pushMessage.js 9.4 KB

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