cdss.js 28 KB

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