pushMessage.js 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. import { get, post, json } from "@utils/ajax";
  2. import { BILLING_ADVICE, SET_TIPS, SET_TIPS_DETAILS ,SET_CHRONIC_TABLELIST,SET_SCALE_INFO,SET_CHRONIC_PUSHS,SHOW_TABLE_LIST} 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. import { Notify} from '@commonComp';
  7. const api={
  8. push:'/push/pushInner',
  9. textPush:'/push/pushText',
  10. getTableList:'/scale/getList', //获取量表列表
  11. }
  12. //获取右侧推送信息
  13. export const billing = (mdata) => {
  14. return (dispatch, getState) =>{
  15. const state = getState();
  16. let url = api.push;
  17. if(+state.typeConfig.typeConfig===1){
  18. url=api.textPush;
  19. }
  20. const emrData = getEMRParams();
  21. const params = {
  22. age: emrData.age,
  23. featureType: "4,5,6,7,22",
  24. // featureType: "22",
  25. diag: emrData.dis,
  26. lis: emrData.lis,
  27. other: emrData.other,
  28. pacs: emrData.pacs,
  29. sex: emrData.sex,
  30. vital:emrData.vital,
  31. symptom: mdata?(emrData.current + mdata):(emrData.current + emrData.main)
  32. };
  33. storageLocal.set('emrParam',params); //推送数据存储,用作推送前对比是否有变,有变才推送
  34. json(url, params).then((data) => {
  35. let {dis, lab, pacs,markedVitalIds,medicalIndications} = data.data.data||{};
  36. lab = lab||[];
  37. pacs = pacs||[];
  38. // console.log('推送数据', data.data.data);
  39. let vigilant=[], //警惕
  40. doubt=[], //疑似诊断
  41. possible = [], //可能诊断
  42. determine=[]; //确诊
  43. doubt = dis&&dis['疑似诊断'],
  44. possible = dis&&dis['可能诊断'];
  45. vigilant = dis&&dis['警惕'];
  46. determine = dis&&dis['确诊']; //确诊
  47. if(lab) {
  48. for(let i = 0; i < lab.length; i++) {
  49. lab[i].checked = false
  50. }
  51. }
  52. if(pacs) {
  53. for(let i = 0; i < pacs.length; i++) {
  54. pacs[i].checked = false
  55. }
  56. }
  57. dispatch({
  58. type: BILLING_ADVICE,
  59. determine: determine || [],
  60. doubt: doubt||[],
  61. possible: possible||[],
  62. vigilant: vigilant||[],
  63. lab: lab||[],
  64. pacs: pacs||[],
  65. });
  66. //慢病推送模块数据
  67. dispatch({
  68. type:SET_CHRONIC_PUSHS,
  69. data:medicalIndications
  70. });
  71. //查体高亮标签
  72. dispatch({
  73. type:SET_IMPORT_CHECKBODY_LABEL,
  74. labels:markedVitalIds
  75. })
  76. }).catch((e) =>{
  77. console.log(e)
  78. })
  79. }
  80. };
  81. export const getTips = (diagItem) =>{
  82. return (dispatch, getState) =>{
  83. dispatch({
  84. type: SET_CLICK_DIAG,
  85. clickDiag: diagItem
  86. })
  87. const url = '/introduceInfo/getByQuestionId';
  88. const params = {
  89. questionId: diagItem.id,
  90. type: diagItem.type,
  91. position: 1
  92. }
  93. json(url, params)
  94. .then((data)=>{
  95. dispatch({
  96. type: SET_TIPS,
  97. tips: data.data.data
  98. })
  99. }).catch((e) => {
  100. console.log(e)
  101. })
  102. }
  103. }
  104. export const getTipsDetails = () => {
  105. return(dispatch, getState) => {
  106. const state = getState();
  107. // 诊断指南新窗口展示
  108. // window.open(`/static/pages/information.html?type=7&&questionId=${state.diagnosticList.clickDiag.id}`);
  109. //弹窗显示
  110. const url ='/introduceInfo/getByQuestionId'
  111. const params = {
  112. type: state.diagnosticList.clickDiag.type,
  113. questionId: state.diagnosticList.clickDiag.id,
  114. position:2
  115. }
  116. json(url, params)
  117. .then((data)=>{
  118. dispatch({
  119. type: SET_TIPS_DETAILS,
  120. tipsDetails: data.data.data
  121. })
  122. }).catch((e) => {
  123. console.log(e)
  124. })
  125. }
  126. }
  127. // 量表列表
  128. export const getTableList = (id)=>{
  129. return (dispatch,getState)=>{
  130. json(api.getTableList, {disId:id})
  131. .then((res)=>{
  132. if(res.data.code==0 && res.data.data && res.data.data.length>0){
  133. dispatch({
  134. type: SET_CHRONIC_TABLELIST,
  135. data: res.data.data
  136. })
  137. dispatch({
  138. type:SHOW_TABLE_LIST,
  139. name:'showList',
  140. value:true
  141. })
  142. }else{
  143. Notify.info(res.data.msg||'无关联量表')
  144. }
  145. }).catch((e) => {
  146. console.log(e)
  147. })
  148. }
  149. }
  150. // 量表明细
  151. export const getScaleInfo = (it)=>{console.log('参数:',it)
  152. return (dispatch,getState)=>{
  153. const emrData = getEMRParams();
  154. const params = {
  155. age: emrData.age,
  156. featureType: "21",
  157. diag: emrData.dis,
  158. // lis: emrData.lis,
  159. lis: [],
  160. sex: emrData.sex,
  161. scaleId:it.id,
  162. scaleName:it.name
  163. };
  164. json(api.push, params)
  165. .then((res)=>{
  166. const result = res.data;
  167. if(result.code==0 && result.data.scale && result.data.scale.length>0){
  168. dispatch({
  169. type: SET_SCALE_INFO,
  170. data: result.data.scale,
  171. id:it.id
  172. })
  173. dispatch({
  174. type:SHOW_TABLE_LIST,
  175. name:'showTable',
  176. value:true
  177. })
  178. }else{
  179. Notify.info(result.msg||'暂无量表信息')
  180. }
  181. }).catch((e) => {
  182. console.log(e)
  183. })
  184. }
  185. }