pushMessage.js 11 KB

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