|
@@ -13,7 +13,6 @@ import com.diagbot.entity.DeptInfo;
|
|
|
import com.diagbot.entity.DeptVital;
|
|
|
import com.diagbot.entity.QuestionInfo;
|
|
|
import com.diagbot.entity.VitalOrder;
|
|
|
-import com.diagbot.enums.InputModeEnum;
|
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
|
import com.diagbot.enums.QuantitativeTypeEnum;
|
|
|
import com.diagbot.enums.QuestionTypeEnum;
|
|
@@ -94,10 +93,9 @@ public class PushFacade {
|
|
|
* 推理接口
|
|
|
*
|
|
|
* @param pushVO
|
|
|
- * @param mode
|
|
|
* @return
|
|
|
*/
|
|
|
- public PushDTO pushInner(PushVO pushVO, Integer mode) {
|
|
|
+ public PushDTO pushInner(PushVO pushVO) {
|
|
|
PushDTO pushDTO = new PushDTO();
|
|
|
ResponseData data = pushAI(pushVO);
|
|
|
|
|
@@ -111,31 +109,29 @@ public class PushFacade {
|
|
|
List<FeatureRate> labs = data.getLabs();
|
|
|
|
|
|
Map<String, Object> symptomMap = list2Map(symptom);
|
|
|
- Map<String, Object> vitalMap = new LinkedHashMap<>();
|
|
|
Map<String, Object> disMap = list2Map(dis);
|
|
|
Map<String, Object> labMap = list2Map(labs);
|
|
|
Map<String, Object> pacsMap = list2Map(pacs);
|
|
|
|
|
|
if (featureTypeSet.contains(String.valueOf(QuestionTypeEnum.Lis.getKey()))) {
|
|
|
- pushDTO.setLabMap(labMap);
|
|
|
+ List<QuestionDTO> labDTO = getTagListByMap(labMap, pushVO, QuestionTypeEnum.Lis.getKey());
|
|
|
+ pushDTO.setLab(labDTO);
|
|
|
}
|
|
|
if (featureTypeSet.contains(String.valueOf(QuestionTypeEnum.Pacs.getKey()))) {
|
|
|
- pushDTO.setPacsMap(pacsMap);
|
|
|
+ List<QuestionDTO> pacsDTO = getTagListByMap(labMap, pushVO, QuestionTypeEnum.Pacs.getKey());
|
|
|
+ pushDTO.setPacs(pacsDTO);
|
|
|
}
|
|
|
//诊断 返回tagName+标签
|
|
|
if (featureTypeSet.contains(String.valueOf(QuestionTypeEnum.Disease.getKey()))) {
|
|
|
- disMap = getTagByMap(disMap, pushVO, QuestionTypeEnum.Disease.getKey());
|
|
|
- Map<String, Map<String, Object>> disMapDTO = new LinkedHashMap<>();
|
|
|
- disMapDTO.put("疑似诊断:", disMap);
|
|
|
- pushDTO.setDisMap(disMapDTO);
|
|
|
+ List<QuestionDTO> disDTO = getTagListByMap(disMap, pushVO, QuestionTypeEnum.Disease.getKey());
|
|
|
+ Map<String, List<QuestionDTO>> disMapDTO = new LinkedHashMap<>();
|
|
|
+ disMapDTO.put("疑似诊断:", disDTO);
|
|
|
+ pushDTO.setDis(disMapDTO);
|
|
|
}
|
|
|
//症状(主诉 type=1;现病史 type=2) 返回 tagName+填写单
|
|
|
if (featureTypeSet.contains(String.valueOf(QuestionTypeEnum.Symptom.getKey()))) {
|
|
|
- //结构化模式,症状返回标签
|
|
|
- if (mode.equals(InputModeEnum.Structured.getKey())) {
|
|
|
- symptomMap = getTagByMap(symptomMap, pushVO, QuestionTypeEnum.Symptom.getKey());
|
|
|
- }
|
|
|
- pushDTO.setSymptomMap(symptomMap);
|
|
|
+ List<QuestionDTO> symptomDTO = getTagListByMap(symptomMap, pushVO, QuestionTypeEnum.Symptom.getKey());
|
|
|
+ pushDTO.setSymptom(symptomDTO);
|
|
|
}
|
|
|
//查体 返回模板
|
|
|
if (featureTypeSet.contains(String.valueOf(QuestionTypeEnum.Vital.getKey()))) {
|
|
@@ -144,13 +140,14 @@ public class PushFacade {
|
|
|
if (dis != null && dis.size() > 0) {
|
|
|
deptName = dis.get(0).getExtraProperty();
|
|
|
}
|
|
|
- vitalMap = getVitalModule(deptName, pushVO);
|
|
|
- pushDTO.setVitalMap(vitalMap);
|
|
|
+ List<QuestionDTO> vitalDTO = getVitalModule(deptName, pushVO);
|
|
|
+ pushDTO.setVital(vitalDTO);
|
|
|
|
|
|
}
|
|
|
return pushDTO;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 获取返回结果标签
|
|
|
*
|
|
@@ -158,7 +155,8 @@ public class PushFacade {
|
|
|
* @param pushVO
|
|
|
* @return
|
|
|
*/
|
|
|
- public Map<String, Object> getTagByMap(Map<String, Object> map, PushVO pushVO, Integer type) {
|
|
|
+ public List<QuestionDTO> getTagListByMap(Map<String, Object> map, PushVO pushVO, Integer type) {
|
|
|
+ List<QuestionDTO> questionDTOList = Lists.newLinkedList();
|
|
|
QueryWrapper<QuestionInfo> questionInfoQueryWrapper = new QueryWrapper();
|
|
|
questionInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey()).
|
|
|
in("tag_name", map.keySet()).
|
|
@@ -166,18 +164,24 @@ public class PushFacade {
|
|
|
List<QuestionInfo> questionInfoList = questionFacade.list(questionInfoQueryWrapper);
|
|
|
Map<String, QuestionInfo> questionMap = EntityUtil.makeEntityMap(questionInfoList, "tagName");
|
|
|
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
|
|
+ QuestionDTO questionDTO = new QuestionDTO();
|
|
|
if (questionMap.get(entry.getKey()) != null) {
|
|
|
QuestionVO questionVO = new QuestionVO();
|
|
|
questionVO.setAge(pushVO.getAge());
|
|
|
questionVO.setSexType(pushVO.getSex());
|
|
|
questionVO.setId(questionMap.get(entry.getKey()).getId());
|
|
|
- QuestionDTO questionDTO = questionFacade.getById(questionVO);
|
|
|
- if (questionDTO.getSubType().equals(0)) {
|
|
|
- entry.setValue(questionDTO);
|
|
|
+ questionDTO = questionFacade.getById(questionVO);
|
|
|
+ if (questionDTO == null || (!questionDTO.getSubType().equals(0))) {
|
|
|
+ questionDTO = new QuestionDTO();
|
|
|
+ questionDTO.setTagName(entry.getKey());
|
|
|
}
|
|
|
+
|
|
|
+ } else {
|
|
|
+ questionDTO.setTagName(entry.getKey());
|
|
|
}
|
|
|
+ questionDTOList.add(questionDTO);
|
|
|
}
|
|
|
- return map;
|
|
|
+ return questionDTOList;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -222,6 +226,7 @@ public class PushFacade {
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 快易检结果预处理
|
|
|
*
|
|
@@ -289,8 +294,8 @@ public class PushFacade {
|
|
|
* @param pushVO
|
|
|
* @return
|
|
|
*/
|
|
|
- public Map<String, Object> getVitalModule(String deptName, PushVO pushVO) {
|
|
|
- Map<String, Object> vitalMap = new LinkedHashMap<>();
|
|
|
+ public List<QuestionDTO> getVitalModule(String deptName, PushVO pushVO) {
|
|
|
+ List<QuestionDTO> vitalDTO = Lists.newLinkedList();
|
|
|
QueryWrapper<DeptInfo> deptInfoQueryWrapper = new QueryWrapper<>();
|
|
|
deptInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey()).
|
|
|
eq("name", deptName);
|
|
@@ -320,10 +325,10 @@ public class PushFacade {
|
|
|
questionVO.setId(entry.getKey());
|
|
|
QuestionDTO questionDTO = questionFacade.getById(questionVO);
|
|
|
if (questionDTO != null) {
|
|
|
- vitalMap.put(questionDTO.getName(), questionDTO);
|
|
|
+ vitalDTO.add(questionDTO);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- return vitalMap;
|
|
|
+ return vitalDTO;
|
|
|
}
|
|
|
}
|