Changeset 5043
- Timestamp:
- 07/25/08 04:50:38 (6 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
openmrs-modules/simplelabentry/web/module/portlets/orderEntry.jsp
r5032 r5043 27 27 if (msg.objs[0].patientId) { 28 28 var patient = msg.objs[0]; 29 30 DWRSimpleLabEntryService.getPatient(patient.patientId, function(labPatient) { loadPatient(labPatient) }); 31 clearPatientAndSearchFields(); 29 32 _selectedPatientId = patient.patientId; 30 33 $j("#otherIdentifier").text($j("#patientIdentifier").val()); 31 DWRSimpleLabEntryService.getPatient(patient.patientId, function(labPatient) { loadPatient(labPatient) }); 32 showDiv('createOrderSection'); 33 hideDiv('patientSearchBox'); 34 $j(".idMatch").hide(); 34 $j("#matchedPatientSection").show(); 35 35 $j(".nameMatch").show(); 36 $j(".createdPatientMatch").hide(); 37 dojo.widget.manager.getWidgetById("pSearch").clearSearch(); 36 38 37 } else if (msg.objs[0].href) 39 38 document.location = msg.objs[0].href; … … 57 56 } 58 57 59 function clearPatientSearchFields() { 60 hideDiv('createOrderSection'); 61 $j("#orderDetailSection").hide(); 62 hideDiv('nameMatchSection'); 63 hideDiv('createPatientSection'); 58 function clearPatientAndSearchFields() { 59 _selectedPatientId = null;; 60 clearSearchFields(); 61 } 62 63 function clearSearchFields() { 64 $j("#otherIdentifier").text(''); 65 $j("#nameMatchSection").hide(); 66 $j("#matchedPatientSection").hide(); 64 67 $j(".idMatch").hide(); 65 68 $j(".nameMatch").hide(); 66 69 $j(".createdPatientMatch").hide(); 67 _selectedPatientId = null; 70 $j("#createPatientSection").hide(); 71 $j(".orderDetailSection").remove(); 72 dojo.widget.manager.getWidgetById("pSearch").clearSearch(); 68 73 } 69 74 70 75 function clearFormFields() { 71 76 $j(".orderField").val(''); 72 dojo.widget.manager.getWidgetById("pSearch").clearSearch();77 clearPatientAndSearchFields(); 73 78 } 74 79 75 80 function showCreatePatient() { 76 clearPatientSearchFields(); 77 showDiv('createPatientSection'); 78 _selectedPatientId = null; 79 } 80 81 function showAddOrder() { 82 $j("#newIdentifierAddSection").hide(); 83 $j("#nameMatchSection").hide(); 84 $j("#orderDetailSection").show(); 81 clearSearchFields(); 82 $j("#createPatientSection").show(); 85 83 } 86 84 … … 88 86 89 87 function findNewPatient() { 90 _selectedPatientId = null; 91 showDiv('nameMatchSection'); 92 showDiv('patientSearchBox'); 88 clearPatientAndSearchFields(); 93 89 dojo.widget.manager.getWidgetById("pSearch").inputNode.select(); 94 90 dojo.widget.manager.getWidgetById("pSearch").inputNode.focus(); 95 91 } 96 92 93 function showNewOrder() { 94 $j("#newIdentifierAddSection").hide(); 95 $j(".orderDetailTemplate").clone().removeClass("orderDetailTemplate").appendTo($j("#newOrderSection")).addClass("orderDetailSection").show(); 96 $j(".orderDetailSection input[name='startDate']").val('${model.orderDate}'); 97 $j(".orderDetailSection select[name='location']").val('${model.orderLocation}'); 98 $j(".orderDetailSection select[name='concept']").val('${model.orderConcept}'); 99 $j(".orderDetailSection :button[name='CreateOrderButton']").click( function() { createOrder(); } ); 100 } 101 97 102 function matchPatientById(patIdType, patId) { 98 clearPatient SearchFields();103 clearPatientAndSearchFields(); 99 104 DWRSimpleLabEntryService.getPatientByIdentifier(patIdType, patId, function(patient) { 100 if (patient.patientId == null) { 101 showDiv('nameMatchSection'); 102 showDiv('patientSearchBox'); 103 } 104 else { 105 _selectedPatientId = patient.patientId; 106 loadPatient(patient); 107 $j(".idMatch").show(); 108 $j(".nameMatch").hide(); 109 $j(".createdPatientMatch").hide(); 110 $j("#orderDetailSection").show(); 111 $j("#createOrderSection").show(); 112 } 113 $('newPatientIdentifier').innerHTML = patId; 114 }); 105 if (patient.patientId == null) { 106 $j("#nameMatchSection").show(); 107 } 108 else { 109 _selectedPatientId = patient.patientId; 110 loadPatient(patient); 111 $j(".idMatch").show(); 112 $j("#matchedPatientSection").show(); 113 $j("#newOrderSection").show(); 114 showNewOrder(); 115 } 116 $('newPatientIdentifier').innerHTML = patId; 117 }); 115 118 } 116 119 … … 121 124 var newFirstName = $('newFirstName').value; 122 125 var newLastName = $('newLastName').value; 123 var newGender = $j("input[ @name='newGender']:checked").val();126 var newGender = $j("input[name='newGender']:checked").val(); 124 127 var newAge = $('newAge').value; 125 128 var newCountyDistrict = $('newCountyDistrict').value; … … 130 133 newCountyDistrict, newCityVillage, newNeighborhoodCell, newAddress1, 131 134 { callback:function(createdPatient) { 135 clearPatientAndSearchFields(); 132 136 _selectedPatientId = createdPatient.patientId; 133 137 $j("#matchedIdentifier").text(newIdent); … … 139 143 $j("#matchedCell").text(createdPatient.neighborhoodCell); 140 144 $j("#matchedAddress1").text(createdPatient.address1); 141 showDiv('createOrderSection'); 142 hideDiv('createPatientSection'); 143 $j(".idMatch").hide(); 144 $j(".nameMatch").hide(); 145 $j(".createdPatientMatch").show(); 145 $j("#matchedPatientSection").show(); 146 $j(".createdPatientMatch").show(); 147 showNewOrder(); 146 148 }, 147 149 errorHandler:function(errorString, exception) { … … 153 155 154 156 function createOrder() { 155 var orderLoc = $j(" #matchedOrderLocation").val();156 var orderConcept = $j(" #matchedOrderConcept").val();157 var orderDate = $j(" #matchedOrderDate").val();158 var accessionNum = $j(" #matchedShortId").val();157 var orderLoc = $j(".orderDetailSection select[name='location']").val(); 158 var orderConcept = $j(".orderDetailSection select[name='concept']").val(); 159 var orderDate = $j(".orderDetailSection input[name='startDate']").val(); 160 var accessionNum = $j(".orderDetailSection input[name='accessionNumber']").val(); 159 161 DWRSimpleLabEntryService.createLabOrder(_selectedPatientId, orderConcept, orderLoc, orderDate, accessionNum, 160 162 { callback:function(createdOrder) { … … 171 173 matchPatientById('${patientIdType}',$('patientIdentifier').value); 172 174 }); 173 174 $j("#ClearSearchButton").click( function() { 175 clearFormFields(); 176 clearPatientSearchFields(); 177 }); 178 $j("#ClearSearchButton2").click( function() { 179 clearFormFields(); 180 clearPatientSearchFields(); 181 }); 182 $j("#ClearPatientResultsButton").click( function() { 183 clearFormFields(); 184 clearPatientSearchFields(); 185 }); 186 187 $j("#ShowCreatePatientButton").click( function() { 188 showCreatePatient(); 189 }); 190 191 $j("#CreateOrderFromIdButton").click( function() { 192 createOrder(); 193 }); 175 194 176 $j("#CreateOrderFromNameButton").click( function() { 195 177 createOrder(); … … 205 187 { callback:function(revisedPatient) { 206 188 loadPatient(revisedPatient); 207 show AddOrder();189 showNewOrder(); 208 190 }, 209 191 errorHandler:function(errorString, exception) { … … 214 196 }); 215 197 $j("#NoIdentifierYesOrderButton").click( function() { 216 show AddOrder();198 showNewOrder(); 217 199 }); 218 200 $j("#NoIdentifierCancelButton").click( function() { 219 clearPatientSearchFields(); 220 }); 221 201 clearSearchFields(); 202 }); 222 203 $j("#FindNewPatientButton").click( function() { 223 204 findNewPatient(); … … 235 216 236 217 <b class="boxHeader">Add New Order</b> 237 <div id="findPatientSection" style="align:left;" class="box" > 218 <div style="align:left;" class="box" > 219 238 220 Enter IMB ID (Long ID): 239 221 <input type="text" id="patientIdentifier" class="orderField" name="patientIdentifier" /> 240 222 <input type="button" value="Search" id="SearchByIdButton" /> 241 <input type="button" value="Clear" id="ClearSearchButton" />223 <input type="button" value="Clear" onclick="clearFormFields();" /> 242 224 <br/><br/> 243 244 <div id=" createOrderSection" class="searchSection" style="display:none;">245 <span id="confirmPatientSection" >246 <span style=" color:blue;display:none;" class="idMatch">The following patient matches this ID.</span>247 <span style=" color:blue;display:none;" class="nameMatch">You have selected the following patient.</span>248 <span style=" color:blue;display:none;" class="createdPatientMatch">The following patient has been created.</span>225 226 <div id="matchedPatientSection" class="searchSection" style="display:none;"> 227 <span id="confirmPatientSection" style="color:blue;"> 228 <span style="display:none;" class="idMatch">The following patient matches this ID.</span> 229 <span style="display:none;" class="nameMatch">You have selected the following patient.</span> 230 <span style="display:none;" class="createdPatientMatch">The following patient has been created.</span> 249 231 </span> 250 <table >232 <table id="matchedPatientTable"> 251 233 <tr> 252 234 <th>Long ID</th> … … 279 261 </b> 280 262 <br/> 281 <div id="orderDetailSection" style="display:none;"> 282 <b>Order Details</b> 283 <table> 284 <tr> 285 <th>Short ID:</th> 286 <td><input type="text" class="orderField" id="matchedShortId" name="matchedShortId" /></td> 287 <th><spring:message code="simplelabentry.orderLocation" />:</td> 288 <td><openmrs_tag:locationField formFieldName="matchedOrderLocation" initialValue="${param.orderLocation}"/></td> 289 <th><spring:message code="simplelabentry.orderType" />:</td> 290 <td> 291 <select id="matchedOrderConcept" class="orderField" name="matchedOrderConcept"> 292 <option value=""></option> 293 <c:forEach items="${model.labSets}" var="labSet" varStatus="labSetStatus"> 294 <option value="${labSet.conceptId}" <c:if test="${param.orderConcept == labSet.conceptId}">selected</c:if>> 295 ${empty labSet.name.shortName ? labSet.name.name : labSet.name.shortName} 296 </option> 297 </c:forEach> 298 </select> 299 </td> 300 <th><spring:message code="simplelabentry.orderDate" />: </td> 301 <td><input type="text" class="orderField" id="matchedOrderDate" name="matchedOrderDate" size="10" value="${param.orderDate}" onFocus="showCalendar(this)" /></td> 302 </tr> 303 </table> 304 <br/> 305 <div id="orderResultsSection" style="display:none;"> 306 <b>Results</b> 307 <c:forEach items="${model.labSets}" var="labSet" varStatus="labSetStatus"> 308 <div id="labResultSection${labSet.conceptId}" style="display:none;"> 309 <form action="#"> 310 <table> 311 <tr> 312 <openmrs:forEachRecord name="conceptSet" conceptSet="${labSet.conceptId}"> 313 <th>${empty record.name.shortName ? record.name.name : record.name.shortName}</th> 314 </openmrs:forEachRecord> 315 </tr> 316 <tr> 317 <openmrs:forEachRecord name="conceptSet" conceptSet="${labSet.conceptId}"> 318 <td><openmrs_tag:obsValueField conceptId="${record.conceptId}" formFieldName="test" size="5" /> 319 </openmrs:forEachRecord> 320 </tr> 321 </table> 322 </form> 323 </div> 324 </c:forEach> 325 </div> 326 <br/> 327 <input type="button" id="CreateOrderFromIdButton" value="Create Order" /> 328 <input type="button" id="ClearPatientResultsButton" value="Cancel, Do not Create" /> 329 </div> 263 <div id="newOrderSection"></div> 330 264 </div> 331 265 … … 369 303 <td> 370 304 <input type="button" value="Create Patient" id="CreatePatientButton" /> 371 <input type="button" value="Cancel" id="ClearSearchButton2">305 <input type="button" value="Cancel" onclick="clearFormFields();"> 372 306 </td> 373 307 </tr> … … 375 309 </div> 376 310 </div> 311 312 <div class="orderDetailTemplate" style="display:none;"> 313 <b>Order Details</b> 314 <form action=""> 315 <input type="hidden" name="patientId" value="" /> 316 <input type="hidden" name="orderId" value="" /> 317 <table> 318 <tr> 319 <th>Short ID:</th> 320 <td><input type="text" class="accessionNumber" name="accessionNumber" /></td> 321 <th><spring:message code="simplelabentry.orderLocation" />:</td> 322 <td><openmrs_tag:locationField formFieldName="location" /></td> 323 <th><spring:message code="simplelabentry.orderType" />:</td> 324 <td> 325 <select name="concept"> 326 <option value=""></option> 327 <c:forEach items="${model.labSets}" var="labSet" varStatus="labSetStatus"> 328 <option value="${labSet.conceptId}">${empty labSet.name.shortName ? labSet.name.name : labSet.name.shortName}</option> 329 </c:forEach> 330 </select> 331 </td> 332 <th><spring:message code="simplelabentry.orderDate" />: </td> 333 <td><input type="text" name="startDate" size="10" onFocus="showCalendar(this)" /></td> 334 </tr> 335 </table> 336 <br/> 337 <div class="orderResultsSection" style="display:none;"> 338 <b>Results</b> 339 <c:forEach items="${model.labSets}" var="labSet" varStatus="labSetStatus"> 340 <div id="labResultSection${labSet.conceptId}" style="display:none;"> 341 <table> 342 <tr> 343 <openmrs:forEachRecord name="conceptSet" conceptSet="${labSet.conceptId}"> 344 <th>${empty record.name.shortName ? record.name.name : record.name.shortName}</th> 345 </openmrs:forEachRecord> 346 </tr> 347 <tr> 348 <openmrs:forEachRecord name="conceptSet" conceptSet="${labSet.conceptId}"> 349 <td><openmrs_tag:obsValueField conceptId="${record.conceptId}" formFieldName="test" size="5" /> 350 </openmrs:forEachRecord> 351 </tr> 352 </table> 353 </div> 354 </c:forEach> 355 </div> 356 <br/> 357 <input type="button" name="CreateOrderButton" value="Create Order" /> 358 <input type="button" value="Cancel, Do not Create" onclick="clearFormFields();" /> 359 </form> 360 </div> openmrs-modules/specimentracking/web/src/org/openmrs/module/specimentracking/web/dwr/DWRSimpleLabEntryService.java
r5032 r5043 30 30 // ******************* 31 31 32 // TODO: Add comments 33 32 34 public LabPatientListItem getPatient(Integer patientId) { 33 35 log.warn("Getting patient: " + patientId);