|
@@ -1013,17 +1013,28 @@ GROUP BY erx_category");
|
|
|
return true;
|
|
|
},
|
|
|
addExistingDrugToERx: function(_uid) {
|
|
|
+ let existing = this.existingDrugs.filter(_x => {
|
|
|
+ return _x.uid === _uid;
|
|
|
+ });
|
|
|
+ if(!existing || !existing.length) return false;
|
|
|
+ existing = existing[0];
|
|
|
+
|
|
|
+ // require dispense and refills
|
|
|
+ if(!existing.data.dispense) {
|
|
|
+ toastr.error('Dispense cannot be blank');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if(!existing.data.refills) {
|
|
|
+ toastr.error('Refills cannot be blank');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
if(!this.currentPrescription.clinical_detail_json) {
|
|
|
this.currentPrescription.clinical_detail_json = {};
|
|
|
}
|
|
|
if(!this.currentPrescription.clinical_detail_json.items) {
|
|
|
this.currentPrescription.clinical_detail_json.items = [];
|
|
|
}
|
|
|
- let existing = this.existingDrugs.filter(_x => {
|
|
|
- return _x.uid === _uid;
|
|
|
- });
|
|
|
- if(!existing || !existing.length) return false;
|
|
|
- existing = existing[0];
|
|
|
this.currentPrescription.clinical_detail_json.items.push({
|
|
|
medication: existing.data.name,
|
|
|
dispense: existing.data.dispense,
|