cdss.js 29 KB

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