cdss.js 26 KB

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