index.js 8.9 KB

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