prevent NPEs generating patient summary

This commit is contained in:
Grahame Grieve 2020-08-10 15:53:48 +10:00
parent bc11ac5c5b
commit 96d769a6e2
1 changed files with 20 additions and 4 deletions

View File

@ -177,9 +177,17 @@ public class PatientRenderer extends ResourceRenderer {
StringBuilder b = new StringBuilder(); StringBuilder b = new StringBuilder();
b.append(display(name)); b.append(display(name));
b.append(" "); b.append(" ");
if (dob == null) {
b.append("??");
} else {
b.append(gender); b.append(gender);
}
b.append(" "); b.append(" ");
if (dob == null) {
b.append("DoB Unknown");
} else {
b.append(display(dob)); b.append(display(dob));
}
if (id != null) { if (id != null) {
b.append(" ( "); b.append(" ( ");
b.append(display(id)); b.append(display(id));
@ -191,9 +199,17 @@ public class PatientRenderer extends ResourceRenderer {
public void describe(XhtmlNode x, HumanName name, String gender, DateType dob, Identifier id) throws UnsupportedEncodingException, IOException { public void describe(XhtmlNode x, HumanName name, String gender, DateType dob, Identifier id) throws UnsupportedEncodingException, IOException {
render(x.b(), name); render(x.b(), name);
x.tx(" "); x.tx(" ");
if (dob == null) {
x.tx("??");
} else {
x.tx(gender); x.tx(gender);
}
x.tx(" "); x.tx(" ");
if (dob == null) {
x.tx("DoB Unknown");
} else {
render(x, dob); render(x, dob);
}
if (id != null) { if (id != null) {
x.tx(" ( "); x.tx(" ( ");
render(x, id); render(x, id);