Compare commits

...

3 Commits

17 changed files with 706 additions and 51 deletions

View File

@ -51,7 +51,7 @@
> >
<i class="pi pi-plus-circle"></i> <i class="pi pi-plus-circle"></i>
</button> </button>
<button pButton class="p-button-rounded p-button-warning ml-2" (click)="exportPatient()"> <button pButton class="p-button-rounded p-button-warning ml-2" (click)="exportAppointments()">
<i class="pi pi-download"></i> <i class="pi pi-download"></i>
</button> </button>
</div> </div>
@ -132,7 +132,7 @@
<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 <span class="text-danger">*</span></label>
<span class="p-input-icon-left"> <span class="p-input-icon-left">
<i class="pi pi-user"></i> <i class="pi pi-user"></i>
<input pInputText id="fname" name="fname" [(ngModel)]="appointment.firstName" required /> <input pInputText id="fname" name="fname" [(ngModel)]="appointment.firstName" required />
@ -141,7 +141,7 @@
<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="lname">Last Name</label> <label for="lname">Last Name <span class="text-danger">*</span></label>
<span class="p-input-icon-left"> <span class="p-input-icon-left">
<i class="pi pi-user"></i> <i class="pi pi-user"></i>
<input pInputText id="lname" name="lname" [(ngModel)]="appointment.lastName" required /> <input pInputText id="lname" name="lname" [(ngModel)]="appointment.lastName" required />
@ -149,7 +149,7 @@
</div> </div>
<div class="field col-md-5"> <div class="field col-md-5">
<label>Gender</label> <label>Gender <span class="text-danger">*</span></label>
<div class="flex align-items-center"> <div class="flex align-items-center">
<p-radioButton <p-radioButton
name="gender" name="gender"
@ -172,7 +172,7 @@
<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="mobile">Mobile No</label> <label for="mobile">Mobile No <span class="text-danger">*</span></label>
<span class="p-input-icon-left"> <span class="p-input-icon-left">
<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 />
@ -186,7 +186,7 @@
> >
</div> </div>
<div class="field col-md-11"> <div class="field col-md-11">
<label for="mobile">Address</label> <label for="mobile">Address <span class="text-danger">*</span></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 <input
@ -200,7 +200,7 @@
</div> </div>
<div class="field col-md-5"> <div class="field col-md-5">
<label for="email">Email ID</label> <label for="email">Email ID <span class="text-danger">*</span></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 />
@ -214,13 +214,14 @@
<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 <span class="text-danger">*</span></label>
<p-calendar <p-calendar
id="dob" id="dob"
required required
name="dob" name="dob"
[(ngModel)]="appointment.dob" [(ngModel)]="Dateofbirth"
[showIcon]="true" [showIcon]="true"
appendTo="body"
required required
></p-calendar> ></p-calendar>
<small <small
@ -231,7 +232,7 @@
</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 <span class="text-danger">*</span></label>
<p-dropdown <p-dropdown
id="doctor" id="doctor"
name="doctor" name="doctor"
@ -246,18 +247,19 @@
<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 <span class="text-danger">*</span></label>
<p-calendar <p-calendar
id="date" id="date"
name="date" name="date"
[(ngModel)]="appointment.dateOfAppointment" [(ngModel)]="AppointmentDate"
[showIcon]="true" [showIcon]="true"
appendTo="body"
required required
></p-calendar> ></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 <span class="text-danger">*</span></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 <input

View File

