]> Softwares of Agnibho - medscript-lite.git/commitdiff
Updated for mpaz 0.3 master
authorAgnibho Mondal <mondal@agnibho.com>
Fri, 10 Nov 2023 19:38:28 +0000 (01:08 +0530)
committerAgnibho Mondal <mondal@agnibho.com>
Fri, 10 Nov 2023 19:38:28 +0000 (01:08 +0530)
README
public/template/default.html
public/template/medcert.html
src/App.vue
src/components/EditScreen.vue
src/components/PrescriberScreen.vue
src/components/RenderScreen.vue

diff --git a/README b/README
index 2498486d13b1e3ffd452877a7a0f1c7bff9dac78..f3376e365fe0b51b7316d3caa105d145965cb672 100644 (file)
--- a/README
+++ b/README
@@ -33,12 +33,12 @@ The structure of the mpaz file is as follows:
     <filename>.mpaz (zipped file)
     |-- meta.json (e.g. {"type": "MedScript", "version": "<mpaz version>"})
     |-- prescription.json (Prescription object in JSON format)
-    |-- template (included template for rendering)
+    |-- template (template for rendering, unsupported in MedScript Lite)
     |   |-- index.html (Jinja2 template)
     |   |-- <other template files e.g. CSS>
     |-- attachment (directory containing attachments)
     |   |-- <attached files>
-    |-- signature (optional: S/MIME signature)
+    |-- signature (optional: S/MIME signature, unsupported in MedScript Lite)
     |-- certificate.pem (optional: full certificate chain including end-user, intermediates and root certificate)
 
 Install
@@ -84,23 +84,27 @@ prescription editing screen will open. The required data can be entered in the
 form.
 
 The parts of a prescription are as follows:
+
 1. ID
-2. Name
-3. Age
-4. Sex
-5. Address
-6. Contact
-7. Diagnosis
-8. Extra (any extra data about the patient. can also be used to certify)
-9. DAW (dispense as written)
-10. Mode (consultation mode e.g. tele-consultation)
-11. Note (clinical notes)
-12. Report (available reports)
-13. Advice
-14. Investigation
-15. Medication
-16. Additional
-17. Attachment (files can be attached with the prescription from this option)
+2. PID
+3. Name
+4. Date of Birth
+5. Age
+6. Sex
+7. Address
+8. Contact
+9. Diagnosis
+10. Extra
+11. DAW (dispense as written)
+12. Mode (consultation mode e.g. tele-consultation)
+13. Note (clinical notes)
+14. Report (available reports)
+15. Advice
+16. Investigation
+17. Medication
+18. Additional
+19. Certificate
+20. Attachment (files can be attached with the prescription from this option)
 
 After editing the "Save" button below can be used to save the data in a
 mpaz file and download it. The "Render" button will render the prescription
@@ -130,7 +134,7 @@ Note that MedScript Lite do not include the templates in the mpaz file.
 
 ### Medical Certificate
 
-The Certify/Extra area can be used to write a medical prescription. Select the
+The certificate text area can be used to write a medical prescription. Select the
 medical certificate template from the edit screen for proper rendering.
 
 Prescriber
@@ -157,12 +161,14 @@ structure of the Prescription object is as follows:
     prescription (Prescription object)
     |-- date (string: date-time in the %Y-%m-%d %H:%M:%S format)
     |-- id (string: the id of the prescription)
