pushMessage.js 7.0 KB

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