Issue Fixes

This commit is contained in:
Sk Shaifat Murshed 2025-02-05 12:46:14 +05:30
parent a84ddd9f03
commit c5df13a8f2
10 changed files with 362 additions and 73 deletions

View File

@ -1,8 +1,18 @@
<div> <div>
<p-table #dt2 dataKey="id" [value]="appointments" [paginator]="true" [rows]="10" [totalRecords]="totalRecords" <p-table
[lazy]="true" (onLazyLoad)="loadappointments($event)" [rowsPerPageOptions]="[10, 20, 50]" #dt2
[responsiveLayout]="'scroll'" [globalFilterFields]="['id', 'name', 'status']" dataKey="id"
[filters]="{ global: { value: '', matchMode: 'contains' } }" class="table table-striped" [value]="appointments"
[paginator]="true"
[rows]="10"
[totalRecords]="totalRecords"
[lazy]="true"
(onLazyLoad)="loadappointments($event)"
[rowsPerPageOptions]="[10, 20, 50]"
[responsiveLayout]="'scroll'"
[globalFilterFields]="['id', 'name', 'status']"
[filters]="{ global: { value: '', matchMode: 'contains' } }"
class="table table-striped"
> >
<ng-template pTemplate="caption"> <ng-template pTemplate="caption">
<div class="flex align-items-center justify-content-between mb-3 gap-3"> <div class="flex align-items-center justify-content-between mb-3 gap-3">
@ -24,7 +34,11 @@
</span> </span>
</div> </div>
<div> <div>
<button pButton class="p-button-rounded p-button-secondary ml-2" (click)="loadappointments($event)"> <button
pButton
class="p-button-rounded p-button-secondary ml-2"
(click)="loadappointments($event)"
>
<i class="pi pi-refresh"></i> <i class="pi pi-refresh"></i>
</button> </button>
<button <button
@ -63,7 +77,16 @@
<tr> <tr>
<td>{{ appointment.firstName }} {{ appointment.lastName }}</td> <td>{{ appointment.firstName }} {{ appointment.lastName }}</td>
<td>{{ appointment.doctor }}</td> <td>{{ appointment.doctor }}</td>
<td></td> <td>
<i
class="pi"
[ngClass]="{
'pi-mars text-primary': appointment.gender === 1,
'pi-venus text-pink-500': appointment.gender === 2
}"
></i>
{{ getGenderLabel(appointment.gender) }}
</td>
<td>{{ appointment.dateOfAppointment | date }}</td> <td>{{ appointment.dateOfAppointment | date }}</td>
<td><i class="pi pi-clock"></i> {{ appointment.timeOfAppointment }}</td> <td><i class="pi pi-clock"></i> {{ appointment.timeOfAppointment }}</td>
<td>{{ appointment.mobile }}</td> <td>{{ appointment.mobile }}</td>
@ -89,7 +112,6 @@
> >
<form #appointmentForm="ngForm" (ngSubmit)="saveAppointment(appointmentForm)"> <form #appointmentForm="ngForm" (ngSubmit)="saveAppointment(appointmentForm)">
<div class="p-fluid grid justify-content-center"> <div class="p-fluid grid justify-content-center">
<div class="field col-md-5"> <div class="field col-md-5">
<label for="fname">First Name</label> <label for="fname">First Name</label>
<span class="p-input-icon-left"> <span class="p-input-icon-left">
@ -110,9 +132,21 @@
<div class="field col-md-5"> <div class="field col-md-5">
<label>Gender</label> <label>Gender</label>
<div class="flex align-items-center"> <div class="flex align-items-center">
<p-radioButton name="gender" value="1" [(ngModel)]="appointment.gender" inputId="male" required></p-radioButton> <p-radioButton
name="gender"
value="1"
[(ngModel)]="appointment.gender"
inputId="male"
required
></p-radioButton>
<label for="male" class="ml-2 mr-3">Male</label> <label for="male" class="ml-2 mr-3">Male</label>
<p-radioButton name="gender" value="2" [(ngModel)]="appointment.gender" inputId="female" required></p-radioButton> <p-radioButton
name="gender"
value="2"
[(ngModel)]="appointment.gender"
inputId="female"
required
></p-radioButton>
<label for="female" class="ml-2">Female</label> <label for="female" class="ml-2">Female</label>
</div> </div>
</div> </div>
@ -124,13 +158,25 @@
<i class="pi pi-phone"></i> <i class="pi pi-phone"></i>
<input pInputText id="mobile" name="mobile" [(ngModel)]="appointment.mobile" required /> <input pInputText id="mobile" name="mobile" [(ngModel)]="appointment.mobile" required />
</span> </span>
<small class="p-error" *ngIf="appointmentForm.controls.mobile?.invalid && appointmentForm.controls.mobile?.touched">Mobile number Required</small> <small
class="p-error"
*ngIf="
appointmentForm.controls.mobile?.invalid && appointmentForm.controls.mobile?.touched
"
>Mobile number Required</small
>
</div> </div>
<div class="field col-md-11"> <div class="field col-md-11">
<label for="mobile">Address</label> <label for="mobile">Address</label>
<span class="p-input-icon-left"> <span class="p-input-icon-left">
<i class="pi pi-map-marker"></i> <i class="pi pi-map-marker"></i>
<input pInputText id="Address" name="Address" [(ngModel)]="appointment.address" required /> <input
pInputText
id="Address"
name="Address"
[(ngModel)]="appointment.address"
required
/>
</span> </span>
</div> </div>
@ -138,40 +184,75 @@
<label for="email">Email ID</label> <label for="email">Email ID</label>
<span class="p-input-icon-left"> <span class="p-input-icon-left">
<i class="pi pi-envelope"></i> <i class="pi pi-envelope"></i>
<input pInputText id="email" name="email" [(ngModel)]="appointment.email" required/> <input pInputText id="email" name="email" [(ngModel)]="appointment.email" required />
</span> </span>
<small class="p-error" *ngIf="appointmentForm.controls.email?.invalid && appointmentForm.controls.email?.touched">Email address Required</small> <small
class="p-error"
*ngIf="appointmentForm.controls.email?.invalid && appointmentForm.controls.email?.touched"
>Email address Required</small
>
</div> </div>
<div class="field col-md-1"></div> <div class="field col-md-1"></div>
<div class="field col-md-5"> <div class="field col-md-5">
<label for="dob">Date of Birth</label> <label for="dob">Date of Birth</label>
<p-calendar id="dob" required name="dob" [(ngModel)]="appointment.dob" [showIcon]="true" required></p-calendar> <p-calendar
<small class="p-error" *ngIf="appointmentForm.controls.dob?.invalid && appointmentForm.controls.dob?.touched">DOB Required</small> id="dob"
required
name="dob"
[(ngModel)]="appointment.dob"
[showIcon]="true"
required
></p-calendar>
<small
class="p-error"
*ngIf="appointmentForm.controls.dob?.invalid && appointmentForm.controls.dob?.touched"
>DOB Required</small
>
</div> </div>
<div class="field col-md-5"> <div class="field col-md-5">
<label for="doctor">Consulting Doctor</label> <label for="doctor">Consulting Doctor</label>
<p-dropdown id="doctor" name="doctor" [(ngModel)]="appointment.doctorId" [options]="doctorOptions" placeholder="Select Doctor" optionLabel="label" optionValue="value" required></p-dropdown> <p-dropdown
id="doctor"
name="doctor"
[(ngModel)]="appointment.doctorId"
[options]="doctorOptions"
placeholder="Select Doctor"
optionLabel="label"
optionValue="value"
required
></p-dropdown>
</div> </div>
<div class="field col-md-1"></div> <div class="field col-md-1"></div>
<div class="field col-md-5"> <div class="field col-md-5">
<label for="date">Date of Appointment</label> <label for="date">Date of Appointment</label>
<p-calendar id="date" name="date" [(ngModel)]="appointment.dateOfAppointment" [showIcon]="true" required></p-calendar> <p-calendar
id="date"
name="date"
[(ngModel)]="appointment.dateOfAppointment"
[showIcon]="true"
required
></p-calendar>
</div> </div>
<div class="field col-md-5"> <div class="field col-md-5">
<label for="time">Time Of Appointment</label> <label for="time">Time Of Appointment</label>
<span class="p-input-icon-left"> <span class="p-input-icon-left">
<i class="pi pi-clock"></i> <i class="pi pi-clock"></i>
<input pInputText id="time" name="time" type="time" [(ngModel)]="appointment.timeOfAppointment" required /> <input
pInputText
id="time"
name="time"
type="time"
[(ngModel)]="appointment.timeOfAppointment"
required
/>
</span> </span>
</div> </div>
<div class="field col-md-1"></div> <div class="field col-md-1"></div>
<!-- Injury (Full Width) -->
<div class="field col-md-5"> <div class="field col-md-5">
<label for="injury">Injury/Condition</label> <label for="injury">Injury/Condition</label>
<span class="p-input-icon-left"> <span class="p-input-icon-left">
@ -179,41 +260,92 @@
<input pInputText id="injury" name="injury" [(ngModel)]="appointment.injuryORContion" /> <input pInputText id="injury" name="injury" [(ngModel)]="appointment.injuryORContion" />
</span> </span>
</div> </div>
<!--
<div class="field col-md-5"> <div class="field col-md-5">
<label for="insurance">Insurance Provider</label> <label for="insurance">Insurance Provider</label>
<span class="p-input-icon-left"> <span class="p-input-icon-left">
<i class="pi pi-credit-card"></i> <i class="pi pi-credit-card"></i>
<input pInputText id="insurance" name="insuranceProvider" [(ngModel)]="appointment.insuranceProvider" /> <input
pInputText
id="insurance"
name="insuranceProvider"
[(ngModel)]="appointment.insuranceProvider"
/>
</span> </span>
</div> </div>
--> <div class="field col-md-1"></div>
<!-- <div class="field col-md-5">
<div class="field col-md-5">
<label for="status">Appointment Status</label> <label for="status">Appointment Status</label>
<p-dropdown id="status" name="status" [(ngModel)]="appointment.status" [options]="appointmentStatuses" placeholder="Select Status" required></p-dropdown> <p-dropdown
id="status"
name="status"
[(ngModel)]="appointment.appointmentStatus"
[options]="appointmentStatuses"
optionLabel="label"
optionValue="value"
placeholder="Select Status"
></p-dropdown>
</div> </div>
<div class="field col-md-5"> <div class="field col-md-5">
<label for="visitType">Visit Type</label> <label for="visitType">Visit Type</label>
<p-dropdown id="visitType" name="visitType" [(ngModel)]="appointment.visitType" [options]="visitTypes" placeholder="Select Visit Type" required></p-dropdown> <p-dropdown
id="visitType"
name="visitType"
[(ngModel)]="appointment.visitType"
[options]="visitTypes"
optionLabel="label"
optionValue="value"
placeholder="Select Visit Type"
></p-dropdown>
</div> </div>
<div class="field col-md-1"></div>
<div class="field col-md-5"> <div class="field col-md-5">
<label for="paymentStatus">Payment Status</label> <label for="paymentStatus">Payment Status</label>
<p-dropdown id="paymentStatus" name="paymentStatus" [(ngModel)]="appointment.paymentStatus" [options]="paymentStatuses" placeholder="Select Payment Status" required></p-dropdown> <p-dropdown
</div> --> id="paymentStatus"
name="paymentStatus"
[(ngModel)]="appointment.paymentStatus"
[options]="paymentStatuses"
optionLabel="label"
optionValue="value"
placeholder="Select Payment Status"
></p-dropdown>
</div>
<!-- Notes (Full Width) --> <!-- Notes (Full Width) -->
<div class="field col-11"> <div class="field col-11">
<label for="notes">Notes</label> <label for="notes">Notes</label>
<textarea id="notes" name="notes" [(ngModel)]="appointment.note" rows="5"cols="30"pInputTextarea></textarea> <textarea
id="notes"
name="notes"
[(ngModel)]="appointment.note"
rows="5"
cols="30"
pInputTextarea
></textarea>
</div> </div>
<div class="field col-11 flex justify-content-end"> <div class="field col-11 flex justify-content-end">
<button pButton type="submit" label="Save" class="p-button-success" [disabled]="appointmentForm.invalid"></button> <button
<button pButton type="button" label="Cancel" class="p-button-secondary ml-2" (click)="closeDialog()"></button> pButton
type="submit"
label="Save"
class="p-button-success"
[disabled]="appointmentForm.invalid"
></button>
<button
pButton
type="button"
label="Cancel"
class="p-button-secondary ml-2"
(click)="closeDialog()"
></button>
</div> </div>
</div> </div>
</form> </form>

