cdssHorizontal.js 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689
  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. let emptyImg = require('./../images/empty3.png').replace(/^undefined/g, '')
  18. require('./../images/new2.png').replace(/^undefined/g, '')
  19. const { post,config,getUrlArgObject,openNewWin,titleConfigH,throttle, } = require('./promise.js');
  20. let infoImg = require('./../images/icon_info.png').replace(/^undefined/g, '')
  21. let infoImgOn = require('./../images/icon_info_on.png').replace(/^undefined/g, '')
  22. let iconArrowUp = require('./../images/icon_arrow_up.png').replace(/^undefined/g, '')
  23. let iconArrowDown = require('./../images/icon_arrow_down.png').replace(/^undefined/g, '')
  24. let showImg = require('./../images/show2.png').replace(/^undefined/g, '')
  25. let collapseImg = require('./../images/collapse2.png').replace(/^undefined/g, '')
  26. let treatDisName,treatUniqueName
  27. let generalTreatInfo
  28. const { renderFollowUp } = require('./followUp.js');
  29. setWidth()
  30. let moduleConfig={
  31. auxiliary:"recommendWrap",
  32. qc:"qcWrap",
  33. medical:"medicalKonwledgeWrap",
  34. followup:'followUpWrap'
  35. }
  36. let allInterface = 0
  37. let hasCompleteTnterface = 0
  38. let moduleNum = 0
  39. let mrId = getUrlArgObject('mrId')
  40. const tipsMode = getUrlArgObject('tipsMode') || 1
  41. let planCode = getUrlArgObject('planCode') || 'all'
  42. let hospitalIdUrl = getUrlArgObject('hospitalId') || ''
  43. let msg;
  44. let tipsMsg;
  45. let caseWriteStandradList;
  46. function getMRInfo() {
  47. return post(config.getMr2,{mrId:mrId})
  48. }
  49. function getConf() {
  50. var msg = window.msg
  51. return post(config.getPushSet,{hospitalId:hospitalIdUrl||msg.hospitalId||1,planCode: planCode})
  52. }
  53. function getPushInfo() {
  54. return post(config.pushInner, Object.assign({}, msg, {
  55. featureType: '1,4,5,6,7,8,9,10,12',
  56. hospitalId: hospitalIdUrl || msg.hospitalId,
  57. ruleType: config.ruleTypeMap['22']
  58. }))
  59. }
  60. function getPusgWarning(){
  61. return post(config.indicationPush,Object.assign({},msg,{ruleType: '1,2,3,4',hospitalId:hospitalIdUrl||msg.hospitalId}))
  62. }
  63. function getWriteStandardPush(){
  64. return post(config.caseWritingPrompt,Object.assign({},msg,{hospitalId:2||msg.hospitalId}))
  65. }
  66. if(mrId){
  67. Promise.all([getConf(),getMRInfo()]).then(([res1,res2])=>{
  68. const data = res1.data.data&&res1.data.data[0]
  69. msg = res2.data.data ||{}
  70. if(!(msg&&msg.diseaseName&&msg.diseaseName.name)){
  71. msg.diseaseName={}
  72. }
  73. window.msg = msg
  74. renderPage(data)
  75. })
  76. } else{
  77. getConf().then(res =>{
  78. if(res.data.code == '0'){
  79. // const configArr = res.data.data.pushSetList || []
  80. // getPageInfo(configArr)
  81. const data = res.data.data&&res.data.data[0]
  82. renderPage(data)
  83. }
  84. })
  85. }
  86. function renderPage(pageSet){
  87. if(!pageSet || !pageSet.sysSetInfo){
  88. return
  89. }
  90. renderTab(pageSet.sysSetInfo)
  91. const iframeHei = $(".bodyWrap").height()
  92. const tabHei = $(".tabList").height()
  93. $(".contentWrapper").css("height",iframeHei-tabHei-10-20-30+'px')
  94. const hasAuxiliary = hasTab("辅助信息",pageSet.sysSetInfo)
  95. const hasMedical = hasTab("医学知识",pageSet.sysSetInfo)
  96. const hasFollowUp = hasTab("随访计划",pageSet.sysSetInfo)
  97. if(hasAuxiliary){
  98. renderModuleWrapper(hasAuxiliary.planDetails)
  99. let needPush = isNeedPush(hasAuxiliary.planDetails)
  100. let needPushWarning = isNeedPushWarning(hasAuxiliary.planDetails)
  101. let needWriteStandardPush = isNeedwriteStandardPush(hasAuxiliary.planDetails)
  102. if(needPush || needPushWarning){
  103. renderPushData()
  104. allInterface++
  105. }
  106. if(needPushWarning){
  107. renderPushWarning()
  108. allInterface++
  109. }
  110. if(needWriteStandardPush){
  111. renderCaseWrite()
  112. allInterface++
  113. }
  114. if(hasFollowUp){
  115. renderFollowUp(msg,1)
  116. }
  117. }
  118. }
  119. function renderTab(tabList){
  120. if(!tabList){
  121. return
  122. }
  123. let tabStr = ''
  124. let TabNum = 0
  125. for(let i = 0; i < tabList.length; i++){
  126. if(tabList[i].status == '1'){
  127. TabNum++
  128. tabStr += `<span class="tab" style="border-bottom:${tabList.length==i+1?'0':'1px solid #3B9ED0'}" data-name="${tabList[i].code}" ><span class="tabName">${tabList[i].name}</span><span class="activeLine"></span></span>`
  129. }
  130. }
  131. $(".tabList").append(tabStr)
  132. $(".tabList .tab").eq(0).addClass("activeTab")
  133. $(".tabList .tab").css("height", 1/TabNum * 100 + '%')
  134. let showModuleName = $(".tabList .tab").eq(0).attr("data-name")
  135. getModuleShow(moduleConfig[showModuleName])
  136. bindTabClick()
  137. setTabNameTop()
  138. }
  139. function hasTab(tabName,tabList){
  140. for(let i = 0; i < tabList.length; i++){
  141. if(tabList[i].name == tabName){
  142. return tabList[i]
  143. }
  144. }
  145. return false
  146. }
  147. function renderModuleWrapper(moduleList){
  148. if(!moduleList){
  149. return
  150. }
  151. let moduleStr = '',treatStr=""
  152. for(let i = 0; i < moduleList.length; i++){
  153. if(moduleList[i].status !='0'){
  154. if(moduleList[i].code == 'general' || moduleList[i].code == 'medicine' || moduleList[i].code == 'operation'){
  155. treatStr += `<div class="moduleItem ${moduleList[i].code }" data-num="${moduleList[i].number}" style="display:none"><span class="moduleItemTitBox"></span></div>`
  156. }else if(moduleList[i].code == 'critical'){
  157. moduleStr += `<div class="moduleItem warning" data-num="${moduleList[i].number}" style="display:none"><span class="moduleItemTitBox"></span></div>`
  158. // moduleStr += `<div class="moduleItem tips" data-num="${moduleList[i].number}" style="display:none"><span class="moduleItemTitBox"></span></div>`
  159. }else{
  160. moduleStr += `<div class="moduleItem ${moduleList[i].code }" data-num="${moduleList[i].number}" style="display:none"><span class="moduleItemTitBox"></span></div>`
  161. }
  162. }
  163. }
  164. $(".recommendWrap .leftBox").append(moduleStr)
  165. $(".recommendWrap .rightBox").append(treatStr)
  166. }
  167. function isNeedPush(list){
  168. let pushCode = ["diag","lis","pacs","symptom","vital"]
  169. for(let i = 0; i < list.length; i++){
  170. if(pushCode.indexOf(list[i].code)>-1){
  171. if(list[i].status == "1"){
  172. return true
  173. }
  174. }
  175. }
  176. return false
  177. }
  178. function isNeedPushWarning(list){
  179. let pushCode = ["tips"]
  180. for(let i = 0; i < list.length; i++){
  181. if(pushCode.indexOf(list[i].code)>-1){
  182. if(list[i].status == "1"){
  183. return true
  184. }
  185. }
  186. }
  187. return false
  188. }
  189. function isNeedwriteStandardPush(list){
  190. let pushCode = ["casewriting"]
  191. for(let i = 0; i < list.length; i++){
  192. if(pushCode.indexOf(list[i].code)>-1){
  193. if(list[i].status == "1"){
  194. return true
  195. }
  196. }
  197. }
  198. return false
  199. }
  200. function bindTabClick(){
  201. $(".tabList .tab").on("click", function(){
  202. $(".activeTab").removeClass("activeTab")
  203. $(this).addClass("activeTab")
  204. const moduleName = $(this).attr("data-name")
  205. getModuleShow(moduleConfig[moduleName])
  206. })
  207. }
  208. function getModuleShow(moduleClassName){
  209. if( $(`.${moduleClassName}`).css("display") =="none"){
  210. $(".moduleWrapper").css("display","none")
  211. $(`.${moduleClassName}`).css("display","block")
  212. }
  213. }
  214. function setTabNameTop(){
  215. tabNameList = $(".tabList .tab .tabName")
  216. for(let i = 0; i < tabNameList.length; i++){
  217. let tabNameHei = $(".tabList .tab .tabName").eq(i).height()
  218. $(".tabList .tab .tabName").eq(i).css("marginTop",-tabNameHei/2+"px")
  219. }
  220. }
  221. function renderCaseWrite(){
  222. getWriteStandardPush().then(res =>{
  223. hasCompleteTnterface++
  224. if(res.data.code == '0'){
  225. const caseWriteList = res.data.data || {}
  226. let caseWritePush = Object.keys(caseWriteList) || []
  227. renderwriteStandardPage(caseWritePush)
  228. if($(".moduleItem.casewriting")){
  229. let casewritingHei = $(".moduleItem.casewriting")[0].scrollHeight
  230. if(casewritingHei > 81){
  231. $(".casewriting").append(`<span class="showMoreCaseWrite">更多</span>`)
  232. caseWriteStandradList = caseWritePush
  233. showMoreCaseWrite()
  234. }
  235. }
  236. }
  237. })
  238. }
  239. function renderPushData(){
  240. return getPushInfo().then(res =>{
  241. hasCompleteTnterface++
  242. if(res.data.code == "0"){
  243. const result = res.data.data
  244. let diagPush = result.dis ||{}
  245. let lisPush = result.lis || []
  246. let scalePush = result.scale || []
  247. let pacsPush = result.pacs || []
  248. let symptomPush = result.symptom ||[]
  249. let checkupPush = result.vital ||[]
  250. let medicinesPush = result.medicines || []
  251. let operationsPush = result.operations ||[]
  252. let treatPush = result.treat&&result.treat[0] ||{}
  253. treatDisName = treatPush&&treatPush["name"]
  254. treatUniqueName = treatPush&&treatPush["uniqueName"]
  255. let generaTreatPush = treatPush&&treatPush["generaTreat"]
  256. generalTreatInfo = generaTreatPush
  257. // let lisPush =[{name:"血常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null}]
  258. // let pacsPush = [{name:"胸部x射线",hisNameList:null},{name:"心电图",hisNameList:null}]
  259. // let checkupPush = [{name:"神志表情",hisNameList:null},{name:"面部表情",hisNameList:null}]
  260. let lisNum = $(".moduleItem.lis").attr("data-num") || 5
  261. let scaleNum = $(".moduleItem.evaluation").attr("data-num") || 5
  262. let pacsNum = $(".moduleItem.pacs").attr("data-num") || 5
  263. let checkupNum = $(".moduleItem.vital").attr("data-num") || 5
  264. let symptomNum = $(".moduleItem.symptom").attr("data-num") || 5
  265. let medicinesNum = $(".moduleItem.medicine").attr("data-num") || 5
  266. let operationsNum = $(".moduleItem.operation").attr("data-num") || 5
  267. renderLis(lisPush,lisNum,3,true)
  268. renderScale(scalePush,scaleNum,8,true)
  269. renderPacs(pacsPush,pacsNum,5,true)
  270. renderCheckup(checkupPush,checkupNum,null,true)
  271. renderSymptomPush(symptomPush,symptomNum,null,true)
  272. renderDiag(diagPush)
  273. if(medicinesPush.length > 0 || operationsPush.length > 0||generaTreatPush){
  274. let str = `<img class="treatIcon" src = ${titleConfigH["treat"].icon} /><span>${titleConfigH["treat"].name}</span>`
  275. $(".rightBoxTitle").append(str)
  276. renderDisName()
  277. $(".rightWrapper").css("display","inline-block")
  278. $(".leftWrapper").css("borderRight","1px solid #E6E6E6")
  279. }else{
  280. $(".leftWrapper").css({
  281. borderRight: "0px",
  282. width: "100%"
  283. })
  284. }
  285. if((!$(".moduleItem.medicine")&&!$(".moduleItem.operation")&&!(".moduleItem.general")) ||($(".moduleItem.general").length === 0&&$(".moduleItem.medicine").length === 0&&$(".moduleItem.operation").length === 0)){
  286. $(".rightWrapper").css("display","none")
  287. $(".leftWrapper").css({
  288. borderRight: "0px",
  289. width: "100%"
  290. })
  291. }
  292. rendergeneraTreatPush(generaTreatPush)
  293. renderMedicinesPush(medicinesPush,medicinesNum,2,true)
  294. renderOperationPush(operationsPush,operationsNum,6,true)
  295. // if(hasCompleteTnterface === allInterface){
  296. // $('.loading').css("display","none")
  297. // if(moduleNum === 0){
  298. // empty()
  299. // }
  300. // }icon
  301. bindOpenInfo()
  302. bindSlide()
  303. moreInfo()
  304. }
  305. })
  306. }
  307. function renderLis(list,showNum,type,hasInfo){
  308. if(list.length > 0 && $(".moduleItem.lis").length > 0){
  309. moduleNum++
  310. $('.moduleItem.lis .moduleItemTitBox').append(titleStr("lisPush"))
  311. let {shortStr, longStr} = renderItemWrapper(list,showNum,type,hasInfo)
  312. $('.moduleItem.lis').append(shortStr)
  313. $('.moduleItem.lis').append(renderLongStr(titleConfigH["lisPush"].name,longStr,titleConfigH["lisPush"].location))
  314. $('.moduleItem.lis').css("display","block")
  315. }
  316. }
  317. function renderScale(list,showNum,type,hasInfo){
  318. if(list.length > 0 && $(".moduleItem.evaluation").length > 0){
  319. moduleNum++
  320. $('.moduleItem.evaluation .moduleItemTitBox').append(titleStr("scalePush"))
  321. let {shortStr, longStr} = renderItemWrapper(list,showNum,type,hasInfo)
  322. $('.moduleItem.evaluation').append(shortStr)
  323. $('.moduleItem.evaluation').append(renderLongStr(titleConfigH["scalePush"].name,longStr,titleConfigH["scalePush"].location))
  324. $('.moduleItem.evaluation').css("display","block")
  325. }
  326. }
  327. function renderPacs(list,showNum,type,hasInfo){
  328. if(list.length > 0 && $(".moduleItem.pacs").length > 0){
  329. moduleNum++
  330. $('.moduleItem.pacs .moduleItemTitBox').append(titleStr("pacsPush"))
  331. let {shortStr, longStr} = renderItemWrapper(list,showNum,type,hasInfo)
  332. $(".moduleItem.pacs").append(shortStr)
  333. $(".moduleItem.pacs").append(renderLongStr(titleConfigH["pacsPush"].name,longStr,titleConfigH["pacsPush"].location))
  334. $('.moduleItem.pacs').css("display","block")
  335. }
  336. }
  337. function renderSymptomPush(list,showNum,type,hasInfo){
  338. if(list.length > 0 && $(".moduleItem.symptom").length > 0){
  339. moduleNum++
  340. $('.moduleItem.symptom .moduleItemTitBox').append(titleStr("symptomPush"))
  341. let {shortStr, longStr} = renderItemWrapper(list,showNum,type,hasInfo)
  342. $(".moduleItem.symptom").append(shortStr)
  343. $(".moduleItem.symptom").append(renderLongStr(titleConfigH["symptomPush"].name,longStr,titleConfigH["symptomPush"].location))
  344. $('.moduleItem.symptom').css("display","block")
  345. }
  346. }
  347. function renderMedicinesPush(list,showNum,type,hasInfo){
  348. if(list.length > 0 && $(".moduleItem.medicine").length > 0){
  349. moduleNum++
  350. $('.moduleItem.medicine .moduleItemTitBox').append(titleStr("drugPush"))
  351. let {shortStr, longStr} = renderItemWrapper(list,showNum,type,hasInfo)
  352. $(".moduleItem.medicine").append(shortStr)
  353. $(".moduleItem.medicine").append(renderLongStr(titleConfigH["drugPush"].name,longStr,titleConfigH["drugPush"].location))
  354. $(".moduleItem.medicine").css("display","block")
  355. }
  356. }
  357. function renderOperationPush(list,showNum,type,hasInfo){
  358. if(list.length > 0 && $(".moduleItem.operation").length > 0){
  359. moduleNum++
  360. $('.moduleItem.operation .moduleItemTitBox').append(titleStr("operationPush"))
  361. let {shortStr, longStr} = renderItemWrapper(list,showNum,type,hasInfo)
  362. $(".moduleItem.operation").append(shortStr)
  363. $(".moduleItem.operation").append(renderLongStr(titleConfigH["operationPush"].name,longStr,titleConfigH["operationPush"].location))
  364. $(".moduleItem.operation").css("display","block")
  365. }
  366. }
  367. function renderDisName(){
  368. $(".disName").append(`${treatDisName||''}`)
  369. }
  370. function rendergeneraTreatPush(list){
  371. if(list&&list.length > 0 && $(".moduleItem.general").length > 0){
  372. moduleNum++
  373. $('.moduleItem.general .moduleItemTitBox').append(titleStr("generaTreatPush"))
  374. let str = `<div class="generalTreatInfo clearfix isOverFlow">${list}</div>`
  375. $(".moduleItem.general").append(str)
  376. setTimeout(function(){
  377. let generaTreatHei = $(".moduleItem .generalTreatInfo")[0].scrollHeight
  378. if(generaTreatHei >81){
  379. $(".moduleItem .generalTreatInfo").append(`<span class="showMoreGeneralTreat">更多</span>`)
  380. bindGeneralSlide()
  381. }
  382. })
  383. $(".moduleItem.general").css("display","block")
  384. }
  385. }
  386. function renderCheckup(list,showNum,type,hasInfo){
  387. if(list.length > 0 && $(".moduleItem.vital").length > 0){
  388. moduleNum++
  389. $(".moduleItem.vital .moduleItemTitBox").append(titleStr("checkupPush"))
  390. let {shortStr, longStr} = renderItemWrapper(list,showNum,type,hasInfo)
  391. $(".moduleItem.vital").append(shortStr)
  392. $(".moduleItem.vital").append(renderLongStr(titleConfigH["checkupPush"].name,longStr,titleConfigH["checkupPush"].location))
  393. $('.moduleItem.vital').css("display","block")
  394. }
  395. }
  396. function renderDiag(diagPush){
  397. let possibleDiagPush = diagPush["可能诊断"] || []
  398. let firstDiagPush = diagPush["初步诊断"] || []
  399. let identifyDiagPush = diagPush["鉴别诊断"] || []
  400. let warningDiagPush = diagPush["警惕"] || []
  401. let number = $('.moduleItem.diag').attr("data-num") || 5
  402. let warnNumber = $('.moduleItem.warning').attr("data-num") || 5
  403. $('.moduleItem.diag .moduleItemTitBox').append(titleStr("diagPush"))
  404. // 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}]
  405. // let firstDiagPush = [{name:"血常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null}]
  406. // let identifyDiagPush = diagPush["鉴别诊断"] || [{name:"血常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null}]
  407. renderDiagItem(possibleDiagPush,"可能诊断",number)
  408. renderDiagItem(firstDiagPush,"初步诊断",number)
  409. renderDiagItem(identifyDiagPush,"鉴别诊断",number)
  410. renderWarningDiag(warningDiagPush,"警惕",1000)
  411. moreInfo()
  412. }
  413. function renderDiagItem(list,name,number){
  414. if(list.length === 0){
  415. return
  416. }
  417. let titleStr = `<span class="moduleBoxName">${name}</span>`
  418. let {shortStr, longStr} = renderItemWrapper(list,number,1,true)
  419. let boxStr = `<div class="moduleBox">
  420. ${titleStr}
  421. ${shortStr}
  422. </div>`
  423. $(".diag").append(boxStr)
  424. $(".diag").append(renderLongStr(name,longStr,"left"))
  425. $('.moduleItem.diag').css("display","block")
  426. }
  427. function renderWarningDiag(list,name,showNum){
  428. if(list.length > 0 && $(".moduleItem.warning").length > 0){
  429. moduleNum++
  430. $('.moduleItem.warning .moduleItemTitBox').append(titleStr("vigilancePush"))
  431. let {shortStr, longStr} = renderItemWrapper(list,showNum,1,true)
  432. $('.moduleItem.warning').append(shortStr)
  433. $('.moduleItem.warning').css("display","block")
  434. }
  435. }
  436. function renderwriteStandardPage(list){
  437. if(list.length > 0 && $(".moduleItem.casewriting").length > 0){
  438. moduleNum++
  439. $(".moduleItem.casewriting .moduleItemTitBox").append(titleStr("casewritingPush"))
  440. let str = ``
  441. for(let i = 0; i < list.length; i++){
  442. str += `<p>${list[i]}</p>`
  443. }
  444. $(".moduleItem.casewriting").append(str)
  445. $('.moduleItem.casewriting').css("display","block")
  446. }
  447. }
  448. function renderPushWarning(){
  449. return getPusgWarning().then(res =>{
  450. hasCompleteTnterface++
  451. if(res.data.code == '0'){
  452. const result = res.data.data
  453. let billMsgList = result.billMsgList || [] //开单合理性提醒
  454. let highRiskList = result.highRiskList || [] //高危药品、手术
  455. let criticalValList = result.criticalValList || [] //危急值提醒
  456. let noteList = result.noteList || [] //检查内容注意事项
  457. let dubugStr = result.dubugStr || [] //注意调试信息
  458. let otherList = result.otherList || [] //其他提醒
  459. $('.moduleItem.tips .moduleItemTitBox').append(titleStr('warning'))
  460. renderBillingPush(billMsgList,'开单合理性')
  461. renderBillingPush(highRiskList,'高风险提示')
  462. renderBillingPush(criticalValList,'危急值提醒')
  463. renderBillingPush(noteList,'检查注意事项')
  464. renderBillingPush(otherList,'其他提醒')
  465. moreInfo()
  466. if($(".moduleItem.tips")){
  467. let tipsHei = $(".moduleItem.tips")[0].scrollHeight
  468. if(tipsHei > 81){
  469. $(".tips").append(`<span class="showMoreNewPage">更多</span>`)
  470. tipsMsg = result
  471. showMoreNewPage()
  472. }
  473. }
  474. // renderBillingPush(dubugStr,'注意调试信息')
  475. }
  476. if(hasCompleteTnterface === allInterface){
  477. $('.loading').css("display","none")
  478. if(moduleNum === 0){//console.log(999)
  479. // empty()
  480. }
  481. }
  482. })
  483. }
  484. function renderBillingPush(list,name){
  485. if(list.length === 0){
  486. return
  487. }
  488. let str = ``
  489. for(let i = 0; i < list.length; i++){
  490. str += `<div class="billingPushItem">${list[i].msg}</div>`
  491. }
  492. let titleStr = `<span class="moduleBoxName">${name}</span>`
  493. let boxStr = `<div class="moduleBox">
  494. ${titleStr}
  495. ${str}
  496. </div>`
  497. $(".tips").append(boxStr)
  498. $('.moduleItem.tips').css("display","block")
  499. }
  500. function renderLongStr(name,longStr,location){
  501. if(!longStr){
  502. return
  503. }
  504. let str = `
  505. <div class="longStrBox" data-location="${location}">
  506. <span class="longStrBoxTitle">${name}:</span>
  507. ${longStr}
  508. </div>
  509. `
  510. return str
  511. }
  512. function renderItemWrapper(list,showNum,type,hasInfo){
  513. let showNum1 = showNum || 5
  514. let shortStr = '', longStr = ''
  515. for(let i = 0; i < list.length; i++){
  516. if(i <= showNum1-1){
  517. shortStr += renderPushItem(list[i],type)
  518. }
  519. longStr += renderPushItem(list[i],type)
  520. }
  521. if(showNum1 >= list.length){
  522. return {
  523. shortStr:`<div class="shortBox">${shortStr}</div>`,
  524. longStr:''
  525. }
  526. }else{
  527. shortStr += `<span class="showMore"> <img class="iconArrowImg" src="${showImg}"></span>`
  528. longStr += `<span class="showLess"><img class="iconArrowImg" src="${collapseImg}"></span>`
  529. return {
  530. shortStr:`<div class="shortBox clearfix">${shortStr}</div>`,
  531. longStr:`<div class="longBox clearfix">${longStr}</div>`
  532. }
  533. }
  534. }
  535. function renderPushItem(item,type){
  536. str= `<span class="pushItemBox" data-name="${item.name}" data-type="${type}"><span class="pushItemName">${type==8?('【'+item.name+'】'):item.name}</span>${item.hasInfo=="1"?`<img class="infoImg" src="${infoImg}">`:""}</span>`
  537. return str
  538. }
  539. function bindOpenInfo(){
  540. $(".infoImg").on("mouseenter", function(){
  541. $(this).attr("src", infoImgOn)
  542. }).on("mouseleave", function(){
  543. $(this).attr("src", infoImg)
  544. })
  545. }
  546. function titleStr(type){
  547. let titleStr = ''
  548. titleStr += `<div class="moduleTitle"><img class="titleIcon" src=${titleConfigH[type].icon}>${titleConfigH[type].name}:</div>`
  549. return titleStr
  550. }
  551. function bindSlide(){
  552. $(".showMore").on("click", function(){
  553. $(".longStrBox").css("display","none")
  554. $(this).parents(".moduleItem ").find(".longStrBox").css("display","block")
  555. let location = $(this).parents(".moduleItem ").find(".longStrBox").attr("data-location")
  556. let scrollTop = getLongTop(location)
  557. $(this).parents(".moduleItem ").find(".longStrBox").css("top", 5 +Number(scrollTop)+ "px")
  558. })
  559. $(".showLess").on("click", function(){
  560. $(this).parent().parent().css("display","none")
  561. })
  562. addScrollEvent()
  563. }
  564. function showMoreNewPage(){
  565. $(".showMoreNewPage").on("click", function(){
  566. // openNewWin(`smartAlert.html?billMsgList=${encodeURIComponent(billMsgList)}&highRiskList=${encodeURIComponent(highRiskList)}&criticalValList=${encodeURIComponent(criticalValList)}&noteList=${encodeURIComponent(noteList)}`)
  567. openNewWin(`smartAlert.html?mrId=${mrId}&hospitalId=${hospitalIdUrl}`)
  568. })
  569. }
  570. function showMoreCaseWrite(){
  571. $(".showMoreCaseWrite").on("click", function(){
  572. // openNewWin(`smartAlert.html?billMsgList=${encodeURIComponent(billMsgList)}&highRiskList=${encodeURIComponent(highRiskList)}&criticalValList=${encodeURIComponent(criticalValList)}&noteList=${encodeURIComponent(noteList)}`)
  573. openNewWin(`caseWriteStandard.html?caseWriteStandradList=${encodeURIComponent(JSON.stringify(caseWriteStandradList))}`)
  574. })
  575. }
  576. function bindGeneralSlide(){
  577. $(".showMoreGeneralTreat").on("click",function(){
  578. openNewWin(`generalTreat.html?disName=${treatDisName}&name=${treatUniqueName}`)
  579. })
  580. }
  581. function setWidth(){
  582. let winWidth = $(".bodyWrap").css("width")
  583. $(".contentBox").css("width",winWidth)
  584. }
  585. //医学知识搜索
  586. searchMedical()
  587. function searchMedical(){
  588. $(".medicalKonwledgeWrap .search").on("click", function(){
  589. openNewWin(`homeStatic.html?mrId=${mrId}&hospitalId=${hospitalIdUrl}&planCode=${planCode}`)
  590. })
  591. }
  592. function moreInfo() {
  593. $('.infoImg').off("click").click(function(){
  594. const name = $(this).parent().attr('data-name')
  595. const type = $(this).parent().attr('data-type')
  596. openNewWin(`staticInfo.html?type=${encodeURIComponent(type)}&position=0&name=${encodeURIComponent(name)}`)
  597. })
  598. }
  599. function getVersion() {
  600. return post(config.getVersion, 'confArr').then((res) => {
  601. const data = res.data.data;
  602. const ver = localStorage.getItem('versionTime');
  603. const time = data.refreshTime;
  604. if(!ver||ver===time+"=new"||time!==ver.replace("=new","")){ //判断版本是否更新
  605. $(".versionBottom").addClass('new-icon');
  606. localStorage.setItem('versionTime',time+"=new"); //保存版本更新时间
  607. }else{
  608. $(".versionBottom").removeClass("new-icon");
  609. }
  610. })
  611. }
  612. function getLongTop(type){
  613. let scrollTop = 0
  614. if(type === "left"){
  615. scrollTop = $(".leftWrapper").scrollTop() || 0
  616. }else if(type === "right"){
  617. scrollTop = $(".rightWrapper").scrollTop() || 0
  618. }
  619. return scrollTop
  620. }
  621. function addScrollEvent(){
  622. $(`.leftWrapper`).off("scroll").scroll(throttle(function(){
  623. if($(".leftWrapper .longStrBox:visible").length){
  624. $(".leftWrapper .longStrBox:visible").css("top",Number(getLongTop("left"))+5+"px")
  625. }
  626. }, 100));
  627. $(`.rightWrapper`).off("scroll").scroll(throttle(function(){
  628. if($(".rightWrapper .longStrBox").css("display") === "block"){
  629. $(".rightWrapper .longStrBox").css("top",Number(getLongTop("right"))+5+"px")
  630. }
  631. }, 100));
  632. }
  633. $(function(){
  634. getVersion()
  635. $(window).on("resize",function(){
  636. setWidth()
  637. })
  638. $(".versionTop").on("click", function(){
  639. openNewWin("disclaimer.html")
  640. });
  641. $(".versionBottom").on("click", function(){
  642. const ver = localStorage.getItem('versionTime');
  643. $(".versionBottom").removeClass('new-icon');
  644. localStorage.setItem('versionTime',ver.replace("=new",""));
  645. openNewWin("version.html");
  646. });
  647. })
  648. // function empty(){
  649. // $(".responsibility").css("display","none")
  650. // $('.recommendWrap .empty').css("display","block")
  651. // }