+    |-- pid (string: the patient's id)
     |-- name (string: the name of the patient)
+    |-- dob (string: the date of birth)
     |-- age (string: the age of the patient, may contain unit)
     |-- sex (string: sex of the patient)
     |-- address (string: address of the patient)
     |-- contact (string: contact number / email of the patient)
-    |-- extra (string: extra data related to the prescription, may also be used for writing certificates)
+    |-- extra (string: extra data related to the prescription)
     |-- mode (string: the mode of consultation e.g. tele-consultation)
     |-- daw (boolean: dispense as written)
     |-- diagnosis (string: diagnosis of the patient's condition)
@@ -172,6 +178,9 @@ structure of the Prescription object is as follows:
     |-- investigation (string: investigations suggested for the patient)
     |-- medication (string: the list of medications prescribed)
     |-- additional (string: any additional advice/instructions)
+    |-- certificate (string: content of a medical certificate)
+    |-- custom (list: contents of custom input forms)
+    |-- properties (object: unused, included for future/plugin use)
     |-- prescriber (Prescriber object)
     |   |-- name (string: the name of the prescriber)
     |   |-- qualification (string: the qualification of the prescriber)
@@ -179,6 +188,7 @@ structure of the Prescription object is as follows:
     |   |-- address (string: the address of the prescriber)
     |   |-- contact (string: contact number / email of the prescriber)
     |   |-- extra (string: any extra data about the prescriber)
+    |   |-- properties (object: unused, included for future/plugin use)
 
 Website
 -------
index dc86644079f77d44aaab4aade792a9af2e057a50..f896eb6d95829ab6be653039508272f3b6550796 100644 (file)
@@ -40,11 +40,15 @@ You should have received a copy of the GNU General Public License along with Med
               <td>
                 <table class="table">
                   <tr>
-                    <td class="text-end" colspan="3"><small>{% if id %}ID: {{id}}{% endif %}</small></td>
+                    <td class="text-end" colspan="3"><small>{% if id %}<strong>ID:</strong> {{id}}{% endif %} {% if pid %}<strong>PID:</strong> {{pid}}{% endif %}</small></td>
                   </tr>
                   <tr>
                     <td><p><strong>Name:</strong> {{name}}</p></td>
+                    {% if age %}
                     <td><p><strong>Age:</strong> {{age}}</p></td>
+                    {% else %}
+                    <td><p><strong>Date of Birth:</strong> {{dob|date("MMMM DD, YYYY")}}</p></td>
+                    {% endif %}
                     <td><p><strong>Sex:</strong> {{sex}}</p></td>
                   </tr>
                   <tr>
@@ -96,7 +100,7 @@ You should have received a copy of the GNU General Public License along with Med
       <div class="footer" style="position:fixed;bottom:0;width:95%;left:50%; transform:translateX(-50%);background:white;bottom:0;border-top:2px solid black;height:100px">
         <table class="table">
           <tr><td class="col-sm-8">{% if mode %}Consultation: {{mode}}{% endif %}<br>{% if daw %}Dispense as written{% endif %}</td><td class="col-sm-4"><br><br></td></tr>
-          <tr><td><p>{{date|date("YYYY-MM-DDTHH:mm:ss")}}</p></td><td class="text-center" style="border-top: 2px solid gray"><p>Signature</p></td></tr>
+          <tr><td><p>{{date|date("MMMM DD, YYYY hh:mm a")}}</p></td><td class="text-center" style="border-top: 2px solid gray"><p>Signature</p></td></tr>
         </table>
       </div>
     </div>
index c81e76e9c09fc7aceb754d897f5df81d7faef550..3dd4f1c94155dd0304bbc7597c3957c4eea1674f 100644 (file)
@@ -40,11 +40,15 @@ You should have received a copy of the GNU General Public License along with Med
               <td>
                 <table class="table">
                   <tr>
-                    <td class="text-end" colspan="3"><small>{% if id %}ID: {{id}}{% endif %}</small></td>
+                    <td class="text-end" colspan="3"><small>{% if id %}<strong>ID:</strong> {{id}}{% endif %} {% if pid %}<strong>PID:</strong> {{pid}}{% endif %}</small></td>
                   </tr>
                   <tr>
                     <td><p><strong>Name:</strong> {{name}}</p></td>
+                    {% if age %}
                     <td><p><strong>Age:</strong> {{age}}</p></td>
+                    {% else %}
+                    <td><p><strong>Date of Birth:</strong> {{dob|date("MMMM DD, YYYY")}}</p></td>
+                    {% endif %}
                     <td><p><strong>Sex:</strong> {{sex}}</p></td>
                   </tr>
                   <tr>
@@ -56,7 +60,7 @@ You should have received a copy of the GNU General Public License along with Med
                     <td>{% if diagnosis %}<strong>Provisional Diagnosis: {{diagnosis}}</strong>{% endif %}</td>
                   </tr>
                   <tr>
-                    <td><pre class="text-justify">{{extra}}</p></td>
+                    <td><pre class="text-justify">{{certificate}}</p></td>
                   </tr>
                 </table>
               </td>
@@ -68,7 +72,7 @@ You should have received a copy of the GNU General Public License along with Med
       <div class="footer" style="position:fixed;bottom:0;width:95%;left:50%; transform:translateX(-50%);background:white;bottom:0;border-top:2px solid black;height:100px">
         <table class="table">
           <tr><td class="col-sm-8">{% if mode %}Consultation: {{mode}}{% endif %}<br>{% if daw %}Dispense as written{% endif %}</td><td class="col-sm-4"><br><br></td></tr>
-          <tr><td><p>{{date|date("YYYY-MM-DDTHH:mm:ss")}}</p></td><td class="text-center" style="border-top: 2px solid gray"><p>Signature</p></td></tr>
+          <tr><td><p>{{date|date("MMMM DD, YYYY hh:mm a")}}</p></td><td class="text-center" style="border-top: 2px solid gray"><p>Signature</p></td></tr>
         </table>
       </div>
     </div>
index d0fe856bb7e7121a8b5699941713acd937e02d77..3e64da16cd1fa748fff31c8c8a28f36989ad1cf7 100644 (file)
@@ -19,7 +19,7 @@ You should have received a copy of the GNU General Public License along with Med
                        <home-screen @openPrescription="loadPrescription" @openAttachment="loadAttachment" @newFile="newFile" @editPrescriber="editPrescriber" v-show="showComponent.home"></home-screen><br>
                        <edit-screen @renderPrescription="renderPrescription" @cancel="cancelEdit" :openedPrescription="openedPrescription" :openedAttachment="openedAttachment" v-show="showComponent.edit"></edit-screen>
                        <render-screen :prescription="prescription" :template="template" @closeRender="closeRender" v-show="showComponent.render"></render-screen>
-                       <prescriber-screen @cancel="cancelPrescriber" v-show="showComponent.prescriber"></prescriber-screen>
+                       <prescriber-screen @save="closePrescriber" @cancel="closePrescriber" v-show="showComponent.prescriber"></prescriber-screen>
                        <div v-show="!showComponent.render">
                                <hr>
                        </div>
@@ -81,7 +81,6 @@ You should have received a copy of the GNU General Public License along with Med
                                this.showComponent.render=true;
                        },
                        closeRender() {
-                               console.log("close")
                                this.showComponent.render=false;
                                this.showComponent.edit=true;
                        },
@@ -93,7 +92,7 @@ You should have received a copy of the GNU General Public License along with Med
                                this.showComponent.home=false;
                                this.showComponent.prescriber=true;
                        },
