Skip to content

Commit

Permalink
Merge pull request #475 from udsm-dhis2-lab/feature/gepg_requestmodif…
Browse files Browse the repository at this point in the history
…ication

Merge changes added to Sample API , Discharge API , and GFS CODE SCRIPT
  • Loading branch information
josephatJ authored Nov 14, 2024
2 parents 4fc5758 + 718062b commit 09e1401
Show file tree
Hide file tree
Showing 16 changed files with 400 additions and 359 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -205,25 +205,56 @@ public SampleStatus saveSampleStatus(SampleStatus sampleStatus) throws Exception
@Override
public SampleStatus updateSampleStatus(SampleStatus sampleStatus) throws Exception {

// Retrieve the sample from the database by UUID
Sample sample = this.getSampleByUuid(sampleStatus.getSample().getUuid());
if (sample == null) {
throw new Exception("Sample with ID '" + sampleStatus.getSample().getUuid() + "' does not exist.");
}
User user = new User();
if (sampleStatus.getUser() != null) {
Context.getUserService().getUserByUuid(sampleStatus.getUser().getUuid());

User user;
if (sampleStatus.getUser() != null && sampleStatus.getUser().getUuid() != null) {
// Retrieve the existing user by UUID if specified
user = Context.getUserService().getUserByUuid(sampleStatus.getUser().getUuid());
if (user == null) {
throw new Exception("User with UUID '" + sampleStatus.getUser().getUuid() + "' does not exist.");
}
} else {
// Otherwise, use the authenticated user
user = Context.getAuthenticatedUser();
if (user == null) {
throw new Exception("The user is not authenticated.");
}
}

if (user == null) {
throw new Exception("The user is not authenticated.");
}
// Ensure that sample and user are set on the sampleStatus object
sampleStatus.setSample(sample);
sampleStatus.setUser(user);

// Save the sampleStatus entity
return this.sampleStatusDAO.save(sampleStatus);
}

// public SampleStatus updateSampleStatus(SampleStatus sampleStatus) throws Exception {

// Sample sample = this.getSampleByUuid(sampleStatus.getSample().getUuid());
// if (sample == null) {
// throw new Exception("Sample with ID '" + sampleStatus.getSample().getUuid() + "' does not exist.");
// }
// User user = new User();
// if (sampleStatus.getUser() != null) {
// Context.getUserService().getUserByUuid(sampleStatus.getUser().getUuid());
// } else {
// user = Context.getAuthenticatedUser();
// }

// if (user == null) {
// throw new Exception("The user is not authenticated.");
// }
// sampleStatus.setSample(sample);
// sampleStatus.setUser(user);
// return this.sampleStatusDAO.save(sampleStatus);
// }

@Override
public TestAllocation allocateTestWithSample(TestAllocation testAllocation) throws Exception {
//Check preconditions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,130 +106,132 @@
</div>
</div>
</mat-tab>
<!-- Payments Requests) -->
<mat-tab>
<ng-template mat-tab-label>
<span class="mr-2" [matBadge]="patientBillingDetails.pendingPayments?.length" matBadgePosition="after"
matBadgeOverlap="false" [matBadgeHidden]="
<!-- Payments Requests) -->
<mat-tab>
<ng-template mat-tab-label>
<span class="mr-2" [matBadge]="patientBillingDetails.pendingPayments?.length" matBadgePosition="after"
matBadgeOverlap="false" [matBadgeHidden]="
patientBillingDetails.pendingPayments?.length === 0
">Payments Requests
</span>
</ng-template>
</span>
</ng-template>

<div class="py-4" style="text-align: center">
<table mat-table [dataSource]="dataSource" class="mat-elevation-z8" multiTemplateDataRows>
<div class="py-4" style="text-align: center">
<table mat-table [dataSource]="dataSource" class="mat-elevation-z8" multiTemplateDataRows>

<!-- Position Column -->
<ng-container matColumnDef="position">
<th mat-header-cell *matHeaderCellDef [style.background-color]="color"> # </th>
<td mat-cell *matCellDef="let element"> {{element.position}} </td>
</ng-container>
<!-- Position Column -->
<ng-container matColumnDef="position">
<th mat-header-cell *matHeaderCellDef [style.background-color]="color"> # </th>
<td mat-cell *matCellDef="let element"> {{element.position}} </td>
</ng-container>

<!-- Created Column -->
<ng-container matColumnDef="createdAt">
<th mat-header-cell *matHeaderCellDef [style.background-color]="color"> Created At </th>
<td mat-cell *matCellDef="let element"> {{element.createdAt}} </td>
</ng-container>
<!-- Created Column -->
<ng-container matColumnDef="createdAt">
<th mat-header-cell *matHeaderCellDef [style.background-color]="color"> Created At </th>
<td mat-cell *matCellDef="let element"> {{element.createdAt}} </td>
</ng-container>

