123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- import axios from '@utils/ajax';
- import store from '@store';
- import { searchList,resetLabel } from '../actions/newAdvice';
- import { Notify } from '@commonComp';
- export const getSearchList = (val) => {
- if(val.trim() == ''){
- const data = [];
- return (dispatch) => dispatch(searchList(data,''));
- }
- let baseList = store.getState();
- let type = baseList.newAdvice.shType;
- return (dispatch) => {
- axios.json('/demo/retrieval/index',{
- "age": 10,
- "inputStr": val,
- "sex": 1,
- "type": type
- })
- .then((res)=>{
- if(res.data.code==0){
- const data = res.data.data;let curDate=[];
- //药:阿替乐尔;手术:髂动脉造影
- let arr = type==5?data.drugNames:data.operationNames,tmp=[];
- for(let i = 0;i < arr.length;i++){
- let obj = {}
- obj['uniqueName'] = arr[i].name;
- obj['name'] = arr[i].name;
- obj['flg'] = type;
- tmp.push(obj)
- }
- curDate=tmp
- dispatch(searchList(curDate,val.trim()));
- }else{
- Notify.success(res.data.msg)
- }
- })
- }
- };
- export const getSublableList = (id,idx) => {//getById
- let baseList = store.getState();
- let sex = baseList.patInfo.message.patientSex;
- return (dispatch) => {
- axios.json('/questionInfo/getById',{
- age:baseList.patInfo.message.patientAge,
- sexType:sex == '男'?'1' : sex == '女'?'2':'3',
- id: id
- })
- .then((res)=>{
- const data = res.data.data;
- if (data.controlType == 0) {
- dispatch(resetLabel(data.questionMapping,data.uniqueName||''));
- }else if(data.controlType == 1||data.controlType == 6){
- let arr = [];
- arr[0] = data;
- dispatch(resetLabel(arr));
- }
- })
- }
- };
|