index.js 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. require('./../css/reset.css');
  2. require('./../css/indexVert.less');
  3. require('./../css/popup.css');
  4. // require('./popupEdit.js');
  5. var Promise = require("bluebird");
  6. const $ = require("jquery");
  7. const { post,config,getUrlArgObject,openNewWin } = require('./promise.js');
  8. const { transConf } = require('./util.js');
  9. const { renderRecommendInfo, renderMultRecommendInfo, renderTreat, renderRecommendConditTips, renderTipsInfo } = require('./indexVertDom.js');
  10. let mrId = getUrlArgObject('mrId')
  11. let msg;
  12. if(mrId) {
  13. post(config.getMr,{mrId:mrId}).then((res) => {
  14. const data = res.data
  15. if(data.code == 0) {
  16. msg = Object.assign(data.data, {hosCode:getUrlArgObject('hospitalCode') || '',plan:getUrlArgObject('plan') || '0',})
  17. window.msg = msg
  18. window.pushMessage = {}
  19. getPageInfo();
  20. }
  21. })
  22. } else {
  23. msg = {
  24. age: getUrlArgObject('age'),
  25. sex: getUrlArgObject('sex') == '男'?1:(getUrlArgObject('sex') == '女'?2:(getUrlArgObject('sex') == '通用'?3:getUrlArgObject('sex'))),
  26. symptom: getUrlArgObject('symptomJson'),
  27. vital: getUrlArgObject('vitalJson'),
  28. lis: getUrlArgObject('lisJson')? JSON.parse(getUrlArgObject('lisJson')) : [],
  29. pacs: getUrlArgObject('pacsJson'),
  30. diag: getUrlArgObject('diagJson'),
  31. diseaseName: getUrlArgObject('diseaseName'),
  32. other: getUrlArgObject('otherJson') + getUrlArgObject('pastJson'),
  33. hosCode:getUrlArgObject('hospitalCode') || '',
  34. plan:getUrlArgObject('plan') || '0',
  35. }
  36. window.msg = msg
  37. window.pushMessage = {}
  38. getPageInfo();
  39. }
  40. // var msg = {
  41. // age: getUrlArgObject('age'),
  42. // sex: getUrlArgObject('sex') == '男'?1:(getUrlArgObject('sex') == '女'?2:(getUrlArgObject('sex') == '通用'?3:getUrlArgObject('sex'))),
  43. // symptom: getUrlArgObject('symptomJson'),
  44. // vital: getUrlArgObject('vitalJson'),
  45. // lis: getUrlArgObject('lisJson')? JSON.parse(getUrlArgObject('lisJson')) : [],
  46. // pacs: getUrlArgObject('pacsJson'),
  47. // diag: getUrlArgObject('diagJson'),
  48. // diseaseName: getUrlArgObject('diseaseName'),
  49. // other: getUrlArgObject('otherJson') + getUrlArgObject('pastJson'),
  50. // hosCode:getUrlArgObject('hospitalCode') || '',
  51. // plan:getUrlArgObject('plan') || '0',
  52. // }//推送相关信息
  53. // // http://localhost:8082/indexVert.html?age=28&diseaseId=280&lisJson=&diagJson=%E6%80%A5%E6%80%A7%E8%83%B0%E8%85%BA%E7%82%8E&pastJson=%E6%97%A0%E5%BF%83%E8%84%8F%E7%97%85&otherJson=%E6%97%A0%E9%AB%98%E8%A1%80%E5%8E%8B&pacsJson=%E8%85%B9%E9%83%A8B%E8%B6%85:%E6%97%A0%E5%BC%82%E5%B8%B8,%20%E6%8A%A5%E5%91%8A%E6%97%A5%E6%9C%9F:2019-05-07&sex=%E7%94%B7&symptomJson=%E6%81%B6%E5%BF%83%E5%91%95%E5%90%90%E8%85%B0%E7%97%9B&vitalJson=%E8%A1%80%E5%8E%8B%E5%B7%A6%E4%B8%8A%E8%82%A213/12mmHg
  54. // window.msg = msg
  55. // window.pushMessage = {}
  56. function getConf() {
  57. return post(config.getSysSetInfoDatas,{hospitalCode: msg.hosCode,plan:msg.plan})
  58. }
  59. function getPushInfo() {
  60. return post(config.pushInner,Object.assign({featureType: '1,4,5,6,7,22'},msg))
  61. }
  62. function getTreatment() {
  63. return post(config.pushTreatment,Object.assign({featureType: '8'},msg))
  64. }
  65. function getTipsInfo() {
  66. return post(config.information,{name:getUrlArgObject('tipsName'),type:getUrlArgObject('tipsType'), position: 1})
  67. }
  68. function getPageInfo() {
  69. Promise.all([getConf(),getPushInfo(),getTreatment(),getTipsInfo()]).then(([res1, res2, res3, res4]) =>{
  70. console.log({res1, res2, res3, res4})
  71. const configArr = res1&&res1.data&&res1.data.data || []
  72. const pushInfo = res2&&res2.data || {}
  73. const treatInfo = res3&&res3.data || {}
  74. const tipsInfo = res4&&res4.data || {}
  75. const confArr = transConf(configArr)
  76. pushResult = pushInfo.data || {};
  77. treatResult = treatInfo.data || {}
  78. tipsResult = tipsInfo.data || {}
  79. const diagPossible = pushResult.dis&&pushResult.dis['可能诊断'] || []//可能
  80. const diagDoubt = pushResult.dis&&pushResult.dis['疑似诊断'] || [] // 疑似
  81. const diagDeter = pushResult.dis&&pushResult.dis['确诊'] || []//确诊
  82. const diagWaring = pushResult.dis&&pushResult.dis['警惕'] || [] // 推荐警惕诊断
  83. const symptomRecommend = pushResult.symptom || [] //推荐问诊症状
  84. const physiExamRecommend = pushResult.vital || [] //推荐体格检查
  85. const diagRecommend = diagPossible.concat(diagDoubt, diagDeter) //推荐诊断
  86. const labRecommend = pushResult.lab || []
  87. const pacsRecommend = pushResult.pacs || []
  88. const medicalIndications = pushResult.medicalIndications || []
  89. const labAndPacsRecommend = [
  90. {
  91. title: '化验',
  92. className: 'labRecommend',
  93. data: labRecommend
  94. },
  95. {
  96. title: '辅检',
  97. className: 'pacsRecommend',
  98. data: pacsRecommend
  99. }
  100. ]
  101. window.pushMessage = medicalIndications;//计算的需要的相关数据
  102. for(let i = 0; i < confArr.length; i++) {
  103. switch(confArr[i].code) {
  104. case "inquiry_show": //问诊症状
  105. renderRecommendInfo('symptomRecommend', '问诊症状', symptomRecommend, false)
  106. break;
  107. case "health_show": //体格检查
  108. renderRecommendInfo('physiExamRecommend', '体格检查', physiExamRecommend, false)
  109. break;
  110. case "illness_show": //病情提示
  111. renderRecommendConditTips('conditTips','病情提示', medicalIndications || [])
  112. break;
  113. case "vigilant_show": //警惕诊断
  114. renderRecommendInfo('warning', '警惕诊断', diagWaring, true,7,2)
  115. break;
  116. case "lispacs_show": //检验检查
  117. renderMultRecommendInfo('labAndPacsRecommend', '检验检查', labAndPacsRecommend, false)
  118. break;
  119. case "cure_show": //治疗方案
  120. renderTreat('treatRecommend','治疗方案',treatResult)
  121. break;
  122. case "diagnose_show": //推荐诊断
  123. renderRecommendInfo('diagRecommend', '推荐诊断', diagRecommend, true,7,2)
  124. break;
  125. case "tip_show": //提示信息
  126. renderTipsInfo('tipsInfo','提示信息',tipsResult)
  127. moreInfo()
  128. break;
  129. default:
  130. return
  131. }
  132. }
  133. }).catch(function (err) {
  134. console.log(err);
  135. })
  136. }
  137. function moreInfo() {
  138. $('.moreInfo').click(function(){
  139. const name = $(this).attr('data-name')
  140. const type = getUrlArgObject('tipsType')
  141. openNewWin(`information.html?type=${type}&position=0&name=${name}`)
  142. })
  143. }
  144. function getVersion() {
  145. post(config.getVersion, '').then((res) => {
  146. const data = res.data.data;
  147. const ver = localStorage.getItem('versionTime');
  148. const time = data.refreshTime;
  149. if(!ver||ver===time+"=new"||time!==ver.replace("=new","")){ //判断版本是否更新
  150. $(".version-tip").addClass('new-icon');
  151. localStorage.setItem('versionTime',time+"=new"); //保存版本更新时间
  152. }else{
  153. $(".version-tip").removeClass('new-icon');
  154. }
  155. })
  156. }
  157. function getDisclaimer() {
  158. post(config.disclaimer, '').then((res) => {
  159. const data = res.data.data.find(item => item.disclaimerCode == '2');
  160. $(".responsibility").html(data.description);
  161. })
  162. }
  163. $(function(){
  164. getDisclaimer(); //获取免责声明
  165. getVersion(); //获取版本信息
  166. $(".disclaimerInfo").on("click", function(){
  167. openNewWin("disclaimer.html")
  168. });
  169. $(".version-tip").on("click", function(){
  170. const ver = localStorage.getItem('versionTime');
  171. $(".version-tip").removeClass('new-icon');
  172. localStorage.setItem('versionTime',ver.replace("=new",""));
  173. openNewWin("version.html");
  174. });
  175. });