cdssHorizontal.js 30 KB

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