@ -20,6 +20,9 @@ export class ViewAppointmentComponent {
patients: []; patients: [];
appointmentDialog = false; appointmentDialog = false;
genders = Gender; genders = Gender;
Dateofbirth: Date = new Date();
AppointmentDate: Date = new Date();
appointmentStatuses = Object.keys(appointmentStatus) appointmentStatuses = Object.keys(appointmentStatus)
.filter(key => !isNaN(Number(key))) .filter(key => !isNaN(Number(key)))
.map(key => ({ .map(key => ({
@ -141,10 +144,33 @@ export class ViewAppointmentComponent {
}; };
} }
exportAppointments() { exportAppointments() {
console.log('Exporting appointment data'); debugger
this.AppointmentService.getExportAppointmentRecord().subscribe(result => {
const binary = atob(result.fileContent);
const len = binary.length;
const bytes = new Uint8Array(len);
for (let i = 0; i < len; i++) {
bytes[i] = binary.charCodeAt(i);
} }
const blob = new Blob([bytes], { type: 'application/xlsx' });
const url = window.URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = url;
link.download = result.fileName;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
window.URL.revokeObjectURL(url);
});
}
editAppointment(appointment: any) { editAppointment(appointment: any) {
debugger; debugger;
this.isEditMode = true; this.isEditMode = true;
@ -153,8 +179,8 @@ export class ViewAppointmentComponent {
this.AppointmentService.getAppointmentById(appointment.id).subscribe(result => { this.AppointmentService.getAppointmentById(appointment.id).subscribe(result => {
debugger; debugger;
this.appointment = result; this.appointment = result;
this.appointment.dateOfAppointment = new Date(result.dateOfAppointment).toISOString().split('T')[0];; this.AppointmentDate = new Date(result.dateOfAppointment);
this.appointment.dob = new Date(result.dob).toISOString().split('T')[0];; this.Dateofbirth = new Date(result.dob);
}); });
} }
@ -181,6 +207,8 @@ export class ViewAppointmentComponent {
Object.values(form.controls).forEach(control => control.markAsTouched()); Object.values(form.controls).forEach(control => control.markAsTouched());
return; return;
} }
this.appointment.dob = this.Dateofbirth.toDateString();
this.appointment.dateOfAppointment = this.AppointmentDate.toDateString();
if (this.isEditMode) { if (this.isEditMode) {
this.AppointmentService.updateAppointment(this.appointment).subscribe( this.AppointmentService.updateAppointment(this.appointment).subscribe(
() => { () => {
@ -197,7 +225,7 @@ export class ViewAppointmentComponent {
}, },
error => { error => {
console.log(error); console.log(error);
this.toaster.error(error.error.error.message, 'Error'); this.toaster.error(error, 'Error');
} }
); );
} else { } else {

View File

@ -226,7 +226,7 @@
<div class="col-6"> <div class="col-6">
<div class="field"> <div class="field">
<label for="admissionDate"><i class="pi pi-calendar"></i> Admission Date</label> <label for="admissionDate"><i class="pi pi-calendar"></i> Admission Date</label>
<p-calendar id="admissionDate" name="admissionDate" [(ngModel)]="selectadmissionDate" showIcon <p-calendar appendTo="body" id="admissionDate" name="admissionDate" [(ngModel)]="selectadmissionDate" showIcon
styleClass="small-calendar" required #admissionDate="ngModel"></p-calendar> styleClass="small-calendar" required #admissionDate="ngModel"></p-calendar>
<small *ngIf="admissionDate.invalid && admissionDate.touched" class="p-error"> <small *ngIf="admissionDate.invalid && admissionDate.touched" class="p-error">
Admission Date is required Admission Date is required
@ -275,6 +275,17 @@
</div> </div>
</div> </div>
</div> </div>
<div class="p-fluid grid">
<div class="col-6">
<div class="field">
<label for="status">Status</label>
<p-dropdown name="status" id="status" [options]="statuslist" [(ngModel)]="selectedstatus"
optionLabel="label" optionValue="value" placeholder="Select status"
required></p-dropdown>
<small *ngIf="selectedstatus === 0" class="p-error">Status is required</small>
</div>
</div>
</div>
<div class="text-right"> <div class="text-right">
<button type="submit" pButton class="btn btn-primary" <button type="submit" pButton class="btn btn-primary"

View File

@ -141,7 +141,7 @@
<div class="col-6"> <div class="col-6">
<div class="field"> <div class="field">
<label for="admissionDate"><i class="pi pi-calendar"></i> Admission Date</label> <label for="admissionDate"><i class="pi pi-calendar"></i> Admission Date</label>
<p-calendar id="admissionDate" name="admissionDate" [(ngModel)]="selectdateOfAdmission" showIcon required <p-calendar appendTo="body" id="admissionDate" name="admissionDate" [(ngModel)]="selectdateOfAdmission" showIcon required
#admissionDate="ngModel"></p-calendar> #admissionDate="ngModel"></p-calendar>
<small *ngIf="admissionDate.invalid && admissionDate.touched" class="p-error"> <small *ngIf="admissionDate.invalid && admissionDate.touched" class="p-error">
Admission Date is required. Admission Date is required.
@ -153,7 +153,7 @@
<div class="col-6"> <div class="col-6">
<div class="field"> <div class="field">
<label for="nextFollowUp"><i class="pi pi-calendar-plus"></i> Next Follow-Up Date</label> <label for="nextFollowUp"><i class="pi pi-calendar-plus"></i> Next Follow-Up Date</label>
<p-calendar id="nextFollowUp" name="nextFollowUp" [(ngModel)]="selectnextFollowUp" showIcon required <p-calendar appendTo="body" id="nextFollowUp" name="nextFollowUp" [(ngModel)]="selectnextFollowUp" showIcon required
#nextFollowUp="ngModel"></p-calendar> #nextFollowUp="ngModel"></p-calendar>
<small *ngIf="nextFollowUp.invalid && nextFollowUp.touched" class="p-error"> <small *ngIf="nextFollowUp.invalid && nextFollowUp.touched" class="p-error">
Next Follow-Up Date is required. Next Follow-Up Date is required.

View File

@ -2,6 +2,7 @@ import type { Gender } from '../../global-enum/gender.enum';
import type { appointmentStatus } from '../../global-enum/appointment-status.enum'; import type { appointmentStatus } from '../../global-enum/appointment-status.enum';
import type { visitType } from '../../global-enum/visit-type.enum'; import type { visitType } from '../../global-enum/visit-type.enum';
import type { paymentStatus } from '../../global-enum/payment-status.enum'; import type { paymentStatus } from '../../global-enum/payment-status.enum';
import type { Doctor } from '../../doctors/models';
export interface AppointmentDto { export interface AppointmentDto {
id?: string; id?: string;
@ -21,6 +22,7 @@ export interface AppointmentDto {
appointmentStatus: appointmentStatus; appointmentStatus: appointmentStatus;
visitType: visitType; visitType: visitType;
paymentStatus: paymentStatus; paymentStatus: paymentStatus;
doctor: Doctor;
} }
export interface CreateOrUpdateAppointmentDto { export interface CreateOrUpdateAppointmentDto {

View File

@ -2,7 +2,7 @@ import { RestService, Rest } from '@abp/ng.core';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import type { PagedResultDto } from '../abp/application/services/dto/models'; import type { PagedResultDto } from '../abp/application/services/dto/models';
import type { AppointmentDto, CreateOrUpdateAppointmentDto } from '../appoinments/dto/models'; import type { AppointmentDto, CreateOrUpdateAppointmentDto } from '../appoinments/dto/models';
import type { PagingSortResultDto } from '../dto/models'; import type { FileDownloadDto, PagingSortResultDto } from '../dto/models';
@Injectable({ @Injectable({
providedIn: 'root', providedIn: 'root',
@ -12,7 +12,7 @@ export class AppointmentService {
createAppointment = (input: CreateOrUpdateAppointmentDto, config?: Partial<Rest.Config>) => createAppointment = (input: CreateOrUpdateAppointmentDto, config?: Partial<Rest.Config>) =>
this.restService.request<any, AppointmentDto>({ this.restService.request<any, void>({
method: 'POST', method: 'POST',
url: '/api/app/appointment/appointment', url: '/api/app/appointment/appointment',
body: input, body: input,
@ -54,8 +54,16 @@ export class AppointmentService {
{ apiName: this.apiName,...config }); { apiName: this.apiName,...config });
getExportAppointmentRecord = (config?: Partial<Rest.Config>) =>
this.restService.request<any, FileDownloadDto>({
method: 'GET',
url: '/api/app/appointment/export-appointment-record',
},
{ apiName: this.apiName,...config });
updateAppointment = (input: CreateOrUpdateAppointmentDto, config?: Partial<Rest.Config>) => updateAppointment = (input: CreateOrUpdateAppointmentDto, config?: Partial<Rest.Config>) =>
this.restService.request<any, AppointmentDto>({ this.restService.request<any, void>({
method: 'PUT', method: 'PUT',
url: '/api/app/appointment/appointment', url: '/api/app/appointment/appointment',
body: input, body: input,

View File

@ -1 +1,2 @@
export * from './appointment.service'; export * from './appointment.service';
export * from './models';

View File

@ -0,0 +1,25 @@
import type { FullAuditedEntity } from '../volo/abp/domain/entities/auditing/models';
import type { Gender } from '../global-enum/gender.enum';
import type { Doctor } from '../doctors/models';
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 Appointment extends FullAuditedEntity<string> {
firstName?: string;
lastName?: string;
gender: Gender;
mobile?: string;
address?: string;
email?: string;
dob?: string;
doctor: Doctor;
dateOfAppointment?: string;
timeOfAppointment?: string;
injuryORContion?: string;
note?: string;
insuranceProvider?: string;
appointmentStatus: appointmentStatus;
visitType: visitType;
paymentStatus: paymentStatus;
}

View File

@ -1 +1,2 @@
export * from './department.service'; export * from './department.service';
export * from './models';

View File

@ -0,0 +1,10 @@
import type { FullAuditedEntity } from '../volo/abp/domain/entities/auditing/models';
export interface Department extends FullAuditedEntity<string> {
departmentNo?: string;
departmentName?: string;
departmentDate?: string;
departmentHead?: string;
status?: string;
description?: string;
}

View File

@ -1 +1,2 @@
export * from './doctor.service'; export * from './doctor.service';
export * from './models';

View File

@ -0,0 +1,19 @@
import type { FullAuditedEntity } from '../volo/abp/domain/entities/auditing/models';
import type { Department } from '../departments/models';
import type { Appointment } from '../appointments/models';
export interface Doctor extends FullAuditedEntity<string> {
firstName?: string;
lastName?: string;
gender?: string;
mobile?: string;
password?: string;
designation?: string;
departmentId?: string;
department: Department;
address?: string;
email?: string;
dob?: string;
education?: string;
appointments: Appointment[];
}

View File

@ -1053,8 +1053,8 @@
} }
], ],
"returnValue": { "returnValue": {
"type": "HospitalManagementSystem.Appoinments.Dto.AppointmentDto", "type": "System.Void",
"typeSimple": "HospitalManagementSystem.Appoinments.Dto.AppointmentDto" "typeSimple": "System.Void"
}, },
"allowAnonymous": null, "allowAnonymous": null,
"implementFrom": "HospitalManagementSystem.Appointments.AppointmentAppService" "implementFrom": "HospitalManagementSystem.Appointments.AppointmentAppService"
@ -1090,8 +1090,8 @@
} }
], ],
"returnValue": { "returnValue": {
"type": "HospitalManagementSystem.Appoinments.Dto.AppointmentDto", "type": "System.Void",
"typeSimple": "HospitalManagementSystem.Appoinments.Dto.AppointmentDto" "typeSimple": "System.Void"
}, },
"allowAnonymous": null, "allowAnonymous": null,
"implementFrom": "HospitalManagementSystem.Appointments.AppointmentAppService" "implementFrom": "HospitalManagementSystem.Appointments.AppointmentAppService"
@ -1132,6 +1132,21 @@
}, },
"allowAnonymous": false, "allowAnonymous": false,
"implementFrom": "HospitalManagementSystem.Appointments.AppointmentAppService" "implementFrom": "HospitalManagementSystem.Appointments.AppointmentAppService"
},
"GetExportAppointmentRecordAsync": {
"uniqueName": "GetExportAppointmentRecordAsync",
"name": "GetExportAppointmentRecordAsync",
"httpMethod": "GET",
"url": "api/app/appointment/export-appointment-record",
"supportedVersions": [],
"parametersOnMethod": [],
"parameters": [],
"returnValue": {
"type": "HospitalManagementSystem.Dto.FileDownloadDto",
"typeSimple": "HospitalManagementSystem.Dto.FileDownloadDto"
},
"allowAnonymous": null,
"implementFrom": "HospitalManagementSystem.Appointments.AppointmentAppService"
} }
} }
}, },
@ -4901,6 +4916,18 @@
"minimum": null, "minimum": null,
"maximum": null, "maximum": null,
"regex": null "regex": null
},
{
"name": "Doctor",
"jsonName": null,
"type": "HospitalManagementSystem.Doctors.Doctor",
"typeSimple": "HospitalManagementSystem.Doctors.Doctor",
"isRequired": false,
"minLength": null,
"maxLength": null,
"minimum": null,
"maximum": null,
"regex": null
} }
] ]
}, },
@ -5117,6 +5144,453 @@
} }
] ]
}, },
"HospitalManagementSystem.Appointments.Appointment": {
"baseType": "Volo.Abp.Domain.Entities.Auditing.FullAuditedEntity<System.Guid>",
"isEnum": false,
"enumNames": null,
"enumValues": null,
"genericArguments": null,
"properties": [
{
"name": "FirstName",
"jsonName": null,
"type": "System.String",
"typeSimple": "string",
"isRequired": false,
"minLength": null,
"maxLength": null,
"minimum": null,
"maximum": null,
"regex": null
},
{
"name": "LastName",
"jsonName": null,
"type": "System.String",
"typeSimple": "string",
"isRequired": false,
"minLength": null,
"maxLength": null,
"minimum": null,
"maximum": null,
"regex": null
},
{
"name": "Gender",
"jsonName": null,
"type": "HospitalManagementSystem.GlobalEnum.Gender",
"typeSimple": "HospitalManagementSystem.GlobalEnum.Gender",
"isRequired": false,
"minLength": null,
"maxLength": null,
"minimum": null,
"maximum": null,
"regex": null
},
{
"name": "Mobile",
"jsonName": null,
"type": "System.String",
"typeSimple": "string",
"isRequired": false,
"minLength": null,
"maxLength": null,
"minimum": null,
"maximum": null,
"regex": null
},
{
"name": "Address",
"jsonName": null,
"type": "System.String",
"typeSimple": "string",
"isRequired": false,
"minLength": null,
"maxLength": null,
"minimum": null,
"maximum": null,
"regex": null
},
{
"name": "Email",
"jsonName": null,
"type": "System.String",
"typeSimple": "string",
"isRequired": false,
"minLength": null,
"maxLength": null,
"minimum": null,
"maximum": null,
"regex": null
},
{
"name": "DOB",
"jsonName": null,
"type": "System.DateTime?",
"typeSimple": "string?",
"isRequired": false,
"minLength": null,
"maxLength": null,
"minimum": null,
"maximum": null,
"regex": null
},
{
"name": "Doctor",
"jsonName": null,
"type": "HospitalManagementSystem.Doctors.Doctor",
"typeSimple": "HospitalManagementSystem.Doctors.Doctor",
"isRequired": false,
"minLength": null,
"maxLength": null,
"minimum": null,
"maximum": null,
"regex": null
},
{
"name": "DateOfAppointment",
"jsonName": null,
"type": "System.DateTime?",
"typeSimple": "string?",
"isRequired": false,
"minLength": null,
"maxLength": null,
"minimum": null,
"maximum": null,
"regex": null
},
{
"name": "TimeOfAppointment",
"jsonName": null,
"type": "System.String",
"typeSimple": "string",
"isRequired": false,
"minLength": null,
"maxLength": null,
"minimum": null,
"maximum": null,
"regex": null
},
{
"name": "InjuryORContion",
"jsonName": null,
"type": "System.String",
"typeSimple": "string",
"isRequired": false,
"minLength": null,
"maxLength": null,
"minimum": null,
"maximum": null,
"regex": null
},
{
"name": "Note",
"jsonName": null,
"type": "System.String",
"typeSimple": "string",
"isRequired": false,
"minLength": null,
"maxLength": null,
"minimum": null,
"maximum": 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
}
]
},
"HospitalManagementSystem.Departments.Department": {
"baseType": "Volo.Abp.Domain.Entities.Auditing.FullAuditedEntity<System.Guid>",
"isEnum": false,
"enumNames": null,
"enumValues": null,
"genericArguments": null,
"properties": [
{
"name": "DepartmentNo",
"jsonName": null,
"type": "System.String",
"typeSimple": "string",
"isRequired": false,
"minLength": null,
"maxLength": null,
"minimum": null,
"maximum": null,
"regex": null
},
{
"name": "DepartmentName",
"jsonName": null,
"type": "System.String",
"typeSimple": "string",
"isRequired": false,
"minLength": null,
"maxLength": null,
"minimum": null,
"maximum": null,
"regex": null
},
{
"name": "DepartmentDate",
"jsonName": null,
"type": "System.DateTime?",
"typeSimple": "string?",
"isRequired": false,
"minLength": null,
"maxLength": null,
"minimum": null,
"maximum": null,
"regex": null
},
{
"name": "DepartmentHead",
"jsonName": null,
"type": "System.String",
"typeSimple": "string",
"isRequired": false,
"minLength": null,
"maxLength": null,
"minimum": null,
"maximum": null,
"regex": null
},
{
"name": "Status",
"jsonName": null,
"type": "System.String",
"typeSimple": "string",
"isRequired": false,
"minLength": null,
"maxLength": null,
"minimum": null,
"maximum": null,
"regex": null
},
{
"name": "Description",
"jsonName": null,
"type": "System.String",
"typeSimple": "string",
"isRequired": false,
"minLength": null,
"maxLength": null,
"minimum": null,
"maximum": null,
"regex": null
}
]
},
"HospitalManagementSystem.Doctors.Doctor": {
"baseType": "Volo.Abp.Domain.Entities.Auditing.FullAuditedEntity<System.Guid>",
"isEnum": false,
"enumNames": null,
"enumValues": null,
"genericArguments": null,
"properties": [
{
"name": "FirstName",
"jsonName": null,
"type": "System.String",
"typeSimple": "string",
"isRequired": false,
"minLength": null,
"maxLength": null,
"minimum": null,
"maximum": null,
"regex": null
},
{
"name": "LastName",
"jsonName": null,
"type": "System.String",
"typeSimple": "string",
"isRequired": false,
"minLength": null,
"maxLength": null,
"minimum": null,
"maximum": null,
"regex": null
},
{
"name": "Gender",
"jsonName": null,
"type": "System.String",
"typeSimple": "string",
"isRequired": false,
"minLength": null,
"maxLength": null,
"minimum": null,
"maximum": null,
"regex": null
},
{
"name": "Mobile",
"jsonName": null,
"type": "System.String",
"typeSimple": "string",
"isRequired": false,
"minLength": null,
"maxLength": null,
"minimum": null,
"maximum": null,
"regex": null
},
{
"name": "Password",
"jsonName": null,
"type": "System.String",
"typeSimple": "string",
"isRequired": false,
"minLength": null,
"maxLength": null,
"minimum": null,
"maximum": null,
"regex": null
},
{
"name": "Designation",
"jsonName": null,
"type": "System.String",
"typeSimple": "string",
"isRequired": false,
"minLength": null,
"maxLength": null,
"minimum": null,
"maximum": null,
"regex": null
},
{
"name": "DepartmentId",
"jsonName": null,
"type": "System.Guid?",
"typeSimple": "string?",
"isRequired": false,
"minLength": null,
"maxLength": null,
"minimum": null,
"maximum": null,
"regex": null
},
{
"name": "Department",
"jsonName": null,
"type": "HospitalManagementSystem.Departments.Department",
"typeSimple": "HospitalManagementSystem.Departments.Department",
"isRequired": false,
"minLength": null,
"maxLength": null,
"minimum": null,
"maximum": null,
"regex": null
},
{
"name": "Address",
"jsonName": null,
"type": "System.String",
"typeSimple": "string",
"isRequired": false,
"minLength": null,
"maxLength": null,
"minimum": null,
"maximum": null,
"regex": null
},
{
"name": "Email",
"jsonName": null,
"type": "System.String",
"typeSimple": "string",
"isRequired": false,
"minLength": null,
"maxLength": null,
"minimum": null,
"maximum": null,
"regex": null
},
{
"name": "DOB",
"jsonName": null,
"type": "System.String",
"typeSimple": "string",
"isRequired": false,
"minLength": null,
"maxLength": null,
"minimum": null,
"maximum": null,
"regex": null
},
{
"name": "Education",
"jsonName": null,
"type": "System.String",
"typeSimple": "string",
"isRequired": false,
"minLength": null,
"maxLength": null,
"minimum": null,
"maximum": null,
"regex": null
},
{
"name": "Appointments",
"jsonName": null,
"type": "[HospitalManagementSystem.Appointments.Appointment]",
"typeSimple": "[HospitalManagementSystem.Appointments.Appointment]",
"isRequired": false,
"minLength": null,
"maxLength": null,
"minimum": null,
"maximum": null,
"regex": null
}
]
},
"HospitalManagementSystem.Documents.EntityDocument": { "HospitalManagementSystem.Documents.EntityDocument": {
"baseType": "Volo.Abp.Domain.Entities.Auditing.AuditedAggregateRoot<System.Guid>", "baseType": "Volo.Abp.Domain.Entities.Auditing.AuditedAggregateRoot<System.Guid>",
"isEnum": false, "isEnum": false,

View File

@ -1,4 +1,5 @@
using HospitalManagementSystem.GlobalEnum; using HospitalManagementSystem.Doctors;
using HospitalManagementSystem.GlobalEnum;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -26,5 +27,7 @@ namespace HospitalManagementSystem.Appoinments.Dto
public appointmentStatus AppointmentStatus { get; set; } public appointmentStatus AppointmentStatus { get; set; }
public visitType VisitType { get; set; } public visitType VisitType { get; set; }
public paymentStatus PaymentStatus { get; set; } public paymentStatus PaymentStatus { get; set; }
public Doctor? Doctor { get; set; }
} }
} }

