소스 검색

6 智能开方保存处方时,进行安全合理用药检测提醒判断

cc12458 1 년 전
부모
커밋
32e65b1b12
3개의 변경된 파일179개의 추가작업 그리고 3개의 파일을 삭제
  1. 8 0
      src/api/diagnosis.js
  2. 15 1
      src/utils/minix/prescribing.js
  3. 156 2
      src/views/diagnosis/Prescribing.vue

+ 8 - 0
src/api/diagnosis.js

@@ -448,6 +448,14 @@ export function getMaxMinDoaseNumber(data) {
     })
     })
 }
 }
 
 
+// 获取合理安全用药规则
+export async function getRationalSafeUse() {
+    return request({
+        url: '/basis/medicalInsuranceRegulationMgr/minimumAndMaximumDosageNumber',
+        method: 'post',
+    })
+}
+
 export function getTongueAndFaceAnalysis(data) {
 export function getTongueAndFaceAnalysis(data) {
     return request({
     return request({
         url: '/outpatient/electronicmedicalrecordMgr/getTongueFaceAnalysisResult',
         url: '/outpatient/electronicmedicalrecordMgr/getTongueFaceAnalysisResult',

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

@@ -1,4 +1,4 @@
-import { getMaxMinDoaseNumber } from '@/api/diagnosis.js'
+import { getMaxMinDoaseNumber, getRationalSafeUse } from '@/api/diagnosis.js'
 
 
 export default {
 export default {
     data() {
     data() {
@@ -9,6 +9,8 @@ export default {
             showSafeD: false, // 安全合理用药
             showSafeD: false, // 安全合理用药
             isShrink: false, // 是否是收缩状态
             isShrink: false, // 是否是收缩状态
 
 
+            saving: false,
+
             // 中药处方 中成药处方 适宜技术处方提交前暂存
             // 中药处方 中成药处方 适宜技术处方提交前暂存
             zhongPrescriptionVo: null,
             zhongPrescriptionVo: null,
             chengPrescriptionVo: null,
             chengPrescriptionVo: null,
@@ -178,6 +180,18 @@ export default {
             this.djChange(model.isDaiJian)
             this.djChange(model.isDaiJian)
             this.showAddress = false;
             this.showAddress = false;
         },
         },
+        // 获取合理安全用药提醒配置
+        async getRationalSafeUse() {
+            try {
+                const res = await getRationalSafeUse();
+                return {
+                    options: res.Data.rational_safe.split(',').filter(Boolean),
+                    force: +res.Data.rational_safe_mandatoryOrNot === 1 // 0 否(可以继续开方) 1是(不可以继续开方)
+                }
+            } catch (e) {
+                return {options: [], force: false,}
+            }
+        },
         // 获取医保规则最大/最小药味数
         // 获取医保规则最大/最小药味数
         async getMaxMinDoaseNumber() {
         async getMaxMinDoaseNumber() {
             let res = await getMaxMinDoaseNumber()
             let res = await getMaxMinDoaseNumber()

+ 156 - 2
src/views/diagnosis/Prescribing.vue

@@ -2595,8 +2595,37 @@ export default {
       );
       );
     },
     },
     // 提交中药处方
     // 提交中药处方
-    submitRecipe1() {
+    async submitRecipe1() {
       let zhongPrescriptionVo = this.dealRecipe1();
       let zhongPrescriptionVo = this.dealRecipe1();
+      if (!zhongPrescriptionVo.length) return;
+
+      this.saving = true;
+      try {
+        const {options, force} = await this.getRationalSafeUse();
+        if (options.length) {
+          const child = this.$children.find(item => item.name === "中药处方");
+          const results = await Promise.all(child.recipe_tabs.map((_, index) => this.getRationalMed2(index)));
+          let i = 1;
+          for (const item of results) {
+            const rationalMed = options.map(i => item[i]).filter(Boolean);
+            if (!rationalMed.length) continue;
+
+            this.$message({
+              dangerouslyUseHTMLString: true,
+              customClass: 'message-rational-safe-use-wrapper',
+              message: `<h2 style="margin-bottom: 16px;">${item.title}</h2>` + rationalMed.map(item => {
+                return `<div class="title">${item.title}</div><div class="content">${item.collection.join('')}</div>`
+              }).join(''),
+              duration: 1000 * 3 * i++,
+              showClose: force,
+            })
+          }
+
+          if (force) return;
+        }
+      } catch (e) {}
+      this.saving = false;
+
       let chengPrescriptionVo = {};
       let chengPrescriptionVo = {};
       // setTimeout(() => {
       // setTimeout(() => {
       //   chengPrescriptionVo = this.dealRecipe2();
       //   chengPrescriptionVo = this.dealRecipe2();
@@ -3421,6 +3450,108 @@ export default {
       }
       }
     },
     },
     // 获取右侧合理用药信息展示
     // 获取右侧合理用药信息展示
+    async getRationalMed2(index) {
+      const child = this.$children.find(item => item.name === "中药处方");
+      if (index == null) index = child.recipe_tabs_c;
+      const gather = child.recipe_tabs[index].totalTableD.filter(item => item.name && item.medid).map(item => item.medid);
+
+      const request = (id, i, ids) => getRationalMed({
+        matID: id,
+        matIds: [...ids.slice(0, i), ...ids.slice(i + 1)],
+        orgId: this.getuserinfo.organizationid,
+      }).then(res => res.code === 0 ? Object.assign({matid: id}, res.data) : null).catch(err => null)
+
+      const rationalMed = await Promise.all(gather.map(request)).then(data => data.filter(Boolean));
+      return rationalMed.reduce((data, item) => {
+        const color = 'blue';
+
+        if (item.matdosage && item.showDose) {
+          const ref = {}, i = 1;
+          const child = data[i] || (data[i] = {title: '', collection: []});
+          child.collection.push(`<div>
+            <span class="met-name" style="color: ${color};">${item.matname}</span>
+            <span class="met-value">${ref[item.matdosage]}</span>
+          </div>`);
+        }
+        if (item.matsjj) {
+          const ref = {1: '慎用', 2: '忌用', 3: '禁用'}, i = 2;
+          const child = data[i] || (data[i] = {title: '慎忌禁用药', collection: []});
+          child.collection.push(`<div>
+            <span class="met-name" style="color: ${color};">${item.matname}</span>
+            <span class="met-value">${ref[item.matsjj]}</span>
+          </div>`);
+        }
+        if (item.matyfsjj) {
+          const color = item.matyfsjj === '3' ? 'red' : 'blue';
+          const ref = {1: '孕妇慎用', 2: '孕妇忌用', 3: '孕妇禁用'}, i = 3;
+          const child = data[i] || (data[i] = {title: '孕妇慎忌禁', collection: []});
+          child.collection.push(`<div>
+            <span class="met-name" style="color: ${color};">${item.matname}</span>
+            <span class="met-value">${ref[item.matyfsjj]}</span>
+          </div>`);
+        }
+        if (item.matysjj) {
+          const ref = {}, i = 4;
+          const child = data[i] || (data[i] = {title: '服药饮食禁忌', collection: []});
+          child.collection.push(`<div>
+            <span class="met-name" style="color: ${color};">${item.matname}</span>
+            <span class="met-value">${item.matysjj || '无'}</span>
+          </div>`);
+        }
+        if (item.matdxsm) {
+          const color = 'red';
+          const ref = {}, i = 5;
+          const child = data[i] || (data[i] = {title: '药物毒性说明', collection: []});
+          child.collection.push(`<div>
+            <span class="met-name" style="color: ${color};">${item.matname}</span>
+            <span class="met-value">${item.matdxsm || '无'}</span>
+          </div>`);
+        }
+        if (item.matbzjj) {
+          const ref = {}, i = 6;
+          const child = data[i] || (data[i] = {title: '病证用药禁忌', collection: []});
+          child.collection.push(`<div>
+            <span class="met-name" style="color: ${color};">${item.matname}</span>
+            <span class="met-value">${item.matbzjj || '无'}</span>
+          </div>`);
+        }
+        if (item.matsbf) {
+          const color = 'red';
+          const ref = {}, i = 7;
+          const child = data[i] || (data[i] = {title: '十八反', collection: []});
+          child.collection.push(`<div>
+            <span class="met-name" style="color: ${color};">${item.matname}</span>
+            <span class="met-value">反${item.matsbf}</span>
+          </div>`);
+        }
+        if (item.matsjw) {
+          const color = 'red';
+          const ref = {}, i = 8;
+          const child = data[i] || (data[i] = {title: '十九畏', collection: []});
+          child.collection.push(`<div>
+            <span class="met-name" style="color: ${color};">${item.matname}</span>
+            <span class="met-value">畏${item.matsjw}</span>
+          </div>`);
+        }
+        if (item.matby) {
+          const ref = {}, i = 9;
+          const child = data[i] || (data[i] = {title: '用药不宜', collection: []});
+          child.collection.push(`<div>
+            <span class="met-name" style="color: ${color};">${item.matname}</span>
+            <span class="met-value">不宜与${item.matby}同用</span>
+          </div>`);
+        }
+        if (item.matmindosage && item.matmaxdosage) {
+          const ref = {}, i = 10;
+          const child = data[i] || (data[i] = {title: '超剂量药品', collection: []});
+          child.collection.push(`<div>
+            <span class="met-name" style="color: ${color};">${item.matname}</span>
+            <span class="met-value" style="color: red;">(${item.matmindosage}-${item.matmaxdosage})</span>
+          </div>`);
+        }
+        return data;
+      }, {title: `中药处方${index + 1}`});
+    },
     async getRationalMed(id) {
     async getRationalMed(id) {
       let ids = [];
       let ids = [];
       // this.rationalMed = []
       // this.rationalMed = []
@@ -5427,10 +5558,33 @@ export default {
 <style lang="scss" scoped>
 <style lang="scss" scoped>
 @import "../../style/media/diagnosis/prescribing.scss";
 @import "../../style/media/diagnosis/prescribing.scss";
 </style>
 </style>
-<style>
+<style lang="scss">
 /* @media screen and (max-width: 768px) {
 /* @media screen and (max-width: 768px) {
   body {
   body {
     width: 100% !important;
     width: 100% !important;
   }
   }
 } */
 } */
+
+.message-rational-safe-use-wrapper {
+  align-items: flex-start;
+  max-height: 80vh;
+  overflow-y: auto;
+
+  .title {
+    font-size: 16px;
+    font-weight: 700;
+  }
+
+  .content {
+    margin: 12px 0;
+
+    > div {
+      margin: 8px 0;
+    }
+  }
+
+  .el-message__content {
+    color: #333;
+  }
+}
 </style>
 </style>