cdssHorizontal.js 26 KB

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