cdssHorizontal.js 30 KB

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