feat: implement patient demographic merge and unmerge#128
Open
D3V41 wants to merge 134 commits into
Open
Conversation
- Interface with all method signatures for the copy engine - copyDemographic() uses INSERT INTO...SELECT (single SQL statement, no row-by-row) - DatabaseMetaData replaces information_schema (JDBC standard, H2-compatible) - ConcurrentHashMap caches table existence and column lists across 40+ table copies - validateIdentifier() whitelist prevents SQL injection on dynamic table/column names
…eMgmtIssue, CaseMgmtIssueNotes, CaseMgmtIssueNotesPK JPA entity classes
BillingONItem, Consent, ConsultationRequest, ConsultationRequestExt, DemographicCustArchive, DemographicExtArchive, DigitalSignature, EFormValue, EReferAttachment, EmailAttachment, EmailLog, Measurement, MeasurementsDeleted, OLISQueryLog, OLISResults, PatientLabRouting, Prescription, Prevention, PreventionExt, FormBCAR2020, HRMDocumentToDemographic to support Hibernate detach-persist copy pattern
…ConsultationArchiveGroup
…ns are not orphaned
…ltationArchiveGroup
…ttachment_data copy
- Add DemographicMergeManager interface and DemographicMergeManagerImpl - Add MERGED to PatientStatus enum in Demographic model - Mark primary and secondaries as MERGED after merge (not IN) - Restore to AC on unmerge; deactivate merged record C to IN - Block MERGED and IN patients from re-merging (validation guard)
- Add demographicMergeRecord.jsp (step 1: search & select patients) - Add demographicMergePrimarySelect.jsp (step 2: pick primary record) - Both JSPs use pure JSTL/EL - no scriptlets, Bootstrap 5, OWASP e: encoding - Security check via security:oscarSec tag with c:redirect (no scriptlets) - Add searchDemographicsForMerge() and searchMergedDemographicsForUnmerge() to DemographicManager/DemographicManagerImpl - Refactor DemographicMergeAction to handle search/selectPrimary display routes and use only managers (no direct DAO access)
- Register admin/DemographicMerge action in struts.xml with search, selectPrimary, success, successUnMerge, and failure results - Fix action URLs in both JSPs to use admin/DemographicMerge.do - Add Merge Patient Records link to admin.jsp popup menu - Add Merge Patient Records link to leftNav.jspf - Add admin.admin.mergeDemographic key to all 5 language resource files en, fr, es, pl, pt_BR)
…pyFormBooleanValues(). No generated key is needed here so batching is straightforward. Reduces DB round-trips from O(n) to 1 per form.
In copyCasemgmtNoteGroup(), the previous nested loop fired one JPQL UPDATE per (note × appointment) pair. Rewrite to loop once per appointment and pass all copied note PKs via IN :noteIds, reducing UPDATE statements from notes×appointments down to appointments.
…emographic_merged table Rename DemographicMergeEvent/DemographicMergeEventDao/DemographicMergeEventDaoImpl to DemographicMerge/DemographicMergeDao/DemographicMergeDaoImpl. Change @table annotation from demographic_merge_event to demographic_merged so the new merge entity uses the existing table rather than a separate one.
Remove DemographicMerged.java, DemographicMergedDao.java, and DemographicMergedDaoImpl.java - entirely replaced by the renamed DemographicMerge/DemographicMergeDao classes that map to the same demographic_merged table.
Remove old DemographicMergeRecord2Action, demographic/data/DemographicMergede - rename event class references service class, demographicmergerecord.jsp, the entire commn.merge interceptor pattern (4 files), 10 domain-specific MergedDemographic DAOs, the old REST layer (DemographicMergeService + 3 DTOs), and the old DemographicMergedDaoTest. Fix DemographicSearchResultTransformer and MessageUploader to use Demographic.getHeadRecord() instead of the deleted DemographicMerged service.
Remove @Autowired DemographicMergedDao field and delete the three methods that only existed to serve the deleted old merge action and REST endpoint: mergeDemographics(), unmergeDemographics(), getMergedDemographics(). Remove matching signatures from the DemographicManager interface.
…amed from DemographicMergeEvent)
…ross all SQL files
…demographic_merged
…ng to merge links
…fo on demographic edit
There was a problem hiding this comment.
Sorry @D3V41, your pull request is larger than the review limit of 300000 diff characters
…icMergeManagerImpl.checkPrivilege
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DemographicMergeEventaudit trail tracking which records were merged