|
@@ -13,6 +13,7 @@ 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;
|
|
@@ -90,12 +91,12 @@ public class PushFacade {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 内部推理
|
|
|
- *
|
|
|
+ * 推理接口
|
|
|
* @param pushVO
|
|
|
+ * @param mode
|
|
|
* @return
|
|
|
*/
|
|
|
- public PushDTO pushInner(PushVO pushVO) {
|
|
|
+ public PushDTO pushInner(PushVO pushVO, Integer mode) {
|
|
|
PushDTO pushDTO = new PushDTO();
|
|
|
ResponseData data = pushAI(pushVO);
|
|
|
|
|
@@ -120,24 +121,19 @@ public class PushFacade {
|
|
|
if (featureTypeSet.contains(String.valueOf(QuestionTypeEnum.Pacs.getKey()))) {
|
|
|
pushDTO.setPacsMap(pacsMap);
|
|
|
}
|
|
|
- //诊断 返回tagName+id
|
|
|
+ //诊断 返回tagName+标签
|
|
|
if (featureTypeSet.contains(String.valueOf(QuestionTypeEnum.Disease.getKey()))) {
|
|
|
- QueryWrapper<QuestionInfo> questionInfoQueryWrapper = new QueryWrapper();
|
|
|
- questionInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey()).
|
|
|
- in("tag_name", disMap.keySet()).
|
|
|
- eq("type", QuestionTypeEnum.Disease.getKey());
|
|
|
- List<QuestionInfo> disList = questionFacade.list(questionInfoQueryWrapper);
|
|
|
- disMap = getTagByMap(disMap, disList, pushVO);
|
|
|
- pushDTO.setDisMap(disMap);
|
|
|
+ disMap = getTagByMap(disMap, pushVO, QuestionTypeEnum.Disease.getKey());
|
|
|
+ Map<String, Map<String, Object>> disMapDTO = new LinkedHashMap<>();
|
|
|
+ disMapDTO.put("疑似诊断:", disMap);
|
|
|
+ pushDTO.setDisMap(disMapDTO);
|
|
|
}
|
|
|
//症状(主诉 type=1;现病史 type=2) 返回 tagName+填写单
|
|
|
if (featureTypeSet.contains(String.valueOf(QuestionTypeEnum.Symptom.getKey()))) {
|
|
|
- QueryWrapper<QuestionInfo> questionInfoQueryWrapper = new QueryWrapper();
|
|
|
- questionInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey()).
|
|
|
- in("tag_name", symptomMap.keySet()).
|
|
|
- eq("type", QuestionTypeEnum.Symptom.getKey());
|
|
|
- List<QuestionInfo> symptomList = questionFacade.list(questionInfoQueryWrapper);
|
|
|
- symptomMap = getTagByMap(symptomMap, symptomList, pushVO);
|
|
|
+ //结构化模式,症状返回标签
|
|
|
+ if (mode.equals(InputModeEnum.Structured.getKey())) {
|
|
|
+ symptomMap = getTagByMap(symptomMap, pushVO, QuestionTypeEnum.Symptom.getKey());
|
|
|
+ }
|
|
|
pushDTO.setSymptomMap(symptomMap);
|
|
|
}
|
|
|
//查体 返回模板
|
|
@@ -147,40 +143,9 @@ public class PushFacade {
|
|
|
if (dis != null && dis.size() > 0) {
|
|
|
deptName = dis.get(0).getExtraProperty();
|
|
|
}
|
|
|
- QueryWrapper<DeptInfo> deptInfoQueryWrapper = new QueryWrapper<>();
|
|
|
- deptInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey()).
|
|
|
- eq("name", deptName);
|
|
|
- DeptInfo deptInfo = deptInfoFacade.getOne(deptInfoQueryWrapper);
|
|
|
- if (deptInfo == null) {
|
|
|
- throw new CommonException(CommonErrorCode.NOT_EXISTS, "科室信息不存在");
|
|
|
- }
|
|
|
+ vitalMap = getVitalModule(deptName, pushVO);
|
|
|
+ pushDTO.setVitalMap(vitalMap);
|
|
|
|
|
|
- QueryWrapper<DeptVital> deptVitalQueryWrapper = new QueryWrapper<>();
|
|
|
- deptVitalQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey()).
|
|
|
- eq("dept_id", deptInfo.getId());
|
|
|
- List<DeptVital> deptVitalList = deptVitalFacade.list(deptVitalQueryWrapper);
|
|
|
- if (deptVitalList.size() > 0) {
|
|
|
- Map<Long, DeptVital> deptVitalMap = EntityUtil.makeEntityMap(deptVitalList, "vitalId");
|
|
|
- //排序
|
|
|
- QueryWrapper<VitalOrder> vitalOrderQueryWrapper = new QueryWrapper<>();
|
|
|
- vitalOrderQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey()).
|
|
|
- in("question_id", deptVitalMap.keySet()).
|
|
|
- orderByAsc("order_no");
|
|
|
- List<VitalOrder> vitalOrderList = vitalOrderFacade.list(vitalOrderQueryWrapper);
|
|
|
- Map<Long, VitalOrder> vitalOrderMap = EntityUtil.makeEntityMap(vitalOrderList, "questionId");
|
|
|
- //标签列表
|
|
|
- for (Map.Entry<Long, VitalOrder> entry : vitalOrderMap.entrySet()) {
|
|
|
- QuestionVO questionVO = new QuestionVO();
|
|
|
- questionVO.setAge(pushVO.getAge());
|
|
|
- questionVO.setSexType(pushVO.getSex());
|
|
|
- questionVO.setId(entry.getKey());
|
|
|
- QuestionDTO questionDTO = questionFacade.getById(questionVO);
|
|
|
- if (questionDTO != null) {
|
|
|
- vitalMap.put(questionDTO.getName(), questionDTO);
|
|
|
- }
|
|
|
- }
|
|
|
- pushDTO.setVitalMap(vitalMap);
|
|
|
- }
|
|
|
}
|
|
|
return pushDTO;
|
|
|
}
|
|
@@ -189,11 +154,15 @@ public class PushFacade {
|
|
|
* 获取返回结果标签
|
|
|
*
|
|
|
* @param map
|
|
|
- * @param questionInfoList
|
|
|
* @param pushVO
|
|
|
* @return
|
|
|
*/
|
|
|
- public Map<String, Object> getTagByMap(Map<String, Object> map, List<QuestionInfo> questionInfoList, PushVO pushVO) {
|
|
|
+ public Map<String, Object> getTagByMap(Map<String, Object> map, PushVO pushVO, Integer type) {
|
|
|
+ QueryWrapper<QuestionInfo> questionInfoQueryWrapper = new QueryWrapper();
|
|
|
+ questionInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey()).
|
|
|
+ in("tag_name", map.keySet()).
|
|
|
+ eq("type", type);
|
|
|
+ List<QuestionInfo> questionInfoList = questionFacade.list(questionInfoQueryWrapper);
|
|
|
Map<String, QuestionInfo> questionMap = EntityUtil.makeEntityMap(questionInfoList, "tagName");
|
|
|
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
|
|
if (questionMap.get(entry.getKey()) != null) {
|
|
@@ -308,4 +277,49 @@ public class PushFacade {
|
|
|
}
|
|
|
return stringList;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取查体模板
|
|
|
+ *
|
|
|
+ * @param deptName
|
|
|
+ * @param pushVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Map<String, Object> getVitalModule(String deptName, PushVO pushVO) {
|
|
|
+ Map<String, Object> vitalMap = new LinkedHashMap<>();
|
|
|
+ QueryWrapper<DeptInfo> deptInfoQueryWrapper = new QueryWrapper<>();
|
|
|
+ deptInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey()).
|
|
|
+ eq("name", deptName);
|
|
|
+ DeptInfo deptInfo = deptInfoFacade.getOne(deptInfoQueryWrapper);
|
|
|
+ if (deptInfo == null) {
|
|
|
+ throw new CommonException(CommonErrorCode.NOT_EXISTS, "科室信息不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ QueryWrapper<DeptVital> deptVitalQueryWrapper = new QueryWrapper<>();
|
|
|
+ deptVitalQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey()).
|
|
|
+ eq("dept_id", deptInfo.getId());
|
|
|
+ List<DeptVital> deptVitalList = deptVitalFacade.list(deptVitalQueryWrapper);
|
|
|
+ if (deptVitalList.size() > 0) {
|
|
|
+ Map<Long, DeptVital> deptVitalMap = EntityUtil.makeEntityMap(deptVitalList, "vitalId");
|
|
|
+ //排序
|
|
|
+ QueryWrapper<VitalOrder> vitalOrderQueryWrapper = new QueryWrapper<>();
|
|
|
+ vitalOrderQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey()).
|
|
|
+ in("question_id", deptVitalMap.keySet()).
|
|
|
+ orderByAsc("order_no");
|
|
|
+ List<VitalOrder> vitalOrderList = vitalOrderFacade.list(vitalOrderQueryWrapper);
|
|
|
+ Map<Long, VitalOrder> vitalOrderMap = EntityUtil.makeEntityMap(vitalOrderList, "questionId");
|
|
|
+ //标签列表
|
|
|
+ for (Map.Entry<Long, VitalOrder> entry : vitalOrderMap.entrySet()) {
|
|
|
+ QuestionVO questionVO = new QuestionVO();
|
|
|
+ questionVO.setAge(pushVO.getAge());
|
|
|
+ questionVO.setSexType(pushVO.getSex());
|
|
|
+ questionVO.setId(entry.getKey());
|
|
|
+ QuestionDTO questionDTO = questionFacade.getById(questionVO);
|
|
|
+ if (questionDTO != null) {
|
|
|
+ vitalMap.put(questionDTO.getName(), questionDTO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return vitalMap;
|
|
|
+ }
|
|
|
}
|