Skip to content

Commit 6d11b4e

Browse files
authored
Merge branch 'jembi:Jmpi-bug-notification-screen-pointing-to-deleted-GR-2' into Jmpi-bug-notification-screen-pointing-to-deleted-GR-2
2 parents 820b989 + fc393fb commit 6d11b4e

File tree

8 files changed

+35
-17
lines changed

8 files changed

+35
-17
lines changed

JeMPI_Apps/JeMPI_Bootstrapper/src/main/resources/data/postgres/notifications-schema.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ CREATE TABLE IF NOT EXISTS Notification
2626
State VARCHAR(50),
2727
Patient_Id VARCHAR(50),
2828
Names VARCHAR(100),
29-
Golden_Id VARCHAR(50),
29+
Old_Golden_Id VARCHAR(50),
30+
Current_Golden_Id VARCHAR(50),
3031
Score Numeric
3132
);
3233

JeMPI_Apps/JeMPI_Controller/src/main/java/org/jembi/jempi/controller/PsqlNotifications.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ void insert(
2828
final String dID) throws SQLException {
2929

3030
psqlClient.connect(AppConfig.POSTGRESQL_NOTIFICATIONS_DB);
31-
String sql = "INSERT INTO notification (id, type, state, names, created, patient_id, golden_id, score) "
32-
+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
31+
String sql = "INSERT INTO notification (id, type, state, names, created, patient_id, old_golden_id, current_golden_id, score) "
32+
+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
3333
try (PreparedStatement pstmt = psqlClient.prepareStatement(sql)) {
3434
psqlClient.setAutoCommit(false);
3535
pstmt.setObject(1, id);
@@ -39,7 +39,8 @@ void insert(
3939
pstmt.setTimestamp(5, created);
4040
pstmt.setString(6, dID);
4141
pstmt.setString(7, gID);
42-
pstmt.setFloat(8, score);
42+
pstmt.setString(8, gID);
43+
pstmt.setFloat(9, score);
4344
pstmt.executeUpdate();
4445
} catch (SQLException e) {
4546
LOGGER.error("Error executing INSERT statement: {}", e.getMessage(), e);

JeMPI_Apps/JeMPI_LibAPI/src/main/java/org/jembi/jempi/libapi/BackEnd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ private Behavior<Event> getGidsPagedHandler(final GetGidsPagedRequest request) {
436436
private Behavior<Event> postUpdateNotificationHandler(final PostUpdateNotificationRequest request) {
437437
try {
438438
libMPI.startTransaction();
439-
psqlNotifications.updateNotificationState(request.notificationId, request.currentGoldenId);
439+
psqlNotifications.updateNotificationState(request.notificationId, request.oldGoldenId, request.currentGoldenId);
440440
libMPI.sendUpdatedNotificationEvent(request.notificationId, request.oldGoldenId, request.currentGoldenId);
441441
libMPI.closeTransaction();
442442
} catch (SQLException exception) {

JeMPI_Apps/JeMPI_LibAPI/src/main/java/org/jembi/jempi/libapi/PsqlNotifications.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ final class PsqlNotifications {
1111

1212
private static final String NOTIFICATION_TABLE_NAME = "notification";
1313
private static final String QUERY = """
14-
SELECT patient_id, id, names, created, state,type, score, golden_id
14+
SELECT patient_id, id, names, created, state,type, score, old_golden_id, current_golden_id
1515
FROM notification
1616
WHERE created BETWEEN ? AND ? AND state IN (?, ?)
1717
ORDER BY created
@@ -167,10 +167,11 @@ void insertCandidates(
167167
}
168168
}
169169

170-
void updateNotificationState(final String notificationId, final String currentGoldenId) throws SQLException {
170+
void updateNotificationState(final String notificationId, final String oldGoldenId, final String currentGoldenId) throws SQLException {
171171
psqlClient.connect();
172-
String sql = String.format(Locale.ROOT, "update notification set state = '%s', golden_id = '%s' where id = '%s'",
172+
String sql = String.format(Locale.ROOT, "update notification set state = '%s', old_golden_id = '%s', current_golden_id = '%s' where id = '%s'",
173173
"CLOSED",
174+
oldGoldenId,
174175
currentGoldenId,
175176
notificationId);
176177
try (PreparedStatement stmt = psqlClient.prepareStatement(sql)) {

JeMPI_Apps/JeMPI_UI/src/components/notificationWorklist/NotificationWorklist.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ const NotificationWorklist = () => {
185185
notificationId: params.row.id,
186186
notificationType: params.row.type,
187187
patient_id: params.row.patient_id,
188-
golden_id: params.row.golden_id,
188+
golden_id: params.row.current_golden_id,
189189
score: params.row.score,
190190
candidates: params.row.candidates
191191
}

JeMPI_Apps/JeMPI_UI/src/components/notificationWorklist/notificationsColumns.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,22 @@ const NOTIFICATIONS_COLUMNS: GridColDef[] = [
3838
filterable: false
3939
},
4040
{
41-
field: 'golden_id',
42-
headerName: 'Golden ID',
41+
field: 'old_golden_id',
42+
headerName: 'Initial Golden ID',
4343
type: 'number',
4444
flex: 1,
4545
headerClassName: 'super-app-theme--header',
46-
filterable: false
46+
filterable: false,
47+
hideable: true
48+
},
49+
{
50+
field: 'current_golden_id',
51+
headerName: 'Current Golden ID',
52+
type: 'number',
53+
flex: 1,
54+
headerClassName: 'super-app-theme--header',
55+
filterable: false,
56+
hideable: true
4757
},
4858
{
4959
field: 'score',

JeMPI_Apps/JeMPI_UI/src/services/mockData.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ const notifications: Notification[] = [
1212
names: 'Bob Smith',
1313
patient_id: '0x5a',
1414
status: NotificationState.CLOSED,
15-
golden_id: '0x9833',
15+
old_golden_id: '0x9493',
16+
current_golden_id: '0x9833',
1617
score: 0.5,
1718
candidates: [
1819
{
@@ -28,7 +29,8 @@ const notifications: Notification[] = [
2829
names: 'Jane Doe',
2930
patient_id: '0x7j',
3031
status: NotificationState.OPEN,
31-
golden_id: '0x9824',
32+
old_golden_id: '0x9493',
33+
current_golden_id: '0x9833',
3234
score: 0.9,
3335
candidates: [
3436
{
@@ -44,7 +46,8 @@ const notifications: Notification[] = [
4446
names: 'Jane Smith',
4547
patient_id: '0x1a',
4648
status: NotificationState.OPEN,
47-
golden_id: '0x9847',
49+
old_golden_id: '0x9493',
50+
current_golden_id: '0x9833',
4851
score: 0.3,
4952
candidates: [
5053
{
@@ -60,7 +63,8 @@ const notifications: Notification[] = [
6063
names: 'John Themba',
6164
patient_id: '0x9a',
6265
status: NotificationState.OPEN,
63-
golden_id: '0x9866',
66+
old_golden_id: '0x9493',
67+
current_golden_id: '0x9833',
6468
score: 0.7,
6569
candidates: [
6670
{

JeMPI_Apps/JeMPI_UI/src/types/Notification.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ export default interface Notification {
66
names: string
77
patient_id: string | null
88
status: NotificationState
9-
golden_id: string
9+
old_golden_id: string
10+
current_golden_id: string
1011
score: number
1112
linkedTo?: GoldenRecordCandidate
1213
candidates?: GoldenRecordCandidate[]

0 commit comments

Comments
 (0)