|
@@ -16,6 +16,7 @@ import com.diagbot.entity.KlConceptCommon;
|
|
|
import com.diagbot.entity.KlConceptStatic;
|
|
|
import com.diagbot.entity.KlDiagnose;
|
|
|
import com.diagbot.entity.KlDiagnoseBase;
|
|
|
+import com.diagbot.entity.KlDrugMapping;
|
|
|
import com.diagbot.entity.KlLexicon;
|
|
|
import com.diagbot.entity.KlLibraryInfo;
|
|
|
import com.diagbot.entity.KlRelation;
|
|
@@ -23,6 +24,7 @@ import com.diagbot.entity.KlRule;
|
|
|
import com.diagbot.entity.KlRuleBase;
|
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
|
import com.diagbot.enums.LexiconEnum;
|
|
|
+import com.diagbot.enums.RelationLibTypeEnum;
|
|
|
import com.diagbot.enums.StatusEnum;
|
|
|
import com.diagbot.exception.CommonErrorCode;
|
|
|
import com.diagbot.exception.CommonException;
|
|
@@ -44,6 +46,7 @@ import com.diagbot.vo.KlConceptSaveSubVO;
|
|
|
import com.diagbot.vo.KlConceptSaveVO;
|
|
|
import com.diagbot.vo.KlLibraryInfoVO;
|
|
|
import com.diagbot.vo.SearchConceptVO;
|
|
|
+import com.diagbot.vo.SearchVO;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.google.common.collect.Maps;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -100,7 +103,10 @@ public class KlConceptFacade extends KlConceptServiceImpl {
|
|
|
KlVitalResFacade klVitalResFacade;
|
|
|
@Autowired
|
|
|
KlDrugMappingFacade klDrugMappingFacade;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ KlTcmDiseaseFacade klTcmDiseaseFacade;
|
|
|
+ @Autowired
|
|
|
+ KlTcmSyndromeFacade klTcmSyndromeFacade;
|
|
|
|
|
|
/**
|
|
|
* @param klConceptInfoVO
|
|
@@ -207,6 +213,12 @@ public class KlConceptFacade extends KlConceptServiceImpl {
|
|
|
case VitalResult: //体征结果扩展 kl_vital_result, kl_relation,kl_relation_order
|
|
|
klVitalResFacade.getKlVitalResult(conceptId, klConceptAll);
|
|
|
break;
|
|
|
+ case Tcmdisease: // 中医疾病
|
|
|
+ klTcmDiseaseFacade.getKlTcmDisease(conceptId, klConceptAll);
|
|
|
+ break;
|
|
|
+ case Tcmsyndrome: // 中医证候
|
|
|
+ klTcmSyndromeFacade.getKlTcmSyndrome(conceptId, klConceptAll);
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
return klConceptAll;
|
|
@@ -343,20 +355,26 @@ public class KlConceptFacade extends KlConceptServiceImpl {
|
|
|
case Medicine: // 药品通用名扩展 kl_drug
|
|
|
klDrugFacade.saveKlDrug(commonParam, klConceptSaveVO.getKlDrugVO());
|
|
|
break;
|
|
|
- case LisName:
|
|
|
- case LisSubName:
|
|
|
- klLisFacade.saveAll(commonParam,klConceptSaveVO.getKlLisVO());
|
|
|
+ case LisName: // 实验室检查套餐
|
|
|
+ case LisSubName: // 实验室检查子项目
|
|
|
+ klLisFacade.saveAll(commonParam, klConceptSaveVO.getKlLisVO());
|
|
|
break;
|
|
|
- case PacsSubName:
|
|
|
- case PacsName:
|
|
|
- klPacsFacade.saveAll(commonParam,klConceptSaveVO.getKlPacsVO());
|
|
|
+ case PacsSubName: // 辅助检查子项目
|
|
|
+ case PacsName: // 辅助检查项目
|
|
|
+ klPacsFacade.saveAll(commonParam, klConceptSaveVO.getKlPacsVO());
|
|
|
break;
|
|
|
- case Operation:
|
|
|
- klOperationFacade.saveAll(commonParam,klConceptSaveVO.getKlOperationVO());
|
|
|
+ case Operation: // 手术和操作
|
|
|
+ klOperationFacade.saveAll(commonParam, klConceptSaveVO.getKlOperationVO());
|
|
|
break;
|
|
|
- case VitalResult:
|
|
|
+ case VitalResult: // 体征结果
|
|
|
klRelationFacade.saveKlVitalRes(commonParam, klConceptSaveVO.getKlVitalResultVO());
|
|
|
break;
|
|
|
+ case Tcmdisease: // 中医疾病
|
|
|
+ klTcmDiseaseFacade.saveAll(commonParam, klConceptSaveVO.getKlTcmDiseaseVO());
|
|
|
+ break;
|
|
|
+ case Tcmsyndrome: // 中医证候
|
|
|
+ klTcmSyndromeFacade.saveAll(commonParam, klConceptSaveVO.getKlTcmSyndromeVO());
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
return res;
|
|
@@ -425,6 +443,12 @@ public class KlConceptFacade extends KlConceptServiceImpl {
|
|
|
return retList;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 根据类型和名称查找术语,名称和类型不能为空
|
|
|
+ *
|
|
|
+ * @param searchConceptVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
public List<GetAllForRelationDTO> searchConceptByNameAndLibType(SearchConceptVO searchConceptVO) {
|
|
|
List<GetAllForRelationDTO> getAllForRelationDTOS = Lists.newArrayList();
|
|
|
String name = searchConceptVO.getName();
|
|
@@ -451,6 +475,34 @@ public class KlConceptFacade extends KlConceptServiceImpl {
|
|
|
return getAllForRelationDTOS;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 根据类型和名称查找术语,名称可为空
|
|
|
+ *
|
|
|
+ * @param SearchVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<GetAllForRelationDTO> searchConceptByNameAndLibType(SearchVO SearchVO) {
|
|
|
+ List<GetAllForRelationDTO> getAllForRelationDTOS = Lists.newArrayList();
|
|
|
+ List<Long> excludedConceptIds = SearchVO.getExcludedConceptIds();
|
|
|
+ List<KlConcept> conceptList = this.list(new QueryWrapper<KlConcept>()
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("lib_type", SearchVO.getLibType())
|
|
|
+ .eq("status", StatusEnum.Enable.getKey())
|
|
|
+ .like(StringUtil.isNotBlank(SearchVO.getName()), "lib_name", SearchVO.getName())
|
|
|
+ .notIn(ListUtil.isNotEmpty(excludedConceptIds), "id", excludedConceptIds));
|
|
|
+ if (ListUtil.isNotEmpty(conceptList)) {
|
|
|
+ getAllForRelationDTOS = conceptList.stream().map(x -> {
|
|
|
+ GetAllForRelationDTO getAllForRelationDTO = new GetAllForRelationDTO();
|
|
|
+ getAllForRelationDTO.setConceptNameType(x.getLibName());
|
|
|
+ getAllForRelationDTO.setConceptName(x.getLibName());
|
|
|
+ getAllForRelationDTO.setConceptId(x.getId());
|
|
|
+ getAllForRelationDTO.setLibType(x.getLibType());
|
|
|
+ return getAllForRelationDTO;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ return getAllForRelationDTOS;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 筛选符合类型的概念id
|
|
|
*
|
|
@@ -497,11 +549,17 @@ public class KlConceptFacade extends KlConceptServiceImpl {
|
|
|
}
|
|
|
|
|
|
//kl_relation
|
|
|
- int relationsum = klRelationFacade.count(new QueryWrapper<KlRelation>().eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
- .eq("start_id", klConceptSatarOrdisaVO.getConceptId()).or()
|
|
|
- .eq("end_id", klConceptSatarOrdisaVO.getConceptId()));
|
|
|
+ List<Integer> notRelationList = Lists.newArrayList(RelationLibTypeEnum.relationDept.getKey(),
|
|
|
+ RelationLibTypeEnum.relationPart.getKey(), RelationLibTypeEnum.relationSystem.getKey(),
|
|
|
+ RelationLibTypeEnum.relationAccSymptom.getKey(), RelationLibTypeEnum.relationNature.getKey());
|
|
|
+ int relationsum = klRelationFacade.count(new QueryWrapper<KlRelation>()
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .and(r -> r.eq("end_id", klConceptSatarOrdisaVO.getConceptId())
|
|
|
+ .or(r1 -> r1.eq("start_id", klConceptSatarOrdisaVO.getConceptId()).notIn("relation_id", notRelationList))
|
|
|
+ )
|
|
|
+ );
|
|
|
if (relationsum > 0) {
|
|
|
- throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该医学标准术语与树形结构或疾病相关存在关系!");
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该医学标准术语与树形结构或疾病相关或扩展信息存在关系!");
|
|
|
}
|
|
|
//kl_rule
|
|
|
int rulesum = klRuleFacade.count(new QueryWrapper<KlRule>().eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
@@ -527,12 +585,19 @@ public class KlConceptFacade extends KlConceptServiceImpl {
|
|
|
if (diagnoseBasesum > 0) {
|
|
|
throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该医学标准术语与诊断依据维护明细存在关系!");
|
|
|
}
|
|
|
+ //kl_drug_mapping
|
|
|
+ int drugMappingSum = klDrugMappingFacade.count(new QueryWrapper<KlDrugMapping>().eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("drug_concept", klConceptSatarOrdisaVO.getConceptId()));
|
|
|
+ if (drugMappingSum > 0) {
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该医学标准术语与注册药品存在关系!");
|
|
|
+ }
|
|
|
}
|
|
|
UpdateWrapper<KlConcept> klLibraryUpdate = new UpdateWrapper<>();
|
|
|
klLibraryUpdate.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
.eq("id", klConceptSatarOrdisaVO.getConceptId())
|
|
|
- .set("status", status).set("gmt_modified", now)
|
|
|
- .set("modifier", UserUtils.getCurrentPrincipleID());
|
|
|
+ .set("status", status).set("gmt_modified", now);
|
|
|
+ // .set("modifier", UserUtils.getCurrentPrincipleID()
|
|
|
+ // );
|
|
|
return this.update(klLibraryUpdate);
|
|
|
|
|
|
}
|