123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373 |
- 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, SHOW_TIPS_DETAILS, TOGGLE_CHRONIC_INFO, SET_MR_ANALYSE
- } from '@store/types/pushMessage';
- import { SET_DRUG_INFO, SHOW_DRUG_INFO } from '@store/types/treat';
- import { SET_CLICK_DIAG } from '../types/diagnosticList';
- import { storageLocal, getEMRParams, getMRInfo, getAllDataStringList, isAllClear } from '@utils/tools';
- import { getBigPush } from '@utils/utils';
- import { SET_IMPORT_CHECKBODY_LABEL, PRESET } from "../types/checkBody";
- import dataLis from '@components/EmergencyProcedure/emergency';
- import Notify from '@commonComp/Notify';
- import { pregetCheckbodyData } from '@store/async-actions/fetchModules';
- import { tabChange } from '@store/actions/tabTemplate';
- import store from '@store';
- import { SET_MR_INFO } from "../types/print";
- const api = {
- getTableList: '/scale/getList', //获取量表列表
- getTableInfo: '/scale/getContent', //获取量表明细
- getConceptDetail: '/conceptDetail/getConceptDetail', //获取静态提示信息
- getMRAnalyse: '/mrqc/analyse', //病历质控
- // setMrInfo:'/api/data/mrv2/createMr', //存页面信息,供页面推送模式调取
- setMrInfo: '/sys/mr/createMr', //存页面信息,供页面推送模式调取
- };
- export const embedPush = (obj) => { //内嵌页面推送时推送
- return (dispatch, getState) => {
- let state = getState()
- let { patInfo: { patInfoData } } = state
- // 2020/12/21 确保推送是 科室和年龄不为空
- let patientAge = patInfoData.find(item=>{
- return item.id === 'patientAge'
- })
- let hospitalDeptName = patInfoData.find(item=>{
- return item.id === 'hospitalDeptName'
- })
- if (patientAge && patientAge.value == '' ){
- Notify.info('年龄不能为空')
- return
- }
- if (hospitalDeptName && hospitalDeptName.value == '') {
- Notify.info('科室不能为空')
- return
- }
- // console.log(obj,'推送的obj');
- const param = getEMRParams(); // 获取推送参数
- // console.log(param,'=param');
- param.dept = [{name:param.deptName,uniqueName:param.hospitalId==-1?param.deptName:''}]
- param.deptName = undefined;
- json(api.setMrInfo, param, true).then((res) => {
- // console.log(res,'======推送的结果');
- const data = res.data;
- if (data.code === '0') {
- //存mrId
- let params = data;
- params.action = obj.action
- dispatch({
- type: SET_MR_INFO,
- data: params,
- isTcm:obj.isTcm //是否为中医触发
- });
- }
- });
- };
- };
- //获取右侧推送信息
- export const billing = (mdata, boxMark) => {
- return (dispatch, getState) => {
- const state = getState();
- const checkBody = state.checkBody.data;
- let diagMain = state.diagnosticList.diagnosticList.length > 0 && state.diagnosticList.diagnosticList[0]
- //let getCheck = boxMark==2&&!(checkBody&&checkBody.length>0&&!checkBody[0].full);
- const emrData = getEMRParams();
- //mdata为主诉无标签直接输入时的内容,symptom参数传主诉+现病史文本
- const mainData = mdata ? (emrData.current + mdata) : (emrData.current + emrData.main);
- const feaType = "42,5,6,7"; //41只返回查体模板,4只返回查体高亮
- getBigPush(feaType, mainData, true).then((data) => {
- let { dis, lab, pacs, vitalIds } = data.data.data || {};
- lab = lab || [];
- pacs = pacs || [];
- // console.log('推送数据', data.data.data);
- let vigilant = [], //警惕
- doubt = [], //疑似诊断
- possible = [], //可能诊断
- determine = [], //确诊
- setPushEmergency = {}, //急诊
- setPushEmergencyIdx = '',//急诊对应本地数据
- likely = [];//鉴别诊断
- doubt = dis && dis['拟诊'],
- possible = dis && dis['可能诊断'];
- vigilant = dis && dis['警惕'];
- determine = dis && dis['确诊']; //确诊
- likely = dis && dis['鉴别诊断'];
- //急诊显示规则,主诊断有急诊优先显示,没有则显示推送的,推送也没有就不显示
- console.log(dis)
- if (dis && dis['页面急诊'] && (dis['页面急诊'].length > 0) && (diagMain && dis['页面急诊'][0].conceptId == diagMain.conceptId)) {
- setPushEmergency = dis['页面急诊'][0]
- let name = dis['页面急诊'][0].name || ''
- for (let i = 0; i < dataLis.length; i++) {
- if (name == dataLis[i].emergencyillname) {
- setPushEmergencyIdx = i
- }
- }
- } else if (dis && dis['急诊'] && dis['急诊'].length > 0) {
- setPushEmergency = dis['急诊'][0]
- let name = dis['急诊'][0].name || ''
- for (let i = 0; i < dataLis.length; i++) {
- if (name == dataLis[i].emergencyillname) {
- setPushEmergencyIdx = i
- }
- }
- }
- 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: TOGGLE_CHRONIC_INFO,
- flag: false
- });
- dispatch({
- type: BILLING_ADVICE,
- determine: determine || [],
- doubt: doubt || [],
- possible: possible || [],
- vigilant: vigilant || [],
- likely: likely || [],
- lab: lab || [],
- pacs: pacs || [],
- setPushEmergency: setPushEmergency || [],
- setPushEmergencyIdx: setPushEmergencyIdx
- });
- //查体高亮标签
- dispatch({
- type: SET_IMPORT_CHECKBODY_LABEL,
- labels: vitalIds
- })
- }).catch((e) => {
- console.log(e)
- });
- //单独调指标
- getBigPush('22', mainData).then((data) => {
- let { medicalIndications } = data.data.data || {};
- //慢病推送模块数据
- dispatch({
- type: SET_CHRONIC_PUSHS,
- data: medicalIndications
- });
- }).catch((e) => {
- console.log(e)
- });
- }
- };
- //获取提示信息(静态信息)
- export const getConceptDetail = (item, noTips, noDetails, noNotify) => {
- return (dispatch, getState) => {
- const params = {
- name: item.name,
- position: item.position,
- type: item.type
- }
- if (item.position == '1') { //点击i要展示详情和提示信息
- params.position = 0
- }
- json(api.getConceptDetail, params).then((res) => {
- if (res.data.code == '0' && res.data.data.details && res.data.data.details.length > 0) {
- dispatch(tabChange(0)); //tab跳回推送
- if (item.position == '1') { //右侧提示信息
- dispatch({
- type: SET_CLICK_DIAG,
- clickDiag: item
- })
- if (item.type == '5' || item.type == '6' || item.type == '12') {
- dispatch({
- type: SET_TIPS,
- tips: res.data.data,
- tmpFlg: 'midPart',
- showPartName: item.showName
- })
- } else {
- dispatch({
- type: SET_TIPS,
- tips: res.data.data,
- });
- dispatch({
- type: TOGGLE_CHRONIC_INFO,
- flag: true
- });
- }
- //document.getElementById("tipsMsg").scrollIntoView(true)
- //点击i同时打开详情弹窗 点击诊断名称不打开弹窗
- //if(!noDetails) {
- dispatch({
- type: SET_TIPS_DETAILS,
- tipsDetails: res.data.data,
- showAllName: item.showName
- })
- dispatch({
- type: SHOW_TIPS_DETAILS
- })
- //}
- } else if (item.position == '5' || item.position == '6') { //药品或不良反应说明
- dispatch({
- type: SET_DRUG_INFO,
- instroduce: res.data.data.details,
- name: item.name,
- tagType: item.type
- })
- dispatch({
- type: SHOW_DRUG_INFO
- })
- }
- } else {
- if (!noNotify) {
- Notify.info('提示信息未维护')
- }
- }
- })
- }
- }
- export const getAllConceptDetail = (item) => {
- return (dispatch, getState) => {
- const state = getState();
- let params = {
- type: item.type,
- name: item.name,
- position: item.position
- };
- if (item.type == 5 || item.type == 51) {
- params.type = 12;
- params.position = 0;
- params.name = item.uname;
- }
- json(api.getConceptDetail, params)
- .then((res) => {
- if (res.data.code == '0') {
- //医学知识中打开弹窗,无详细内容显示未维护
- if (res.data.data && res.data.data.details.length > 0) {
- dispatch({
- type: SHOW_TIPS_DETAILS
- })
- } else {
- Notify.info('提示信息未维护');
- }
- dispatch({
- type: SET_TIPS_DETAILS,
- tipsDetails: res.data.data,
- showAllName: item.showName
- })
- } else {
- Notify.info('提示信息未维护');
- }
- }).catch((e) => {
- console.log(e)
- })
- }
- }
- // 量表列表
- export const getTableList = (name) => {
- return (dispatch, getState) => {
- json(api.getTableList, { disName: name })
- .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) => {
- return (dispatch, getState) => {
- const emrData = getEMRParams();
- const params = {
- featureType: "21",
- scaleId: it.conceptId,
- scaleName: it.name
- };
- json(api.getTableInfo, Object.assign({}, params, emrData))
- .then((res) => {
- const result = res.data;
- // if(result.code==0 && result.data.scale && result.data.scale.length>0){
- if (result.code == 0 && result.data.length > 0) {
- dispatch({
- type: SET_SCALE_INFO,
- name: it.name,
- data: result.data,
- id: it.conceptId
- })
- dispatch({
- type: SHOW_TABLE_LIST,
- name: 'showTable',
- value: true,
- item: Object.assign({}, it)
- })
- } else {
- Notify.info(result.msg || '暂无量表信息')
- }
- }).catch((e) => {
- console.log(e)
- })
- }
- }
- // 病历质控
- export const getMRAnalyse = () => { //第三种模式不调接口
- return (dispatch, getState) => { }
- /*let baseList = store.getState();
- let jsonStr = getAllDataStringList(baseList);
- let flg = isAllClear(jsonStr);
- if(flg) {
- return (dispatch, getState) => {
- const param = getMRInfo()
- json(api.getMRAnalyse, param)
- .then((res) =>{
- const data = res.data;
- if(data.code == '0') {
- dispatch({
- type: SET_MR_ANALYSE,
- MRAnalyseResult: data.data.warning
- })
- } else {
- dispatch({
- type: SET_MR_ANALYSE,
- MRAnalyseResult: []
- })
- }
-
- }).catch((e) => {
- console.log(e)
- })
- }
- } else {
- return (dispatch, getState) => {
- dispatch({
- type: SET_MR_ANALYSE,
- MRAnalyseResult: []
- })
- }
- }*/
- }
|