use of org.hl7.fhir.r5.elementmodel.Manager in project beneficiary-fhir-data by CMSgov.
the class ExplanationOfBenefitResourceProviderIT method adjustHhaRecordForSamhsaDiagnosis.
/**
* Adjusts the first HHA record to support samhsa.
*
* @param loadedRecords the loaded records
* @param entityManager the entity manager
*/
private void adjustHhaRecordForSamhsaDiagnosis(List<Object> loadedRecords, EntityManager entityManager) {
HHAClaim hhaRifRecord = loadedRecords.stream().filter(r -> r instanceof HHAClaim).map(r -> (HHAClaim) r).findFirst().get();
entityManager.getTransaction().begin();
hhaRifRecord = entityManager.find(HHAClaim.class, hhaRifRecord.getClaimId());
hhaRifRecord.setDiagnosis2Code(Optional.of(Stu3EobSamhsaMatcherTest.SAMPLE_SAMHSA_ICD_9_DIAGNOSIS_CODE));
hhaRifRecord.setDiagnosis2CodeVersion(Optional.of('9'));
entityManager.merge(hhaRifRecord);
entityManager.getTransaction().commit();
}
use of org.hl7.fhir.r5.elementmodel.Manager in project beneficiary-fhir-data by CMSgov.
the class R4ExplanationOfBenefitResourceProviderIT method adjustSnfRecordForSamhsaDiagnosis.
/**
* Adjusts the first SNF record to support samhsa.
*
* @param loadedRecords the loaded records
* @param entityManager the entity manager
*/
private void adjustSnfRecordForSamhsaDiagnosis(List<Object> loadedRecords, EntityManager entityManager) {
SNFClaim snfRifRecord = loadedRecords.stream().filter(r -> r instanceof SNFClaim).map(r -> (SNFClaim) r).findFirst().get();
entityManager.getTransaction().begin();
snfRifRecord = entityManager.find(SNFClaim.class, snfRifRecord.getClaimId());
snfRifRecord.setDiagnosis2Code(Optional.of(Stu3EobSamhsaMatcherTest.SAMPLE_SAMHSA_ICD_9_DIAGNOSIS_CODE));
snfRifRecord.setDiagnosis2CodeVersion(Optional.of('9'));
entityManager.merge(snfRifRecord);
entityManager.getTransaction().commit();
}
use of org.hl7.fhir.r5.elementmodel.Manager in project beneficiary-fhir-data by CMSgov.
the class R4ExplanationOfBenefitResourceProviderIT method adjustInpatientRecordForSamhsaDiagnosis.
/**
* Adjusts the first inpatient record to support samhsa.
*
* @param loadedRecords the loaded records
* @param entityManager the entity manager
*/
private void adjustInpatientRecordForSamhsaDiagnosis(List<Object> loadedRecords, EntityManager entityManager) {
InpatientClaim inpatientRifRecord = loadedRecords.stream().filter(r -> r instanceof InpatientClaim).map(r -> (InpatientClaim) r).findFirst().get();
entityManager.getTransaction().begin();
inpatientRifRecord = entityManager.find(InpatientClaim.class, inpatientRifRecord.getClaimId());
inpatientRifRecord.setDiagnosis2Code(Optional.of(Stu3EobSamhsaMatcherTest.SAMPLE_SAMHSA_ICD_9_DIAGNOSIS_CODE));
inpatientRifRecord.setDiagnosis2CodeVersion(Optional.of('9'));
entityManager.merge(inpatientRifRecord);
entityManager.getTransaction().commit();
}
use of org.hl7.fhir.r5.elementmodel.Manager in project beneficiary-fhir-data by CMSgov.
the class R4ExplanationOfBenefitResourceProviderIT method adjustDmeRecordForSamhsaDiagnosis.
/**
* Adjusts the first DME record to support samhsa.
*
* @param loadedRecords the loaded records
* @param entityManager the entity manager
*/
private void adjustDmeRecordForSamhsaDiagnosis(List<Object> loadedRecords, EntityManager entityManager) {
DMEClaim dmeRifRecord = loadedRecords.stream().filter(r -> r instanceof DMEClaim).map(r -> (DMEClaim) r).findFirst().get();
entityManager.getTransaction().begin();
dmeRifRecord = entityManager.find(DMEClaim.class, dmeRifRecord.getClaimId());
dmeRifRecord.setDiagnosis2Code(Optional.of(Stu3EobSamhsaMatcherTest.SAMPLE_SAMHSA_ICD_9_DIAGNOSIS_CODE));
dmeRifRecord.setDiagnosis2CodeVersion(Optional.of('9'));
entityManager.merge(dmeRifRecord);
entityManager.getTransaction().commit();
}
use of org.hl7.fhir.r5.elementmodel.Manager in project himss_2021_sepsis_detection by redhat-na-ssa.
the class GetObservationsSignalEventCommand method execute.
@Override
public ExecutionResults execute(CommandContext ctx) throws Exception {
// NOTE: Make sure this is the actual deploymentId and not an kieserver alias
String deploymentId = (String) ctx.getData("deploymentId");
if (deploymentId == null) {
deploymentId = (String) ctx.getData("DeploymentId");
}
String signal = (String) ctx.getData("Signal");
Long processInstanceId = (Long) ctx.getData("processInstanceId");
if (processInstanceId == null) {
processInstanceId = (Long) ctx.getData("ProcessInstanceId");
}
Patient patientObj = (Patient) ctx.getData(FHIRUtil.EVENT);
if (patientObj == null)
throw new RuntimeException("Context must include: " + FHIRUtil.PATIENT);
List<Observation> obsList = getTimeBoxedObservation(patientObj);
PatientVitals vitals = buildPatientVitals(patientObj, obsList);
// TO-DO: When persisting this list of Observations as part of process instance, upon retrieval of pInstanceVariables ..... the server thread is placed in an infinite loop of JSON processing
// parameters.put("observationList", obsList);
RuntimeManager runtimeManager = RuntimeManagerRegistry.get().getManager(deploymentId);
if (runtimeManager == null) {
throw new IllegalArgumentException("No runtime manager found for deployment id " + deploymentId);
}
RuntimeEngine engine = runtimeManager.getRuntimeEngine(ProcessInstanceIdContext.get(processInstanceId));
try {
log.info("execute() signalling ... : deploymentId = " + deploymentId + " : pInstanceId = " + processInstanceId + " : signal = " + signal);
engine.getKieSession().signalEvent(signal, vitals, processInstanceId);
return new ExecutionResults();
} finally {
runtimeManager.disposeRuntimeEngine(engine);
}
}
Aggregations