index.js 8.2 KB

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