View File

@ -2,11 +2,11 @@ import { ConfirmationService, ToasterService } from '@abp/ng.theme.shared';
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { NgForm } from '@angular/forms'; import { NgForm } from '@angular/forms';
import { AppointmentDto } from '@proxy/appoinments/dto'; import { AppointmentDto, CreateOrUpdateAppointmentDto } from '@proxy/appoinments/dto';
import { AppointmentService } from '@proxy/appointments'; import { AppointmentService } from '@proxy/appointments';
import { DoctorService } from '@proxy/doctors'; import { DoctorService } from '@proxy/doctors';
import { PagingSortResultDto } from '@proxy/dto'; import { PagingSortResultDto } from '@proxy/dto';
import { Gender } from '@proxy/global-enum'; import { appointmentStatus, Gender, paymentStatus, visitType } from '@proxy/global-enum';
@Component({ @Component({
selector: 'app-view-appointment', selector: 'app-view-appointment',
@ -21,11 +21,29 @@ export class ViewAppointmentComponent {
isEditing = false; isEditing = false;
appointmentDialog = false; appointmentDialog = false;
genders = Gender; genders = Gender;
appointmentStatuses = Object.keys(appointmentStatus)
.filter(key => !isNaN(Number(key)))
.map(key => ({
label: appointmentStatus[key as unknown as keyof typeof appointmentStatus],
value: Number(key),
}));
visitTypes = Object.keys(visitType)
.filter(key => !isNaN(Number(key)))
.map(key => ({
label: visitType[key as unknown as keyof typeof visitType],
value: Number(key),
}));
paymentStatuses = Object.keys(paymentStatus)
.filter(key => !isNaN(Number(key)))
.map(key => ({
label: paymentStatus[key as unknown as keyof typeof paymentStatus],
value: Number(key),
}));;
isEditMode: boolean = false; isEditMode: boolean = false;
loading: boolean = false; loading: boolean = false;
params: PagingSortResultDto; params: PagingSortResultDto;
appointment: AppointmentDto = { appointment: CreateOrUpdateAppointmentDto = {
id: '', id: '',
firstName: '', firstName: '',
lastName: '', lastName: '',
@ -39,6 +57,10 @@ export class ViewAppointmentComponent {
timeOfAppointment: '', timeOfAppointment: '',
injuryORContion: '', injuryORContion: '',
note: '', note: '',
appointmentStatus: appointmentStatus.Scheduled,
visitType: visitType.NewPatient,
paymentStatus: paymentStatus.Unpaid,
insuranceProvider: '',
}; };
appointments = []; appointments = [];
@ -46,20 +68,6 @@ export class ViewAppointmentComponent {
doctors = []; doctors = [];
doctorOptions = []; doctorOptions = [];
appointmentStatuses = [
{ label: 'Scheduled', value: 'Scheduled' },
{ label: 'Completed', value: 'Completed' },
{ label: 'Canceled', value: 'Canceled' },
];
visitTypes = [
{ label: 'New Patient', value: 'NewPatient' },
{ label: 'Follow-up', value: 'Follow-up' },
];
paymentStatuses = [
{ label: 'Pending', value: 'Pending' },
{ label: 'Paid', value: 'Paid' },
{ label: 'Unpaid', value: 'Unpaid' },
];
createPermission = true; createPermission = true;
editPermission = true; editPermission = true;
@ -83,6 +91,9 @@ export class ViewAppointmentComponent {
globalFilter: null, globalFilter: null,
}); });
} }
getGenderLabel(gender: number): string {
return gender === Gender.Male ? 'Male' : gender === Gender.Female ? 'Female' : 'Unknown';
}
loadappointments(event: any) { loadappointments(event: any) {
this.loading = true; this.loading = true;
let order = event.sortOrder == 1 ? ' asc' : ' desc'; let order = event.sortOrder == 1 ? ' asc' : ' desc';
@ -96,7 +107,7 @@ export class ViewAppointmentComponent {
this.AppointmentService.getAppointmentList(this.params).subscribe(data => { this.AppointmentService.getAppointmentList(this.params).subscribe(data => {
this.appointments = data.items; this.appointments = data.items;
debugger debugger;
this.totalRecords = data.totalCount; this.totalRecords = data.totalCount;
this.loading = false; this.loading = false;
}); });
@ -117,6 +128,10 @@ export class ViewAppointmentComponent {
note: '', note: '',
doctorId: '', doctorId: '',
address: '', address: '',
appointmentStatus: null,
visitType: null,
paymentStatus: null,
insuranceProvider: '',
}; };
} }
@ -161,17 +176,20 @@ export class ViewAppointmentComponent {
() => { () => {
this.toaster.success('Appointment created successfully', 'Success'); this.toaster.success('Appointment created successfully', 'Success');
this.AppointmentDialog = false; this.AppointmentDialog = false;
// this.loadPatient({ this.loadappointments({
// first: 0, first: 0,
// rows: 10, rows: 10,
// sortField: 'id', sortField: 'id',
// sortOrder: 1, sortOrder: 1,
// globalFilter: null, globalFilter: null,
// }); });
this.closeDialog();
}, },
error => { error => {
console.log(error); console.log(error);
this.closeDialog(); this.toaster.error(error.error.error.message, 'Error');
} }
); );
} }

