pushMessage.js 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  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. import {pregetCheckbodyData} from '@store/async-actions/fetchModules';
  8. const api={
  9. push:'/push/pushInner',
  10. textPush:'/push/pushText',
  11. getTableList:'/scale/getList', //获取量表列表
  12. }
  13. //获取右侧推送信息
  14. export const billing = (mdata,boxMark) => {
  15. return (dispatch, getState) =>{
  16. const state = getState();
  17. let url = api.push;
  18. if(+state.typeConfig.typeConfig===1){
  19. url=api.textPush;
  20. }
  21. const emrData = getEMRParams();
  22. const params = {
  23. age: emrData.age,
  24. featureType: "5,6,7",
  25. // featureType: "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} = 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_IMPORT_CHECKBODY_LABEL,
  70. labels:markedVitalIds
  71. })
  72. }).catch((e) =>{
  73. console.log(e)
  74. });
  75. //单独调指标
  76. const ps = Object.assign({},params,{featureType:'22'});
  77. json(url, ps).then((data) => {
  78. let {medicalIndications} = data.data.data||{};
  79. //慢病推送模块数据
  80. dispatch({
  81. type:SET_CHRONIC_PUSHS,
  82. data:medicalIndications
  83. });
  84. }).catch((e) =>{
  85. console.log(e)
  86. });
  87. //调查体,现病史触发推送且查体无数据时获取查体模板
  88. const checkBody = state.checkBody.data;
  89. if(boxMark==2&&!(checkBody&&checkBody.length>0&&!checkBody[0].full)){
  90. dispatch(pregetCheckbodyData());
  91. }
  92. }
  93. };
  94. export const getTips = (diagItem) =>{
  95. return (dispatch, getState) =>{
  96. dispatch({
  97. type: SET_CLICK_DIAG,
  98. clickDiag: diagItem
  99. })
  100. const url = '/introduceInfo/getByQuestionId';
  101. const params = {
  102. questionId: diagItem.id,
  103. type: diagItem.type,
  104. position: 1
  105. }
  106. json(url, params)
  107. .then((data)=>{
  108. dispatch({
  109. type: SET_TIPS,
  110. tips: data.data.data
  111. })
  112. }).catch((e) => {
  113. console.log(e)
  114. })
  115. }
  116. }
  117. export const getTipsDetails = () => {
  118. return(dispatch, getState) => {
  119. const state = getState();
  120. // 诊断指南新窗口展示
  121. // window.open(`/static/pages/information.html?type=7&&questionId=${state.diagnosticList.clickDiag.id}`);
  122. //弹窗显示
  123. const url ='/introduceInfo/getByQuestionId'
  124. const params = {
  125. type: state.diagnosticList.clickDiag.type,
  126. questionId: state.diagnosticList.clickDiag.id,
  127. position:2
  128. }
  129. json(url, params)
  130. .then((data)=>{
  131. dispatch({
  132. type: SET_TIPS_DETAILS,
  133. tipsDetails: data.data.data
  134. })
  135. }).catch((e) => {
  136. console.log(e)
  137. })
  138. }
  139. }
  140. // 量表列表
  141. export const getTableList = (id)=>{
  142. return (dispatch,getState)=>{
  143. json(api.getTableList, {disId:id})
  144. .then((res)=>{
  145. if(res.data.code==0 && res.data.data && res.data.data.length>0){
  146. dispatch({
  147. type: SET_CHRONIC_TABLELIST,
  148. data: res.data.data
  149. })
  150. dispatch({
  151. type:SHOW_TABLE_LIST,
  152. name:'showList',
  153. value:true
  154. })
  155. }else{
  156. Notify.info(res.data.msg||'无关联量表')
  157. }
  158. }).catch((e) => {
  159. console.log(e)
  160. })
  161. }
  162. }
  163. // 量表明细
  164. export const getScaleInfo = (it)=>{
  165. return (dispatch,getState)=>{
  166. const emrData = getEMRParams();
  167. const params = {
  168. age: emrData.age,
  169. sex: emrData.sex,
  170. featureType: "21",
  171. diag: emrData.dis,
  172. lis: emrData.lis,
  173. scaleId:it.id,
  174. scaleName:it.name,
  175. other: emrData.other,
  176. pacs: emrData.pacs,
  177. vital:emrData.vital,
  178. symptom: emrData.current + emrData.main,
  179. // indications:'' //指标结果
  180. };
  181. json(api.push, params)
  182. .then((res)=>{
  183. const result = res.data;
  184. if(result.code==0 && result.data.scale && result.data.scale.length>0){
  185. dispatch({
  186. type: SET_SCALE_INFO,
  187. data: result.data.scale,
  188. id:it.id
  189. })
  190. dispatch({
  191. type:SHOW_TABLE_LIST,
  192. name:'showTable',
  193. value:true,
  194. item:Object.assign({},it)
  195. })
  196. }else{
  197. Notify.info(result.msg||'暂无量表信息')
  198. }
  199. }).catch((e) => {
  200. console.log(e)
  201. })
  202. }
  203. }