|
@@ -10,11 +10,13 @@ let global_flawData = {}; //缺陷数据
|
|
|
const global_id=getUrlArgObject("id");
|
|
|
const global_age = getUrlArgObject("age");
|
|
|
let global_activeTab=$(".sub-menu .page.active").attr("code"); //当前激活菜单项
|
|
|
+let global_modules ={}; //模板数据缓存
|
|
|
|
|
|
$(function(){
|
|
|
//getSubMenu();
|
|
|
//initScoreItem();
|
|
|
- getRecordDetail();
|
|
|
+ //getRecordDetail();
|
|
|
+ getInfoModule(15);
|
|
|
function initMenu(data){
|
|
|
const menu=[{id:0,name:"缺陷总览",parentId: -1,sonMode: []},...(data||[])];
|
|
|
//菜单数据填充
|
|
@@ -42,6 +44,7 @@ function initMenu(data){
|
|
|
//显示对应内容
|
|
|
const code=$(this).attr("code");
|
|
|
global_activeTab=code;
|
|
|
+ //initModuleData();
|
|
|
$(".content-item,.flaw-item").hide();
|
|
|
$(".content-item[code='"+code+"']").show();
|
|
|
showFlawList();
|
|
@@ -64,7 +67,7 @@ function getRecordDetail(){
|
|
|
initList(msg);
|
|
|
initScoreItem(msg);
|
|
|
global_flawData=msg;
|
|
|
- let obj = JSON.parse(result.pageData)
|
|
|
+ /*let obj = JSON.parse(result.pageData)
|
|
|
|
|
|
infoNotNull(obj,'查房记录')&&wardRound(obj['查房记录'],'查房记录')
|
|
|
infoNotNull(obj,'术前讨论、术前小结')&&preoperation(obj['术前讨论、术前小结'],'术前讨论、术前小结')
|
|
@@ -77,7 +80,7 @@ function getRecordDetail(){
|
|
|
infoNotNull(obj,'病危通知书')&&illnessNotice(obj['病危通知书'],'病危通知书')
|
|
|
infoNotNull(obj,'病理检验送检单')&&pathologicTest(obj['病理检验送检单'],'病理检验送检单')
|
|
|
infoNotNull(obj,'抢救记录')&&rescueRecord(obj['抢救记录'],'抢救记录')
|
|
|
- infoNotNull(obj,'输血后效果评价')&&transfusionEvaluate(obj['输血后效果评价'],'输血后效果评价')
|
|
|
+ infoNotNull(obj,'输血后效果评价')&&transfusionEvaluate(obj['输血后效果评价'],'输血后效果评价')*/
|
|
|
setBoxHeight();
|
|
|
}
|
|
|
});
|
|
@@ -98,26 +101,14 @@ function initPatientInfo(data){
|
|
|
function initContent(data){
|
|
|
const obj = JSON.parse(data);
|
|
|
let info=[];
|
|
|
- let nameMap={
|
|
|
- "入院记录":"#inHisTmpl",
|
|
|
- "出院小结":"#outHisTmpl",
|
|
|
- "病案首页":"#indexTmpl",
|
|
|
- "手术知情同意书":"#surgeryBookTmpl",
|
|
|
- "首次病程录":"#firstCourseTmpl",
|
|
|
- // "病危通知书":"#illnessNoticeTmpl",
|
|
|
- // "抢救记录":"#rescueRecordTmpl",
|
|
|
- "术后首次病程及谈话记录":"#surgeryAfRecord",
|
|
|
- "危急值记录":"#dangerRecore",
|
|
|
- "输血血制品病程记录":"#transfusionRecordTmpl",
|
|
|
- // "输血后效果评价":"#transfusionEvaluateTmpl",
|
|
|
- "死亡记录":"#deathRecordTmpl",
|
|
|
- "死亡病例讨论记录":"#discusionAboutDeathTmpl",
|
|
|
- // "病理检验送检单":"#pathologicTestTmpl"
|
|
|
- };
|
|
|
+ let hml='';
|
|
|
for(let k in obj){
|
|
|
for(let i in obj[k]){
|
|
|
info=formatInfoData(k,obj[k][i]);
|
|
|
- nameMap[k]&&Object.keys(obj[k][i]).length !== 0 &&$(nameMap[k]).tmpl(info).appendTo("#contentInfo");
|
|
|
+ if(global_modules[k]){
|
|
|
+ hml=initModuleData(k,obj[k].length);
|
|
|
+ $.tmpl(hml,info).appendTo("#contentInfo");
|
|
|
+ };
|
|
|
}
|
|
|
}
|
|
|
if(obj["病案首页"]&&obj["病案首页"][0]["出院诊断"]){
|
|
@@ -129,7 +120,7 @@ function initContent(data){
|
|
|
$("#tableTmpl").tmpl({k:"手术信息",data:diag}).appendTo("#surgeryTable");
|
|
|
}
|
|
|
$(".content-item[code="+global_activeTab+"]").show();
|
|
|
- console.log(obj)
|
|
|
+ //console.log(obj)
|
|
|
}
|
|
|
|
|
|
function formatInfoData(k,data){
|
|
@@ -296,4 +287,108 @@ function formatFlawKeys(data){
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
+//获取病例模板
|
|
|
+ function getInfoModule(moduleId){
|
|
|
+ const param = {
|
|
|
+ moduleId:moduleId
|
|
|
+ };
|
|
|
+ post(api.getInfoModule,param).then(function(res){
|
|
|
+ if(res.data.code==='0'){
|
|
|
+ const data = res.data.data;
|
|
|
+ cachemoduleDatas(data);
|
|
|
+ getRecordDetail();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //模板数据缓存
|
|
|
+ function cachemoduleDatas(data){
|
|
|
+ const moudle=data.moduleDetail;
|
|
|
+ global_modules[data.modeName]=[];
|
|
|
+ for(let i in moudle){
|
|
|
+ global_modules[data.modeName].push(moudle[i]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+//初始化模板
|
|
|
+ function initModuleData(key,n){
|
|
|
+ const module=global_modules[key];
|
|
|
+ let hml = '<div class="content-item" code="'+key+'">' +
|
|
|
+ '<h2 class="title">'+key+'</h2>' +
|
|
|
+ (n>1?'<div class="container">':'<div class="container content-ht">');
|
|
|
+
|
|
|
+ for(let i=0;i<module.length;i++){
|
|
|
+ hml=hml+'<div class="info-item">';
|
|
|
+ for(let j=0;j<module[i].length;j++) {
|
|
|
+ const detal = module[i][j].questionDTO;
|
|
|
+ const {tagType} = detal;
|
|
|
+ switch (tagType) {
|
|
|
+ case 1:
|
|
|
+ hml = hml + simpleStructure(detal);
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ hml = hml + combineStructure(detal);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ hml = hml+"</div>"
|
|
|
+ }
|
|
|
+ return hml+"</div></div>";
|
|
|
+ }
|
|
|
+
|
|
|
+ //基础类型结构生成
|
|
|
+ function simpleStructure(data){
|
|
|
+ const {name, val,addLine,position,bold,retract} = data;
|
|
|
+ const posClass = position===1?'text-left':'';
|
|
|
+ const boldClass = bold===1?'text-bold':'';
|
|
|
+ const retractClass = retract===1?'text-indent':'';
|
|
|
+ const lineHml = ('<p class="'+posClass+' '+boldClass+' '+retractClass+'">'+ extractVars(val)+'</p>');
|
|
|
+ const txtHml = ('<span class="'+posClass+' '+boldClass+' '+retractClass+'">'+ extractVars(val)+'</span>');
|
|
|
+
|
|
|
+ let hml = addLine?`<div class="cont" style="width: 100%;">`:`<div class="cont">`;
|
|
|
+ hml=hml+`<span class="label">${name}</span>`+ (addLine?lineHml:txtHml)+ `</div>`;
|
|
|
+ return hml;
|
|
|
+ }
|
|
|
+
|
|
|
+ //组合类型结构生成
|
|
|
+ function combineStructure(data){
|
|
|
+ const {name,questionMapping} = data;
|
|
|
+ let hml='<div class="inner-table"><table>';
|
|
|
+ const colNum = Math.ceil(questionMapping.length/2);
|
|
|
+ let tdVal='';
|
|
|
+ for(let i=0;i<questionMapping.length;){console.log(name,i,questionMapping.length)
|
|
|
+ if(questionMapping[i+1]){
|
|
|
+ tdVal="<td>"+questionMapping[i].name+":${"+questionMapping[i].val.replace(/[【|】]/g,'')+"}</td><td>"+questionMapping[i+1].name+":${"+questionMapping[i+1].val.replace(/[【|】]/g,'')+"}</td>";
|
|
|
+ }else{
|
|
|
+ tdVal="<td>"+questionMapping[i].name+":${"+questionMapping[i].val.replace(/[【|】]/g,'')+"}</td><td></td>";
|
|
|
+ }
|
|
|
+ if(i==0){
|
|
|
+ hml=hml+`<tr><td rowspan="${colNum}">${name}</td>${tdVal}`;
|
|
|
+ }else{
|
|
|
+ hml=hml+`<tr>${tdVal}`;
|
|
|
+ }
|
|
|
+ hml=hml+"</tr>";
|
|
|
+ i=((i+2)>questionMapping.length?i+1:i+2)
|
|
|
+ }
|
|
|
+ hml=hml+"</table></div>";
|
|
|
+ return hml;
|
|
|
+ }
|
|
|
+
|
|
|
+ //抽取变量
|
|
|
+ function extractVars(org){
|
|
|
+ const regexp = /(【(.+?)】)/g;
|
|
|
+ const arr = org.split(regexp);
|
|
|
+ //console.log(arr)
|
|
|
+ let htl = '',val='';
|
|
|
+ for(let i=0;i<arr.length;i++){
|
|
|
+ val = arr[i].indexOf("【")!=-1?'':(arr[i-1]&&arr[i-1].indexOf("【")!=-1?"{{html "+arr[i]+"}}":arr[i]);
|
|
|
+ htl=htl+val;
|
|
|
+ }
|
|
|
+ return htl;
|
|
|
+ }
|
|
|
+
|
|
|
});
|
|
|
+
|