cdss.js 27 KB

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