indexHorizontal.js 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  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. hosCode:getUrlArgObject('hospitalCode') || '',
  53. plan:getUrlArgObject('plan') || '0',
  54. }
  55. window.msg = msg
  56. getPageInfo();
  57. }
  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. const configArr = res1&&res1.data&&res1.data.data || []
  78. const pushInfo = res2.data || {}
  79. const treatInfo = res3.data || {}
  80. const {confArr, showLabsNum, showPacsNum, labsAndPacMode} = transConf(configArr)
  81. const tipsInfo = res4.data || {}
  82. const pushResult = pushInfo.data || {};
  83. const treatResult = treatInfo.data || {}
  84. let tipsResult = []
  85. if(tipsInfo.data) {
  86. if(tipsMode == '2') {
  87. tipsResult = tipsInfo.data
  88. } else {
  89. tipsResult.push(tipsInfo.data)
  90. }
  91. }
  92. const diagPossible = pushResult.dis&&pushResult.dis['可能诊断'] || []//可能
  93. const diagDoubt = pushResult.dis&&pushResult.dis['拟诊'] || [] // 疑似
  94. const diagDeter = pushResult.dis&&pushResult.dis['确诊'] || []//确诊
  95. const diagWaring = pushResult.dis&&pushResult.dis['警惕'] || [] // 推荐警惕诊断
  96. const symptomRecommend = pushResult.symptom || [] //推荐问诊症状
  97. const physiExamRecommend = pushResult.vital || [] //推荐体格检查
  98. const diagRecommend = diagDeter.concat(diagDoubt, diagPossible) //推荐诊断
  99. const labRecommend = pushResult.lab || []
  100. const pacsRecommend = pushResult.pacs || []
  101. const medicalIndications = pushResult.medicalIndications || []
  102. const labAndPacsRecommend = [
  103. {
  104. title: '化验',
  105. className: 'labRecommend',
  106. data: labRecommend,
  107. showNum: showLabsNum
  108. },
  109. {
  110. title: '辅检',
  111. className: 'pacsRecommend',
  112. data: pacsRecommend,
  113. showNum: showPacsNum
  114. }
  115. ]
  116. window.pushMessage = medicalIndications;//计算的需要的相关数据
  117. let tipsNum = 0;
  118. for(let i = 0; i < confArr.length; i++) {
  119. switch(confArr[i].code) {
  120. case "inquiry_show": //问诊症状
  121. symptomRecommend.length > 0 && renderRecommendInfo(confArr[i].showNum, symptomImg, 'symptomRecommend', '问诊症状', symptomRecommend, false)
  122. break;
  123. case "health_show": //体格检查
  124. physiExamRecommend.length > 0 && renderRecommendInfo(confArr[i].showNum, physiExamImg, 'physiExamRecommend', '体格检查', physiExamRecommend, false)
  125. break;
  126. case "illness_show": //病情提示
  127. medicalIndications.length > 0 && renderRecommendConditTips(conditTipsImg, 'conditTips','病情提示', medicalIndications || [])
  128. break;
  129. case "vigilant_show": //警惕诊断
  130. diagWaring.length > 0 && renderRecommendInfo(confArr[i].showNum, warningImg, 'warning', '警惕诊断', diagWaring, true,7,2)
  131. break;
  132. case "lispacs_show": //检验检查
  133. (labRecommend.length > 0 || pacsRecommend.length >0) && renderMultRecommendInfo(labsAndPacMode,labAndPacsImg, 'labAndPacsRecommend', '检验检查', labAndPacsRecommend, false)
  134. break;
  135. case "cure_show": //治疗方案
  136. if(JSON.stringify(treatResult)!='{}'&&treatResult.commonTreatment&&treatResult.treatmentPlan&&treatResult.treatmentPlan.length > 0) {
  137. tipsNum++;
  138. renderTreat(treatImg, 'treatRecommend','治疗方案',treatResult)
  139. }
  140. break;
  141. case "diagnose_show": //推荐诊断
  142. diagRecommend.length > 0 && renderRecommendInfo(confArr[i].showNum, diagImg, 'diagRecommend', '推荐诊断', diagRecommend, true,7,2)
  143. break;
  144. case "tip_show": //提示信息
  145. if(tipsResult.length > 0 ) {
  146. tipsNum++;
  147. renderTipsInfo('', 'tipsInfo','提示信息',tipsResult)
  148. moreInfo()
  149. }
  150. break;
  151. case "knowledge_show": //医学知识
  152. tipsNum++;
  153. renderKnowledgeInfo('','knowledgeInfo','医学知识','点击搜索医学知识')
  154. break;
  155. case "scale_show": //全部量表
  156. tipsNum++;
  157. renderScaleInfo('','scaleInfo','全部量表','点击搜索全部量表')
  158. break;
  159. default:
  160. break;
  161. }
  162. }
  163. function bindTab() {
  164. $('.infoTabBox .infoTab').eq(showTab).addClass('activeTab').siblings().removeClass('activeTab')
  165. $('.informationBox').eq(showTab).siblings(".informationBox").css({"display":"none"})
  166. // if(showTab == '1') {
  167. // $('.infoTabBox .tipsTab').addClass('activeTab')
  168. // $('.infomationBox .treatRecommend').css("display","none")
  169. // } else {
  170. // $('.infoTabBox .treatTab').addClass('activeTab')
  171. // $('.infomationBox .tipsInfo').css("display","none")
  172. // $('.infomationBox .staticWin').css("display","none")
  173. // }
  174. $('.infomationBox .infoTab').click(function() {
  175. $(this).addClass('activeTab').siblings().removeClass('activeTab')
  176. $('.informationBox').css("display","none")
  177. const boxNode = $(this).attr('data-box')
  178. $('.'+boxNode).css("display","block")
  179. })
  180. }
  181. if(tipsNum > 1) {
  182. bindTab();
  183. }else if(tipsNum == 0){
  184. $('.push').css({
  185. "width":"95%",
  186. "border-right":"0 none"
  187. })
  188. $('.itemAllBox').css({"width":"98%"})
  189. }
  190. function moreInfo() {
  191. $('.moreInfo').click(function(){
  192. const name = $(this).attr('data-name')
  193. const type = $(this).attr('data-type')
  194. openNewWin(`information.html?type=${type}&position=0&name=${name}`)
  195. })
  196. }
  197. const pushHei = $('.push').height()
  198. if(pushHei == 0) {
  199. $('.infomationBox').css({"width":"90%"})
  200. }
  201. }).catch(function (err) {
  202. console.log(err);
  203. })
  204. }
  205. function getVersion() {
  206. post(config.getVersion, '').then((res) => {
  207. const data = res.data.data;
  208. const name = data.name;
  209. const ver = localStorage.getItem('versionTime-v');
  210. const time = data.refreshTime;
  211. if(!ver||ver===time+"=new"||time!==ver.replace("=new","")){ //判断版本是否更新
  212. $(".version").addClass('new-icon');
  213. localStorage.setItem('versionTime-v',time+"=new"); //保存版本更新时间
  214. }else{
  215. $(".version").removeClass('new-icon');
  216. }
  217. $(".version span").html(name);
  218. })
  219. }
  220. $(function(){
  221. getVersion();
  222. //打开版本信息
  223. $(".disclaimer .version").on("click",function() {
  224. const ver = localStorage.getItem('versionTime-v');
  225. $(".version").removeClass('new-icon');
  226. localStorage.setItem('versionTime-v',ver.replace("=new",""));
  227. openNewWin("version.html");
  228. });
  229. })