Versions Compared

Key

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

...

Code Block
languagejava
titleEksempel på oprettelse af documententry
linenumberstrue
collapsetrue
public DocumentEntry createDocumentEntry() {

 	 PatientInfo sourcePatientInfo = new PatientInfo();
 	 sourcePatientInfo.setName(new XpnName("Berggren", "Nancy", "Ann", null, null, null));
 	 sourcePatientInfo.setGender("F");
 	 sourcePatientInfo.setDateOfBirth("19481225");

	return createDocumentEntry(new Code("2512489996", new LocalizedString("CPR"), "1.2.208.176.1.2"), 
			new Code("12345679999", new LocalizedString("DROS Testafdeling"), "1.2.208.176.1.1"), 
			"20220221113011", "20220221113011", "20220221113011", // 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"), 
 			sourcePatientInfo,
 			"urn:uuid:69d3b9f3-7919-40e0-8731-32fb339216c2", // dette er det entryuuid, som skal anvendes i forbindelse med evt. ret og slet dokument
			"8438472030670286734.7450729509229840524.1645439411709",
			"8438472030670286734.7450729509229840524.1645439411709");
}


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;
}

...