pushMessage.js 3.4 KB

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