Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Helt overordnet vil et kald ITI-41 kunne laves med:

Code Block
languagejava
titleEksempel på ITI-41 kald
linenumberstrue
// Indlæs dokumentet, som skal registreres
String documentPayload = getAppointmentXmlDocument();

// Opret documentEntry
DocumentEntry documentEntry = createDocumentEntry();

// Opret kald/request 
ProvideAndRegisterDocumentSetRequestType provideAndRegisterDocumentSetRequest = buildProvideAndRegisterDocumentSetRequestAftale(documentEntry, documentPayload);
try {
	// Udfør kald
	RegistryResponseType registryResponse = iti41PortType.documentRepositoryProvideAndRegisterDocumentSetB(provideAndRegisterDocumentSetRequest);

	// Aflæs kaldets svar
	handleResponse(registryResponse);
} catch (WebServiceException e) {
		// Håndter exception
}

...

Det følgende eksempel sætter værdierne direkte.

Code Block
languagejava
titleEksempel på oprettelse af documententry
linenumberstrue
collapsetrue
public DocumentEntry createDocumentEntry() {
	return createDocumentEntry(new Code("1234567890", new LocalizedString("CPR"), "1.2.208.176.1.2"), 
			new Code("12345679999", new LocalizedString("DROS Testafdeling"), "1.2.208.176.1.1"), 
			"120220221112149", "220220221112149", "320220221122149", // datoer skal angives i UTC tid
			new Code("001", new LocalizedString("Klinisk rapport"), "1.2.208.184.100.9"), 
			new Code("N", new LocalizedString("N"), "2.16.840.1.113883.5.25"), 
			null, 
			new Code("urn:ad:dk:medcom:appointmentsummary:full", new LocalizedString("DK Appointment Summary Document schema"), "1.2.208.184.100.10"), 
			new Code("22232009", new LocalizedString("hospital"), "2.16.840.1.113883.6.96"), 
			"da-DK", 
			"text/xml", 
			"Dato og tidspunkt for møde mellem patient og sundhedsperson", 
			new Code("39289-4", new LocalizedString("Follow-up (referred to) provider &or specialist, appointment date"), "2.16.840.1.113883.6.1"), 
			new Code("408443003", new LocalizedString("almen medicin"), "2.16.840.1.113883.6.96"), 
			"urn:uuid:69d3b9f3cfe0c274-7919170c-40e0457e-87318db4-32fb339216c2978ef88cbc67", // dette er det entryuuid, som skal anvendes i forbindelse med evt. ret og slet dokument
			null"6862563602240318502.5433907004287661552.1645438909923",
			null"6862563602240318502.5433907004287661552.1645438909923");
}


public DocumentEntry createDocumentEntry(Code patientId, Code organisation, String creationTime, String serviceStartTime, String serviceStopTime, Code classCode, Code confidentialityCode, List<Code> eventCodes, Code formatCode, Code healthcareFacilityTypeCode, 
		 String languageCode, String mimeType, String title, Code typeCode, Code practiceSettingCode, String documentEntryUuid, String uniqueId, String logicalId) {
	
	// Opret DocumentEntry for CDA dokumentet
	DocumentEntry documentEntry = new DocumentEntry();
	documentEntry.setEntryUuid(documentEntryUuid); //
	documentEntry.setUniqueId(uniqueId);
	documentEntry.setLogicalUuid(logicalId);

	// Patient Identification
	Identifiable patientIdentifiable = null;
	if (patientId != null) {
		AssigningAuthority patientIdAssigningAuthority = new AssigningAuthority(patientId.getSchemeName());
		patientIdentifiable = new Identifiable(patientId.getCode(), patientIdAssigningAuthority);
	}
	documentEntry.setPatientId(patientIdentifiable);
	documentEntry.setSourcePatientId(patientIdentifiable);


	// Opret author (Organisation)
	AssigningAuthority organisationAssigningAuthority = new AssigningAuthority(organisation.getSchemeName());
	Author author = new Author();
	if (organisation != null && organisation.getCode() != null) {
		String orgDisplayname = (organisation.getDisplayName() != null ? organisation.getDisplayName().getValue() : "");
		Organization authorOrganisation = new Organization(orgDisplayname, organisation.getCode(), organisationAssigningAuthority);
		author.getAuthorInstitution().add(authorOrganisation);
	}
	documentEntry.setAuthor(author);

	// Availability Status (enumeration: APPROVED, SUBMITTED, DEPRECATED)
	documentEntry.setAvailabilityStatus(AvailabilityStatus.APPROVED);

	// Datoer - skal angives i UTC tid
	if (creationTime != null) {
		documentEntry.setCreationTime(creationTime);
	}
	if (serviceStartTime != null) {
		documentEntry.setServiceStartTime(serviceStartTime);
	}
	if (serviceStopTime != null) {
		documentEntry.setServiceStopTime(serviceStopTime);
	}

	if (classCode != null) {
		documentEntry.setClassCode(classCode);
	}
	if (confidentialityCode != null) {
		documentEntry.getConfidentialityCodes().add(confidentialityCode);
	}

	List<Code> eventCodesEntry = documentEntry.getEventCodeList();
	if (eventCodes != null) {
		for (Code eventCode : eventCodes) {
			eventCodesEntry.add(eventCode);
		}
	}
	if (formatCode != null) {
		documentEntry.setFormatCode(formatCode);
	}
	if (healthcareFacilityTypeCode != null) {
		documentEntry.setHealthcareFacilityTypeCode(healthcareFacilityTypeCode);
	}
	if (languageCode != null) {
		documentEntry.setLanguageCode(languageCode);
	}
	if (mimeType != null) {
		documentEntry.setMimeType(mimeType);
	}
	documentEntry.setType(DocumentEntryType.STABLE);
	if (title != null) {
		documentEntry.setTitle(new LocalizedString(title));
	}
	if (typeCode != null) {
		documentEntry.setTypeCode(typeCode);
	}
	if (practiceSettingCode != null) {
		documentEntry.setPracticeSettingCode(practiceSettingCode);
	}
	return documentEntry;
}

