cdssHorizontal.js 29 KB

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