|
@@ -4,16 +4,13 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.diagbot.biz.push.entity.Item;
|
|
|
import com.diagbot.biz.push.entity.Lis;
|
|
|
import com.diagbot.biz.push.entity.Scale;
|
|
|
-import com.diagbot.dto.BillMsg;
|
|
|
-import com.diagbot.dto.IndicationDTO;
|
|
|
-import com.diagbot.dto.RuleBaseDTO;
|
|
|
-import com.diagbot.dto.RuleConditionDTO;
|
|
|
-import com.diagbot.dto.RuleExtDTO;
|
|
|
-import com.diagbot.dto.WordCrfDTO;
|
|
|
+import com.diagbot.dto.*;
|
|
|
import com.diagbot.entity.KlDiagHospital;
|
|
|
+import com.diagbot.entity.KlDisease;
|
|
|
+import com.diagbot.entity.KlDrug;
|
|
|
import com.diagbot.enums.*;
|
|
|
-import com.diagbot.facade.CommonFacade;
|
|
|
-import com.diagbot.facade.KlDiagHospitalFacade;
|
|
|
+import com.diagbot.facade.*;
|
|
|
+import com.diagbot.model.entity.Doctor;
|
|
|
import com.diagbot.model.entity.PacsNum;
|
|
|
import com.diagbot.model.label.PacsLabel;
|
|
|
import com.diagbot.rule.AgeRule;
|
|
@@ -28,14 +25,15 @@ import com.diagbot.util.MsgUtil;
|
|
|
import com.diagbot.util.RedisUtil;
|
|
|
import com.diagbot.util.ReflectUtil;
|
|
|
import com.diagbot.util.StringUtil;
|
|
|
+import com.diagbot.vo.Drug;
|
|
|
import com.diagbot.vo.RuleVO;
|
|
|
+import com.diagbot.vo.SearchCollectionConceptVO;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @Description: 其他提示总入口
|
|
@@ -63,6 +61,15 @@ public class OtherTipProcess {
|
|
|
@Autowired
|
|
|
private KlDiagHospitalFacade klDiagHospitalFacade;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private KlConceptFacade klConceptFacade;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private KlDrugFacade klDrugFacade;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private KlDiseaseFacade klDiseaseFacade;
|
|
|
+
|
|
|
/**
|
|
|
* 处理业务——化验
|
|
|
*
|
|
@@ -309,6 +316,137 @@ public class OtherTipProcess {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 处理业务——已开药物是否与医生级别相符
|
|
|
+ *
|
|
|
+ * @param wordCrfDTO
|
|
|
+ * @param res
|
|
|
+ */
|
|
|
+ public void processDrugAndDoctorMatch(WordCrfDTO wordCrfDTO, IndicationDTO res) {
|
|
|
+ List<BillMsg> otherList = res.getOtherList();
|
|
|
+ // 诊断
|
|
|
+ List<Drug> drugOrderList = wordCrfDTO.getDrugOrder();
|
|
|
+ Doctor doctor = wordCrfDTO.getDoctor();
|
|
|
+ if (ListUtil.isEmpty(drugOrderList) || doctor == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, String> drugNameMap = drugOrderList.stream().collect(Collectors.toMap(Drug::getUniqueName, Drug::getName));
|
|
|
+
|
|
|
+ List<String> uniqueNames = drugOrderList.stream().map(Drug::getUniqueName).collect(Collectors.toList());
|
|
|
+
|
|
|
+ SearchCollectionConceptVO searchCollectionConceptVO = new SearchCollectionConceptVO();
|
|
|
+ searchCollectionConceptVO.setNames(uniqueNames);
|
|
|
+ List<GetAllForRelationDTO> getAllForRelationDTOS = klConceptFacade.searchCollectionConceptFacNew(searchCollectionConceptVO);
|
|
|
+
|
|
|
+ if (ListUtil.isEmpty(getAllForRelationDTOS)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<Long,String> drugConceptIdNameMap = getAllForRelationDTOS.stream()
|
|
|
+ .collect(Collectors.toMap(GetAllForRelationDTO::getConceptId ,GetAllForRelationDTO::getConceptName));
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ List<Long> conceptIds = getAllForRelationDTOS.stream().map(GetAllForRelationDTO::getConceptId).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<KlDrug> klDrugs = klDrugFacade.getKlDrugsByConceptIdsNew(conceptIds);
|
|
|
+
|
|
|
+ if (ListUtil.isEmpty(klDrugs)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Map<Integer, List<KlDrug>> drugGradeListMap = klDrugs.stream().filter(e -> e.getDrugGrade() != null).collect(Collectors.groupingBy(KlDrug::getDrugGrade));
|
|
|
+
|
|
|
+ if (Objects.equals(doctor.getProfessionalTitle(), "无") || Objects.equals(doctor.getProfessionalTitle(), "医师")){
|
|
|
+ if (drugGradeListMap.keySet().containsAll(Arrays.asList(1,2))){
|
|
|
+ List<Long> limitConceptIds = drugGradeListMap.get(1).stream().map(KlDrug::getConceptId).collect(Collectors.toList());
|
|
|
+ List<String> limitUniqueNames = limitConceptIds.stream().map(drugConceptIdNameMap::get).collect(Collectors.toList());
|
|
|
+ String limitName = limitUniqueNames.stream().map(drugNameMap::get).collect(Collectors.joining("、"));
|
|
|
+
|
|
|
+ List<Long> specialConceptIds = drugGradeListMap.get(2).stream().map(KlDrug::getConceptId).collect(Collectors.toList());
|
|
|
+ List<String> specialUniqueNames = specialConceptIds.stream().map(drugConceptIdNameMap::get).collect(Collectors.toList());
|
|
|
+ String specialName = specialUniqueNames.stream().map(drugNameMap::get).collect(Collectors.joining("、"));
|
|
|
+ String msg = "1、" +limitName + "为限制使用级药品,仅主治医师及以上级别可使用\n";
|
|
|
+ msg += "2、" + specialName + "为特殊使用级药品,仅副主任及以上级别可使用";
|
|
|
+ BillMsg billMsg = MsgUtil.getCommonOtherMsg(TypeEnum.other.getName(), msg, null, null, null);
|
|
|
+ CoreUtil.addBeanToList(otherList, billMsg);
|
|
|
+ }else if (drugGradeListMap.containsKey(1)){
|
|
|
+ List<Long> limitConceptIds = drugGradeListMap.get(1).stream().map(KlDrug::getConceptId).collect(Collectors.toList());
|
|
|
+ List<String> limitUniqueNames = limitConceptIds.stream().map(drugConceptIdNameMap::get).collect(Collectors.toList());
|
|
|
+ String limitName = limitUniqueNames.stream().map(drugNameMap::get).collect(Collectors.joining("、"));
|
|
|
+
|
|
|
+ String msg = limitName + "为限制使用级药品,仅主治医师及以上级别可使用";
|
|
|
+ BillMsg billMsg = MsgUtil.getCommonOtherMsg(TypeEnum.other.getName(), msg, null, null, null);
|
|
|
+ CoreUtil.addBeanToList(otherList, billMsg);
|
|
|
+ }else if (drugGradeListMap.containsKey(2)){
|
|
|
+ specialDrugTip(drugGradeListMap, drugConceptIdNameMap, drugNameMap, otherList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (Objects.equals(doctor.getProfessionalTitle(), "主治医师") && drugGradeListMap.containsKey(2)){
|
|
|
+ specialDrugTip(drugGradeListMap, drugConceptIdNameMap, drugNameMap, otherList);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 处理业务——传染病周期提示
|
|
|
+ *
|
|
|
+ * @param wordCrfDTO
|
|
|
+ * @param res
|
|
|
+ */
|
|
|
+ public void processInfectiousDisease(WordCrfDTO wordCrfDTO, IndicationDTO res) {
|
|
|
+ List<BillMsg> otherList = res.getOtherList();
|
|
|
+ // 诊断
|
|
|
+ List<Item> diagItems = wordCrfDTO.getDiag();
|
|
|
+ if (ListUtil.isEmpty(diagItems)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, String> diagNameMap = diagItems.stream().collect(Collectors.toMap(Item::getUniqueName, Item::getName));
|
|
|
+
|
|
|
+ List<String> uniqueNames = diagItems.stream().map(Item::getUniqueName).collect(Collectors.toList());
|
|
|
+
|
|
|
+ SearchCollectionConceptVO searchCollectionConceptVO = new SearchCollectionConceptVO();
|
|
|
+ searchCollectionConceptVO.setNames(uniqueNames);
|
|
|
+ List<GetAllForRelationDTO> getAllForRelationDTOS = klConceptFacade.searchCollectionConceptFacNew(searchCollectionConceptVO);
|
|
|
+
|
|
|
+ if (ListUtil.isEmpty(getAllForRelationDTOS)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<Long,String> diagConceptIdNameMap = getAllForRelationDTOS.stream()
|
|
|
+ .collect(Collectors.toMap(GetAllForRelationDTO::getConceptId ,GetAllForRelationDTO::getConceptName));
|
|
|
+
|
|
|
+ List<Long> conceptIds = getAllForRelationDTOS.stream().map(GetAllForRelationDTO::getConceptId).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<KlDisease> klDiseases = klDiseaseFacade.getKlDiagsByConceptIds(conceptIds);
|
|
|
+
|
|
|
+ if (ListUtil.isEmpty(klDiseases)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (KlDisease klDisease : klDiseases) {
|
|
|
+ if (klDisease.getIsInfect() == 1){
|
|
|
+ String diseaseName = diagNameMap.get(diagConceptIdNameMap.get(klDisease.getConceptId()));
|
|
|
+ String msg = diseaseName + "是" + klDisease.getInfectClassification() + "传染病," + klDisease.getInfectDeadline();
|
|
|
+ BillMsg billMsg = MsgUtil.getCommonOtherMsg(TypeEnum.other.getName(), msg, null, null, null);
|
|
|
+ CoreUtil.addBeanToList(otherList, billMsg);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private static void specialDrugTip(Map<Integer, List<KlDrug>> drugGradeListMap, Map<Long, String> drugConceptIdNameMap, Map<String, String> drugNameMap, List<BillMsg> otherList) {
|
|
|
+ List<Long> specialConceptIds = drugGradeListMap.get(2).stream().map(KlDrug::getConceptId).collect(Collectors.toList());
|
|
|
+ List<String> specialUniqueNames = specialConceptIds.stream().map(drugConceptIdNameMap::get).collect(Collectors.toList());
|
|
|
+ String specialName = specialUniqueNames.stream().map(drugNameMap::get).collect(Collectors.joining("、"));
|
|
|
+ String msg = specialName + "为特殊使用级药品,仅副主任及以上级别可使用";
|
|
|
+ BillMsg billMsg = MsgUtil.getCommonOtherMsg(TypeEnum.other.getName(), msg, null, null, null);
|
|
|
+ CoreUtil.addBeanToList(otherList, billMsg);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 是否有效医嘱(6天)
|
|
|
*
|