123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194 |
- import { get, post, json } from "@utils/ajax";
- import { BILLING_ADVICE, SET_TIPS, SET_TIPS_DETAILS ,SET_CHRONIC_TABLELIST,SET_SCALE_INFO,SET_CHRONIC_PUSHS,SHOW_TABLE_LIST} from '../types/pushMessage';
- import { SET_CLICK_DIAG } from '../types/diagnosticList';
- import {storageLocal,getEMRParams} from '@utils/tools';
- import {SET_IMPORT_CHECKBODY_LABEL} from "../types/checkBody";
- import { Notify} from '@commonComp';
- const api={
- push:'/push/pushInner',
- textPush:'/push/pushText',
- getTableList:'/scale/getList', //获取量表列表
- }
- //获取右侧推送信息
- export const billing = (mdata) => {
- return (dispatch, getState) =>{
- const state = getState();
- let url = api.push;
- if(+state.typeConfig.typeConfig===1){
- url=api.textPush;
- }
- const emrData = getEMRParams();
- const params = {
- age: emrData.age,
- featureType: "4,5,6,7,22",
- // featureType: "22",
- diag: emrData.dis,
- lis: emrData.lis,
- other: emrData.other,
- pacs: emrData.pacs,
- sex: emrData.sex,
- vital:emrData.vital,
- symptom: mdata?(emrData.current + mdata):(emrData.current + emrData.main)
- };
- storageLocal.set('emrParam',params); //推送数据存储,用作推送前对比是否有变,有变才推送
- json(url, params).then((data) => {
- let {dis, lab, pacs,markedVitalIds,medicalIndications} = data.data.data||{};
- lab = lab||[];
- pacs = pacs||[];
- // console.log('推送数据', data.data.data);
- let vigilant=[], //警惕
- doubt=[], //疑似诊断
- possible = [], //可能诊断
- determine=[]; //确诊
- doubt = dis&&dis['疑似诊断'],
- possible = dis&&dis['可能诊断'];
- vigilant = dis&&dis['警惕'];
- determine = dis&&dis['确诊']; //确诊
- if(lab) {
- for(let i = 0; i < lab.length; i++) {
- lab[i].checked = false
- }
- }
- if(pacs) {
- for(let i = 0; i < pacs.length; i++) {
- pacs[i].checked = false
- }
- }
- dispatch({
- type: BILLING_ADVICE,
- determine: determine || [],
- doubt: doubt||[],
- possible: possible||[],
- vigilant: vigilant||[],
- lab: lab||[],
- pacs: pacs||[],
- });
- //慢病推送模块数据
- dispatch({
- type:SET_CHRONIC_PUSHS,
- data:medicalIndications
- });
- //查体高亮标签
- dispatch({
- type:SET_IMPORT_CHECKBODY_LABEL,
- labels:markedVitalIds
- })
- }).catch((e) =>{
- console.log(e)
- })
- }
- };
- export const getTips = (diagItem) =>{
- return (dispatch, getState) =>{
- dispatch({
- type: SET_CLICK_DIAG,
- clickDiag: diagItem
- })
- const url = '/introduceInfo/getByQuestionId';
- const params = {
- questionId: diagItem.id,
- type: diagItem.type,
- position: 1
- }
- json(url, params)
- .then((data)=>{
- dispatch({
- type: SET_TIPS,
- tips: data.data.data
- })
- }).catch((e) => {
- console.log(e)
- })
- }
- }
- export const getTipsDetails = () => {
- return(dispatch, getState) => {
- const state = getState();
- // 诊断指南新窗口展示
- // window.open(`/static/pages/information.html?type=7&&questionId=${state.diagnosticList.clickDiag.id}`);
- //弹窗显示
- const url ='/introduceInfo/getByQuestionId'
- const params = {
- type: state.diagnosticList.clickDiag.type,
- questionId: state.diagnosticList.clickDiag.id,
- position:2
- }
- json(url, params)
- .then((data)=>{
- dispatch({
- type: SET_TIPS_DETAILS,
- tipsDetails: data.data.data
- })
- }).catch((e) => {
- console.log(e)
- })
- }
- }
- // 量表列表
- export const getTableList = (id)=>{
- return (dispatch,getState)=>{
- json(api.getTableList, {disId:id})
- .then((res)=>{
- if(res.data.code==0 && res.data.data && res.data.data.length>0){
- dispatch({
- type: SET_CHRONIC_TABLELIST,
- data: res.data.data
- })
- dispatch({
- type:SHOW_TABLE_LIST,
- name:'showList',
- value:true
- })
- }else{
- Notify.info(res.data.msg||'无关联量表')
- }
- }).catch((e) => {
- console.log(e)
- })
- }
- }
- // 量表明细
- export const getScaleInfo = (it)=>{console.log('参数:',it)
- return (dispatch,getState)=>{
- const emrData = getEMRParams();
- const params = {
- age: emrData.age,
- featureType: "21",
- diag: emrData.dis,
- // lis: emrData.lis,
- lis: [],
- sex: emrData.sex,
- scaleId:it.id,
- scaleName:it.name
- };
- json(api.push, params)
- .then((res)=>{
- const result = res.data;
- if(result.code==0 && result.data.scale && result.data.scale.length>0){
- dispatch({
- type: SET_SCALE_INFO,
- data: result.data.scale,
- id:it.id
- })
- dispatch({
- type:SHOW_TABLE_LIST,
- name:'showTable',
- value:true
- })
- }else{
- Notify.info(result.msg||'暂无量表信息')
- }
- }).catch((e) => {
- console.log(e)
- })
- }
- }
|