Просмотр исходного кода

药品转换接口增加剂量计算

/test/outpatient/changeDrug
/test/outpatient/changePre
cc12458 1 год назад
Родитель
Сommit
15d38e7b8f

+ 7 - 3
src/components/ChineseMedicine.vue

@@ -993,6 +993,7 @@ import { debounce } from "@/utils/format.js";
 import { mapState, mapGetters, mapActions, mapMutations } from "vuex";
 import popup from "@/components/Propup.vue";
 import accompanied from "./ui/accompanied.vue";
+import {CC_Dosage2Basis} from '@/utils/medicine';
 
 let medicineBlurTimer;
 export default {
@@ -1849,6 +1850,8 @@ export default {
         showSearch: false,
         showDoseSection: false // 展示剂量区间
       };
+      obj.ggnum = +item.ggnum || 1;
+      obj.xbzxs = +item.xbzxs || '34'.includes(item.zylx) ? obj.ggnum : 1;
       Object.assign(totalData[scope.row.id - 1], obj);
 
       // 调用 父级合理用药接口
@@ -2459,14 +2462,14 @@ export default {
 
       this.recipe_tabs[this.recipe_tabs_c].totalTableD.forEach(item => {
         if (item.name) {
+          item.oldDose = CC_Dosage2Basis(item);
           let idDose =
             item.medid +
             "&" +
-            (item.dose || item.oldDose) +
+            item.oldDose +
             "&" +
             (item.usage || "");
           // drugIds.push(item.medid)
-          item.oldDose = item.dose;
           drugIds.push(idDose);
         }
       });
@@ -2526,7 +2529,8 @@ export default {
                     oldDose: item1.oldDose
                   };
                   /* 修正 */ item1.usage = item1.useage = getUsage(item1.usage);
-
+                  item1.ggnum = +item.ggnum || 1;
+                  item1.xbzxs = +item.xbzxs || '34'.includes(item.zylx) ? item1.ggnum : 1;
                   item1.color = item.kc > 0 ? "#000" : 'red';
                 }
 

+ 4 - 1
src/components/MedicineAccord.vue

@@ -1329,6 +1329,8 @@ export default {
         showSearch: false,
         showDoseSection: false // 展示剂量区间
       };
+      obj.ggnum = +item.ggnum || 1;
+      obj.xbzxs = +item.xbzxs || '34'.includes(item.zylx) ? obj.ggnum : 1;
       Object.assign(totalData[scope.row.id - 1], obj);
 
       // 调用 父级合理用药接口
@@ -1980,7 +1982,8 @@ export default {
                     oldDose: item1.oldDose
                   };
                   /* 修正 */ item1.usage = item1.useage = getUsage(item1.usage);
-
+                  item1.ggnum = +item.ggnum || 1;
+                  item1.xbzxs = +item.xbzxs || '34'.includes(item.zylx) ? item1.ggnum : 1;
                   item1.color = "#000";
                 }
 

+ 8 - 3
src/components/ui/accompanied.vue

@@ -31,6 +31,7 @@
         changeAndJoin,
 
     } from "@/api/knowledge.js";
+    import {CC_Dosage2Basis} from '@/utils/medicine';
     accompaniedData.forEach(item => {
         item.child.forEach(item1 => {
             item1.child.forEach(item2 => {
@@ -152,7 +153,8 @@
 
                 let ids = [];
                 drugs.forEach(item => {
-                    let idDose = item.pid + "&" + (item.dose || 0);
+                    item.oldDose = CC_Dosage2Basis(item);
+                    let idDose = item.pid + "&" + (item.oldDose || 0);
                     ids.push(idDose);
                 });
 
@@ -203,12 +205,14 @@
                                     key: "",
                                     search_i: index
                                 };
-
+                                obj.oldDose = item1.oldDose;
                                 noDrugs.push(obj);
                                 // noDrugs.push(item1.matname)
                             }
 
                             if (item instanceof Object && item.oldYpid == item1.matid) {
+                                item.ggnum = +item.ggnum || 1;
+                                item.xbzxs = +item.xbzxs || '34'.includes(item.zylx) ? item.ggnum : 1;
                                 hasDrugs.push(item);
                             }
                         });
@@ -248,7 +252,8 @@
                                 originname: item.cdmc, // 产地名称
                                 showSearch: false
                             };
-
+                            obj1.ggnum = +item.ggnum || 1;
+                            obj1.xbzxs = +item.xbzxs || '34'.includes(item.zylx) ? obj1.ggnum : 1;
                             parent.recipe_tabs[parent.recipe_tabs_c].totalTableD.push(obj1);
                             parent.getSelectType("中药药品用法", index);
                         });

+ 26 - 0
src/utils/medicine.js

@@ -0,0 +1,26 @@
+/**
+ * 药品输入剂量通过转换系数成基础剂量
+ * @param medicine 药品
+ * @param {number} medicine.dose 输入剂量
+ * @param {number} medicine.xbzxs 转换系数
+ * @returns {number} 基础剂量
+ */
+export function CC_Dosage2Basis({dose = 0, xbzxs = 1}) {
+    console.log('log-->CC_Dosage2Basis', `dose: ${dose}, xbzxs: ${xbzxs}`);
+    if (!xbzxs || xbzxs === 1) return dose;
+    return dose * xbzxs;
+}
+
+/**
+ * 药品基础剂量通过转换系数成输入剂量
+ * @param medicine 药品
+ * @param {number} medicine.oldDose 基础剂量
+ * @param {number} medicine.xbzxs 转换系数
+ * @param {boolean=false} keep 保留计算结果
+ * @returns {number} 输入剂量
+ */
+export function CC_Basis2Dosage({oldDose = 0, xbzxs = 1}, keep = false) {
+    console.log('log-->CC_Basis2Dosage', `basis: ${oldDose}, xbzxs: ${xbzxs}`);
+    if (!xbzxs || xbzxs === 1) return oldDose;
+    return oldDose / xbzxs;
+}

