cdssHorizontal.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491
  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. const $ = require("jquery");
  10. require('./../css/reset.css');
  11. require('./../css/cdssHorizontal.less');
  12. require('./../css/popup.css');
  13. require('./../css/staticSearch.css')
  14. require('./../js/staticSearch.js')
  15. require('./../images/empty2.png').replace(/^undefined/g, '')
  16. require('./../images/loading.gif').replace(/^undefined/g, '')
  17. const { post,config,getUrlArgObject,openNewWin,titleConfigH } = require('./promise.js');
  18. let infoImg = require('./../images/icon_info.png').replace(/^undefined/g, '')
  19. let infoImgOn = require('./../images/icon_info_on.png').replace(/^undefined/g, '')
  20. let iconArrowUp = require('./../images/icon_arrow_up.png').replace(/^undefined/g, '')
  21. let iconArrowDown = require('./../images/icon_arrow_down.png').replace(/^undefined/g, '')
  22. let showImg = require('./../images/show.png').replace(/^undefined/g, '')
  23. let collapseImg = require('./../images/collapse.png').replace(/^undefined/g, '')
  24. setWidth()
  25. let moduleConfig={
  26. auxiliary:"recommendWrap",
  27. qc:"qcWrap",
  28. medical:"medicalKonwledgeWrap"
  29. }
  30. let allInterface = 0
  31. let hasCompleteTnterface = 0
  32. let moduleNum = 0
  33. let mrId = getUrlArgObject('mrId')
  34. const tipsMode = getUrlArgObject('tipsMode') || 1
  35. let planCode = getUrlArgObject('planCode') || 'all'
  36. let hospitalIdUrl = getUrlArgObject('hospitalId') || ''
  37. let msg;
  38. function getMRInfo() {
  39. return post(config.getMr2,{mrId:mrId})
  40. }
  41. function getConf() {
  42. var msg = window.msg
  43. return post(config.getPushSet,{hospitalId:hospitalIdUrl||msg.hospitalId||1,planCode: planCode})
  44. }
  45. function getPushInfo() {
  46. return post(config.pushInner,Object.assign({},msg,{featureType: '1,4,5,6,7,8,9',hospitalId:hospitalIdUrl||msg.hospitalId,ruleType:config.ruleTypeMap['22']}))
  47. }
  48. function getPusgWarning(){
  49. return post(config.indicationPush,Object.assign({},msg,{ruleType: '1,2,3',hospitalId:hospitalIdUrl||msg.hospitalId}))
  50. }
  51. if(mrId){
  52. getMRInfo().then(res =>{
  53. if(res.data.code == '0'){
  54. msg = res.data.data ||{}
  55. window.msg = msg
  56. }
  57. }).catch(function (err) {
  58. console.log(err);
  59. })
  60. }
  61. getConf().then(res =>{
  62. if(res.data.code == '0'){
  63. // const configArr = res.data.data.pushSetList || []
  64. // getPageInfo(configArr)
  65. const data = res.data.data&&res.data.data[0]
  66. renderPage(data)
  67. }
  68. })
  69. function renderPage(pageSet){
  70. renderTab(pageSet.sysSetInfo)
  71. const iframeHei = $(".bodyWrap").height()
  72. const tabHei = $(".tabList").height()
  73. $(".contentWrapper").css("height",iframeHei-tabHei-10-20-30+'px')
  74. const hasAuxiliary = hasTab("辅助信息",pageSet.sysSetInfo)
  75. const hasMedical = hasTab("医学知识",pageSet.sysSetInfo)
  76. if(hasAuxiliary){
  77. renderModuleWrapper(hasAuxiliary.planDetails)
  78. let needPush = isNeedPush(hasAuxiliary.planDetails)
  79. let needPushWarning = isNeedPushWarning(hasAuxiliary.planDetails)
  80. if(needPush || needPushWarning){
  81. renderPushData()
  82. allInterface++
  83. }
  84. if(needPushWarning){
  85. renderPushWarning()
  86. allInterface++
  87. }
  88. }
  89. }
  90. function renderTab(tabList){
  91. let tabStr = ''
  92. let TabNum = 0
  93. for(let i = 0; i < tabList.length; i++){
  94. if(tabList[i].status == '1'){
  95. TabNum++
  96. tabStr += `<span class="tab" data-name="${tabList[i].code}" ><span class="tabName">${tabList[i].name}</span><span class="activeLine"></span></span>`
  97. }
  98. }
  99. $(".tabList").append(tabStr)
  100. $(".tabList .tab").eq(0).addClass("activeTab")
  101. $(".tabList .tab").css("height", 1/TabNum * 100 + '%')
  102. let showModuleName = $(".tabList .tab").eq(0).attr("data-name")
  103. getModuleShow(moduleConfig[showModuleName])
  104. bindTabClick()
  105. setTabNameTop()
  106. }
  107. function hasTab(tabName,tabList){
  108. for(let i = 0; i < tabList.length; i++){
  109. if(tabList[i].name == tabName){
  110. return tabList[i]
  111. }
  112. }
  113. return false
  114. }
  115. function renderModuleWrapper(moduleList){
  116. let moduleStr = '',treatStr=""
  117. for(let i = 0; i < moduleList.length; i++){
  118. if(moduleList[i].status !='0'){
  119. if(moduleList[i].code == 'treat'){
  120. treatStr += `<div class="moduleItem medicine" data-num="${moduleList[i].number}" style="display:none"><span class="moduleItemTitBox"></span></div>`
  121. treatStr += `<div class="moduleItem operation" data-num="${moduleList[i].number}" style="display:none"><span class="moduleItemTitBox"></span></div>`
  122. }else if(moduleList[i].code == 'tips'){
  123. moduleStr += `<div class="moduleItem warning" data-num="${moduleList[i].number}" style="display:none"><span class="moduleItemTitBox"></span></div>`
  124. moduleStr += `<div class="moduleItem tips" data-num="${moduleList[i].number}" style="display:none"><span class="moduleItemTitBox"></span></div>`
  125. }else{
  126. moduleStr += `<div class="moduleItem ${moduleList[i].code }" data-num="${moduleList[i].number}" style="display:none"><span class="moduleItemTitBox"></span></div>`
  127. }
  128. }
  129. }
  130. $(".recommendWrap .leftBox").append(moduleStr)
  131. $(".recommendWrap .rightBox").append(treatStr)
  132. }
  133. function isNeedPush(list){
  134. let pushCode = ["diag","lis","pacs","symptom","vital"]
  135. for(let i = 0; i < list.length; i++){
  136. if(pushCode.indexOf(list[i].code)>-1){
  137. return true
  138. }
  139. }
  140. return false
  141. }
  142. function isNeedPushWarning(list){
  143. let pushCode = ["tips"]
  144. for(let i = 0; i < list.length; i++){
  145. if(pushCode.indexOf(list[i].code)>-1){
  146. return true
  147. }
  148. }
  149. return false
  150. }
  151. function bindTabClick(){
  152. $(".tabList .tab").on("click", function(){
  153. $(".activeTab").removeClass("activeTab")
  154. $(this).addClass("activeTab")
  155. const moduleName = $(this).attr("data-name")
  156. getModuleShow(moduleConfig[moduleName])
  157. })
  158. }
  159. function getModuleShow(moduleClassName){
  160. console.log("moduleClassName",moduleClassName)
  161. if( $(`.${moduleClassName}`).css("display") =="none"){
  162. $(".moduleWrapper").css("display","none")
  163. $(`.${moduleClassName}`).css("display","block")
  164. }
  165. }
  166. function setTabNameTop(){
  167. tabNameList = $(".tabList .tab .tabName")
  168. for(let i = 0; i < tabNameList.length; i++){
  169. let tabNameHei = $(".tabList .tab .tabName").eq(i).height()
  170. console.log("tabNameHei",tabNameList)
  171. $(".tabList .tab .tabName").eq(i).css("marginTop",-tabNameHei/2+"px")
  172. }
  173. }
  174. function renderPushData(){
  175. return getPushInfo().then(res =>{
  176. hasCompleteTnterface++
  177. if(res.data.code == "0"){
  178. const result = res.data.data
  179. let diagPush = result.dis
  180. let lisPush = result.lis || []
  181. let pacsPush = result.pacs || []
  182. let symptomPush = result.symptom ||[]
  183. let checkupPush = result.vital ||[]
  184. let medicinesPush = result.medicines || []
  185. let operationsPush = result.operations ||[]
  186. // let lisPush =[{name:"血常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null}]
  187. // let pacsPush = [{name:"胸部x射线",hisNameList:null},{name:"心电图",hisNameList:null}]
  188. // let checkupPush = [{name:"神志表情",hisNameList:null},{name:"面部表情",hisNameList:null}]
  189. let lisNum = $(".moduleItem.lis").attr("data-num") || 5
  190. let pacsNum = $(".moduleItem.pacs").attr("data-num") || 5
  191. let checkupNum = $(".moduleItem.vital").attr("data-num") || 5
  192. let symptomNum = $(".moduleItem.symptom").attr("data-num") || 5
  193. let medicinesNum = $(".moduleItem.medicine").attr("data-num") || 5
  194. let operationsNum = $(".moduleItem.operation").attr("data-num") || 5
  195. renderLis(lisPush,lisNum,3,true)
  196. renderPacs(pacsPush,pacsNum,5,true)
  197. renderCheckup(checkupPush,checkupNum,null,true)
  198. renderSymptomPush(symptomPush,symptomNum,null,true)
  199. renderDiag(diagPush)
  200. if(medicinesPush.length > 0 || operationsPush.length > 0){
  201. let str = `<img class="treatIcon" src = ${titleConfigH["treat"].icon} /><span>${titleConfigH["treat"].name}</span>`
  202. $(".rightBoxTitle").append(str)
  203. $(".rightWrapper").css("display","inline-block")
  204. }else{
  205. $(".leftWrapper").css({
  206. borderRight: "0px",
  207. width: "100%"
  208. })
  209. }
  210. renderMedicinesPush(medicinesPush,medicinesNum,2,true)
  211. renderOperationPush(operationsPush,operationsNum,6,true)
  212. // if(hasCompleteTnterface === allInterface){
  213. // $('.loading').css("display","none")
  214. // if(moduleNum === 0){
  215. // empty()
  216. // }
  217. // }icon
  218. bindOpenInfo()
  219. bindSlide()
  220. }
  221. })
  222. }
  223. function renderLis(list,showNum,type,hasInfo){
  224. if(list.length > 0 && $(".moduleItem.lis").length > 0){
  225. moduleNum++
  226. $('.moduleItem.lis .moduleItemTitBox').append(titleStr("lisPush"))
  227. let {shortStr, longStr} = renderItemWrapper(list,showNum,type,hasInfo)
  228. $('.moduleItem.lis').append(shortStr)
  229. $('.moduleItem.lis').append(renderLongStr(titleConfigH["lisPush"].name,longStr))
  230. $('.moduleItem.lis').css("display","block")
  231. }
  232. }
  233. function renderPacs(list,showNum,type,hasInfo){
  234. if(list.length > 0 && $(".moduleItem.pacs").length > 0){
  235. moduleNum++
  236. $('.moduleItem.pacs .moduleItemTitBox').append(titleStr("pacsPush"))
  237. let {shortStr, longStr} = renderItemWrapper(list,showNum,type,hasInfo)
  238. $(".moduleItem.pacs").append(shortStr)
  239. $(".moduleItem.pacs").append(renderLongStr(titleConfigH["pacsPush"].name,longStr))
  240. $('.moduleItem.pacs').css("display","block")
  241. }
  242. }
  243. function renderSymptomPush(list,showNum,type,hasInfo){
  244. if(list.length > 0 && $(".moduleItem.symptom").length > 0){
  245. moduleNum++
  246. $('.moduleItem.symptom .moduleItemTitBox').append(titleStr("symptomPush"))
  247. let {shortStr, longStr} = renderItemWrapper(list,showNum,type,hasInfo)
  248. $(".moduleItem.symptom").append(shortStr)
  249. $(".moduleItem.symptom").append(renderLongStr(titleConfigH["symptomPush"].name,longStr))
  250. $('.moduleItem.symptom').css("display","block")
  251. }
  252. }
  253. function renderMedicinesPush(list,showNum,type,hasInfo){
  254. if(list.length > 0 && $(".moduleItem.medicine").length > 0){
  255. moduleNum++
  256. $('.moduleItem.medicine .moduleItemTitBox').append(titleStr("drugPush"))
  257. let {shortStr, longStr} = renderItemWrapper(list,showNum,type,hasInfo)
  258. $(".moduleItem.medicine").append(shortStr)
  259. $(".moduleItem.medicine").append(renderLongStr(titleConfigH["drugPush"].name,longStr))
  260. $(".moduleItem.medicine").css("display","block")
  261. }
  262. }
  263. function renderOperationPush(list,showNum,type,hasInfo){
  264. if(list.length > 0 && $(".moduleItem.operation").length > 0){
  265. moduleNum++
  266. $('.moduleItem.operation .moduleItemTitBox').append(titleStr("operationPush"))
  267. let {shortStr, longStr} = renderItemWrapper(list,showNum,type,hasInfo)
  268. $(".moduleItem.operation").append(shortStr)
  269. $(".moduleItem.operation").append(renderLongStr(titleConfigH["operationPush"].name,longStr))
  270. $(".moduleItem.operation").css("display","block")
  271. }
  272. }
  273. function renderCheckup(list,showNum,type,hasInfo){
  274. if(list.length > 0 && $(".moduleItem.vital").length > 0){
  275. moduleNum++
  276. $(".moduleItem.vital .moduleItemTitBox").append(titleStr("checkupPush"))
  277. let {shortStr, longStr} = renderItemWrapper(list,showNum,type,hasInfo)
  278. $(".moduleItem.vital").append(shortStr)
  279. $(".moduleItem.vital").append(renderLongStr(titleConfigH["checkupPush"].name,longStr))
  280. $('.moduleItem.vital').css("display","block")
  281. }
  282. }
  283. function renderDiag(diagPush){
  284. let possibleDiagPush = diagPush["可能诊断"] || []
  285. let firstDiagPush = diagPush["初步诊断"] || []
  286. let identifyDiagPush = diagPush["鉴别诊断"] || []
  287. let warningDiagPush = diagPush["警惕"] || []
  288. let number = $('.moduleItem.diag').attr("data-num") || 5
  289. let warnNumber = $('.moduleItem.warning').attr("data-num") || 5
  290. $('.moduleItem.diag .moduleItemTitBox').append(titleStr("diagPush"))
  291. // let warningDiagPush = [{name:"血常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"血常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null}]
  292. // let firstDiagPush = [{name:"血常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null}]
  293. // let identifyDiagPush = diagPush["鉴别诊断"] || [{name:"血常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null}]
  294. renderDiagItem(possibleDiagPush,"可能诊断",number)
  295. renderDiagItem(firstDiagPush,"初步诊断",number)
  296. renderDiagItem(identifyDiagPush,"鉴别诊断",number)
  297. renderWarningDiag(warningDiagPush,"警惕",1000)
  298. moreInfo()
  299. }
  300. function renderDiagItem(list,name,number){
  301. if(list.length === 0){
  302. return
  303. }
  304. let titleStr = `<span class="moduleBoxName">${name}</span>`
  305. let {shortStr, longStr} = renderItemWrapper(list,number,1,true)
  306. let boxStr = `<div class="moduleBox">
  307. ${titleStr}
  308. ${shortStr}
  309. </div>`
  310. $(".diag").append(boxStr)
  311. $(".diag").append(renderLongStr(name,longStr))
  312. $('.moduleItem.diag').css("display","block")
  313. }
  314. function renderWarningDiag(list,name,showNum){
  315. if(list.length > 0 && $(".moduleItem.warning").length > 0){
  316. moduleNum++
  317. $('.moduleItem.warning .moduleItemTitBox').append(titleStr("vigilancePush"))
  318. console.log("")
  319. let {shortStr, longStr} = renderItemWrapper(list,showNum,1,true)
  320. $('.moduleItem.warning').append(shortStr)
  321. $('.moduleItem.warning').append(renderLongStr(titleConfigH["lisPush"].name,longStr))
  322. $('.moduleItem.warning').css("display","block")
  323. }
  324. }
  325. function renderPushWarning(){
  326. return getPusgWarning().then(res =>{
  327. hasCompleteTnterface++
  328. if(res.data.code == '0'){
  329. const result = res.data.data
  330. let billMsgList = result.billMsgList || [] //开单合理性提醒
  331. let highRiskList = result.highRiskList || [] //高危药品、手术
  332. let criticalValList = result.criticalValList || [] //危急值提醒
  333. let noteList = result.noteList || [] //检查内容注意事项
  334. let dubugStr = result.dubugStr || [] //注意调试信息
  335. $('.moduleItem.tips .moduleItemTitBox').append(titleStr('warning'))
  336. renderBillingPush(billMsgList,'开单合理性')
  337. renderBillingPush(highRiskList,'高风险提示')
  338. renderBillingPush(criticalValList,'危急值提醒')
  339. renderBillingPush(noteList,'检查注意事项')
  340. moreInfo()
  341. // renderBillingPush(dubugStr,'注意调试信息')
  342. }
  343. if(hasCompleteTnterface === allInterface){
  344. $('.loading').css("display","none")
  345. if(moduleNum === 0){
  346. empty()
  347. }
  348. }
  349. })
  350. }
  351. function renderBillingPush(list,name){
  352. if(list.length === 0){
  353. return
  354. }
  355. let str = ``
  356. for(let i = 0; i < list.length; i++){
  357. str += `<div class="billingPushItem">${list[i].msg}</div>`
  358. }
  359. let titleStr = `<span class="moduleBoxName">${name}</span>`
  360. let boxStr = `<div class="moduleBox">
  361. ${titleStr}
  362. ${str}
  363. </div>`
  364. $(".tips").append(boxStr)
  365. $('.moduleItem.tips').css("display","block")
  366. }
  367. function renderLongStr(name,longStr){
  368. if(!longStr){
  369. return
  370. }
  371. let str = `
  372. <div class="longStrBox">
  373. <span class="longStrBoxTitle">${name}:</span>
  374. ${longStr}
  375. </div>
  376. `
  377. return str
  378. }
  379. function renderItemWrapper(list,showNum,type,hasInfo){
  380. let showNum1 = showNum || 5
  381. let shortStr = '', longStr = ''
  382. for(let i = 0; i < list.length; i++){
  383. if(i <= showNum1-1){
  384. shortStr += renderPushItem(list[i],type)
  385. }
  386. longStr += renderPushItem(list[i],type)
  387. }
  388. if(showNum1 >= list.length){
  389. return {
  390. shortStr:`<div class="shortBox">${shortStr}</div>`,
  391. longStr:''
  392. }
  393. }else{
  394. shortStr += `<span class="showMore"> <img class="iconArrowImg" src="${showImg}"></span>`
  395. longStr += `<span class="showLess"><img class="iconArrowImg" src="${collapseImg}"></span>`
  396. return {
  397. shortStr:`<div class="shortBox clearfix">${shortStr}</div>`,
  398. longStr:`<div class="longBox clearfix">${longStr}</div>`
  399. }
  400. }
  401. }
  402. function renderPushItem(item,type){
  403. str= `<span class="pushItemBox" data-name="${item.name}" data-type="${type}"><span class="pushItemName">${item.name}</span>${item.hasInfo=="1"?`<img class="infoImg" src="${infoImg}">`:""}</span>`
  404. return str
  405. }
  406. function bindOpenInfo(){
  407. $(".infoImg").on("mouseenter", function(){
  408. $(this).attr("src", infoImgOn)
  409. }).on("mouseleave", function(){
  410. $(this).attr("src", infoImg)
  411. })
  412. }
  413. function titleStr(type){
  414. let titleStr = ''
  415. titleStr += `<div class="moduleTitle"><img class="titleIcon" src=${titleConfigH[type].icon}>${titleConfigH[type].name}:</div>`
  416. return titleStr
  417. }
  418. function bindSlide(){
  419. $(".showMore").on("click", function(){
  420. $(".longStrBox").css("display","none")
  421. $(this).parents(".moduleItem ").find(".longStrBox").css("display","block")
  422. })
  423. $(".showLess").on("click", function(){
  424. $(this).parent().parent().css("display","none")
  425. })
  426. }
  427. function setWidth(){
  428. let winWidth = $(".bodyWrap").css("width")
  429. $(".contentBox").css("width",winWidth)
  430. }
  431. //医学知识搜索
  432. searchMedical()
  433. function searchMedical(){
  434. $(".medicalKonwledgeWrap .search").on("click", function(){
  435. openNewWin(`staticSearch.html?searchType=1`)
  436. })
  437. }
  438. function moreInfo() {
  439. $('.infoImg').off("click").click(function(){
  440. const name = $(this).parent().attr('data-name')
  441. const type = $(this).parent().attr('data-type')
  442. openNewWin(`information.html?type=${encodeURIComponent(type)}&position=0&name=${encodeURIComponent(name)}`)
  443. })
  444. }
  445. $(function(){
  446. $(window).on("resize",function(){
  447. setWidth()
  448. })
  449. $(".versionTop").on("click", function(){
  450. openNewWin("disclaimer.html")
  451. });
  452. $(".versionBottom").on("click", function(){
  453. // const ver = localStorage.getItem('versionTime');
  454. // $(".version-tip").removeClass('new-icon');
  455. // localStorage.setItem('versionTime',ver.replace("=new",""));
  456. openNewWin("version.html");
  457. });
  458. })