本文整理汇总了Java中ca.uhn.fhir.model.dstu2.composite.SimpleQuantityDt类的典型用法代码示例。如果您正苦于以下问题:Java SimpleQuantityDt类的具体用法?Java SimpleQuantityDt怎么用?Java SimpleQuantityDt使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SimpleQuantityDt类属于ca.uhn.fhir.model.dstu2.composite包,在下文中一共展示了SimpleQuantityDt类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertToDosage
import ca.uhn.fhir.model.dstu2.composite.SimpleQuantityDt; //导入依赖的package包/类
private static List<Dosage> convertToDosage(List<MedicationOrder.DosageInstruction> instructions) throws FHIRException {
List<Dosage> dosages = new ArrayList<>();
for (MedicationOrder.DosageInstruction dosageInstruction : instructions) {
Dosage dosage = new Dosage();
dosage.setText(dosageInstruction.getText());
dosage.setAsNeeded(dosageInstruction.getAsNeeded() == null ? new BooleanType(true) : new BooleanType(((BooleanDt) dosageInstruction.getAsNeeded()).getValue()));
Integer frequency = dosageInstruction.getTiming().getRepeat().getFrequency();
Integer frequencyMax = dosageInstruction.getTiming().getRepeat().getFrequencyMax();
Timing.TimingRepeatComponent repeat = new Timing.TimingRepeatComponent();
if (frequency != null) {
repeat.setFrequency(frequency);
}
if (frequencyMax != null) {
repeat.setFrequencyMax(frequencyMax);
}
repeat.setPeriod(dosageInstruction.getTiming().getRepeat().getPeriod())
.setPeriodUnit(Timing.UnitsOfTime.fromCode(dosageInstruction.getTiming().getRepeat().getPeriodUnits()));
Timing timing = new Timing();
timing.setRepeat(repeat);
dosage.setTiming(timing);
SimpleQuantityDt quantityDt = (SimpleQuantityDt) dosageInstruction.getDose();
dosage.setDose(new SimpleQuantity()
.setValue(quantityDt.getValue())
.setUnit(quantityDt.getUnit())
.setCode(quantityDt.getCode())
.setSystem(quantityDt.getSystem())
);
dosages.add(dosage);
}
return dosages;
}