use of com.nedap.archie.rm.composition.Evaluation in project ehrbase by ehrbase.
the class EntryAccess method setCompositionFields.
/**
* set the EntryRecord with fields from composition:<br>
* <ul>
* <li>category</li>
* <li>item type</li>
* <li>archetype node Id</li>
* <li>entry content (json)</li>
* </ul>
*
* @param record Target {@link EntryRecord}
* @param composition input data in {@link Composition} representation
*/
private void setCompositionFields(EntryRecord record, Composition composition) {
record.setCategory(record.getCategory());
if (composition.getContent() != null && !composition.getContent().isEmpty()) {
Object node = composition.getContent().get(0);
if (node instanceof Section) {
record.setItemType(EntryType.valueOf("section"));
} else if (node instanceof Evaluation || node instanceof Observation || node instanceof Instruction || node instanceof Action) {
record.setItemType(EntryType.valueOf("care_entry"));
} else if (node instanceof AdminEntry) {
record.setItemType(EntryType.valueOf("admin"));
}
} else {
record.setItemType(EntryType.valueOf("admin"));
}
record.setArchetypeId(composition.getArchetypeNodeId());
RawJson rawJson = new RawJson();
record.setEntry(JSONB.valueOf(rawJson.marshal(composition)));
}
Aggregations