View File

@ -10,6 +10,7 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\HospitalManagementSystem.Domain.Shared\HospitalManagementSystem.Domain.Shared.csproj" /> <ProjectReference Include="..\HospitalManagementSystem.Domain.Shared\HospitalManagementSystem.Domain.Shared.csproj" />
<ProjectReference Include="..\HospitalManagementSystem.Domain\HospitalManagementSystem.Domain.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -20,6 +20,9 @@ using Microsoft.EntityFrameworkCore;
using System.Linq.Dynamic.Core; using System.Linq.Dynamic.Core;
using Abp.UI; using Abp.UI;
using HospitalManagementSystem.Doctors; using HospitalManagementSystem.Doctors;
using ClosedXML.Excel;
using System.IO;
using Microsoft.AspNetCore.Hosting;
namespace HospitalManagementSystem.Appointments namespace HospitalManagementSystem.Appointments
{ {
@ -29,6 +32,7 @@ namespace HospitalManagementSystem.Appointments
private readonly ICurrentTenant _currentTenant; private readonly ICurrentTenant _currentTenant;
private IRepository<Appointment, Guid> _appointmentsRepository; private IRepository<Appointment, Guid> _appointmentsRepository;
private readonly IRepository<Doctor, Guid> _doctorRepository; private readonly IRepository<Doctor, Guid> _doctorRepository;
private readonly IWebHostEnvironment _env;
public AppointmentAppService(ICurrentUser currentUser, ICurrentTenant currentTenant, IRepository<Appointment, Guid> appointmentsRepository, IRepository<Doctor, Guid> doctorRepository) public AppointmentAppService(ICurrentUser currentUser, ICurrentTenant currentTenant, IRepository<Appointment, Guid> appointmentsRepository, IRepository<Doctor, Guid> doctorRepository)
{ {
@ -62,6 +66,7 @@ namespace HospitalManagementSystem.Appointments
.Take(input.MaxResultCount) .Take(input.MaxResultCount)
.ToListAsync(); .ToListAsync();
var appoinmentdto = ObjectMapper.Map<List<Appointment>, List<AppointmentDto>>(pagedQuery); var appoinmentdto = ObjectMapper.Map<List<Appointment>, List<AppointmentDto>>(pagedQuery);
return new PagedResultDto<AppointmentDto>( return new PagedResultDto<AppointmentDto>(
totalCount, totalCount,
appoinmentdto appoinmentdto
@ -84,18 +89,22 @@ namespace HospitalManagementSystem.Appointments
#endregion #endregion
#region Create Appointment #region Create Appointment
public async Task<AppointmentDto> CreateAppointmentAsync(CreateOrUpdateAppointmentDto input) public async Task CreateAppointmentAsync(CreateOrUpdateAppointmentDto input)
{ {
var appointment = ObjectMapper.Map<CreateOrUpdateAppointmentDto, Appointment>(input); Appointment appointment = new Appointment();
var newdata = ObjectMapper.Map<CreateOrUpdateAppointmentDto, Appointment>(input);
newdata.Doctor = await _doctorRepository.GetAsync(input.DoctorId.Value);
appointment = newdata;
appointment = await _appointmentsRepository.InsertAsync(appointment); appointment = await _appointmentsRepository.InsertAsync(appointment);
return ObjectMapper.Map<Appointment, AppointmentDto>(appointment);
} }
#endregion #endregion
#region Update Appointment #region Update Appointment
public async Task<AppointmentDto> UpdateAppointmentAsync(CreateOrUpdateAppointmentDto input) public async Task UpdateAppointmentAsync(CreateOrUpdateAppointmentDto input)
{
try
{ {
//var appointment = await _appointmentsRepository.GetAsync(input.Id); //var appointment = await _appointmentsRepository.GetAsync(input.Id);
Appointment appointment = new Appointment(); Appointment appointment = new Appointment();
@ -103,7 +112,11 @@ namespace HospitalManagementSystem.Appointments
newdata.Doctor = await _doctorRepository.GetAsync(input.DoctorId.Value); newdata.Doctor = await _doctorRepository.GetAsync(input.DoctorId.Value);
appointment = newdata; appointment = newdata;
appointment = await _appointmentsRepository.UpdateAsync(appointment); appointment = await _appointmentsRepository.UpdateAsync(appointment);
return ObjectMapper.Map<Appointment, AppointmentDto>(appointment); }
catch (Exception ex)
{
throw new Exception(ex.Message);
}
} }
#endregion #endregion
@ -114,5 +127,67 @@ namespace HospitalManagementSystem.Appointments
await _appointmentsRepository.DeleteAsync(id); await _appointmentsRepository.DeleteAsync(id);
} }
#endregion #endregion
#region Export Appointment Data to Excel
public async Task<FileDownloadDto> GetExportAppointmentRecordAsync()
{
var Appointmentrecord = await _appointmentsRepository.GetQueryableAsync().Result.ToListAsync();
var folderPath = Path.Combine(_env.WebRootPath, "temp");
if (!Directory.Exists(folderPath))
{
Directory.CreateDirectory(folderPath); // Ensure the folder exists
}
var filename = "Appointments_" + DateTime.Now.ToString("yyyyMMdd_HHmmss") + ".xlsx";
var filePath = Path.Combine(folderPath, filename);
// Create a workbook and worksheet
using (var workbook = new XLWorkbook())
{
var worksheet = workbook.Worksheets.Add("Appointment");
// Add headers
worksheet.Cell(1, 1).Value = "Name";
worksheet.Cell(1, 2).Value = "Email";
worksheet.Cell(1, 3).Value = "Gender";
worksheet.Cell(1, 4).Value = "Date";
worksheet.Cell(1, 5).Value = "Time";
worksheet.Cell(1, 6).Value = "Mobile";
worksheet.Cell(1, 7).Value = "Doctor";
worksheet.Cell(1, 8).Value = "Injury";
worksheet.Cell(1, 9).Value = "Appointment Status";
worksheet.Cell(1, 10).Value = "Visit Type";
worksheet.Cell(1, 11).Value = "Payment Status";
worksheet.Cell(1, 12).Value = "Insurance Provider";
worksheet.Cell(1, 13).Value = "Notes";
for (int i = 0; i < Appointmentrecord.Count; i++)
{
//worksheet.Cell(i + 2, 1).Value = Appointmentrecord[i].Patients.Name;
//worksheet.Cell(i + 2, 2).Value = Appointmentrecord[i].Patients.Gender.ToString();
//worksheet.Cell(i + 2, 3).Value = Appointmentrecord[i].DateOfAdmission.ToShortDateString();
//worksheet.Cell(i + 2, 4).Value = Appointmentrecord[i].Diagnosis;
//worksheet.Cell(i + 2, 5).Value = Appointmentrecord[i].NextFollowUp?.ToShortDateString();
//worksheet.Cell(i + 2, 6).Value = Appointmentrecord[i].InsuranceProvider;
//worksheet.Cell(i + 2, 7).Value = Appointmentrecord[i].InsuranceProvider;
//worksheet.Cell(i + 2, 8).Value = Appointmentrecord[i].InsuranceProvider;
//worksheet.Cell(i + 2, 9).Value = Appointmentrecord[i].Status.ToString();
}
worksheet.Columns().AdjustToContents();
workbook.SaveAs(filePath);
}
byte[] fileBytes = await File.ReadAllBytesAsync(filePath);
File.Delete(filePath);
return new FileDownloadDto
{
FileName = filename,
FileContent = Convert.ToBase64String(fileBytes) // Use Base64 encoding for file content
};
}
#endregion
} }
} }

