Changeset 5361
- Timestamp:
- 08/26/08 13:46:08 (3 months ago)
- Files:
-
- openmrs-modules/patientmatching/src/org/openmrs/module/patientmatching/PatientMatchingActivator.java (modified) (1 diff)
- openmrs-modules/patientmatching/web/module/dupesList.jsp (modified) (1 diff)
- openmrs-modules/patientmatching/web/src/org/openmrs/module/patientmatching/web/MatchingConfigUtilities.java (modified) (4 diffs)
- openmrs-modules/patientmatching/web/src/org/openmrs/module/patientmatching/web/ReportSimpleFormController.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
openmrs-modules/patientmatching/src/org/openmrs/module/patientmatching/PatientMatchingActivator.java
r5267 r5361 235 235 String value = ""; 236 236 try { 237 value = BeanUtils.getProperty(patient, property); 237 String classProperty = property.substring(property.lastIndexOf(".") + 1); 238 value = BeanUtils.getProperty(patient, classProperty); 238 239 } catch (Exception e) { 239 240 logger.debug("Error getting the value for property: " + property, e); openmrs-modules/patientmatching/web/module/dupesList.jsp
r5321 r5361 30 30 <table> 31 31 <tr> 32 <th >Analysis Result</th>32 <th colspan="2">Analysis Result</th> 33 33 </tr> 34 <c:set var="currentGroupId" value="-9999" /> 34 35 <c:forEach items="${analysisResults}" var="analysisResult"> 36 <c:choose> 37 <c:when test="${currentGroupId == analysisResult['Group Id']}"> 38 </c:when> 39 <c:otherwise> 40 <c:set var="currentGroupId" value="${analysisResult['Group Id']}" /> 41 <tr> 42 <td colspan="2">****************************************</td> 43 </tr> 44 <tr> 45 <td>Group</td> 46 <td><c:out value="${analysisResult['Group Id']}" /></td> 47 </tr> 48 <tr> 49 <td colspan="2"> </td> 50 </tr> 51 </c:otherwise> 52 </c:choose> 35 53 <tr> 36 <td> 37 <c:out value="${analysisResult}" />. 38 </td> 54 <td>UID</td> 55 <td><c:out value="${analysisResult['UID']}" /></td> 56 </tr> 57 <c:forEach var="item" items="${analysisResult}"> 58 <c:if test="${item.key != 'Group Id' && item.key != 'UID'}"> 59 <tr> 60 <td> 61 <spring:message code="${item.key}" /> 62 </td> 63 <td> 64 <c:out value="${item.value}" />. 65 </td> 66 </tr> 67 </c:if> 68 </c:forEach> 69 <tr> 70 <td colspan="2"> </td> 39 71 </tr> 40 72 </c:forEach> 73 <tr> 74 <td colspan="2">****************************************</td> 75 </tr> 41 76 </table> 42 77 </div> openmrs-modules/patientmatching/web/src/org/openmrs/module/patientmatching/web/MatchingConfigUtilities.java
r5321 r5361 2 2 3 3 import java.beans.PropertyDescriptor; 4 import java.io.BufferedWriter; 4 5 import java.io.File; 6 import java.io.FileWriter; 7 import java.io.IOException; 8 import java.text.SimpleDateFormat; 5 9 import java.util.ArrayList; 10 import java.util.Arrays; 6 11 import java.util.Collections; 12 import java.util.Date; 7 13 import java.util.Hashtable; 8 14 import java.util.List; 15 import java.util.Map; 16 import java.util.TreeMap; 9 17 10 18 import org.apache.commons.beanutils.PropertyUtils; … … 321 329 } 322 330 323 public static List< String> doAnalysis(){331 public static List<Map<String, String>> doAnalysis() throws IOException { 324 332 325 333 HibernateConnection connection = new HibernateConnection(); … … 360 368 } 361 369 370 List<String> globalIncludeColumns = new ArrayList<String>(); 362 371 DedupMatchResultList list = new DedupMatchResultList(); 363 372 for (MatchingConfig matchingConfig : matchingConfigLists) { … … 377 386 list.sort(); 378 387 } 379 } 380 388 List<String> blockingColumns = Arrays.asList(matchingConfig.getBlockingColumns()); 389 globalIncludeColumns.addAll(blockingColumns); 390 List<String> includeColumns = Arrays.asList(matchingConfig.getIncludedColumnsNames()); 391 globalIncludeColumns.addAll(includeColumns); 392 } 393 381 394 SetSimilarityAnalysis ssa = new SetSimilarityAnalysis(); 382 395 List<List<MatchResult>> groups = ssa.getSimilarSets(list.getResults()); 383 396 List<List<Record>> records = ssa.getSimilarRecords(groups); 384 385 List<String> buffer = new ArrayList<String>(); 386 buffer.add("Possible Similar Record Sets: "); 397 398 int groupId = 0; 399 String separator = "|"; 400 401 SimpleDateFormat format = new SimpleDateFormat("dd-MM-yyyy"); 402 String dateString = format.format(new Date()); 403 404 File reportFile = new File(configFileFolder, "dedup-report-" + dateString); 405 BufferedWriter writer = new BufferedWriter(new FileWriter(reportFile)); 406 407 List<Map<String, String>> buffer = new ArrayList<Map<String, String>>(); 408 409 Collections.sort(globalIncludeColumns); 410 387 411 for (List<Record> recordList: records) { 388 412 for (Record r : recordList) { 389 buffer.add("UID: " + r.getUID()); 390 Hashtable<String, String> ht1 = r.getDemographics(); 391 buffer.add("(Attribute) Phone : " + ht1.get("(Attribute) Phone") + "\t"); 392 } 393 buffer.add("----------------------------------------"); 394 } 413 414 Map<String, String> displayMap = new TreeMap<String, String>(); 415 416 String report = groupId + separator; 417 displayMap.put("Group Id", String.valueOf(groupId)); 418 419 report = report + r.getUID() + separator; 420 displayMap.put("UID", String.valueOf(r.getUID())); 421 422 Hashtable<String, String> h = r.getDemographics(); 423 for(String demographic: globalIncludeColumns) { 424 report = report + h.get(demographic) + separator; 425 if (demographic.indexOf(".") == -1) { 426 displayMap.put(demographic, h.get(demographic)); 427 } else { 428 displayMap.put("patientmatching." + demographic, h.get(demographic)); 429 } 430 } 431 buffer.add(displayMap); 432 report = report.substring(0, report.length() - 1); 433 writer.write(report); 434 writer.write(System.getProperty("line.separator")); 435 } 436 groupId ++; 437 } 438 writer.close(); 439 395 440 return buffer; 396 441 } openmrs-modules/patientmatching/web/src/org/openmrs/module/patientmatching/web/ReportSimpleFormController.java
r5321 r5361 35 35 protected Map<String, Object> referenceData(HttpServletRequest req) throws Exception { 36 36 37 List< String> analysisResult = MatchingConfigUtilities.doAnalysis();37 List<Map<String, String>> analysisResult = MatchingConfigUtilities.doAnalysis(); 38 38 39 39 Map<String, Object> requestMap = new HashMap<String, Object>();