|
@@ -2,18 +2,69 @@ package com.diagbot.repository;
|
|
|
|
|
|
import com.diagbot.dto.BillNeoDTO;
|
|
|
import com.diagbot.dto.PacsBillNeoDTO;
|
|
|
-import com.diagbot.entity.node.*;
|
|
|
-import com.diagbot.entity.relationship.*;
|
|
|
+import com.diagbot.entity.node.Allergen;
|
|
|
+import com.diagbot.entity.node.ClinicalFinding;
|
|
|
+import com.diagbot.entity.node.ConflictDevice;
|
|
|
+import com.diagbot.entity.node.Disease;
|
|
|
+import com.diagbot.entity.node.Gender;
|
|
|
+import com.diagbot.entity.node.Group;
|
|
|
+import com.diagbot.entity.node.Lis;
|
|
|
+import com.diagbot.entity.node.MedAllergen;
|
|
|
+import com.diagbot.entity.node.OralMedicine;
|
|
|
+import com.diagbot.entity.node.PacsDescribe;
|
|
|
+import com.diagbot.entity.node.PacsSubName;
|
|
|
+import com.diagbot.entity.node.Vital;
|
|
|
+import com.diagbot.entity.relationship.PacsSubNameAllergen;
|
|
|
+import com.diagbot.entity.relationship.PacsSubNameClinicalFinding;
|
|
|
+import com.diagbot.entity.relationship.PacsSubNameConflictDevice;
|
|
|
+import com.diagbot.entity.relationship.PacsSubNameDisease;
|
|
|
+import com.diagbot.entity.relationship.PacsSubNameGender;
|
|
|
+import com.diagbot.entity.relationship.PacsSubNameGroup;
|
|
|
+import com.diagbot.entity.relationship.PacsSubNameLis;
|
|
|
+import com.diagbot.entity.relationship.PacsSubNameMedAllergen;
|
|
|
+import com.diagbot.entity.relationship.PacsSubNameOralMedicine;
|
|
|
+import com.diagbot.entity.relationship.PacsSubNamePacsDescribe;
|
|
|
+import com.diagbot.entity.relationship.PacsSubNameVital;
|
|
|
import com.diagbot.util.ListUtil;
|
|
|
import com.diagbot.util.NeoUtil;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Set;
|
|
|
|
|
|
+@Component
|
|
|
public class PacsSubNameNode {
|
|
|
|
|
|
+ @Autowired
|
|
|
+ MedAllergenRepository medAllergenRepository;
|
|
|
+ @Autowired
|
|
|
+ GenderRepository genderRepository;
|
|
|
+ @Autowired
|
|
|
+ LisRepository lisRepository;
|
|
|
+ @Autowired
|
|
|
+ GroupRepository groupRepository;
|
|
|
+ @Autowired
|
|
|
+ ClinicalFindingRepository clinicalFindingRepository;
|
|
|
+ @Autowired
|
|
|
+ VitalRepository vitalRepository;
|
|
|
+ @Autowired
|
|
|
+ AgeRepository ageRepository;
|
|
|
+ @Autowired
|
|
|
+ DiseaseRepository diseaseRepository;
|
|
|
+ @Autowired
|
|
|
+ BillConflictItemRepository billConflictItemRepository;
|
|
|
+ @Autowired
|
|
|
+ ConflictDeviceRepository conflictDeviceRepository;
|
|
|
+ @Autowired
|
|
|
+ OralMedicineRepository oralMedicineRepository;
|
|
|
+ @Autowired
|
|
|
+ PacsDescribeRepository pacsDescribeRepository;
|
|
|
+ @Autowired
|
|
|
+ AllergenRepository allergenRepository;
|
|
|
+
|
|
|
|
|
|
public PacsBillNeoDTO PacstoPACSDTO(PacsSubName pacs) {
|
|
|
PacsBillNeoDTO pacsBillNeoDTO = new PacsBillNeoDTO();
|
|
@@ -217,8 +268,272 @@ public class PacsSubNameNode {
|
|
|
|
|
|
return pacslist;
|
|
|
}
|
|
|
-}
|
|
|
|
|
|
+ /**
|
|
|
+ * 更新关系状态属性
|
|
|
+ */
|
|
|
+ public void updateRelationExt(PacsSubName pacsSubName, String relname, Integer status, Integer ruleType, String e_name, PacsSubNameRepository pacsSubNameRepository) {
|
|
|
+ Boolean isExist = false;
|
|
|
+ try {
|
|
|
+ switch (relname) {
|
|
|
+ case "辅助检查子项目名称禁忌性别":
|
|
|
+ Gender gender = genderRepository.findByNameIs(e_name).get(0);
|
|
|
+ PacsSubNameGender pacsSubNameGender = new PacsSubNameGender();
|
|
|
+ pacsSubNameGender.setGender(gender);
|
|
|
+ pacsSubNameGender.setPacsSubName(pacsSubName);
|
|
|
+ pacsSubNameGender.setStatus(status);
|
|
|
+ pacsSubNameGender.setRuleType(ruleType);
|
|
|
+ pacsSubName.setPacsSubNameGender(pacsSubNameGender);
|
|
|
+ break;
|
|
|
+ case "辅助检查子项目名称禁忌禁忌人群":
|
|
|
+ Group group = groupRepository.findByNameIs(e_name).get(0);
|
|
|
+ Set<PacsSubNameGroup> pacsSubNameGroupSet = pacsSubName.getPacsSubNameGroups();
|
|
|
+ isExist = false;
|
|
|
+ for (PacsSubNameGroup item : pacsSubNameGroupSet) {
|
|
|
+ if (item.getGroup() != null
|
|
|
+ && item.getGroup().getName().equals(e_name)) {
|
|
|
+ isExist = true;
|
|
|
+ item.setPacsSubName(pacsSubName);
|
|
|
+ item.setGroup(group);
|
|
|
+ item.setStatus(status);
|
|
|
+ item.setRuleType(ruleType);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!isExist) {
|
|
|
+ PacsSubNameGroup pacsSubNameGroup = new PacsSubNameGroup();
|
|
|
+ pacsSubNameGroup.setGroup(group);
|
|
|
+ pacsSubNameGroup.setPacsSubName(pacsSubName);
|
|
|
+ pacsSubNameGroup.setStatus(status);
|
|
|
+ pacsSubNameGroup.setRuleType(ruleType);
|
|
|
+ pacsSubNameGroupSet.add(pacsSubNameGroup);
|
|
|
+ }
|
|
|
+ pacsSubName.setPacsSubNameGroups(pacsSubNameGroupSet);
|
|
|
+ break;
|
|
|
+ case "辅助检查子项目名称禁忌药物过敏原":
|
|
|
+ MedAllergen medAllergen = medAllergenRepository.findByNameIs(e_name).get(0);
|
|
|
+ Set<PacsSubNameMedAllergen> pacsSubNameMedAllergenSet = pacsSubName.getPacsSubNameMedallergens();
|
|
|
+ isExist = false;
|
|
|
+ for (PacsSubNameMedAllergen item : pacsSubNameMedAllergenSet) {
|
|
|
+ if (item.getMedAllergen() != null
|
|
|
+ && item.getMedAllergen().getName().equals(e_name)) {
|
|
|
+ isExist = true;
|
|
|
+ item.setPacsSubName(pacsSubName);
|
|
|
+ item.setMedAllergen(medAllergen);
|
|
|
+ item.setStatus(status);
|
|
|
+ item.setRuleType(ruleType);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!isExist) {
|
|
|
+ PacsSubNameMedAllergen pacsSubNameMedAllergen = new PacsSubNameMedAllergen();
|
|
|
+ pacsSubNameMedAllergen.setMedAllergen(medAllergen);
|
|
|
+ pacsSubNameMedAllergen.setPacsSubName(pacsSubName);
|
|
|
+ pacsSubNameMedAllergen.setStatus(status);
|
|
|
+ pacsSubNameMedAllergen.setRuleType(ruleType);
|
|
|
+ pacsSubNameMedAllergenSet.add(pacsSubNameMedAllergen);
|
|
|
+ }
|
|
|
+ pacsSubName.setPacsSubNameMedallergens(pacsSubNameMedAllergenSet);
|
|
|
+ break;
|
|
|
+ case "辅助检查子项目名称禁忌临床表现":
|
|
|
+ ClinicalFinding clinicalFinding = clinicalFindingRepository.findByNameIs(e_name).get(0);
|
|
|
+ Set<PacsSubNameClinicalFinding> pacsSubNameClinicalFindingSet = pacsSubName.getPacsSubNameClinicalfindings();
|
|
|
+ isExist = false;
|
|
|
+ for (PacsSubNameClinicalFinding item : pacsSubNameClinicalFindingSet) {
|
|
|
+ if (item.getClinicalFinding() != null
|
|
|
+ && item.getClinicalFinding().getName().equals(e_name)) {
|
|
|
+ isExist = true;
|
|
|
+ item.setPacsSubName(pacsSubName);
|
|
|
+ item.setClinicalFinding(clinicalFinding);
|
|
|
+ item.setStatus(status);
|
|
|
+ item.setRuleType(ruleType);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!isExist) {
|
|
|
+ PacsSubNameClinicalFinding pacsSubNameClinicalFinding = new PacsSubNameClinicalFinding();
|
|
|
+ pacsSubNameClinicalFinding.setClinicalFinding(clinicalFinding);
|
|
|
+ pacsSubNameClinicalFinding.setPacsSubName(pacsSubName);
|
|
|
+ pacsSubNameClinicalFinding.setStatus(status);
|
|
|
+ pacsSubNameClinicalFinding.setRuleType(ruleType);
|
|
|
+ pacsSubNameClinicalFindingSet.add(pacsSubNameClinicalFinding);
|
|
|
+ }
|
|
|
+ pacsSubName.setPacsSubNameClinicalfindings(pacsSubNameClinicalFindingSet);
|
|
|
+ break;
|
|
|
+ case "辅助检查子项目名称禁忌实验室检查":
|
|
|
+ Lis lis = lisRepository.findByNameIs(e_name).get(0);
|
|
|
+ Set<PacsSubNameLis> pacsSubNameLisSet = pacsSubName.getPacsSubNameLis();
|
|
|
+ isExist = false;
|
|
|
+ for (PacsSubNameLis item : pacsSubNameLisSet) {
|
|
|
+ if (item.getLis() != null
|
|
|
+ && item.getLis().getName().equals(e_name)) {
|
|
|
+ isExist = true;
|
|
|
+ item.setPacsSubName(pacsSubName);
|
|
|
+ item.setLis(lis);
|
|
|
+ item.setStatus(status);
|
|
|
+ item.setRuleType(ruleType);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!isExist) {
|
|
|
+ PacsSubNameLis pacsSubNameLis = new PacsSubNameLis();
|
|
|
+ pacsSubNameLis.setLis(lis);
|
|
|
+ pacsSubNameLis.setPacsSubName(pacsSubName);
|
|
|
+ pacsSubNameLis.setStatus(status);
|
|
|
+ pacsSubNameLis.setRuleType(ruleType);
|
|
|
+ pacsSubNameLisSet.add(pacsSubNameLis);
|
|
|
+ }
|
|
|
+ pacsSubName.setPacsSubNameLis(pacsSubNameLisSet);
|
|
|
+ break;
|
|
|
+ case "辅助检查子项目名称禁忌疾病":
|
|
|
+ Disease disease = diseaseRepository.findByNameIs(e_name).get(0);
|
|
|
+ Set<PacsSubNameDisease> pacsSubNameDiseaseSet = pacsSubName.getPacsSubNameDiseases();
|
|
|
+ isExist = false;
|
|
|
+ for (PacsSubNameDisease item : pacsSubNameDiseaseSet) {
|
|
|
+ if (item.getDisease() != null
|
|
|
+ && item.getDisease().getName().equals(e_name)) {
|
|
|
+ isExist = true;
|
|
|
+ item.setPacsSubName(pacsSubName);
|
|
|
+ item.setDisease(disease);
|
|
|
+ item.setStatus(status);
|
|
|
+ item.setRuleType(ruleType);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!isExist) {
|
|
|
+ PacsSubNameDisease pacsSubNameDisease = new PacsSubNameDisease();
|
|
|
+ pacsSubNameDisease.setDisease(disease);
|
|
|
+ pacsSubNameDisease.setPacsSubName(pacsSubName);
|
|
|
+ pacsSubNameDisease.setStatus(status);
|
|
|
+ pacsSubNameDisease.setRuleType(ruleType);
|
|
|
+ pacsSubNameDiseaseSet.add(pacsSubNameDisease);
|
|
|
+ }
|
|
|
+ pacsSubName.setPacsSubNameDiseases(pacsSubNameDiseaseSet);
|
|
|
+ break;
|
|
|
+ case "辅助检查子项目名称禁忌禁忌医疗器械及物品":
|
|
|
+ ConflictDevice conflictDevice = conflictDeviceRepository.findByNameIs(e_name).get(0);
|
|
|
+ Set<PacsSubNameConflictDevice> pacsSubNameConflictDeviceSet = pacsSubName.getPacsSubNameConflictdevices();
|
|
|
+ isExist = false;
|
|
|
+ for (PacsSubNameConflictDevice item : pacsSubNameConflictDeviceSet) {
|
|
|
+ if (item.getConflictDevice() != null
|
|
|
+ && item.getConflictDevice().getName().equals(e_name)) {
|
|
|
+ isExist = true;
|
|
|
+ item.setPacsSubName(pacsSubName);
|
|
|
+ item.setConflictDevice(conflictDevice);
|
|
|
+ item.setStatus(status);
|
|
|
+ item.setRuleType(ruleType);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!isExist) {
|
|
|
+ PacsSubNameConflictDevice pacsSubNameConflictDevice = new PacsSubNameConflictDevice();
|
|
|
+ pacsSubNameConflictDevice.setConflictDevice(conflictDevice);
|
|
|
+ pacsSubNameConflictDevice.setPacsSubName(pacsSubName);
|
|
|
+ pacsSubNameConflictDevice.setStatus(status);
|
|
|
+ pacsSubNameConflictDevice.setRuleType(ruleType);
|
|
|
+ pacsSubNameConflictDeviceSet.add(pacsSubNameConflictDevice);
|
|
|
+ }
|
|
|
+ pacsSubName.setPacsSubNameConflictdevices(pacsSubNameConflictDeviceSet);
|
|
|
+ break;
|
|
|
+ case "辅助检查子项目名称禁忌体征":
|
|
|
+ Vital vital = vitalRepository.findByNameIs(e_name).get(0);
|
|
|
+ Set<PacsSubNameVital> pacsSubNameVitalSet = pacsSubName.getPacsSubNameVitals();
|
|
|
+ isExist = false;
|
|
|
+ for (PacsSubNameVital item : pacsSubNameVitalSet) {
|
|
|
+ if (item.getVital() != null
|
|
|
+ && item.getVital().getName().equals(e_name)) {
|
|
|
+ isExist = true;
|
|
|
+ item.setPacsSubName(pacsSubName);
|
|
|
+ item.setVital(vital);
|
|
|
+ item.setStatus(status);
|
|
|
+ item.setRuleType(ruleType);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!isExist) {
|
|
|
+ PacsSubNameVital pacsSubNameVital = new PacsSubNameVital();
|
|
|
+ pacsSubNameVital.setVital(vital);
|
|
|
+ pacsSubNameVital.setPacsSubName(pacsSubName);
|
|
|
+ pacsSubNameVital.setStatus(status);
|
|
|
+ pacsSubNameVital.setRuleType(ruleType);
|
|
|
+ pacsSubNameVitalSet.add(pacsSubNameVital);
|
|
|
+ }
|
|
|
+ pacsSubName.setPacsSubNameVitals(pacsSubNameVitalSet);
|
|
|
+ break;
|
|
|
+ case "辅助检查子项目名称禁忌服用药品":
|
|
|
+ OralMedicine oralMedicine = oralMedicineRepository.findByNameIs(e_name).get(0);
|
|
|
+ Set<PacsSubNameOralMedicine> pacsSubNameOralMedicineSet = pacsSubName.getPacsSubNameOralmedicines();
|
|
|
+ isExist = false;
|
|
|
+ for (PacsSubNameOralMedicine item : pacsSubNameOralMedicineSet) {
|
|
|
+ if (item.getOralMedicine() != null
|
|
|
+ && item.getOralMedicine().getName().equals(e_name)) {
|
|
|
+ isExist = true;
|
|
|
+ item.setPacsSubName(pacsSubName);
|
|
|
+ item.setOralMedicine(oralMedicine);
|
|
|
+ item.setStatus(status);
|
|
|
+ item.setRuleType(ruleType);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!isExist) {
|
|
|
+ PacsSubNameOralMedicine pacsSubNameOralMedicine = new PacsSubNameOralMedicine();
|
|
|
+ pacsSubNameOralMedicine.setOralMedicine(oralMedicine);
|
|
|
+ pacsSubNameOralMedicine.setPacsSubName(pacsSubName);
|
|
|
+ pacsSubNameOralMedicine.setStatus(status);
|
|
|
+ pacsSubNameOralMedicine.setRuleType(ruleType);
|
|
|
+ pacsSubNameOralMedicineSet.add(pacsSubNameOralMedicine);
|
|
|
+ }
|
|
|
+ pacsSubName.setPacsSubNameOralmedicines(pacsSubNameOralMedicineSet);
|
|
|
+ break;
|
|
|
+ case "辅助检查子项目名称禁忌辅助检查名称描述":
|
|
|
+ PacsDescribe pacsDescribe = pacsDescribeRepository.findByNameIs(e_name).get(0);
|
|
|
+ Set<PacsSubNamePacsDescribe> pacsSubNamePacsDescribeSet = pacsSubName.getPacsSubNamePacsdescribes();
|
|
|
+ isExist = false;
|
|
|
+ for (PacsSubNamePacsDescribe item : pacsSubNamePacsDescribeSet) {
|
|
|
+ if (item.getPacsDescribe() != null
|
|
|
+ && item.getPacsDescribe().getName().equals(e_name)) {
|
|
|
+ isExist = true;
|
|
|
+ item.setPacsSubName(pacsSubName);
|
|
|
+ item.setPacsDescribe(pacsDescribe);
|
|
|
+ item.setStatus(status);
|
|
|
+ item.setRuleType(ruleType);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!isExist) {
|
|
|
+ PacsSubNamePacsDescribe pacsSubNamePacsDescribe = new PacsSubNamePacsDescribe();
|
|
|
+ pacsSubNamePacsDescribe.setPacsDescribe(pacsDescribe);
|
|
|
+ pacsSubNamePacsDescribe.setPacsSubName(pacsSubName);
|
|
|
+ pacsSubNamePacsDescribe.setStatus(status);
|
|
|
+ pacsSubNamePacsDescribe.setRuleType(ruleType);
|
|
|
+ pacsSubNamePacsDescribeSet.add(pacsSubNamePacsDescribe);
|
|
|
+ }
|
|
|
+ pacsSubName.setPacsSubNamePacsdescribes(pacsSubNamePacsDescribeSet);
|
|
|
+ break;
|
|
|
+ case "辅助检查子项目名称禁忌过敏原":
|
|
|
+ Allergen allergen = allergenRepository.findByNameIs(e_name).get(0);
|
|
|
+ Set<PacsSubNameAllergen> pacsSubNameAllergenSet = pacsSubName.getPacsSubNameAllergens();
|
|
|
+ isExist = false;
|
|
|
+ for (PacsSubNameAllergen item : pacsSubNameAllergenSet) {
|
|
|
+ if (item.getAllergen() != null
|
|
|
+ && item.getAllergen().getName().equals(e_name)) {
|
|
|
+ isExist = true;
|
|
|
+ item.setPacsSubName(pacsSubName);
|
|
|
+ item.setAllergen(allergen);
|
|
|
+ item.setStatus(status);
|
|
|
+ item.setRuleType(ruleType);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!isExist) {
|
|
|
+ PacsSubNameAllergen pacsSubNameAllergen = new PacsSubNameAllergen();
|
|
|
+ pacsSubNameAllergen.setAllergen(allergen);
|
|
|
+ pacsSubNameAllergen.setPacsSubName(pacsSubName);
|
|
|
+ pacsSubNameAllergen.setStatus(status);
|
|
|
+ pacsSubNameAllergen.setRuleType(ruleType);
|
|
|
+ pacsSubNameAllergenSet.add(pacsSubNameAllergen);
|
|
|
+ }
|
|
|
+ pacsSubName.setPacsSubNameAllergens(pacsSubNameAllergenSet);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ pacsSubNameRepository.save(pacsSubName, 1);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ ex.printStackTrace();
|
|
|
+ } finally {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
|
|
|
|