Versions Compared

Key

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

...

Code Block
languagejava
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
}

En del af felterne i documentEntry er felter, som kan findes i selve XML dokumentet. Derfor kan det at lave en documentEntry gøres på 2 måder: Hvis man selv har skabt XML dokumentet, så har man disse felters værdi og kan sætte dem direkte. Er XML dokumentet skabt på forhånd, kan man unparse det, og hente relevante informationer ud.

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

Code Block
languagejava
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"), 
			"1", "2", "3", // 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:69d3b9f3-7919-40e0-8731-32fb339216c2", // dette er det entryuuid, som skal anvendes i forbindelse med evt. ret og slet dokument
			null,
			null);
}


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;
}
Code Block
languagejava
linenumberstrue

...