+ 5 - 1
src/views/business/ExperienceAdd.vue

@@ -263,6 +263,7 @@ import {
   getExperinceDetail,
   editExperince
 } from "@/api/business";
+import {CC_Dosage2Basis} from '@/utils/medicine';
 
 export default {
   components: {
@@ -863,7 +864,8 @@ export default {
 
       this.totalTableD.forEach(item => {
         if (item.name) {
-          let idDose = item.medid + "&" + item.dose;
+          item.oldDose = CC_Dosage2Basis(item);
+          let idDose = item.medid + "&" + item.oldDose;
           // drugIds.push(item.medid)
           drugIds.push(idDose);
         }
@@ -923,6 +925,8 @@ export default {
                 item1.showSearch = false;
 
                 item1.color = "#000";
+                item1.ggnum = +item.ggnum || 1;
+                item1.xbzxs = +item.xbzxs || '34'.includes(item.zylx) ? item1.ggnum : 1;
               }
 
               this.$set(this.totalTableD, index1, item1);

+ 20 - 6
src/views/diagnosis/Prescribing.vue

@@ -1183,6 +1183,7 @@ import { setTimeout } from "timers";
 import prescribing from "../../utils/minix/prescribing";
 
 import {formatPicture} from "@/utils/picture";
+import {CC_Dosage2Basis} from '@/utils/medicine';
 
 export default {
   mixins: [prescribing],
@@ -2542,7 +2543,8 @@ export default {
           originname: item.cdmc, // 产地名称
           showSearch: false
         };
-
+        obj1.ggnum = +item.ggnum || 1;
+        obj1.xbzxs = +item.xbzxs || '34'.includes(item.zylx) ? obj1.ggnum : 1;
         data1.recipe_tabs[data1.recipe_tabs_c].totalTableD.push(obj1);
         data1.getSelectType("中药药品用法", index);
       });
@@ -2828,8 +2830,8 @@ export default {
      const is = recipe.medicine.every(m => m.matid);
      if (is) {
        // 调用 方剂 换方
-       const medicine = recipe.medicine.map((m, i) => {
-         return {
+       const medicines = recipe.medicine.map((m, i) => {
+         const medicine = {
            matid: m.matid,
            matname: m.ypmc,
            dose: m.dose,
@@ -2837,9 +2839,12 @@ export default {
            useage: m.usagestr,
            seqn: i + 1,
          }
+         medicine.ggnum = +m.ggnum || 1;
+         medicine.xbzxs = +m.xbzxs || '34'.includes(m.zylx) ? medicine.ggnum : 1;
+         return medicine;
        });
        if (recipe.__RecipeFrom__ === '2') this.agreeAssignToTCM(recipe, void 0, true);
-       this.setDrugsInfo(medicine);
+       this.setDrugsInfo(medicines);
        this.changeAndJoin(1);
      } else if (recipe.__RecipeFrom__ === '2') {
        this.agreeInfo = recipe;
@@ -2930,7 +2935,8 @@ export default {
           originname: item.cdmc, // 产地名称
           showSearch: false
         };
-
+        obj1.ggnum = +item.ggnum || 1;
+        obj1.xbzxs = +item.xbzxs || '34'.includes(item.zylx) ? obj1.ggnum : 1;
         data1.recipe_tabs[data1.recipe_tabs_c].totalTableD.push(obj1);
         data1.getSelectType("中药药品用法", index);
       });
@@ -4009,7 +4015,8 @@ export default {
 
       let ids = [];
       drugs.forEach(item => {
-        let idDose = item.matid + "&" + item.dose + "&" + (item.useage || "");
+        item.oldDose = CC_Dosage2Basis(item);
+        let idDose = item.matid + "&" + item.oldDose + "&" + (item.useage || "");
         ids.push(idDose);
       });
 
@@ -4067,12 +4074,15 @@ export default {
                   key: "",
                   search_i: index
                 };
+                obj.oldDose = item1.oldDose;
                 /* 修正 */ obj.usage = obj.useage = getUsage(obj.usage);
                 noDrugs.push(obj);
                 // noDrugs.push(item1.matname)
               }
 
               if (item instanceof Object && item.oldYpid == item1.matid) {
+                item.ggnum = +item.ggnum || 1;
+                item.xbzxs = +item.xbzxs || '34'.includes(item.zylx) ? item.ggnum : 1;
                 if (item.kc > 0) hasDrugs.push(item);
                 else {
                   item.color = 'red';
@@ -4111,6 +4121,8 @@ export default {
                 color: item.color ? item.color : "#000"
               };
               /* 修正 */ obj1.usage = obj1.useage = getUsage(obj1.usage);
+              obj1.ggnum = +item.ggnum || 1;
+              obj1.xbzxs = +item.xbzxs || '34'.includes(item.zylx) ? obj1.ggnum : 1;
 
               child.recipe_tabs[child.recipe_tabs_c].totalTableD.push(obj1);
               child.getSelectType("中药药品用法", index);
@@ -4196,6 +4208,8 @@ export default {
                 showSearch: false
               };
               /* 修正 */ obj1.usage = obj1.useage = getUsage(obj1.usage);
+              obj1.ggnum = +item.ggnum || 1;
+              obj1.xbzxs = +item.xbzxs || '34'.includes(item.zylx) ? obj1.ggnum : 1;
 
               child.recipe_tabs[child.recipe_tabs_c].totalTableD.push(obj1);
               child.getSelectType("中药药品用法", index);