use of org.hl7.fhir.r5.model.Money in project synthea by synthetichealth.
the class FhirStu3 method createMoneyExtension.
/**
* Create an extension in with a valueMoney in USD.
* @param url The url of the extension.
* @param value The value in USD.
* @return the Extension
*/
private static Extension createMoneyExtension(String url, double value) {
Money money = new Money();
money.setValue(value);
money.setSystem("urn:iso:std:iso:4217");
money.setCode("USD");
Extension extension = new Extension();
extension.setUrl(url);
extension.setValue(money);
return extension;
}
use of org.hl7.fhir.r5.model.Money in project synthea by synthetichealth.
the class FhirStu3 method encounterClaim.
/**
* Create an entry for the given Claim, associated to an Encounter.
*
* @param rand Source of randomness to use when generating ids etc
* @param personEntry Entry for the person
* @param bundle The Bundle to add to
* @param encounterEntry The current Encounter
* @param claim the Claim object
* @return the added Entry
*/
private static BundleEntryComponent encounterClaim(RandomNumberGenerator rand, BundleEntryComponent personEntry, Bundle bundle, BundleEntryComponent encounterEntry, Claim claim) {
org.hl7.fhir.dstu3.model.Claim claimResource = new org.hl7.fhir.dstu3.model.Claim();
org.hl7.fhir.dstu3.model.Encounter encounterResource = (org.hl7.fhir.dstu3.model.Encounter) encounterEntry.getResource();
claimResource.setStatus(ClaimStatus.ACTIVE);
claimResource.setUse(org.hl7.fhir.dstu3.model.Claim.Use.COMPLETE);
// duration of encounter
claimResource.setBillablePeriod(encounterResource.getPeriod());
claimResource.setPatient(new Reference(personEntry.getFullUrl()));
claimResource.setOrganization(encounterResource.getServiceProvider());
// add item for encounter
claimResource.addItem(new ItemComponent(new PositiveIntType(1)).addEncounter(new Reference(encounterEntry.getFullUrl())));
int itemSequence = 2;
int conditionSequence = 1;
int procedureSequence = 1;
int informationSequence = 1;
for (Claim.ClaimEntry claimEntry : claim.items) {
HealthRecord.Entry item = claimEntry.entry;
if (Costs.hasCost(item)) {
// update claimItems list
ItemComponent claimItem = new ItemComponent(new PositiveIntType(itemSequence));
Code primaryCode = item.codes.get(0);
String system = ExportHelper.getSystemURI(primaryCode.system);
CodeableConcept serviceProvided = new CodeableConcept().addCoding(new Coding().setCode(primaryCode.code).setVersion("v1").setSystem(system));
claimItem.setService(serviceProvided);
// calculate the cost of the procedure
Money moneyResource = new Money();
moneyResource.setCode("USD");
moneyResource.setSystem("urn:iso:std:iso:4217");
moneyResource.setValue(item.getCost());
claimItem.setNet(moneyResource);
if (item instanceof HealthRecord.Procedure) {
Type procedureReference = new Reference(item.fullUrl);
ProcedureComponent claimProcedure = new ProcedureComponent(new PositiveIntType(procedureSequence), procedureReference);
claimResource.addProcedure(claimProcedure);
claimItem.addProcedureLinkId(procedureSequence);
procedureSequence++;
} else {
Reference informationReference = new Reference(item.fullUrl);
SpecialConditionComponent informationComponent = new SpecialConditionComponent();
informationComponent.setSequence(informationSequence);
informationComponent.setValue(informationReference);
CodeableConcept category = new CodeableConcept();
category.getCodingFirstRep().setSystem("http://hl7.org/fhir/claiminformationcategory").setCode("info");
informationComponent.setCategory(category);
claimResource.addInformation(informationComponent);
claimItem.addInformationLinkId(informationSequence);
claimItem.setService(claimResource.getType());
informationSequence++;
}
claimResource.addItem(claimItem);
} else {
// assume it's a Condition, we don't have a Condition class specifically
// add diagnosisComponent to claim
Reference diagnosisReference = new Reference(item.fullUrl);
org.hl7.fhir.dstu3.model.Claim.DiagnosisComponent diagnosisComponent = new org.hl7.fhir.dstu3.model.Claim.DiagnosisComponent(new PositiveIntType(conditionSequence), diagnosisReference);
claimResource.addDiagnosis(diagnosisComponent);
// update claimItems with diagnosis
ItemComponent diagnosisItem = new ItemComponent(new PositiveIntType(itemSequence));
diagnosisItem.addDiagnosisLinkId(conditionSequence);
claimResource.addItem(diagnosisItem);
conditionSequence++;
}
itemSequence++;
}
Money moneyResource = new Money();
moneyResource.setCode("USD");
moneyResource.setSystem("urn:iso:std:iso:4217");
moneyResource.setValue(claim.getTotalClaimCost());
claimResource.setTotal(moneyResource);
return newEntry(rand, bundle, claimResource);
}
use of org.hl7.fhir.r5.model.Money in project java-docs-samples by GoogleCloudPlatform.
the class GeneralSearchSample method main.
// [END compensation_filter]
public static void main(String... args) throws Exception {
Company companyToBeCreated = BasicCompanySample.generateCompany().setDisplayName("Google");
String companyName = BasicCompanySample.createCompany(companyToBeCreated).getName();
Job jobToBeCreated = BasicJobSample.generateJobWithRequiredFields(companyName).setTitle("Systems Administrator").setEmploymentTypes(Arrays.asList("FULL_TIME")).setLanguageCode("en-US").setCompensationInfo(new CompensationInfo().setEntries(Arrays.asList(new CompensationEntry().setType("BASE").setUnit("HOURLY").setAmount(new Money().setCurrencyCode("USD").setUnits(12L)))));
final String jobName = BasicJobSample.createJob(jobToBeCreated).getName();
// Wait several seconds for post processing
Thread.sleep(10000);
basicSearcJobs(companyName, "Systems Administrator");
categoryFilterSearch(companyName, Arrays.asList("COMPUTER_AND_IT"));
dateRangeSearch(companyName, "1980-01-15T01:30:15.01Z", "2099-01-15T01:30:15.01Z");
employmentTypesSearch(companyName, Arrays.asList("FULL_TIME", "CONTRACTOR", "PER_DIEM"));
companyDisplayNameSearch(companyName, Arrays.asList("Google"));
compensationSearch(companyName);
languageCodeSearch(companyName, Arrays.asList("pt-BR", "en-US"));
BasicJobSample.deleteJob(jobName);
BasicCompanySample.deleteCompany(companyName);
}
use of org.hl7.fhir.r5.model.Money in project java-docs-samples by GoogleCloudPlatform.
the class GeneralSearchSample method compensationSearch.
// [END company_display_name_filter]
// [START compensation_filter]
/**
* Search on compensation.
*/
public static void compensationSearch(String companyName) throws IOException, InterruptedException {
// Make sure to set the requestMetadata the same as the associated search request
RequestMetadata requestMetadata = new RequestMetadata().setUserId("HashedUserId").setSessionId("HashedSessionID").setDomain("www.google.com");
// Search jobs that pay between 10.50 and 15 USD per hour
JobQuery jobQuery = new JobQuery().setCompensationFilter(new CompensationFilter().setType("UNIT_AND_AMOUNT").setUnits(Arrays.asList("HOURLY")).setRange(new CompensationRange().setMaxCompensation(new Money().setCurrencyCode("USD").setUnits(15L)).setMinCompensation(new Money().setCurrencyCode("USD").setUnits(10L).setNanos(500000000))));
if (companyName != null) {
jobQuery.setCompanyNames(Arrays.asList(companyName));
}
SearchJobsRequest searchJobsRequest = new SearchJobsRequest().setRequestMetadata(requestMetadata).setJobQuery(// Set the actual search term as defined in the jobQurey
jobQuery).setSearchMode(// Set the search mode to a regular search
"JOB_SEARCH");
SearchJobsResponse searchJobsResponse = talentSolutionClient.projects().jobs().search(DEFAULT_PROJECT_ID, searchJobsRequest).execute();
Thread.sleep(1000);
System.out.printf("Search results by compensation: %s\n", searchJobsResponse);
}
use of org.hl7.fhir.r5.model.Money in project synthea by synthetichealth.
the class FhirR4 method encounterClaim.
/**
* Create an entry for the given Claim, associated to an Encounter.
*
* @param person The patient having the encounter.
* @param personEntry Entry for the person
* @param bundle The Bundle to add to
* @param encounterEntry The current Encounter
* @param claim the Claim object
* @return the added Entry
*/
private static BundleEntryComponent encounterClaim(Person person, BundleEntryComponent personEntry, Bundle bundle, BundleEntryComponent encounterEntry, Claim claim) {
org.hl7.fhir.r4.model.Claim claimResource = new org.hl7.fhir.r4.model.Claim();
org.hl7.fhir.r4.model.Encounter encounterResource = (org.hl7.fhir.r4.model.Encounter) encounterEntry.getResource();
claimResource.setStatus(ClaimStatus.ACTIVE);
CodeableConcept type = new CodeableConcept();
type.getCodingFirstRep().setSystem("http://terminology.hl7.org/CodeSystem/claim-type").setCode("institutional");
claimResource.setType(type);
claimResource.setUse(org.hl7.fhir.r4.model.Claim.Use.CLAIM);
InsuranceComponent insuranceComponent = new InsuranceComponent();
insuranceComponent.setSequence(1);
insuranceComponent.setFocal(true);
insuranceComponent.setCoverage(new Reference().setDisplay(claim.payer.getName()));
claimResource.addInsurance(insuranceComponent);
// duration of encounter
claimResource.setBillablePeriod(encounterResource.getPeriod());
claimResource.setCreated(encounterResource.getPeriod().getEnd());
claimResource.setPatient(new Reference().setReference(personEntry.getFullUrl()).setDisplay((String) person.attributes.get(Person.NAME)));
claimResource.setProvider(encounterResource.getServiceProvider());
if (USE_US_CORE_IG) {
claimResource.setFacility(encounterResource.getLocationFirstRep().getLocation());
}
// set the required priority
CodeableConcept priority = new CodeableConcept();
priority.getCodingFirstRep().setSystem("http://terminology.hl7.org/CodeSystem/processpriority").setCode("normal");
claimResource.setPriority(priority);
// add item for encounter
claimResource.addItem(new ItemComponent(new PositiveIntType(1), encounterResource.getTypeFirstRep()).addEncounter(new Reference(encounterEntry.getFullUrl())));
int itemSequence = 2;
int conditionSequence = 1;
int procedureSequence = 1;
int informationSequence = 1;
for (Claim.ClaimEntry claimEntry : claim.items) {
HealthRecord.Entry item = claimEntry.entry;
if (Costs.hasCost(item)) {
// update claimItems list
Code primaryCode = item.codes.get(0);
String system = ExportHelper.getSystemURI(primaryCode.system);
ItemComponent claimItem = new ItemComponent(new PositiveIntType(itemSequence), mapCodeToCodeableConcept(primaryCode, system));
// calculate the cost of the procedure
Money moneyResource = new Money();
moneyResource.setCurrency("USD");
moneyResource.setValue(item.getCost());
claimItem.setNet(moneyResource);
claimResource.addItem(claimItem);
if (item instanceof Procedure) {
Type procedureReference = new Reference(item.fullUrl);
ProcedureComponent claimProcedure = new ProcedureComponent(new PositiveIntType(procedureSequence), procedureReference);
claimResource.addProcedure(claimProcedure);
claimItem.addProcedureSequence(procedureSequence);
procedureSequence++;
} else {
Reference informationReference = new Reference(item.fullUrl);
SupportingInformationComponent informationComponent = new SupportingInformationComponent();
informationComponent.setSequence(informationSequence);
informationComponent.setValue(informationReference);
CodeableConcept category = new CodeableConcept();
category.getCodingFirstRep().setSystem("http://terminology.hl7.org/CodeSystem/claiminformationcategory").setCode("info");
informationComponent.setCategory(category);
claimResource.addSupportingInfo(informationComponent);
claimItem.addInformationSequence(informationSequence);
informationSequence++;
}
} else {
// assume it's a Condition, we don't have a Condition class specifically
// add diagnosisComponent to claim
Reference diagnosisReference = new Reference(item.fullUrl);
DiagnosisComponent diagnosisComponent = new DiagnosisComponent(new PositiveIntType(conditionSequence), diagnosisReference);
claimResource.addDiagnosis(diagnosisComponent);
// update claimItems with diagnosis
ItemComponent diagnosisItem = new ItemComponent(new PositiveIntType(itemSequence), mapCodeToCodeableConcept(item.codes.get(0), SNOMED_URI));
diagnosisItem.addDiagnosisSequence(conditionSequence);
claimResource.addItem(diagnosisItem);
conditionSequence++;
}
itemSequence++;
}
Money moneyResource = new Money();
moneyResource.setCurrency("USD");
moneyResource.setValue(claim.getTotalClaimCost());
claimResource.setTotal(moneyResource);
return newEntry(person, bundle, claimResource);
}
Aggregations