Updates to date processing on xls generation modified procedures and medications to have effective, start, and end for IVL_TS
diff --git a/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/SheetHeaderUtil.java b/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/SheetHeaderUtil.java index 5092037..6332b57 100644 --- a/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/SheetHeaderUtil.java +++ b/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/SheetHeaderUtil.java
@@ -186,7 +186,11 @@ */ static int createProcedureHeader(Row row1, Row row2, int offset) { row2.createCell(offset++).setCellValue(replaceSpace("ID")); - row2.createCell(offset++).setCellValue(replaceSpace("Date")); + row2.createCell(offset++).setCellValue(replaceSpace("Effective Date")); + row2.createCell(offset++).setCellValue(replaceSpace("Location")); + row2.createCell(offset++).setCellValue(replaceSpace("Start Date")); + row2.createCell(offset++).setCellValue(replaceSpace("Location")); + row2.createCell(offset++).setCellValue(replaceSpace("End Date")); row2.createCell(offset++).setCellValue(replaceSpace("Location")); row2.getSheet().setColumnHidden(offset - 1, hideColumns); offset = addCodeHeader(row2, offset, "Procedure"); @@ -264,7 +268,10 @@ row2.getSheet().setColumnHidden(offset - 1, hideColumns); row2.createCell(offset++).setCellValue(replaceSpace("Administration Date")); row2.createCell(offset++).setCellValue(replaceSpace("Location")); - row2.getSheet().setColumnHidden(offset - 1, hideColumns); + row2.createCell(offset++).setCellValue(replaceSpace("Administration Start Date")); + row2.createCell(offset++).setCellValue(replaceSpace("Location")); + row2.createCell(offset++).setCellValue(replaceSpace("Administration End Date")); + row2.createCell(offset++).setCellValue(replaceSpace("Location")); row2.createCell(offset++).setCellValue(replaceSpace("Lot Number")); row2.createCell(offset++).setCellValue(replaceSpace("Location")); row2.getSheet().setColumnHidden(offset - 1, hideColumns);
diff --git a/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/SpreadsheetSerializer.java b/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/SpreadsheetSerializer.java index 7ed8d35..08ad94d 100644 --- a/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/SpreadsheetSerializer.java +++ b/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/SpreadsheetSerializer.java
@@ -1701,6 +1701,57 @@ return offset; } + static int serializeCompleteDate(Row row, int offset, IVL_TS effectiveTime) { + + if (effectiveTime.getValue() != null) { + + Date effectiveDate = CDAValueUtil.getDate(effectiveTime.getValue()); + if (effectiveDate != null) { + row.createCell(offset++).setCellValue(CDAValueUtil.DATE_PRETTY.format(effectiveDate)); + } else { + row.createCell(offset++).setCellValue(""); + } + row.createCell(offset++).setCellValue(CDAUtil.getDomainPath(effectiveTime)); + } else { + row.createCell(offset++).setCellValue(""); + row.createCell(offset++).setCellValue(CDAUtil.getDomainPath(effectiveTime)); + } + + if (effectiveTime.getLow() != null) { + + Date effectiveDateLow = CDAValueUtil.getDate(effectiveTime.getLow().getValue()); + if (effectiveDateLow != null) { + row.createCell(offset++).setCellValue(CDAValueUtil.DATE_PRETTY.format(effectiveDateLow)); + } else { + row.createCell(offset++).setCellValue(""); + } + row.createCell(offset++).setCellValue(CDAUtil.getDomainPath(effectiveTime.getLow())); + + } else { + row.createCell(offset++).setCellValue(""); + row.createCell(offset++).setCellValue(CDAUtil.getDomainPath(effectiveTime)); + + } + + if (effectiveTime.getLow() != null) { + + Date effectiveDateHigh = CDAValueUtil.getDate(effectiveTime.getHigh().getValue()); + if (effectiveDateHigh != null) { + row.createCell(offset++).setCellValue(CDAValueUtil.DATE_PRETTY.format(effectiveDateHigh)); + } else { + row.createCell(offset++).setCellValue(""); + } + + row.createCell(offset++).setCellValue(CDAUtil.getDomainPath(effectiveTime.getHigh())); + } else { + row.createCell(offset++).setCellValue(""); + row.createCell(offset++).setCellValue(CDAUtil.getDomainPath(effectiveTime)); + + } + + return offset; + } + /** * @param row * @param offset @@ -1718,14 +1769,7 @@ sb = new StringBuffer(); - Date d = CDAValueUtil.getDate(CDAValueUtil.getValueAsString(procedureActivityAct.getEffectiveTime())); - if (d != null) { - row.createCell(offset++).setCellValue(CDAValueUtil.DATE_PRETTY.format(d)); - } else { - row.createCell(offset++).setCellValue(""); - } - - row.createCell(offset++).setCellValue(CDAUtil.getDomainPath(procedureActivityAct.getEffectiveTime())); + offset = serializeCompleteDate(row, offset, procedureActivityAct.getEffectiveTime()); offset = SpreadsheetSerializer.appendCodeShowNullFlavor( row, offset, procedureActivityAct.getSection(), procedureActivityAct.getCode(), @@ -1787,14 +1831,16 @@ sb = new StringBuffer(); - Date d = CDAValueUtil.getDate(CDAValueUtil.getValueAsString(procedureActivityObservation.getEffectiveTime())); - if (d != null) { - row.createCell(offset++).setCellValue(CDAValueUtil.DATE_PRETTY.format(d)); - } else { - row.createCell(offset++).setCellValue(""); - } + // Date d = CDAValueUtil.getDate(CDAValueUtil.getValueAsString(procedureActivityObservation.getEffectiveTime())); + // if (d != null) { + // row.createCell(offset++).setCellValue(CDAValueUtil.DATE_PRETTY.format(d)); + // } else { + // row.createCell(offset++).setCellValue(""); + // } + // + // row.createCell(offset++).setCellValue(CDAUtil.getDomainPath(procedureActivityObservation.getEffectiveTime())); - row.createCell(offset++).setCellValue(CDAUtil.getDomainPath(procedureActivityObservation.getEffectiveTime())); + offset = serializeCompleteDate(row, offset, procedureActivityObservation.getEffectiveTime()); offset = SpreadsheetSerializer.appendCodeShowNullFlavor( row, offset, procedureActivityObservation.getSection(), procedureActivityObservation.getCode(), @@ -1821,14 +1867,16 @@ sb = new StringBuffer(); - Date d = CDAValueUtil.getDate(CDAValueUtil.getValueAsString(procedureActivityProcedure.getEffectiveTime())); - if (d != null) { - row.createCell(offset++).setCellValue(CDAValueUtil.DATE_PRETTY.format(d)); - } else { - row.createCell(offset++).setCellValue(""); - } + // Date d = CDAValueUtil.getDate(CDAValueUtil.getValueAsString(procedureActivityProcedure.getEffectiveTime())); + // if (d != null) { + // row.createCell(offset++).setCellValue(CDAValueUtil.DATE_PRETTY.format(d)); + // } else { + // row.createCell(offset++).setCellValue(""); + // } + // + // row.createCell(offset++).setCellValue(CDAUtil.getDomainPath(procedureActivityProcedure.getEffectiveTime())); - row.createCell(offset++).setCellValue(CDAUtil.getDomainPath(procedureActivityProcedure.getEffectiveTime())); + offset = serializeCompleteDate(row, offset, procedureActivityProcedure.getEffectiveTime()); offset = SpreadsheetSerializer.appendCodeShowNullFlavor( row, offset, procedureActivityProcedure.getSection(), procedureActivityProcedure.getCode(), @@ -2022,7 +2070,6 @@ row.createCell(offset++).setCellValue(sb.toString()); sb = new StringBuffer(); - substanceAdministration.getEffectiveTimes(); ST lotNumberText = null; boolean hasCode = false; @@ -2066,32 +2113,13 @@ row.createCell(offset++).setCellValue(CDAValueUtil.getValue(substanceAdministration.getDoseQuantity())); row.createCell(offset++).setCellValue(CDAUtil.getDomainPath(substanceAdministration.getDoseQuantity())); - String time = ""; - EObject source = null; for (SXCM_TS t : substanceAdministration.getEffectiveTimes()) { - source = t; - if (!StringUtils.isEmpty(t.getValue())) { - time = t.getValue(); - } - if (t instanceof IVL_TS) { - - time = CDAValueUtil.getValueAsString((IVL_TS) t); - + offset = serializeCompleteDate(row, offset, (IVL_TS) t); } - + break; } - Date d = CDAValueUtil.getDate(time); - - if (d != null) { - row.createCell(offset++).setCellValue(CDAValueUtil.DATE_PRETTY.format(d)); - } else { - row.createCell(offset++).setCellValue(time); - } - - row.createCell(offset++).setCellValue(CDAUtil.getDomainPath(source)); - if (lotNumberText != null) { row.createCell(offset++).setCellValue(lotNumberText.getText()); row.createCell(offset++).setCellValue(CDAUtil.getDomainPath(lotNumberText));