diff --git a/angular/src/app/patients/all-patients/all-patients.component.html b/angular/src/app/patients/all-patients/all-patients.component.html index 64159d6..3aadf3e 100644 --- a/angular/src/app/patients/all-patients/all-patients.component.html +++ b/angular/src/app/patients/all-patients/all-patients.component.html @@ -1,4 +1,4 @@ -
+ +
+
+
+

Patient List

+
+ + +
+ + +
+
+
+ + + + + + Patient ID + Full Name + Gender + Date of Admission + Blood Group + Mobile + Email + Status + Actions + + + + + + {{ patient.id }} + {{ patient.name }} + + + {{ gender[patient.gender] }} + + + {{ patient.admissionDate | date }} + {{ patient.bloodGroup }} + {{ patient.mobile }} + {{ patient.email }} + + + {{ status[patient.status] }} + + + + + + + + + + + + + No Patients found. + + + +
Total Records: {{ totalRecords }}
+
+
+ [closable]="true" [style]="{width: '80%', height: 'auto'}" class="modern-dialog">
-
-
- -
-
- - - Full Name is required -
-
- - -
- {{error}} - {{imgpath}} +
+ +
+
+ + + Full Name is required
- - -
-
- - - - Mobile is required and must be 10 digits - -
+
+ +
- - -
-
- - - Address is - required -
+ {{error}} +
+

Uploading... {{ uploadProgress }}%