View File

@ -1,4 +1,7 @@
import type { Gender } from '../../global-enum/gender.enum'; import type { Gender } from '../../global-enum/gender.enum';
import type { appointmentStatus } from '../../global-enum/appointment-status.enum';
import type { visitType } from '../../global-enum/visit-type.enum';
import type { paymentStatus } from '../../global-enum/payment-status.enum';
export interface AppointmentDto { export interface AppointmentDto {
id?: string; id?: string;
@ -30,4 +33,8 @@ export interface CreateOrUpdateAppointmentDto {
timeOfAppointment?: string; timeOfAppointment?: string;
injuryORContion?: string; injuryORContion?: string;
note?: string; note?: string;
insuranceProvider?: string;
appointmentStatus: appointmentStatus;
visitType: visitType;
paymentStatus: paymentStatus;
} }

View File

@ -4964,6 +4964,54 @@
"minimum": null, "minimum": null,
"maximum": null, "maximum": null,
"regex": null "regex": null
},
{
"name": "InsuranceProvider",
"jsonName": null,
"type": "System.String",
"typeSimple": "string",
"isRequired": false,
"minLength": null,
"maxLength": null,
"minimum": null,
"maximum": null,
"regex": null
},
{
"name": "AppointmentStatus",
"jsonName": null,
"type": "HospitalManagementSystem.GlobalEnum.appointmentStatus",
"typeSimple": "HospitalManagementSystem.GlobalEnum.appointmentStatus",
"isRequired": false,
"minLength": null,
"maxLength": null,
"minimum": null,
"maximum": null,
"regex": null
},
{
"name": "VisitType",
"jsonName": null,
"type": "HospitalManagementSystem.GlobalEnum.visitType",
"typeSimple": "HospitalManagementSystem.GlobalEnum.visitType",
"isRequired": false,
"minLength": null,
"maxLength": null,
"minimum": null,
"maximum": null,
"regex": null
},
{
"name": "PaymentStatus",
"jsonName": null,
"type": "HospitalManagementSystem.GlobalEnum.paymentStatus",
"typeSimple": "HospitalManagementSystem.GlobalEnum.paymentStatus",
"isRequired": false,
"minLength": null,
"maxLength": null,
"minimum": null,
"maximum": null,
"regex": null
} }
] ]
}, },
@ -5567,6 +5615,22 @@
} }
] ]
}, },
"HospitalManagementSystem.GlobalEnum.appointmentStatus": {
"baseType": "System.Enum",
"isEnum": true,
"enumNames": [
"Scheduled",
"Completed",
"Canceled"
],
"enumValues": [
1,
2,
3
],
"genericArguments": null,
"properties": null
},
"HospitalManagementSystem.GlobalEnum.Gender": { "HospitalManagementSystem.GlobalEnum.Gender": {
"baseType": "System.Enum", "baseType": "System.Enum",
"isEnum": true, "isEnum": true,
@ -5581,6 +5645,22 @@
"genericArguments": null, "genericArguments": null,
"properties": null "properties": null
}, },
"HospitalManagementSystem.GlobalEnum.paymentStatus": {
"baseType": "System.Enum",
"isEnum": true,
"enumNames": [
"Paid",
"Pending",
"Unpaid"
],
"enumValues": [
1,
2,
3
],
"genericArguments": null,
"properties": null
},
"HospitalManagementSystem.GlobalEnum.Status": { "HospitalManagementSystem.GlobalEnum.Status": {
"baseType": "System.Enum", "baseType": "System.Enum",
"isEnum": true, "isEnum": true,
@ -5597,6 +5677,20 @@
"genericArguments": null, "genericArguments": null,
"properties": null "properties": null
}, },
"HospitalManagementSystem.GlobalEnum.visitType": {
"baseType": "System.Enum",
"isEnum": true,
"enumNames": [
"NewPatient",
"Followup"
],
"enumValues": [
1,
2
],
"genericArguments": null,
"properties": null
},
"HospitalManagementSystem.Patients.Dto.CreateUpdatePatientDto": { "HospitalManagementSystem.Patients.Dto.CreateUpdatePatientDto": {
"baseType": null, "baseType": null,
"isEnum": false, "isEnum": false,

View File

@ -0,0 +1,9 @@
import { mapEnumToOptions } from '@abp/ng.core';
export enum appointmentStatus {
Scheduled = 1,
Completed = 2,
Canceled = 3,
}
export const appointmentStatusOptions = mapEnumToOptions(appointmentStatus);

View File

@ -1,2 +1,5 @@
export * from './appointment-status.enum';
export * from './gender.enum'; export * from './gender.enum';
export * from './payment-status.enum';
export * from './status.enum'; export * from './status.enum';
export * from './visit-type.enum';

View File

@ -0,0 +1,9 @@
import { mapEnumToOptions } from '@abp/ng.core';
export enum paymentStatus {
Paid = 1,
Pending = 2,
Unpaid = 3,
}
export const paymentStatusOptions = mapEnumToOptions(paymentStatus);

View File

@ -0,0 +1,8 @@
import { mapEnumToOptions } from '@abp/ng.core';
export enum visitType {
NewPatient = 1,
Followup = 2,
}
export const visitTypeOptions = mapEnumToOptions(visitType);

View File

@ -24,5 +24,10 @@ namespace HospitalManagementSystem.Appoinments.Dto
public string? TimeOfAppointment { get; set; } public string? TimeOfAppointment { get; set; }
public string? InjuryORContion { get; set; } public string? InjuryORContion { get; set; }
public string? Note { get; set; } public string? Note { get; set; }
public string? InsuranceProvider { get; set; }
public appointmentStatus AppointmentStatus { get; set; }
public visitType VisitType { get; set; }
public paymentStatus PaymentStatus { get; set; }
} }
} }

View File

@ -22,5 +22,9 @@ namespace HospitalManagementSystem.Appointments
public string? TimeOfAppointment { get; set; } public string? TimeOfAppointment { get; set; }
public string? InjuryORContion { get; set; } public string? InjuryORContion { get; set; }
public string? Note { get; set; } public string? Note { get; set; }
public string? InsuranceProvider { get; set; }
public appointmentStatus AppointmentStatus { get; set; }
public visitType VisitType { get; set; }
public paymentStatus PaymentStatus { get; set; }
} }
} }