diagnosticSearch.js 1020 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import { json } from "@utils/ajax";
  2. import { GET_SEARCH_RESULT } from '@store/types/diagnosticSearch';
  3. export const getSearchList = (val) => {
  4. if(val.trim() == ''){
  5. const data = [];
  6. return (dispatch) => dispatch({
  7. type: GET_SEARCH_RESULT,
  8. searchResult: []
  9. })
  10. }
  11. return (dispatch, getState) => {
  12. const state = getState();
  13. const diagnosticList = state.diagnosticList.diagnosticList
  14. let noIds = []
  15. for(let i = 0; i < diagnosticList.length; i++) {
  16. noIds.push(diagnosticList[i].id)
  17. }
  18. json('/retrieval/getTagInfos',{
  19. type:'7',
  20. age:state.patInfo.message.patientAge,
  21. inputStr:val,
  22. sexType: state.patInfo.message.sex,
  23. inputIds: noIds
  24. })
  25. .then((res)=>{
  26. const data = res.data.data;
  27. dispatch({
  28. type: GET_SEARCH_RESULT,
  29. searchResult: data
  30. })
  31. })
  32. }
  33. };