View File

@ -161,7 +161,7 @@ namespace HospitalManagementSystem.Patients
#region Create Patient #region Create Patient
[Authorize(HospitalManagementSystemPermissions.Patient.Create)] [Authorize(HospitalManagementSystemPermissions.Patient.Create)]
public async Task<PatientRecordDto> CreatePatientRecordAsync(CreateUpdatePatientRecordDto input) public async Task CreatePatientRecordAsync(CreateUpdatePatientRecordDto input)
{ {
var patientEntity = await _patientRepository.GetAsync(input.PatientId); // Get Patient from DB var patientEntity = await _patientRepository.GetAsync(input.PatientId); // Get Patient from DB
var patientRecord = ObjectMapper.Map<CreateUpdatePatientRecordDto, PatientRecord>(input); var patientRecord = ObjectMapper.Map<CreateUpdatePatientRecordDto, PatientRecord>(input);
@ -194,14 +194,12 @@ namespace HospitalManagementSystem.Patients
} }
} }
patientRecord = await _patientrecordRepository.InsertAsync(patientRecord); patientRecord = await _patientrecordRepository.InsertAsync(patientRecord);
return ObjectMapper.Map<PatientRecord, PatientRecordDto>(patientRecord);
} }
#endregion #endregion
#region Update Patient #region Update Patient
[Authorize(HospitalManagementSystemPermissions.Patient.Edit)] [Authorize(HospitalManagementSystemPermissions.Patient.Edit)]
public async Task<PatientRecordDto> UpdatePatientRecordAsync(Guid id, CreateUpdatePatientRecordDto input) public async Task UpdatePatientRecordAsync(Guid id, CreateUpdatePatientRecordDto input)
{ {
try try
{ {
@ -240,7 +238,6 @@ namespace HospitalManagementSystem.Patients
} }
patientRecord = await _patientrecordRepository.UpdateAsync(patientRecord); patientRecord = await _patientrecordRepository.UpdateAsync(patientRecord);
return ObjectMapper.Map<PatientRecord, PatientRecordDto>(patientRecord);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -364,7 +361,7 @@ namespace HospitalManagementSystem.Patients
#region Create Patient #region Create Patient
[Authorize(HospitalManagementSystemPermissions.Patient.Create)] [Authorize(HospitalManagementSystemPermissions.Patient.Create)]
public async Task<PatientDto> CreatePatientAsync(CreateUpdatePatientDto input) public async Task CreatePatientAsync(CreateUpdatePatientDto input)
{ {
var patient = ObjectMapper.Map<CreateUpdatePatientDto, Patient>(input); var patient = ObjectMapper.Map<CreateUpdatePatientDto, Patient>(input);
@ -381,14 +378,12 @@ namespace HospitalManagementSystem.Patients
} }
} }
} }
return ObjectMapper.Map<Patient, PatientDto>(patient);
} }
#endregion #endregion
#region Update Patient #region Update Patient
[Authorize(HospitalManagementSystemPermissions.Patient.Edit)] [Authorize(HospitalManagementSystemPermissions.Patient.Edit)]
public async Task<PatientDto> UpdatePatientAsync(Guid id, CreateUpdatePatientDto input) public async Task UpdatePatientAsync(Guid id, CreateUpdatePatientDto input)
{ {
var patient = await _patientRepository.GetQueryableAsync().Result.Include(x => x.Images).Where(x => x.Id == id).FirstOrDefaultAsync(); var patient = await _patientRepository.GetQueryableAsync().Result.Include(x => x.Images).Where(x => x.Id == id).FirstOrDefaultAsync();
List<EntityDocument> entitydocument = new List<EntityDocument>(); List<EntityDocument> entitydocument = new List<EntityDocument>();
@ -407,7 +402,6 @@ namespace HospitalManagementSystem.Patients
} }
patient = await _patientRepository.UpdateAsync(patient); patient = await _patientRepository.UpdateAsync(patient);
return ObjectMapper.Map<Patient, PatientDto>(patient);
} }
#endregion #endregion