started writing AllergyIntolerance conversion
This commit is contained in:
parent
bb953fc7fc
commit
05994163dd
|
@ -3072,6 +3072,8 @@ public class VersionConvertor_10_30 {
|
|||
return Appointment10_30.convertAppointment((org.hl7.fhir.dstu2.model.Appointment) src);
|
||||
if (src instanceof org.hl7.fhir.dstu2.model.AppointmentResponse)
|
||||
return AppointmentResponse10_30.convertAppointmentResponse((org.hl7.fhir.dstu2.model.AppointmentResponse) src);
|
||||
if (src instanceof org.hl7.fhir.dstu2.model.AllergyIntolerance)
|
||||
return AllergyIntolerance10_30.convertAllergyIntolerance((org.hl7.fhir.dstu2.model.AllergyIntolerance) src);
|
||||
if (src instanceof org.hl7.fhir.dstu2.model.AuditEvent)
|
||||
return AuditEvent10_30.convertAuditEvent((org.hl7.fhir.dstu2.model.AuditEvent) src);
|
||||
if (src instanceof org.hl7.fhir.dstu2.model.Basic)
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.Collections;
|
|||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.hl7.fhir.convertors.conv10_40.AllergyIntolerance10_40;
|
||||
import org.hl7.fhir.convertors.conv10_40.Appointment10_40;
|
||||
import org.hl7.fhir.convertors.conv10_40.AppointmentResponse10_40;
|
||||
import org.hl7.fhir.convertors.conv10_40.AuditEvent10_40;
|
||||
|
@ -3174,6 +3175,8 @@ public class VersionConvertor_10_40 {
|
|||
return Parameters10_40.convertParameters((org.hl7.fhir.dstu2.model.Parameters) src);
|
||||
if (src instanceof org.hl7.fhir.dstu2.model.Appointment)
|
||||
return Appointment10_40.convertAppointment((org.hl7.fhir.dstu2.model.Appointment) src);
|
||||
if (src instanceof org.hl7.fhir.dstu2.model.AllergyIntolerance)
|
||||
return AllergyIntolerance10_40.convertAllergyIntolerance((org.hl7.fhir.dstu2.model.AllergyIntolerance) src);
|
||||
if (src instanceof org.hl7.fhir.dstu2.model.AppointmentResponse)
|
||||
return AppointmentResponse10_40.convertAppointmentResponse((org.hl7.fhir.dstu2.model.AppointmentResponse) src);
|
||||
if (src instanceof org.hl7.fhir.dstu2.model.AuditEvent)
|
||||
|
|
|
@ -0,0 +1,121 @@
|
|||
package org.hl7.fhir.convertors.conv10_30;
|
||||
|
||||
import org.hl7.fhir.convertors.VersionConvertor_10_30;
|
||||
import org.hl7.fhir.dstu2.model.AllergyIntolerance;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
|
||||
public class AllergyIntolerance10_30 {
|
||||
public static org.hl7.fhir.dstu3.model.AllergyIntolerance convertAllergyIntolerance(org.hl7.fhir.dstu2.model.AllergyIntolerance src) throws FHIRException {
|
||||
if (src == null)
|
||||
return null;
|
||||
org.hl7.fhir.dstu3.model.AllergyIntolerance tgt = new org.hl7.fhir.dstu3.model.AllergyIntolerance();
|
||||
VersionConvertor_10_30.copyDomainResource(src, tgt);
|
||||
for (org.hl7.fhir.dstu2.model.Identifier identifier : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(identifier));
|
||||
if (src.hasOnset())
|
||||
tgt.setOnset(new org.hl7.fhir.dstu3.model.DateTimeType(src.getOnset()));
|
||||
if (src.hasRecordedDate())
|
||||
tgt.setAssertedDate(src.getRecordedDate());
|
||||
if (src.hasRecorder())
|
||||
tgt.setRecorder(VersionConvertor_10_30.convertReference(src.getRecorder()));
|
||||
if (src.hasPatient())
|
||||
tgt.setPatient(VersionConvertor_10_30.convertReference(src.getPatient()));
|
||||
if (src.hasReporter())
|
||||
tgt.setAsserter(VersionConvertor_10_30.convertReference(src.getReporter()));
|
||||
if (src.hasSubstance())
|
||||
tgt.setCode(VersionConvertor_10_30.convertCodeableConcept(src.getSubstance()));
|
||||
if (src.hasStatus()) {
|
||||
if (src.getStatus() != org.hl7.fhir.dstu2.model.AllergyIntolerance.AllergyIntoleranceStatus.REFUTED
|
||||
&& src.getStatus() != org.hl7.fhir.dstu2.model.AllergyIntolerance.AllergyIntoleranceStatus.ENTEREDINERROR) {
|
||||
tgt.setClinicalStatus(translateAllergyIntoleranceClinicalStatus(src.getStatus()));
|
||||
}
|
||||
if (src.getStatus() != org.hl7.fhir.dstu2.model.AllergyIntolerance.AllergyIntoleranceStatus.ACTIVE
|
||||
&& src.getStatus() != org.hl7.fhir.dstu2.model.AllergyIntolerance.AllergyIntoleranceStatus.RESOLVED) {
|
||||
tgt.setVerificationStatus(translateAllergyIntoleranceVerificationStatus(src.getStatus()));
|
||||
}
|
||||
}
|
||||
if (src.hasCriticality())
|
||||
tgt.setCriticality(translateAllergyIntoleranceCriticality(src.getCriticality()));
|
||||
if (src.hasType())
|
||||
tgt.setType(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceType.fromCode(src.getType().toCode()));
|
||||
if (src.hasCategory())
|
||||
tgt.addCategory(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory.fromCode(src.getCategory().toCode()));
|
||||
if (src.hasLastOccurence())
|
||||
tgt.setLastOccurrence(src.getLastOccurence());
|
||||
if (src.hasNote())
|
||||
tgt.addNote(VersionConvertor_10_30.convertAnnotation(src.getNote()));
|
||||
for (org.hl7.fhir.dstu2.model.AllergyIntolerance.AllergyIntoleranceReactionComponent reaction : src.getReaction())
|
||||
tgt.addReaction(algReaction(reaction));
|
||||
return tgt;
|
||||
}
|
||||
|
||||
private static org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceReactionComponent algReaction(AllergyIntolerance.AllergyIntoleranceReactionComponent src) {
|
||||
if (src == null)
|
||||
return null;
|
||||
org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceReactionComponent tgt = new org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceReactionComponent();
|
||||
VersionConvertor_10_30.copyElement(src, tgt);
|
||||
for (org.hl7.fhir.dstu2.model.Extension extension : src.getModifierExtension()) tgt.addExtension(VersionConvertor_10_30.convertExtension(extension));
|
||||
if (src.hasSubstance())
|
||||
tgt.setSubstance(VersionConvertor_10_30.convertCodeableConcept(src.getSubstance()));
|
||||
if (src.hasCertainty())
|
||||
tgt.addExtension(new org.hl7.fhir.dstu3.model.Extension(
|
||||
"http://hl7.org/fhir/AllergyIntolerance-r2-certainty",
|
||||
new org.hl7.fhir.dstu3.model.StringType(src.getCertainty().toCode())
|
||||
));
|
||||
for (org.hl7.fhir.dstu2.model.CodeableConcept concept : src.getManifestation()) tgt.addManifestation(VersionConvertor_10_30.convertCodeableConcept(concept));
|
||||
if (src.hasDescription())
|
||||
src.setDescription(src.getDescription());
|
||||
if (src.hasOnset())
|
||||
tgt.setOnset(src.getOnset());
|
||||
if (src.hasSeverity())
|
||||
tgt.setSeverity(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceSeverity.fromCode(src.getSeverity().toCode()));
|
||||
if (src.hasExposureRoute())
|
||||
tgt.setExposureRoute(VersionConvertor_10_30.convertCodeableConcept(src.getExposureRoute()));
|
||||
if (src.hasNote())
|
||||
tgt.addNote(VersionConvertor_10_30.convertAnnotation(src.getNote()));
|
||||
return tgt;
|
||||
}
|
||||
|
||||
public static org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus translateAllergyIntoleranceVerificationStatus(org.hl7.fhir.dstu2.model.AllergyIntolerance.AllergyIntoleranceStatus src) {
|
||||
switch(src) {
|
||||
case UNCONFIRMED:
|
||||
case INACTIVE:
|
||||
return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus.UNCONFIRMED;
|
||||
case CONFIRMED:
|
||||
return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus.CONFIRMED;
|
||||
case REFUTED:
|
||||
return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus.REFUTED;
|
||||
case ENTEREDINERROR:
|
||||
return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus.ENTEREDINERROR;
|
||||
default:
|
||||
return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus.NULL;
|
||||
}
|
||||
}
|
||||
|
||||
public static org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus translateAllergyIntoleranceClinicalStatus(org.hl7.fhir.dstu2.model.AllergyIntolerance.AllergyIntoleranceStatus src) {
|
||||
switch(src) {
|
||||
case ACTIVE:
|
||||
case UNCONFIRMED:
|
||||
case CONFIRMED:
|
||||
return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus.ACTIVE;
|
||||
case INACTIVE:
|
||||
return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus.INACTIVE;
|
||||
case RESOLVED:
|
||||
return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus.RESOLVED;
|
||||
default:
|
||||
return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus.NULL;
|
||||
}
|
||||
}
|
||||
public static org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality translateAllergyIntoleranceCriticality(org.hl7.fhir.dstu2.model.AllergyIntolerance.AllergyIntoleranceCriticality src) {
|
||||
switch(src) {
|
||||
case CRITL:
|
||||
return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality.LOW;
|
||||
case CRITH:
|
||||
return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality.HIGH;
|
||||
case CRITU:
|
||||
return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality.UNABLETOASSESS;
|
||||
default:
|
||||
return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality.NULL;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
package org.hl7.fhir.convertors.conv10_40;
|
||||
|
||||
import org.hl7.fhir.convertors.VersionConvertor_10_40;
|
||||
import org.hl7.fhir.dstu2.model.AllergyIntolerance;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
|
||||
public class AllergyIntolerance10_40 {
|
||||
public static org.hl7.fhir.r4.model.AllergyIntolerance convertAllergyIntolerance(org.hl7.fhir.dstu2.model.AllergyIntolerance src) throws FHIRException {
|
||||
if (src == null)
|
||||
return null;
|
||||
org.hl7.fhir.r4.model.AllergyIntolerance tgt = new org.hl7.fhir.r4.model.AllergyIntolerance();
|
||||
for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t));
|
||||
if (src.hasOnset())
|
||||
tgt.setOnset(VersionConvertor_10_40.convertType(src.getOnsetElement()));
|
||||
if (src.hasRecordedDate())
|
||||
tgt.setRecordedDate(src.getRecordedDate());
|
||||
if (src.hasRecorder())
|
||||
tgt.setRecorder(VersionConvertor_10_40.convertReference(src.getRecorder()));
|
||||
if (src.hasPatient())
|
||||
tgt.setPatient(VersionConvertor_10_40.convertReference(src.getPatient()));
|
||||
if (src.hasReporter())
|
||||
tgt.setAsserter(VersionConvertor_10_40.convertReference(src.getReporter()));
|
||||
if (src.hasSubstance())
|
||||
tgt.setCode(VersionConvertor_10_40.convertCodeableConcept(src.getSubstance()));
|
||||
if (src.hasStatus()) {
|
||||
if (src.getStatus() != org.hl7.fhir.dstu2.model.AllergyIntolerance.AllergyIntoleranceStatus.REFUTED
|
||||
&& src.getStatus() != org.hl7.fhir.dstu2.model.AllergyIntolerance.AllergyIntoleranceStatus.ENTEREDINERROR) {
|
||||
org.hl7.fhir.r4.model.Coding code = new org.hl7.fhir.r4.model.Coding();
|
||||
code.setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical");
|
||||
code.setCode(src.getStatus().toCode());
|
||||
tgt.setClinicalStatus(new org.hl7.fhir.r4.model.CodeableConcept(code));
|
||||
}
|
||||
if (src.getStatus() != org.hl7.fhir.dstu2.model.AllergyIntolerance.AllergyIntoleranceStatus.ACTIVE
|
||||
&& src.getStatus() != org.hl7.fhir.dstu2.model.AllergyIntolerance.AllergyIntoleranceStatus.RESOLVED) {
|
||||
org.hl7.fhir.r4.model.Coding code = new org.hl7.fhir.r4.model.Coding();
|
||||
code.setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification");
|
||||
code.setCode(src.getStatus().toCode());
|
||||
tgt.setVerificationStatus(new org.hl7.fhir.r4.model.CodeableConcept(code));
|
||||
}
|
||||
}
|
||||
if (src.hasCriticality())
|
||||
tgt.setCriticality(translateAllergyIntoleranceCriticality(src.getCriticality()));
|
||||
if (src.hasType())
|
||||
tgt.setType(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceType.fromCode(src.getType().toCode()));
|
||||
if (src.hasCategory())
|
||||
tgt.addCategory(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCategory.fromCode(src.getCategory().toCode()));
|
||||
if (src.hasLastOccurence())
|
||||
tgt.setLastOccurrence(src.getLastOccurence());
|
||||
if (src.hasNote())
|
||||
tgt.addNote(VersionConvertor_10_40.convertAnnotation(src.getNote()));
|
||||
for (org.hl7.fhir.dstu2.model.AllergyIntolerance.AllergyIntoleranceReactionComponent reaction : src.getReaction())
|
||||
tgt.addReaction(algReaction(reaction));
|
||||
return tgt;
|
||||
}
|
||||
|
||||
private static org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceReactionComponent algReaction(AllergyIntolerance.AllergyIntoleranceReactionComponent src) {
|
||||
if (src == null)
|
||||
return null;
|
||||
org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceReactionComponent tgt = new org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceReactionComponent();
|
||||
VersionConvertor_10_40.copyElement(src, tgt);
|
||||
for (org.hl7.fhir.dstu2.model.Extension extension : src.getModifierExtension()) tgt.addExtension(VersionConvertor_10_40.convertExtension(extension));
|
||||
if (src.hasSubstance())
|
||||
tgt.setSubstance(VersionConvertor_10_40.convertCodeableConcept(src.getSubstance()));
|
||||
if (src.hasCertainty())
|
||||
tgt.addExtension(new org.hl7.fhir.r4.model.Extension(
|
||||
"http://hl7.org/fhir/AllergyIntolerance-r2-certainty",
|
||||
new org.hl7.fhir.r4.model.StringType(src.getCertainty().toCode())
|
||||
));
|
||||
for (org.hl7.fhir.dstu2.model.CodeableConcept concept : src.getManifestation()) tgt.addManifestation(VersionConvertor_10_40.convertCodeableConcept(concept));
|
||||
if (src.hasDescription())
|
||||
src.setDescription(src.getDescription());
|
||||
if (src.hasOnset())
|
||||
tgt.setOnset(src.getOnset());
|
||||
if (src.hasSeverity())
|
||||
tgt.setSeverity(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceSeverity.fromCode(src.getSeverity().toCode()));
|
||||
if (src.hasExposureRoute())
|
||||
tgt.setExposureRoute(VersionConvertor_10_40.convertCodeableConcept(src.getExposureRoute()));
|
||||
if (src.hasNote())
|
||||
tgt.addNote(VersionConvertor_10_40.convertAnnotation(src.getNote()));
|
||||
return tgt;
|
||||
}
|
||||
|
||||
public static org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCriticality translateAllergyIntoleranceCriticality(org.hl7.fhir.dstu2.model.AllergyIntolerance.AllergyIntoleranceCriticality src) {
|
||||
switch(src) {
|
||||
case CRITL:
|
||||
return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCriticality.LOW;
|
||||
case CRITH:
|
||||
return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCriticality.HIGH;
|
||||
case CRITU:
|
||||
return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCriticality.UNABLETOASSESS;
|
||||
default:
|
||||
return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCriticality.NULL;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
package org.hl7.fhir.convertors.conv10_30;
|
||||
|
||||
public class AllergyIntolerance10_30Test {
|
||||
}
|
Loading…
Reference in New Issue