Explorar el Código

0f2a722 修改开方合理安全用药解析正则匹配

cc12458 hace 5 meses
padre
commit
1f37d55843
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. 2 2
      src/request/model.prescription.js

+ 2 - 2
src/request/model.prescription.js

@@ -46,14 +46,14 @@ export class ReasonableSafeMedicine {
       },
       toString() {
         const parse = (value, highlight) => {
-          const match = value.match(/^([^(\d]+)(\d+[g|克])?(?:\((.+)\))?$/);
+          const match = value.match(/^(.+?)(\d+(?:\.\d+)?[克Gg]?|反|畏|不宜与)?[((]([\s\S]*)[))]$/);
           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>` : '',
+            suffix ? `<span class="${highlight.value && 'highlight'}">(${suffix})</span>` : '',
           ].filter(Boolean).join(' ');
         };
         let html = ``;