cdssHorizontal.js 27 KB

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