<!-- Received By Column -->
<ng-container matColumnDef="receivedBy">
<th mat-header-cell *matHeaderCellDef [style.background-color]="color"> Received By </th>
<td mat-cell *matCellDef="let element"> {{element.receivedBy}} </td>
</ng-container>
<!-- Received By Column -->
<ng-container matColumnDef="receivedBy">
<th mat-header-cell *matHeaderCellDef [style.background-color]="color"> Received By </th>
<td mat-cell *matCellDef="let element"> {{element.receivedBy}} </td>
</ng-container>

<!-- Creator Column -->
<ng-container matColumnDef="creator">
<th mat-header-cell *matHeaderCellDef [style.background-color]="color"> Creator </th>
<td mat-cell *matCellDef="let element"> {{element.creator}} </td>
</ng-container>
<!-- Creator Column -->
<ng-container matColumnDef="creator">
<th mat-header-cell *matHeaderCellDef [style.background-color]="color"> Creator </th>
<td mat-cell *matCellDef="let element"> {{element.creator}} </td>
</ng-container>

<!-- Payment Type Column -->
<ng-container matColumnDef="paymentType">
<th mat-header-cell *matHeaderCellDef [style.background-color]="color"> Payment Type </th>
<td mat-cell *matCellDef="let element"> {{element.paymentType}} </td>
</ng-container>
<!-- Payment Type Column -->
<ng-container matColumnDef="paymentType">
<th mat-header-cell *matHeaderCellDef [style.background-color]="color"> Payment Type </th>
<td mat-cell *matCellDef="let element"> {{element.paymentType}} </td>
</ng-container>

<!-- Reference Number Column -->
<ng-container matColumnDef="referenceNumber">
<th mat-header-cell *matHeaderCellDef [style.background-color]="color"> Control Number </th>
<td mat-cell *matCellDef="let element"> {{element.referenceNumber}} </td>
</ng-container>
<!-- Reference Number Column -->
<ng-container matColumnDef="referenceNumber">
<th mat-header-cell *matHeaderCellDef [style.background-color]="color"> Control Number </th>
<td mat-cell *matCellDef="let element"> {{element.referenceNumber}} </td>
</ng-container>

<!-- Status Column -->
<ng-container matColumnDef="status">
<th mat-header-cell *matHeaderCellDef [style.background-color]="color"> Status </th>
<td mat-cell *matCellDef="let element"> {{element.status}} </td>
</ng-container>
<!-- Status Column -->
<ng-container matColumnDef="status">
<th mat-header-cell *matHeaderCellDef [style.background-color]="color"> Status </th>
<td mat-cell *matCellDef="let element"> {{element.status}} </td>
</ng-container>

<!-- Print Column (No Title) -->
<ng-container matColumnDef="print">
<th mat-header-cell *matHeaderCellDef [style.background-color]="color"> </th>
<td mat-cell *matCellDef="let element">
<button mat-icon-button *ngIf="element.referenceNumber" (click)="printElement(element)">
<mat-icon>print</mat-icon>
</button>
</td>
</ng-container>

<!-- Expanded Content Column -->
<ng-container matColumnDef="expandedDetail">
<td mat-cell *matCellDef="let element" [attr.colspan]="displayedColumns.length">
<div class="example-element-detail" [@detailExpand]="element === expandedElement ? 'expanded' : 'collapsed'">
<table>
<thead>
<tr>
<th>Receipt Number</th>
<th>Control Number</th>
<th>Bill Amount</th>
<th>Paid Amount</th>
<th>Payment Date</th>
<th>Payer Number</th>
<th>Payer Name</th>
<th>PSP Name</th>
<th>A/C Number</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{ element.receiptNumber }}</td>
<td>{{ element.referenceNumber }}</td>
<td>{{ element.billAmount | currency: 'TZS' }}</td>
<td>{{ element.paidAmount | currency: 'TZS' }}</td>
<td>{{ element.gepgpaymentDate }}</td>
<td>{{ element.payerNumber }}</td>
<td>{{ element.payerName }}</td>
<td>{{ element.pspName }}</td>
<td>{{ element.accountNumber }}</td>
</tr>
</tbody>
</table>
</div>
</td>
</ng-container>
<!-- Print Column (No Title) -->
<ng-container matColumnDef="print">
<th mat-header-cell *matHeaderCellDef [style.background-color]="color"> </th>
<td mat-cell *matCellDef="let element">
<button mat-icon-button *ngIf="element.referenceNumber" (click)="printElement(element)">
<mat-icon>print</mat-icon>
</button>
</td>
</ng-container>

