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

病案首页改为动态模板

zhouna 5 лет назад
Родитель
Сommit
be64e85fd6
2 измененных файлов с 20 добавлено и 13 удалено
  1. 0 1
      src/html/qcScore.html
  2. 20 12
      src/js/qcScore.js

+ 0 - 1
src/html/qcScore.html

@@ -91,7 +91,6 @@
              </tr>
              <tr><td colspan="2" class="table-tip">入院病情:1.有,2.临床未确定,3.情况不明,4.无。</td></tr>
          </table>
-         <!--<p class="table-tip"></p>-->
          {{else}}
              <table>
          <tr>

+ 20 - 12
src/js/qcScore.js

@@ -129,19 +129,11 @@ function initContent(data){
       info=formatInfoData(k,obj[k][i]);
       moduleId=info.mode_id;
       if(global_modules[moduleId]){
-        hml=initModuleData(moduleId,obj[k].length);
+        hml=initModuleData(moduleId,obj[k]);
         $.tmpl(hml,info).appendTo("#contentInfo");
       };
     }
   }
-  if(obj["病案首页"]&&obj["病案首页"][0]["出院诊断"]){
-    const diag = JSON.parse(obj["病案首页"][0]["出院诊断"]);
-    $("#tableTmpl").tmpl({k:"出院诊断",data:diag}).appendTo("#diagTable");
-  }
-  if(obj["病案首页"]&&obj["病案首页"][0]["手术信息"]){
-    const diag = JSON.parse(obj["病案首页"][0]["手术信息"]);
-    $("#tableTmpl").tmpl({k:"手术信息",data:diag}).appendTo("#surgeryTable");
-  }
   $(".content-item[code="+global_activeTab+"]").show();
   //console.log(obj)
 }
@@ -459,7 +451,8 @@ function formatFlawKeys(data){
   }
 
 //初始化模板
-  function initModuleData(mid,n){
+  function initModuleData(mid,obj){
+    const n = obj.length;
     const module=global_modules[mid].moduleDetail;
     const key = global_modules[mid].modeName.replace(/[^\u4e00-\u9fa5|a-zA-Z0-9]+/g,'');
     let hml = '<div class="content-item" code="'+key+'">' +
@@ -473,7 +466,7 @@ function formatFlawKeys(data){
         const {tagType} = detal;
         switch (tagType) {
           case 1:
-            hml = hml + simpleStructure(detal);
+            hml = hml + simpleStructure(detal,obj);
             break;
           case 4:
             hml = hml + combineStructure(detal);
@@ -488,8 +481,23 @@ function formatFlawKeys(data){
   }
 
   //基础类型结构生成
-  function simpleStructure(data){
+  function simpleStructure(data,obj){
     const {name, val,monoLine,addLine,position,bold,retract,id} = data;
+    if(name==="手术记录表格-1"){
+      const value = val.replace("【","").replace("】","");
+      const diag = JSON.parse(obj[0][value]);
+      let thml=`<div class="cont" style="width: 100%;" id="anchor${id}">`;
+      thml+=$("#tableTmpl").tmpl({k:"手术信息",data:diag})[0].outerHTML+"</div>";
+      return thml;
+    }
+    if(name==="出院诊断表格-1"){
+      const value = val.replace("【","").replace("】","");
+      const diag = JSON.parse(obj[0][value]);
+
+      let thml=`<div class="cont" style="width: 100%;" id="anchor${id}">`;
+      thml+=$("#tableTmpl").tmpl({k:"出院诊断",data:diag})[0].outerHTML+"</div>";
+      return thml;
+    }
     const posClass = position===1?'text-left':'';
     const boldClass = bold===1?'text-bold':'';
     const retractClass = retract===1?'text-indent':'';