pushMessage.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  1. import { get, post, json } from "@utils/ajax";
  2. import {
  3. BILLING_ADVICE, SET_TIPS, SET_TIPS_DETAILS, SET_CHRONIC_TABLELIST, SET_SCALE_INFO,
  4. SET_CHRONIC_PUSHS, SHOW_TABLE_LIST, SHOW_TIPS_DETAILS, TOGGLE_CHRONIC_INFO, SET_MR_ANALYSE
  5. } from '@store/types/pushMessage';
  6. import { SET_DRUG_INFO, SHOW_DRUG_INFO } from '@store/types/treat';
  7. import { SET_CLICK_DIAG } from '../types/diagnosticList';
  8. import { storageLocal, getEMRParams, getMRInfo, getAllDataStringList, isAllClear } from '@utils/tools';
  9. import { getBigPush } from '@utils/utils';
  10. import { SET_IMPORT_CHECKBODY_LABEL, PRESET } from "../types/checkBody";
  11. import dataLis from '@components/EmergencyProcedure/emergency';
  12. import Notify from '@commonComp/Notify';
  13. import { pregetCheckbodyData } from '@store/async-actions/fetchModules';
  14. import { tabChange } from '@store/actions/tabTemplate';
  15. import store from '@store';
  16. import { SET_MR_INFO } from "../types/print";
  17. const api = {
  18. getTableList: '/scale/getList', //获取量表列表
  19. getTableInfo: '/scale/getContent', //获取量表明细
  20. getConceptDetail: '/conceptDetail/getConceptDetail', //获取静态提示信息
  21. getMRAnalyse: '/mrqc/analyse', //病历质控
  22. // setMrInfo:'/api/data/mrv2/createMr', //存页面信息,供页面推送模式调取
  23. setMrInfo: '/sys/mr/createMr', //存页面信息,供页面推送模式调取
  24. };
  25. export const embedPush = (obj) => { //内嵌页面推送时推送
  26. return (dispatch, getState) => {
  27. let state = getState()
  28. let { patInfo: { patInfoData } } = state
  29. // 2020/12/21 确保推送是 科室和年龄不为空
  30. let patientAge = patInfoData.find(item=>{
  31. return item.id === 'patientAge'
  32. })
  33. let hospitalDeptName = patInfoData.find(item=>{
  34. return item.id === 'hospitalDeptName'
  35. })
  36. if (patientAge && patientAge.value == '' ){
  37. Notify.info('年龄不能为空')
  38. return
  39. }
  40. if (hospitalDeptName && hospitalDeptName.value == '') {
  41. Notify.info('科室不能为空')
  42. return
  43. }
  44. // console.log(obj,'推送的obj');
  45. const param = getEMRParams(); // 获取推送参数
  46. // console.log(param,'=param');
  47. param.dept = [{name:param.deptName,uniqueName:param.hospitalId==-1?param.deptName:''}]
  48. param.deptName = undefined;
  49. json(api.setMrInfo, param, true).then((res) => {
  50. // console.log(res,'======推送的结果');
  51. const data = res.data;
  52. if (data.code === '0') {
  53. //存mrId
  54. let params = data;
  55. params.action = obj.action
  56. dispatch({
  57. type: SET_MR_INFO,
  58. data: params,
  59. isTcm:obj.isTcm //是否为中医触发
  60. });
  61. }
  62. });
  63. };
  64. };
  65. //获取右侧推送信息
  66. export const billing = (mdata, boxMark) => {
  67. return (dispatch, getState) => {
  68. const state = getState();
  69. const checkBody = state.checkBody.data;
  70. let diagMain = state.diagnosticList.diagnosticList.length > 0 && state.diagnosticList.diagnosticList[0]
  71. //let getCheck = boxMark==2&&!(checkBody&&checkBody.length>0&&!checkBody[0].full);
  72. const emrData = getEMRParams();
  73. //mdata为主诉无标签直接输入时的内容,symptom参数传主诉+现病史文本
  74. const mainData = mdata ? (emrData.current + mdata) : (emrData.current + emrData.main);
  75. const feaType = "42,5,6,7"; //41只返回查体模板,4只返回查体高亮
  76. getBigPush(feaType, mainData, true).then((data) => {
  77. let { dis, lab, pacs, vitalIds } = data.data.data || {};
  78. lab = lab || [];
  79. pacs = pacs || [];
  80. // console.log('推送数据', data.data.data);
  81. let vigilant = [], //警惕
  82. doubt = [], //疑似诊断
  83. possible = [], //可能诊断
  84. determine = [], //确诊
  85. setPushEmergency = {}, //急诊
  86. setPushEmergencyIdx = '',//急诊对应本地数据
  87. likely = [];//鉴别诊断
  88. doubt = dis && dis['拟诊'],
  89. possible = dis && dis['可能诊断'];
  90. vigilant = dis && dis['警惕'];
  91. determine = dis && dis['确诊']; //确诊
  92. likely = dis && dis['鉴别诊断'];
  93. //急诊显示规则,主诊断有急诊优先显示,没有则显示推送的,推送也没有就不显示
  94. console.log(dis)
  95. if (dis && dis['页面急诊'] && (dis['页面急诊'].length > 0) && (diagMain && dis['页面急诊'][0].conceptId == diagMain.conceptId)) {
  96. setPushEmergency = dis['页面急诊'][0]
  97. let name = dis['页面急诊'][0].name || ''
  98. for (let i = 0; i < dataLis.length; i++) {
  99. if (name == dataLis[i].emergencyillname) {
  100. setPushEmergencyIdx = i
  101. }
  102. }
  103. } else if (dis && dis['急诊'] && dis['急诊'].length > 0) {
  104. setPushEmergency = dis['急诊'][0]
  105. let name = dis['急诊'][0].name || ''
  106. for (let i = 0; i < dataLis.length; i++) {
  107. if (name == dataLis[i].emergencyillname) {
  108. setPushEmergencyIdx = i
  109. }
  110. }
  111. }
  112. if (lab) {
  113. for (let i = 0; i < lab.length; i++) {
  114. lab[i].checked = false
  115. }
  116. }
  117. if (pacs) {
  118. for (let i = 0; i < pacs.length; i++) {
  119. pacs[i].checked = false
  120. }
  121. }
  122. dispatch({
  123. type: TOGGLE_CHRONIC_INFO,
  124. flag: false
  125. });
  126. dispatch({
  127. type: BILLING_ADVICE,
  128. determine: determine || [],
  129. doubt: doubt || [],
  130. possible: possible || [],
  131. vigilant: vigilant || [],
  132. likely: likely || [],
  133. lab: lab || [],
  134. pacs: pacs || [],
  135. setPushEmergency: setPushEmergency || [],
  136. setPushEmergencyIdx: setPushEmergencyIdx
  137. });
  138. //查体高亮标签
  139. dispatch({
  140. type: SET_IMPORT_CHECKBODY_LABEL,
  141. labels: vitalIds
  142. })
  143. }).catch((e) => {
  144. console.log(e)
  145. });
  146. //单独调指标
  147. getBigPush('22', mainData).then((data) => {
  148. let { medicalIndications } = data.data.data || {};
  149. //慢病推送模块数据
  150. dispatch({
  151. type: SET_CHRONIC_PUSHS,
  152. data: medicalIndications
  153. });
  154. }).catch((e) => {
  155. console.log(e)
  156. });
  157. }
  158. };
  159. //获取提示信息(静态信息)
  160. export const getConceptDetail = (item, noTips, noDetails, noNotify) => {
  161. return (dispatch, getState) => {
  162. const params = {
  163. name: item.name,
  164. position: item.position,
  165. type: item.type
  166. }
  167. if (item.position == '1') { //点击i要展示详情和提示信息
  168. params.position = 0
  169. }
  170. json(api.getConceptDetail, params).then((res) => {
  171. if (res.data.code == '0' && res.data.data.details && res.data.data.details.length > 0) {
  172. dispatch(tabChange(0)); //tab跳回推送
  173. if (item.position == '1') { //右侧提示信息
  174. dispatch({
  175. type: SET_CLICK_DIAG,
  176. clickDiag: item
  177. })
  178. if (item.type == '5' || item.type == '6' || item.type == '12') {
  179. dispatch({
  180. type: SET_TIPS,
  181. tips: res.data.data,
  182. tmpFlg: 'midPart',
  183. showPartName: item.showName
  184. })
  185. } else {
  186. dispatch({
  187. type: SET_TIPS,
  188. tips: res.data.data,
  189. });
  190. dispatch({
  191. type: TOGGLE_CHRONIC_INFO,
  192. flag: true
  193. });
  194. }
  195. //document.getElementById("tipsMsg").scrollIntoView(true)
  196. //点击i同时打开详情弹窗 点击诊断名称不打开弹窗
  197. //if(!noDetails) {
  198. dispatch({
  199. type: SET_TIPS_DETAILS,
  200. tipsDetails: res.data.data,
  201. showAllName: item.showName
  202. })
  203. dispatch({
  204. type: SHOW_TIPS_DETAILS
  205. })
  206. //}
  207. } else if (item.position == '5' || item.position == '6') { //药品或不良反应说明
  208. dispatch({
  209. type: SET_DRUG_INFO,
  210. instroduce: res.data.data.details,
  211. name: item.name,
  212. tagType: item.type
  213. })
  214. dispatch({
  215. type: SHOW_DRUG_INFO
  216. })
  217. }
  218. } else {
  219. if (!noNotify) {
  220. Notify.info('提示信息未维护')
  221. }
  222. }
  223. })
  224. }
  225. }
  226. export const getAllConceptDetail = (item) => {
  227. return (dispatch, getState) => {
  228. const state = getState();
  229. let params = {
  230. type: item.type,
  231. name: item.name,
  232. position: item.position
  233. };
  234. if (item.type == 5 || item.type == 51) {
  235. params.type = 12;
  236. params.position = 0;
  237. params.name = item.uname;
  238. }
  239. json(api.getConceptDetail, params)
  240. .then((res) => {
  241. if (res.data.code == '0') {
  242. //医学知识中打开弹窗,无详细内容显示未维护
  243. if (res.data.data && res.data.data.details.length > 0) {
  244. dispatch({
  245. type: SHOW_TIPS_DETAILS
  246. })
  247. } else {
  248. Notify.info('提示信息未维护');
  249. }
  250. dispatch({
  251. type: SET_TIPS_DETAILS,
  252. tipsDetails: res.data.data,
  253. showAllName: item.showName
  254. })
  255. } else {
  256. Notify.info('提示信息未维护');
  257. }
  258. }).catch((e) => {
  259. console.log(e)
  260. })
  261. }
  262. }
  263. // 量表列表
  264. export const getTableList = (name) => {
  265. return (dispatch, getState) => {
  266. json(api.getTableList, { disName: name })
  267. .then((res) => {
  268. if (res.data.code == 0 && res.data.data && res.data.data.length > 0) {
  269. dispatch({
  270. type: SET_CHRONIC_TABLELIST,
  271. data: res.data.data
  272. })
  273. dispatch({
  274. type: SHOW_TABLE_LIST,
  275. name: 'showList',
  276. value: true
  277. })
  278. } else {
  279. Notify.info(res.data.msg || '无关联量表')
  280. }
  281. }).catch((e) => {
  282. console.log(e)
  283. })
  284. }
  285. }
  286. // 量表明细
  287. export const getScaleInfo = (it) => {
  288. return (dispatch, getState) => {
  289. const emrData = getEMRParams();
  290. const params = {
  291. featureType: "21",
  292. scaleId: it.conceptId,
  293. scaleName: it.name
  294. };
  295. json(api.getTableInfo, Object.assign({}, params, emrData))
  296. .then((res) => {
  297. const result = res.data;
  298. // if(result.code==0 && result.data.scale && result.data.scale.length>0){
  299. if (result.code == 0 && result.data.length > 0) {
  300. dispatch({
  301. type: SET_SCALE_INFO,
  302. name: it.name,
  303. data: result.data,
  304. id: it.conceptId
  305. })
  306. dispatch({
  307. type: SHOW_TABLE_LIST,
  308. name: 'showTable',
  309. value: true,
  310. item: Object.assign({}, it)
  311. })
  312. } else {
  313. Notify.info(result.msg || '暂无量表信息')
  314. }
  315. }).catch((e) => {
  316. console.log(e)
  317. })
  318. }
  319. }
  320. // 病历质控
  321. export const getMRAnalyse = () => { //第三种模式不调接口
  322. return (dispatch, getState) => { }
  323. /*let baseList = store.getState();
  324. let jsonStr = getAllDataStringList(baseList);
  325. let flg = isAllClear(jsonStr);
  326. if(flg) {
  327. return (dispatch, getState) => {
  328. const param = getMRInfo()
  329. json(api.getMRAnalyse, param)
  330. .then((res) =>{
  331. const data = res.data;
  332. if(data.code == '0') {
  333. dispatch({
  334. type: SET_MR_ANALYSE,
  335. MRAnalyseResult: data.data.warning
  336. })
  337. } else {
  338. dispatch({
  339. type: SET_MR_ANALYSE,
  340. MRAnalyseResult: []
  341. })
  342. }
  343. }).catch((e) => {
  344. console.log(e)
  345. })
  346. }
  347. } else {
  348. return (dispatch, getState) => {
  349. dispatch({
  350. type: SET_MR_ANALYSE,
  351. MRAnalyseResult: []
  352. })
  353. }
  354. }*/
  355. }