pushMessage.js 5.5 KB

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