12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- import { json } from "@utils/ajax";
- import { GET_SEARCH_RESULT, SHOWNODATATEXT } from '@store/types/diagnosticSearch';
- import { GET_SEARCH } from '@store/types/emergencyHis';
- import { Notify } from '@commonComp';
- import { formatFormParmas } from '@utils/tools';
- import store from '@store';
- export const getSearchList = (val,flag) => {
- if(val.trim() == ''){
- // const data = [];
- if(flag){
- return (dispatch) => dispatch({
- type: GET_SEARCH,
- searchResult: []
- })
- }
- return (dispatch) => dispatch({
- type: GET_SEARCH_RESULT,
- searchResult: []
- })
- }
-
- return (dispatch, getState) => {
- const state = getState();
- let baseList = state;
- const diagnosticList = flag?state.emergencyHis.searchData:state.diagnosticList.diagnosticList;
- let noIds = []
- for(let i = 0; i < diagnosticList.length; i++) {
- if(diagnosticList[i].conceptId) {
- noIds.push(diagnosticList[i].conceptId)
- }
- }
- json('/demo/retrieval/index',{
- "type":'4',
- "age": formatFormParmas('patientAge',state.patInfo.patInfoData),
- "inputStr": val,
- "sex": formatFormParmas('patientSex',state.patInfo.patInfoData),
- })
- .then((res)=>{
- if(res.data.code==0){
- const data = res.data.data;let curDate=[];
- let arr = data.diseaseNames||[];
- for (var key in arr) {
- let obj = {}
- obj['name'] = arr[key];
- obj['uniqueName'] = arr[key];
- obj['conceptId'] = '';
- curDate.push(obj)
- }
- if(flag){
- dispatch({
- type: GET_SEARCH,
- searchResult: curDate
- })
- }else{
- dispatch({
- type: GET_SEARCH_RESULT,
- searchResult: curDate
- })
- // 是否进行过搜索
- dispatch({
- type: SHOWNODATATEXT,
- isShowNoDataInfo: true
- });
- }
- }else{
- Notify.error(res.data.msg)
- }
- })
- }
- };
|