inspect.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import axios from '@utils/ajax';
  2. import store from '@store';
  3. import { searchList,resetLabel } from '../actions/inspect';
  4. export const getSearchList = (val) => {
  5. if(val.trim() == ''){
  6. const data = [];
  7. return (dispatch) => dispatch(searchList(data));
  8. }
  9. let baseList = store.getState();
  10. let sex = baseList.patInfo.message.patientSex;
  11. return (dispatch) => {
  12. axios.json('/api/icss/retrieval/getTagInfos',{
  13. type:'5',
  14. age:baseList.patInfo.message.patientAge,
  15. inputStr:val,
  16. sexType:sex == '男'?'1' : sex == '女'?'2':'3'
  17. })
  18. .then((res)=>{
  19. const data = res.data.data;
  20. dispatch(searchList(data));
  21. })
  22. }
  23. };
  24. export const getSublableList = (id,idx) => {
  25. let baseList = store.getState();
  26. let sex = baseList.patInfo.message.patientSex;
  27. return (dispatch) => {
  28. axios.json('/api/icss/questionInfo/getById',{
  29. age:baseList.patInfo.message.patientAge,
  30. sexType:sex == '男'?'1' : sex == '女'?'2':'3',
  31. id: id
  32. })
  33. .then((res)=>{
  34. const data = res.data.data;
  35. if (data.controlType == 0) {
  36. dispatch(resetLabel(data.questionMapping,idx));
  37. }else if(data.controlType == 1){
  38. let arr = [];
  39. arr[0] = data;
  40. dispatch(resetLabel(arr,idx));
  41. }else if(data.controlType == 6) {
  42. let arr =[];
  43. arr[0] = data;
  44. dispatch(resetLabel(arr,idx));
  45. }
  46. })
  47. }
  48. };