pushMessage.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. import { get, post, json } from "@utils/ajax";
  2. import { BILLING_ADVICE, SET_TIPS, SET_TIPS_DETAILS ,SET_CHRONIC_TABLELIST,SET_CHRONIC_PUSHS} from '../types/pushMessage';
  3. import { SET_CLICK_DIAG } from '../types/diagnosticList';
  4. import {storageLocal,getEMRParams} from '@utils/tools';
  5. import {SET_IMPORT_CHECKBODY_LABEL} from "../types/checkBody";
  6. const api={
  7. push:'/push/pushInner',
  8. textPush:'/push/pushText',
  9. getTableList:'/scale/getList' //获取量表列表
  10. }
  11. //获取右侧推送信息
  12. export const billing = (mdata) => {
  13. return (dispatch, getState) =>{
  14. const state = getState();
  15. let url = api.push;
  16. if(+state.typeConfig.typeConfig===1){
  17. url=api.textPush;
  18. }
  19. const emrData = getEMRParams();
  20. const params = {
  21. age: emrData.age,
  22. featureType: "4,5,6,7,22",
  23. diag: emrData.dis,
  24. lis: emrData.lis,
  25. other: emrData.other,
  26. pacs: emrData.pacs,
  27. sex: emrData.sex,
  28. vital:emrData.vital,
  29. symptom: mdata?(emrData.current + mdata):(emrData.current + emrData.main)
  30. };
  31. storageLocal.set('emrParam',params); //推送数据存储,用作推送前对比是否有变,有变才推送
  32. json(url, params).then((data) => {
  33. let {dis, lab, pacs,markedVitalIds,medicalIndications} = data.data.data||{};
  34. lab = lab||[];
  35. pacs = pacs||[];
  36. // console.log('推送数据', data.data.data);
  37. let vigilant=[], //警惕
  38. doubt=[], //疑似诊断
  39. possible = [], //可能诊断
  40. determine=[]; //确诊
  41. doubt = dis&&dis['疑似诊断'],
  42. possible = dis&&dis['可能诊断'];
  43. vigilant = dis&&dis['警惕'];
  44. determine = dis&&dis['确诊']; //确诊
  45. if(lab) {
  46. for(let i = 0; i < lab.length; i++) {
  47. lab[i].checked = false
  48. }
  49. }
  50. if(pacs) {
  51. for(let i = 0; i < pacs.length; i++) {
  52. pacs[i].checked = false
  53. }
  54. }
  55. dispatch({
  56. type: BILLING_ADVICE,
  57. determine: determine || [],
  58. doubt: doubt||[],
  59. possible: possible||[],
  60. vigilant: vigilant||[],
  61. lab: lab||[],
  62. pacs: pacs||[],
  63. });
  64. //慢病推送模块数据
  65. dispatch({
  66. type:SET_CHRONIC_PUSHS,
  67. data:medicalIndications
  68. });
  69. //查体高亮标签
  70. dispatch({
  71. type:SET_IMPORT_CHECKBODY_LABEL,
  72. labels:markedVitalIds
  73. })
  74. }).catch((e) =>{
  75. console.log(e)
  76. })
  77. }
  78. };
  79. export const getTips = (diagItem) =>{
  80. return (dispatch, getState) =>{
  81. dispatch({
  82. type: SET_CLICK_DIAG,
  83. clickDiag: diagItem
  84. })
  85. const url = '/introduceInfo/getByQuestionId';
  86. const params = {
  87. questionId: diagItem.id,
  88. type: 7,
  89. position: 1
  90. }
  91. json(url, params)
  92. .then((data)=>{
  93. dispatch({
  94. type: SET_TIPS,
  95. tips: data.data.data
  96. })
  97. }).catch((e) => {
  98. console.log(e)
  99. })
  100. }
  101. }
  102. export const getTipsDetails = () => {
  103. return(dispatch, getState) => {
  104. const state = getState();
  105. // 诊断指南新窗口展示
  106. // window.open(`/static/pages/information.html?type=7&&questionId=${state.diagnosticList.clickDiag.id}`);
  107. //弹窗显示
  108. const url ='/introduceInfo/getByQuestionId'
  109. const params = {
  110. type: 7,
  111. questionId: state.diagnosticList.clickDiag.id,
  112. position:2
  113. }
  114. json(url, params)
  115. .then((data)=>{
  116. dispatch({
  117. type: SET_TIPS_DETAILS,
  118. tipsDetails: data.data.data
  119. })
  120. }).catch((e) => {
  121. console.log(e)
  122. })
  123. }
  124. }
  125. export const getTableList = (id)=>{
  126. return (dispatch,getState)=>{
  127. json(api.getTableList, {disId:id})
  128. .then((res)=>{
  129. if(res.data.code==0){
  130. dispatch({
  131. type: SET_CHRONIC_TABLELIST,
  132. data: res.data.data
  133. })
  134. }
  135. }).catch((e) => {
  136. console.log(e)
  137. })
  138. }
  139. }