当前位置: 首页>>代码示例>>Java>>正文


Java SimpleQuantityDt类代码示例

本文整理汇总了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;
}
 
开发者ID:DBCG,项目名称:cqf-ruler,代码行数:40,代码来源:Dstu2ToStu3.java


注:本文中的ca.uhn.fhir.model.dstu2.composite.SimpleQuantityDt类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。