diagnosticSearch.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. console.log('diagnosticList', diagnosticList)
  15. let noIds = []
  16. for(let i = 0; i < diagnosticList.length; i++) {
  17. if(diagnosticList[i].conceptId) {
  18. noIds.push(diagnosticList[i].conceptId)
  19. }
  20. }
  21. json('/retrieval/getTagInfos',{
  22. type:'7',
  23. age:state.patInfo.message.patientAge,
  24. inputStr:val,
  25. sexType: state.patInfo.message.sex,
  26. inputIds: noIds
  27. })
  28. .then((res)=>{
  29. const data = res.data.data;
  30. dispatch({
  31. type: GET_SEARCH_RESULT,
  32. searchResult: data
  33. })
  34. })
  35. }
  36. };