cdssHorizontal.js 26 KB

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