pushMessage.js 12 KB

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