<!-- Expanded Content Column -->
<ng-container matColumnDef="expandedDetail">
<td mat-cell *matCellDef="let element" [attr.colspan]="displayedColumns.length">
<div class="example-element-detail"
[@detailExpand]="element === expandedElement ? 'expanded' : 'collapsed'">
<table>
<thead>
<tr>
<th>Receipt Number</th>
<th>Control Number</th>
<th>Bill Amount</th>
<th>Paid Amount</th>
<th>Payment Date</th>
<th>Payer Number</th>
<th>Payer Name</th>
<th>PSP Name</th>
<th>A/C Number</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{ element.receiptNumber }}</td>
<td>{{ element.referenceNumber }}</td>
<td>{{ element.billAmount | currency: 'TZS' }}</td>
<td>{{ element.paidAmount | currency: 'TZS' }}</td>
<td>{{ element.gepgpaymentDate }}</td>
<td>{{ element.payerNumber }}</td>
<td>{{ element.payerName }}</td>
<td>{{ element.pspName }}</td>
<td>{{ element.accountNumber }}</td>
</tr>
</tbody>
</table>
</div>
</td>
</ng-container>


<!-- Header and data rows -->
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"
[ngClass]="{'green': row.status === 'PAID', 'pale-orange': row.referenceNumber}"
(click)="expandedElement = expandedElement === row ? null : row" class="example-element-row"
[class.example-expanded-row]="expandedElement === row">
</tr>
<tr mat-row *matRowDef="let row; columns: ['expandedDetail']" class="example-detail-row"></tr>
</table>
</div>

<!-- Header and data rows -->
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;" [ngClass]="{
'pale-green': row.referenceNumber && (row.status === 'PAID' || !row.status),
'white-background': !row.referenceNumber || row.status !== 'PAID'
}" (click)="expandedElement = expandedElement === row ? null : row" class="example-element-row"
[class.example-expanded-row]="expandedElement === row">
</tr>
<tr mat-row *matRowDef="let row; columns: ['expandedDetail']" class="example-detail-row"></tr>
</table>
</div>


<div>
<!-- <app-quotations
<div>
<!-- <app-quotations
[bills]="patientBillingDetails?.pendingPayments"
[disableControls]="true"
(confirmPayment)="onConfirmBillPayment($event)"
>
</app-quotations> -->
</div>
</mat-tab>
</div>
</mat-tab>
<!-- Loans / Debts -->
<mat-tab>
<ng-template mat-tab-label>
Expand Down Expand Up @@ -331,7 +333,7 @@
</div>
</div>
</mat-tab>

</mat-tab-group>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,15 @@ button {
color: #666666;
}
.pale-green {
background-color: palegreen;
background-color: #cfedd7;
}

.white-background {
background-color: white;
}

.pale-orange {
background-color: #EAA343;
background-color: rgba(255, 166, 0, 0.527);
}

table {
Expand All @@ -34,9 +38,7 @@ tr.example-detail-row {
height: 0;
}

tr.example-element-row:not(.example-expanded-row):hover {
background: whitesmoke;
}
tr.example-element-row:not(.example-expanded-row)

tr.example-element-row:not(.example-expanded-row):active {
background: #efefef;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,11 @@ export class CurrentPatientBillingComponent implements OnInit {
})
);
this.patientBillingDetails$
.pipe(
map((data: any)=>{
console.log("data here .............",data.bills)
}));
this.patientBillingDetails$
.pipe(
map((data: any) => data.payments.map((payment: any, index: number) => ({
position: index + 1,
Expand All @@ -299,6 +304,7 @@ export class CurrentPatientBillingComponent implements OnInit {
payerName: payment.paymentDetails.payerName,
pspName: payment.paymentDetails.pspName,
accountNumber: payment.paymentDetails.accountNumber,

})))
)
.subscribe((payments: Payments[]) => {
Expand Down
1 change: 0 additions & 1 deletion ui/src/app/modules/billing/services/payment.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export class PaymentService {
.pipe(
map((payments: any[]) =>
(payments || []).map((payment, paymentIndex) => {
console.log('Payment-----:', payment); // Log each payment
return new Payment(payment, paymentIndex);
})
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
[shouldShowParentLocation]="true"
[isTabularList]="true"
[itemsPerPage]="10"
[isDischarge]="false"
[encounterType]="'e22e39fd-7db2-45e7-80f1-60fa0d5a4378'"
(selectPatient)="onSelectPatient($event)"
></app-patient-list>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@
<!-- TODO: Softcode the order uuid -->
<!-- {{ locationsIds$ | async | json }} -->
<app-patient-list
[encounterType]="'e22e39fd-7db2-45e7-80f1-60fa0d5a4378'"
[isDischarge]="true"
[encounterType]="'181820aa-88c9-479b-9077-af92f5364329'"
(selectPatient)="onSelectPatient($event)"
[shouldShowParentLocation]="true"
[isTabularList]="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ export class SamplesToCollectComponent implements OnInit, OnChanges {
encounter: order?.encounterUuid,
};
});

this.ordersService.updateOrdersViaEncounter(orders).subscribe({
next: (order) => {
return order;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
])
"
>

<ng-template matTabContent>
<div class="p-2" style="min-height: 200px">
<app-samples-to-accept
Expand Down
Loading

0 comments on commit 09e1401

Please sign in to comment.