pushMessage.js 10 KB

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