cdssHorizontal.js 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736
  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, hasTcm);
  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.length > 0) {
  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. // $('.moduleItem.evaluation').children(".shortBox").children(".pushItemBox").children(".pushItemName").addClass("evaluationtitle")
  338. // $('.moduleItem.evaluation').children(".longStrBox").children(".longBox").children(".pushItemBox").children(".pushItemName").addClass("evaluationtitle")
  339. }
  340. }
  341. function renderNurse(list, showNum, type, hasInfo) {
  342. if (list.length > 0 && $(".moduleItem.nurse").length > 0) {
  343. moduleNum++
  344. $('.moduleItem.nurse .moduleItemTitBox').append(titleStr("nursePush"))
  345. let { shortStr, longStr } = renderItemWrapper(list, showNum, type, hasInfo)
  346. $(".moduleItem.nurse").append(shortStr)
  347. $(".moduleItem.nurse").append(renderLongStr(titleConfigH["nursePush"].name, longStr, titleConfigH["nursePush"].location))
  348. $(".moduleItem.nurse").css("display", "block")
  349. }
  350. }
  351. function renderPacs(list, showNum, type, hasInfo) {
  352. if (list.length > 0 && $(".moduleItem.pacs").length > 0) {
  353. moduleNum++
  354. $('.moduleItem.pacs .moduleItemTitBox').append(titleStr("pacsPush"))
  355. let { shortStr, longStr } = renderItemWrapper(list, showNum, type, hasInfo)
  356. $(".moduleItem.pacs").append(shortStr)
  357. $(".moduleItem.pacs").append(renderLongStr(titleConfigH["pacsPush"].name, longStr, titleConfigH["pacsPush"].location))
  358. $('.moduleItem.pacs').css("display", "block")
  359. }
  360. }
  361. function renderSymptomPush(list, showNum, type, hasInfo) {
  362. if (list.length > 0 && $(".moduleItem.symptom").length > 0) {
  363. moduleNum++
  364. $('.moduleItem.symptom .moduleItemTitBox').append(titleStr("symptomPush"))
  365. let { shortStr, longStr } = renderItemWrapper(list, showNum, type, hasInfo)
  366. $(".moduleItem.symptom").append(shortStr)
  367. $(".moduleItem.symptom").append(renderLongStr(titleConfigH["symptomPush"].name, longStr, titleConfigH["symptomPush"].location))
  368. $('.moduleItem.symptom').css("display", "block")
  369. }
  370. }
  371. function renderMedicinesPush(list, showNum, type, hasInfo) {
  372. if (list.length > 0 && $(".moduleItem.medicine").length > 0) {
  373. moduleNum++
  374. $('.moduleItem.medicine .moduleItemTitBox').append(titleStr("drugPush"))
  375. let { shortStr, longStr } = renderItemWrapper(list, showNum, type, hasInfo)
  376. $(".moduleItem.medicine").append(shortStr)
  377. $(".moduleItem.medicine").append(renderLongStr(titleConfigH["drugPush"].name, longStr, titleConfigH["drugPush"].location))
  378. $(".moduleItem.medicine").css("display", "block")
  379. }
  380. }
  381. function renderOperationPush(list, showNum, type, hasInfo) {
  382. if (list.length > 0 && $(".moduleItem.operation").length > 0) {
  383. moduleNum++
  384. $('.moduleItem.operation .moduleItemTitBox').append(titleStr("operationPush"))
  385. let { shortStr, longStr } = renderItemWrapper(list, showNum, type, hasInfo)
  386. $(".moduleItem.operation").append(shortStr)
  387. $(".moduleItem.operation").append(renderLongStr(titleConfigH["operationPush"].name, longStr, titleConfigH["operationPush"].location))
  388. $(".moduleItem.operation").css("display", "block")
  389. }
  390. }
  391. function renderDisName() {
  392. $(".disName").append(`${treatDisName || ''}`)
  393. }
  394. function rendergeneraTreatPush(list) {
  395. if (list && list.length > 0 && $(".moduleItem.general").length > 0) {
  396. moduleNum++
  397. $('.moduleItem.general .moduleItemTitBox').append(titleStr("generaTreatPush"))
  398. let str = `<div class="generalTreatInfo clearfix isOverFlow">${list}</div>`
  399. $(".moduleItem.general").append(str)
  400. setTimeout(function () {
  401. let generaTreatHei = $(".moduleItem .generalTreatInfo")[0].scrollHeight
  402. if (generaTreatHei > 81) {
  403. $(".moduleItem .generalTreatInfo").append(`<span class="showMoreGeneralTreat">更多</span>`)
  404. bindGeneralSlide()
  405. }
  406. })
  407. $(".moduleItem.general").css("display", "block")
  408. }
  409. }
  410. function renderCheckup(list, showNum, type, hasInfo) {
  411. if (list.length > 0 && $(".moduleItem.vital").length > 0) {
  412. moduleNum++
  413. $(".moduleItem.vital .moduleItemTitBox").append(titleStr("checkupPush"))
  414. let { shortStr, longStr } = renderItemWrapper(list, showNum, type, hasInfo)
  415. $(".moduleItem.vital").append(shortStr)
  416. $(".moduleItem.vital").append(renderLongStr(titleConfigH["checkupPush"].name, longStr, titleConfigH["checkupPush"].location))
  417. $('.moduleItem.vital').css("display", "block")
  418. }
  419. }
  420. function renderDiag(diagPush) {
  421. let possibleDiagPush = diagPush["可能诊断"] || []
  422. let firstDiagPush = diagPush["初步诊断"] || []
  423. let identifyDiagPush = diagPush["鉴别诊断"] || []
  424. let warningDiagPush = diagPush["警惕"] || []
  425. let number = $('.moduleItem.diag').attr("data-num") || 5
  426. let warnNumber = $('.moduleItem.warning').attr("data-num") || 5
  427. $('.moduleItem.diag .moduleItemTitBox').append(titleStr("diagPush"))
  428. // 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}]
  429. // let firstDiagPush = [{name:"血常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null}]
  430. // let identifyDiagPush = diagPush["鉴别诊断"] || [{name:"血常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null}]
  431. renderDiagItem(possibleDiagPush, "可能诊断", number)
  432. renderDiagItem(firstDiagPush, "初步诊断", number)
  433. renderDiagItem(identifyDiagPush, "鉴别诊断", number)
  434. renderWarningDiag(warningDiagPush, "警惕", 1000)
  435. moreInfo()
  436. }
  437. function renderDiagItem(list, name, number) {
  438. if (list.length === 0) {
  439. return
  440. }
  441. let titleStr = `<span class="moduleBoxName">${name}</span>`
  442. let { shortStr, longStr } = renderItemWrapper(list, number, 1, true)
  443. let boxStr = `<div class="moduleBox">
  444. ${titleStr}
  445. ${shortStr}
  446. </div>`
  447. $(".diag").append(boxStr)
  448. $(".diag").append(renderLongStr(name, longStr, "left"))
  449. $('.moduleItem.diag').css("display", "block")
  450. }
  451. function renderWarningDiag(list, name, showNum) {
  452. if (list.length > 0 && $(".moduleItem.warning").length > 0) {
  453. moduleNum++
  454. $('.moduleItem.warning .moduleItemTitBox').append(titleStr("vigilancePush"))
  455. let { shortStr, longStr } = renderItemWrapper(list, showNum, 1, true)
  456. $('.moduleItem.warning').append(shortStr)
  457. $('.moduleItem.warning').css("display", "block")
  458. }
  459. }
  460. function renderwriteStandardPage(list) {
  461. if (list.length > 0 && $(".moduleItem.casewriting").length > 0) {
  462. moduleNum++
  463. $(".moduleItem.casewriting .moduleItemTitBox").append(titleStr("casewritingPush"))
  464. let str = ``
  465. for (let i = 0; i < list.length; i++) {
  466. str += `<p>${list[i]}</p>`
  467. }
  468. $(".moduleItem.casewriting").append(str)
  469. $('.moduleItem.casewriting').css("display", "block")
  470. }
  471. }
  472. function renderPushWarning() {
  473. return getPusgWarning().then(res => {
  474. hasCompleteTnterface++
  475. if (res.data.code == '0') {
  476. const result = res.data.data;
  477. let billMsgList = result.billMsgList || [] //开单合理性提醒
  478. let highRiskList = result.highRiskList || [] //高危药品、手术
  479. let criticalValList = result.criticalValList || [] //危急值提醒
  480. let noteList = result.noteList || [] //检查内容注意事项
  481. let dubugStr = result.dubugStr || [] //注意调试信息
  482. let otherList = result.otherList || [] //其他提醒
  483. renderBillingPush(billMsgList, '开单合理性', 'rationali')
  484. renderBillingPush(highRiskList, '高风险提示', 'highrisk')
  485. renderBillingPush(criticalValList, '危急值提醒', 'crivalue')
  486. renderBillingPush(noteList, '检查注意事项')
  487. renderBillingPush(otherList, '其他提醒', 'otherremind')
  488. const codes = ($(".rationali.tips").length ? 'rationali,' : "") + ($(".highrisk.tips").length ? 'highrisk,' : "") + ($(".crivalue.tips").length ? 'crivalue,' : "") + ($(".otherremind.tips").length ? 'otherremind' : "");
  489. $(".moduleItem.tips").wrapAll("<div class='tips-cont' codes=" + codes + "></div>");
  490. $('.tips-cont').append(titleStr('warning'))
  491. moreInfo()
  492. const hasTipsNum = $(".moduleItem.tips").length;
  493. if (hasTipsNum) {
  494. let tipsHei = $(".tips-cont")[0].scrollHeight;
  495. if (tipsHei > 81) {
  496. $(".tips-cont").append(`<span class="showMoreNewPage">更多</span>`)
  497. tipsMsg = result
  498. showMoreNewPage()
  499. }
  500. }
  501. // renderBillingPush(dubugStr,'注意调试信息')
  502. }
  503. if (hasCompleteTnterface === allInterface) {
  504. $('.loading').css("display", "none")
  505. if (moduleNum === 0) {//console.log(999)
  506. // empty()
  507. }
  508. }
  509. })
  510. }
  511. function renderBillingPush(list, name, code) {
  512. if (list.length === 0) {
  513. return
  514. }
  515. let str = ``
  516. for (let i = 0; i < list.length; i++) {
  517. str += `<div class="billingPushItem">${list[i].msg}</div>`
  518. }
  519. let titleStr = `<span class="moduleBoxName">${name}</span>`
  520. let boxStr = `<div class="moduleBox">
  521. ${titleStr}
  522. ${str}
  523. </div>`
  524. $("." + code).append(boxStr)
  525. $('.moduleItem.' + code).addClass("tips").attr("code", code).css("display", "block")
  526. }
  527. function renderLongStr(name, longStr, location) {
  528. if (!longStr) {
  529. return
  530. }
  531. let str = `
  532. <div class="longStrBox" data-location="${location}">
  533. <span class="longStrBoxTitle">${name}:</span>
  534. ${longStr}
  535. </div>
  536. `
  537. return str
  538. }
  539. function renderItemWrapper(list, showNum, type, hasInfo) {
  540. let showNum1 = showNum || 5
  541. let shortStr = '', longStr = ''
  542. for (let i = 0; i < list.length; i++) {
  543. if (i <= showNum1 - 1) {
  544. shortStr += renderPushItem(list[i], type)
  545. }
  546. longStr += renderPushItem(list[i], type)
  547. }
  548. if (showNum1 >= list.length) {
  549. return {
  550. shortStr: `<div class="shortBox">${shortStr}</div>`,
  551. longStr: ''
  552. }
  553. } else {
  554. shortStr += `<span class="showMore"> <img class="iconArrowImg" src="${showImg}"></span>`
  555. longStr += `<span class="showLess"><img class="iconArrowImg" src="${collapseImg}"></span>`
  556. return {
  557. shortStr: `<div class="shortBox clearfix">${shortStr}</div>`,
  558. longStr: `<div class="longBox clearfix">${longStr}</div>`
  559. }
  560. }
  561. }
  562. function renderPushItem(item, type) {
  563. str = `<span class="pushItemBox" data-name="${item.name}" data-type="${type}">`
  564. str += `${item.hasScale == "0" ? `<span class="pushItemName">${type == 8 ? ('【' + item.name + '】') : item.name}</span>` : `<span class="pushItemName evaluationtitle">${type == 8 ? ('【' + item.name + '】') : item.name}</span>`}`
  565. str += `${item.hasInfo == "1" ? `<img class="infoImg" src="${infoImg}">` : ""}`
  566. str += '</span >'
  567. return str
  568. return str
  569. }
  570. function bindOpenInfo() {
  571. $(".infoImg").on("mouseenter", function () {
  572. $(this).attr("src", infoImgOn)
  573. }).on("mouseleave", function () {
  574. $(this).attr("src", infoImg)
  575. })
  576. }
  577. function titleStr(type) {
  578. let titleStr = ''
  579. titleStr += `<div class="moduleTitle"><img class="titleIcon" src=${titleConfigH[type].icon}>${titleConfigH[type].name}:</div>`
  580. return titleStr
  581. }
  582. function bindSlide() {
  583. $(".showMore").on("click", function () {
  584. $(".longStrBox").css("display", "none")
  585. $(this).parents(".moduleItem ").find(".longStrBox").css("display", "block")
  586. let location = $(this).parents(".moduleItem ").find(".longStrBox").attr("data-location")
  587. let scrollTop = getLongTop(location)
  588. $(this).parents(".moduleItem ").find(".longStrBox").css("top", 5 + Number(scrollTop) + "px")
  589. })
  590. $(".showLess").on("click", function () {
  591. $(this).parent().parent().css("display", "none")
  592. })
  593. addScrollEvent()
  594. }
  595. function showMoreNewPage() {
  596. const codes = $(".tips-cont").attr("codes");
  597. $(".showMoreNewPage").on("click", function () {
  598. // openNewWin(`smartAlert.html?billMsgList=${encodeURIComponent(billMsgList)}&highRiskList=${encodeURIComponent(highRiskList)}&criticalValList=${encodeURIComponent(criticalValList)}&noteList=${encodeURIComponent(noteList)}`)
  599. openNewWin(`smartAlert.html?mrId=${mrId}&hospitalId=${hospitalIdUrl}&codes=` + codes);
  600. })
  601. }
  602. function showMoreCaseWrite() {
  603. $(".showMoreCaseWrite").on("click", function () {
  604. // openNewWin(`smartAlert.html?billMsgList=${encodeURIComponent(billMsgList)}&highRiskList=${encodeURIComponent(highRiskList)}&criticalValList=${encodeURIComponent(criticalValList)}&noteList=${encodeURIComponent(noteList)}`)
  605. openNewWin(`caseWriteStandard.html?caseWriteStandradList=${encodeURIComponent(JSON.stringify(caseWriteStandradList))}`)
  606. })
  607. }
  608. function bindGeneralSlide() {
  609. $(".showMoreGeneralTreat").on("click", function () {
  610. openNewWin(`generalTreat.html?disName=${treatDisName}&name=${treatUniqueName}`)
  611. })
  612. }
  613. function setWidth() {
  614. let winWidth = $(".bodyWrap").css("width")
  615. $(".contentBox").css("width", winWidth)
  616. }
  617. //医学知识搜索
  618. searchMedical()
  619. function searchMedical() {
  620. $(".medicalKonwledgeWrap .search").on("click", function () {
  621. openNewWin(`homeStatic.html?mrId=${mrId}&hospitalId=${hospitalIdUrl}&planCode=${planCode}`)
  622. })
  623. }
  624. function moreInfo() {
  625. $('.infoImg').off("click").click(function () {
  626. const name = $(this).parent().attr('data-name')
  627. const type = $(this).parent().attr('data-type')
  628. openNewWin(`staticInfo.html?type=${encodeURIComponent(type)}&position=0&name=${encodeURIComponent(name)}`)
  629. })
  630. $('.evaluationtitle').off("click").click(function () {
  631. console.log(11)
  632. const name = $(this).parent().attr('data-name')
  633. const type = $(this).parent().attr('data-type')
  634. console.log(name)
  635. openNewWin(`staticInfo.html?type=${encodeURIComponent(type)}&position=0&name=${encodeURIComponent(name)}&page=1&gauge=gauge`)
  636. })
  637. }
  638. function pushItemName(){
  639. $('.pushItemName').off("click").click(function () {
  640. console.log(11)
  641. const name = $(this).parent().attr('data-name')
  642. const type = $(this).parent().attr('data-type')
  643. console.log(name)
  644. openNewWin(`staticInfo.html?type=${encodeURIComponent(type)}&position=0&name=${encodeURIComponent(name)}`)
  645. })
  646. }
  647. function getVersion() {
  648. return post(config.getVersion, 'confArr').then((res) => {
  649. const data = res.data.data;
  650. const ver = localStorage.getItem('versionTime');
  651. const time = data.refreshTime;
  652. if (!ver || ver === time + "=new" || time !== ver.replace("=new", "")) { //判断版本是否更新
  653. $(".versionBottom").addClass('new-icon');
  654. localStorage.setItem('versionTime', time + "=new"); //保存版本更新时间
  655. } else {
  656. $(".versionBottom").removeClass("new-icon");
  657. }
  658. })
  659. }
  660. function getLongTop(type) {
  661. let scrollTop = 0
  662. if (type === "left") {
  663. scrollTop = $(".leftWrapper").scrollTop() || 0
  664. } else if (type === "right") {
  665. scrollTop = $(".rightWrapper").scrollTop() || 0
  666. }
  667. return scrollTop
  668. }
  669. function addScrollEvent() {
  670. $(`.leftWrapper`).off("scroll").scroll(throttle(function () {
  671. if ($(".leftWrapper .longStrBox:visible").length) {
  672. $(".leftWrapper .longStrBox:visible").css("top", Number(getLongTop("left")) + 5 + "px")
  673. }
  674. }, 100));
  675. $(`.rightWrapper`).off("scroll").scroll(throttle(function () {
  676. if ($(".rightWrapper .longStrBox:visible").css("display") === "block") {
  677. $(".rightWrapper .longStrBox:visible").css("top", Number(getLongTop("right")) + 5 + "px")
  678. }
  679. }, 100));
  680. }
  681. $(function () {
  682. getVersion()
  683. $(window).on("resize", function () {
  684. setWidth()
  685. })
  686. $(".versionTop").on("click", function () {
  687. openNewWin("disclaimer.html")
  688. });
  689. $(".versionBottom").on("click", function () {
  690. const ver = localStorage.getItem('versionTime');
  691. $(".versionBottom").removeClass('new-icon');
  692. localStorage.setItem('versionTime', ver.replace("=new", ""));
  693. openNewWin("version.html");
  694. });
  695. })
  696. // function empty(){
  697. // $(".responsibility").css("display","none")
  698. // $('.recommendWrap .empty').css("display","block")
  699. // }