我正在使用HAPI FHIR DSTU2HL7Org在远程服务器中创建MedicationOrders。对象的构造如下。
MedicationOrder[] medicationOrder = null;
MedicationOrderDataWrapper[] medicationOrderWrapper = new MedicationOrderDataToolkit().getMedicationOrderDataWrapper(wrapper);
if(medicationOrderWrapper != null)
{
medicationOrder = new MedicationOrder[medicationOrderWrapper.length];
for(int i=0; i<medicationOrderWrapper.length; i++)
{
medicationOrder[i] = new MedicationOrder();
MedicationOrderDosageInstructionComponent dosageInstruction = new MedicationOrderDosageInstructionComponent().setDose(medicationOrderWrapper[i].getDoseQuantity()).
setTiming(medicationOrderWrapper[i].getTiming()).setAdditionalInstructions(medicationOrderWrapper[i].getAdditionalInstruction());
medicationOrder[i].addDosageInstruction(dosageInstruction).setEncounterTarget(medicationOrderWrapper[i].getEncounter()).
setMedication(medicationOrderWrapper[i].getMedicationCodeableConcept()).setPatientTarget(medicationOrderWrapper[i].getPatient()).setPrescriberTarget(medicationOrderWrapper[i].getPractitioner())
.addExtension(medicationOrderWrapper[i].getExtension());
medicationOrder[i].getContained().add(medicationOrder[i].getEncounterTarget());
medicationOrder[i].getContained().add(medicationOrderWrapper[i].getOrganization());
medicationOrder[i].getContained().add(medicationOrderWrapper[i].getLocation());
medicationOrder[i].getContained().add(medicationOrder[i].getPatientTarget());
medicationOrder[i].getContained().add(medicationOrder[i].getPrescriberTarget());
medicationOrder[i].setEncounter(new Reference("#" + medicationOrder[i].getEncounterTarget().getId()))
.setPatient(new Reference("#" + medicationOrder[i].getPatientTarget().getId()).setDisplay(medicationOrder[i].getPatientTarget().getName().get(0).getText()))
.setPrescriber(new Reference("#" + medicationOrder[i].getPrescriberTarget().getId()).setDisplay(medicationOrder[i].getPrescriberTarget().getName().getText()))
.setReason(medicationOrderWrapper[i].getReasonCodeableConcept()).addIdentifier(medicationOrderWrapper[i].getCosmicIdentifier());
但是此代码导致生成的xml消息中包含重复的元素。组织和位置元素分别出现3次和2次,而Patient,Practitioner和Encounter只出现一次。
有人可以解释一下吗?
答案 0 :(得分:0)
这实际上听起来像个错误。您是否介意在GitHub问题跟踪器上提交报告?