From: Agnibho Mondal Date: Sun, 11 Dec 2016 09:39:16 +0000 (+0530) Subject: Show dosage rate X-Git-Url: https://code.agnibho.com/repo?p=pdosage.git;a=commitdiff_plain;h=3e56961c7a8fae9c86443d987af1e0c35eae502b Show dosage rate --- diff --git a/index.html b/index.html index 517db77..b6a1203 100755 --- a/index.html +++ b/index.html @@ -68,7 +68,7 @@

PDosage

-

Pediatric Dose Calculator

+

Drug Dose Calculator

diff --git a/src/AboutView.vue b/src/AboutView.vue index 72dc6c6..82994b1 100644 --- a/src/AboutView.vue +++ b/src/AboutView.vue @@ -30,11 +30,13 @@
-

About PDosage

+

About PDosage

PDosage is a web application for calculating dosage of some commonly used drugs. Although it's primarily designed for the practice of Pediatrics, it also provides adult doses of drugs, making it useful for other disciplines too.

PDosage is written in Javascript.

+

App Version:

+

Data version:

Copyright © 2016 Agnibho Mondal

E-mail: mail@agnibho.com

diff --git a/src/DataInput.vue b/src/DataInput.vue index 9ac78aa..4b21cf2 100644 --- a/src/DataInput.vue +++ b/src/DataInput.vue @@ -75,10 +75,10 @@ props:["patient"], data:function(){ return{ - inWt: "", - inAgeY: "", - inAgeM: "", - inAgeD: "" + inWt: this.patient.wt, + inAgeY: this.patient.age.y, + inAgeM: this.patient.age.m, + inAgeD: this.patient.age.d } }, watch: { diff --git a/src/Dosage.js b/src/Dosage.js new file mode 100644 index 0000000..672ea52 --- /dev/null +++ b/src/Dosage.js @@ -0,0 +1,220 @@ +/********************************************************************** + * Title: PDosage + * Description: Pediatric Calculator + * Author: Agnibho Mondal + * Website: http://code.agnibho.com + ********************************************************************** + Copyright (c) 2016 Agnibho Mondal + All rights reserved + ********************************************************************** + This file is part of PDosage. + + PDosage is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + PDosage is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with PDosage. If not, see . + **********************************************************************/ + +export default function Dosage(data){ + + Object.defineProperty(data, "prop", { + writable: false + }); + + this.get=function(){ + return data; + } + + this.listDrugs=function(){ + var list=data.map(function(obj){ + return obj.name; + }); + return list; + } + + this.getDrug=function(name, patient){ + if(this.listDrugs().indexOf(name)==-1){ + return null; + } + var drug=JSON.parse(JSON.stringify(data.filter(extract)[0])); + function extract(obj){ + return (obj.name == name); + } + for(var i=0; i=min && patient.wt=min && pDaysdose.adult[0]){ + dose.val[0]=dose.adult[0]; + } + if(dose.val[1]>dose.adult[1]){ + dose.val[1]=dose.adult[1]; + } + } + if(dose.limit && dose.val){ + if(dose.val[0]>dose.limit[0]){ + dose.val[0]=dose.limit[0]; + } + if(dose.val[1]>dose.limit[1]){ + dose.val[1]=dose.limit[1]; + } + } + if(dose.val[1]==dose.val[0]){ + dose.val[1]=null; + } + return dose; + } + } +} diff --git a/src/DrugView.vue b/src/DrugView.vue index 3ba5928..6bcf5ce 100644 --- a/src/DrugView.vue +++ b/src/DrugView.vue @@ -71,10 +71,24 @@