At lave ProvideAndRegisterDocumentSetRequestType kan gøres på følgende måde:

Code Block
languagejava
titleEksempel på oprettelse af ProvideAndRegisterDocumentSetRequestType
linenumberstrue
public ProvideAndRegisterDocumentSetRequestType buildProvideAndRegisterDocumentSetRequest(DocumentEntry documentEntry, String documentPayload, Code contentTypeCode) {

	ProvideAndRegisterDocumentSet provideAndRegisterDocumentSet = new ProvideAndRegisterDocumentSet();

	Document document = new Document(documentEntry, new DataHandler(new ByteArrayDataSource(documentPayload.getBytes(), documentEntry.getMimeType())));
	provideAndRegisterDocumentSet.getDocuments().add(document);

	// Opret SubmissionSet for dokumentet
	SubmissionSet submissionSet = createSubmissionSet(documentEntry.getPatientId(), new Code("39289-4", new LocalizedString("Follow-up (referred to) provider &or specialist, appointment date"), "2.16.840.1.113883.6.1"), "1");
	provideAndRegisterDocumentSet.setSubmissionSet(submissionSet);

	// Opret association mellem SubmissionSet og DocumentEntry
	Association association = createAssociation(submissionSet, documentEntry);
	provideAndRegisterDocumentSet.getAssociations().add(association);

	// Transformer request - dette laver core model om til RIM format
	ProvideAndRegisterDocumentSetTransformer registerDocumentSetTransformer = new ProvideAndRegisterDocumentSetTransformer(ebXMLFactory);
	EbXMLProvideAndRegisterDocumentSetRequest30 ebxmlRequest = (EbXMLProvideAndRegisterDocumentSetRequest30) registerDocumentSetTransformer.toEbXML(provideAndRegisterDocumentSet);
	ProvideAndRegisterDocumentSetRequestType provideAndRegisterDocumentSetRequestType = ebxmlRequest.getInternal();

	return provideAndRegisterDocumentSetRequestType;
}

At oprette SubmissionSet kan gøres som:

Code Block
languagejava
titleEksempel på submissionset
linenumberstrue
public SubmissionSet createSubmissionSet(Identifiable patientIdentifiable, Code contentTypeCode, String submissionTime) {
	SubmissionSet submissionSet = new SubmissionSet();
	submissionSet.setUniqueId(generateId());
	submissionSet.setSourceId(generateId());
	submissionSet.setEntryUuid(generateUUID());
	submissionSet.setPatientId(patientIdentifiable);
	submissionSet.setContentTypeCode(contentTypeCode);
	submissionSet.setAvailabilityStatus(AvailabilityStatus.APPROVED);

	if (submissionTime != null) {
		submissionSet.setSubmissionTime(submissionTime);
	}
	return submissionSet;
}

Og at oprette en association kan gøres som:

Code Block
languagejava
titleEksempel på association
linenumberstrue
public Association createAssociation(SubmissionSet submissionSet, DocumentEntry documentEntry) {
 // Opret association mellem SubmissionSet og DocumentEntry
	Association association = new Association();
	association.setAssociationType(AssociationType.HAS_MEMBER);
	association.setEntryUuid(generateUUID());
	association.setSourceUuid(submissionSet.getEntryUuid());
	association.setTargetUuid(documentEntry.getEntryUuid());
	association.setAvailabilityStatus(AvailabilityStatus.APPROVED);
	association.setLabel(AssociationLabel.ORIGINAL);
	return association;
}
Code Block
languagejava
linenumberstrue
Code Block
languagejava
linenumberstrue

...