FHIR STU3 ListResource.ListEntryComponent.getItemTarget() 函数无法识别引用的资源

FHIR STU3 ListResource.ListEntryComponent.getItemTarget() function not recognizing referenced Resource

我正在将我的代码转换为 FHIR STU3,我正在尝试通过调用 ListEntryComponent 上的 getItemTarget() 获取 List.entry[x].item.reference 引用的组织资源,但它总是 returns NULL 尽管资源在那里(见 if (organizations.get(i).getItemTarget()) )。有什么问题吗?

这是我使用的部分代码:

if (entries0.get(e).getReference().equals("List/g1")) {

        //get the organizations list
        var organizations =  entries0.get(e).getResource().getEntry();

        for (var i = 0; i < organizations.size(); i++) {

            var orgReference = organizations.get(i).getItem();              

            if (orgReference.hasReference()) {

                //if the reference resolves, Organization.type must be present
                if (organizations.get(i).getItemTarget() && 
                    organizations.get(i).getItemTarget().getResourceType() == fhirPackageStruct.ResourceType.Organization) {

                    list1OrgTypeSystem = organizations.get(i).getItemTarget().getTypeFirstRep().getCodingFirstRep().getSystem().equals("http://spms.min-saude.pt/pds/codings/nn_organization_types");
                    throwIfTrue(!list1OrgTypeSystem,'Composition.section[0].entry['+e+'].entry['+i+'].item ' + orgReference.getReference(), "INVALID Organization.type.system. Expected: http://spms.min-saude.pt/pds/codings/nn_organization_types");
                }
                else {
                    throw 'srcTransf validateNNDocumentProfile: não foi encontrado o recurso referenciado por ' + orgReference.getReference() + ' da lista de instituições de seguimento da grávida.';
                }

                orgReference = orgReference.getReference().toLowerCase();
            }               

            if (orgReference.equals("organization/hospital")) {

                section0HospMotive = organizations.get(i).getItemTarget().getExtension().isEmpty();
                throwIfTrue(section0HospMotive,'Composition.section[0].entry['+e+'].entry['+i+'].item (Organization/Hospital)', "MISSING FOLLOWUP MOTIVE EXTENSION");
            }
        }   
}

你能帮帮我吗?谢谢!!

getFOOTarget() 方法有点令人困惑,实际上并没有使用它们,可能会被删除。

您需要将 getItemTarget() 替换为 getItem().getResource()