cdss.js 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843
  1. if(!Promise){
  2. var Promise = require("bluebird");
  3. // Configure
  4. Promise.config({
  5. longStackTraces: true,
  6. warnings: true // note, run node with --trace-warnings to see full stack traces for warnings
  7. })
  8. }
  9. require('./../css/reset.css');
  10. require('./../css/cdss.less');
  11. require('./../css/popup.css');
  12. require('./../css/followUpV.less');
  13. require('../css/staticSearch.less')
  14. require('./../js/staticSearch.js');//静态知识搜索
  15. require('./../images/empty.png').replace(/^undefined/g, '')
  16. require('./../images/icon_admin.png').replace(/^undefined/g, '')
  17. require('./../images/empty2.png').replace(/^undefined/g, '')
  18. require('./../images/empty3.png').replace(/^undefined/g, '')
  19. require('./../images/icon_no.png').replace(/^undefined/g, '')
  20. require('./../images/loading.gif').replace(/^undefined/g, '')
  21. require('./../images/right.png').replace(/^undefined/g, '')
  22. require('./../images/new.png').replace(/^undefined/g, '')
  23. require('./../images/t1.png').replace(/^undefined/g, '')
  24. require('./../images/t2.png').replace(/^undefined/g, '')
  25. require('./../images/t3.png').replace(/^undefined/g, '')
  26. require('./../images/go.png').replace(/^undefined/g, '')
  27. require('./../images/g1.png').replace(/^undefined/g, '')
  28. // require('./popupEdit.js');
  29. let infoImg = require('./../images/icon_info.png').replace(/^undefined/g, '')
  30. let infoImgOn = require('./../images/icon_info_on.png').replace(/^undefined/g, '')
  31. let iconArrowUp = require('./../images/icon_arrow_up.png').replace(/^undefined/g, '')
  32. let iconArrowDown = require('./../images/icon_arrow_down.png').replace(/^undefined/g, '')
  33. let iconMark = require('./../images/icon_mark.png').replace(/^undefined/g, '')
  34. let warnImg = require('./../images/icon_warning.png').replace(/^undefined/g, '')
  35. let warnImgWhite = require('./../images/icon_waring_white.png').replace(/^undefined/g, '')
  36. const $ = require("jquery");
  37. const { post,config,getUrlArgObject,openNewWin,titleConfig } = require('./promise.js');
  38. const { renderFollowUp, followEmpty } = require('./followUp.js');
  39. const {getTcmMr} = require('./tcmiss.js');
  40. const { transConf } = require('./util.js');
  41. //静态知识类型: 1:诊断 2.药品 3.化验套餐 4.化验明细 5.辅检 6.手术和操作
  42. let moduleConfig={
  43. auxiliary:"recommendWrap",
  44. qc:"qcWrap",
  45. medical:"medicalKonwledgeWrap",
  46. followup: "followUpWrap",
  47. tcmiss: 'tcmWarp',
  48. }
  49. let allInterface = 0
  50. let hasCompleteTnterface = 0
  51. let moduleNum = 0
  52. let mrId = getUrlArgObject('mrId')
  53. let isTcm = getUrlArgObject('isTcm')
  54. let pushMrId = getUrlArgObject('pushMrId')
  55. const tipsMode = getUrlArgObject('tipsMode') || 1
  56. let planCode = getUrlArgObject('planCode') || 'all'
  57. let hospitalIdUrl = getUrlArgObject('hospitalId') || ''
  58. let msg;
  59. let treatDisName;
  60. function getMRInfo() {
  61. return post(config.getMr2,{mrId:mrId})
  62. }
  63. let ifInputParam; //是否有入参,显示输入空状态用
  64. if(mrId){
  65. Promise.all([getConf(),getMRInfo()]).then(([res1,res2])=>{
  66. const data = res1.data.data&&res1.data.data[0]
  67. msg = res2.data.data ||{}
  68. if(!(msg&&msg.diseaseName&&msg.diseaseName.name)){
  69. msg.diseaseName={}
  70. }
  71. window.msg = msg;
  72. renderPage(data)
  73. })
  74. } else{
  75. getConf().then(res =>{
  76. if(res.data.code == '0'){
  77. // const configArr = res.data.data.pushSetList || []
  78. // getPageInfo(configArr)
  79. const data = res.data.data&&res.data.data[0]
  80. renderPage(data)
  81. }
  82. })
  83. followEmpty()
  84. }
  85. function hasInputParam(){
  86. const checkKeys = ["chief","diag","diseaseName","drug","drugOrder","lis","lisOrder",'marital','menstrual',"operation","operationOrder","otherIndex","otherOrder","pacs","pacsOrder","pasts","personal","symptom","transfusion","transfusionOrder","vital"];
  87. let res = false;
  88. let val;
  89. checkKeys.map((it)=>{
  90. val = msg[it];
  91. if(typeof val==='string'){
  92. if(val!==''){
  93. res=true;
  94. }
  95. }else{
  96. const str = JSON.stringify(val);
  97. if(!(str==='{}'||str==='[]')){
  98. res=true;
  99. }
  100. }
  101. });
  102. return res;
  103. }
  104. function getConf() {
  105. var msg = window.msg
  106. return post(config.getPushSet,{hospitalId:hospitalIdUrl||msg.hospitalId||1,planCode: planCode})
  107. }
  108. function getPushInfo() {
  109. return post(config.pushInner, Object.assign({}, msg, {
  110. featureType: '1,4,5,6,7,8,9,10,12,13',
  111. hospitalId: hospitalIdUrl || msg.hospitalId,
  112. ruleType: config.ruleTypeMap['22']
  113. }))
  114. }
  115. function getPusgWarning(){
  116. const indPush = pushMrId ? config.indicationPushCache : config.indicationPush;
  117. return post(indPush, Object.assign({}, msg, {ruleType: '1,2,3,4', mrId: pushMrId || mrId}))
  118. }
  119. function getWriteStandardPush(){
  120. return post(config.caseWritingPrompt,Object.assign({},msg,{hospitalId:2||msg.hospitalId}))
  121. }
  122. function getHosptDeptUsal(){
  123. var msg = window.msg
  124. const param ={
  125. age: msg.age,
  126. deptName: msg.deptName,
  127. hospitalCode: msg.hosCode,
  128. sexType: msg.sex,
  129. type: 1,
  130. }
  131. return post(config.getHosptDeptUsal,param)
  132. }
  133. function getPushData(res){
  134. if(res&&res.data&&res.data.data&&res.data.data.dis&&res.data.data.dis){
  135. let dis = res.data.data.dis;
  136. //急诊显示规则,主诊断有急诊优先显示,没有则显示推送的,推送也没有就不显示
  137. if(dis&&dis['页面急诊']&&(dis['页面急诊'].length>0)){
  138. let name = dis['页面急诊'][0].name || ''
  139. $(".allDis .disName").html(name)
  140. disName = name
  141. if(name){
  142. $(".singleDis").css("display","block")
  143. }
  144. }else if(dis&&dis['急诊']&&dis['急诊'].length>0){
  145. let name = dis['急诊'][0].name || ''
  146. $(".allDis .disName").html(name)
  147. disName = name
  148. if(name){
  149. $(".singleDis").css("display","block")
  150. }
  151. }
  152. }
  153. }
  154. let disName=""
  155. function handleShow(){
  156. const newinConf = {
  157. width: '600', //窗口的文档显示区的宽度。以像素计。
  158. height: '826', //窗口文档显示区的高度。以像素计。
  159. left: '0', //窗口的 x 坐标。以像素计。
  160. top: '0', //窗口的 y 坐标。以像素计。
  161. openMode: "_blank" //每次都是新窗口打开为_blank,打开同一窗口填写任意字符串
  162. }
  163. const newWindowLocation = `width=${newinConf.width}, height=${newinConf.height}, left=${newinConf.left}, top=${newinConf.top} scrollbars=yes`
  164. window.open('./emergency.html?disName='+disName, newinConf.openMode, newWindowLocation)
  165. }
  166. $(document).on('click',".allDis .allName",function(){
  167. handleShow()
  168. })
  169. $(document).on('click',".singleDis",function(){
  170. $(this).next().css("display","block")
  171. $(this).css("display","none")
  172. })
  173. $(document).on('click',".allDis .right,.allDis .secDis",function(){
  174. $(".allDis").css("display","none")
  175. $(".singleDis").css("display","block")
  176. })
  177. function moreInfo() {
  178. $('.infoImg').off("click").click(function(){
  179. const name = $(this).parents(".pushItemBox").attr('data-name')
  180. const type = $(this).parents(".pushItemBox").attr('data-type')
  181. openNewWin(`staticInfo.html?type=${encodeURIComponent(type)}&position=0&name=${encodeURIComponent(name)}&mrId=${encodeURIComponent(mrId)}`)
  182. })
  183. $('.evaluationtitle').off("click").click(function () {
  184. const name = $(this).parents(".pushItemBox").attr('data-name')
  185. const type = $(this).parents(".pushItemBox").attr('data-type')
  186. openNewWin(`staticInfo.html?type=${encodeURIComponent(type)}&position=0&name=${encodeURIComponent(name)}&page=1&mrId=${encodeURIComponent(mrId)}&gauge=gauge`)
  187. })
  188. }
  189. function getVersion() {
  190. return post(config.getVersion, 'confArr').then((res) => {
  191. const data = res.data.data;
  192. const ver = localStorage.getItem('versionTime');
  193. const time = data.refreshTime;
  194. if(!ver||ver===time+"=new"||time!==ver.replace("=new","")){ //判断版本是否更新
  195. $(".version-tip").addClass('new-icon');
  196. localStorage.setItem('versionTime',time+"=new"); //保存版本更新时间
  197. }else{
  198. $(".version-tip").removeClass("new-icon");
  199. }
  200. })
  201. }
  202. function getDisclaimer() {
  203. return post(config.disclaimer, {}).then((res) => {
  204. const data = res.data.data.filter(item => item.disclaimerCode == "2");
  205. $(".responsibility").html((data[0] || {}).description);
  206. // $(".iframeWrap").css({height: $(window).height()-115-$(".responsibility").height()+"px"})
  207. })
  208. }
  209. function renderPage(pageSet){
  210. const setInfo = pageSet.sysSetInfo;
  211. if(!pageSet || !setInfo){
  212. return
  213. }
  214. renderTab(setInfo)
  215. adjustHei()
  216. const hasAuxiliary = hasTab("辅助信息",setInfo);
  217. const hasMedical = hasTab("医学知识",setInfo)
  218. const hasFollowUp = hasTab("随访计划",setInfo)
  219. const hasTcm = hasTab("中医辅助", setInfo);
  220. console.log(hasFollowUp)
  221. //所有模块都未开启配置,显示功能未开启(无tab)
  222. if(hasAuxiliary.status===0&&hasMedical.status===0&&hasFollowUp.status===0&&hasTcm.status===0){
  223. const nullTxt = `<div class="empty-box" style="left: -20px;display: block;">
  224. <img class="emptyImg" src="../images/icon_admin.png" alt="空">
  225. <p class="emptyTxt">功能未开启</p>
  226. </div>`
  227. $(".contentWrapper").html(nullTxt);
  228. return;
  229. }
  230. if (hasTcm) {
  231. getTcmMr(mrId, hasTcm);
  232. }
  233. if(!mrId){
  234. return
  235. }
  236. if(hasFollowUp){
  237. renderFollowUp(msg)
  238. }
  239. const planDetail = hasAuxiliary.planDetails;
  240. const configs = planDetail.find((it)=>it.status!==0);
  241. if(!configs){ //没有开启辅助信息各项配置
  242. $('.empty-box').hide();
  243. $('.recommendBox .empty-right').show();
  244. return;
  245. }
  246. if(hasAuxiliary){
  247. $('.empty-box').hide();
  248. $(".loading").show();
  249. renderModuleWrapper(planDetail)
  250. let needPush = isNeedPush(planDetail)
  251. let needPushWarning = isNeedPushWarning(planDetail)
  252. let needWriteStandardPush = isNeedwriteStandardPush(planDetail);
  253. if(needPush){
  254. renderPushData()
  255. allInterface++
  256. }
  257. if(needPushWarning){
  258. renderPushWarning()
  259. allInterface++
  260. }
  261. if(needWriteStandardPush){
  262. renderWriteStandard()
  263. allInterface++
  264. }
  265. }
  266. }
  267. function renderPushData(){
  268. return getPushInfo().then(res =>{
  269. $(".loading").hide();
  270. hasCompleteTnterface++
  271. if(res.data.code == "0"){
  272. const result = res.data.data
  273. let diagPush = result.dis ||{}
  274. let lisPush = result.lis || []
  275. let scalePush = result.scale || []
  276. let pacsPush = result.pacs || []
  277. let symptomPush = result.symptom ||[]
  278. let checkupPush = result.vital ||[]
  279. let medicinesPush = result.medicines || []
  280. let operationsPush = result.operations ||[]
  281. let treatPush = result.treat&&result.treat[0] ||{}
  282. let nursePush = result.nurse || []
  283. treatDisName = treatPush&&treatPush["name"]
  284. let generaTreatPush = treatPush&&treatPush["generaTreat"]
  285. // let lisPush =[{name:"血常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null}]
  286. // let pacsPush = [{name:"胸部x射线",hisNameList:null},{name:"心电图",hisNameList:null}]
  287. // let checkupPush = [{name:"神志表情",hisNameList:null},{name:"面部表情",hisNameList:null}]
  288. let lisNum = $(".moduleItem.lis").attr("data-num") || 5
  289. let scaleNum = $(".moduleItem.evaluation").attr("data-num") || 5
  290. let pacsNum = $(".moduleItem.pacs").attr("data-num") || 5
  291. let checkupNum = $(".moduleItem.vital").attr("data-num") || 5
  292. let symptomNum = $(".moduleItem.symptom").attr("data-num") || 5
  293. let medicinesNum = $(".moduleItem.medicine").attr("data-num") || 5
  294. let operationsNum = $(".moduleItem.operation").attr("data-num") || 5
  295. let nurseNum = $(".moduleItem.nurse").attr("data-num") || 5
  296. renderLis(lisPush,lisNum)
  297. renderScale(scalePush,scaleNum)
  298. renderPacs(pacsPush,pacsNum)
  299. renderCheckup(checkupPush,checkupNum)
  300. renderSymptomPush(symptomPush,symptomNum)
  301. renderDiag(diagPush)
  302. renderMedicinesPush(medicinesPush,medicinesNum)
  303. renderOperationPush(operationsPush,operationsNum)
  304. rendergeneraTreatPush(generaTreatPush)
  305. renderNurse(nursePush, nurseNum)
  306. bindOpenInfo()
  307. moreInfo()
  308. bindSlide()
  309. empty(); //判断是否显示空状态
  310. }
  311. })
  312. }
  313. function adjustHei(){
  314. const iframeHei = $(".bodyWrap").height()
  315. $(".contentWrapper").css("height",iframeHei-20-30-60+3+19+'px')
  316. $(".tabList").css("height",iframeHei+'px')
  317. }
  318. function isNeedPush(list){
  319. let pass = false;
  320. let pushCode = ['critical',"diag","lis","pacs","symptom","vital","treat","medicines",'evaluation','general','medicine','operation','nurse']
  321. for(let i = 0; i < list.length; i++){
  322. if(pushCode.indexOf(list[i].code)>-1){
  323. if(list[i].status == "1"){
  324. pass = true
  325. }
  326. }
  327. }
  328. return pass;
  329. }
  330. function isNeedwriteStandardPush(list){
  331. let pass = false;
  332. let pushCode = ["casewriting"]
  333. for(let i = 0; i < list.length; i++){
  334. if(pushCode.indexOf(list[i].code)>-1){
  335. if(list[i].status == "1"){
  336. pass = true
  337. }
  338. }
  339. }
  340. return pass
  341. }
  342. function isNeedPushWarning(list){
  343. let pushCode = ["crivalue", "rationali", "highrisk", "otherremind"];
  344. let pass = false;
  345. for(let i = 0; i < list.length; i++){
  346. if(pushCode.indexOf(list[i].code.trim())>-1){
  347. if(+list[i].status === 1){
  348. pass=true
  349. }
  350. }
  351. }
  352. return pass
  353. }
  354. //let popNum = 0;//气泡显示数字
  355. function renderPushWarning(){
  356. return getPusgWarning().then(res =>{
  357. $(".loading").hide();
  358. hasCompleteTnterface++
  359. if(res.data.code == '0'){
  360. const result = res.data.data
  361. let billMsgList = result.billMsgList || [] //开单合理性提醒
  362. let highRiskList = result.highRiskList || [] //高危药品、手术
  363. let criticalValList = result.criticalValList || [] //危急值提醒
  364. let noteList = result.noteList || [] //检查内容注意事项
  365. let dubugStr = result.dubugStr || [] //注意调试信息
  366. let otherList = result.otherList || [] //其他提醒
  367. //$('.moduleItem.crivalue').append(titleStr('warning'))
  368. renderBillingPush(billMsgList,'开单合理性提醒','rationali')
  369. renderBillingPush(highRiskList,'高风险提示','highrisk')
  370. renderBillingPush(criticalValList,'危急值提醒','crivalue')
  371. //renderBillingPush(noteList,'检查内容注意事项')
  372. renderBillingPush(otherList,'其他提醒','otherremind')
  373. //moreInfo()
  374. $(".moduleItem.tips").wrapAll("<div class='tips-cont'></div>");
  375. updatePopNum();
  376. $(titleStr('warning')).insertBefore('.tips-cont .moduleItem:first-child')
  377. empty();
  378. }
  379. })
  380. }
  381. function renderWriteStandard(){
  382. return getWriteStandardPush().then(res =>{
  383. $(".loading").hide();
  384. hasCompleteTnterface++
  385. if(res.data.code == '0'){
  386. const list = res.data.data || {}
  387. let casewritingNum = $(".moduleItem.casewriting").attr("data-num") || 5
  388. renderwriteStandardPage(list,casewritingNum)
  389. empty();
  390. }
  391. })
  392. }
  393. function renderwriteStandardPage(list,casewritingNum){
  394. let arr = Object.keys(list)
  395. if(arr.length > 0 && $(".moduleItem.casewriting").length > 0){
  396. moduleNum++
  397. $(".moduleItem.casewriting").append(titleStr("casewritingPush"))
  398. let longStr = ``
  399. let shortStr = ``
  400. for(let i = 0; i < arr.length; i++){
  401. if( i < casewritingNum){
  402. shortStr += `<div class="billingPushItem"><img class="iconMark" src=${iconMark}>${arr[i]}</div>`
  403. }
  404. longStr += `<div class="billingPushItem"><img class="iconMark" src=${iconMark}>${arr[i]}</div>`
  405. }
  406. let shortStrBox = `<div class="shortStrBox">${shortStr}</div>`
  407. let longStrBox = `<div class="longStrBox">${longStr}</div>`
  408. let allStr = `<div class="casewritingWrapper"></div>`
  409. $(".moduleItem.casewriting").append(allStr)
  410. $(".casewritingWrapper").append(shortStrBox)
  411. if( arr.length>casewritingNum){
  412. $(".shortStrBox .billingPushItem").eq( $(".shortStrBox .billingPushItem").length -1).append(`<span class="showMoreCaseWriting"><img class="iconArrowImg" src="${iconArrowDown}"></span>`)
  413. // $(".moduleItem .generalTreatInfo").append(`<span class="showLessGeneralTreat">收起<img class="iconArrowImg" src="${iconArrowUp}"></span>`)
  414. $(".casewritingWrapper").append(longStrBox)
  415. $(".longStrBox .billingPushItem").eq( $(".longStrBox .billingPushItem").length -1).append(`<span class="showLessCaseWriting"><img class="iconArrowImg" src="${iconArrowUp}"></span>`)
  416. }
  417. $('.moduleItem.casewriting').css("display","block")
  418. updatePopNum();
  419. bindSlideCaseWriting()
  420. }
  421. }
  422. function renderBillingPush(list,name,code){
  423. if(list.length === 0){
  424. return
  425. }
  426. moduleNum++
  427. let str = ``
  428. for(let i = 0; i < list.length; i++){
  429. str += `<div class="billingPushItem"><img class="iconMark" src=${iconMark}>${list[i].msg}</div>`
  430. }
  431. let titleStr = titleStr2(name)
  432. let boxStr = `<div class="moduleBox">
  433. ${titleStr}
  434. ${str}
  435. </div>`
  436. $("."+code).append(boxStr)
  437. $('.moduleItem.'+code).addClass("tips").css("display", "block")
  438. }
  439. //更新消息个数
  440. function updatePopNum(){
  441. const warnNum = $(".tips-cont .billingPushItem,.casewriting .billingPushItem").length;
  442. if(warnNum===0){
  443. $(".tabList .numPop").hide();
  444. return;
  445. }
  446. $(".tabList .numPop").text(warnNum).show()
  447. }
  448. function renderDiag(diagPush){
  449. let possibleDiagPush = diagPush["可能诊断"] || []
  450. let previousDiagPush = diagPush["既往诊断"] || []
  451. let firstDiagPush = diagPush["初步诊断"] || []
  452. let identifyDiagPush = diagPush["鉴别诊断"] || []
  453. let warningDiagPush = diagPush["警惕"] || []
  454. let number = $('.moduleItem.diag').attr("data-num") || 5
  455. let warnNumber = $('.moduleItem.warning').attr("data-num") || 5
  456. $('.moduleItem.diag').append(titleStr("diagPush"))
  457. // let warningDiagPush = [{name:"血常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null}]
  458. // let firstDiagPush = [{name:"血常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null}]
  459. // let identifyDiagPush = diagPush["鉴别诊断"] || [{name:"血常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null}]
  460. renderDiagItem(possibleDiagPush,"可能诊断",number)
  461. renderDiagItem(previousDiagPush, "既往诊断", number)
  462. renderDiagItem(firstDiagPush,"初步诊断",number)
  463. renderDiagItem(identifyDiagPush,"鉴别诊断",number)
  464. renderWarningDiag(warningDiagPush,"警惕",warnNumber)
  465. moreInfo()
  466. }
  467. function renderDiagItem(list,name,number){
  468. if(list.length === 0){
  469. return
  470. }
  471. moduleNum++
  472. let titleStr = titleStr2(name)
  473. let {shortStr, longStr} = renderItemWrapper(list,number)
  474. let boxStr = `<div class="moduleBox">
  475. ${titleStr}
  476. ${shortStr}
  477. ${longStr}
  478. </div>`
  479. $(".diag").append(boxStr)
  480. $('.moduleItem.diag').css("display","block")
  481. }
  482. function renderWarningDiag(list,name,number){
  483. if(list.length > 0 && $(".moduleItem.warning").length > 0){
  484. moduleNum++
  485. $('.moduleItem.warning').append()
  486. let str = `<span class="warningTitle"><img class="warningTitImg" src=${warnImgWhite}>警惕</span>`
  487. for(let i = 0; i < list.length; i++){
  488. str+= renderPushItem(list[i],1)
  489. }
  490. $('.moduleItem.warning').append(str)
  491. $('.moduleItem.warning').css("display","block")
  492. }
  493. }
  494. function renderLis(list,showNum){
  495. if(list.length > 0 && $(".moduleItem.lis").length > 0){
  496. moduleNum++
  497. $('.moduleItem.lis').append(titleStr("lisPush"))
  498. let {shortStr, longStr} = renderItemWrapper(list,showNum)
  499. $('.moduleItem.lis').append(shortStr).append(longStr)
  500. $('.moduleItem.lis').css("display","block")
  501. }
  502. }
  503. function renderScale(list,showNum){
  504. if(list.length > 0 && $(".moduleItem.evaluation").length > 0){
  505. moduleNum++
  506. $('.moduleItem.evaluation').append(titleStr("scalePush"))
  507. let {shortStr, longStr} = renderItemWrapper(list,showNum)
  508. $('.moduleItem.evaluation').append(shortStr).append(longStr)
  509. $('.moduleItem.evaluation').css("display", "block")
  510. }
  511. }
  512. function renderNurse(list, showNum) {
  513. if (list.length > 0 && $(".moduleItem.nurse").length > 0) {
  514. moduleNum++
  515. $('.moduleItem.nurse').append(titleStr("nursePush"))
  516. let {shortStr, longStr} = renderItemWrapper(list, showNum)
  517. $('.moduleItem.nurse').append(shortStr).append(longStr);
  518. $('.moduleItem.nurse').css("display", "block")
  519. }
  520. }
  521. function renderPacs(list,showNum){
  522. if(list.length > 0 && $(".moduleItem.pacs").length > 0){
  523. moduleNum++
  524. $(".moduleItem.pacs").append(titleStr("pacsPush"))
  525. let {shortStr, longStr} = renderItemWrapper(list,showNum)
  526. $(".moduleItem.pacs").append(shortStr).append(longStr)
  527. $('.moduleItem.pacs').css("display","block")
  528. }
  529. }
  530. function renderCheckup(list,showNum){
  531. if(list.length > 0 && $(".moduleItem.vital").length > 0){
  532. moduleNum++
  533. $(".moduleItem.vital").append(titleStr("checkupPush"))
  534. let {shortStr, longStr} = renderItemWrapper(list,showNum)
  535. $(".moduleItem.vital").append(shortStr).append(longStr)
  536. $('.moduleItem.vital').css("display","block")
  537. }
  538. }
  539. function renderSymptomPush(list,showNum){
  540. $(".moduleItem.symptom").append(titleStr('symptomPush'))
  541. if(list.length > 0 && $(".moduleItem.symptom").length > 0){
  542. moduleNum++
  543. let {shortStr, longStr} = renderItemWrapper(list,showNum)
  544. $(".moduleItem.symptom").append(shortStr).append(longStr)
  545. $(".moduleItem.symptom").css("display","block")
  546. }
  547. }
  548. function rendergeneraTreatPush(list){
  549. if(list&& $(".moduleItem.general").length > 0){
  550. $(".moduleItem.general").append(titleStr('generaTreatPush'))
  551. moduleNum++
  552. let str = `<div class="generalTreatInfo clearfix isOverFlow">${list}</div>`
  553. $(".moduleItem.general").append(str)
  554. $(".moduleItem.general").css("display","block")
  555. let generaTreatHei = $(".moduleItem .generalTreatInfo")[0].scrollHeight
  556. if(generaTreatHei > 50){
  557. $(".moduleItem .generalTreatInfo").append(`<span class="showMoreGeneralTreat"><img class="iconArrowImg more" src="${iconArrowDown}"></span>`)
  558. $(".moduleItem .generalTreatInfo").append(`<span class="showLessGeneralTreat"><img class="iconArrowImg" src="${iconArrowUp}"></span>`)
  559. bindGeneralSlide()
  560. }
  561. }
  562. }
  563. function renderMedicinesPush(list,showNum){
  564. $(".moduleItem.medicine").append(titleStr('drugPush'))
  565. if(list.length > 0 && $(".moduleItem.medicine").length > 0){
  566. moduleNum++
  567. let {shortStr, longStr} = renderItemWrapper(list,showNum)
  568. $(".moduleItem.medicine").append(shortStr).append(longStr)
  569. $(".moduleItem.medicine").css("display","block")
  570. }
  571. }
  572. function renderOperationPush(list,showNum){
  573. $(".moduleItem.operation").append(titleStr('operationPush'))
  574. if(list.length > 0 && $(".moduleItem.operation").length > 0){
  575. moduleNum++
  576. let {shortStr, longStr} = renderItemWrapper(list,showNum)
  577. $(".moduleItem.operation").append(shortStr).append(longStr)
  578. $(".moduleItem.operation").css("display","block")
  579. }
  580. }
  581. function renderItemWrapper(list, showNum) {
  582. let showNum1 = showNum || 5
  583. let shortStr = '', longStr = ''
  584. for(let i = 0; i < list.length; i++){
  585. if(i <= showNum1-1){
  586. shortStr += renderPushItem(list[i])
  587. }
  588. longStr += renderPushItem(list[i])
  589. }
  590. if(showNum1 >= list.length){
  591. return {
  592. shortStr:`<div class="shortBox">${shortStr}</div>`,
  593. longStr:''
  594. }
  595. }else{
  596. shortStr += `<span class="showMore"><img class="iconArrowImg" src="${iconArrowDown}"></span>`
  597. longStr += `<span class="showLess"><img class="iconArrowImg" src="${iconArrowUp}"></span>`
  598. return {
  599. shortStr:`<div class="shortBox">${shortStr}</div>`,
  600. longStr:`<div class="longBox">${longStr}</div>`
  601. }
  602. }
  603. }
  604. function renderPushItem(item) {
  605. const infoIcon = `${ item.hasInfo == "1" ? `<img class="infoImg" src="${infoImg}">` : "" }`;
  606. str = `<span class="pushItemBox" data-name="${item.name}" data-type="${item.type}">`
  607. str += `<span class="pushItemName ${item.hasScale == "1" ? 'evaluationtitle':''}"><i>${item.type == 8 ? ('【' + item.name + '】') : item.name}</i> ${infoIcon}<i class="hidden-i"></i></span>`
  608. str+=`</span>`;
  609. return str
  610. }
  611. function bindOpenInfo(){
  612. $(".infoImg").on("mouseenter", function(){
  613. $(this).attr("src", infoImgOn)
  614. }).on("mouseleave", function(){
  615. $(this).attr("src", infoImg)
  616. })
  617. }
  618. function bindSlide(){
  619. $(".showMore").off("click").on("click", function(){
  620. $(this).parent().parent().find(".longBox").css("display","block")
  621. $(this).parent().parent().find(".shortBox").css("display","none")
  622. })
  623. $(".showLess").off("click").on("click", function(){
  624. $(this).parent().parent().find(".longBox").css("display","none")
  625. $(this).parent().parent().find(".shortBox").css("display","block")
  626. })
  627. }
  628. function renderModuleWrapper(moduleList){
  629. if(!moduleList){
  630. return
  631. }
  632. let moduleStr = ''
  633. for(let i = 0; i < moduleList.length; i++){
  634. if(moduleList[i].status !='0'){
  635. if(moduleList[i].code == 'critical'){
  636. moduleStr += `<div class="moduleItem warning" data-num="${moduleList[i].number}" style="display:none"></div>`
  637. // moduleStr += `<div class="moduleItem tips" data-num="${moduleList[i].number}" style="display:none"></div>`
  638. }else{
  639. moduleStr += `<div class="moduleItem ${moduleList[i].code }" data-num="${moduleList[i].number}" style="display:none"></div>`
  640. }
  641. }
  642. }
  643. //console.log(moduleList,moduleStr)
  644. $(".recommendWrap").append(moduleStr)
  645. }
  646. function hasTab(tabName,tabList){
  647. if(!tabList){
  648. return
  649. }
  650. for(let i = 0; i < tabList.length; i++){
  651. if(tabList[i].name == tabName){
  652. return tabList[i]
  653. }
  654. }
  655. return false
  656. }
  657. function renderTab(tabList){
  658. let tabStr = '<ul>'
  659. for(let i = 0; i < tabList.length; i++){
  660. if(tabList[i].status == '1'){
  661. tabStr += `<li class="tab" data-name="${tabList[i].code}" ><span>${tabList[i].name}</span></li>`
  662. }
  663. }
  664. tabStr += `</ul><div class="numPop"></div>`;
  665. $(".tabList").append(tabStr)
  666. let tabNum = 0;
  667. if(isTcm=='true'){
  668. tabNum = $(".tabList .tab").length-1;
  669. }
  670. $(".tabList .tab").eq(tabNum).addClass("activeTab")
  671. let showModuleName = $(".tabList .tab").eq(tabNum).attr("data-name")
  672. getModuleShow(moduleConfig[showModuleName])
  673. bindTabClick()
  674. }
  675. function titleStr(type){
  676. let titleStr = ''
  677. titleStr += `<h4 class="moduleTitle" style="background:${titleConfig[type].background}"><img class="titleIcon" src=${titleConfig[type].icon}>${titleConfig[type].name}</h4>`
  678. return titleStr
  679. }
  680. function titleStr2(name){
  681. let titleStr = ''
  682. titleStr += `<p class="moduleBoxTitle">${name}:</p>`
  683. return titleStr
  684. }
  685. function bindTabClick(){
  686. $(".tabList .tab").off("click").on("click", function(){
  687. $(".activeTab").removeClass("activeTab")
  688. $(this).addClass("activeTab")
  689. const moduleName = $(this).attr("data-name")
  690. getModuleShow(moduleConfig[moduleName])
  691. if(moduleName == "medical"){
  692. $(".staticSearchT .ipt").find("input").focus()
  693. //$(".contentWrapper").css("overflowY","hidden")
  694. }else if(moduleName == 'followup'){
  695. // $(".contentWrapper").css("overflowY","auto")
  696. }
  697. })
  698. }
  699. function getModuleShow(moduleClassName){
  700. if( $(`.${moduleClassName}`).css("display") =="none"){
  701. $(".moduleWrapper").css("display","none")
  702. $(`.${moduleClassName}`).css("display","block")
  703. }
  704. }
  705. function bindGeneralSlide(){
  706. $(".showMoreGeneralTreat").off("click").on("click",function(){
  707. $(".generalTreatInfo").toggleClass("isOverFlow")
  708. $(".showMoreGeneralTreat").toggle()
  709. })
  710. $(".showLessGeneralTreat").off("click").on("click",function(){
  711. $(".generalTreatInfo").toggleClass("isOverFlow")
  712. $(".showMoreGeneralTreat").toggle()
  713. })
  714. }
  715. function bindSlideCaseWriting(){
  716. $(".showMoreCaseWriting").off("click").on("click",function(){
  717. $(this).parents(".casewritingWrapper ").find(".shortStrBox").css("display","none")
  718. $(this).parents(".casewritingWrapper ").find(".longStrBox").css("display","block")
  719. })
  720. $(".showLessCaseWriting").off("click").on("click",function(){
  721. $(this).parents(".casewritingWrapper ").find(".shortStrBox").css("display","block")
  722. $(this).parents(".casewritingWrapper ").find(".longStrBox").css("display","none")
  723. })
  724. }
  725. //显示空状态
  726. function empty(){
  727. setTimeout(function(){
  728. ifInputParam = hasInputParam();
  729. if(!ifInputParam){ //没有输入数据时
  730. $(".recommendBox .empty-box").hide();
  731. $(".recommendBox .empty").show();
  732. return;
  733. }
  734. const emptyShownBox = $('.recommendWrap .empty-box:visible').length;
  735. const configShownBox = $('.recommendWrap .moduleItem:visible').length;
  736. if(configShownBox===0&&emptyShownBox===0){ //有配置但没数据
  737. $('.empty-box').hide();
  738. $('.recommendBox .empty-null').show();
  739. return;
  740. }
  741. $(".empty-box").hide();
  742. },200);
  743. }
  744. $(function(){
  745. //隐藏logo
  746. if(getUrlArgObject("hideLg")){
  747. $(".disclaimer .logo").hide();
  748. }
  749. getDisclaimer(); //获取免责声明
  750. getVersion(); //获取版本信息
  751. $(".disclaimerInfo").on("click", function(){
  752. openNewWin("disclaimer.html")
  753. });
  754. $(".version-tip").on("click", function(){
  755. const ver = localStorage.getItem('versionTime');
  756. $(".version-tip").removeClass('new-icon');
  757. localStorage.setItem('versionTime',ver.replace("=new",""));
  758. openNewWin("version.html");
  759. });
  760. $.fn.extend({
  761. "preventScroll":function(){
  762. $(this).each(function(){
  763. var _this = this;
  764. if(navigator.userAgent.indexOf('Firefox') >= 0){ //firefox
  765. _this.addEventListener('DOMMouseScroll',function(e){
  766. _this.scrollTop += e.detail > 0 ? 60 : -60;
  767. e.preventDefault();
  768. },false);
  769. }else{
  770. _this.onmousewheel = function(e){
  771. e = e || window.event;
  772. _this.scrollTop += e.wheelDelta > 0 ? -60 : 60;
  773. return false;
  774. };
  775. }
  776. })
  777. }
  778. });
  779. $(window).on("resize", function(){
  780. adjustHei()
  781. })
  782. });