12345678910111213141516171819202122232425262728293031323334353637383940 |
- import { json } from "@utils/ajax";
- import { GET_SEARCH_RESULT } from '@store/types/diagnosticSearch';
- export const getSearchList = (val) => {
- if(val.trim() == ''){
- const data = [];
- return (dispatch) => dispatch({
- type: GET_SEARCH_RESULT,
- searchResult: []
- })
- }
-
- return (dispatch, getState) => {
- const state = getState();
- const diagnosticList = state.diagnosticList.diagnosticList
- console.log('diagnosticList', diagnosticList)
- let noIds = []
- for(let i = 0; i < diagnosticList.length; i++) {
- if(diagnosticList[i].conceptId) {
- noIds.push(diagnosticList[i].conceptId)
- }
- }
- json('/retrieval/getTagInfos',{
- type:'7',
- age:state.patInfo.message.patientAge,
- inputStr:val,
- sexType: state.patInfo.message.sex,
- inputIds: noIds
- })
- .then((res)=>{
- const data = res.data.data;
- dispatch({
- type: GET_SEARCH_RESULT,
- searchResult: data
- })
- })
- }
- };
|