cdssHorizontal.js 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732
  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.less')
  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" 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").eq(0).addClass("activeTab")
  143. $(".tabList .tab .activeLine").eq(0).css({ display: "block" })
  144. // $(".tabList .tab").css("height", 1 / TabNum * 100 + '%')
  145. let showModuleName = $(".tabList .tab").eq(0).attr("data-name")
  146. getModuleShow(moduleConfig[showModuleName])
  147. bindTabClick()
  148. setTabNameTop()
  149. }
  150. function hasTab(tabName, tabList) {
  151. for (let i = 0; i < tabList.length; i++) {
  152. if (tabList[i].name == tabName) {
  153. return tabList[i]
  154. }
  155. }
  156. return false
  157. }
  158. function renderModuleWrapper(moduleList) {
  159. if (!moduleList) {
  160. return
  161. }
  162. let moduleStr = '', treatStr = ""
  163. for (let i = 0; i < moduleList.length; i++) {
  164. if (moduleList[i].status != '0') {
  165. if (moduleList[i].code == 'general' || moduleList[i].code == 'medicine' || moduleList[i].code == 'operation' || moduleList[i].code == 'nurse') {
  166. treatStr += `<div class="moduleItem ${moduleList[i].code}" data-num="${moduleList[i].number}" style="display:none"><span class="moduleItemTitBox"></span></div>`
  167. } else if (moduleList[i].code == 'critical') {
  168. moduleStr += `<div class="moduleItem warning" data-num="${moduleList[i].number}" style="display:none"><span class="moduleItemTitBox"></span></div>`
  169. // moduleStr += `<div class="moduleItem tips" data-num="${moduleList[i].number}" style="display:none"><span class="moduleItemTitBox"></span></div>`
  170. } else {
  171. moduleStr += `<div class="moduleItem ${moduleList[i].code}" data-num="${moduleList[i].number}" style="display:none"><span class="moduleItemTitBox"></span></div>`
  172. }
  173. }
  174. }
  175. $(".recommendWrap .leftBox").append(moduleStr)
  176. $(".recommendWrap .rightBox").append(treatStr)
  177. }
  178. function isNeedPush(list) {
  179. let pushCode = ["diag", "lis", "pacs", "symptom", "vital"]
  180. for (let i = 0; i < list.length; i++) {
  181. if (pushCode.indexOf(list[i].code) > -1) {
  182. if (list[i].status == "1") {
  183. return true
  184. }
  185. }
  186. }
  187. return false
  188. }
  189. function isNeedPushWarning(list) {
  190. let pushCode = ["crivalue", "rationali", "highrisk", "otherremind"]
  191. for (let i = 0; i < list.length; i++) {
  192. if (pushCode.indexOf(list[i].code) > -1) {
  193. if (list[i].status == "1") {
  194. return true
  195. }
  196. }
  197. }
  198. return false
  199. }
  200. function isNeedwriteStandardPush(list) {
  201. let pushCode = ["casewriting"]
  202. for (let i = 0; i < list.length; i++) {
  203. if (pushCode.indexOf(list[i].code) > -1) {
  204. if (list[i].status == "1") {
  205. return true
  206. }
  207. }
  208. }
  209. return false
  210. }
  211. function bindTabClick() {
  212. $(".tabList .tab").on("click", function () {
  213. $(".activeTab").removeClass("activeTab")
  214. $(".tabList .tab .activeLine").css({ display: "none" })
  215. $(this).addClass("activeTab")
  216. $(this).find('.activeLine').css({ display: "block" })
  217. const moduleName = $(this).attr("data-name")
  218. getModuleShow(moduleConfig[moduleName])
  219. })
  220. }
  221. function getModuleShow(moduleClassName) {
  222. if ($(`.${moduleClassName}`).css("display") == "none") {
  223. $(".moduleWrapper").css("display", "none")
  224. $(`.${moduleClassName}`).css("display", "block")
  225. }
  226. }
  227. function setTabNameTop() {
  228. tabNameList = $(".tabList .tab .tabName")
  229. for (let i = 0; i < tabNameList.length; i++) {
  230. let tabNameHei = $(".tabList .tab .tabName").eq(i).height()
  231. // $(".tabList .tab .tabName").eq(i).css("marginTop", -tabNameHei / 2 + "px")
  232. }
  233. }
  234. function renderCaseWrite() {
  235. getWriteStandardPush().then(res => {
  236. hasCompleteTnterface++
  237. if (res.data.code == '0') {
  238. const caseWriteList = res.data.data || {}
  239. let caseWritePush = Object.keys(caseWriteList) || []
  240. renderwriteStandardPage(caseWritePush)
  241. if ($(".moduleItem.casewriting")) {
  242. let casewritingHei = $(".moduleItem.casewriting")[0].scrollHeight
  243. if (casewritingHei > 81) {
  244. $(".casewriting").append(`<span class="showMoreCaseWrite">更多</span>`)
  245. caseWriteStandradList = caseWritePush
  246. showMoreCaseWrite()
  247. }
  248. }
  249. }
  250. })
  251. }
  252. function renderPushData() {
  253. return getPushInfo().then(res => {
  254. hasCompleteTnterface++
  255. if (res.data.code == "0") {
  256. const result = res.data.data
  257. let diagPush = result.dis || {}
  258. let lisPush = result.lis || []
  259. let scalePush = result.scale || []
  260. let pacsPush = result.pacs || []
  261. let symptomPush = result.symptom || []
  262. let checkupPush = result.vital || []
  263. let medicinesPush = result.medicines || []
  264. let operationsPush = result.operations || []
  265. let nursePush = result.nurse || []
  266. let treatPush = result.treat && result.treat[0] || {}
  267. treatDisName = treatPush && treatPush["name"]
  268. treatUniqueName = treatPush && treatPush["uniqueName"]
  269. let generaTreatPush = treatPush && treatPush["generaTreat"]
  270. generalTreatInfo = generaTreatPush
  271. // let lisPush =[{name:"血常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null}]
  272. // let pacsPush = [{name:"胸部x射线",hisNameList:null},{name:"心电图",hisNameList:null}]
  273. // let checkupPush = [{name:"神志表情",hisNameList:null},{name:"面部表情",hisNameList:null}]
  274. let lisNum = $(".moduleItem.lis").attr("data-num") || 5
  275. let scaleNum = $(".moduleItem.evaluation").attr("data-num") || 5
  276. let pacsNum = $(".moduleItem.pacs").attr("data-num") || 5
  277. let checkupNum = $(".moduleItem.vital").attr("data-num") || 5
  278. let symptomNum = $(".moduleItem.symptom").attr("data-num") || 5
  279. let medicinesNum = $(".moduleItem.medicine").attr("data-num") || 5
  280. let operationsNum = $(".moduleItem.operation").attr("data-num") || 5
  281. let nurseNum = $(".moduleItem.nurse").attr("data-num") || 5
  282. renderLis(lisPush, lisNum)
  283. renderScale(scalePush, scaleNum)
  284. renderPacs(pacsPush, pacsNum)
  285. renderCheckup(checkupPush, checkupNum)
  286. renderSymptomPush(symptomPush, symptomNum)
  287. renderDiag(diagPush)
  288. if (medicinesPush.length > 0 || operationsPush.length > 0 || generaTreatPush || nursePush.length > 0) {
  289. let str = `<img class="treatIcon" src = ${titleConfigH["treat"].icon} /><span>${titleConfigH["treat"].name}</span>`
  290. $(".rightBoxTitle").append(str)
  291. renderDisName()
  292. $(".rightWrapper").css("display", "inline-block")
  293. // $(".leftWrapper").css("borderRight", "1px solid #E6E6E6")
  294. } else {
  295. $(".leftWrapper").css({
  296. borderRight: "0px",
  297. width: "100%"
  298. })
  299. }
  300. if ((!$(".moduleItem.medicine") && !$(".moduleItem.operation") && !(".moduleItem.general")) || ($(".moduleItem.general").length === 0 && $(".moduleItem.medicine").length === 0 && $(".moduleItem.operation").length === 0 && $(".moduleItem.nurse").length === 0)) {
  301. $(".rightWrapper").css("display", "none")
  302. $(".leftWrapper").css({
  303. borderRight: "0px",
  304. width: "100%"
  305. })
  306. }
  307. rendergeneraTreatPush(generaTreatPush)
  308. renderMedicinesPush(medicinesPush, medicinesNum)
  309. renderOperationPush(operationsPush, operationsNum)
  310. renderNurse(nursePush, nurseNum)
  311. bindOpenInfo()
  312. bindSlide()
  313. moreInfo()
  314. }
  315. })
  316. }
  317. function renderLis(list, showNum) {
  318. if (list.length > 0 && $(".moduleItem.lis").length > 0) {
  319. moduleNum++
  320. $('.moduleItem.lis .moduleItemTitBox').append(titleStr("lisPush"))
  321. let { shortStr, longStr } = renderItemWrapper(list, showNum)
  322. $('.moduleItem.lis').append(shortStr)
  323. $('.moduleItem.lis').append(renderLongStr(titleConfigH["lisPush"].name, longStr, titleConfigH["lisPush"].location))
  324. $('.moduleItem.lis').css("display", "block")
  325. }
  326. }
  327. function renderScale(list, showNum) {
  328. if (list.length > 0 && $(".moduleItem.evaluation").length > 0) {
  329. moduleNum++
  330. $('.moduleItem.evaluation .moduleItemTitBox').append(titleStr("scalePush"))
  331. let { shortStr, longStr } = renderItemWrapper(list, showNum)
  332. $('.moduleItem.evaluation').append(shortStr)
  333. $('.moduleItem.evaluation').append(renderLongStr(titleConfigH["scalePush"].name, longStr, titleConfigH["scalePush"].location))
  334. $('.moduleItem.evaluation').css("display", "block")
  335. // $('.moduleItem.evaluation').children(".shortBox").children(".pushItemBox").children(".pushItemName").addClass("evaluationtitle")
  336. // $('.moduleItem.evaluation').children(".longStrBox").children(".longBox").children(".pushItemBox").children(".pushItemName").addClass("evaluationtitle")
  337. }
  338. }
  339. function renderNurse(list, showNum) {
  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)
  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) {
  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)
  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) {
  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)
  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) {
  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)
  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) {
  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)
  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) {
  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)
  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. renderDiagItem(possibleDiagPush, "可能诊断", number)
  427. renderDiagItem(firstDiagPush, "既往诊断", number)
  428. renderDiagItem(identifyDiagPush, "鉴别诊断", number)
  429. renderWarningDiag(warningDiagPush, "警惕", 1000)
  430. moreInfo()
  431. }
  432. function renderDiagItem(list, name, number) {
  433. if (list.length === 0) {
  434. return
  435. }
  436. let titleStr = `<span class="moduleBoxName">${name}</span>`
  437. let { shortStr, longStr } = renderItemWrapper(list, number)
  438. let boxStr = `<div class="moduleBox">
  439. ${titleStr}
  440. ${shortStr}
  441. </div>`
  442. $(".diag").append(boxStr)
  443. $(".diag").append(renderLongStr(name, longStr, "left"))
  444. $('.moduleItem.diag').css("display", "block")
  445. }
  446. function renderWarningDiag(list, name, showNum) {
  447. if (list.length > 0 && $(".moduleItem.warning").length > 0) {
  448. moduleNum++
  449. $('.moduleItem.warning .moduleItemTitBox').append(titleStr("vigilancePush"))
  450. let { shortStr, longStr } = renderItemWrapper(list, showNum)
  451. $('.moduleItem.warning').append(shortStr)
  452. $('.moduleItem.warning').css("display", "block")
  453. }
  454. }
  455. function renderwriteStandardPage(list) {
  456. if (list.length > 0 && $(".moduleItem.casewriting").length > 0) {
  457. moduleNum++
  458. $(".moduleItem.casewriting .moduleItemTitBox").append(titleStr("casewritingPush"))
  459. let str = ``
  460. for (let i = 0; i < list.length; i++) {
  461. str += `<p>${list[i]}</p>`
  462. }
  463. $(".moduleItem.casewriting").append(str)
  464. $('.moduleItem.casewriting').css("display", "block")
  465. }
  466. }
  467. function renderPushWarning() {
  468. return getPusgWarning().then(res => {
  469. hasCompleteTnterface++
  470. if (res.data.code == '0') {
  471. const result = res.data.data;
  472. let billMsgList = result.billMsgList || [] //开单合理性提醒
  473. let highRiskList = result.highRiskList || [] //高危药品、手术
  474. let criticalValList = result.criticalValList || [] //危急值提醒
  475. let noteList = result.noteList || [] //检查内容注意事项
  476. let dubugStr = result.dubugStr || [] //注意调试信息
  477. let otherList = result.otherList || [] //其他提醒
  478. renderBillingPush(billMsgList, '开单合理性', 'rationali')
  479. renderBillingPush(highRiskList, '高风险提示', 'highrisk')
  480. renderBillingPush(criticalValList, '危急值提醒', 'crivalue')
  481. renderBillingPush(noteList, '检查注意事项')
  482. renderBillingPush(otherList, '其他提醒', 'otherremind')
  483. const codes = ($(".rationali.tips").length ? 'rationali,' : "") + ($(".highrisk.tips").length ? 'highrisk,' : "") + ($(".crivalue.tips").length ? 'crivalue,' : "") + ($(".otherremind.tips").length ? 'otherremind' : "");
  484. $(".moduleItem.tips").wrapAll("<div class='tips-cont' codes=" + codes + "></div>");
  485. $('.tips-cont').append(titleStr('warning'))
  486. moreInfo()
  487. const hasTipsNum = $(".moduleItem.tips").length;
  488. if (hasTipsNum) {
  489. let tipNum = $(".tips-cont .billingPushItem").length;
  490. if (tipNum > 3) {
  491. $(".tips-cont").append(`<span class="showMoreNewPage">更多</span>`)
  492. tipsMsg = result
  493. showMoreNewPage()
  494. }
  495. }
  496. // renderBillingPush(dubugStr,'注意调试信息')
  497. }
  498. if (hasCompleteTnterface === allInterface) {
  499. $('.loading').css("display", "none")
  500. if (moduleNum === 0) {//console.log(999)
  501. // empty()
  502. }
  503. }
  504. })
  505. }
  506. function renderBillingPush(list, name, code) {
  507. if (list.length === 0) {
  508. return
  509. }
  510. let str = ``
  511. for (let i = 0; i < list.length; i++) {
  512. str += `<div class="billingPushItem">${list[i].msg}</div>`
  513. }
  514. let titleStr = `<span class="moduleBoxName">${name}</span>`
  515. let boxStr = `<div class="moduleBox">
  516. ${titleStr}
  517. ${str}
  518. </div>`
  519. $("." + code).append(boxStr)
  520. $('.moduleItem.' + code).addClass("tips").attr("code", code).css("display", "block")
  521. }
  522. function renderLongStr(name, longStr, location) {
  523. if (!longStr) {
  524. return
  525. }
  526. let str = `
  527. <div class="longStrBox" data-location="${location}">
  528. <span class="longStrBoxTitle">${name}:</span>
  529. ${longStr}
  530. </div>
  531. `
  532. return str
  533. }
  534. function renderItemWrapper(list, showNum) {
  535. let showNum1 = showNum || 5
  536. let shortStr = '', longStr = ''
  537. for (let i = 0; i < list.length; i++) {
  538. if (i <= showNum1 - 1) {
  539. shortStr += renderPushItem(list[i])
  540. }
  541. longStr += renderPushItem(list[i])
  542. }
  543. if (showNum1 >= list.length) {
  544. return {
  545. shortStr: `<div class="shortBox">${shortStr}</div>`,
  546. longStr: ''
  547. }
  548. } else {
  549. shortStr += `<span class="showMore"> <img class="iconArrowImg" src="${showImg}"></span>`
  550. longStr += `<span class="showLess"><img class="iconArrowImg" src="${collapseImg}"></span>`
  551. return {
  552. shortStr: `<div class="shortBox clearfix">${shortStr}</div>`,
  553. longStr: `<div class="longBox clearfix">${longStr}</div>`
  554. }
  555. }
  556. }
  557. function renderPushItem(item) {
  558. str = `<span class="pushItemBox" data-name="${item.name}" data-type="${item.type}">`
  559. str += `${item.hasScale == "0" ? `<span class="pushItemName">${item.type == 8 ? ('【' + item.name + '】') : item.name}</span>` : item.hasScale == "1" ? `<span class="pushItemName evaluationtitle">${item.type == 8 ? ('【' + item.name + '】') : item.name}</span>` : `<span class="pushItemName">${item.type == 8 ? ('【' + item.name + '】') : item.name}</span>`}`
  560. str += `${item.hasInfo == "1" ? `<img class="infoImg" src="${infoImg}">` : ""}`
  561. str += '</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").off("click").on("click", function () {
  578. const longBox = $(this).parent().next().length?$(this).parent().next():$(this).parent().parent().next();
  579. $(".longStrBox").css("display", "none")
  580. longBox.css("display", "block")
  581. let location = longBox.attr("data-location")
  582. let scrollTop = getLongTop(location)
  583. longBox.css("top", 5 + Number(scrollTop) + "px")
  584. })
  585. $(".showLess").off("click").on("click", function () {
  586. $(this).parent().parent().css("display", "none")
  587. })
  588. addScrollEvent()
  589. }
  590. function showMoreNewPage() {
  591. const codes = $(".tips-cont").attr("codes");
  592. $(".showMoreNewPage").on("click", function () {
  593. // openNewWin(`smartAlert.html?billMsgList=${encodeURIComponent(billMsgList)}&highRiskList=${encodeURIComponent(highRiskList)}&criticalValList=${encodeURIComponent(criticalValList)}&noteList=${encodeURIComponent(noteList)}`)
  594. openNewWin(`smartAlert.html?mrId=${mrId}&hospitalId=${hospitalIdUrl}&codes=` + codes);
  595. })
  596. }
  597. function showMoreCaseWrite() {
  598. $(".showMoreCaseWrite").on("click", function () {
  599. // openNewWin(`smartAlert.html?billMsgList=${encodeURIComponent(billMsgList)}&highRiskList=${encodeURIComponent(highRiskList)}&criticalValList=${encodeURIComponent(criticalValList)}&noteList=${encodeURIComponent(noteList)}`)
  600. openNewWin(`caseWriteStandard.html?caseWriteStandradList=${encodeURIComponent(JSON.stringify(caseWriteStandradList))}`)
  601. })
  602. }
  603. function bindGeneralSlide() {
  604. $(".showMoreGeneralTreat").on("click", function () {
  605. openNewWin(`generalTreat.html?disName=${treatDisName}&name=${treatUniqueName}`)
  606. })
  607. }
  608. function setWidth() {
  609. let winWidth = $(".bodyWrap").css("width")
  610. $(".contentBox").css("width", winWidth)
  611. }
  612. //医学知识搜索
  613. searchMedical()
  614. function searchMedical() {
  615. $(".medicalKonwledgeWrap .search").on("click", function () {
  616. openNewWin(`homeStatic.html?mrId=${mrId}&hospitalId=${hospitalIdUrl}&planCode=${planCode}`)
  617. })
  618. }
  619. function moreInfo() {
  620. $('.infoImg').off("click").click(function () {
  621. const name = $(this).parent().attr('data-name')
  622. const type = $(this).parent().attr('data-type')
  623. openNewWin(`staticInfo.html?type=${encodeURIComponent(type)}&position=0&name=${encodeURIComponent(name)}`)
  624. })
  625. $('.evaluationtitle').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)}&page=1&gauge=gauge`)
  629. })
  630. }
  631. function pushItemName() {
  632. $('.pushItemName').off("click").click(function () {
  633. console.log(11)
  634. const name = $(this).parent().attr('data-name')
  635. const type = $(this).parent().attr('data-type')
  636. console.log(name)
  637. openNewWin(`staticInfo.html?type=${encodeURIComponent(type)}&position=0&name=${encodeURIComponent(name)}`)
  638. })
  639. }
  640. function getVersion() {
  641. return post(config.getVersion, 'confArr').then((res) => {
  642. const data = res.data.data;
  643. const ver = localStorage.getItem('versionTime');
  644. const time = data.refreshTime;
  645. if (!ver || ver === time + "=new" || time !== ver.replace("=new", "")) { //判断版本是否更新
  646. $(".versionBottom").addClass('new-icon');
  647. localStorage.setItem('versionTime', time + "=new"); //保存版本更新时间
  648. } else {
  649. $(".versionBottom").removeClass("new-icon");
  650. }
  651. })
  652. }
  653. function getLongTop(type) {
  654. let scrollTop = 0
  655. if (type === "left") {
  656. scrollTop = $(".leftWrapper").scrollTop() || 0
  657. } else if (type === "right") {
  658. scrollTop = $(".rightWrapper").scrollTop() || 0
  659. }
  660. return scrollTop
  661. }
  662. function addScrollEvent() {
  663. $(`.leftWrapper`).off("scroll").scroll(throttle(function () {
  664. if ($(".leftWrapper .longStrBox:visible").length) {
  665. $(".leftWrapper .longStrBox:visible").css("top", Number(getLongTop("left")) + 5 + "px")
  666. }
  667. }, 100));
  668. $(`.rightWrapper`).off("scroll").scroll(throttle(function () {
  669. if ($(".rightWrapper .longStrBox:visible").css("display") === "block") {
  670. $(".rightWrapper .longStrBox:visible").css("top", Number(getLongTop("right")) + 5 + "px")
  671. }
  672. }, 100));
  673. }
  674. $(function () {//隐藏logo
  675. if(getUrlArgObject("hideLg")){
  676. $(".versionTop .logoTxt").hide();
  677. }
  678. getVersion()
  679. $(window).on("resize", function () {
  680. setWidth()
  681. })
  682. $(".versionTop").on("click", function () {
  683. openNewWin("disclaimer.html")
  684. });
  685. $(".versionBottom").on("click", function () {
  686. const ver = localStorage.getItem('versionTime');
  687. $(".versionBottom").removeClass('new-icon');
  688. localStorage.setItem('versionTime', ver.replace("=new", ""));
  689. openNewWin("version.html");
  690. });
  691. })
  692. // function empty(){
  693. // $(".responsibility").css("display","none")
  694. // $('.recommendWrap .empty').css("display","block")
  695. // }