}
return template;
}
public static EncompassingEncounter createEncompassingEncounter(NonCodedCDACommonFields commonFields) throws MissingMandatoryFieldException {
MissingMandatoryFieldException missingFields = new MissingMandatoryFieldException();
boolean from = commonFields.getEncounterFromTime()!=null;
boolean to = commonFields.getEncounterToTime()!=null;
// Null checks for mandatory fields
if (!from && !to) {
missingFields.addMissingField("encounterFromTime", "If an encounter is included, it must have a start and/or end time");
}
if (commonFields.getEncounterLocationType() == null) {
missingFields.addMissingField("encounterLocationType", "If an encounter is included, it must have a location type");
}
if (missingFields.hasEntries()) {
throw missingFields;
}
EncompassingEncounter template = new EncompassingEncounter();
// ID