-                       cancelPrescriber() {
+                       closePrescriber() {
                                this.showComponent.prescriber=false;
                                this.showComponent.home=true;
                        },
index 9770b9b0663a46ab9e077b7958747d1f11900311..02262cb8d0782c1cc1443d8ec4894ef359721b63 100644 (file)
@@ -22,6 +22,12 @@ You should have received a copy of the GNU General Public License along with Med
                                        <input type="text" class="form-control" id="id" v-model="prescription.id">
                                </div>
                        </div>
+                       <div class="form-group row mb-2">
+                               <label for="pid" class="col-sm-2">PID:</label>
+                               <div class="col-sm-10">
+                                       <input type="text" class="form-control" id="pid" v-model="prescription.pid">
+                               </div>
+                       </div>
                        <div class="form-group row mb-2">
                                <label for="name" class="col-sm-2">Name:</label>
                                <div class="col-sm-10">
@@ -29,6 +35,24 @@ You should have received a copy of the GNU General Public License along with Med
                                </div>
                        </div>
                        <div class="form-group row mb-2">
+                               <div class="col-sm-10 offset-sm-2">
+                                       <div class="form-check form-check-inline">
+                                               <input class="form-check-input" type="radio" id="ageDob2" name="ageDob" value="dob" v-model="ageDob">
+                                               <label class="form-check-label" for="ageDob2">Date of Birth</label>
+                                       </div>
+                                       <div class="form-check form-check-inline">
+                                               <input class="form-check-input" type="radio" id="ageDob1" name="ageDob" value="age" v-model="ageDob">
+                                               <label class="form-check-label" for="ageDob1">Age</label>
+                                       </div>
+                               </div>
+                       </div>
+                       <div class="form-group row mb-2" :class="{'d-none':ageDob!='dob'}">
+                               <label for="dob" class="col-sm-2">Date of Birth:</label>
+                               <div class="col-sm-10">
+                                       <input type="date" class="form-control" id="dob" v-model="prescription.dob">
+                               </div>
+                       </div>
+                       <div class="form-group row mb-2" :class="{'d-none':ageDob!='age'}">
                                <label for="age" class="col-sm-2">Age:</label>
                                <div class="col-sm-10">
                                        <input type="text" class="form-control" id="age" v-model="prescription.age">
@@ -59,7 +83,7 @@ You should have received a copy of the GNU General Public License along with Med
                                </div>
                        </div>
                        <div class="form-group row mb-2">
-                               <label for="extra" class="col-sm-2">Extra/Certificate:</label>
+                               <label for="extra" class="col-sm-2">Extra:</label>
                                <div class="col-sm-10">
                                        <textarea class="form-control" id="extra" v-model="prescription.extra"></textarea>
                                </div>
@@ -122,6 +146,13 @@ You should have received a copy of the GNU General Public License along with Med
                                </div>
                        </div>
                        <hr>
+                       <div class="form-group row">
+                               <label for="certificate" class="col-sm-2">Certificate:</label>
+                               <div class="col-sm-10">
+                                       <textarea class="form-control" id="certificate" v-model="prescription.certificate"></textarea>
+                               </div>
+                       </div>
+                       <hr>
                        <div class="form-group row mb-2">
                                <label for="attachment" class="col-sm-2">Attachments:</label>
                                <div class="col-sm-10">
@@ -174,6 +205,7 @@ You should have received a copy of the GNU General Public License along with Med
                data() {
                        return {
                                prescription: this.newData(),
+                               ageDob: "age",
                                attachment: [],
                                selected: 0,
                                template: "default"
@@ -184,7 +216,9 @@ You should have received a copy of the GNU General Public License along with Med
                                var prescription={
                                        date: new Date(new Date() - new Date().getTimezoneOffset() * 60000).toISOString().split(".")[0],
                                        id: "",
+                                       pid: "",
                                        name: "",
+                                       dob: "",
                                        age: "",
                                        sex: "",
                                        address: "",
@@ -199,26 +233,33 @@ You should have received a copy of the GNU General Public License along with Med
                                        investigation: "",
                                        medication: "",
                                        additional: "",
+                                       certificate: "",
                                        attachment: "",
+                                       custom: null,
+                                       properties: null,
                                        prescriber: this.loadPrescriber()
                                };
                                return prescription;
                        },
                        saveData() {
-                               var prescription=JSON.stringify(this.prescription, null, 2);
                                var filename=""
+                               this.prescription.date=this.prescription.date.replace("T", " ")
                                if(this.prescription.id){
                                        filename=this.prescription.id.name.replace(/ +/g, "_")
                                }
-                               else if(this.prescription.name){
-                                       filename=this.prescription.name.replace(/ +/g, "_")
-                               }
                                else {
                                        filename="prescription"
                                }
+                               if(this.dobAge=="dob"){
+                                       this.prescription.age=""
+                               }
+                               else{
+                                       this.prescription.dob=""
+                               }
+                               var prescription=JSON.stringify(this.prescription, null, 2);
                                var zipfile=new JSZip();
                                zipfile.file("prescription.json", prescription);
-                               zipfile.file("meta.json", JSON.stringify({"type": "MedScript", "version": "0.2"}))
+                               zipfile.file("meta.json", JSON.stringify({"type": "MedScript", "version": "0.3"}))
                                this.attachment.forEach((item) => {
                                        zipfile.file("attachment/"+item.name, item.content)
                                });
@@ -278,6 +319,11 @@ You should have received a copy of the GNU General Public License along with Med
                        openedPrescription: function(){
                                if(this.openedPrescription) {
                                        this.prescription=structuredClone(this.openedPrescription)
+                                       if(JSON.stringify(this.prescription.prescriber)!=JSON.stringify(this.loadPrescriber())){
+                                               if(confirm("Original prescriber and current prescriber are different. Replace original with current?")){
+                                                       this.prescription.prescriber=this.loadPrescriber()
+                                               }
+                                       }
                                }
                                else {
                                        this.prescription=this.newData()
index b70056cae33bdf1b61482f2c5339e98b2ab776ed..f0be3bba28d366ad6214a0ffe5c000fee57b1846 100644 (file)
@@ -16,6 +16,12 @@ You should have received a copy of the GNU General Public License along with Med
                                        <input type="text" class="form-control" id="name" v-model="prescriber.name">
                                </div>
                        </div>
+                       <div class="form-group row mb-2">
+                               <label for="qualification" class="col-sm-2">Qualification:</label>
+                               <div class="col-sm-10">
+                                       <input type="text" class="form-control" id="qualification" v-model="prescriber.qualification">
+                               </div>
+                       </div>
                        <div class="form-group row mb-2">
                                <label for="registration" class="col-sm-2">Registration:</label>
                                <div class="col-sm-10">
@@ -47,6 +53,9 @@ You should have received a copy of the GNU General Public License along with Med
                                <div class="col-sm-3 d-grid gap-2">
                                        <button type="button" @click="cancel" class="btn btn-warning">Cancel</button>
                                </div>
+                               <div class="col-sm-3 d-grid gap-2">
+                                       <button type="button" @click="reset" class="btn btn-danger">Reset</button>
+                               </div>
                        </div>
                </form>
        </div>
@@ -66,15 +75,19 @@ You should have received a copy of the GNU General Public License along with Med
                                        prescriber=JSON.parse(localStorage.getItem("prescriber"));
                                }
                                catch {
-                                       prescriber={name: "", registration: "", address: "", contact: "", extra: ""}
+                                       prescriber={name: "", qualification: "", registration: "", address: "", contact: "", extra: "", properties: null}
                                }
                                return prescriber;
                        },
                        save() {
                                localStorage.setItem("prescriber", JSON.stringify(this.prescriber));
+                               this.$emit("save");
                        },
                        cancel() {
                                this.$emit("cancel");
+                       },
+                       reset() {
+                               this.prescriber={name: "", qualification: "", registration: "", address: "", contact: "", extra: "", properties: null}
                        }
                }
        }
index 33cc27ca2d9b28fbe059edaa66dffbb2aaf5a78a..899a78b15e477dd4e194497120322ce9d07b9ac0 100644 (file)
@@ -25,8 +25,6 @@ You should have received a copy of the GNU General Public License along with Med
                },
                methods: {
                        render() {
-                               console.log(this.prescription.prescriber);
-                               console.log(this.template);
                                fetch("template/"+this.template+".html")
                                        .then((response)=>response.text())
                                        .then(function(response) {