pushMessage.js 7.9 KB

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