cdss.js 28 KB

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