123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- import {json} from '@utils/ajax.js';
- import {SET} from '@types/checkBody.js';
- import {fullfillText,_fullfillText} from '@common/js/func';
- import {SETDATA} from '@store/types/otherHistory';
- import store from '@store';
- import {getEMRParams} from '@utils/tools.js';
- import {Notify} from '@commonComp';
- import {SETOTHERHISTORY} from "../types/homePage";
- import config from "@config/index";
- const api={
- getSpreadModule:'/api/icss/questionInfo/getByIds',
- getModule:'/api/icss/questionInfo/getById',
- searchURL: '/api/icss/retrieval/getTagInfos',
- getOtherHisRecord: '/api/icss/inquiryInfo/getLastOther',
- getBigPush:'/api/icss/push/pushInner',
- saveMode:'/api/icss/doctorPageMode/saveDoctorPageModes',
- };
- //获取模板,多个
- export const getModules = (ids)=>{
- const {patInfo} = store.getState();
- const param = {
- "age": patInfo.message.patientAge,
- "ids": ids,
- "sexType": patInfo.message.sex
- };
- const modules = json(api.getSpreadModule,param);
- return modules;
- };
- //获取单个模板
- export const getModule = (id)=>{
- const {patInfo} = store.getState();
- const param = {
- "age": patInfo.message.patientAge,
- "id": id,
- "sexType": patInfo.message.sex
- };
- return json(api.getModule,param);
- };
- //搜索接口
- export const getSearch = (param)=>{
- const {patInfo} = store.getState();
- const {inpStr,boxMark,mainIds} = param;
- const params = {
- "age": patInfo.message.patientAge,
- "inputIds":mainIds&&mainIds.length>0?mainIds:[],//主诉去重
- // "inputStr": inpStr.trim(),
- "inputStr": inpStr,
- "sexType": patInfo.message.sex,
- "type": boxMark //1为搜症状
- };
- return json(api.searchURL,params);
- };
- //其他史最近记录获取
- export const getOtherHisRecord = ()=>{
- return (dispatch,getStore)=>{
- const state = getStore();
- const {message} =state.patInfo;
- const mode = state.typeConfig.typeConfig;
- const param = {
- hospitalCode:message.hospitalCode,
- patientCode:message.patientCode,
- sign:mode
- };
- json(api.getOtherHisRecord,param).then((res)=>{
- if(res.data.code=='0'){
- const data = res.data.data;
- const obj = JSON.parse(data.dataJson||'{}');
- const objStr = JSON.parse(data.otherStr||'[]');
- let arr = [];
- if((!obj||!obj.other||obj.other.length==0)&&!objStr[0]){ //无其他史历史记录用默认模板
- //console.log('其他史最近数据无')
- //arr = state.homePage.initData.otherHis;
- }else{
- arr = obj.other;
- dispatch({
- type:SETOTHERHISTORY,
- data:arr,
- save:objStr
- });
- }
- }
- });
- }
- };
- //查体模板数据获取
- export function getInitData(){
- return (dispatch)=>{
- const emrData = getEMRParams();
- const param = {
- age: emrData.age,
- featureType: "1,4,7",
- diag: emrData.dis,
- lis: emrData.lis,
- other: emrData.other,
- pacs: emrData.pacs,
- sex: emrData.sex,
- vital:emrData.vital,
- symptom: emrData.current||emrData.main
- };
- json(api.getBigPush,param).then((res)=>{
- if(+res.data.code === 0){
- const data = res.data.data&&res.data.data.vital;
- const str = JSON.stringify(data);
- const arr = fullfillText(JSON.parse(str),false,false,false).newArr;
- dispatch({
- type:SET,
- data:[...arr],
- isEmpty:false
- });
- }else{
- const block = Object.assign(JSON.parse(config.textLabel),{full:true}); //无数据时保留一个自由文本标签可输入
- dispatch({
- type:SET,
- data:[block],
- isEmpty:false
- });
- Notify.error(res.data.msg);
- }
- });
- }
- }
- //保存切换模式
- export function saveMode(mode){
- return (dispatch,getStore)=>{
- const {patInfo} = getStore();
- const param = {
- doctorId:patInfo.message.doctorId,
- modeClassify:0,
- modeValue:mode
- };
- return json(api.saveMode,param);
- }
- }
|