Search in sources :

Example 1 with Evaluation

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)));
}
Also used : Evaluation(com.nedap.archie.rm.composition.Evaluation) Action(com.nedap.archie.rm.composition.Action) RawJson(org.ehrbase.serialisation.dbencoding.RawJson) AdminEntry(com.nedap.archie.rm.composition.AdminEntry) Observation(com.nedap.archie.rm.composition.Observation) Instruction(com.nedap.archie.rm.composition.Instruction) Section(com.nedap.archie.rm.composition.Section)

Aggregations

Action (com.nedap.archie.rm.composition.Action)1 AdminEntry (com.nedap.archie.rm.composition.AdminEntry)1 Evaluation (com.nedap.archie.rm.composition.Evaluation)1 Instruction (com.nedap.archie.rm.composition.Instruction)1 Observation (com.nedap.archie.rm.composition.Observation)1 Section (com.nedap.archie.rm.composition.Section)1 RawJson (org.ehrbase.serialisation.dbencoding.RawJson)1