If the class is a simple one, you may find it more convenient to use the constructor to initialise the values (refer to the javadocs for details of constructor arguments):
fields.setUsualGPName(new PersonName("Dr", "Simon", "Jones"));
Once you have set all the relevant values in the EndOfLifeCareISBFields object, you can use the
EndOfLifeCareDocumentCreationHelper class to generate the more complex set of objects that represent the CDA document contents:
ClinicalDocument doc = EndOfLifeCareDocumentCreationHelper
ClinicalDocument object that is returned contains many other objects representing the various coded and text sections within the CDA document. If necessary you can use these objects to add any additional information that might be required that has not been done by the helper.
Now we can simply call the
serialise method on this document to generate a full CDA document that can be sent over ITK (or via other channels if required):
String xml = doc.serialise();
As a convenience, the standard renderer provided by the messaging team is also provided with the library, and can easily be used to generate a rendered HTML version of the document using the
String html = DocumentRenderer.generateHTMLDocument(xml);
Note: The helper makes a number of assumptions in order to simplify the process of creating an End of Life Care document. For example it assumes that all patients will be identified using an NHS number, and that all staff will be identified using an SDS ID. These assumptions may not fit the specific needs of teams implementing this library in their solution. Developers are encouraged to use the helper as a starting point to build on/tweak as required.