Skip to content

Commit 98f45c4

Browse files
Merge branch 'development' into bugfix-13734-add-therapy-and-clinical-course-tabs-visibility
2 parents 909c26c + 536a1b6 commit 98f45c4

File tree

14 files changed

+354
-120
lines changed

14 files changed

+354
-120
lines changed

sormas-api/src/main/java/de/symeda/sormas/api/externalmessage/processing/doctordeclaration/AbstractDoctorDeclarationMessageProcessingFlow.java

Lines changed: 27 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -373,41 +373,22 @@ protected void postBuildHospitalization(CaseDataDto caseDto, ExternalMessageDto
373373

374374
final FacilityReferenceDto hospitalFacilityReference = getHospitalFacilityReference(externalMessageDto);
375375

376-
if (externalMessageDto.getAdmittedToHealthFacility() == null
377-
&& externalMessageDto.getHospitalizationFacilityName() == null
376+
if (externalMessageDto.getHospitalizationFacilityName() == null
378377
&& externalMessageDto.getHospitalizationFacilityExternalId() == null
379-
&& externalMessageDto.getHospitalizationFacilityDepartment() == null
380-
&& externalMessageDto.getHospitalizationAdmissionDate() == null
381-
&& externalMessageDto.getHospitalizationDischargeDate() == null) {
378+
&& externalMessageDto.getHospitalizationFacilityDepartment() == null) {
382379
logger.info("[POST BUILD HOSPITALIZATION] No hospitalization information found for case with UUID: {}.", caseDto.getUuid());
383380
return;
384381
}
385382

386-
// If we do not have a hospital facility reference, we quit early
387-
if (hospitalFacilityReference == null) {
388-
logger.warn(
389-
"[POST BUILD HOSPITALIZATION] No hospital facility found for case with UUID: {}. Hospitalization details will not be set.",
390-
caseDto.getUuid());
391-
return;
392-
}
393-
394383
HospitalizationDto hospitalizationDto = caseDto.getHospitalization();
395384
if (hospitalizationDto == null) {
396385
hospitalizationDto = HospitalizationDto.build();
397386
caseDto.setHospitalization(hospitalizationDto);
398387
logger.debug("[POST BUILD HOSPITALIZATION] Hospitalization initialized for case with UUID: {}", caseDto.getUuid());
399388
}
400389

401-
final FacilityDto hospitalFacility = getExternalMessageProcessingFacade().getFacilityByUuid(hospitalFacilityReference.getUuid());
402-
403-
// if for whatever reason the hospital facility is not found, we quit early
404-
if (hospitalFacility == null) {
405-
logger.warn(
406-
"[POST BUILD HOSPITALIZATION] Hospital facility with UUID: {} not found for case with UUID: {}. Hospitalization details will not be set.",
407-
hospitalFacilityReference.getUuid(),
408-
caseDto.getUuid());
409-
return;
410-
}
390+
final FacilityDto hospitalFacility =
391+
hospitalFacilityReference != null ? getExternalMessageProcessingFacade().getFacilityByUuid(hospitalFacilityReference.getUuid()) : null;
411392

412393
// In case the patient is admitted to a health facility, we need to set the case hospitalization details and quit early
413394
if (YesNoUnknown.YES.equals(externalMessageDto.getAdmittedToHealthFacility())) {
@@ -424,27 +405,42 @@ protected void postBuildHospitalization(CaseDataDto caseDto, ExternalMessageDto
424405
hospitalizationDto.setCurrentlyHospitalized(YesNoUnknown.YES);
425406
}
426407

408+
caseDto.setDepartment(externalMessageDto.getHospitalizationFacilityDepartment());
409+
caseDto.setFacilityType(FacilityType.HOSPITAL);
410+
411+
// if for whatever reason the hospital facility is not found, we quit early
412+
if (hospitalFacility == null) {
413+
logger.warn(
414+
"[POST BUILD HOSPITALIZATION] Hospital facility not found for case with UUID: {}. Hospitalization details will not be set.",
415+
caseDto.getUuid());
416+
return;
417+
}
418+
419+
// we have a facility, so we set the responsible region, district and community
427420
caseDto.setResponsibleRegion(hospitalFacility.getRegion());
428421
caseDto.setResponsibleDistrict(hospitalFacility.getDistrict());
429422
caseDto.setResponsibleCommunity(hospitalFacility.getCommunity());
430423
caseDto.setHealthFacility(hospitalFacilityReference);
431-
caseDto.setDepartment(externalMessageDto.getHospitalizationFacilityDepartment());
432-
caseDto.setFacilityType(FacilityType.HOSPITAL);
424+
433425
return;
434426
}
435427

436428
// the patient is not admitted to a health facility, so we create a previous hospitalization entry
437429
final PreviousHospitalizationDto previousHospitalization = new PreviousHospitalizationDto();
438430
previousHospitalization.setUuid(DataHelper.createUuid());
439431

440-
previousHospitalization.setAdmittedToHealthFacility(externalMessageDto.getAdmittedToHealthFacility());
432+
// Here we set the admitted to health facility to yes, because currently he is not admitted to a health facility thus meaning that this is a previous hospitalization
433+
previousHospitalization.setAdmittedToHealthFacility(YesNoUnknown.YES);
441434
previousHospitalization.setAdmissionDate(externalMessageDto.getHospitalizationAdmissionDate());
442435
previousHospitalization.setDischargeDate(externalMessageDto.getHospitalizationDischargeDate());
443436

444-
previousHospitalization.setRegion(hospitalFacility.getRegion());
445-
previousHospitalization.setDistrict(hospitalFacility.getDistrict());
446-
previousHospitalization.setCommunity(hospitalFacility.getCommunity());
447-
previousHospitalization.setHealthFacility(hospitalFacilityReference);
437+
if (hospitalFacility != null) {
438+
previousHospitalization.setRegion(hospitalFacility.getRegion());
439+
previousHospitalization.setDistrict(hospitalFacility.getDistrict());
440+
previousHospitalization.setCommunity(hospitalFacility.getCommunity());
441+
previousHospitalization.setHealthFacility(hospitalFacilityReference);
442+
}
443+
448444
previousHospitalization.setHealthFacilityDepartment(externalMessageDto.getHospitalizationFacilityDepartment());
449445

450446
if (hospitalizationDto.getPreviousHospitalizations() == null) {
@@ -464,18 +460,7 @@ protected void postBuildHospitalization(CaseDataDto caseDto, ExternalMessageDto
464460
*/
465461
@Override
466462
protected void postBuildPerson(PersonDto personDto, ExternalMessageDto externalMessageDto) {
467-
468-
logger.debug("[POST BUILD PERSON] Processing person with UUID: {}", personDto.getUuid());
469-
470-
if (externalMessageDto.getPersonGuardianFirstName() != null && externalMessageDto.getPersonGuardianLastName() != null) {
471-
personDto.setNamesOfGuardians(externalMessageDto.getPersonGuardianFirstName() + " " + externalMessageDto.getPersonGuardianLastName());
472-
473-
logger.debug(
474-
"[POST BUILD PERSON] Guardian names set for person with UUID: {} - Guardian: {} {}",
475-
personDto.getUuid(),
476-
externalMessageDto.getPersonGuardianFirstName(),
477-
externalMessageDto.getPersonGuardianLastName());
478-
}
463+
// No additional actions needed for person data
479464
}
480465

481466
/**

sormas-api/src/main/java/de/symeda/sormas/api/i18n/Strings.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,6 +1035,8 @@ public interface Strings {
10351035
String infoExposureInvestigationContacts = "infoExposureInvestigationContacts";
10361036
String infoExposuresInfectionEnvironmentHint = "infoExposuresInfectionEnvironmentHint";
10371037
String infoExposuresRiskAreaHint = "infoExposuresRiskAreaHint";
1038+
String infoExternalMessageHospitalizationFacilityMissing = "infoExternalMessageHospitalizationFacilityMissing";
1039+
String infoExternalMessageHospitalizationMissingHospital = "infoExternalMessageHospitalizationMissingHospital";
10381040
String infoFacilityCsvImport = "infoFacilityCsvImport";
10391041
String infoFacilityNeedsDistrict = "infoFacilityNeedsDistrict";
10401042
String infoHeadingAefiDashboardMap = "infoHeadingAefiDashboardMap";

sormas-api/src/main/java/de/symeda/sormas/api/symptoms/SymptomsDto.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2649,6 +2649,7 @@ public static SymptomsDto build() {
26492649
private String otherClinicalPresentationText;
26502650

26512651
@Diseases({
2652+
PERTUSSIS,
26522653
INVASIVE_PNEUMOCOCCAL_INFECTION,
26532654
INVASIVE_MENINGOCOCCAL_INFECTION,
26542655
MEASLES })

sormas-api/src/main/resources/strings.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,6 +1155,8 @@ infoNoSurveys=There are no surveys created or sent for this case
11551155
infoSurveyResponseReceived=Response received
11561156
infoSurveyResponseNotReceived=No response received yet
11571157
infoNoDiseaseConfigurationAgeGroups=Click on the + button below to add age groups to this disease configuration.
1158+
infoExternalMessageHospitalizationFacilityMissing=The external message contains a hospitalization entry without a hospital name.\nThe processing can continue but the hospital facility will not be set.
1159+
infoExternalMessageHospitalizationMissingHospital=Hospital facility missing for hospital '%s'.\nPlease contact your system administrator to configure the hospital facility.
11581160

11591161
# Messages
11601162
messageActionOutsideJurisdictionDeletionDenied = The action outside user's jurisdiction cannot be deleted

sormas-app/app/src/main/java/de/symeda/sormas/app/backend/common/DatabaseHelper.java

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
190190
public static final String DATABASE_NAME = "sormas.db";
191191
// any time you make changes to your database objects, you may have to increase the database version
192192

193-
public static final int DATABASE_VERSION = 359;
193+
public static final int DATABASE_VERSION = 360;
194194

195195
private static DatabaseHelper instance = null;
196196

@@ -398,7 +398,7 @@ public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource, int
398398
// IMPORTANT: table and column names are CASE SENSITIVE!
399399
int currentVersion = oldVersion;
400400
try {
401-
switch (oldVersion) {
401+
switch (newVersion) {
402402
case 91:
403403
currentVersion = 91;
404404
getDao(District.class).executeRaw("ALTER TABLE district ADD COLUMN epidCode varchar(255);");
@@ -3201,8 +3201,28 @@ public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource, int
32013201
getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN septicaemia varchar(255);");
32023202
getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN whoopsound varchar(255);");
32033203

3204-
// ATTENTION: break should only be done after last version
3205-
break;
3204+
case 360:
3205+
currentVersion = 360;
3206+
getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN acuteEncephalitis varchar(255);");
3207+
getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN eggyBurps varchar(255);");
3208+
getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN weightLoss varchar(255);");
3209+
getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN weightLossAmount float8;");
3210+
getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN reoccurrence varchar(255);");
3211+
getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN symptomCurrentStatus varchar(255);");
3212+
getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN durationOfSymptoms int;");
3213+
getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN overnightStayRequired varchar(255);");
3214+
getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN bloating varchar(255);");
3215+
getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN difficultyBreathingDuringMeals varchar(255);");
3216+
getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN paradoxicalBreathing varchar(255);");
3217+
getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN respiratoryFatigue varchar(255);");
3218+
getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN parentTimeOffWork varchar(255);");
3219+
getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN timeOffWorkDays float8;");
3220+
getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN unknownSymptom varchar(255);");
3221+
getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN skinRashOnsetDate timestamp;");
3222+
3223+
3224+
// ATTENTION: break should only be done after last version
3225+
break;
32063226

32073227

32083228

sormas-app/app/src/main/java/de/symeda/sormas/app/backend/contact/ContactDao.java

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,19 @@ private QueryBuilder<Contact, Long> buildQueryBuilder(ContactCriteria contactCri
219219

220220
// Only use user filter if no restricting case is specified
221221
if (contactCriteria.getIncludeContactsFromOtherJurisdictions().equals(false)) {
222-
whereStatements.add(where.or(createJurisdictionFilterForCase(where), createJurisdictionFilter(where)));
222+
// whereStatements.add(where.or(createJurisdictionFilterForCase(where), createJurisdictionFilter(where)));
223+
Where<Contact, Long> caseJurisdictionWhere = createJurisdictionFilterForCase(where);
224+
Where<Contact, Long> jurisdictionWhere = createJurisdictionFilter(where);
225+
if (caseJurisdictionWhere != null && jurisdictionWhere != null) {
226+
whereStatements.add(where.or(caseJurisdictionWhere, jurisdictionWhere));
227+
} else {
228+
if (caseJurisdictionWhere != null) {
229+
whereStatements.add(caseJurisdictionWhere);
230+
}
231+
if (jurisdictionWhere != null) {
232+
whereStatements.add(jurisdictionWhere);
233+
}
234+
}
223235
}
224236

225237
if (contactCriteria != null) {
@@ -283,8 +295,9 @@ public Where<Contact, Long> createJurisdictionFilterForCase(Where<Contact, Long>
283295

284296
if (!whereJurisdictionFilterStatements.isEmpty()) {
285297
where.or(whereJurisdictionFilterStatements.size());
298+
return where;
286299
}
287-
return where;
300+
return null;
288301
}
289302

290303
public Where<Contact, Long> createJurisdictionFilter(Where<Contact, Long> where) throws SQLException {
@@ -316,9 +329,10 @@ public Where<Contact, Long> createJurisdictionFilter(Where<Contact, Long> where)
316329

317330
if (!whereUserFilterStatements.isEmpty()) {
318331
where.or(whereUserFilterStatements.size());
332+
return where;
319333
}
320334

321-
return where;
335+
return null;
322336
}
323337

324338
public Where<Contact, Long> createCriteriaFilter(List<Where<Contact, Long>> whereStatements, Where<Contact, Long> where, ContactCriteria criteria)

0 commit comments

Comments
 (0)