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 f25d060..64159d6 100644 --- a/angular/src/app/patients/all-patients/all-patients.component.html +++ b/angular/src/app/patients/all-patients/all-patients.component.html @@ -57,7 +57,7 @@ @@ -89,6 +89,13 @@ placeholder="Enter full patient name" required #name="ngModel" /> Full Name is required +
+ + +
+ {{error}} + {{imgpath}} @@ -150,6 +157,25 @@ +
+ +
+
+ + +
+
+ + +
+
+ + +
+
+
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 5ced034..9b907b1 100644 --- a/angular/src/app/patients/all-patients/all-patients.component.scss +++ b/angular/src/app/patients/all-patients/all-patients.component.scss @@ -1,21 +1,3 @@ -/* Adjusting the calendar popup */ -.small-calendar .p-datepicker { - width: 200px !important; /* Adjust the width as per your needs */ - font-size: 12px !important; /* Adjust the font size */ -} - -.small-calendar .p-datepicker-header { - padding: 2px !important; /* Adjust the header padding */ -} - -.small-calendar .p-datepicker-calendar th { - font-size: 10px !important; /* Smaller font size for the header */ -} - -.small-calendar .p-datepicker-calendar td { - font-size: 10px !important; /* Smaller font size for the days */ -} - .table-header { display: flex; justify-content: space-between; 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 0c6151d..b9cbffb 100644 --- a/angular/src/app/patients/all-patients/all-patients.component.ts +++ b/angular/src/app/patients/all-patients/all-patients.component.ts @@ -1,4 +1,5 @@ import { PermissionService } from '@abp/ng.core'; +import { Confirmation, ConfirmationService, ToasterService } from '@abp/ng.theme.shared'; import { HttpClient } from '@angular/common/http'; import { Component, OnInit } from '@angular/core'; import { NgForm } from '@angular/forms'; @@ -7,13 +8,12 @@ import { PagingSortPatientResultDto } from '@proxy/dto'; import { Gender, Status } from '@proxy/global-enum'; import { PatientService } from '@proxy/patients'; import { PatientDto, CreateUpdatePatientDto } from '@proxy/patients/dto'; -import { MessageService } from 'primeng/api'; @Component({ selector: 'app-all-patients', templateUrl: './all-patients.component.html', styleUrl: './all-patients.component.scss', - providers: [PatientService, MessageService, PermissionService], + providers: [PatientService, ConfirmationService, ToasterService, PermissionService], }) export class AllPatientsComponent implements OnInit { globalFilter: string = ''; @@ -32,18 +32,30 @@ export class AllPatientsComponent implements OnInit { selectedgender: any = 0; selectadmissionDate: Date = new Date(); selectdischargeDate: Date = new Date(); - uploadfile: { - file: File[]; - name: string; - }[] = []; createpermission: boolean; editpermission: boolean; deletepermission: boolean; + 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 : '' + }; constructor( private patientService: PatientService, private http: HttpClient, - private messageService: MessageService, + private confirmation: ConfirmationService, + private toaster: ToasterService, private permissionChecker: PermissionService, private router: Router ) {} @@ -88,6 +100,9 @@ export class AllPatientsComponent implements OnInit { dischargeDate: '', status: Status.InTreatment, }; + this.imgpath = ''; + this.selectedgender = 0; + this.selectedstatus = 0; } loadPatient(event: any) { @@ -147,30 +162,60 @@ export class AllPatientsComponent implements OnInit { this.router.navigate(['/patients/patient-record', id]); } + profileimageupload(event: Event) { + if (this.selectedPatient.name == '') { + this.error = 'Please Type a Name'; + return; + } + const input = event.target as HTMLInputElement; + if (input.files.length > 0) { + const tag = 'Image'; + const formdata = new FormData(); + formdata.append('file', input.files[0]); + this.UploadFileData(tag, formdata); + } else { + return; + } + } + + UploadFileData(tag: string, formdata: FormData) { + this.patientService.uploadFile(tag, formdata).subscribe(result => { + this.selectedPatient.imageID = result; + }); + } + editPatient(Patient: any) { + this.resetselectpatient(); this.patientDialogTitle = 'Edit Patient'; - this.selectedPatient = { ...Patient }; - this.selectedgender = this.selectedPatient.gender; - this.selectedstatus = this.selectedPatient.status; - this.selectadmissionDate = new Date(this.selectedPatient.admissionDate); - this.selectdischargeDate = new Date(this.selectedPatient.dischargeDate); + this.patientService.getPatientById(Patient.id).subscribe(result => { + this.selectedPatient = result; + this.imgpath = result.imagepath != null ? result.imagepath.split('\\')[3] : ''; + this.selectadmissionDate = new Date(this.selectedPatient.admissionDate); + this.selectedgender = this.selectedPatient.gender; + this.selectedstatus = this.selectedPatient.status; + }); this.patientDialog = true; this.isEditMode = true; } deletePatient(id: any) { - this.patientService.deletePatient(id).subscribe(() => { - this.messageService.add({ - severity: 'success', - summary: 'Success', - detail: 'Patient deleted successfully', + this.confirmation + .warn('Do you really want to delete this patient?', { + key: '::AreYouSure', + defaultValue: 'Are you sure?', + }) + .subscribe((status: Confirmation.Status) => { + // your code here + if (status == 'confirm') { + this.patientService.deletePatient(id).subscribe(() => { + this.toaster.success('Patient deleted successfully', 'Success'); + this.loadPatient(this.params); + }); + } }); - this.loadPatient(this.params); - }); } savePatient(form: NgForm) { - debugger; console.log(form.controls); if (form.invalid) { Object.values(form.controls).forEach(control => control.markAsTouched()); @@ -180,18 +225,15 @@ export class AllPatientsComponent implements OnInit { this.selectedPatient.status = this.selectedstatus; this.selectedPatient.admissionDate = this.selectadmissionDate.toDateString(); this.selectedPatient.dischargeDate = this.selectdischargeDate.toDateString(); - + this.selectedPatient.imageID = this.selectedPatient.imageID + ? this.selectedPatient.imageID.replace('"', '').replace('"', '') + : this.guid; console.log(this.selectedPatient); if (this.isEditMode) { - this.patientService - .updatePatient(this.selectedPatient.id, this.selectedPatient) - .subscribe(() => { - this.messageService.add({ - severity: 'success', - summary: 'Success', - detail: 'Patient updated successfully', - }); + this.patientService.updatePatient(this.selectedPatient.id, this.selectedPatient).subscribe( + () => { + this.toaster.success('Patient updated successfully', 'Success'); this.patientDialog = false; this.loadPatient({ first: 0, @@ -200,23 +242,30 @@ export class AllPatientsComponent implements OnInit { sortOrder: 1, globalFilter: null, }); - }); + }, + error => { + console.log(error); + this.closeDialog(); + } + ); } else { - this.patientService.createPatient(this.selectedPatient).subscribe(() => { - this.messageService.add({ - severity: 'success', - summary: 'Success', - detail: 'Patient created successfully', - }); - this.patientDialog = false; - this.loadPatient({ - first: 0, - rows: 10, - sortField: 'id', - sortOrder: 1, - globalFilter: null, - }); - }); + this.patientService.createPatient(this.selectedPatient).subscribe( + () => { + this.toaster.success('Patient created successfully', 'Success'); + this.patientDialog = false; + this.loadPatient({ + first: 0, + rows: 10, + sortField: 'id', + sortOrder: 1, + globalFilter: null, + }); + }, + error => { + console.log(error); + this.closeDialog(); + } + ); } } 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 3fc7716..44ff19f 100644 --- a/angular/src/app/patients/patient-record/patient-record.component.html +++ b/angular/src/app/patients/patient-record/patient-record.component.html @@ -30,9 +30,15 @@
Admission: {{ patientdto?.admissionDate | date }}
+
+ Discharge: {{ patientdto?.dischargeDate | date }} +
+
+ Treatment: {{ patientdto?.treatment || 'N/A' }} +
Status: - + {{ status[patientdto?.status] }}
@@ -40,11 +46,15 @@
- +
+ +
@@ -103,8 +113,8 @@ - + @@ -186,6 +196,7 @@
+ {{labReportUrlpath}}
@@ -193,6 +204,7 @@
+ {{medicationUrlpath}}
@@ -203,6 +215,7 @@ + {{medicationHistoryUrlpath}}
@@ -237,10 +250,11 @@
- - Insurance is required. - + [(ngModel)]="selectedPatient.insuranceProvider" required placeholder="Enter insurance provider" + #insurance="ngModel" /> + + Insurance is required. +
@@ -257,8 +271,7 @@
- +
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 098cd73..0bc5d64 100644 --- a/angular/src/app/patients/patient-record/patient-record.component.scss +++ b/angular/src/app/patients/patient-record/patient-record.component.scss @@ -78,19 +78,4 @@ border-radius: 6px; } - .status { - font-weight: bold; - padding: 4px 8px; - border-radius: 4px; - } - - .status.active { - background: #28a745; - color: white; - } - - .status.inactive { - background: #dc3545; - color: white; - } \ No newline at end of file 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 3c95e39..49358ae 100644 --- a/angular/src/app/patients/patient-record/patient-record.component.ts +++ b/angular/src/app/patients/patient-record/patient-record.component.ts @@ -4,15 +4,16 @@ import { PagingSortPatientResultDto } from '@proxy/dto'; import { Gender, Status } from '@proxy/global-enum'; import { PatientService } from '@proxy/patients'; import { CreateUpdatePatientRecordDto, PatientDto, PatientRecordDto } from '@proxy/patients/dto'; -import { MessageService } from 'primeng/api'; import { PermissionService } from '@abp/ng.core'; -import { ActivatedRoute } from '@angular/router'; +import { ActivatedRoute, Router } from '@angular/router'; +import { environment } from 'src/environments/environment'; +import { Confirmation, ConfirmationService, ToasterService } from '@abp/ng.theme.shared'; @Component({ selector: 'app-patient-record', templateUrl: './patient-record.component.html', styleUrl: './patient-record.component.scss', - providers: [PatientService, MessageService, PermissionService], + providers: [PatientService, ConfirmationService, ToasterService, PermissionService], }) export class PatientRecordComponent implements OnInit { globalFilter: string = ''; @@ -30,26 +31,40 @@ export class PatientRecordComponent implements OnInit { statuslist: any; selectdateOfAdmission: Date = new Date(); selectnextFollowUp: Date = new Date(); - uploadfile: { - file: File[]; - name: string; - }[] = []; createpermission: boolean; editpermission: boolean; deletepermission: boolean; - userid: any; + patientId: any; patientImageUrl: string; + labReportUrlpath: string; + 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 : '' + }; constructor( private patientService: PatientService, - private messageService: MessageService, + private confirmation: ConfirmationService, private permissionChecker: PermissionService, - private route: ActivatedRoute + private toaster: ToasterService, + private route: ActivatedRoute, + private router: Router ) {} ngOnInit() { - this.userid = this.route.snapshot.paramMap.get('id'); - console.log(this.userid); + this.patientId = this.route.snapshot.paramMap.get('id'); + console.log(this.patientId); this.createpermission = this.permissionChecker.getGrantedPolicy( 'HospitalManagementSystem.Patient.Create' @@ -71,11 +86,11 @@ export class PatientRecordComponent implements OnInit { resetselectpatient() { this.selectedPatient = { - patientId: this.userid, + patientId: this.patientId, dateOfAdmission: '', - labReportUrl: '', - medicationUrl: '', - medicationHistoryUrl: '', + // labReportUrl: '', + // medicationUrl: '', + // medicationHistoryUrl: '', nextFollowUp: '', diagnosis: '', treatmentPlan: '', @@ -83,10 +98,15 @@ export class PatientRecordComponent implements OnInit { insuranceProvider: '', status: Status.InTreatment, }; + this.labReportUrlpath = ''; + this.medicationUrlpath = ''; + this.medicationHistoryUrlpath = ''; + this.selectdateOfAdmission = new Date(); + this.selectnextFollowUp = new Date(); } loadPatient(event: any, id: any) { - this.selectedPatient.patientId = this.userid; + this.selectedPatient.patientId = this.patientId; this.loading = true; let order = event.sortOrder == 1 ? ' asc' : ' desc'; event.sortField = event.sortField == undefined ? 'id' : event.sortField; @@ -96,16 +116,22 @@ export class PatientRecordComponent implements OnInit { sorting: event.sortField + order, search: event.globalFilter == null ? '' : event.globalFilter, }; - this.patientService.getPatientById(this.userid).subscribe(result => { + this.patientService.getPatientById(this.patientId).subscribe(result => { this.patientdto = result; + this.patientImageUrl = environment.apis.default.url + result.imagepath; }); this.patientService.getPatientRecordList(this.params, id).subscribe(data => { this.patientrecords = data.items; + // console.log(data.items); this.totalRecords = data.totalCount; this.loading = false; }); } + backtopatient() { + this.router.navigate(['/patients/all-patients']); + } + exportPatient() { this.patientService.getExportPatientRecord().subscribe(result => { const binary = atob(result.fileContent); @@ -140,80 +166,133 @@ export class PatientRecordComponent implements OnInit { } editPatient(Patient: any) { + this.resetselectpatient(); this.patientDialogTitle = 'Edit Patient'; - this.selectedPatient = { ...Patient }; - this.selectedPatient.patientId = this.userid; - this.selectdateOfAdmission = new Date(this.selectedPatient.dateOfAdmission); - this.selectnextFollowUp = new Date(this.selectedPatient.nextFollowUp); + this.patientService.getPatientRecordById(Patient.id).subscribe(result => { + this.selectedPatient = result; + this.selectedPatient.patientId = this.patientId; + this.selectdateOfAdmission = new Date(this.selectedPatient.dateOfAdmission); + this.selectnextFollowUp = new Date(this.selectedPatient.nextFollowUp); + this.labReportUrlpath = result.labReportUrl != null ? result.labReportUrl.split('\\')[3] : ''; + this.medicationUrlpath = + result.medicationUrl != null ? result.medicationUrl.split('\\')[3] : ''; + this.medicationHistoryUrlpath = + result.medicationHistoryUrl != null ? result.medicationHistoryUrl.split('\\')[3] : ''; + console.log(result); + }); this.patientDialog = true; this.isEditMode = true; - console.log(this.selectedPatient); } deletePatient(id: any) { - this.patientService.deletePatientRecord(id).subscribe(() => { - this.messageService.add({ - severity: 'success', - summary: 'Success', - detail: 'Patient deleted successfully', + this.confirmation + .warn('Do you really want to delete this record ?', { + key: '::AreYouSure', + defaultValue: 'Are you sure?', + }) + .subscribe((status: Confirmation.Status) => { + // your code here + if (status == 'confirm') { + this.patientService.deletePatientRecord(id).subscribe(() => { + this.loadPatient(this.params, this.patientId); + this.toaster.success('Patient deleted successfully', 'Success'); + }); + } }); - this.loadPatient(this.params, this.userid); - }); } - // handleLabReportUpload(event: any): void { - // const input = event.target as HTMLInputElement; - // console.log(input); - // const files: File[] = event.files; // Files uploaded - // this.addToUploadList(files, 'Lab-Report'); - // } handleLabReportUpload(event: Event): void { const input = event.target as HTMLInputElement; if (input && input.files) { - const files: File[] = Array.from(input.files); // Convert FileList to an array of File - this.addToUploadList(files, 'Lab-Report'); - } else { - console.error('No files selected'); + const tag = 'Lab-Report'; + const formdata = new FormData(); + formdata.append('file', input.files[0]); + this.UploadFileData(tag, formdata); } } handleMedicationsUpload(event: any): void { - const files: File[] = event.files; // Files uploaded - this.addToUploadList(files, 'Medications'); + 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 files: File[] = event.files; // Files uploaded - this.addToUploadList(files, 'Medication-History'); + 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); + } } - private addToUploadList(files: File[], name: string): void { - const existingIndex = this.uploadfile.findIndex(item => item.name === name); - - if (existingIndex > -1) { - this.uploadfile[existingIndex].file = files; - } else { - this.uploadfile.push({ file: files, name }); - } - console.log(this.uploadfile); + 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; + } + }); } savePatient(form: NgForm) { // console.log(form); - this.selectedPatient.patientId = this.userid; + this.selectedPatient.patientId = this.patientId; this.selectedPatient.status = this.patientdto.status; this.selectedPatient.dateOfAdmission = this.selectdateOfAdmission.toDateString(); this.selectedPatient.nextFollowUp = this.selectnextFollowUp.toDateString(); + this.selectedPatient.labReportUrlID = this.selectedPatient.labReportUrlID + ? this.selectedPatient.labReportUrlID.replace('"', '').replace('"', '') + : this.guid; + this.selectedPatient.medicationUrlID = this.selectedPatient.medicationUrlID + ? this.selectedPatient.medicationUrlID.replace('"', '').replace('"', '') + : this.guid; + this.selectedPatient.medicationHistoryUrlID = this.selectedPatient.medicationHistoryUrlID + ? this.selectedPatient.medicationHistoryUrlID.replace('"', '').replace('"', '') + : this.guid; + console.log(this.selectedPatient); if (this.isEditMode) { this.patientService .updatePatientRecord(this.selectedPatient.id, this.selectedPatient) - .subscribe(() => { - this.messageService.add({ - severity: 'success', - summary: 'Success', - detail: 'Patient updated successfully', - }); + .subscribe( + result => { + this.toaster.success('Patient updated successfully', 'Success'); + this.patientDialog = false; + console.log(result); + + this.loadPatient( + { + first: 0, + rows: 10, + sortField: 'id', + sortOrder: 1, + globalFilter: null, + }, + this.patientId + ); + }, + error => { + console.log(error); + this.closeDialog(); + } + ); + } else { + this.patientService.createPatientRecord(this.selectedPatient).subscribe( + () => { + this.toaster.success('Patient created successfully', 'Success'); this.patientDialog = false; this.loadPatient( { @@ -223,28 +302,14 @@ export class PatientRecordComponent implements OnInit { sortOrder: 1, globalFilter: null, }, - this.userid + this.patientId ); - }); - } else { - this.patientService.createPatientRecord(this.selectedPatient).subscribe(() => { - this.messageService.add({ - severity: 'success', - summary: 'Success', - detail: 'Patient created successfully', - }); - this.patientDialog = false; - this.loadPatient( - { - first: 0, - rows: 10, - sortField: 'id', - sortOrder: 1, - globalFilter: null, - }, - this.userid - ); - }); + }, + error => { + console.log(error); + this.closeDialog(); + } + ); } } diff --git a/angular/src/app/proxy/documents/index.ts b/angular/src/app/proxy/documents/index.ts new file mode 100644 index 0000000..e9644da --- /dev/null +++ b/angular/src/app/proxy/documents/index.ts @@ -0,0 +1 @@ +export * from './models'; diff --git a/angular/src/app/proxy/documents/models.ts b/angular/src/app/proxy/documents/models.ts new file mode 100644 index 0000000..cc9c431 --- /dev/null +++ b/angular/src/app/proxy/documents/models.ts @@ -0,0 +1,11 @@ +import type { AuditedAggregateRoot } from '../volo/abp/domain/entities/auditing/models'; + +export interface EntityDocument extends AuditedAggregateRoot { + originalFileName?: string; + generatedFileName?: string; + fileSize?: string; + filePath?: string; + fileType?: string; + tagName?: string; + uploadDate?: string; +} diff --git a/angular/src/app/proxy/generate-proxy.json b/angular/src/app/proxy/generate-proxy.json index 8d9d811..13c1217 100644 --- a/angular/src/app/proxy/generate-proxy.json +++ b/angular/src/app/proxy/generate-proxy.json @@ -1428,6 +1428,140 @@ }, "allowAnonymous": null, "implementFrom": "HospitalManagementSystem.Patients.PatientAppService" + }, + "UploadFileAsyncByTagNameAndFile": { + "uniqueName": "UploadFileAsyncByTagNameAndFile", + "name": "UploadFileAsync", + "httpMethod": "POST", + "url": "api/app/patient/upload-file", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "TagName", + "typeAsString": "System.String, System.Private.CoreLib", + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "file", + "typeAsString": "Volo.Abp.Content.IRemoteStreamContent, Volo.Abp.Core", + "type": "Volo.Abp.Content.IRemoteStreamContent", + "typeSimple": "Volo.Abp.Content.IRemoteStreamContent", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "TagName", + "name": "TagName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + }, + { + "nameOnMethod": "file", + "name": "file", + "jsonName": null, + "type": "Volo.Abp.Content.IRemoteStreamContent", + "typeSimple": "Volo.Abp.Content.IRemoteStreamContent", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "FormFile", + "descriptorName": "" + } + ], + "returnValue": { + "type": "System.Guid", + "typeSimple": "string" + }, + "allowAnonymous": null, + "implementFrom": "HospitalManagementSystem.Patients.PatientAppService" + }, + "SaveFileToDocumentByPatientAndUniqueIdsAndIsNew": { + "uniqueName": "SaveFileToDocumentByPatientAndUniqueIdsAndIsNew", + "name": "SaveFileToDocument", + "httpMethod": "POST", + "url": "api/app/patient/save-file-to-document", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "patient", + "typeAsString": "HospitalManagementSystem.Patients.Patient, HospitalManagementSystem.Domain", + "type": "HospitalManagementSystem.Patients.Patient", + "typeSimple": "HospitalManagementSystem.Patients.Patient", + "isOptional": false, + "defaultValue": null + }, + { + "name": "uniqueIds", + "typeAsString": "System.Collections.Generic.List`1[[System.Guid, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib", + "type": "System.Collections.Generic.List", + "typeSimple": "[string]", + "isOptional": false, + "defaultValue": null + }, + { + "name": "isNew", + "typeAsString": "System.Boolean, System.Private.CoreLib", + "type": "System.Boolean", + "typeSimple": "boolean", + "isOptional": true, + "defaultValue": false + } + ], + "parameters": [ + { + "nameOnMethod": "patient", + "name": "patient", + "jsonName": null, + "type": "HospitalManagementSystem.Patients.Patient", + "typeSimple": "HospitalManagementSystem.Patients.Patient", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "Body", + "descriptorName": "" + }, + { + "nameOnMethod": "uniqueIds", + "name": "uniqueIds", + "jsonName": null, + "type": "System.Collections.Generic.List", + "typeSimple": "[string]", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "Body", + "descriptorName": "" + }, + { + "nameOnMethod": "isNew", + "name": "isNew", + "jsonName": null, + "type": "System.Boolean", + "typeSimple": "boolean", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + } + ], + "returnValue": { + "type": "System.Collections.Generic.List", + "typeSimple": "[HospitalManagementSystem.Documents.EntityDocument]" + }, + "allowAnonymous": null, + "implementFrom": "HospitalManagementSystem.Patients.PatientAppService" } } } @@ -4076,6 +4210,99 @@ } }, "types": { + "HospitalManagementSystem.Documents.EntityDocument": { + "baseType": "Volo.Abp.Domain.Entities.Auditing.AuditedAggregateRoot", + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "OriginalFileName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null + }, + { + "name": "GeneratedFileName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null + }, + { + "name": "FileSize", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null + }, + { + "name": "FilePath", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null + }, + { + "name": "FileType", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null + }, + { + "name": "TagName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null + }, + { + "name": "UploadDate", + "jsonName": null, + "type": "System.DateTime", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null + } + ] + }, "HospitalManagementSystem.Dto.DropDownItems": { "baseType": null, "isEnum": false, @@ -4355,6 +4582,18 @@ "minimum": null, "maximum": null, "regex": null + }, + { + "name": "ImageID", + "jsonName": null, + "type": "System.Guid", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null } ] }, @@ -4402,10 +4641,10 @@ "regex": null }, { - "name": "LabReportUrl", + "name": "LabReportUrlID", "jsonName": null, - "type": "System.String", - "typeSimple": "string", + "type": "System.Guid?", + "typeSimple": "string?", "isRequired": false, "minLength": null, "maxLength": null, @@ -4414,10 +4653,10 @@ "regex": null }, { - "name": "MedicationUrl", + "name": "MedicationUrlID", "jsonName": null, - "type": "System.String", - "typeSimple": "string", + "type": "System.Guid?", + "typeSimple": "string?", "isRequired": false, "minLength": null, "maxLength": null, @@ -4426,10 +4665,10 @@ "regex": null }, { - "name": "MedicationHistoryUrl", + "name": "MedicationHistoryUrlID", "jsonName": null, - "type": "System.String", - "typeSimple": "string", + "type": "System.Guid?", + "typeSimple": "string?", "isRequired": false, "minLength": null, "maxLength": null, @@ -4673,6 +4912,18 @@ "minimum": null, "maximum": null, "regex": null + }, + { + "name": "Imagepath", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null } ] }, @@ -4841,52 +5092,43 @@ } ] }, - "Volo.Abp.Account.ChangePasswordInput": { - "baseType": null, + "HospitalManagementSystem.Patients.Patient": { + "baseType": "Volo.Abp.Domain.Entities.Auditing.AuditedAggregateRoot", "isEnum": false, "enumNames": null, "enumValues": null, "genericArguments": null, "properties": [ { - "name": "CurrentPassword", + "name": "Name", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false, - "minLength": 0, - "maxLength": 128, + "isRequired": true, + "minLength": null, + "maxLength": null, "minimum": null, "maximum": null, "regex": null }, { - "name": "NewPassword", + "name": "Gender", "jsonName": null, - "type": "System.String", - "typeSimple": "string", + "type": "HospitalManagementSystem.GlobalEnum.Gender", + "typeSimple": "HospitalManagementSystem.GlobalEnum.Gender", "isRequired": true, - "minLength": 0, - "maxLength": 128, + "minLength": null, + "maxLength": null, "minimum": null, "maximum": null, "regex": null - } - ] - }, - "Volo.Abp.Account.ProfileDto": { - "baseType": "Volo.Abp.ObjectExtending.ExtensibleObject", - "isEnum": false, - "enumNames": null, - "enumValues": null, - "genericArguments": null, - "properties": [ + }, { - "name": "UserName", + "name": "Mobile", "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false, + "isRequired": true, "minLength": null, "maxLength": null, "minimum": null, @@ -4898,7 +5140,7 @@ "jsonName": null, "type": "System.String", "typeSimple": "string", - "isRequired": false, + "isRequired": true, "minLength": null, "maxLength": null, "minimum": null, @@ -4906,11 +5148,11 @@ "regex": null }, { - "name": "Name", + "name": "Age", "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false, + "type": "System.Int32", + "typeSimple": "number", + "isRequired": true, "minLength": null, "maxLength": null, "minimum": null, @@ -4918,7 +5160,181 @@ "regex": null }, { - "name": "Surname", + "name": "Treatment", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null + }, + { + "name": "DoctorAssigned", + "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": true, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null + }, + { + "name": "BloodGroup", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": true, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null + }, + { + "name": "AdmissionDate", + "jsonName": null, + "type": "System.DateTime", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null + }, + { + "name": "DischargeDate", + "jsonName": null, + "type": "System.DateTime?", + "typeSimple": "string?", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null + }, + { + "name": "Status", + "jsonName": null, + "type": "HospitalManagementSystem.GlobalEnum.Status", + "typeSimple": "HospitalManagementSystem.GlobalEnum.Status", + "isRequired": true, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null + }, + { + "name": "Images", + "jsonName": null, + "type": "HospitalManagementSystem.Documents.EntityDocument", + "typeSimple": "HospitalManagementSystem.Documents.EntityDocument", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null + } + ] + }, + "Volo.Abp.Account.ChangePasswordInput": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "CurrentPassword", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": 0, + "maxLength": 128, + "minimum": null, + "maximum": null, + "regex": null + }, + { + "name": "NewPassword", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": true, + "minLength": 0, + "maxLength": 128, + "minimum": null, + "maximum": null, + "regex": null + } + ] + }, + "Volo.Abp.Account.ProfileDto": { + "baseType": "Volo.Abp.ObjectExtending.ExtensibleObject", + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "UserName", + "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": "Name", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null + }, + { + "name": "Surname", "jsonName": null, "type": "System.String", "typeSimple": "string", @@ -7599,6 +8015,197 @@ } ] }, + "Volo.Abp.Content.IRemoteStreamContent": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "FileName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null + }, + { + "name": "ContentType", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null + }, + { + "name": "ContentLength", + "jsonName": null, + "type": "System.Int64?", + "typeSimple": "number?", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null + } + ] + }, + "Volo.Abp.Domain.Entities.AggregateRoot": { + "baseType": "Volo.Abp.Domain.Entities.BasicAggregateRoot", + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": [ + "TKey" + ], + "properties": [ + { + "name": "ExtraProperties", + "jsonName": null, + "type": "{System.String:System.Object}", + "typeSimple": "{string:object}", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null + }, + { + "name": "ConcurrencyStamp", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null + } + ] + }, + "Volo.Abp.Domain.Entities.Auditing.AuditedAggregateRoot": { + "baseType": "Volo.Abp.Domain.Entities.Auditing.CreationAuditedAggregateRoot", + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": [ + "TKey" + ], + "properties": [ + { + "name": "LastModificationTime", + "jsonName": null, + "type": "System.DateTime?", + "typeSimple": "string?", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null + }, + { + "name": "LastModifierId", + "jsonName": null, + "type": "System.Guid?", + "typeSimple": "string?", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null + } + ] + }, + "Volo.Abp.Domain.Entities.Auditing.CreationAuditedAggregateRoot": { + "baseType": "Volo.Abp.Domain.Entities.AggregateRoot", + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": [ + "TKey" + ], + "properties": [ + { + "name": "CreationTime", + "jsonName": null, + "type": "System.DateTime", + "typeSimple": "string", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null + }, + { + "name": "CreatorId", + "jsonName": null, + "type": "System.Guid?", + "typeSimple": "string?", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null + } + ] + }, + "Volo.Abp.Domain.Entities.BasicAggregateRoot": { + "baseType": "Volo.Abp.Domain.Entities.Entity", + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": [ + "TKey" + ], + "properties": [] + }, + "Volo.Abp.Domain.Entities.Entity": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [] + }, + "Volo.Abp.Domain.Entities.Entity": { + "baseType": "Volo.Abp.Domain.Entities.Entity", + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": [ + "TKey" + ], + "properties": [ + { + "name": "Id", + "jsonName": null, + "type": "TKey", + "typeSimple": "TKey", + "isRequired": false, + "minLength": null, + "maxLength": null, + "minimum": null, + "maximum": null, + "regex": null + } + ] + }, "Volo.Abp.FeatureManagement.FeatureDto": { "baseType": null, "isEnum": false, diff --git a/angular/src/app/proxy/index.ts b/angular/src/app/proxy/index.ts index 79126d2..368f3ff 100644 --- a/angular/src/app/proxy/index.ts +++ b/angular/src/app/proxy/index.ts @@ -1,4 +1,6 @@ +import * as Documents from './documents'; import * as Dto from './dto'; import * as GlobalEnum from './global-enum'; import * as Patients from './patients'; -export { Dto, GlobalEnum, Patients }; +import * as Volo from './volo'; +export { Documents, Dto, GlobalEnum, Patients, Volo }; diff --git a/angular/src/app/proxy/patients/dto/models.ts b/angular/src/app/proxy/patients/dto/models.ts index bc5e1a1..1ce7102 100644 --- a/angular/src/app/proxy/patients/dto/models.ts +++ b/angular/src/app/proxy/patients/dto/models.ts @@ -15,15 +15,16 @@ export interface CreateUpdatePatientDto { admissionDate?: string; dischargeDate?: string; status: Status; + imageID?: string; } export interface CreateUpdatePatientRecordDto { id?: string; patientId?: string; dateOfAdmission?: string; - labReportUrl?: string; - medicationUrl?: string; - medicationHistoryUrl?: string; + labReportUrlID?: string; + medicationUrlID?: string; + medicationHistoryUrlID?: string; nextFollowUp?: string; diagnosis?: string; treatmentPlan?: string; @@ -46,6 +47,7 @@ export interface PatientDto { admissionDate?: string; dischargeDate?: string; status: Status; + imagepath?: string; } export interface PatientRecordDto { diff --git a/angular/src/app/proxy/patients/index.ts b/angular/src/app/proxy/patients/index.ts index 74952af..db5afa5 100644 --- a/angular/src/app/proxy/patients/index.ts +++ b/angular/src/app/proxy/patients/index.ts @@ -1,3 +1,4 @@ import * as Dto from './dto'; +export * from './models'; export * from './patient.service'; export { Dto }; diff --git a/angular/src/app/proxy/patients/models.ts b/angular/src/app/proxy/patients/models.ts new file mode 100644 index 0000000..608e659 --- /dev/null +++ b/angular/src/app/proxy/patients/models.ts @@ -0,0 +1,20 @@ +import type { AuditedAggregateRoot } from '../volo/abp/domain/entities/auditing/models'; +import type { Gender } from '../global-enum/gender.enum'; +import type { Status } from '../global-enum/status.enum'; +import type { EntityDocument } from '../documents/models'; + +export interface Patient extends AuditedAggregateRoot { + name: string; + gender: Gender; + mobile: string; + email: string; + age: number; + treatment?: string; + doctorAssigned?: string; + address: string; + bloodGroup: string; + admissionDate?: string; + dischargeDate?: string; + status: Status; + images: EntityDocument; +} diff --git a/angular/src/app/proxy/patients/patient.service.ts b/angular/src/app/proxy/patients/patient.service.ts index 5743a60..76b2462 100644 --- a/angular/src/app/proxy/patients/patient.service.ts +++ b/angular/src/app/proxy/patients/patient.service.ts @@ -1,7 +1,9 @@ import type { CreateUpdatePatientDto, CreateUpdatePatientRecordDto, PatientDto, PatientRecordDto } from './dto/models'; +import type { Patient } from './models'; import { RestService, Rest } from '@abp/ng.core'; import type { PagedResultDto } from '@abp/ng.core'; import { Injectable } from '@angular/core'; +import type { EntityDocument } from '../documents/models'; import type { DropDownItems, FileDownloadDto, PagingSortPatientResultDto } from '../dto/models'; @Injectable({ @@ -103,6 +105,16 @@ export class PatientService { { apiName: this.apiName,...config }); + saveFileToDocumentByPatientAndUniqueIdsAndIsNew = (patient: Patient, uniqueIds: string[], isNew?: boolean, config?: Partial) => + this.restService.request({ + method: 'POST', + url: '/api/app/patient/save-file-to-document', + params: { isNew }, + body: uniqueIds, + }, + { apiName: this.apiName,...config }); + + updatePatient = (id: string, input: CreateUpdatePatientDto, config?: Partial) => this.restService.request({ method: 'PUT', @@ -119,6 +131,17 @@ export class PatientService { body: input, }, { apiName: this.apiName,...config }); + + + uploadFile = (TagName: string, file: FormData, config?: Partial) => + this.restService.request({ + method: 'POST', + responseType: 'text', + url: '/api/app/patient/upload-file', + params: { tagName: TagName }, + body: file, + }, + { apiName: this.apiName,...config }); constructor(private restService: RestService) {} } diff --git a/angular/src/app/proxy/volo/abp/domain/entities/auditing/index.ts b/angular/src/app/proxy/volo/abp/domain/entities/auditing/index.ts new file mode 100644 index 0000000..e9644da --- /dev/null +++ b/angular/src/app/proxy/volo/abp/domain/entities/auditing/index.ts @@ -0,0 +1 @@ +export * from './models'; diff --git a/angular/src/app/proxy/volo/abp/domain/entities/auditing/models.ts b/angular/src/app/proxy/volo/abp/domain/entities/auditing/models.ts new file mode 100644 index 0000000..e37aea6 --- /dev/null +++ b/angular/src/app/proxy/volo/abp/domain/entities/auditing/models.ts @@ -0,0 +1,11 @@ +import type { AggregateRoot } from '../models'; + +export interface AuditedAggregateRoot extends CreationAuditedAggregateRoot { + lastModificationTime?: string; + lastModifierId?: string; +} + +export interface CreationAuditedAggregateRoot extends AggregateRoot { + creationTime?: string; + creatorId?: string; +} diff --git a/angular/src/app/proxy/volo/abp/domain/entities/index.ts b/angular/src/app/proxy/volo/abp/domain/entities/index.ts new file mode 100644 index 0000000..72387e4 --- /dev/null +++ b/angular/src/app/proxy/volo/abp/domain/entities/index.ts @@ -0,0 +1,3 @@ +import * as Auditing from './auditing'; +export * from './models'; +export { Auditing }; diff --git a/angular/src/app/proxy/volo/abp/domain/entities/models.ts b/angular/src/app/proxy/volo/abp/domain/entities/models.ts new file mode 100644 index 0000000..5cef7e7 --- /dev/null +++ b/angular/src/app/proxy/volo/abp/domain/entities/models.ts @@ -0,0 +1,11 @@ + +export interface AggregateRoot extends BasicAggregateRoot { + extraProperties: Record; + concurrencyStamp?: string; +} + +export interface BasicAggregateRoot extends Entity { +} + +export interface Entity { +} diff --git a/angular/src/app/proxy/volo/abp/domain/index.ts b/angular/src/app/proxy/volo/abp/domain/index.ts new file mode 100644 index 0000000..4a7b9cf --- /dev/null +++ b/angular/src/app/proxy/volo/abp/domain/index.ts @@ -0,0 +1,2 @@ +import * as Entities from './entities'; +export { Entities }; diff --git a/angular/src/app/proxy/volo/abp/index.ts b/angular/src/app/proxy/volo/abp/index.ts new file mode 100644 index 0000000..7ac9be6 --- /dev/null +++ b/angular/src/app/proxy/volo/abp/index.ts @@ -0,0 +1,2 @@ +import * as Domain from './domain'; +export { Domain }; diff --git a/angular/src/app/proxy/volo/index.ts b/angular/src/app/proxy/volo/index.ts new file mode 100644 index 0000000..900f264 --- /dev/null +++ b/angular/src/app/proxy/volo/index.ts @@ -0,0 +1,2 @@ +import * as Abp from './abp'; +export { Abp }; diff --git a/angular/src/assets/default-profile.png b/angular/src/assets/default-profile.png new file mode 100644 index 0000000..98f065f Binary files /dev/null and b/angular/src/assets/default-profile.png differ diff --git a/aspnet-core/src/HospitalManagementSystem.Application.Contracts/Patients/Dto/CreateUpdatePatientDto.cs b/aspnet-core/src/HospitalManagementSystem.Application.Contracts/Patients/Dto/CreateUpdatePatientDto.cs index 28f01a0..e2eb693 100644 --- a/aspnet-core/src/HospitalManagementSystem.Application.Contracts/Patients/Dto/CreateUpdatePatientDto.cs +++ b/aspnet-core/src/HospitalManagementSystem.Application.Contracts/Patients/Dto/CreateUpdatePatientDto.cs @@ -23,5 +23,6 @@ namespace HospitalManagementSystem.Patients.Dto public DateTime AdmissionDate { get; set; } public DateTime? DischargeDate { get; set; } public Status Status { get; set; } + public Guid ImageID { get; set; } } } diff --git a/aspnet-core/src/HospitalManagementSystem.Application.Contracts/Patients/Dto/CreateUpdatePatientRecordDto.cs b/aspnet-core/src/HospitalManagementSystem.Application.Contracts/Patients/Dto/CreateUpdatePatientRecordDto.cs index de9a586..6820645 100644 --- a/aspnet-core/src/HospitalManagementSystem.Application.Contracts/Patients/Dto/CreateUpdatePatientRecordDto.cs +++ b/aspnet-core/src/HospitalManagementSystem.Application.Contracts/Patients/Dto/CreateUpdatePatientRecordDto.cs @@ -13,21 +13,15 @@ namespace HospitalManagementSystem.Patients.Dto { public Guid Id { get; set; } - //public string FullName { get; set; } - - //public string Mobile { get; set; } - - //public Gender Gender { get; set; } - public Guid PatientId { get; set; } public DateTime DateOfAdmission { get; set; } - public string? LabReportUrl { get; set; } + public Guid? LabReportUrlID { get; set; } - public string? MedicationUrl { get; set; } + public Guid? MedicationUrlID { get; set; } - public string? MedicationHistoryUrl { get; set; } + public Guid? MedicationHistoryUrlID { get; set; } public DateTime? NextFollowUp { get; set; } diff --git a/aspnet-core/src/HospitalManagementSystem.Application.Contracts/Patients/Dto/PatientDto.cs b/aspnet-core/src/HospitalManagementSystem.Application.Contracts/Patients/Dto/PatientDto.cs index 79a5c8d..ec56607 100644 --- a/aspnet-core/src/HospitalManagementSystem.Application.Contracts/Patients/Dto/PatientDto.cs +++ b/aspnet-core/src/HospitalManagementSystem.Application.Contracts/Patients/Dto/PatientDto.cs @@ -22,5 +22,6 @@ namespace HospitalManagementSystem.Patients.Dto public DateTime AdmissionDate { get; set; } public DateTime? DischargeDate { get; set; } public Status Status { get; set; } + public string? Imagepath { get; set; } } } diff --git a/aspnet-core/src/HospitalManagementSystem.Application.Contracts/Patients/Dto/PatientRecordDto.cs b/aspnet-core/src/HospitalManagementSystem.Application.Contracts/Patients/Dto/PatientRecordDto.cs index db4a03a..f1c5c57 100644 --- a/aspnet-core/src/HospitalManagementSystem.Application.Contracts/Patients/Dto/PatientRecordDto.cs +++ b/aspnet-core/src/HospitalManagementSystem.Application.Contracts/Patients/Dto/PatientRecordDto.cs @@ -14,12 +14,6 @@ namespace HospitalManagementSystem.Patients.Dto { public Guid Id { get; set; } - //public string FullName { get; set; } - - //public string Mobile { get; set; } - - //public Gender Gender { get; set; } - public Guid PatientId { get; set; } public PatientDto Patients { get; set; } diff --git a/aspnet-core/src/HospitalManagementSystem.Application/Patients/PatientAppService.cs b/aspnet-core/src/HospitalManagementSystem.Application/Patients/PatientAppService.cs index eab372b..cd53ffa 100644 --- a/aspnet-core/src/HospitalManagementSystem.Application/Patients/PatientAppService.cs +++ b/aspnet-core/src/HospitalManagementSystem.Application/Patients/PatientAppService.cs @@ -1,19 +1,24 @@ using ClosedXML.Excel; +using HospitalManagementSystem.Documents; using HospitalManagementSystem.Dto; using HospitalManagementSystem.GlobalEnum; using HospitalManagementSystem.Patients.Dto; using HospitalManagementSystem.Permissions; using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Hosting; using Microsoft.EntityFrameworkCore; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Linq.Dynamic.Core; +using System.Text.Json; using System.Threading.Tasks; using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; +using Volo.Abp.Content; using Volo.Abp.Domain.Repositories; +using static HospitalManagementSystem.Permissions.HospitalManagementSystemPermissions; namespace HospitalManagementSystem.Patients @@ -22,11 +27,18 @@ namespace HospitalManagementSystem.Patients { private IRepository _patientrecordRepository; private IRepository _patientRepository; + private IRepository _entityDocumentRepository; + private IRepository _patientDocumentRepository; + private readonly IWebHostEnvironment _env; + List uniqueid = new List(); - public PatientAppService(IRepository patientrecordRepository, IRepository patientRepository) + public PatientAppService(IRepository patientrecordRepository, IRepository patientRepository, IWebHostEnvironment env, IRepository entityDocumentRepository, IRepository patientDocumentRepository) { _patientrecordRepository = patientrecordRepository; _patientRepository = patientRepository; + _env = env; + _entityDocumentRepository = entityDocumentRepository; + _patientDocumentRepository = patientDocumentRepository; } #region PatientRecord @@ -35,46 +47,36 @@ namespace HospitalManagementSystem.Patients [Authorize(HospitalManagementSystemPermissions.Patient.Default)] public async Task> GetPatientRecordListAsync(PagingSortPatientResultDto input, Guid Id) { - //List? query; - - //query = _patientrecordRepository.GetQueryableAsync().Result - // .Include(x => x.Patients) - // .WhereIf(!String.IsNullOrEmpty(input.Search), x => x.Patients.Name.ToLower().Contains(input.Search.ToLower())) - // .Where(x => x.Patients.Id == Id) - // .OrderBy(input.Sorting ?? (nameof(PatientRecord.Id) + " asc")) - // .Skip(input.SkipCount) - // .Take(input.MaxResultCount) - // .ToList(); - - //var totalCount = await _patientrecordRepository.CountAsync(); - //return new PagedResultDto( - // totalCount, - // ObjectMapper.Map, List>(query) - //); var queryable = await _patientrecordRepository.GetQueryableAsync(); var filteredQuery = queryable .Include(x => x.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())) .Where(x => x.Patients.Id == Id); - // Get total count after filtering var totalCount = await filteredQuery.CountAsync(); - // Apply sorting dynamically (ensure input.Sorting is valid) filteredQuery = !string.IsNullOrEmpty(input.Sorting) ? filteredQuery.OrderBy(input.Sorting) : filteredQuery.OrderBy(x => x.Id); - // Apply paging var pagedQuery = await filteredQuery .Skip(input.SkipCount) .Take(input.MaxResultCount) .ToListAsync(); - + var patientrecorddto = ObjectMapper.Map, List>(pagedQuery); + foreach (var pr in patientrecorddto) + { + pr.LabReportUrl = filteredQuery.Where(x => x.Id == pr.Id).Select(x => x.LabReportUrl.FilePath).FirstOrDefault(); + pr.MedicationUrl = filteredQuery.Where(x => x.Id == pr.Id).Select(x => x.MedicationUrl.FilePath).FirstOrDefault(); + pr.MedicationHistoryUrl = filteredQuery.Where(x => x.Id == pr.Id).Select(x => x.MedicationHistoryUrl.FilePath).FirstOrDefault(); + } return new PagedResultDto( totalCount, - ObjectMapper.Map, List>(pagedQuery) + patientrecorddto ); } @@ -84,17 +86,26 @@ namespace HospitalManagementSystem.Patients [Authorize(HospitalManagementSystemPermissions.Patient.Default)] public async Task GetPatientRecordByIdAsync(Guid id) { - var patient = await _patientrecordRepository.GetAsync(id); - return ObjectMapper.Map(patient); + var patient = await _patientrecordRepository.GetQueryableAsync().Result + .Include(x => x.LabReportUrl) + .Include(x => x.MedicationUrl) + .Include(x => x.MedicationHistoryUrl) + .Where(x => x.Id == id).FirstOrDefaultAsync(); + var patientdto = ObjectMapper.Map(patient); + + patientdto.LabReportUrl = patient.LabReportUrl != null ? patient.LabReportUrl.FilePath : null; + patientdto.MedicationUrl = patient.MedicationUrl != null ? patient.MedicationUrl.FilePath : null; + patientdto.MedicationHistoryUrl = patient.MedicationHistoryUrl != null ? patient.MedicationHistoryUrl.FilePath : null; + return patientdto; } #endregion #region Export Patient Data to Excel public async Task GetExportPatientRecordAsync() { - var patients = await _patientrecordRepository.GetListAsync(); + var patientrecord = await _patientrecordRepository.GetQueryableAsync().Result.Include(x => x.Patients).ToListAsync(); - var folderPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "exports"); + var folderPath = Path.Combine(_env.WebRootPath, "temp"); if (!Directory.Exists(folderPath)) { Directory.CreateDirectory(folderPath); // Ensure the folder exists @@ -114,16 +125,22 @@ namespace HospitalManagementSystem.Patients worksheet.Cell(1, 3).Value = "Date of Admission"; worksheet.Cell(1, 4).Value = "Diagnosis"; worksheet.Cell(1, 5).Value = "Next Follow-Up"; - worksheet.Cell(1, 6).Value = "Status"; + worksheet.Cell(1, 6).Value = "InsuranceProvider"; + worksheet.Cell(1, 7).Value = "InsuranceProvider"; + worksheet.Cell(1, 8).Value = "InsuranceProvider"; + worksheet.Cell(1, 9).Value = "Status"; - for (int i = 0; i < patients.Count; i++) + for (int i = 0; i < patientrecord.Count; i++) { - worksheet.Cell(i + 2, 1).Value = patients[i].Patients.Name; - worksheet.Cell(i + 2, 2).Value = patients[i].Patients.Gender.ToString(); - worksheet.Cell(i + 2, 3).Value = patients[i].DateOfAdmission.ToShortDateString(); - worksheet.Cell(i + 2, 4).Value = patients[i].Diagnosis; - worksheet.Cell(i + 2, 5).Value = patients[i].NextFollowUp?.ToShortDateString(); - worksheet.Cell(i + 2, 6).Value = patients[i].Status.ToString(); + worksheet.Cell(i + 2, 1).Value = patientrecord[i].Patients.Name; + worksheet.Cell(i + 2, 2).Value = patientrecord[i].Patients.Gender.ToString(); + worksheet.Cell(i + 2, 3).Value = patientrecord[i].DateOfAdmission.ToShortDateString(); + worksheet.Cell(i + 2, 4).Value = patientrecord[i].Diagnosis; + worksheet.Cell(i + 2, 5).Value = patientrecord[i].NextFollowUp?.ToShortDateString(); + worksheet.Cell(i + 2, 6).Value = patientrecord[i].InsuranceProvider; + worksheet.Cell(i + 2, 7).Value = patientrecord[i].InsuranceProvider; + worksheet.Cell(i + 2, 8).Value = patientrecord[i].InsuranceProvider; + worksheet.Cell(i + 2, 9).Value = patientrecord[i].Status.ToString(); } worksheet.Columns().AdjustToContents(); @@ -147,10 +164,35 @@ namespace HospitalManagementSystem.Patients public async Task CreatePatientRecordAsync(CreateUpdatePatientRecordDto input) { var patientEntity = await _patientRepository.GetAsync(input.PatientId); // Get Patient from DB - var patientRecord = ObjectMapper.Map(input); - patientRecord.Patients = patientEntity; // Assign the fetched entity - + patientRecord.Patients = patientEntity; + List entitydocument = new List(); + + if (input.LabReportUrlID != Guid.Empty) + uniqueid.Add(input.LabReportUrlID.Value); + if (input.MedicationUrlID != Guid.Empty) + uniqueid.Add(input.MedicationUrlID.Value); + if (input.MedicationHistoryUrlID != Guid.Empty) + uniqueid.Add(input.MedicationHistoryUrlID.Value); + if (uniqueid.Count > 0) + { + entitydocument = await SaveFileToDocument(patientEntity, uniqueid); + foreach (var entity in entitydocument) + { + switch (entity.TagName) + { + case "Lab-Report": + patientRecord.LabReportUrl = entity; + break; + case "Medication": + patientRecord.MedicationUrl = entity; + break; + case "Medication-History": + patientRecord.MedicationHistoryUrl = entity; + break; + } + } + } patientRecord = await _patientrecordRepository.InsertAsync(patientRecord); return ObjectMapper.Map(patientRecord); @@ -161,20 +203,50 @@ namespace HospitalManagementSystem.Patients [Authorize(HospitalManagementSystemPermissions.Patient.Edit)] public async Task UpdatePatientRecordAsync(Guid id, CreateUpdatePatientRecordDto input) { - var patientRecord = await _patientrecordRepository.GetAsync(id); + try + { + var patientRecord = await _patientrecordRepository.GetQueryableAsync().Result.Include(x => x.Patients).Where(x => x.Id == id).FirstOrDefaultAsync(); + List entitydocument = new List(); + if (patientRecord.Patients.Id != input.PatientId) // If PatientId is updated, fetch new Patient + { + var newPatient = await _patientRepository.GetAsync(input.PatientId); + patientRecord.Patients = newPatient; + } + ObjectMapper.Map(input, patientRecord); + if (input.LabReportUrlID != Guid.Empty) + uniqueid.Add(input.LabReportUrlID.Value); + if (input.MedicationUrlID != Guid.Empty) + uniqueid.Add(input.MedicationUrlID.Value); + if (input.MedicationHistoryUrlID != Guid.Empty) + uniqueid.Add(input.MedicationHistoryUrlID.Value); + if (uniqueid.Count > 0) + { + entitydocument = await SaveFileToDocument(patientRecord.Patients, uniqueid); + foreach (var entity in entitydocument) + { + switch (entity.TagName) + { + case "Lab-Report": + patientRecord.LabReportUrl = entity; + break; + case "Medication": + patientRecord.MedicationUrl = entity; + break; + case "Medication-History": + patientRecord.MedicationHistoryUrl = entity; + break; + } + } + } + patientRecord = await _patientrecordRepository.UpdateAsync(patientRecord); - if (patientRecord.Patients.Id != input.PatientId) // If PatientId is updated, fetch new Patient + return ObjectMapper.Map(patientRecord); + } + catch (Exception ex) { - var newPatient = await _patientRepository.GetAsync(input.PatientId); - patientRecord.Patients = newPatient; + throw new Exception(ex.Message); } - ObjectMapper.Map(input, patientRecord); - - patientRecord = await _patientrecordRepository.UpdateAsync(patientRecord); - - return ObjectMapper.Map(patientRecord); - } #endregion @@ -225,8 +297,10 @@ namespace HospitalManagementSystem.Patients [Authorize(HospitalManagementSystemPermissions.Patient.Default)] public async Task GetPatientByIdAsync(Guid id) { - var patient = await _patientRepository.GetAsync(id); - return ObjectMapper.Map(patient); + var patient = await _patientRepository.GetQueryableAsync().Result.Include(x => x.Images).Where(x => x.Id == id).FirstOrDefaultAsync(); + var patientdto = ObjectMapper.Map(patient); + patientdto.Imagepath = patient.Images != null ? patient.Images.FilePath : null; + return patientdto; } #endregion @@ -235,7 +309,7 @@ namespace HospitalManagementSystem.Patients { var patients = await _patientRepository.GetListAsync(); - var folderPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "exports"); + var folderPath = Path.Combine(_env.WebRootPath, "temp"); if (!Directory.Exists(folderPath)) { Directory.CreateDirectory(folderPath); @@ -252,11 +326,12 @@ namespace HospitalManagementSystem.Patients worksheet.Cell(1, 1).Value = "Name"; worksheet.Cell(1, 2).Value = "Gender"; worksheet.Cell(1, 3).Value = "Age"; - worksheet.Cell(1, 4).Value = "Treatment"; - worksheet.Cell(1, 5).Value = "Doctor Assigned"; - worksheet.Cell(1, 6).Value = "Admission Date"; - worksheet.Cell(1, 7).Value = "Discharge Date"; - worksheet.Cell(1, 8).Value = "Status"; + worksheet.Cell(1, 4).Value = "BloodGroup"; + worksheet.Cell(1, 5).Value = "Treatment"; + worksheet.Cell(1, 6).Value = "Doctor Assigned"; + worksheet.Cell(1, 7).Value = "Admission Date"; + worksheet.Cell(1, 8).Value = "Discharge Date"; + worksheet.Cell(1, 9).Value = "Status"; // Add data rows for (int i = 0; i < patients.Count; i++) @@ -264,11 +339,12 @@ namespace HospitalManagementSystem.Patients worksheet.Cell(i + 2, 1).Value = patients[i].Name; worksheet.Cell(i + 2, 2).Value = patients[i].Gender.ToString(); worksheet.Cell(i + 2, 3).Value = patients[i].Age; - worksheet.Cell(i + 2, 4).Value = patients[i].Treatment; - worksheet.Cell(i + 2, 5).Value = patients[i].DoctorAssigned; - worksheet.Cell(i + 2, 6).Value = patients[i].AdmissionDate.ToShortDateString(); - worksheet.Cell(i + 2, 7).Value = patients[i].DischargeDate?.ToShortDateString(); - worksheet.Cell(i + 2, 8).Value = patients[i].Status.ToString(); + worksheet.Cell(i + 2, 4).Value = patients[i].BloodGroup; + worksheet.Cell(i + 2, 5).Value = patients[i].Treatment; + worksheet.Cell(i + 2, 6).Value = patients[i].DoctorAssigned; + worksheet.Cell(i + 2, 7).Value = patients[i].AdmissionDate.ToShortDateString(); + worksheet.Cell(i + 2, 8).Value = patients[i].DischargeDate?.ToShortDateString(); + worksheet.Cell(i + 2, 9).Value = patients[i].Status.ToString(); } worksheet.Columns().AdjustToContents(); @@ -293,6 +369,19 @@ namespace HospitalManagementSystem.Patients var patient = ObjectMapper.Map(input); patient = await _patientRepository.InsertAsync(patient); + if (input.ImageID != Guid.Empty) + { + uniqueid.Add(input.ImageID); + var entitydocument = await SaveFileToDocument(patient, uniqueid, true); + foreach (var entity in entitydocument) + { + if (entity.TagName == "Image") + { + patient.Images = entity; + } + } + } + return ObjectMapper.Map(patient); } #endregion @@ -301,9 +390,21 @@ namespace HospitalManagementSystem.Patients [Authorize(HospitalManagementSystemPermissions.Patient.Edit)] public async Task UpdatePatientAsync(Guid id, CreateUpdatePatientDto input) { - var patient = await _patientRepository.GetAsync(id); - + var patient = await _patientRepository.GetQueryableAsync().Result.Include(x => x.Images).Where(x => x.Id == id).FirstOrDefaultAsync(); + List entitydocument = new List(); ObjectMapper.Map(input, patient); + if (input.ImageID != Guid.Empty) + { + uniqueid.Add(input.ImageID); + entitydocument = await SaveFileToDocument(patient, uniqueid); + foreach (var entity in entitydocument) + { + if (entity.TagName == "Image") + { + patient.Images = entity; + } + } + } patient = await _patientRepository.UpdateAsync(patient); return ObjectMapper.Map(patient); @@ -343,5 +444,220 @@ namespace HospitalManagementSystem.Patients return await Task.FromResult(statuslist); } #endregion + + #region UploadFile + public async Task UploadFileAsync(string TagName, IRemoteStreamContent file) + { + if (file == null) + { + throw new Exception("File cannot be null"); + } + string patientFolder = Path.Combine(_env.WebRootPath, "temp"); + Guid uniqueId = Guid.NewGuid(); + if (!Directory.Exists(patientFolder)) + { + Directory.CreateDirectory(patientFolder); + } + + string fileExtension = Path.GetExtension(file.FileName); + string fileName = $"{uniqueId}({TagName}){fileExtension}"; + string filePath = Path.Combine(patientFolder, fileName); + + using (var fileStream = new FileStream(filePath, FileMode.Create, FileAccess.Write)) + { + await file.GetStream().CopyToAsync(fileStream); + } + + var metadata = new + { + OriginalFileName = file.FileName, + FileName = fileName, + FileSize = new FileInfo(filePath).Length.ToString(), + FilePath = filePath, + UploadDate = DateTime.UtcNow, + FileType = fileExtension, + TagName = TagName, + }; + + string jsonFileName = $"{uniqueId}({TagName}).json"; + string jsonFilePath = Path.Combine(patientFolder, jsonFileName); + await File.WriteAllTextAsync(jsonFilePath, JsonSerializer.Serialize(metadata, new JsonSerializerOptions { WriteIndented = true })); + + return uniqueId; + } + #endregion + + #region SaveFileToDocument + //public async Task> SaveFileToDocument(Patient Patients, Guid ImageId, bool IsNew = false) + //{ + // try + // { + // //string patientFolder = Path.Combine(_env.WebRootPath, "uploads", PatientId.ToString()); + // string patientFolder = Path.Combine(_env.WebRootPath, "uploads", $"{Patients.Id}({Patients.Name})"); + // string ImageFolder = Path.Combine(_env.WebRootPath, "uploads", $"{ImageId}({Patients.Name})"); + // List? jsonFiles; + + // if (IsNew) + // { + // jsonFiles = Directory.EnumerateFiles(ImageFolder, "*.json").Where(x => Path.GetFileName(x).StartsWith(ImageId.ToString())).ToList(); + // } + // else + // { + // jsonFiles = Directory.EnumerateFiles(patientFolder, "*.json").Where(x => Path.GetFileName(x).StartsWith(Patients.Id.ToString())).ToList(); + // } + + // List savedDocuments = new List(); + + // // Iterate over all matching JSON files and save data to the database + // foreach (var jsonFilePath in jsonFiles) + // { + // string jsonContent = await File.ReadAllTextAsync(jsonFilePath); + // var metadata = JsonSerializer.Deserialize(jsonContent); + + // var document = new EntityDocument + // { + // OriginalFileName = metadata.GetProperty("OriginalFileName").GetString(), + // GeneratedFileName = metadata.GetProperty("FileName").GetString(), + // FileSize = metadata.GetProperty("FileSize").GetString(), + // FilePath = metadata.GetProperty("FilePath").GetString(), + // FileType = metadata.GetProperty("FileType").GetString(), + // TagName = metadata.GetProperty("TagName").GetString(), + // UploadDate = metadata.GetProperty("UploadDate").GetDateTime() // Use GetDateTime() + // }; + + // // Save document record to the database + // await _entityDocumentRepository.InsertAsync(document); + // savedDocuments.Add(document); + // var patientidexist = await _patientDocumentRepository.GetQueryableAsync().Result.Include(x => x.Patients).Include(x => x.EntityDocuments) + // .Where(x => x.Patients.Id == Patients.Id && x.TagName == document.TagName).FirstOrDefaultAsync(); + // var patientDocument = new PatientDocument + // { + // Patients = Patients, + // EntityDocuments = document, + // TagName = metadata.GetProperty("TagName").GetString() + // }; + // if (patientidexist != null) + // { + // await _patientDocumentRepository.UpdateAsync(patientDocument); + // } + // else + // { + // await _patientDocumentRepository.InsertAsync(patientDocument); + // } + // File.Delete(jsonFilePath); + // } + // return savedDocuments; + // } + // catch (Exception ex) + // { + // throw new Exception(ex.Message); + // } + //} + public async Task> SaveFileToDocument(Patient patient, List uniqueIds, bool isNew = false) + { + try + { + string tempFolder = Path.Combine(_env.WebRootPath, "temp"); + string patientFolder = Path.Combine(_env.WebRootPath, "uploads", $"{patient.Id}({patient.Name})"); + + if (!Directory.Exists(patientFolder)) + { + Directory.CreateDirectory(patientFolder); + } + + List savedDocuments = new List(); + + foreach (var uniqueId in uniqueIds) + { + // Fetch all matching JSON metadata files for the current uniqueId + foreach (var jsonFilePath in Directory.EnumerateFiles(tempFolder, $"{uniqueId}(*).json")) + { + string jsonContent = await File.ReadAllTextAsync(jsonFilePath); + var metadata = JsonSerializer.Deserialize(jsonContent); + + string originalFileName = metadata.GetProperty("OriginalFileName").GetString(); + string generatedFileName = metadata.GetProperty("FileName").GetString(); + string fileSize = metadata.GetProperty("FileSize").GetString(); + string filePath = metadata.GetProperty("FilePath").GetString(); + string fileType = metadata.GetProperty("FileType").GetString(); + string tagName = metadata.GetProperty("TagName").GetString(); + DateTime uploadDate = metadata.GetProperty("UploadDate").GetDateTime(); + + // Move the file from temp folder to patient folder + string newFilePath = Path.Combine(patientFolder, generatedFileName); + if (File.Exists(filePath)) + { + File.Move(filePath, newFilePath, true); + } + newFilePath = newFilePath.Split("wwwroot")[1]; + var document = new EntityDocument + { + OriginalFileName = originalFileName, + GeneratedFileName = generatedFileName, + FileSize = fileSize, + FilePath = newFilePath, + FileType = fileType, + TagName = tagName, + UploadDate = uploadDate + }; + savedDocuments.Add(document); + + // Delete JSON file after processing + File.Delete(jsonFilePath); + } + } + + // Batch insert entity documents + if (savedDocuments.Any()) + { + await _entityDocumentRepository.InsertManyAsync(savedDocuments); + } + + // Fetch existing patient documents in one query + var existingPatientDocs = await _patientDocumentRepository.GetQueryableAsync() + .Result.Where(x => x.Patients.Id == patient.Id) + .ToListAsync(); + + List patientDocuments = new List(); + + foreach (var document in savedDocuments) + { + var existingDoc = existingPatientDocs.FirstOrDefault(x => x.TagName == document.TagName); + + var patientDocument = new PatientDocument + { + Patients = patient, + EntityDocuments = document, + TagName = document.TagName + }; + + if (existingDoc != null) + { + existingDoc.EntityDocuments = document; // Update reference + await _patientDocumentRepository.UpdateAsync(existingDoc); + } + else + { + patientDocuments.Add(patientDocument); + } + } + + // Batch insert new patient documents + if (patientDocuments.Any()) + { + await _patientDocumentRepository.InsertManyAsync(patientDocuments); + } + uniqueid.Clear(); + return savedDocuments; + } + catch (Exception ex) + { + uniqueid.Clear(); + throw new Exception($"Error saving files for patient {patient.Id}: {ex.Message}", ex); + } + } + + + #endregion } } diff --git a/aspnet-core/src/HospitalManagementSystem.Domain.Shared/Dto/UploadFileDto.cs b/aspnet-core/src/HospitalManagementSystem.Domain.Shared/Dto/UploadFileDto.cs new file mode 100644 index 0000000..059ec2d --- /dev/null +++ b/aspnet-core/src/HospitalManagementSystem.Domain.Shared/Dto/UploadFileDto.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.Content; + +namespace HospitalManagementSystem.Dto +{ + public class UploadFileDto + { + public Guid PatientId { get; set; } // Patient GUID ID + public string PatientName { get; set; } // Patient Name + public string TagName { get; set; } // Tag name for the file + public IRemoteStreamContent File { get; set; } // File content + } + +} diff --git a/aspnet-core/src/HospitalManagementSystem.Domain/Documents/EntityDocument.cs b/aspnet-core/src/HospitalManagementSystem.Domain/Documents/EntityDocument.cs new file mode 100644 index 0000000..c5ac170 --- /dev/null +++ b/aspnet-core/src/HospitalManagementSystem.Domain/Documents/EntityDocument.cs @@ -0,0 +1,21 @@ +using HospitalManagementSystem.Patients; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.Domain.Entities.Auditing; + +namespace HospitalManagementSystem.Documents +{ + public class EntityDocument : AuditedAggregateRoot + { + public string OriginalFileName { get; set; } + public string GeneratedFileName { get; set; } + public string FileSize { get; set; } + public string FilePath { get; set; } + public string FileType { get; set; } + public string TagName { get; set; } + public DateTime UploadDate { get; set; } + } +} diff --git a/aspnet-core/src/HospitalManagementSystem.Domain/Documents/PatientDocument.cs b/aspnet-core/src/HospitalManagementSystem.Domain/Documents/PatientDocument.cs new file mode 100644 index 0000000..ec61794 --- /dev/null +++ b/aspnet-core/src/HospitalManagementSystem.Domain/Documents/PatientDocument.cs @@ -0,0 +1,21 @@ +using HospitalManagementSystem.Patients; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.Domain.Entities.Auditing; + +namespace HospitalManagementSystem.Documents +{ + public class PatientDocument : AuditedAggregateRoot + { + [Required] + public Patient Patients { get; set; } + [Required] + public EntityDocument EntityDocuments { get; set; } + [Required] + public string TagName { get; set; } + } +} diff --git a/aspnet-core/src/HospitalManagementSystem.Domain/HospitalManagementSystem.Domain.csproj b/aspnet-core/src/HospitalManagementSystem.Domain/HospitalManagementSystem.Domain.csproj index 45c0c81..2d936cd 100644 --- a/aspnet-core/src/HospitalManagementSystem.Domain/HospitalManagementSystem.Domain.csproj +++ b/aspnet-core/src/HospitalManagementSystem.Domain/HospitalManagementSystem.Domain.csproj @@ -13,6 +13,7 @@ + diff --git a/aspnet-core/src/HospitalManagementSystem.Domain/Patients/Patient.cs b/aspnet-core/src/HospitalManagementSystem.Domain/Patients/Patient.cs index 0c9a518..39f9f04 100644 --- a/aspnet-core/src/HospitalManagementSystem.Domain/Patients/Patient.cs +++ b/aspnet-core/src/HospitalManagementSystem.Domain/Patients/Patient.cs @@ -1,4 +1,5 @@ -using HospitalManagementSystem.GlobalEnum; +using HospitalManagementSystem.Documents; +using HospitalManagementSystem.GlobalEnum; using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; @@ -31,6 +32,7 @@ namespace HospitalManagementSystem.Patients public DateTime? DischargeDate { get; set; } [Required] public Status Status { get; set; } + public EntityDocument? Images { get; set; } } } diff --git a/aspnet-core/src/HospitalManagementSystem.Domain/Patients/PatientRecord.cs b/aspnet-core/src/HospitalManagementSystem.Domain/Patients/PatientRecord.cs index 798b81f..7ecf45e 100644 --- a/aspnet-core/src/HospitalManagementSystem.Domain/Patients/PatientRecord.cs +++ b/aspnet-core/src/HospitalManagementSystem.Domain/Patients/PatientRecord.cs @@ -7,6 +7,7 @@ using System.Threading.Tasks; using System.ComponentModel.DataAnnotations; using HospitalManagementSystem.GlobalEnum; using System.ComponentModel.DataAnnotations.Schema; +using HospitalManagementSystem.Documents; namespace HospitalManagementSystem.Patients { @@ -31,11 +32,11 @@ namespace HospitalManagementSystem.Patients public string DoctorNotes { get; set; } - public string? LabReportUrl { get; set; } + public virtual EntityDocument? LabReportUrl { get; set; } - public string? MedicationUrl { get; set; } + public virtual EntityDocument? MedicationUrl { get; set; } - public string? MedicationHistoryUrl { get; set; } + public virtual EntityDocument? MedicationHistoryUrl { get; set; } public DateTime? NextFollowUp { get; set; } diff --git a/aspnet-core/src/HospitalManagementSystem.EntityFrameworkCore/EntityFrameworkCore/HospitalManagementSystemDbContext.cs b/aspnet-core/src/HospitalManagementSystem.EntityFrameworkCore/EntityFrameworkCore/HospitalManagementSystemDbContext.cs index eb1e70f..fe45fee 100644 --- a/aspnet-core/src/HospitalManagementSystem.EntityFrameworkCore/EntityFrameworkCore/HospitalManagementSystemDbContext.cs +++ b/aspnet-core/src/HospitalManagementSystem.EntityFrameworkCore/EntityFrameworkCore/HospitalManagementSystemDbContext.cs @@ -1,4 +1,5 @@ -using HospitalManagementSystem.Patients; +using HospitalManagementSystem.Documents; +using HospitalManagementSystem.Patients; using Microsoft.EntityFrameworkCore; using Volo.Abp.AuditLogging.EntityFrameworkCore; using Volo.Abp.BackgroundJobs.EntityFrameworkCore; @@ -28,6 +29,9 @@ public class HospitalManagementSystemDbContext : /* Add DbSet properties for your Aggregate Roots / Entities here. */ public DbSet PatientRecords { get; set; } public DbSet Patients { get; set; } + public DbSet EntityDocuments { get; set; } + public DbSet PatientDocuments { get; set; } + #region Entities from the modules /* Notice: We only implemented IIdentityDbContext and ITenantManagementDbContext @@ -90,6 +94,18 @@ public class HospitalManagementSystemDbContext : b.ConfigureByConvention(); //auto configure for the base class props }); + builder.Entity(b => + { + b.ToTable("EntityDocuments"); + b.ConfigureByConvention(); //auto configure for the base class props + }); + + builder.Entity(b => + { + b.ToTable("PatientDocuments"); + b.ConfigureByConvention(); //auto configure for the base class props + }); + //builder.Entity(b => //{ // b.ToTable(HospitalManagementSystemConsts.DbTablePrefix + "YourEntities", HospitalManagementSystemConsts.DbSchema); diff --git a/aspnet-core/src/HospitalManagementSystem.EntityFrameworkCore/Migrations/20250131062928_patientdocument_entitydocument.Designer.cs b/aspnet-core/src/HospitalManagementSystem.EntityFrameworkCore/Migrations/20250131062928_patientdocument_entitydocument.Designer.cs new file mode 100644 index 0000000..b791c9e --- /dev/null +++ b/aspnet-core/src/HospitalManagementSystem.EntityFrameworkCore/Migrations/20250131062928_patientdocument_entitydocument.Designer.cs @@ -0,0 +1,2297 @@ +// +using System; +using HospitalManagementSystem.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Volo.Abp.EntityFrameworkCore; + +#nullable disable + +namespace HospitalManagementSystem.Migrations +{ + [DbContext(typeof(HospitalManagementSystemDbContext))] + [Migration("20250131062928_patientdocument_entitydocument")] + partial class patientdocument_entitydocument + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) + .HasAnnotation("ProductVersion", "9.0.1") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("HospitalManagementSystem.Documents.EntityDocument", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("FilePath") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("FileSize") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("FileType") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("GeneratedFileName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("OriginalFileName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("TagName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UploadDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.ToTable("EntityDocuments", (string)null); + }); + + modelBuilder.Entity("HospitalManagementSystem.Documents.PatientDocument", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("EntityDocumentsId") + .HasColumnType("uniqueidentifier"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("PatientsId") + .HasColumnType("uniqueidentifier"); + + b.Property("TagName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("EntityDocumentsId"); + + b.HasIndex("PatientsId"); + + b.ToTable("PatientDocuments", (string)null); + }); + + modelBuilder.Entity("HospitalManagementSystem.Patients.Patient", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Address") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("AdmissionDate") + .HasColumnType("datetime2"); + + b.Property("Age") + .HasColumnType("int"); + + b.Property("BloodGroup") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DischargeDate") + .HasColumnType("datetime2"); + + b.Property("DoctorAssigned") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Gender") + .HasColumnType("int"); + + b.Property("ImagesId") + .HasColumnType("uniqueidentifier"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Mobile") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("Treatment") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ImagesId"); + + b.ToTable("Patient", (string)null); + }); + + modelBuilder.Entity("HospitalManagementSystem.Patients.PatientRecord", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DateOfAdmission") + .HasColumnType("datetime2"); + + b.Property("Diagnosis") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("DoctorNotes") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("InsuranceProvider") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("LabReportUrlId") + .HasColumnType("uniqueidentifier"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("MedicationHistoryUrlId") + .HasColumnType("uniqueidentifier"); + + b.Property("MedicationUrlId") + .HasColumnType("uniqueidentifier"); + + b.Property("NextFollowUp") + .HasColumnType("datetime2"); + + b.Property("PatientsId") + .HasColumnType("uniqueidentifier"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("TreatmentPlan") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("LabReportUrlId"); + + b.HasIndex("MedicationHistoryUrlId"); + + b.HasIndex("MedicationUrlId"); + + b.HasIndex("PatientsId"); + + b.ToTable("PatientRecords", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ApplicationName") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)") + .HasColumnName("ApplicationName"); + + b.Property("BrowserInfo") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)") + .HasColumnName("BrowserInfo"); + + b.Property("ClientId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("ClientId"); + + b.Property("ClientIpAddress") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("ClientIpAddress"); + + b.Property("ClientName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("ClientName"); + + b.Property("Comments") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Comments"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CorrelationId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("CorrelationId"); + + b.Property("Exceptions") + .HasColumnType("nvarchar(max)"); + + b.Property("ExecutionDuration") + .HasColumnType("int") + .HasColumnName("ExecutionDuration"); + + b.Property("ExecutionTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("HttpMethod") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)") + .HasColumnName("HttpMethod"); + + b.Property("HttpStatusCode") + .HasColumnType("int") + .HasColumnName("HttpStatusCode"); + + b.Property("ImpersonatorTenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("ImpersonatorTenantId"); + + b.Property("ImpersonatorTenantName") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("ImpersonatorTenantName"); + + b.Property("ImpersonatorUserId") + .HasColumnType("uniqueidentifier") + .HasColumnName("ImpersonatorUserId"); + + b.Property("ImpersonatorUserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("ImpersonatorUserName"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("TenantName") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("TenantName"); + + b.Property("Url") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Url"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier") + .HasColumnName("UserId"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("UserName"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "ExecutionTime"); + + b.HasIndex("TenantId", "UserId", "ExecutionTime"); + + b.ToTable("AbpAuditLogs", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AuditLogId") + .HasColumnType("uniqueidentifier") + .HasColumnName("AuditLogId"); + + b.Property("ExecutionDuration") + .HasColumnType("int") + .HasColumnName("ExecutionDuration"); + + b.Property("ExecutionTime") + .HasColumnType("datetime2") + .HasColumnName("ExecutionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("MethodName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("MethodName"); + + b.Property("Parameters") + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)") + .HasColumnName("Parameters"); + + b.Property("ServiceName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("ServiceName"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("AuditLogId"); + + b.HasIndex("TenantId", "ServiceName", "MethodName", "ExecutionTime"); + + b.ToTable("AbpAuditLogActions", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AuditLogId") + .HasColumnType("uniqueidentifier") + .HasColumnName("AuditLogId"); + + b.Property("ChangeTime") + .HasColumnType("datetime2") + .HasColumnName("ChangeTime"); + + b.Property("ChangeType") + .HasColumnType("tinyint") + .HasColumnName("ChangeType"); + + b.Property("EntityId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("EntityId"); + + b.Property("EntityTenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("EntityTypeFullName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("EntityTypeFullName"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("AuditLogId"); + + b.HasIndex("TenantId", "EntityTypeFullName", "EntityId"); + + b.ToTable("AbpEntityChanges", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("EntityChangeId") + .HasColumnType("uniqueidentifier"); + + b.Property("NewValue") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)") + .HasColumnName("NewValue"); + + b.Property("OriginalValue") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)") + .HasColumnName("OriginalValue"); + + b.Property("PropertyName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("PropertyName"); + + b.Property("PropertyTypeFullName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("PropertyTypeFullName"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("EntityChangeId"); + + b.ToTable("AbpEntityPropertyChanges", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.BackgroundJobs.BackgroundJobRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsAbandoned") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("JobArgs") + .IsRequired() + .HasMaxLength(1048576) + .HasColumnType("nvarchar(max)"); + + b.Property("JobName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("LastTryTime") + .HasColumnType("datetime2"); + + b.Property("NextTryTime") + .HasColumnType("datetime2"); + + b.Property("Priority") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint") + .HasDefaultValue((byte)15); + + b.Property("TryCount") + .ValueGeneratedOnAdd() + .HasColumnType("smallint") + .HasDefaultValue((short)0); + + b.HasKey("Id"); + + b.HasIndex("IsAbandoned", "NextTryTime"); + + b.ToTable("AbpBackgroundJobs", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureDefinitionRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AllowedProviders") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("DefaultValue") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Description") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("GroupName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("IsAvailableToHost") + .HasColumnType("bit"); + + b.Property("IsVisibleToClients") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ParentName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ValueType") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.HasKey("Id"); + + b.HasIndex("GroupName"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("AbpFeatures", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureGroupDefinitionRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("AbpFeatureGroups", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[ProviderName] IS NOT NULL AND [ProviderKey] IS NOT NULL"); + + b.ToTable("AbpFeatureValues", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("Description") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsStatic") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Regex") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("RegexDescription") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Required") + .HasColumnType("bit"); + + b.Property("ValueType") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("AbpClaimTypes", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityLinkUser", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("SourceTenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("SourceUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("TargetTenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("TargetUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("SourceUserId", "SourceTenantId", "TargetUserId", "TargetTenantId") + .IsUnique() + .HasFilter("[SourceTenantId] IS NOT NULL AND [TargetTenantId] IS NOT NULL"); + + b.ToTable("AbpLinkUsers", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("EntityVersion") + .HasColumnType("int"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDefault") + .HasColumnType("bit") + .HasColumnName("IsDefault"); + + b.Property("IsPublic") + .HasColumnType("bit") + .HasColumnName("IsPublic"); + + b.Property("IsStatic") + .HasColumnType("bit") + .HasColumnName("IsStatic"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName"); + + b.ToTable("AbpRoles", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ClaimType") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ClaimValue") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AbpRoleClaims", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentitySecurityLog", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Action") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); + + b.Property("ApplicationName") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); + + b.Property("BrowserInfo") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("ClientId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ClientIpAddress") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CorrelationId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreationTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Identity") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("TenantName") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Action"); + + b.HasIndex("TenantId", "ApplicationName"); + + b.HasIndex("TenantId", "Identity"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AbpSecurityLogs", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentitySession", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ClientId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Device") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("DeviceInfo") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IpAddresses") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("LastAccessed") + .HasColumnType("datetime2"); + + b.Property("SessionId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("SignedIn") + .HasColumnType("datetime2"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("Device"); + + b.HasIndex("SessionId"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AbpSessions", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AccessFailedCount") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0) + .HasColumnName("AccessFailedCount"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Email"); + + b.Property("EmailConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("EmailConfirmed"); + + b.Property("EntityVersion") + .HasColumnType("int"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsActive") + .HasColumnType("bit") + .HasColumnName("IsActive"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsExternal") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsExternal"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("LastPasswordChangeTime") + .HasColumnType("datetimeoffset"); + + b.Property("LockoutEnabled") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("LockoutEnabled"); + + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Name"); + + b.Property("NormalizedEmail") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("NormalizedEmail"); + + b.Property("NormalizedUserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("NormalizedUserName"); + + b.Property("PasswordHash") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("PasswordHash"); + + b.Property("PhoneNumber") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)") + .HasColumnName("PhoneNumber"); + + b.Property("PhoneNumberConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("PhoneNumberConfirmed"); + + b.Property("SecurityStamp") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("SecurityStamp"); + + b.Property("ShouldChangePasswordOnNextLogin") + .HasColumnType("bit"); + + b.Property("Surname") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Surname"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("TwoFactorEnabled") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("TwoFactorEnabled"); + + b.Property("UserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("UserName"); + + b.HasKey("Id"); + + b.HasIndex("Email"); + + b.HasIndex("NormalizedEmail"); + + b.HasIndex("NormalizedUserName"); + + b.HasIndex("UserName"); + + b.ToTable("AbpUsers", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ClaimType") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ClaimValue") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AbpUserClaims", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserDelegation", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("EndTime") + .HasColumnType("datetime2"); + + b.Property("SourceUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("StartTime") + .HasColumnType("datetime2"); + + b.Property("TargetUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("AbpUserDelegations", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("LoginProvider") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderDisplayName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(196) + .HasColumnType("nvarchar(196)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "LoginProvider"); + + b.HasIndex("LoginProvider", "ProviderKey"); + + b.ToTable("AbpUserLogins", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b => + { + b.Property("OrganizationUnitId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("OrganizationUnitId", "UserId"); + + b.HasIndex("UserId", "OrganizationUnitId"); + + b.ToTable("AbpUserOrganizationUnits", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId", "UserId"); + + b.ToTable("AbpUserRoles", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("LoginProvider") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Name") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AbpUserTokens", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(95) + .HasColumnType("nvarchar(95)") + .HasColumnName("Code"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("DisplayName"); + + b.Property("EntityVersion") + .HasColumnType("int"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("Code"); + + b.HasIndex("ParentId"); + + b.ToTable("AbpOrganizationUnits", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b => + { + b.Property("OrganizationUnitId") + .HasColumnType("uniqueidentifier"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("OrganizationUnitId", "RoleId"); + + b.HasIndex("RoleId", "OrganizationUnitId"); + + b.ToTable("AbpOrganizationUnitRoles", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.OpenIddict.Applications.OpenIddictApplication", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ApplicationType") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ClientId") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ClientSecret") + .HasColumnType("nvarchar(max)"); + + b.Property("ClientType") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ClientUri") + .HasColumnType("nvarchar(max)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ConsentType") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("DisplayName") + .HasColumnType("nvarchar(max)"); + + b.Property("DisplayNames") + .HasColumnType("nvarchar(max)"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("JsonWebKeySet") + .HasColumnType("nvarchar(max)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("LogoUri") + .HasColumnType("nvarchar(max)"); + + b.Property("Permissions") + .HasColumnType("nvarchar(max)"); + + b.Property("PostLogoutRedirectUris") + .HasColumnType("nvarchar(max)"); + + b.Property("Properties") + .HasColumnType("nvarchar(max)"); + + b.Property("RedirectUris") + .HasColumnType("nvarchar(max)"); + + b.Property("Requirements") + .HasColumnType("nvarchar(max)"); + + b.Property("Settings") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ClientId"); + + b.ToTable("OpenIddictApplications", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.OpenIddict.Authorizations.OpenIddictAuthorization", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ApplicationId") + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Properties") + .HasColumnType("nvarchar(max)"); + + b.Property("Scopes") + .HasColumnType("nvarchar(max)"); + + b.Property("Status") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Subject") + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Type") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationId", "Status", "Subject", "Type"); + + b.ToTable("OpenIddictAuthorizations", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.OpenIddict.Scopes.OpenIddictScope", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Descriptions") + .HasColumnType("nvarchar(max)"); + + b.Property("DisplayName") + .HasColumnType("nvarchar(max)"); + + b.Property("DisplayNames") + .HasColumnType("nvarchar(max)"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("Properties") + .HasColumnType("nvarchar(max)"); + + b.Property("Resources") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("OpenIddictScopes", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.OpenIddict.Tokens.OpenIddictToken", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ApplicationId") + .HasColumnType("uniqueidentifier"); + + b.Property("AuthorizationId") + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("ExpirationDate") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Payload") + .HasColumnType("nvarchar(max)"); + + b.Property("Properties") + .HasColumnType("nvarchar(max)"); + + b.Property("RedemptionDate") + .HasColumnType("datetime2"); + + b.Property("ReferenceId") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Status") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Subject") + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("Type") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("AuthorizationId"); + + b.HasIndex("ReferenceId"); + + b.HasIndex("ApplicationId", "Status", "Subject", "Type"); + + b.ToTable("OpenIddictTokens", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionDefinitionRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("GroupName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("IsEnabled") + .HasColumnType("bit"); + + b.Property("MultiTenancySide") + .HasColumnType("tinyint"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ParentName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Providers") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("StateCheckers") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("GroupName"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("AbpPermissions", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[TenantId] IS NOT NULL"); + + b.ToTable("AbpPermissionGrants", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGroupDefinitionRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("AbpPermissionGroups", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey") + .IsUnique() + .HasFilter("[ProviderName] IS NOT NULL AND [ProviderKey] IS NOT NULL"); + + b.ToTable("AbpSettings", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.SettingManagement.SettingDefinitionRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DefaultValue") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("Description") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsEncrypted") + .HasColumnType("bit"); + + b.Property("IsInherited") + .HasColumnType("bit"); + + b.Property("IsVisibleToClients") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Providers") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("AbpSettingDefinitions", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("EntityVersion") + .HasColumnType("int"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("NormalizedName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.HasIndex("NormalizedName"); + + b.ToTable("AbpTenants", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => + { + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.HasKey("TenantId", "Name"); + + b.ToTable("AbpTenantConnectionStrings", (string)null); + }); + + modelBuilder.Entity("HospitalManagementSystem.Documents.PatientDocument", b => + { + b.HasOne("HospitalManagementSystem.Documents.EntityDocument", "EntityDocuments") + .WithMany() + .HasForeignKey("EntityDocumentsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("HospitalManagementSystem.Patients.Patient", "Patients") + .WithMany() + .HasForeignKey("PatientsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("EntityDocuments"); + + b.Navigation("Patients"); + }); + + modelBuilder.Entity("HospitalManagementSystem.Patients.Patient", b => + { + b.HasOne("HospitalManagementSystem.Documents.EntityDocument", "Images") + .WithMany() + .HasForeignKey("ImagesId"); + + b.Navigation("Images"); + }); + + modelBuilder.Entity("HospitalManagementSystem.Patients.PatientRecord", b => + { + b.HasOne("HospitalManagementSystem.Documents.EntityDocument", "LabReportUrl") + .WithMany() + .HasForeignKey("LabReportUrlId"); + + b.HasOne("HospitalManagementSystem.Documents.EntityDocument", "MedicationHistoryUrl") + .WithMany() + .HasForeignKey("MedicationHistoryUrlId"); + + b.HasOne("HospitalManagementSystem.Documents.EntityDocument", "MedicationUrl") + .WithMany() + .HasForeignKey("MedicationUrlId"); + + b.HasOne("HospitalManagementSystem.Patients.Patient", "Patients") + .WithMany() + .HasForeignKey("PatientsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("LabReportUrl"); + + b.Navigation("MedicationHistoryUrl"); + + b.Navigation("MedicationUrl"); + + b.Navigation("Patients"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => + { + b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) + .WithMany("Actions") + .HasForeignKey("AuditLogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) + .WithMany("EntityChanges") + .HasForeignKey("AuditLogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => + { + b.HasOne("Volo.Abp.AuditLogging.EntityChange", null) + .WithMany("PropertyChanges") + .HasForeignKey("EntityChangeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => + { + b.HasOne("Volo.Abp.Identity.IdentityRole", null) + .WithMany("Claims") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Claims") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Logins") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b => + { + b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) + .WithMany() + .HasForeignKey("OrganizationUnitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("OrganizationUnits") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => + { + b.HasOne("Volo.Abp.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Roles") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Tokens") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => + { + b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) + .WithMany() + .HasForeignKey("ParentId"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b => + { + b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) + .WithMany("Roles") + .HasForeignKey("OrganizationUnitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Volo.Abp.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.OpenIddict.Authorizations.OpenIddictAuthorization", b => + { + b.HasOne("Volo.Abp.OpenIddict.Applications.OpenIddictApplication", null) + .WithMany() + .HasForeignKey("ApplicationId"); + }); + + modelBuilder.Entity("Volo.Abp.OpenIddict.Tokens.OpenIddictToken", b => + { + b.HasOne("Volo.Abp.OpenIddict.Applications.OpenIddictApplication", null) + .WithMany() + .HasForeignKey("ApplicationId"); + + b.HasOne("Volo.Abp.OpenIddict.Authorizations.OpenIddictAuthorization", null) + .WithMany() + .HasForeignKey("AuthorizationId"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => + { + b.HasOne("Volo.Abp.TenantManagement.Tenant", null) + .WithMany("ConnectionStrings") + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => + { + b.Navigation("Actions"); + + b.Navigation("EntityChanges"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.Navigation("PropertyChanges"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => + { + b.Navigation("Claims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => + { + b.Navigation("Claims"); + + b.Navigation("Logins"); + + b.Navigation("OrganizationUnits"); + + b.Navigation("Roles"); + + b.Navigation("Tokens"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => + { + b.Navigation("Roles"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => + { + b.Navigation("ConnectionStrings"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/aspnet-core/src/HospitalManagementSystem.EntityFrameworkCore/Migrations/20250131062928_patientdocument_entitydocument.cs b/aspnet-core/src/HospitalManagementSystem.EntityFrameworkCore/Migrations/20250131062928_patientdocument_entitydocument.cs new file mode 100644 index 0000000..ec882c4 --- /dev/null +++ b/aspnet-core/src/HospitalManagementSystem.EntityFrameworkCore/Migrations/20250131062928_patientdocument_entitydocument.cs @@ -0,0 +1,241 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace HospitalManagementSystem.Migrations +{ + /// + public partial class patientdocument_entitydocument : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "LabReportUrl", + table: "PatientRecords"); + + migrationBuilder.DropColumn( + name: "MedicationHistoryUrl", + table: "PatientRecords"); + + migrationBuilder.DropColumn( + name: "MedicationUrl", + table: "PatientRecords"); + + migrationBuilder.AddColumn( + name: "LabReportUrlId", + table: "PatientRecords", + type: "uniqueidentifier", + nullable: true); + + migrationBuilder.AddColumn( + name: "MedicationHistoryUrlId", + table: "PatientRecords", + type: "uniqueidentifier", + nullable: true); + + migrationBuilder.AddColumn( + name: "MedicationUrlId", + table: "PatientRecords", + type: "uniqueidentifier", + nullable: true); + + migrationBuilder.AddColumn( + name: "ImagesId", + table: "Patient", + type: "uniqueidentifier", + nullable: true); + + migrationBuilder.CreateTable( + name: "EntityDocuments", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + OriginalFileName = table.Column(type: "nvarchar(max)", nullable: false), + GeneratedFileName = table.Column(type: "nvarchar(max)", nullable: false), + FileSize = table.Column(type: "nvarchar(max)", nullable: false), + FilePath = table.Column(type: "nvarchar(max)", nullable: false), + FileType = table.Column(type: "nvarchar(max)", nullable: false), + TagName = table.Column(type: "nvarchar(max)", nullable: false), + UploadDate = table.Column(type: "datetime2", nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: false), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_EntityDocuments", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "PatientDocuments", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + PatientsId = table.Column(type: "uniqueidentifier", nullable: false), + EntityDocumentsId = table.Column(type: "uniqueidentifier", nullable: false), + TagName = table.Column(type: "nvarchar(max)", nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: false), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_PatientDocuments", x => x.Id); + table.ForeignKey( + name: "FK_PatientDocuments_EntityDocuments_EntityDocumentsId", + column: x => x.EntityDocumentsId, + principalTable: "EntityDocuments", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_PatientDocuments_Patient_PatientsId", + column: x => x.PatientsId, + principalTable: "Patient", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_PatientRecords_LabReportUrlId", + table: "PatientRecords", + column: "LabReportUrlId"); + + migrationBuilder.CreateIndex( + name: "IX_PatientRecords_MedicationHistoryUrlId", + table: "PatientRecords", + column: "MedicationHistoryUrlId"); + + migrationBuilder.CreateIndex( + name: "IX_PatientRecords_MedicationUrlId", + table: "PatientRecords", + column: "MedicationUrlId"); + + migrationBuilder.CreateIndex( + name: "IX_Patient_ImagesId", + table: "Patient", + column: "ImagesId"); + + migrationBuilder.CreateIndex( + name: "IX_PatientDocuments_EntityDocumentsId", + table: "PatientDocuments", + column: "EntityDocumentsId"); + + migrationBuilder.CreateIndex( + name: "IX_PatientDocuments_PatientsId", + table: "PatientDocuments", + column: "PatientsId"); + + migrationBuilder.AddForeignKey( + name: "FK_Patient_EntityDocuments_ImagesId", + table: "Patient", + column: "ImagesId", + principalTable: "EntityDocuments", + principalColumn: "Id"); + + migrationBuilder.AddForeignKey( + name: "FK_PatientRecords_EntityDocuments_LabReportUrlId", + table: "PatientRecords", + column: "LabReportUrlId", + principalTable: "EntityDocuments", + principalColumn: "Id"); + + migrationBuilder.AddForeignKey( + name: "FK_PatientRecords_EntityDocuments_MedicationHistoryUrlId", + table: "PatientRecords", + column: "MedicationHistoryUrlId", + principalTable: "EntityDocuments", + principalColumn: "Id"); + + migrationBuilder.AddForeignKey( + name: "FK_PatientRecords_EntityDocuments_MedicationUrlId", + table: "PatientRecords", + column: "MedicationUrlId", + principalTable: "EntityDocuments", + principalColumn: "Id"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Patient_EntityDocuments_ImagesId", + table: "Patient"); + + migrationBuilder.DropForeignKey( + name: "FK_PatientRecords_EntityDocuments_LabReportUrlId", + table: "PatientRecords"); + + migrationBuilder.DropForeignKey( + name: "FK_PatientRecords_EntityDocuments_MedicationHistoryUrlId", + table: "PatientRecords"); + + migrationBuilder.DropForeignKey( + name: "FK_PatientRecords_EntityDocuments_MedicationUrlId", + table: "PatientRecords"); + + migrationBuilder.DropTable( + name: "PatientDocuments"); + + migrationBuilder.DropTable( + name: "EntityDocuments"); + + migrationBuilder.DropIndex( + name: "IX_PatientRecords_LabReportUrlId", + table: "PatientRecords"); + + migrationBuilder.DropIndex( + name: "IX_PatientRecords_MedicationHistoryUrlId", + table: "PatientRecords"); + + migrationBuilder.DropIndex( + name: "IX_PatientRecords_MedicationUrlId", + table: "PatientRecords"); + + migrationBuilder.DropIndex( + name: "IX_Patient_ImagesId", + table: "Patient"); + + migrationBuilder.DropColumn( + name: "LabReportUrlId", + table: "PatientRecords"); + + migrationBuilder.DropColumn( + name: "MedicationHistoryUrlId", + table: "PatientRecords"); + + migrationBuilder.DropColumn( + name: "MedicationUrlId", + table: "PatientRecords"); + + migrationBuilder.DropColumn( + name: "ImagesId", + table: "Patient"); + + migrationBuilder.AddColumn( + name: "LabReportUrl", + table: "PatientRecords", + type: "nvarchar(max)", + nullable: true); + + migrationBuilder.AddColumn( + name: "MedicationHistoryUrl", + table: "PatientRecords", + type: "nvarchar(max)", + nullable: true); + + migrationBuilder.AddColumn( + name: "MedicationUrl", + table: "PatientRecords", + type: "nvarchar(max)", + nullable: true); + } + } +} diff --git a/aspnet-core/src/HospitalManagementSystem.EntityFrameworkCore/Migrations/HospitalManagementSystemDbContextModelSnapshot.cs b/aspnet-core/src/HospitalManagementSystem.EntityFrameworkCore/Migrations/HospitalManagementSystemDbContextModelSnapshot.cs index 592d3d2..e97a0b9 100644 --- a/aspnet-core/src/HospitalManagementSystem.EntityFrameworkCore/Migrations/HospitalManagementSystemDbContextModelSnapshot.cs +++ b/aspnet-core/src/HospitalManagementSystem.EntityFrameworkCore/Migrations/HospitalManagementSystemDbContextModelSnapshot.cs @@ -19,11 +19,128 @@ namespace HospitalManagementSystem.Migrations #pragma warning disable 612, 618 modelBuilder .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) - .HasAnnotation("ProductVersion", "9.0.0") + .HasAnnotation("ProductVersion", "9.0.1") .HasAnnotation("Relational:MaxIdentifierLength", 128); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + modelBuilder.Entity("HospitalManagementSystem.Documents.EntityDocument", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("FilePath") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("FileSize") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("FileType") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("GeneratedFileName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("OriginalFileName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("TagName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UploadDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.ToTable("EntityDocuments", (string)null); + }); + + modelBuilder.Entity("HospitalManagementSystem.Documents.PatientDocument", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("EntityDocumentsId") + .HasColumnType("uniqueidentifier"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("PatientsId") + .HasColumnType("uniqueidentifier"); + + b.Property("TagName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("EntityDocumentsId"); + + b.HasIndex("PatientsId"); + + b.ToTable("PatientDocuments", (string)null); + }); + modelBuilder.Entity("HospitalManagementSystem.Patients.Patient", b => { b.Property("Id") @@ -77,6 +194,9 @@ namespace HospitalManagementSystem.Migrations b.Property("Gender") .HasColumnType("int"); + b.Property("ImagesId") + .HasColumnType("uniqueidentifier"); + b.Property("LastModificationTime") .HasColumnType("datetime2") .HasColumnName("LastModificationTime"); @@ -102,6 +222,8 @@ namespace HospitalManagementSystem.Migrations b.HasKey("Id"); + b.HasIndex("ImagesId"); + b.ToTable("Patient", (string)null); }); @@ -145,8 +267,8 @@ namespace HospitalManagementSystem.Migrations .IsRequired() .HasColumnType("nvarchar(max)"); - b.Property("LabReportUrl") - .HasColumnType("nvarchar(max)"); + b.Property("LabReportUrlId") + .HasColumnType("uniqueidentifier"); b.Property("LastModificationTime") .HasColumnType("datetime2") @@ -156,11 +278,11 @@ namespace HospitalManagementSystem.Migrations .HasColumnType("uniqueidentifier") .HasColumnName("LastModifierId"); - b.Property("MedicationHistoryUrl") - .HasColumnType("nvarchar(max)"); + b.Property("MedicationHistoryUrlId") + .HasColumnType("uniqueidentifier"); - b.Property("MedicationUrl") - .HasColumnType("nvarchar(max)"); + b.Property("MedicationUrlId") + .HasColumnType("uniqueidentifier"); b.Property("NextFollowUp") .HasColumnType("datetime2"); @@ -177,6 +299,12 @@ namespace HospitalManagementSystem.Migrations b.HasKey("Id"); + b.HasIndex("LabReportUrlId"); + + b.HasIndex("MedicationHistoryUrlId"); + + b.HasIndex("MedicationUrlId"); + b.HasIndex("PatientsId"); b.ToTable("PatientRecords", (string)null); @@ -1922,14 +2050,60 @@ namespace HospitalManagementSystem.Migrations b.ToTable("AbpTenantConnectionStrings", (string)null); }); + modelBuilder.Entity("HospitalManagementSystem.Documents.PatientDocument", b => + { + b.HasOne("HospitalManagementSystem.Documents.EntityDocument", "EntityDocuments") + .WithMany() + .HasForeignKey("EntityDocumentsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("HospitalManagementSystem.Patients.Patient", "Patients") + .WithMany() + .HasForeignKey("PatientsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("EntityDocuments"); + + b.Navigation("Patients"); + }); + + modelBuilder.Entity("HospitalManagementSystem.Patients.Patient", b => + { + b.HasOne("HospitalManagementSystem.Documents.EntityDocument", "Images") + .WithMany() + .HasForeignKey("ImagesId"); + + b.Navigation("Images"); + }); + modelBuilder.Entity("HospitalManagementSystem.Patients.PatientRecord", b => { + b.HasOne("HospitalManagementSystem.Documents.EntityDocument", "LabReportUrl") + .WithMany() + .HasForeignKey("LabReportUrlId"); + + b.HasOne("HospitalManagementSystem.Documents.EntityDocument", "MedicationHistoryUrl") + .WithMany() + .HasForeignKey("MedicationHistoryUrlId"); + + b.HasOne("HospitalManagementSystem.Documents.EntityDocument", "MedicationUrl") + .WithMany() + .HasForeignKey("MedicationUrlId"); + b.HasOne("HospitalManagementSystem.Patients.Patient", "Patients") .WithMany() .HasForeignKey("PatientsId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + b.Navigation("LabReportUrl"); + + b.Navigation("MedicationHistoryUrl"); + + b.Navigation("MedicationUrl"); + b.Navigation("Patients"); });