Skip to content

Commit

Permalink
Most Recent Observations should show up in dashboard header - TRUNK-439
Browse files Browse the repository at this point in the history
TRUNK-439: Add Global property for dashboard header concepts and remove obsolete cd4_count concept.
Includes Migration.

By @wginolas and @jthoenes

Remove invisible patientHeaderObsReturnVisit from patientHeader.jsp.

@jthoenes, @wginolas

Add class to td element and adapt release test.

@wginolas and @jthoenes
  • Loading branch information
Nils Eckelt authored and wluyima committed Aug 18, 2013
1 parent d7f47b7 commit bad513c
Show file tree
Hide file tree
Showing 10 changed files with 82 additions and 50 deletions.
3 changes: 1 addition & 2 deletions api/src/main/java/org/openmrs/Concept.java
Expand Up @@ -991,8 +991,7 @@ public ConceptName getShortestName(Locale locale, Boolean exact) {
ConceptName shortestNameForConcept = null;

if (locale != null) {
for (Iterator<ConceptName> i = getNames().iterator(); i.hasNext();) {
ConceptName possibleName = i.next();
for (ConceptName possibleName : getNames()) {
if (possibleName.getLocale().equals(locale)) {
if ((shortestNameForLocale == null)
|| (possibleName.getName().length() < shortestNameForLocale.getName().length())) {
Expand Down
10 changes: 7 additions & 3 deletions api/src/main/java/org/openmrs/util/OpenmrsConstants.java
Expand Up @@ -1081,6 +1081,8 @@ public static final Collection<String> AUTO_ROLES() {

public static final String GP_CASE_SENSITIVE_NAMES_IN_CONCEPT_NAME_TABLE = "concept.caseSensitiveNamesInConceptNameTable";

public static final String GP_DASHBOARD_CONCEPTS = "dashboard.header.showConcept";

public static final String GP_MAIL_SMTP_STARTTLS_ENABLE = "mail.smtp.starttls.enable";

/**
Expand All @@ -1105,6 +1107,10 @@ public static final List<GlobalProperty> CORE_GLOBAL_PROPERTIES() {

props.add(new GlobalProperty("dashboard.overview.showConcepts", "",
"Comma delimited list of concepts ids to show on the patient dashboard overview tab"));

props.add(new GlobalProperty(GP_DASHBOARD_CONCEPTS, "5497",
"Comma delimited list of concepts ids to show on the patient header overview"));

props
.add(new GlobalProperty("dashboard.encounters.showEmptyFields", "true",
"true/false whether or not to show empty fields on the 'View Encounter' window",
Expand Down Expand Up @@ -1215,9 +1221,7 @@ public static final List<GlobalProperty> CORE_GLOBAL_PROPERTIES() {

props.add(new GlobalProperty("concept.weight", "5089", "Concept id of the concept defining the WEIGHT concept"));
props.add(new GlobalProperty("concept.height", "5090", "Concept id of the concept defining the HEIGHT concept"));
props
.add(new GlobalProperty("concept.cd4_count", "5497",
"Concept id of the concept defining the CD4 count concept"));

props.add(new GlobalProperty("concept.causeOfDeath", "5002",
"Concept id of the concept defining the CAUSE OF DEATH concept"));
props.add(new GlobalProperty("concept.none", "1107", "Concept id of the concept defining the NONE concept"));
Expand Down
17 changes: 16 additions & 1 deletion api/src/main/resources/liquibase-update-to-latest.xml
Expand Up @@ -7488,6 +7488,21 @@
</column>
</addColumn>
</changeSet>
<changeSet id="20130626-TRUNK-439" author="jthoenes">
<comment>
Adding configurability to Patient Header on Dashboard. Therefore the cd4_count property is dropped and
replaced with a header.showConcept property.
</comment>
<update tableName="global_property">
<column name="property"
value="dashboard.header.showConcept" />
<column name="description"
value="Comma delimited list of concepts ids to show on the patient header overview" />
<where>
property='concept.cd4_count'
</where>
</update>
</changeSet>

<changeSet id="201306141103-TRUNK-3884" author="susantan">
<comment>Adding 3 foreign key relationships (creator,created_by,voided_by) to encounter_provider table</comment>
Expand All @@ -7496,4 +7511,4 @@
<addForeignKeyConstraint constraintName="encounter_provider_voided_by" baseTableName="encounter_provider" baseColumnNames="voided_by" referencedTableName="users" referencedColumnNames="user_id"/>
</changeSet>

</databaseChangeLog>
</databaseChangeLog>
Expand Up @@ -57,7 +57,7 @@ public void verifyPatientDashBoard(){
assertPresenceOf(div().with(attribute("id",equalTo("patientHeaderPatientName"))).with(text(equalTo("Mr. Horatio L Hornblower Esq."))));
assertPresenceOf(cell().with(attribute("id",equalTo("patientHeaderPatientAge"))).with(text(containsString("71 yrs"))));
assertPresenceOf(table().with(attribute("id",equalTo("patientHeaderObs"))));
assertPresenceOf(cell().with(attribute("id",equalTo("patientHeaderObsCD4"))));
assertPresenceOf(cell().with(attribute("class",equalTo("patientRecentObsConfigured"))));
assertPresenceOf(cell().with(attribute("id", equalTo("patientHeaderObsRegimen"))));
assertPresenceOf(div().with(attribute("id",equalTo("patientHeaderPreferredIdentifier"))).with(text(containsString("101-6"))));
assertPresenceOf(cell().with(attribute("id", equalTo("patientHeaderOtherIdentifiers"))).with(text(containsString("Old Identification Number: 101"))));
Expand Down
18 changes: 12 additions & 6 deletions web/src/main/java/org/openmrs/web/taglib/ConceptTag.java
Expand Up @@ -43,7 +43,7 @@ public class ConceptTag extends BodyTagSupport {

private String nameVar;

private String shortNameVar;
private String shortestNameVar;

private String numericVar;

Expand Down Expand Up @@ -87,11 +87,9 @@ public int doStartTag() throws JspException {
log.debug("Retrieved name " + cName.getName() + ", set to variable: " + nameVar);
}

/**
* ABK - no short name attribute exists in openmrs.tld ConceptName shortName =
* c.getShortName(loc); if (shortNameVar != null && shortName != null)
* pageContext.setAttribute(shortNameVar, shortName);
*/
if (shortestNameVar != null) {
pageContext.setAttribute(shortestNameVar, c.getShortestName(loc, false));
}

if (numericVar != null) {
pageContext.setAttribute(numericVar, cs.getConceptNumeric(conceptId));
Expand Down Expand Up @@ -201,6 +199,14 @@ public String getSetMemberVar() {
return setMemberVar;
}

public String getShortestNameVar() {
return shortestNameVar;
}

public void setShortestNameVar(String shortestNameVar) {
this.shortestNameVar = shortestNameVar;
}

/**
* @param SetMemberVar the SetMemberVar to set
*/
Expand Down
6 changes: 6 additions & 0 deletions webapp/src/main/webapp/WEB-INF/taglibs/openmrs.tld
Expand Up @@ -415,6 +415,12 @@
<rtexprvalue>true</rtexprvalue>
<type>java.lang.String</type>
</attribute>
<attribute>
<name>shortestNameVar</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>java.lang.String</type>
</attribute>
<attribute>
<name>numericVar</name>
<required>false</required>
Expand Down
Expand Up @@ -15,40 +15,40 @@
<openmrs:htmlInclude file="/dwr/util.js" />

<table>
<c:forTokens var="conceptId" items="${model.conceptIds}" delims="," >
<c:forTokens var="conceptIds" items="${model.conceptIds}" delims="," >
<tr>
<td><openmrs_tag:concept conceptId="${conceptId}"/>:</td>
<td><openmrs_tag:concept conceptId="${conceptIds}"/>:</td>
<td>
<b>
<openmrs_tag:mostRecentObs concept="${conceptId}" observations="${model.patientObs}" locale="${model.locale}" labelIfNone="general.none" showDate="true" showEditLink="true"/>
<openmrs_tag:mostRecentObs concept="${conceptIds}" observations="${model.patientObs}" locale="${model.locale}" labelIfNone="general.none" showDate="true" showEditLink="true"/>
</b>
</td>
<c:if test="${allowNew}">
<td>
<c:set var="thisConcept" value="${model.conceptMapByStringIds[conceptId]}"/>
<a href="javascript:showHideDiv('newCustomObs_${conceptId}')">
<a href="javascript:showHideDiv('newCustomObs_${conceptIds}')">
<openmrs:message code="general.new"/>
</a>
</td>
<td class="dashedAndHighlighted" id="newCustomObs_${conceptId}" style="display:none">
<td class="dashedAndHighlighted" id="newCustomObs_${conceptIds}" style="display:none">

<openmrs:format conceptId="${conceptId}"/>
<openmrs:format conceptId="${conceptIds}"/>
<c:choose>
<c:when test="${thisConcept.datatype.hl7Abbreviation == 'DT'}">
<input type="text" size="10" value="" onfocus="showCalendar(this)" id="value_${conceptId}" />
<input type="text" size="10" value="" onfocus="showCalendar(this)" id="value_${conceptIds}" />
</c:when>
<c:when test="${thisConcept.datatype.hl7Abbreviation == 'CWE'}">
<openmrs:fieldGen type="org.openmrs.Concept" formFieldName="value_${conceptId}" val="" parameters="noBind=true|showAnswers=${conceptId}" />
<openmrs:fieldGen type="org.openmrs.Concept" formFieldName="value_${conceptIds}" val="" parameters="noBind=true|showAnswers=${conceptIds}" />
</c:when>
<c:otherwise>
<input type="text" id="value_${conceptId}"/>
<input type="text" id="value_${conceptIds}"/>
</c:otherwise>
</c:choose>

<openmrs:message code="general.onDate"/>
<openmrs:fieldGen type="java.util.Date" formFieldName="date_${conceptId}" val="" parameters="noBind=true" />
<input type="button" value="<openmrs:message code="general.save"/>" onClick="handleAddCustomObs(${conceptId})"/>
<input type="button" value="<openmrs:message code="general.cancel"/>" onClick="showHideDiv('newCustomObs_${conceptId}')"/>
<openmrs:fieldGen type="java.util.Date" formFieldName="date_${conceptIds}" val="" parameters="noBind=true" />
<input type="button" value="<openmrs:message code="general.save"/>" onClick="handleAddCustomObs(${conceptIds})"/>
<input type="button" value="<openmrs:message code="general.cancel"/>" onClick="showHideDiv('newCustomObs_${conceptIds}')"/>
</td>
</c:if>
</tr>
Expand Down
28 changes: 14 additions & 14 deletions webapp/src/main/webapp/WEB-INF/view/portlets/patientGraphs.jsp
Expand Up @@ -70,39 +70,39 @@ table#labTestTable th {
</c:if>
</td>
</tr>
<c:forEach items="${fn:split(graphConceptString, '-')}" var="conceptId" varStatus="varStatus">
<c:if test="${conceptId != ''}">
<c:forEach items="${fn:split(graphConceptString, '-')}" var="conceptIds" varStatus="varStatus">
<c:if test="${conceptIds != ''}">
<tr>
<td>
<div id="conceptBox-${conceptId}" style="text-align: center;">
<div id="conceptBox-${conceptIds}" style="text-align: center;">
<h1>
<span class="conceptGraphTitle"></span>
<openmrs:message code="patientDashboard.graphs.title"/>
</h1>
<a class="graphToggleLink" href="#conceptBox-${conceptId}"><openmrs:message code="patientDashboard.graphs.hide"/></a>
<a class="graphToggleLink" href="#conceptBox-${conceptIds}"><openmrs:message code="patientDashboard.graphs.hide"/></a>
<div class="conceptBox-body">
<div style="margin: 10px auto; height: 300px; width: 600px; align: center;" align="center" id="conceptGraphBox-${conceptId}">
<div style="margin: 10px auto; height: 300px; width: 600px; align: center;" align="center" id="conceptGraphBox-${conceptIds}">
<openmrs:message code="general.loading" />
</div>
<div align="center">
<div style="width: 750px; overflow: auto; border: 1px solid black;">
<openmrs:obsTable observations="${model.patientObs}"
concepts="${conceptId}"
concepts="${conceptIds}"
conceptLink="admin/observations/personObs.form?personId=${model.patientId}&"
id="labTestTable" showEmptyConcepts="false"
showConceptHeader="true" showDateHeader="true"
orientation="horizontal" sort="asc" combineEqualResults="true"
limit="-1" />
</div>
<div align="center" valign="top" style="font-size: .9em"><a
href="?patientId=${patient.patientId}&patientGraphConceptRemove=true&patientGraphConcept=${conceptId}"><openmrs:message
href="?patientId=${patient.patientId}&patientGraphConceptRemove=true&patientGraphConcept=${conceptIds}"><openmrs:message
code="general.remove" /></a> <br />
<br />
</div>
</div>
</div>
</div>
<a id="concept-${conceptId}"></a>
<a id="concept-${conceptIds}"></a>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -178,15 +178,15 @@ table#labTestTable th {
}
function loadGraphs() {
<c:forEach items="${fn:split(graphConceptString, '-')}" var="conceptId">
<c:if test="${conceptId != ''}">
<c:forEach items="${fn:split(graphConceptString, '-')}" var="conceptIds">
<c:if test="${conceptIds != ''}">
<openmrs:globalProperty var="colorAbsolute" key="graph.color.absolute"/>
<openmrs:globalProperty var="colorNormal" key="graph.color.normal"/>
<openmrs:globalProperty var="colorCritical" key="graph.color.critical"/>
$j.getJSON("patientGraphJson.form?patientId=${patient.patientId}&conceptId=${conceptId}", function(json){
$j("#conceptBox-${conceptId} .conceptGraphTitle").html(json.name);
$j.getJSON("patientGraphJson.form?patientId=${patient.patientId}&conceptId=${conceptIds}", function(json){
$j("#conceptBox-${conceptIds} .conceptGraphTitle").html(json.name);
var plot = $j.plot($j('#conceptGraphBox-${conceptId}'),
var plot = $j.plot($j('#conceptGraphBox-${conceptIds}'),
[{
data: json.data,
lines:{show:true},
Expand Down Expand Up @@ -217,7 +217,7 @@ table#labTestTable th {
grid: { hoverable: true, clickable: true }
});
$j("#conceptBox-${conceptId}").bind("plothover", function (event, pos, item) {
$j("#conceptBox-${conceptIds}").bind("plothover", function (event, pos, item) {
$j("#tooltip").remove();
plot.unhighlight();
if (item) {
Expand Down
21 changes: 13 additions & 8 deletions webapp/src/main/webapp/WEB-INF/view/portlets/patientHeader.jsp
Expand Up @@ -165,7 +165,7 @@
<table id="patientHeaderObs">
<openmrs:globalProperty key="concept.weight" var="weightConceptId" />
<openmrs:globalProperty key="concept.height" var="heightConceptId" />
<openmrs:globalProperty key="concept.cd4_count" var="cd4ConceptId" />
<openmrs:globalProperty key="dashboard.header.showConcept" var="conceptIds" listSeparator="," />

<tr class="patientObsRow">
<th id="patientHeaderObsWeight"><openmrs:message
Expand All @@ -178,13 +178,18 @@
observations="${model.patientObs}" concept="${heightConceptId}"
showUnits="true" locale="${model.locale}" showDate="false" /> )
</small></th>
<td id="patientHeaderObsCD4"><openmrs:message code="Patient.cd4" />:
<openmrs_tag:mostRecentObs observations="${model.patientObs}"
concept="${cd4ConceptId}" locale="${model.locale}" /></td>
<td id="patientHeaderObsReturnVisit"><openmrs:message
code="Patient.returnVisit" />: <openmrs_tag:mostRecentObs
observations="${model.patientObs}" concept="5096"
locale="${model.locale}" /></td>

<c:forEach items="${conceptIds}" var="conceptId">
<td class="patientRecentObsConfigured">
<openmrs:concept conceptId="${conceptId}" var="c" nameVar="n" numericVar="num" shortestNameVar="sn">
<span title="${n.description}">${sn}:</span>
</openmrs:concept>
<openmrs_tag:mostRecentObs
observations="${model.patientObs}" concept="${conceptId}"
showUnits="true" locale="${model.locale}" showDate="false" />
</td>
</c:forEach>

<td id="patientHeaderObsRegimen"><openmrs:message
code="Patient.regimen" />: <span id="patientHeaderRegimen">
<c:forEach items="${model.currentDrugOrders}" var="drugOrder"
Expand Down
3 changes: 0 additions & 3 deletions webapp/src/main/webapp/openmrs.css
Expand Up @@ -368,9 +368,6 @@ tr td#patientHeaderObsWeight{
tr td#patientHeaderObsRegimen{
border-right: 0px solid white;
}
tr td#patientHeaderObsReturnVisit {
display: none;
}

#patientHeader a.offColor, #patientHeader a.offColor:link, #patientHeader a.offColor:active, #patientHeader a.offColor:visited, #patientHeader a.offColor:hover {
color: #ffffff;
Expand Down

0 comments on commit bad513c

Please sign in to comment.