+
+ {{imgpath}}
-
- -
-
- -
- - -
- Gender is required -
+ +
+
+ + + + Mobile is required and must be 10 digits +
- - -
-
- - - - Admission Date is required - -
-
-
-
- -
-
- - -
-
- - -
-
- - -
-
-
- -
- -
-
- - - Blood Group is - required -
-
- - -
-
- - - Enter a valid email - address -
-
-
- -
- -
-
- - - - Age is required and must be between 1 and 90 - -
-
- - -
-
- - - Status is required -
+
+ + + Address is required
-
+
+ +
+
+ +
+ + +
+ Gender is required +
+
+
+
+ + + + Admission Date is required + +
+
+
+ +
+ +
+
+ + +
+
+
+
+ + +
+
+
+ +
+ +
+
+ + + Blood Group is + required +
+
+
+
+ + + Enter a valid email + address +
+
+
+ +
- + [disabled]="(patientrecord.invalid || selectedstatus === 0 || !selectedgender)"> + Save + +
diff --git a/angular/src/app/patients/all-patients/all-patients.component.scss b/angular/src/app/patients/all-patients/all-patients.component.scss index 9b907b1..cd3ef1e 100644 --- a/angular/src/app/patients/all-patients/all-patients.component.scss +++ b/angular/src/app/patients/all-patients/all-patients.component.scss @@ -25,4 +25,13 @@ color: red; font-size: 1.2rem; } + + .bg-pink { + background-color: #ff4081 !important; + color: white; +} + +.gap-1 { + gap: 5px; +} \ No newline at end of file diff --git a/angular/src/app/patients/all-patients/all-patients.component.ts b/angular/src/app/patients/all-patients/all-patients.component.ts index ad9ba7d..88d042d 100644 --- a/angular/src/app/patients/all-patients/all-patients.component.ts +++ b/angular/src/app/patients/all-patients/all-patients.component.ts @@ -1,6 +1,6 @@ import { PermissionService } from '@abp/ng.core'; import { Confirmation, ConfirmationService, ToasterService } from '@abp/ng.theme.shared'; -import { HttpClient } from '@angular/common/http'; +import { HttpClient, HttpEventType, HttpParams, HttpRequest } from '@angular/common/http'; import { Component, OnInit } from '@angular/core'; import { NgForm } from '@angular/forms'; import { Router } from '@angular/router'; @@ -8,6 +8,7 @@ import { PagingSortResultDto } from '@proxy/dto'; import { Gender, Status } from '@proxy/global-enum'; import { PatientService } from '@proxy/patients'; import { PatientDto, CreateUpdatePatientDto } from '@proxy/patients/dto'; +import { environment } from 'src/environments/environment'; @Component({ selector: 'app-all-patients', @@ -38,18 +39,7 @@ export class AllPatientsComponent implements OnInit { error: string = ''; imgpath: string = ''; guid: string = '00000000-0000-0000-0000-000000000000'; - options: Partial = { - hideCancelBtn: false, - hideYesBtn: false, - dismissible: false, - cancelText: 'Close', - // yesText: 'Confirm', - messageLocalizationParams: ['Demo'], - titleLocalizationParams: [], - // You can customize icon - // icon: 'fa fa-exclamation-triangle', // or - // iconTemplate : '' - }; + uploadProgress = 0; constructor( private patientService: PatientService, @@ -103,6 +93,7 @@ export class AllPatientsComponent implements OnInit { this.imgpath = ''; this.selectedgender = 0; this.selectedstatus = 0; + this.uploadProgress = 0; } loadPatient(event: any) { @@ -167,6 +158,7 @@ export class AllPatientsComponent implements OnInit { this.error = 'Please Type a Name'; return; } + this.error = ''; const input = event.target as HTMLInputElement; if (input.files.length > 0) { const tag = 'Image'; @@ -174,14 +166,40 @@ export class AllPatientsComponent implements OnInit { formdata.append('file', input.files[0]); this.UploadFileData(tag, formdata); } else { + this.uploadProgress = 0; return; } } UploadFileData(tag: string, formdata: FormData) { - this.patientService.uploadFile(tag, formdata).subscribe(result => { - this.selectedPatient.imageID = result; - }); + // this.patientService.uploadFile(tag, formdata).subscribe(result => { + // this.selectedPatient.imageID = result; + // }); + const req = new HttpRequest( + 'POST', + environment.apis.default.url + '/api/app/patient/upload-file', + formdata, + { + reportProgress: true, + responseType: 'text', + params: new HttpParams().set('tagName', tag), + } + ); + this.http.request(req).subscribe( + event => { + if (event.type === HttpEventType.UploadProgress) { + this.uploadProgress = Math.round((event.loaded / event.total!) * 100); + console.log(event.type, this.uploadProgress); + } else if (event.type === HttpEventType.Response) { + this.uploadProgress = 100; + this.selectedPatient.imageID = event.body.toString(); + } + }, + error => { + console.error('Upload failed', error); + this.uploadProgress = 0; + } + ); } editPatient(Patient: any) { diff --git a/angular/src/app/patients/patient-record/patient-record.component.html b/angular/src/app/patients/patient-record/patient-record.component.html index 44ff19f..1640b18 100644 --- a/angular/src/app/patients/patient-record/patient-record.component.html +++ b/angular/src/app/patients/patient-record/patient-record.component.html @@ -52,30 +52,27 @@
-
- +
+ -
-

{{'::PatientHeader' | abpLocalization}}

-
- - - - - - - - + + + +
@@ -83,14 +80,14 @@ Patient ID - Full Name - Gender + Full Name + Gender Date of Admission Diagnosis Lab Reports Medications Next Follow-Up - Status + Status Actions @@ -106,173 +103,141 @@ {{ patientrecord.dateOfAdmission | date }} {{ patientrecord.diagnosis }} - - + + {{ patientrecord.nextFollowUp | date }} - {{ status[patientrecord.patients.status] }} - - - + + + {{ status[patientrecord.patients.status] }} + + + + + + - No Patients found. + No Patients found.
- Total Records: {{totalRecords}} +
Total Records: {{totalRecords}}
+ [closable]="true" [style]="{width: '70%', height: 'auto'}">
-
-
- - -
+
-
-
- -
-
-
- - - - Admission Date is required. - -
+ +
+
+ + + + Admission Date is required. +
-
-
-
- - -
- {{labReportUrlpath}} -
-
-
- - -
- {{medicationUrlpath}} -
-
- -
-
-
- - -
- {{medicationHistoryUrlpath}} -
-
-
- - - - Next Follow-Up Date is required. - -
-
-
- -
-
-
-
- -
- - - Diagnosis is required. - -
-
-
- -
-
-
- - - - Insurance is required. - -
-
-
- + +
+
+ + + + Next Follow-Up Date is required. +
-
- - + + +
+
+
+ + +
+

Uploading... {{ uploadProgress1 }}%

+ +
+ {{labReportUrlpath}} +
+
+ +
+
+ + +
+

Uploading... {{ uploadProgress2 }}%

+ +
+ {{medicationUrlpath}} +
+
+
+
+ + +
+

Uploading... {{ uploadProgress3 }}%

+ +
+ {{medicationHistoryUrlpath}} +
+
+
+ + +
+
+ + + + Diagnosis is required. + +
+
+ + +
+
+ + + + Insurance is required. + +
+
+ + + diff --git a/angular/src/app/patients/patient-record/patient-record.component.scss b/angular/src/app/patients/patient-record/patient-record.component.scss index 0bc5d64..049d143 100644 --- a/angular/src/app/patients/patient-record/patient-record.component.scss +++ b/angular/src/app/patients/patient-record/patient-record.component.scss @@ -18,7 +18,8 @@ } .female { - background-color: purple; + background-color: #ff4081 !important; + color: white; } .pdf-icon { diff --git a/angular/src/app/patients/patient-record/patient-record.component.ts b/angular/src/app/patients/patient-record/patient-record.component.ts index d9e488c..a154ce6 100644 --- a/angular/src/app/patients/patient-record/patient-record.component.ts +++ b/angular/src/app/patients/patient-record/patient-record.component.ts @@ -8,6 +8,7 @@ import { PermissionService } from '@abp/ng.core'; import { ActivatedRoute, Router } from '@angular/router'; import { environment } from 'src/environments/environment'; import { Confirmation, ConfirmationService, ToasterService } from '@abp/ng.theme.shared'; +import { HttpClient, HttpEventType, HttpParams, HttpRequest } from '@angular/common/http'; @Component({ selector: 'app-patient-record', @@ -40,18 +41,9 @@ export class PatientRecordComponent implements OnInit { medicationHistoryUrlpath: string; medicationUrlpath: string; guid: string = '00000000-0000-0000-0000-000000000000'; - options: Partial = { - hideCancelBtn: false, - hideYesBtn: false, - dismissible: false, - cancelText: 'Close', - yesText: 'Confirm', - messageLocalizationParams: ['Demo'], - titleLocalizationParams: [], - // You can customize icon - // icon: 'fa fa-exclamation-triangle', // or - // iconTemplate : '' - }; + uploadProgress1 = 0; + uploadProgress2 = 0; + uploadProgress3 = 0; constructor( private patientService: PatientService, @@ -59,7 +51,8 @@ export class PatientRecordComponent implements OnInit { private permissionChecker: PermissionService, private toaster: ToasterService, private route: ActivatedRoute, - private router: Router + private router: Router, + private http: HttpClient ) {} ngOnInit() { @@ -103,6 +96,9 @@ export class PatientRecordComponent implements OnInit { this.medicationHistoryUrlpath = ''; this.selectdateOfAdmission = new Date(); this.selectnextFollowUp = new Date(); + this.uploadProgress1 = 0; + this.uploadProgress2 = 0; + this.uploadProgress3 = 0; } loadPatient(event: any, id: any) { @@ -122,7 +118,6 @@ export class PatientRecordComponent implements OnInit { }); this.patientService.getPatientRecordList(this.params, id).subscribe(data => { this.patientrecords = data.items; - // console.log(data.items); this.totalRecords = data.totalCount; this.loading = false; }); @@ -201,50 +196,113 @@ export class PatientRecordComponent implements OnInit { }); } - handleLabReportUpload(event: Event): void { + handleUpload(event: Event, tag: string): void { const input = event.target as HTMLInputElement; - if (input && input.files) { - const tag = 'Lab-Report'; + if (input.files.length > 0) { const formdata = new FormData(); formdata.append('file', input.files[0]); this.UploadFileData(tag, formdata); + } else { + this.uploadProgress1 = 0; + this.uploadProgress2 = 0; + this.uploadProgress3 = 0; + return; } } - handleMedicationsUpload(event: any): void { - const input = event.target as HTMLInputElement; - if (input && input.files) { - const tag = 'Medication'; - const formdata = new FormData(); - formdata.append('file', input.files[0]); - this.UploadFileData(tag, formdata); - } - } + // handleLabReportUpload(event: Event): void { + // const input = event.target as HTMLInputElement; + // if (input && input.files) { + // const tag = 'Lab-Report'; + // const formdata = new FormData(); + // formdata.append('file', input.files[0]); + // this.UploadFileData(tag, formdata); + // } + // } - handleMedicationHistoryUpload(event: any): void { - const input = event.target as HTMLInputElement; - if (input && input.files) { - const tag = 'Medication-History'; - const formdata = new FormData(); - formdata.append('file', input.files[0]); - this.UploadFileData(tag, formdata); - } - } + // handleMedicationsUpload(event: any): void { + // const input = event.target as HTMLInputElement; + // if (input && input.files) { + // const tag = 'Medication'; + // const formdata = new FormData(); + // formdata.append('file', input.files[0]); + // this.UploadFileData(tag, formdata); + // } + // } + + // handleMedicationHistoryUpload(event: any): void { + // const input = event.target as HTMLInputElement; + // if (input && input.files) { + // const tag = 'Medication-History'; + // const formdata = new FormData(); + // formdata.append('file', input.files[0]); + // this.UploadFileData(tag, formdata); + // } + // } UploadFileData(tag: string, formdata: FormData) { - this.patientService.uploadFile(tag, formdata).subscribe(result => { - switch (tag) { - case 'Lab-Report': - this.selectedPatient.labReportUrlID = result; - break; - case 'Medication': - this.selectedPatient.medicationUrlID = result; - break; - case 'Medication-History': - this.selectedPatient.medicationHistoryUrlID = result; - break; + // this.patientService.uploadFile(tag, formdata).subscribe(result => { + // switch (tag) { + // case 'Lab-Report': + // this.selectedPatient.labReportUrlID = result; + // break; + // case 'Medication': + // this.selectedPatient.medicationUrlID = result; + // break; + // case 'Medication-History': + // this.selectedPatient.medicationHistoryUrlID = result; + // break; + // } + // }); + const req = new HttpRequest( + 'POST', + environment.apis.default.url + '/api/app/patient/upload-file', + formdata, + { + reportProgress: true, + responseType: 'text', + params: new HttpParams().set('tagName', tag), } - }); + ); + this.http.request(req).subscribe( + event => { + if (event.type === HttpEventType.UploadProgress) { + // this.uploadProgress = Math.round((event.loaded / event.total!) * 100); + switch (tag) { + case 'Lab-Report': + this.uploadProgress1 = Math.round((event.loaded / event.total!) * 100); + break; + case 'Medication': + this.uploadProgress2 = Math.round((event.loaded / event.total!) * 100); + break; + case 'Medication-History': + this.uploadProgress3 = Math.round((event.loaded / event.total!) * 100); + break; + } + } else if (event.type === HttpEventType.Response) { + switch (tag) { + case 'Lab-Report': + this.uploadProgress1 = 100; + this.selectedPatient.labReportUrlID = event.body.toString(); + break; + case 'Medication': + this.uploadProgress2 = 100; + this.selectedPatient.medicationUrlID = event.body.toString(); + break; + case 'Medication-History': + this.uploadProgress3 = 100; + this.selectedPatient.medicationHistoryUrlID = event.body.toString(); + break; + } + } + }, + error => { + console.error('Upload failed', error); + this.uploadProgress1 = 100; + this.uploadProgress2 = 100; + this.uploadProgress3 = 100; + } + ); } savePatient(form: NgForm) { diff --git a/aspnet-core/src/HospitalManagementSystem.Application/Patients/PatientAppService.cs b/aspnet-core/src/HospitalManagementSystem.Application/Patients/PatientAppService.cs index 6bad524..d031437 100644 --- a/aspnet-core/src/HospitalManagementSystem.Application/Patients/PatientAppService.cs +++ b/aspnet-core/src/HospitalManagementSystem.Application/Patients/PatientAppService.cs @@ -54,7 +54,7 @@ namespace HospitalManagementSystem.Patients .Include(x => x.LabReportUrl) .Include(x => x.MedicationUrl) .Include(x => x.MedicationHistoryUrl) - .WhereIf(!string.IsNullOrEmpty(input.Search), x => x.Patients.Name.ToLower().Contains(input.Search.ToLower())) + .WhereIf(!string.IsNullOrEmpty(input.Search), x => x.Patients.Name.ToLower().Contains(input.Search.ToLower()) || x.Patients.Email.Contains(input.Search)) .Where(x => x.Patients.Id == Id); var totalCount = await filteredQuery.CountAsync(); @@ -270,7 +270,7 @@ namespace HospitalManagementSystem.Patients if (!string.IsNullOrEmpty(input.Search)) { query = _patientRepository.GetQueryableAsync().Result - .Where(x => x.Name.ToLower().Contains(input.Search.ToLower())) + .Where(x => x.Name.ToLower().Contains(input.Search.ToLower()) || x.Email.Contains(input.Search)) .OrderBy(input.Sorting ?? (nameof(Patient.Id) + " asc")) .Skip(input.SkipCount) .Take(input.MaxResultCount)