use of org.hl7.v3.CD in project eCRNow by drajer-health.
the class CdaFhirUtilities method getPractitionersForType.
public static List<Practitioner> getPractitionersForType(R4FhirData data, V3ParticipationType type) {
List<Practitioner> practs = new ArrayList<>();
if (data != null && data.getEncounter() != null) {
List<EncounterParticipantComponent> participants = data.getEncounter().getParticipant();
if (participants != null && !participants.isEmpty()) {
for (EncounterParticipantComponent part : participants) {
if (part.getIndividual() != null && part.getIndividual().getReference() != null) {
logger.debug("Individual is present");
List<CodeableConcept> types = part.getType();
if (types != null && !types.isEmpty()) {
logger.debug("Codeable Concepts present for individuals");
for (CodeableConcept conc : types) {
logger.debug("Get Coding information for codeable concept");
List<Coding> typeCodes = conc.getCoding();
if (typeCodes != null && !typeCodes.isEmpty()) {
for (Coding cd : typeCodes) {
if (cd.getSystem() != null && (cd.getSystem().contentEquals(CdaGeneratorConstants.FHIR_PARTICIPANT_TYPE) || cd.getSystem().contentEquals(CdaGeneratorConstants.FHIR_PARTICIPANT_TYPE_V3))) {
logger.debug("Found Practitioner for Participation code system");
if (cd.getCode() != null && cd.getCode().contentEquals(type.toString())) {
logger.debug("Found Practitioner for Code and CodeSystem");
logger.debug("part.getIndividual = {}", part.getIndividual().getDisplay());
if (part.getIndividual().getReferenceElement() != null)
logger.debug("part.getIndividual = {}", part.getIndividual().getReferenceElement());
if (part.getIndividual().getReferenceElement() != null && part.getIndividual().getReferenceElement().getIdPart() != null) {
Practitioner pr = data.getPractitionerById(part.getIndividual().getReferenceElement().getIdPart());
if (pr != null) {
logger.info("Found Practitioner for Type {}", type);
practs.add(pr);
}
// Found Practitioenr
} else // Valid Reference
{
logger.debug("Individual Ref Id is null");
}
} else // Found Type that we need
{
logger.debug("Did not find the code for type {}", type);
}
} else // Found participants that use standard code systems
{
logger.debug("Did not find participants using standard code system ");
}
}
// For all Codings
}
// Codings present
}
// For all Codeable Concepts
}
// Codeable Concept present
}
// PArticipant is an individual
}
// For all EncounteR ParticipantComponents
}
// Participants not empty
}
return practs;
}
use of org.hl7.v3.CD in project eCRNow by drajer-health.
the class CdaFhirUtilities method getXmlForType.
public static String getXmlForType(Type dt, String elName, Boolean valFlag) {
String val = "";
if (dt != null) {
if (dt instanceof Coding) {
Coding cd = (Coding) dt;
List<Coding> cds = new ArrayList<>();
cds.add(cd);
if (!valFlag)
val += getCodingXml(cds, elName, "");
else
val += getCodingXmlForValue(cds, elName);
} else if (dt instanceof CodeableConcept) {
CodeableConcept cd = (CodeableConcept) dt;
List<Coding> cds = cd.getCoding();
if (!valFlag)
val += getCodingXml(cds, elName, "");
else
val += getCodingXmlForValue(cds, elName);
} else if (dt instanceof Quantity) {
Quantity qt = (Quantity) dt;
val += getQuantityXml(qt, elName, valFlag);
} else if (dt instanceof DateTimeType) {
DateTimeType d = (DateTimeType) dt;
val += CdaGeneratorUtils.getXmlForEffectiveTime(elName, d.getValue(), d.getTimeZone());
} else if (dt instanceof Period) {
Period pt = (Period) dt;
val += getPeriodXml(pt, elName);
} else if (dt instanceof Timing) {
Timing t = (Timing) (dt);
if (t.getRepeat() != null && t.getRepeat().getBounds() != null) {
logger.debug("Found the bounds element for creating xml");
String v = getXmlForType(t.getRepeat().getBounds(), elName, valFlag);
val += v;
}
} else if (dt instanceof CodeType) {
CodeType cd = (CodeType) dt;
if (!valFlag)
val += CdaGeneratorUtils.getXmlForCD(elName, cd.getCode());
else
val += CdaGeneratorUtils.getXmlForValueString(cd.getCode());
} else if (dt instanceof StringType) {
StringType st = (StringType) dt;
if (!valFlag)
val += CdaGeneratorUtils.getXmlForText(elName, st.getValue());
else
val += CdaGeneratorUtils.getXmlForValueString(st.getValue());
}
logger.debug("Printing the class name {}", dt.getClass());
return val;
}
if (!valFlag)
val += CdaGeneratorUtils.getNFXMLForElement(elName, CdaGeneratorConstants.NF_NI);
else
val += CdaGeneratorUtils.getNFXmlForValueString(CdaGeneratorConstants.NF_NI);
return val;
}
use of org.hl7.v3.CD in project eCRNow by drajer-health.
the class FhirGeneratorUtils method getCodeableConcept.
public static CodeableConcept getCodeableConcept(String system, String code, String display) {
Coding cd = getCoding(system, code, display);
CodeableConcept cc = null;
if (cd != null) {
cc = new CodeableConcept();
cc.addCoding(cd);
if (!StringUtils.isEmpty(display))
cc.setText(display);
}
return cc;
}
use of org.hl7.v3.CD in project eCRNow by drajer-health.
the class PlanDefinitionProcessor method processConditions.
private void processConditions(List<PlanDefinitionActionConditionComponent> condlist, AbstractAction act) {
if (condlist != null && !condlist.isEmpty()) {
for (PlanDefinitionActionConditionComponent cond : condlist) {
if (cond.hasKind() && cond.hasExpression()) {
CQLExpressionCondition cd = new CQLExpressionCondition();
cd.setConditionType(cond.getKind());
cd.setExpression(cond.getExpression().getExpression());
act.addCondition(cd);
}
}
}
}
use of org.hl7.v3.CD in project MobileAccessGateway by i4mi.
the class Iti83RequestConverter method iti83ToIti45Converter.
public String iti83ToIti45Converter(Parameters parameters) throws JAXBException {
List<Type> targetSystemList = (List<Type>) parameters.getParameters("targetSystem");
Identifier sourceIdentifier = (Identifier) parameters.getParameter("sourceIdentifier");
PRPAIN201309UV02Type resultMsg = new PRPAIN201309UV02Type();
resultMsg.setITSVersion("XML_1.0");
// String UUID.randomUUID().toString();
resultMsg.setId(new II(config.getPixQueryOid(), uniqueId()));
// Now
resultMsg.setCreationTime(new TS(Timestamp.now().toHL7()));
resultMsg.setProcessingCode(new CS("T", null, null));
resultMsg.setProcessingModeCode(new CS("T", null, null));
resultMsg.setInteractionId(new II("2.16.840.1.113883.1.18", "PRPA_IN201309UV02"));
resultMsg.setAcceptAckCode(new CS("AL", null, null));
MCCIMT000100UV01Receiver receiver = new MCCIMT000100UV01Receiver();
resultMsg.addReceiver(receiver);
receiver.setTypeCode(CommunicationFunctionType.RCV);
MCCIMT000100UV01Device receiverDevice = new MCCIMT000100UV01Device();
receiver.setDevice(receiverDevice);
receiverDevice.setClassCode(EntityClassDevice.DEV);
receiverDevice.setDeterminerCode(EntityDeterminer.INSTANCE);
receiverDevice.setId(Collections.singletonList(new II(config.getPixReceiverOid(), null)));
MCCIMT000100UV01Sender sender = new MCCIMT000100UV01Sender();
resultMsg.setSender(sender);
sender.setTypeCode(CommunicationFunctionType.SND);
MCCIMT000100UV01Device senderDevice = new MCCIMT000100UV01Device();
sender.setDevice(senderDevice);
senderDevice.setClassCode(EntityClassDevice.DEV);
senderDevice.setDeterminerCode(EntityDeterminer.INSTANCE);
senderDevice.setId(Collections.singletonList(new II(config.getPixMySenderOid(), null)));
PRPAIN201309UV02QUQIMT021001UV01ControlActProcess controlActProcess = new PRPAIN201309UV02QUQIMT021001UV01ControlActProcess();
resultMsg.setControlActProcess(controlActProcess);
controlActProcess.setClassCode(ActClassControlAct.CACT);
controlActProcess.setMoodCode(XActMoodIntentEvent.EVN);
controlActProcess.setCode(new CD("PRPA_TE201309UV02", "2.16.840.1.113883.1.18", null));
PRPAMT201307UV02QueryByParameter queryByParameter = new PRPAMT201307UV02QueryByParameter();
controlActProcess.setQueryByParameter(queryByParameter);
queryByParameter.setQueryId(new II(config.getPixQueryOid(), uniqueId()));
queryByParameter.setStatusCode(new CS("new", null, null));
queryByParameter.setResponsePriorityCode(new CS("I", null, null));
PRPAMT201307UV02ParameterList parameterList = new PRPAMT201307UV02ParameterList();
queryByParameter.setParameterList(parameterList);
PRPAMT201307UV02PatientIdentifier patientIdentifier = new PRPAMT201307UV02PatientIdentifier();
parameterList.addPatientIdentifier(patientIdentifier);
String system = getScheme(sourceIdentifier.getSystem());
patientIdentifier.setValue(Collections.singletonList(new II(system, sourceIdentifier.getValue())));
patientIdentifier.setSemanticsText(ST("Patient.id"));
if (targetSystemList != null && (targetSystemList.size() > 0)) {
for (Type targetSystemType : targetSystemList) {
UriType targetSystem = (UriType) targetSystemType;
String sourceSystem = getScheme(targetSystem.getValue());
PRPAMT201307UV02DataSource dataSource = new PRPAMT201307UV02DataSource();
parameterList.addDataSource(dataSource);
dataSource.setValue(Collections.singletonList(new II(sourceSystem, null, null)));
dataSource.setSemanticsText(ST("DataSource.id"));
}
}
ByteArrayOutputStream out = new ByteArrayOutputStream();
log.debug("PRE CONVERT");
HL7V3Transformer.marshallMessage(PRPAIN201309UV02Type.class, out, resultMsg);
log.debug("POST CONVERT");
String outArray = new String(out.toByteArray());
log.debug(outArray);
return outArray;
}
Aggregations