indexHorizontal.js 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. require('./../css/reset.css');
  2. require('./../css/indexHorizontal.less');
  3. // require('./../css/popup.css');
  4. // require('./popupEdit.js');
  5. var Promise = require("bluebird");
  6. let warningImg = require('./../images/warings.png')
  7. let diagImg = require('./../images/yszd.png')
  8. let symptomImg = require('./../images/inquire.png')
  9. let physiExamImg = require('./../images/tgjc.png')
  10. let labAndPacsImg = require('./../images/inspect.png')
  11. let conditTipsImg = require('./../images/tips.png')
  12. let treatImg = require('./../images/zhiliao.png')
  13. const $ = require("jquery");
  14. const { post,config,getUrlArgObject,openNewWin, isIe8 } = require('./promise.js');
  15. const { transConf } = require('./util.js');
  16. const { renderRecommendInfo, renderMultRecommendInfo, renderTreat, renderRecommendConditTips, renderTipsInfo ,renderKnowledgeInfo,renderScaleInfo} = require('./indexHorizontalDom.js');
  17. const is8Ie = isIe8() //判断是否为IE8
  18. if(is8Ie) {
  19. let reg = /undefined/g
  20. warningImg = warningImg.replace(reg, '')
  21. diagImg = diagImg.replace(reg, '')
  22. symptomImg = symptomImg.replace(reg, '')
  23. physiExamImg = physiExamImg.replace(reg, '')
  24. labAndPacsImg = labAndPacsImg.replace(reg, '')
  25. conditTipsImg = conditTipsImg.replace(reg, '')
  26. treatImg = treatImg.replace(reg, '')
  27. }
  28. let mrId = getUrlArgObject('mrId')
  29. let showTab = getUrlArgObject('showTab') || '0';
  30. const tipsMode = getUrlArgObject('tipsMode') || 1
  31. let msg;
  32. if(mrId) {
  33. post(config.getMr,{mrId:mrId}).then((res) => {
  34. const data = res.data
  35. if(data.code == 0) {
  36. msg = Object.assign(data.data, {hosCode:getUrlArgObject('hospitalCode') || '',plan:getUrlArgObject('plan') || '0',})
  37. window.msg = msg
  38. getPageInfo();
  39. }
  40. })
  41. } else {
  42. 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. pasts: getUrlArgObject('otherJson') + getUrlArgObject('pastJson'),
  53. hosCode:getUrlArgObject('hospitalCode') || '',
  54. plan:getUrlArgObject('plan') || '0',
  55. }
  56. window.msg = msg
  57. getPageInfo();
  58. }
  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. const configArr = res1&&res1.data&&res1.data.data || []
  79. const pushInfo = res2.data || {}
  80. const treatInfo = res3.data || {}
  81. const {confArr, showLabsNum, showPacsNum, labsAndPacMode} = transConf(configArr)
  82. const tipsInfo = res4.data || {}
  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. showNum: showLabsNum
  109. },
  110. {
  111. title: '辅检',
  112. className: 'pacsRecommend',
  113. data: pacsRecommend,
  114. showNum: showPacsNum
  115. }
  116. ]
  117. window.pushMessage = medicalIndications;//计算的需要的相关数据
  118. let tipsNum = 0;
  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, symptomImg, 'symptomRecommend', '问诊症状', symptomRecommend, false)
  123. break;
  124. case "health_show": //体格检查
  125. physiExamRecommend.length > 0 && renderRecommendInfo(confArr[i].showNum, physiExamImg, 'physiExamRecommend', '体格检查', physiExamRecommend, false)
  126. break;
  127. case "illness_show": //病情提示
  128. medicalIndications.length > 0 && renderRecommendConditTips(conditTipsImg, 'conditTips','病情提示', medicalIndications || [])
  129. break;
  130. case "vigilant_show": //警惕诊断
  131. diagWaring.length > 0 && renderRecommendInfo(confArr[i].showNum, warningImg, 'warning', '警惕诊断', diagWaring, true,7,2)
  132. break;
  133. case "lispacs_show": //检验检查
  134. (labRecommend.length > 0 || pacsRecommend.length >0) && renderMultRecommendInfo(labsAndPacMode,labAndPacsImg, 'labAndPacsRecommend', '检验检查', labAndPacsRecommend, false)
  135. break;
  136. case "cure_show": //治疗方案
  137. if(JSON.stringify(treatResult)!='{}'&&(treatResult.commonTreatment||treatResult.treatmentPlan&&treatResult.treatmentPlan.length > 0)) {
  138. tipsNum++;
  139. renderTreat(treatImg, 'treatRecommend','治疗方案',treatResult)
  140. }
  141. break;
  142. case "diagnose_show": //推荐诊断
  143. diagRecommend.length > 0 && renderRecommendInfo(confArr[i].showNum, diagImg, 'diagRecommend', '推荐诊断', diagRecommend, true,7,2)
  144. break;
  145. case "tip_show": //提示信息
  146. if(tipsResult.length > 0 ) {
  147. tipsNum++;
  148. renderTipsInfo('', 'tipsInfo','提示信息',tipsResult)
  149. moreInfo()
  150. }
  151. break;
  152. case "knowledge_show": //医学知识
  153. tipsNum++;
  154. renderKnowledgeInfo('','knowledgeInfo','医学知识','点击搜索医学知识')
  155. break;
  156. case "scale_show": //全部量表
  157. tipsNum++;
  158. renderScaleInfo('','scaleInfo','全部量表','点击搜索全部量表')
  159. break;
  160. default:
  161. break;
  162. }
  163. }
  164. function bindTab() {
  165. $('.infoTabBox .infoTab').eq(showTab).addClass('activeTab').siblings().removeClass('activeTab')
  166. $('.informationBox').eq(showTab).siblings(".informationBox").css({"display":"none"})
  167. // if(showTab == '1') {
  168. // $('.infoTabBox .tipsTab').addClass('activeTab')
  169. // $('.infomationBox .treatRecommend').css("display","none")
  170. // } else {
  171. // $('.infoTabBox .treatTab').addClass('activeTab')
  172. // $('.infomationBox .tipsInfo').css("display","none")
  173. // $('.infomationBox .staticWin').css("display","none")
  174. // }
  175. $('.infomationBox .infoTab').click(function() {
  176. $(this).addClass('activeTab').siblings().removeClass('activeTab')
  177. $('.informationBox').css("display","none")
  178. const boxNode = $(this).attr('data-box')
  179. $('.'+boxNode).css("display","block")
  180. })
  181. }
  182. if(tipsNum > 1) {
  183. bindTab();
  184. }else if(tipsNum == 0){
  185. $('.push').css({
  186. "width":"95%",
  187. "border-right":"0 none"
  188. })
  189. $('.itemAllBox').css({"width":"98%"})
  190. }
  191. function moreInfo() {
  192. $('.moreInfo').click(function(){
  193. const name = $(this).attr('data-name')
  194. const type = $(this).attr('data-type')
  195. openNewWin(`information.html?type=${encodeURIComponent(type)}&position=0&name=${encodeURIComponent(name)}`)
  196. })
  197. }
  198. const pushHei = $('.push').height()
  199. if(pushHei == 0) {
  200. $('.infomationBox').css({"width":"90%"})
  201. }
  202. }).catch(function (err) {
  203. console.log(err);
  204. })
  205. }
  206. function getVersion() {
  207. post(config.getVersion, '').then((res) => {
  208. const data = res.data.data;
  209. const name = data.name;
  210. const ver = localStorage.getItem('versionTime-v');
  211. const time = data.refreshTime;
  212. if(!ver||ver===time+"=new"||time!==ver.replace("=new","")){ //判断版本是否更新
  213. $(".version").addClass('new-icon');
  214. localStorage.setItem('versionTime-v',time+"=new"); //保存版本更新时间
  215. }else{
  216. $(".version").removeClass('new-icon');
  217. }
  218. $(".version span").html(name);
  219. })
  220. }
  221. $(function(){
  222. getVersion();
  223. //打开版本信息
  224. $(".disclaimer .version").on("click",function() {
  225. const ver = localStorage.getItem('versionTime-v');
  226. $(".version").removeClass('new-icon');
  227. localStorage.setItem('versionTime-v',ver.replace("=new",""));
  228. openNewWin("version.html");
  229. });
  230. })