cdss.js 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799
  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 {getTcmMr} = 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: 'tcmWarp',
  46. }
  47. let allInterface = 0
  48. let hasCompleteTnterface = 0
  49. let moduleNum = 0
  50. let mrId = getUrlArgObject('mrId')
  51. let isTcm = getUrlArgObject('isTcm')
  52. let pushMrId = getUrlArgObject('pushMrId')
  53. const tipsMode = getUrlArgObject('tipsMode') || 1
  54. let planCode = getUrlArgObject('planCode') || 'all'
  55. let hospitalIdUrl = getUrlArgObject('hospitalId') || ''
  56. let msg;
  57. let treatDisName;
  58. function getMRInfo() {
  59. return post(config.getMr2,{mrId:mrId})
  60. }
  61. $('.empty').css("display","none")
  62. if(mrId){
  63. Promise.all([getConf(),getMRInfo()]).then(([res1,res2])=>{
  64. const data = res1.data.data&&res1.data.data[0]
  65. msg = res2.data.data ||{}
  66. if(!(msg&&msg.diseaseName&&msg.diseaseName.name)){
  67. msg.diseaseName={}
  68. }
  69. window.msg = msg;
  70. renderPage(data)
  71. })
  72. } else{
  73. getConf().then(res =>{
  74. if(res.data.code == '0'){
  75. // const configArr = res.data.data.pushSetList || []
  76. // getPageInfo(configArr)
  77. const data = res.data.data&&res.data.data[0]
  78. renderPage(data)
  79. }
  80. })
  81. followEmpty()
  82. }
  83. function getConf() {
  84. var msg = window.msg
  85. return post(config.getPushSet,{hospitalId:hospitalIdUrl||msg.hospitalId||1,planCode: planCode})
  86. }
  87. function getPushInfo() {
  88. return post(config.pushInner, Object.assign({}, msg, {
  89. featureType: '1,4,5,6,7,8,9,10,12,13',
  90. hospitalId: hospitalIdUrl || msg.hospitalId,
  91. ruleType: config.ruleTypeMap['22']
  92. }))
  93. }
  94. function getPusgWarning(){
  95. const indPush = pushMrId ? config.indicationPushCache : config.indicationPush;
  96. return post(indPush, Object.assign({}, msg, {ruleType: '1,2,3,4', mrId: pushMrId || mrId}))
  97. }
  98. function getWriteStandardPush(){
  99. return post(config.caseWritingPrompt,Object.assign({},msg,{hospitalId:2||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(`staticInfo.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.filter(item => item.disclaimerCode == "2");
  179. $(".responsibility").html((data[0] || {}).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. const hasTcm = hasTab("中医辅助", pageSet.sysSetInfo);
  193. if (hasTcm) {
  194. getTcmMr(mrId, hasTcm);
  195. }
  196. if(!mrId){
  197. empty()
  198. return
  199. }
  200. if(hasAuxiliary){
  201. renderModuleWrapper(hasAuxiliary.planDetails)
  202. let needPush = isNeedPush(hasAuxiliary.planDetails)
  203. let needPushWarning = isNeedPushWarning(hasAuxiliary.planDetails)
  204. let needWriteStandardPush = isNeedwriteStandardPush(hasAuxiliary.planDetails)
  205. if(needPush || needPushWarning){
  206. renderPushData()
  207. allInterface++
  208. }
  209. if(needPushWarning){
  210. renderPushWarning()
  211. allInterface++
  212. }
  213. if(needWriteStandardPush){
  214. renderWriteStandard()
  215. allInterface++
  216. }
  217. }
  218. if(hasFollowUp){
  219. renderFollowUp(msg)
  220. }
  221. }
  222. function renderPushData(){
  223. return getPushInfo().then(res =>{
  224. hasCompleteTnterface++
  225. if(res.data.code == "0"){
  226. console.log(1)
  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 previousDiagPush = diagPush["既往诊断"] || []
  405. let firstDiagPush = diagPush["初步诊断"] || []
  406. let identifyDiagPush = diagPush["鉴别诊断"] || []
  407. let warningDiagPush = diagPush["警惕"] || []
  408. let number = $('.moduleItem.diag').attr("data-num") || 5
  409. let warnNumber = $('.moduleItem.warning').attr("data-num") || 5
  410. $('.moduleItem.diag').append(titleStr("diagPush"))
  411. // let warningDiagPush = [{name:"血常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null}]
  412. // let firstDiagPush = [{name:"血常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null}]
  413. // let identifyDiagPush = diagPush["鉴别诊断"] || [{name:"血常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null}]
  414. renderDiagItem(possibleDiagPush,"可能诊断",number)
  415. renderDiagItem(previousDiagPush, "既往诊断", number)
  416. renderDiagItem(firstDiagPush,"初步诊断",number)
  417. renderDiagItem(identifyDiagPush,"鉴别诊断",number)
  418. renderWarningDiag(warningDiagPush,"警惕",warnNumber)
  419. moreInfo()
  420. }
  421. function renderDiagItem(list,name,number){
  422. if(list.length === 0){
  423. return
  424. }
  425. moduleNum++
  426. let titleStr = titleStr2(name)
  427. let {shortStr, longStr} = renderItemWrapper(list,number,1,true)
  428. let boxStr = `<div class="moduleBox">
  429. ${titleStr}
  430. ${shortStr}
  431. ${longStr}
  432. </div>`
  433. $(".diag").append(boxStr)
  434. $('.moduleItem.diag').css("display","block")
  435. }
  436. function renderWarningDiag(list,name,number){
  437. if(list.length > 0 && $(".moduleItem.warning").length > 0){
  438. moduleNum++
  439. $('.moduleItem.warning').append()
  440. let str = `<span class="warningTitle"><img class="warningTitImg" src=${warnImgWhite}>警惕</span>`
  441. for(let i = 0; i < list.length; i++){
  442. str+= renderPushItem(list[i],1)
  443. }
  444. $('.moduleItem.warning').append(str)
  445. $('.moduleItem.warning').css("display","block")
  446. }
  447. }
  448. function renderLis(list,showNum,type,hasInfo){
  449. if(list.length > 0 && $(".moduleItem.lis").length > 0){
  450. moduleNum++
  451. $('.moduleItem.lis').append(titleStr("lisPush"))
  452. let {shortStr, longStr} = renderItemWrapper(list,showNum,type,hasInfo)
  453. $('.moduleItem.lis').append(shortStr).append(longStr)
  454. $('.moduleItem.lis').css("display","block")
  455. }
  456. }
  457. function renderScale(list,showNum,type,hasInfo){
  458. if(list.length > 0 && $(".moduleItem.evaluation").length > 0){
  459. moduleNum++
  460. $('.moduleItem.evaluation').append(titleStr("scalePush"))
  461. let {shortStr, longStr} = renderItemWrapper(list,showNum,type,hasInfo)
  462. $('.moduleItem.evaluation').append(shortStr).append(longStr)
  463. $('.moduleItem.evaluation').css("display","block")
  464. }
  465. }
  466. function renderNurse(list, showNum, type, hasInfo) {
  467. if (list.length > 0 && $(".moduleItem.nurse").length > 0) {
  468. moduleNum++
  469. $('.moduleItem.nurse').append(titleStr("nursePush"))
  470. let {shortStr, longStr} = renderItemWrapper(list, showNum, type, hasInfo)
  471. $('.moduleItem.nurse').append(shortStr).append(longStr);
  472. $('.moduleItem.nurse').css("display", "block")
  473. }
  474. }
  475. function renderPacs(list,showNum,type,hasInfo){
  476. if(list.length > 0 && $(".moduleItem.pacs").length > 0){
  477. moduleNum++
  478. $(".moduleItem.pacs").append(titleStr("pacsPush"))
  479. let {shortStr, longStr} = renderItemWrapper(list,showNum,type,hasInfo)
  480. $(".moduleItem.pacs").append(shortStr).append(longStr)
  481. $('.moduleItem.pacs').css("display","block")
  482. }
  483. }
  484. function renderCheckup(list,showNum,type,hasInfo){
  485. if(list.length > 0 && $(".moduleItem.vital").length > 0){
  486. moduleNum++
  487. $(".moduleItem.vital").append(titleStr("checkupPush"))
  488. let {shortStr, longStr} = renderItemWrapper(list,showNum,type,hasInfo)
  489. $(".moduleItem.vital").append(shortStr).append(longStr)
  490. $('.moduleItem.vital').css("display","block")
  491. }
  492. }
  493. function renderSymptomPush(list,showNum,type,hasInfo){
  494. $(".moduleItem.symptom").append(titleStr('symptomPush'))
  495. if(list.length > 0 && $(".moduleItem.symptom").length > 0){
  496. moduleNum++
  497. let {shortStr, longStr} = renderItemWrapper(list,showNum,type,hasInfo)
  498. $(".moduleItem.symptom").append(shortStr).append(longStr)
  499. $(".moduleItem.symptom").css("display","block")
  500. }
  501. }
  502. function rendergeneraTreatPush(list){
  503. if(list&& $(".moduleItem.general").length > 0){
  504. $(".moduleItem.general").append(titleStr('generaTreatPush'))
  505. moduleNum++
  506. let str = `<div class="generalTreatInfo clearfix isOverFlow">${list}</div>`
  507. $(".moduleItem.general").append(str)
  508. $(".moduleItem.general").css("display","block")
  509. let generaTreatHei = $(".moduleItem .generalTreatInfo")[0].scrollHeight
  510. if(generaTreatHei > 50){
  511. $(".moduleItem .generalTreatInfo").append(`<span class="showMoreGeneralTreat">更多<img class="iconArrowImg more" src="${iconArrowDown}"></span>`)
  512. $(".moduleItem .generalTreatInfo").append(`<span class="showLessGeneralTreat">收起<img class="iconArrowImg" src="${iconArrowUp}"></span>`)
  513. bindGeneralSlide()
  514. }
  515. }
  516. }
  517. function renderMedicinesPush(list,showNum,type,hasInfo){
  518. $(".moduleItem.medicine").append(titleStr('drugPush'))
  519. if(list.length > 0 && $(".moduleItem.medicine").length > 0){
  520. moduleNum++
  521. let {shortStr, longStr} = renderItemWrapper(list,showNum,type,hasInfo)
  522. $(".moduleItem.medicine").append(shortStr).append(longStr)
  523. $(".moduleItem.medicine").css("display","block")
  524. }
  525. }
  526. function renderOperationPush(list,showNum,type,hasInfo){
  527. $(".moduleItem.operation").append(titleStr('operationPush'))
  528. if(list.length > 0 && $(".moduleItem.operation").length > 0){
  529. moduleNum++
  530. let {shortStr, longStr} = renderItemWrapper(list,showNum,type,hasInfo)
  531. $(".moduleItem.operation").append(shortStr).append(longStr)
  532. $(".moduleItem.operation").css("display","block")
  533. }
  534. }
  535. function renderItemWrapper(list, showNum, type, hasInfo) {
  536. //console.log(33, type)
  537. let showNum1 = showNum || 5
  538. let shortStr = '', longStr = ''
  539. for(let i = 0; i < list.length; i++){
  540. if(i <= showNum1-1){
  541. shortStr += renderPushItem(list[i],type)
  542. }
  543. longStr += renderPushItem(list[i],type)
  544. }
  545. if(showNum1 >= list.length){
  546. return {
  547. shortStr:`<div class="shortBox">${shortStr}</div>`,
  548. longStr:''
  549. }
  550. }else{
  551. shortStr += `<span class="showMore">更多 <img class="iconArrowImg" src="${iconArrowDown}"></span>`
  552. longStr += `<span class="showLess">收起 <img class="iconArrowImg" src="${iconArrowUp}"></span>`
  553. return {
  554. shortStr:`<div class="shortBox clearfix">${shortStr}</div>`,
  555. longStr:`<div class="longBox clearfix">${longStr}</div>`
  556. }
  557. }
  558. }
  559. function renderPushItem(item,type){
  560. 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>`
  561. return str
  562. }
  563. function bindOpenInfo(){
  564. $(".infoImg").on("mouseenter", function(){
  565. $(this).attr("src", infoImgOn)
  566. }).on("mouseleave", function(){
  567. $(this).attr("src", infoImg)
  568. })
  569. }
  570. function bindSlide(){
  571. $(".showMore").on("click", function(){
  572. $(this).parent().parent().find(".longBox").css("display","block")
  573. $(this).parent().parent().find(".shortBox").css("display","none")
  574. })
  575. $(".showLess").on("click", function(){
  576. $(this).parent().parent().find(".longBox").css("display","none")
  577. $(this).parent().parent().find(".shortBox").css("display","block")
  578. })
  579. }
  580. function renderModuleWrapper(moduleList){
  581. if(!moduleList){
  582. return
  583. }
  584. let moduleStr = ''
  585. for(let i = 0; i < moduleList.length; i++){
  586. if(moduleList[i].status !='0'){
  587. if(moduleList[i].code == 'critical'){
  588. moduleStr += `<div class="moduleItem warning" data-num="${moduleList[i].number}" style="display:none"></div>`
  589. // moduleStr += `<div class="moduleItem tips" data-num="${moduleList[i].number}" style="display:none"></div>`
  590. }else{
  591. moduleStr += `<div class="moduleItem ${moduleList[i].code }" data-num="${moduleList[i].number}" style="display:none"></div>`
  592. }
  593. }
  594. }
  595. // console.log(moduleList,moduleStr)
  596. $(".recommendWrap").append(moduleStr)
  597. }
  598. function hasTab(tabName,tabList){
  599. if(!tabList){
  600. return
  601. }
  602. for(let i = 0; i < tabList.length; i++){
  603. if(tabList[i].name == tabName){
  604. return tabList[i]
  605. }
  606. }
  607. return false
  608. }
  609. function renderTab(tabList){
  610. let tabStr = ''
  611. for(let i = 0; i < tabList.length; i++){
  612. if(tabList[i].status == '1'){
  613. tabStr += `<span class="tab" data-name="${tabList[i].code}" >${tabList[i].name}<span class="activeLine"></span></span>`
  614. }
  615. }
  616. $(".tabList").append(tabStr)
  617. let tabNum = 0;
  618. if(isTcm=='true'){
  619. tabNum = $(".tabList .tab").length-1;
  620. }
  621. $(".tabList .tab").eq(tabNum).addClass("activeTab")
  622. let showModuleName = $(".tabList .tab").eq(tabNum).attr("data-name")
  623. getModuleShow(moduleConfig[showModuleName])
  624. bindTabClick()
  625. }
  626. function titleStr(type){
  627. let titleStr = ''
  628. titleStr += `<h4 class="moduleTitle" style="background:${titleConfig[type].background}"><img class="titleIcon" src=${titleConfig[type].icon}>${titleConfig[type].name}</h4>`
  629. return titleStr
  630. }
  631. function titleStr2(name){
  632. let titleStr = ''
  633. titleStr += `<p class="moduleBoxTitle">${name}:</p>`
  634. return titleStr
  635. }
  636. function bindTabClick(){
  637. $(".tabList .tab").on("click", function(){
  638. $(".activeTab").removeClass("activeTab")
  639. $(this).addClass("activeTab")
  640. const moduleName = $(this).attr("data-name")
  641. getModuleShow(moduleConfig[moduleName])
  642. if(moduleName == "medical"){
  643. $(".staticSearchT .ipt").find("input").focus()
  644. $(".contentWrapper").css("overflowY","hidden")
  645. }else if(moduleName == 'followup'){
  646. // $(".contentWrapper").css("overflowY","auto")
  647. }
  648. })
  649. }
  650. function getModuleShow(moduleClassName){
  651. if( $(`.${moduleClassName}`).css("display") =="none"){
  652. $(".moduleWrapper").css("display","none")
  653. $(`.${moduleClassName}`).css("display","block")
  654. }
  655. }
  656. function bindGeneralSlide(){
  657. $(".showMoreGeneralTreat").on("click",function(){
  658. $(".generalTreatInfo").toggleClass("isOverFlow")
  659. $(".showMoreGeneralTreat").toggle()
  660. })
  661. $(".showLessGeneralTreat").on("click",function(){
  662. $(".generalTreatInfo").toggleClass("isOverFlow")
  663. $(".showMoreGeneralTreat").toggle()
  664. })
  665. }
  666. function bindSlideCaseWriting(){
  667. $(".showMoreCaseWriting").on("click",function(){
  668. $(this).parents(".casewritingWrapper ").find(".shortStrBox").css("display","none")
  669. $(this).parents(".casewritingWrapper ").find(".longStrBox").css("display","block")
  670. })
  671. $(".showLessCaseWriting").on("click",function(){
  672. $(this).parents(".casewritingWrapper ").find(".shortStrBox").css("display","block")
  673. $(this).parents(".casewritingWrapper ").find(".longStrBox").css("display","none")
  674. })
  675. }
  676. function empty(){
  677. // $(".responsibility").css("display","none")
  678. $('.recommendWrap .empty').css("display","block")
  679. }
  680. $(function(){
  681. getDisclaimer(); //获取免责声明
  682. getVersion(); //获取版本信息
  683. $(".disclaimerInfo").on("click", function(){
  684. openNewWin("disclaimer.html")
  685. });
  686. $(".version-tip").on("click", function(){
  687. const ver = localStorage.getItem('versionTime');
  688. $(".version-tip").removeClass('new-icon');
  689. localStorage.setItem('versionTime',ver.replace("=new",""));
  690. openNewWin("version.html");
  691. });
  692. $.fn.extend({
  693. "preventScroll":function(){
  694. $(this).each(function(){
  695. var _this = this;
  696. if(navigator.userAgent.indexOf('Firefox') >= 0){ //firefox
  697. _this.addEventListener('DOMMouseScroll',function(e){
  698. _this.scrollTop += e.detail > 0 ? 60 : -60;
  699. e.preventDefault();
  700. },false);
  701. }else{
  702. _this.onmousewheel = function(e){
  703. e = e || window.event;
  704. _this.scrollTop += e.wheelDelta > 0 ? -60 : 60;
  705. return false;
  706. };
  707. }
  708. })
  709. }
  710. });
  711. // $(".iframeWrap").preventScroll();
  712. $(".iframeWrap").preventScroll();
  713. $(".recommendWrap").preventScroll();
  714. $(".tcmWarp").preventScroll();
  715. $(".infoWrap").preventScroll();
  716. $(".medicalKonwledgeWrap .staticSearchB ul").preventScroll();
  717. $(window).on("resize", function(){
  718. $(".iframeWrap").preventScroll();
  719. $(".recommendWrap").preventScroll();
  720. $(".tcmWarp").preventScroll();
  721. $(".medicalKonwledgeWrap .staticSearchB ul").preventScroll();
  722. adjustHei()
  723. })
  724. });