cdss.js 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873
  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. require('./../css/reset.css');
  10. require('./../css/cdss.less');
  11. require('./../css/popup.css');
  12. require('./../css/followUpV.less');
  13. require('../css/staticSearch.less')
  14. require('./../js/staticSearch.js');//静态知识搜索
  15. require('./../images/empty.png').replace(/^undefined/g, '')
  16. require('./../images/icon_admin.png').replace(/^undefined/g, '')
  17. require('./../images/empty2.png').replace(/^undefined/g, '')
  18. require('./../images/empty3.png').replace(/^undefined/g, '')
  19. require('./../images/icon_no.png').replace(/^undefined/g, '')
  20. require('./../images/loading.gif').replace(/^undefined/g, '')
  21. require('./../images/right.png').replace(/^undefined/g, '')
  22. require('./../images/new.png').replace(/^undefined/g, '')
  23. require('./../images/t1.png').replace(/^undefined/g, '')
  24. require('./../images/t2.png').replace(/^undefined/g, '')
  25. require('./../images/t3.png').replace(/^undefined/g, '')
  26. require('./../images/go.png').replace(/^undefined/g, '')
  27. require('./../images/g1.png').replace(/^undefined/g, '')
  28. // require('./popupEdit.js');
  29. let infoImg = require('./../images/icon_info.png').replace(/^undefined/g, '')
  30. let infoImgOn = require('./../images/icon_info_on.png').replace(/^undefined/g, '')
  31. let iconArrowUp = require('./../images/icon_arrow_up.png').replace(/^undefined/g, '')
  32. let iconArrowDown = require('./../images/icon_arrow_down.png').replace(/^undefined/g, '')
  33. let iconMark = require('./../images/icon_mark.png').replace(/^undefined/g, '')
  34. let warnImg = require('./../images/icon_warning.png').replace(/^undefined/g, '')
  35. let warnImgWhite = require('./../images/icon_waring_white.png').replace(/^undefined/g, '')
  36. const $ = require("jquery");
  37. const { post, config, getUrlArgObject, openNewWin, titleConfig } = require('./promise.js');
  38. const { renderFollowUp, followEmpty } = require('./followUp.js');
  39. const { getTcmMr } = require('./tcmiss.js');
  40. const { transConf } = require('./util.js');
  41. //静态知识类型: 1:诊断 2.药品 3.化验套餐 4.化验明细 5.辅检 6.手术和操作
  42. let moduleConfig = {
  43. auxiliary: "recommendWrap",
  44. qc: "qcWrap",
  45. medical: "medicalKonwledgeWrap",
  46. followup: "followUpWrap",
  47. tcmiss: 'tcmWarp',
  48. }
  49. let allInterface = 0; //需要调用的推送接口的个数
  50. let hasCompleteTnterface = 0; //已返回的推送接口的个数
  51. let moduleNum = 0
  52. let mrId = getUrlArgObject('mrId')
  53. let isTcm = getUrlArgObject('isTcm')
  54. let pushMrId = getUrlArgObject('pushMrId')
  55. const tipsMode = getUrlArgObject('tipsMode') || 1
  56. let planCode = getUrlArgObject('planCode') || 'all'
  57. let hospitalIdUrl = getUrlArgObject('hospitalId') || ''
  58. let msg;
  59. let treatDisName;
  60. function getMRInfo() {
  61. return post(config.getMr2, { mrId: mrId })
  62. }
  63. let ifInputParam; //是否有入参,显示输入空状态用
  64. if (mrId) {
  65. Promise.all([getConf(), getMRInfo()]).then(([res1, res2]) => {
  66. const data = res1.data.data && res1.data.data[0]
  67. msg = res2.data.data || {}
  68. if (!(msg && msg.diseaseName && msg.diseaseName.name)) {
  69. msg.diseaseName = null
  70. }
  71. window.msg = msg;
  72. renderPage(data)
  73. })
  74. } else {
  75. getConf().then(res => {
  76. if (res.data.code == '0') {
  77. // const configArr = res.data.data.pushSetList || []
  78. // getPageInfo(configArr)
  79. const data = res.data.data && res.data.data[0]
  80. renderPage(data)
  81. }
  82. })
  83. followEmpty()
  84. }
  85. function hasInputParam() {
  86. const checkKeys = ["chief", "diag", "diseaseName", "drug", "drugOrder", "lis", "lisOrder", 'marital', 'menstrual', "operation", "operationOrder", "otherIndex", "otherOrder", "pacs", "pacsOrder", "pasts", "personal", "symptom", "transfusion", "transfusionOrder", "vital"];
  87. let res = false;
  88. let val;
  89. checkKeys.map((it) => {
  90. val = msg[it];
  91. if (typeof val === 'string') {
  92. if (val !== '') {
  93. res = true;
  94. }
  95. } else {
  96. const str = JSON.stringify(val);
  97. if (!(str === '{}' || str === '[]')) {
  98. res = true;
  99. }
  100. }
  101. });
  102. return res;
  103. }
  104. function getConf() {
  105. var msg = window.msg
  106. return post(config.getPushSet, { hospitalId: hospitalIdUrl || msg.hospitalId || 1, planCode: planCode })
  107. }
  108. function getPushInfo() {
  109. return post(config.pushInner, Object.assign({}, msg, {
  110. featureType: '1,4,5,6,7,8,9,10,12,13',
  111. hospitalId: hospitalIdUrl || msg.hospitalId,
  112. ruleType: config.ruleTypeMap['22']
  113. }))
  114. }
  115. function getPusgWarning() {
  116. const indPush = pushMrId ? config.indicationPushCache : config.indicationPush;
  117. return post(indPush, Object.assign({}, msg, { ruleType: '1,2,3,4', mrId: pushMrId || mrId }))
  118. }
  119. function getWriteStandardPush() {
  120. return post(config.caseWritingPrompt, Object.assign({}, msg, { hospitalId: 2 || msg.hospitalId }))
  121. }
  122. function getHosptDeptUsal() {
  123. var msg = window.msg
  124. const param = {
  125. age: msg.age,
  126. deptName: msg.deptName,
  127. hospitalCode: msg.hosCode,
  128. sexType: msg.sex,
  129. type: 1,
  130. }
  131. return post(config.getHosptDeptUsal, param)
  132. }
  133. function getPushData(res) {
  134. if (res && res.data && res.data.data && res.data.data.dis && res.data.data.dis) {
  135. let dis = res.data.data.dis;
  136. //急诊显示规则,主诊断有急诊优先显示,没有则显示推送的,推送也没有就不显示
  137. if (dis && dis['页面急诊'] && (dis['页面急诊'].length > 0)) {
  138. let name = dis['页面急诊'][0].name || ''
  139. $(".allDis .disName").html(name)
  140. disName = name
  141. if (name) {
  142. $(".singleDis").css("display", "block")
  143. }
  144. } else if (dis && dis['急诊'] && dis['急诊'].length > 0) {
  145. let name = dis['急诊'][0].name || ''
  146. $(".allDis .disName").html(name)
  147. disName = name
  148. if (name) {
  149. $(".singleDis").css("display", "block")
  150. }
  151. }
  152. }
  153. }
  154. let disName = ""
  155. function handleShow() {
  156. const newinConf = {
  157. width: '600', //窗口的文档显示区的宽度。以像素计。
  158. height: '826', //窗口文档显示区的高度。以像素计。
  159. left: '0', //窗口的 x 坐标。以像素计。
  160. top: '0', //窗口的 y 坐标。以像素计。
  161. openMode: "_blank" //每次都是新窗口打开为_blank,打开同一窗口填写任意字符串
  162. }
  163. const newWindowLocation = `width=${newinConf.width}, height=${newinConf.height}, left=${newinConf.left}, top=${newinConf.top} scrollbars=yes`
  164. window.open('./emergency.html?disName=' + disName, newinConf.openMode, newWindowLocation)
  165. }
  166. $(document).on('click', ".allDis .allName", function () {
  167. handleShow()
  168. })
  169. $(document).on('click', ".singleDis", function () {
  170. $(this).next().css("display", "block")
  171. $(this).css("display", "none")
  172. })
  173. $(document).on('click', ".allDis .right,.allDis .secDis", function () {
  174. $(".allDis").css("display", "none")
  175. $(".singleDis").css("display", "block")
  176. })
  177. function moreInfo() {
  178. $('.infoImg').off("click").click(function () {
  179. const name = $(this).parents(".pushItemBox").attr('data-name')
  180. const type = $(this).parents(".pushItemBox").attr('data-type')
  181. openNewWin(`staticInfo.html?type=${encodeURIComponent(type)}&position=0&name=${encodeURIComponent(name)}&mrId=${encodeURIComponent(mrId)}`)
  182. })
  183. $('.evaluationtitle .item-name').off("click").click(function () {
  184. const name = $(this).parents(".pushItemBox").attr('data-name')
  185. const type = $(this).parents(".pushItemBox").attr('data-type')
  186. openNewWin(`staticInfo.html?type=${encodeURIComponent(type)}&position=0&name=${encodeURIComponent(name)}&page=1&mrId=${encodeURIComponent(mrId)}&gauge=gauge`)
  187. })
  188. }
  189. function getVersion() {
  190. return post(config.getVersion, 'confArr').then((res) => {
  191. const data = res.data.data;
  192. const ver = localStorage.getItem('versionTime');
  193. const time = data.refreshTime;
  194. if (!ver || ver === time + "=new" || time !== ver.replace("=new", "")) { //判断版本是否更新
  195. $(".version-tip").addClass('new-icon');
  196. localStorage.setItem('versionTime', time + "=new"); //保存版本更新时间
  197. } else {
  198. $(".version-tip").removeClass("new-icon");
  199. }
  200. })
  201. }
  202. function getDisclaimer() {
  203. return post(config.disclaimer, {}).then((res) => {
  204. const data = res.data.data.filter(item => item.disclaimerCode == "2");
  205. $(".responsibility").html((data[0] || {}).description);
  206. // $(".iframeWrap").css({height: $(window).height()-115-$(".responsibility").height()+"px"})
  207. })
  208. }
  209. function renderPage(pageSet) {
  210. const setInfo = pageSet.sysSetInfo;
  211. if (!pageSet || !setInfo) {
  212. return
  213. }
  214. renderTab(setInfo)
  215. adjustHei()
  216. const hasAuxiliary = hasTab("辅助信息", setInfo);
  217. const hasMedical = hasTab("医学知识", setInfo)
  218. const hasFollowUp = hasTab("随访计划", setInfo)
  219. const hasTcm = hasTab("中医辅助", setInfo);
  220. //所有模块都未开启配置,显示功能未开启(无tab)
  221. if (hasAuxiliary.status === 0 && hasMedical.status === 0 && hasFollowUp.status === 0 && hasTcm.status === 0) {
  222. const nullTxt = `<div class="empty-box" style="left: -20px;display: block;">
  223. <img class="emptyImg" src="../images/icon_admin.png" alt="空">
  224. <p class="emptyTxt">功能未开启</p>
  225. </div>`
  226. $(".contentWrapper").html(nullTxt);
  227. return;
  228. }
  229. if (hasTcm) {
  230. getTcmMr(mrId, hasTcm);
  231. }
  232. if (!mrId) {
  233. return
  234. }
  235. if (hasFollowUp) {
  236. renderFollowUp(msg)
  237. }
  238. const planDetail = hasAuxiliary.planDetails;
  239. const configs = planDetail.filter((it) => it.status !== 0) || [];
  240. if (!configs[0]) { //没有开启辅助信息各项配置
  241. $('.empty-box').hide();
  242. $('.recommendBox .empty-right').show();
  243. return;
  244. }
  245. if (hasAuxiliary) {
  246. $('.empty-box').hide();
  247. $(".loading").show();
  248. renderModuleWrapper(planDetail)
  249. let needPush = isNeedPush(planDetail)
  250. let needPushWarning = isNeedPushWarning(planDetail)
  251. let needWriteStandardPush = isNeedwriteStandardPush(planDetail);
  252. if (needPush) {
  253. renderPushData()
  254. allInterface++
  255. }
  256. if (needPushWarning) {
  257. renderPushWarning()
  258. allInterface++
  259. }
  260. if (needWriteStandardPush) {
  261. renderWriteStandard()
  262. allInterface++
  263. }
  264. }
  265. }
  266. function renderPushData() {
  267. return getPushInfo().then(res => {
  268. $(".loading").hide();
  269. hasCompleteTnterface++
  270. if (res.data.code == "0") {
  271. const result = res.data.data
  272. let diagPush = result.dis || {}
  273. let lisPush = result.lis || []
  274. let scalePush = result.scale || []
  275. let pacsPush = result.pacs || []
  276. let symptomPush = result.symptom || []
  277. let checkupPush = result.vital || []
  278. let medicinesPush = result.medicines || []
  279. let operationsPush = result.operations || []
  280. let treatPush = result.treat && result.treat[0] || {}
  281. let nursePush = result.nurse || []
  282. treatDisName = treatPush && treatPush["name"]
  283. let generaTreatPush = treatPush && treatPush["generaTreat"]
  284. let lisNum = $(".moduleItem.lis").attr("data-num") || 5
  285. let scaleNum = $(".moduleItem.evaluation").attr("data-num") || 5
  286. let pacsNum = $(".moduleItem.pacs").attr("data-num") || 5
  287. let checkupNum = $(".moduleItem.vital").attr("data-num") || 5
  288. let symptomNum = $(".moduleItem.symptom").attr("data-num") || 5
  289. let medicinesNum = $(".moduleItem.medicine").attr("data-num") || 5
  290. let operationsNum = $(".moduleItem.operation").attr("data-num") || 5
  291. let nurseNum = $(".moduleItem.nurse").attr("data-num") || 5
  292. renderLis(lisPush, lisNum)
  293. renderScale(scalePush, scaleNum)
  294. renderPacs(pacsPush, pacsNum)
  295. renderCheckup(checkupPush, checkupNum)
  296. renderSymptomPush(symptomPush, symptomNum)
  297. renderDiag(diagPush)
  298. renderMedicinesPush(medicinesPush, medicinesNum)
  299. renderOperationPush(operationsPush, operationsNum)
  300. rendergeneraTreatPush(generaTreatPush)
  301. renderNurse(nursePush, nurseNum)
  302. bindOpenInfo()
  303. moreInfo()
  304. bindSlide();
  305. }
  306. empty(); //判断是否显示空状态
  307. })
  308. }
  309. function adjustHei() {
  310. const iframeHei = $(".bodyWrap").height()
  311. $(".contentWrapper").css("height", iframeHei - 20 - 30 - 60 + 3 + 19 + 'px')
  312. $(".tabList").css("height", iframeHei + 'px')
  313. }
  314. function isNeedPush(list) {
  315. let pass = false;
  316. let pushCode = ['critical', "diag", "lis", "pacs", "symptom", "vital", "treat", "medicines", 'evaluation', 'general', 'medicine', 'operation', 'nurse']
  317. for (let i = 0; i < list.length; i++) {
  318. if (pushCode.indexOf(list[i].code) > -1) {
  319. if (list[i].status == "1") {
  320. pass = true
  321. }
  322. }
  323. }
  324. return pass;
  325. }
  326. function isNeedwriteStandardPush(list) {
  327. let pass = false;
  328. let pushCode = ["casewriting"]
  329. for (let i = 0; i < list.length; i++) {
  330. if (pushCode.indexOf(list[i].code) > -1) {
  331. if (list[i].status == "1") {
  332. pass = true
  333. }
  334. }
  335. }
  336. return pass
  337. }
  338. function isNeedPushWarning(list) {
  339. let pushCode = ["crivalue", "rationali", "highrisk", "otherremind"];
  340. let pass = false;
  341. for (let i = 0; i < list.length; i++) {
  342. if (pushCode.indexOf(list[i].code.trim()) > -1) {
  343. if (+list[i].status === 1) {
  344. pass = true
  345. }
  346. }
  347. }
  348. return pass
  349. }
  350. //let popNum = 0;//气泡显示数字
  351. function renderPushWarning() {
  352. return getPusgWarning().then(res => {
  353. $(".loading").hide();
  354. hasCompleteTnterface++
  355. if (res.data.code == '0') {
  356. const result = res.data.data;
  357. let billMsgList = result.billMsgList || [] //开单合理性提醒
  358. let highRiskList = result.highRiskList || [] //高危药品、手术
  359. let criticalValList = result.criticalValList || [] //危急值提醒
  360. let otherList = result.otherList || [] //其他提醒
  361. renderBillingPush(billMsgList, '开单合理性提醒', 'rationali')
  362. renderBillingPush(highRiskList, '高风险提示', 'highrisk')
  363. renderBillingPush(criticalValList, '危急值提醒', 'crivalue')
  364. //renderBillingPush(noteList,'检查内容注意事项')
  365. renderBillingPush(otherList, '其他提醒', 'otherremind')
  366. //moreInfo()
  367. $(".moduleItem.tips").wrapAll("<div class='tips-cont'></div>");
  368. updatePopNum();
  369. $(titleStr('warning')).insertBefore('.tips-cont .moduleItem:first-child')
  370. }
  371. empty();
  372. })
  373. }
  374. function renderWriteStandard() {
  375. return getWriteStandardPush().then(res => {
  376. $(".loading").hide();
  377. hasCompleteTnterface++
  378. if (res.data.code == '0') {
  379. const list = res.data.data || {}
  380. let casewritingNum = $(".moduleItem.casewriting").attr("data-num") || 5
  381. renderwriteStandardPage(list, casewritingNum)
  382. } else {
  383. empty();
  384. }
  385. })
  386. }
  387. function renderwriteStandardPage(list, casewritingNum) {
  388. let arr = Object.keys(list);
  389. if (arr.length > 0 && $(".moduleItem.casewriting").length > 0) {
  390. moduleNum++
  391. $(".moduleItem.casewriting").append(titleStr("casewritingPush"))
  392. let longStr = ``
  393. let shortStr = ``
  394. for (let i = 0; i < arr.length; i++) {
  395. if (i < casewritingNum) {
  396. shortStr += `<div class="billingPushItem"><img class="iconMark" src=${iconMark}>${arr[i]}</div>`
  397. }
  398. longStr += `<div class="billingPushItem"><img class="iconMark" src=${iconMark}>${arr[i]}</div>`
  399. }
  400. let shortStrBox = `<div class="shortStrBox">${shortStr}</div>`
  401. let longStrBox = `<div class="longStrBox">${longStr}</div>`
  402. let allStr = `<div class="casewritingWrapper"></div>`
  403. $(".moduleItem.casewriting").append(allStr)
  404. $(".casewritingWrapper").append(shortStrBox)
  405. if (arr.length > casewritingNum) {
  406. $(".shortStrBox .billingPushItem").eq($(".shortStrBox .billingPushItem").length - 1).append(`<span class="showMoreCaseWriting"><img class="iconArrowImg" src="${iconArrowDown}"></span>`)
  407. // $(".moduleItem .generalTreatInfo").append(`<span class="showLessGeneralTreat">收起<img class="iconArrowImg" src="${iconArrowUp}"></span>`)
  408. $(".casewritingWrapper").append(longStrBox)
  409. $(".longStrBox .billingPushItem").eq($(".longStrBox .billingPushItem").length - 1).append(`<span class="showLessCaseWriting"><img class="iconArrowImg" src="${iconArrowUp}"></span>`)
  410. }
  411. $('.moduleItem.casewriting').css("display", "block")
  412. updatePopNum();
  413. bindSlideCaseWriting()
  414. }
  415. empty();
  416. }
  417. function renderBillingPush(list, name, code) {
  418. if (list.length === 0) {
  419. return
  420. }
  421. moduleNum++
  422. let str = ``
  423. for (let i = 0; i < list.length; i++) {
  424. str += `<div class="billingPushItem"><img class="iconMark" src=${iconMark}>${list[i].msg}</div>`
  425. }
  426. let titleStr = titleStr2(name)
  427. let boxStr = `<div class="moduleBox">
  428. ${titleStr}
  429. ${str}
  430. </div>`
  431. $("." + code).append(boxStr)
  432. $('.moduleItem.' + code).addClass("tips").css("display", "block")
  433. }
  434. //更新消息个数
  435. function updatePopNum() {
  436. const writeNum = $(".casewriting .longStrBox").length ? $(".casewriting .longStrBox .billingPushItem").length : $(".casewriting .shortStrBox .billingPushItem").length;
  437. const warnNum = $(".tips-cont .billingPushItem").length + writeNum; //病例书写规范有隐藏元素
  438. if (warnNum === 0) {
  439. $(".tabList .numPop").hide();
  440. return;
  441. }
  442. $(".tabList .numPop").text(warnNum).show()
  443. }
  444. function renderDiag(diagPush) {
  445. let possibleDiagPush = diagPush["可能诊断"] || []
  446. let previousDiagPush = diagPush["既往诊断"] || []
  447. let firstDiagPush = diagPush["初步诊断"] || []
  448. let identifyDiagPush = diagPush["鉴别诊断"] || []
  449. let warningDiagPush = diagPush["警惕"] || []
  450. let number = $('.moduleItem.diag').attr("data-num") || 5
  451. let warnNumber = $('.moduleItem.warning').attr("data-num") || 5
  452. $('.moduleItem.diag').append(titleStr("diagPush"))
  453. // let warningDiagPush = [{name:"血常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null}]
  454. // let firstDiagPush = [{name:"血常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null}]
  455. // let identifyDiagPush = diagPush["鉴别诊断"] || [{name:"血常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null}]
  456. renderDiagItem(possibleDiagPush, "可能诊断", number)
  457. renderDiagItem(previousDiagPush, "既往诊断", number)
  458. renderDiagItem(firstDiagPush, "初步诊断", number)
  459. renderDiagItem(identifyDiagPush, "鉴别诊断", number)
  460. renderWarningDiag(warningDiagPush, "警惕", warnNumber)
  461. moreInfo()
  462. }
  463. function renderDiagItem(list, name, number) {
  464. if (list.length === 0) {
  465. return
  466. }
  467. moduleNum++
  468. let titleStr = titleStr2(name)
  469. let { shortStr, longStr } = renderItemWrapper(list, number)
  470. let boxStr = `<div class="moduleBox">
  471. ${titleStr}
  472. ${shortStr}
  473. ${longStr}
  474. </div>`
  475. $(".diag").append(boxStr)
  476. $('.moduleItem.diag').css("display", "block")
  477. }
  478. function renderWarningDiag(list, name, number) {
  479. if (list.length > 0 && $(".moduleItem.warning").length > 0) {
  480. moduleNum++
  481. $('.moduleItem.warning').append()
  482. let str = `<span class="warningTitle"><img class="warningTitImg" src=${warnImgWhite}>警惕</span>`
  483. for (let i = 0; i < list.length; i++) {
  484. str += renderPushItem(list[i], 1)
  485. }
  486. $('.moduleItem.warning').append(str)
  487. $('.moduleItem.warning').css("display", "block")
  488. }
  489. $(".pushItemBox").hover(function () {
  490. $(this).find(".infoImg").css("display", "inline");
  491. }, function () {
  492. $(this).find(".infoImg").css("display", "none");
  493. });
  494. $(".pushItemName").hover(function () {
  495. $(this).find(".infoImg").css("display", "inline");
  496. }, function () {
  497. $(this).find(".infoImg").css("display", "none");
  498. });
  499. $(".item-name").hover(function () {
  500. $(this).find(".infoImg").css("display", "inline");
  501. }, function () {
  502. $(this).find(".infoImg").css("display", "none");
  503. });
  504. $(".hidden-i").hover(function () {
  505. $(this).find(".infoImg").css("display", "inline");
  506. }, function () {
  507. $(this).find(".infoImg").css("display", "none");
  508. });
  509. $(".infoImg").hover(function () {
  510. $(this).find(".infoImg").css("display", "inline");
  511. }, function () {
  512. $(this).find(".infoImg").css("display", "none");
  513. });
  514. }
  515. function renderLis(list, showNum) {
  516. if (list.length > 0 && $(".moduleItem.lis").length > 0) {
  517. moduleNum++
  518. $('.moduleItem.lis').append(titleStr("lisPush"))
  519. let { shortStr, longStr } = renderItemWrapper(list, showNum)
  520. $('.moduleItem.lis').append(shortStr).append(longStr)
  521. $('.moduleItem.lis').css("display", "block")
  522. }
  523. }
  524. function renderScale(list, showNum) {
  525. if (list.length > 0 && $(".moduleItem.evaluation").length > 0) {
  526. moduleNum++
  527. $('.moduleItem.evaluation').append(titleStr("scalePush"))
  528. let { shortStr, longStr } = renderItemWrapper(list, showNum)
  529. $('.moduleItem.evaluation').append(shortStr).append(longStr)
  530. $('.moduleItem.evaluation').css("display", "block")
  531. }
  532. }
  533. function renderNurse(list, showNum) {
  534. if (list.length > 0 && $(".moduleItem.nurse").length > 0) {
  535. moduleNum++
  536. $('.moduleItem.nurse').append(titleStr("nursePush"))
  537. let { shortStr, longStr } = renderItemWrapper(list, showNum)
  538. $('.moduleItem.nurse').append(shortStr).append(longStr);
  539. $('.moduleItem.nurse').css("display", "block")
  540. }
  541. }
  542. function renderPacs(list, showNum) {
  543. if (list.length > 0 && $(".moduleItem.pacs").length > 0) {
  544. moduleNum++
  545. $(".moduleItem.pacs").append(titleStr("pacsPush"))
  546. let { shortStr, longStr } = renderItemWrapper(list, showNum)
  547. $(".moduleItem.pacs").append(shortStr).append(longStr)
  548. $('.moduleItem.pacs').css("display", "block")
  549. }
  550. }
  551. function renderCheckup(list, showNum) {
  552. if (list.length > 0 && $(".moduleItem.vital").length > 0) {
  553. moduleNum++
  554. $(".moduleItem.vital").append(titleStr("checkupPush"))
  555. let { shortStr, longStr } = renderItemWrapper(list, showNum)
  556. $(".moduleItem.vital").append(shortStr).append(longStr)
  557. $('.moduleItem.vital').css("display", "block")
  558. }
  559. }
  560. function renderSymptomPush(list, showNum) {
  561. $(".moduleItem.symptom").append(titleStr('symptomPush'))
  562. if (list.length > 0 && $(".moduleItem.symptom").length > 0) {
  563. moduleNum++
  564. let { shortStr, longStr } = renderItemWrapper(list, showNum)
  565. $(".moduleItem.symptom").append(shortStr).append(longStr)
  566. $(".moduleItem.symptom").css("display", "block")
  567. }
  568. }
  569. function rendergeneraTreatPush(list) {
  570. if (list && $(".moduleItem.general").length > 0) {
  571. $(".moduleItem.general").append(titleStr('generaTreatPush'))
  572. moduleNum++
  573. let str = `<div class="generalTreatInfo clearfix isOverFlow">${list}</div>`
  574. $(".moduleItem.general").append(str)
  575. $(".moduleItem.general").css("display", "block")
  576. let generaTreatHei = $(".moduleItem .generalTreatInfo")[0].scrollHeight
  577. if (generaTreatHei > 50) {
  578. $(".moduleItem .generalTreatInfo").append(`<span class="showMoreGeneralTreat"><img class="iconArrowImg more" src="${iconArrowDown}"></span>`)
  579. $(".moduleItem .generalTreatInfo").append(`<span class="showLessGeneralTreat"><img class="iconArrowImg" src="${iconArrowUp}"></span>`)
  580. bindGeneralSlide()
  581. }
  582. }
  583. }
  584. function renderMedicinesPush(list, showNum) {
  585. $(".moduleItem.medicine").append(titleStr('drugPush'))
  586. if (list.length > 0 && $(".moduleItem.medicine").length > 0) {
  587. moduleNum++
  588. let { shortStr, longStr } = renderItemWrapper(list, showNum)
  589. $(".moduleItem.medicine").append(shortStr).append(longStr)
  590. $(".moduleItem.medicine").css("display", "block")
  591. }
  592. }
  593. function renderOperationPush(list, showNum) {
  594. $(".moduleItem.operation").append(titleStr('operationPush'))
  595. if (list.length > 0 && $(".moduleItem.operation").length > 0) {
  596. moduleNum++
  597. let { shortStr, longStr } = renderItemWrapper(list, showNum)
  598. $(".moduleItem.operation").append(shortStr).append(longStr)
  599. $(".moduleItem.operation").css("display", "block")
  600. }
  601. }
  602. function renderItemWrapper(list, showNum) {
  603. let showNum1 = showNum || 5
  604. let shortStr = '', longStr = ''
  605. for (let i = 0; i < list.length; i++) {
  606. if (i <= showNum1 - 1) {
  607. shortStr += renderPushItem(list[i])
  608. }
  609. longStr += renderPushItem(list[i])
  610. }
  611. if (showNum1 >= list.length) {
  612. return {
  613. shortStr: `<div class="shortBox">${shortStr}</div>`,
  614. longStr: ''
  615. }
  616. } else {
  617. shortStr += `<span class="showMore"><img class="iconArrowImg" src="${iconArrowDown}"></span>`
  618. longStr += `<span class="showLess"><img class="iconArrowImg" src="${iconArrowUp}"></span>`
  619. return {
  620. shortStr: `<div class="shortBox">${shortStr}</div>`,
  621. longStr: `<div class="longBox">${longStr}</div>`
  622. }
  623. }
  624. }
  625. function renderPushItem(item) {
  626. const infoIcon = `${item.hasInfo == "1" ? `<img class="infoImg" src="${infoImg}">` : ""}`;
  627. str = `<span class="pushItemBox" data-name="${item.name}" data-type="${item.type}">`
  628. str += `<span class="pushItemName ${item.hasScale == "1" ? 'evaluationtitle' : ''} ${item.hasInfo == "1" ? '' : 'noInfo'}"><i class="item-name">${item.type == 8 ? ('【' + item.name + '】') : item.name}</i> ${infoIcon}<i class="hidden-i"></i></span>`
  629. str += `</span>`;
  630. return str
  631. }
  632. function bindOpenInfo() {
  633. $(".infoImg").on("mouseenter", function () {
  634. $(this).attr("src", infoImgOn)
  635. }).on("mouseleave", function () {
  636. $(this).attr("src", infoImg)
  637. })
  638. }
  639. function bindSlide() {
  640. $(".showMore").off("click").on("click", function () {
  641. $(this).parent().parent().find(".longBox").css("display", "block")
  642. $(this).parent().parent().find(".shortBox").css("display", "none")
  643. })
  644. $(".showLess").off("click").on("click", function () {
  645. $(this).parent().parent().find(".longBox").css("display", "none")
  646. $(this).parent().parent().find(".shortBox").css("display", "block")
  647. })
  648. }
  649. function renderModuleWrapper(moduleList) {
  650. if (!moduleList) {
  651. return
  652. }
  653. let moduleStr = ''
  654. for (let i = 0; i < moduleList.length; i++) {
  655. if (moduleList[i].status != '0') {
  656. if (moduleList[i].code == 'critical') {
  657. moduleStr += `<div class="moduleItem warning" data-num="${moduleList[i].number}" style="display:none"></div>`
  658. // moduleStr += `<div class="moduleItem tips" data-num="${moduleList[i].number}" style="display:none"></div>`
  659. } else {
  660. moduleStr += `<div class="moduleItem ${moduleList[i].code}" data-num="${moduleList[i].number}" style="display:none"></div>`
  661. }
  662. }
  663. }
  664. $(".recommendWrap").append(moduleStr)
  665. }
  666. function hasTab(tabName, tabList) {
  667. if (!tabList) {
  668. return
  669. }
  670. for (let i = 0; i < tabList.length; i++) {
  671. if (tabList[i].name == tabName) {
  672. return tabList[i]
  673. }
  674. }
  675. return false
  676. }
  677. function renderTab(tabList) {
  678. let tabStr = '<ul>'
  679. for (let i = 0; i < tabList.length; i++) {
  680. if (tabList[i].status == '1') {
  681. tabStr += `<li class="tab" data-name="${tabList[i].code}" ><span>${tabList[i].name}</span></li>`
  682. }
  683. }
  684. tabStr += `</ul><div class="numPop"></div>`;
  685. $(".tabList").append(tabStr)
  686. let tabNum = 0;
  687. if (isTcm == 'true') {
  688. tabNum = $(".tabList .tab").length - 1;
  689. }
  690. $(".tabList .tab").eq(tabNum).addClass("activeTab")
  691. let showModuleName = $(".tabList .tab").eq(tabNum).attr("data-name")
  692. getModuleShow(moduleConfig[showModuleName])
  693. bindTabClick()
  694. }
  695. function titleStr(type) {
  696. let titleStr = ''
  697. titleStr += `<h4 class="moduleTitle" style="background:${titleConfig[type].background}"><img class="titleIcon" src=${titleConfig[type].icon}>${titleConfig[type].name}</h4>`
  698. return titleStr
  699. }
  700. function titleStr2(name) {
  701. let titleStr = ''
  702. titleStr += `<p class="moduleBoxTitle">${name}:</p>`
  703. return titleStr
  704. }
  705. function bindTabClick() {
  706. $(".tabList .tab").off("click").on("click", function () {
  707. $(".activeTab").removeClass("activeTab")
  708. $(this).addClass("activeTab")
  709. const moduleName = $(this).attr("data-name")
  710. getModuleShow(moduleConfig[moduleName])
  711. if (moduleName == "medical") {
  712. $(".staticSearchT .ipt").find("input").focus()
  713. //$(".contentWrapper").css("overflowY","hidden")
  714. } else if (moduleName == 'followup') {
  715. // $(".contentWrapper").css("overflowY","auto")
  716. }
  717. })
  718. }
  719. function getModuleShow(moduleClassName) {
  720. if ($(`.${moduleClassName}`).css("display") == "none") {
  721. $(".moduleWrapper").css("display", "none")
  722. $(`.${moduleClassName}`).css("display", "block")
  723. }
  724. }
  725. function bindGeneralSlide() {
  726. $(".showMoreGeneralTreat").off("click").on("click", function () {
  727. $(".generalTreatInfo").toggleClass("isOverFlow")
  728. $(".showMoreGeneralTreat").toggle()
  729. })
  730. $(".showLessGeneralTreat").off("click").on("click", function () {
  731. $(".generalTreatInfo").toggleClass("isOverFlow")
  732. $(".showMoreGeneralTreat").toggle()
  733. })
  734. }
  735. function bindSlideCaseWriting() {
  736. $(".showMoreCaseWriting").off("click").on("click", function () {
  737. $(this).parents(".casewritingWrapper ").find(".shortStrBox").css("display", "none")
  738. $(this).parents(".casewritingWrapper ").find(".longStrBox").css("display", "block")
  739. })
  740. $(".showLessCaseWriting").off("click").on("click", function () {
  741. $(this).parents(".casewritingWrapper ").find(".shortStrBox").css("display", "block")
  742. $(this).parents(".casewritingWrapper ").find(".longStrBox").css("display", "none")
  743. })
  744. }
  745. //显示空状态
  746. function empty() {
  747. ifInputParam = hasInputParam();
  748. if (!ifInputParam) { //没有输入数据时
  749. $(".recommendBox .empty-box").hide();
  750. $(".recommendBox .empty").show();
  751. return;
  752. }
  753. if (hasCompleteTnterface === allInterface) { //需调的推送接口全部返回后
  754. setTimeout(function () {
  755. const emptyShownBox = $('.recommendWrap .empty-box:visible').length;
  756. const configShownBox = $('.recommendWrap .moduleItem:visible').length;
  757. if (configShownBox === 0 && emptyShownBox === 0) { //有配置但没数据
  758. $('.empty-box').hide();
  759. $('.recommendBox .empty-null').show();
  760. return;
  761. }
  762. $(".empty-box").hide();
  763. }, 200);
  764. }
  765. /*setTimeout(function(){
  766. const emptyShownBox = $('.recommendWrap .empty-box:visible').length;
  767. const configShownBox = $('.recommendWrap .moduleItem:visible').length;
  768. if(configShownBox===0&&emptyShownBox===0){ //有配置但没数据
  769. $('.empty-box').hide();
  770. $('.recommendBox .empty-null').show();
  771. return;
  772. }
  773. $(".empty-box").hide();
  774. },200);*/
  775. }
  776. $(function () {
  777. //隐藏logo
  778. if (getUrlArgObject("hideLg")) {
  779. $(".disclaimer .logo").hide();
  780. }
  781. getDisclaimer(); //获取免责声明
  782. getVersion(); //获取版本信息
  783. $(".disclaimerInfo").on("click", function () {
  784. openNewWin("disclaimer.html")
  785. });
  786. $(".version-tip").on("click", function () {
  787. const ver = localStorage.getItem('versionTime');
  788. $(".version-tip").removeClass('new-icon');
  789. localStorage.setItem('versionTime', ver.replace("=new", ""));
  790. openNewWin("version.html");
  791. });
  792. $.fn.extend({
  793. "preventScroll": function () {
  794. $(this).each(function () {
  795. var _this = this;
  796. if (navigator.userAgent.indexOf('Firefox') >= 0) { //firefox
  797. _this.addEventListener('DOMMouseScroll', function (e) {
  798. _this.scrollTop += e.detail > 0 ? 60 : -60;
  799. e.preventDefault();
  800. }, false);
  801. } else {
  802. _this.onmousewheel = function (e) {
  803. e = e || window.event;
  804. _this.scrollTop += e.wheelDelta > 0 ? -60 : 60;
  805. return false;
  806. };
  807. }
  808. })
  809. }
  810. });
  811. $(window).on("resize", function () {
  812. adjustHei()
  813. })
  814. });