Browse Source

协定方 / 统建处方 转方逻辑修改:

1. 若所有药品都有 matid ,则同 方剂 换方 (changePre)
2. 否则同原逻辑(changeBasisPre -> changeDrug)
cc12458 1 year ago
parent
commit
b8d077ab92

+ 2 - 1
src/utils/minix/prescribing.js

@@ -113,7 +113,8 @@ export default {
         },
         // 我的协定方转方
         agreeTurnRecipe(agreeInfo) {
-            this.turnRecipe2(agreeInfo)
+            // this.turnRecipe2(agreeInfo)
+            this.transposition({...agreeInfo, medicine: agreeInfo.preStiDetails, __RecipeFrom__: '2'});
 
             if (agreeInfo.diseaseid) {
                 this.$refs.TCM.setParams({

+ 32 - 3
src/views/diagnosis/Prescribing.vue

@@ -2466,7 +2466,7 @@ export default {
       }, 1000);
     },
     // 协定方数据转方 赋值给中药处方
-    agreeAssignToTCM(data, loading) {
+    agreeAssignToTCM(data, loading, request = true) {
       let children = this.$children.filter(item => {
         return (
           item.name == "中药处方" ||
@@ -2514,6 +2514,8 @@ export default {
 
       data1.recipe_tabs[data1.recipe_tabs_c].totalTableD = [];
 
+      if (!request) return;
+
       // 赋值给表格
       data.preStiDetails.forEach((item, index) => {
         let obj1 = {
@@ -2788,7 +2790,34 @@ export default {
       this.showRecord = false;
       this.showAgree = false;
     },
-    // 协定方转方
+    transposition(recipe) {
+     const is = recipe.medicine.every(m => m.matid);
+     if (is) {
+       // 调用 方剂 换方
+       const medicine = recipe.medicine.map((m, i) => {
+         return {
+           matid: m.matid,
+           matname: m.ypmc,
+           dose: m.dose,
+           unit: m.dw || m.zxdw || m.bzdw,
+           useage: m.usagestr,
+           seqn: i + 1,
+         }
+       });
+       if (recipe.__RecipeFrom__ === '2') this.agreeAssignToTCM(recipe, void 0, true);
+       this.setDrugsInfo(medicine);
+       this.changeAndJoin(1);
+     } else if (recipe.__RecipeFrom__ === '2') {
+       this.agreeInfo = recipe;
+       this.changeBasisPre(this.agreeInfo.pid);
+     }
+     if (recipe.__RecipeFrom__) this.addRecipeFrom(recipe.__RecipeFrom__ /* 2 协定方*/);
+    },
+
+    /**
+     * 协定方转方
+     * @deprecated
+     */
     turnRecipe2() {
       this.addRecipeFrom("2");
       this.changeBasisPre(this.agreeInfo.pid);
@@ -3387,7 +3416,7 @@ export default {
             this.rDoctorCase.page += 1;
           }
         } else {
-          this.rPrescriprDoctorCasetion.loadMore = false;
+          this.rPrescriprDoctorCasetion = { ...this.rPrescriprDoctorCasetion, loadMore: false, };
         }
       }
     },

+ 4 - 2
src/views/diagnosis/components/prescription-unify.vue

@@ -207,8 +207,10 @@ export default {
         pid: id
       });
       if (res.ResultCode == 0) {
-        this.$parent.$parent.$parent.agreeInfo = res.Data;
-        this.$parent.$parent.$parent.turnRecipe2(res.Data);
+        // this.$parent.$parent.$parent.agreeInfo = res.Data;
+        // this.$parent.$parent.$parent.turnRecipe2(res.Data);
+        const recipe = { ...res.Data, medicine: res.Data.preStiDetails, __RecipeFrom__: '2' }
+        this.$parent.$parent.$parent.transposition(recipe);
         if (res.Data.diseaseid) {
           this.$parent.$parent.$parent.$refs.TCM.setParams({
             namemedicine: res.Data.diseasename,

+ 4 - 2
src/views/diagnosis/components/prescription.vue

@@ -245,8 +245,10 @@ export default {
         pid: id
       });
       if (res.ResultCode == 0) {
-        this.$parent.$parent.$parent.agreeInfo = res.Data;
-        this.$parent.$parent.$parent.turnRecipe2(res.Data);
+        // this.$parent.$parent.$parent.agreeInfo = res.Data;
+        // this.$parent.$parent.$parent.turnRecipe2(res.Data);
+        const recipe = { ...res.Data, medicine: res.Data.preStiDetails, __RecipeFrom__: '2' }
+        this.$parent.$parent.$parent.transposition(recipe);
         if (res.Data.diseaseid) {
           this.$parent.$parent.$parent.$refs.TCM.setParams({
             namemedicine: res.Data.diseasename,