diagnosticSearch.js 798 B

12345678910111213141516171819202122232425262728293031
  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. json('/api/icss/retrieval/getTagInfos',{
  14. type:'6',
  15. age:state.patInfo.message.patientAge,
  16. inputStr:val,
  17. sexType: state.patInfo.message.sex
  18. })
  19. .then((res)=>{
  20. const data = res.data.data;
  21. dispatch({
  22. type: GET_SEARCH_RESULT,
  23. searchResult: data
  24. })
  25. })
  26. }
  27. };