Procházet zdrojové kódy

88009a1 开方合理安全用药解析数据添加高亮

cc12458 před 5 měsíci
rodič
revize
0f2a722d6c

+ 2 - 0
src/request/api.prescription.js

@@ -61,6 +61,8 @@ export function checkReasonableSafeMedicinesMethod(medicines, params) {
     gravidity: tryRun(() => ({'2': 'Y', '1': 'N'}[params.patient.isGravidity])),
     disId: tryRun(() => params.illness.disease.id, ''),
     synId: tryRun(() => params.illness.symptom.code, ''),
+    diseaseCode: tryRun(() => params.illness.disease.code, ''),
+    symptomCode: tryRun(() => params.illness.symptom.code, ''),
   }, {meta: {share: true}}).then(res => {
     for (const {field, key} of ReasonableSafeMedicine.config) {
       if (!key) continue;

+ 11 - 1
src/request/model.prescription.js

@@ -45,7 +45,17 @@ export class ReasonableSafeMedicine {
         return Array.from(gather);
       },
       toString() {
-        const parse = (value, highlight) => { return value; };
+        const parse = (value, highlight) => {
+          const match = value.match(/^([^(\d]+)(\d+[g|克])?(?:\((.+)\))?$/);
+          if (!match) return value;
+
+          const [_, prefix = value, dosage, suffix] = match;
+          return [
+            `<span class="${highlight.label && 'highlight'}">${prefix}</span>`,
+            dosage ? `<span>${dosage}</span>` : '',
+            suffix ? `<span class="${highlight.value && 'highlight'}">(${suffix})</span>` : '',
+          ].filter(Boolean).join(' ');
+        };
         let html = ``;
         for (const {name, highlight = {}, collection} of this) {
           html += `

+ 1 - 0
src/views/diagnosis/Prescribing.vue

@@ -1556,6 +1556,7 @@ export default {
 
       this.rationalMed = storageData.rationalMed.rationalMed;
       // 保存右侧合理用药信息
+      tryRun(() => { if (this.container_i === 0) child1._checkReasonableSafeMedicines(); });
 
       // 从1-9 分别对应 超剂量 到 19反
       this.rationalMed1 = storageData.rationalMed.rationalMed1;