diff --git a/angular/src/app/app-routing.module.ts b/angular/src/app/app-routing.module.ts
index 4261ff2..b303787 100644
--- a/angular/src/app/app-routing.module.ts
+++ b/angular/src/app/app-routing.module.ts
@@ -44,6 +44,10 @@ const routes: Routes = [
path: 'patients',
loadChildren: () => import('./patients/patients.module').then(m => m.PatientsModule),
},
+ {
+ path: 'departments',
+ loadChildren: () => import('./departments/departments.module').then(m => m.DepartmentsModule),
+ },
];
@NgModule({
diff --git a/angular/src/app/appointment/appointment-dialog/appointment-dialog.component.ts b/angular/src/app/appointment/appointment-dialog/appointment-dialog.component.ts
index f1da33f..35273a5 100644
--- a/angular/src/app/appointment/appointment-dialog/appointment-dialog.component.ts
+++ b/angular/src/app/appointment/appointment-dialog/appointment-dialog.component.ts
@@ -49,7 +49,7 @@ import { CommonModule } from '@angular/common';
templateUrl: './appointment-dialog.component.html',
styleUrl: './appointment-dialog.component.scss',
})
-export class AppointmentDialogComponent implements OnInit, OnChanges {
+export class AppointmentDialogComponent implements OnInit {
@Input() visible: boolean = false; // Control modal visibility
@Input() name: string;
@Input() isEditMode: boolean = false; // Determine if it's for edit or create
@@ -70,8 +70,6 @@ export class AppointmentDialogComponent implements OnInit, OnChanges {
constructor(
private DoctorService: DoctorService,
private AppointmentService: AppointmentService,
- private http: HttpClient,
- private confirmation: ConfirmationService,
private toaster: ToasterService
) {}
@@ -101,15 +99,9 @@ export class AppointmentDialogComponent implements OnInit, OnChanges {
}
else{
this.fetchAppointmentData();
-
}
}
- ngOnChanges(changes: SimpleChanges): void {
- // if (changes['appointmentId'] && this.appointmentId) {
- // this.fetchAppointmentData();
- // }
- }
fetchAppointmentData() {
this.AppointmentService.getAppointmentById(this.appointmentId).subscribe(result => {
@@ -161,7 +153,6 @@ export class AppointmentDialogComponent implements OnInit, OnChanges {
() => {
this.toaster.success('Appointment created successfully', 'Success');
this.AppointmentDialog = false;
-
this.onClose();
},
error => {
diff --git a/angular/src/app/appointment/view-appointment/view-appointment.component.ts b/angular/src/app/appointment/view-appointment/view-appointment.component.ts
index 1d92571..9a47b90 100644
--- a/angular/src/app/appointment/view-appointment/view-appointment.component.ts
+++ b/angular/src/app/appointment/view-appointment/view-appointment.component.ts
@@ -16,7 +16,6 @@ import { appointmentStatus, Gender, paymentStatus, visitType } from '@proxy/glob
export class ViewAppointmentComponent {
totalRecords: number = 0;
appointmentIdToEdit: string;
-
AppointmentDialogTitle: string = '';
AppointmentDialog: boolean = false;
patients: [];
@@ -71,7 +70,6 @@ export class ViewAppointmentComponent {
doctors = [];
doctorOptions = [];
-
createPermission = true;
editPermission = true;
deletePermission = true;
@@ -165,7 +163,6 @@ export class ViewAppointmentComponent {
defaultValue: 'Are you sure?',
})
.subscribe((status: Confirmation.Status) => {
- // your code here
if (status == 'confirm') {
this.AppointmentService.deleteAppointmentRecord(id).subscribe(() => {
this.toaster.success('Appointment deleted successfully', 'Success');
diff --git a/angular/src/app/departments/department-dialog.component.html b/angular/src/app/departments/department-dialog.component.html
new file mode 100644
index 0000000..fe05f33
--- /dev/null
+++ b/angular/src/app/departments/department-dialog.component.html
@@ -0,0 +1,145 @@
+
diff --git a/angular/src/app/departments/department-dialog.component.scss b/angular/src/app/departments/department-dialog.component.scss
new file mode 100644
index 0000000..c1581bc
--- /dev/null
+++ b/angular/src/app/departments/department-dialog.component.scss
@@ -0,0 +1,23 @@
+.hide_body{
+ scrollbar-width: auto !important;
+ min-height: 150px;
+ max-height: calc(100vh - 13rem);
+ overflow-y: auto;
+ }
+ .is-valid {
+ border-color: green !important;
+ }
+ .is-invalid {
+ border-color: red !important;
+ }
+
+ /* Adjust the z-index of the calendar dropdown */
+.p-calendar .p-datepicker {
+ z-index: 1050 !important; /* Make sure it's above other elements */
+ }
+
+ /* You can also adjust modal z-index if necessary */
+ .modal {
+ z-index: 1040; /* Set lower z-index to ensure modal is behind the calendar */
+ }
+
\ No newline at end of file
diff --git a/angular/src/app/departments/department-dialog.component.ts b/angular/src/app/departments/department-dialog.component.ts
new file mode 100644
index 0000000..5fc427d
--- /dev/null
+++ b/angular/src/app/departments/department-dialog.component.ts
@@ -0,0 +1,109 @@
+import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
+import { DepartmentsRoutingModule } from './departments-routing.module';
+import { CommonModule } from '@angular/common';
+import { FormsModule, NgForm } from '@angular/forms';
+import { ButtonModule } from 'primeng/button';
+import { CalendarModule } from 'primeng/calendar';
+import { ChipModule } from 'primeng/chip';
+import { DialogModule } from 'primeng/dialog';
+import { DropdownModule } from 'primeng/dropdown';
+import { InputTextModule } from 'primeng/inputtext';
+import { InputTextareaModule } from 'primeng/inputtextarea';
+import { RadioButtonModule } from 'primeng/radiobutton';
+import { TableModule } from 'primeng/table';
+import { CreateDepartmentDto } from '@proxy/dtos';
+import { DepartmentService } from '@proxy/departments';
+import { ConfirmationService, ToasterService } from '@abp/ng.theme.shared';
+
+@Component({
+ selector: 'app-department-dialog',
+ standalone: true,
+ imports: [
+ TableModule,
+ DialogModule,
+ FormsModule,
+ TableModule,
+ ButtonModule,
+ DialogModule,
+ InputTextModule,
+ CalendarModule,
+ DropdownModule,
+ RadioButtonModule,
+ InputTextareaModule,
+ ChipModule,
+ CommonModule,
+ ],
+ templateUrl: './department-dialog.component.html',
+ styleUrl: './department-dialog.component.scss',
+})
+export class DepartmentDialogComponent implements OnInit {
+ @Input() visible: boolean = false;
+ @Input() name: string;
+ @Input() isEditMode: boolean = false;
+ @Output() save = new EventEmitter();
+ @Output() close = new EventEmitter();
+ @Input() Id: string;
+ DepartmentDialog: boolean;
+ Departmentdate: Date;
+ constructor(
+ private DepartmentService: DepartmentService,
+ private toaster: ToasterService
+ ) {}
+ ngOnInit(): void {
+ debugger;
+ if(this.isEditMode){
+ this.fetchDepartmentData();
+ }
+ }
+
+ department: CreateDepartmentDto = {
+ departmentNo: '',
+ departmentName: '',
+ departmentDate: '',
+ departmentHead: '',
+ description: '',
+ status: '',
+ };
+
+ fetchDepartmentData() {
+ this.DepartmentService.getDepartmentById(this.Id).subscribe(result => {
+ this.department = result;
+ this.Departmentdate = new Date(result.departmentDate);
+
+
+ });
+ }
+ saveDepartment(form: NgForm) {
+ if (form.invalid) {
+ Object.values(form.controls).forEach(control => control.markAsTouched());
+ return;
+ }
+ this.department.departmentDate = this.Departmentdate.toDateString();
+
+ if (this.isEditMode) {
+ this.DepartmentService.updateDepartment(this.department).subscribe(
+ () => {
+ this.toaster.success('Department updated successfully', 'Success');
+ this.onClose();
+ },
+ error => {
+ this.toaster.error(error, 'Error');
+ }
+ );
+ } else {
+ this.DepartmentService.createDepartment(this.department).subscribe(
+ () => {
+ this.toaster.success('Department created successfully', 'Success');
+ this.onClose();
+ },
+ error => {
+ this.toaster.error(error, 'Error');
+ }
+ );
+ }
+ }
+ onClose() {
+ this.Id = '';
+ this.close.emit();
+ }
+}
diff --git a/angular/src/app/departments/departments-routing.module.ts b/angular/src/app/departments/departments-routing.module.ts
new file mode 100644
index 0000000..b293606
--- /dev/null
+++ b/angular/src/app/departments/departments-routing.module.ts
@@ -0,0 +1,16 @@
+import { NgModule } from '@angular/core';
+import { RouterModule, Routes } from '@angular/router';
+import { DepartmentsComponent } from './departments.component';
+
+const routes: Routes = [
+
+ { path: '', component: DepartmentsComponent },
+
+
+];
+
+@NgModule({
+ imports: [RouterModule.forChild(routes)],
+ exports: [RouterModule]
+})
+export class DepartmentsRoutingModule { }
diff --git a/angular/src/app/departments/departments.component.html b/angular/src/app/departments/departments.component.html
new file mode 100644
index 0000000..66c9846
--- /dev/null
+++ b/angular/src/app/departments/departments.component.html
@@ -0,0 +1,97 @@
+
+
+
+
+
Department List
+
+
+
+
+
+
+
+
+
+
+ Department Number |
+ Department Name |
+ Description |
+ Date |
+ Department Head |
+ Status |
+ Actions |
+
+
+
+
+ {{ department.departmentNo }} |
+ {{ department.departmentName }} |
+ {{ department.description }} |
+ {{ department.departmentDate | date }} |
+ {{ department.departmentHead }} |
+
+
+ {{ department.status }}
+
+ |
+
+
+
+ |
+
+
+
+
+
+
diff --git a/angular/src/app/departments/departments.component.scss b/angular/src/app/departments/departments.component.scss
new file mode 100644
index 0000000..e69de29
diff --git a/angular/src/app/departments/departments.component.spec.ts b/angular/src/app/departments/departments.component.spec.ts
new file mode 100644
index 0000000..163b39f
--- /dev/null
+++ b/angular/src/app/departments/departments.component.spec.ts
@@ -0,0 +1,23 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { DepartmentsComponent } from './departments.component';
+
+describe('DepartmentsComponent', () => {
+ let component: DepartmentsComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ imports: [DepartmentsComponent]
+ })
+ .compileComponents();
+
+ fixture = TestBed.createComponent(DepartmentsComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/angular/src/app/departments/departments.component.ts b/angular/src/app/departments/departments.component.ts
new file mode 100644
index 0000000..51109c7
--- /dev/null
+++ b/angular/src/app/departments/departments.component.ts
@@ -0,0 +1,115 @@
+import { Confirmation, ConfirmationService, ToasterService } from '@abp/ng.theme.shared';
+import { HttpClient } from '@angular/common/http';
+import { Component, OnInit } from '@angular/core';
+import { DepartmentService } from '@proxy/departments';
+import { PagingSortResultDto } from '@proxy/dto';
+
+@Component({
+ selector: 'app-departments',
+ templateUrl: './departments.component.html',
+ styleUrl: './departments.component.scss',
+})
+export class DepartmentsComponent implements OnInit {
+ totalRecords: number = 0;
+ departments= [];
+ loading: boolean = false;
+ params: PagingSortResultDto;
+ isModalVisible: boolean;
+ isEditMode: boolean = false;
+ DepartmentIdToEdit: string;
+
+ ngOnInit(): void {
+ this.loaddepartments({
+ first: 0,
+ rows: 10,
+ sortField: 'id',
+ sortOrder: 1,
+ globalFilter: null,
+ });
+ }
+ constructor(
+ private DepartmentService: DepartmentService,
+ private http: HttpClient,
+ private confirmation: ConfirmationService,
+ private toaster: ToasterService
+
+ ) {}
+ loaddepartments(event: any) {
+ this.loading = true;
+ let order = event.sortOrder == 1 ? ' asc' : ' desc';
+ event.sortField = event.sortField == undefined ? 'id' : event.sortField;
+ this.params = {
+ skipCount: event.first,
+ maxResultCount: event.rows,
+ sorting: event.sortField + order,
+ search: event.globalFilter == null ? '' : event.globalFilter,
+ };
+
+ this.DepartmentService.getDepartmentList(this.params).subscribe(data => {
+ this.departments = data.items;
+ this.totalRecords = data.totalCount;
+ this.loading = false;
+ });
+ }
+ openNewDepartmentDialog() {
+ this.isModalVisible=true;
+ this.isEditMode = false;
+ }
+ editDepartment(Department: any) {
+ this.isEditMode = true;
+ this.DepartmentIdToEdit = Department.id;
+ this.isModalVisible=true;
+ }
+ deletedepartment(id: string) {
+ this.confirmation
+ .warn('Do you really want to delete this Department?', {
+ key: '::AreYouSure',
+ defaultValue: 'Are you sure?',
+ })
+ .subscribe((status: Confirmation.Status) => {
+ if (status == 'confirm') {
+ this.DepartmentService.deleteDepartmentRecord(id).subscribe(() => {
+ this.toaster.success('Deleted successfully', 'Success');
+ this.loaddepartments(this.params);
+ });
+ }
+ });
+ }
+
+ closeDialog() {
+ this.isModalVisible = false;
+ this.loaddepartments({
+ first: 0,
+ rows: 10,
+ sortField: 'id',
+ sortOrder: 1,
+ globalFilter: null,
+ });
+ }
+
+ exportDepartments() {
+ this.DepartmentService.getExportDepartmentRecord().subscribe(result => {
+ const binary = atob(result.fileContent);
+ const len = binary.length;
+ const bytes = new Uint8Array(len);
+
+ for (let i = 0; i < len; i++) {
+ bytes[i] = binary.charCodeAt(i);
+ }
+
+ const blob = new Blob([bytes], { type: 'application/xlsx' });
+
+ const url = window.URL.createObjectURL(blob);
+
+ const link = document.createElement('a');
+ link.href = url;
+ link.download = result.fileName;
+
+ document.body.appendChild(link);
+ link.click();
+
+ document.body.removeChild(link);
+ window.URL.revokeObjectURL(url);
+ });
+ }
+}
diff --git a/angular/src/app/departments/departments.module.ts b/angular/src/app/departments/departments.module.ts
new file mode 100644
index 0000000..d5d15be
--- /dev/null
+++ b/angular/src/app/departments/departments.module.ts
@@ -0,0 +1,39 @@
+import { NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+
+import { DepartmentsRoutingModule } from './departments-routing.module';
+import { DepartmentsComponent } from './departments.component';
+import { FormsModule } from '@angular/forms';
+import { ButtonModule } from 'primeng/button';
+import { CalendarModule } from 'primeng/calendar';
+import { ChipModule } from 'primeng/chip';
+import { DialogModule } from 'primeng/dialog';
+import { DropdownModule } from 'primeng/dropdown';
+import { InputTextModule } from 'primeng/inputtext';
+import { InputTextareaModule } from 'primeng/inputtextarea';
+import { RadioButtonModule } from 'primeng/radiobutton';
+import { TableModule } from 'primeng/table';
+import { DepartmentDialogComponent } from "./department-dialog.component";
+
+
+@NgModule({
+ declarations: [DepartmentsComponent],
+ imports: [
+ CommonModule,
+ DepartmentsRoutingModule,
+ TableModule,
+ DialogModule,
+ FormsModule,
+ TableModule,
+ ButtonModule,
+ DialogModule,
+ InputTextModule,
+ CalendarModule,
+ DropdownModule,
+ RadioButtonModule,
+ InputTextareaModule,
+ ChipModule,
+ DepartmentDialogComponent
+]
+})
+export class DepartmentsModule { }
diff --git a/angular/src/app/proxy/appoinments/dto/models.ts b/angular/src/app/proxy/appoinments/dto/models.ts
index fdf8af5..2a7c469 100644
--- a/angular/src/app/proxy/appoinments/dto/models.ts
+++ b/angular/src/app/proxy/appoinments/dto/models.ts
@@ -2,7 +2,7 @@ import type { Gender } from '../../global-enum/gender.enum';
import type { appointmentStatus } from '../../global-enum/appointment-status.enum';
import type { visitType } from '../../global-enum/visit-type.enum';
import type { paymentStatus } from '../../global-enum/payment-status.enum';
-import type { Doctor } from '../../doctors/models';
+import type { DoctorDto } from '../../doctors/dto/models';
export interface AppointmentDto {
id?: string;
@@ -22,7 +22,7 @@ export interface AppointmentDto {
appointmentStatus: appointmentStatus;
visitType: visitType;
paymentStatus: paymentStatus;
- doctor: Doctor;
+ doctor: DoctorDto;
}
export interface CreateOrUpdateAppointmentDto {
diff --git a/angular/src/app/proxy/appointments/index.ts b/angular/src/app/proxy/appointments/index.ts
index 39b7171..63c6d7e 100644
--- a/angular/src/app/proxy/appointments/index.ts
+++ b/angular/src/app/proxy/appointments/index.ts
@@ -1,2 +1 @@
export * from './appointment.service';
-export * from './models';
diff --git a/angular/src/app/proxy/appointments/models.ts b/angular/src/app/proxy/appointments/models.ts
deleted file mode 100644
index 53dbb11..0000000
--- a/angular/src/app/proxy/appointments/models.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import type { FullAuditedEntity } from '../volo/abp/domain/entities/auditing/models';
-import type { Gender } from '../global-enum/gender.enum';
-import type { Doctor } from '../doctors/models';
-import type { appointmentStatus } from '../global-enum/appointment-status.enum';
-import type { visitType } from '../global-enum/visit-type.enum';
-import type { paymentStatus } from '../global-enum/payment-status.enum';
-
-export interface Appointment extends FullAuditedEntity {
- firstName?: string;
- lastName?: string;
- gender: Gender;
- mobile?: string;
- address?: string;
- email?: string;
- dob?: string;
- doctor: Doctor;
- dateOfAppointment?: string;
- timeOfAppointment?: string;
- injuryORContion?: string;
- note?: string;
- insuranceProvider?: string;
- appointmentStatus: appointmentStatus;
- visitType: visitType;
- paymentStatus: paymentStatus;
-}
diff --git a/angular/src/app/proxy/departments/department.service.ts b/angular/src/app/proxy/departments/department.service.ts
index 4bb87d0..0ca73f2 100644
--- a/angular/src/app/proxy/departments/department.service.ts
+++ b/angular/src/app/proxy/departments/department.service.ts
@@ -1,5 +1,7 @@
import { RestService, Rest } from '@abp/ng.core';
import { Injectable } from '@angular/core';
+import type { PagedResultDto } from '../abp/application/services/dto/models';
+import type { FileDownloadDto, PagingSortResultDto } from '../dto/models';
import type { CreateDepartmentDto, DepartmentDto } from '../dtos/models';
@Injectable({
@@ -9,19 +11,53 @@ export class DepartmentService {
apiName = 'Default';
- create = (input: CreateDepartmentDto, config?: Partial) =>
- this.restService.request({
+ createDepartment = (input: CreateDepartmentDto, config?: Partial) =>
+ this.restService.request({
method: 'POST',
- url: '/api/app/department',
+ url: '/api/app/department/department',
body: input,
},
{ apiName: this.apiName,...config });
- get = (config?: Partial) =>
- this.restService.request({
+ deleteDepartmentRecord = (id: string, config?: Partial) =>
+ this.restService.request({
+ method: 'DELETE',
+ url: `/api/app/department/${id}/department-record`,
+ },
+ { apiName: this.apiName,...config });
+
+
+ getDepartmentById = (id: string, config?: Partial) =>
+ this.restService.request({
method: 'GET',
- url: '/api/app/department',
+ url: `/api/app/department/${id}/department-by-id`,
+ },
+ { apiName: this.apiName,...config });
+
+
+ getDepartmentList = (input: PagingSortResultDto, config?: Partial) =>
+ this.restService.request>({
+ method: 'GET',
+ url: '/api/app/department/department-list',
+ params: { search: input.search, sorting: input.sorting, skipCount: input.skipCount, maxResultCount: input.maxResultCount },
+ },
+ { apiName: this.apiName,...config });
+
+
+ getExportDepartmentRecord = (config?: Partial) =>
+ this.restService.request({
+ method: 'GET',
+ url: '/api/app/department/export-department-record',
+ },
+ { apiName: this.apiName,...config });
+
+
+ updateDepartment = (input: CreateDepartmentDto, config?: Partial) =>
+ this.restService.request({
+ method: 'PUT',
+ url: '/api/app/department/department',
+ body: input,
},
{ apiName: this.apiName,...config });
diff --git a/angular/src/app/proxy/departments/index.ts b/angular/src/app/proxy/departments/index.ts
index 7924191..47a1528 100644
--- a/angular/src/app/proxy/departments/index.ts
+++ b/angular/src/app/proxy/departments/index.ts
@@ -1,2 +1 @@
export * from './department.service';
-export * from './models';
diff --git a/angular/src/app/proxy/departments/models.ts b/angular/src/app/proxy/departments/models.ts
deleted file mode 100644
index 588cf48..0000000
--- a/angular/src/app/proxy/departments/models.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import type { FullAuditedEntity } from '../volo/abp/domain/entities/auditing/models';
-
-export interface Department extends FullAuditedEntity {
- departmentNo?: string;
- departmentName?: string;
- departmentDate?: string;
- departmentHead?: string;
- status?: string;
- description?: string;
-}
diff --git a/angular/src/app/proxy/doctors/index.ts b/angular/src/app/proxy/doctors/index.ts
index 4cf2224..afe22b6 100644
--- a/angular/src/app/proxy/doctors/index.ts
+++ b/angular/src/app/proxy/doctors/index.ts
@@ -1,4 +1,3 @@
import * as Dto from './dto';
export * from './doctor.service';
-export * from './models';
export { Dto };
diff --git a/angular/src/app/proxy/doctors/models.ts b/angular/src/app/proxy/doctors/models.ts
deleted file mode 100644
index 6c1201f..0000000
--- a/angular/src/app/proxy/doctors/models.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import type { FullAuditedEntity } from '../volo/abp/domain/entities/auditing/models';
-import type { Department } from '../departments/models';
-import type { Appointment } from '../appointments/models';
-
-export interface Doctor extends FullAuditedEntity {
- firstName?: string;
- lastName?: string;
- gender?: string;
- mobile?: string;
- password?: string;
- designation?: string;
- departmentId?: string;
- department: Department;
- address?: string;
- email?: string;
- dob?: string;
- education?: string;
- appointments: Appointment[];
-}
diff --git a/angular/src/app/proxy/dtos/models.ts b/angular/src/app/proxy/dtos/models.ts
index bd93de0..9837656 100644
--- a/angular/src/app/proxy/dtos/models.ts
+++ b/angular/src/app/proxy/dtos/models.ts
@@ -1,11 +1,13 @@
import type { FullAuditedEntity } from '../volo/abp/domain/entities/auditing/models';
export interface CreateDepartmentDto {
+ id?: string;
departmentNo?: string;
departmentName?: string;
departmentDate?: string;
departmentHead?: string;
description?: string;
+ status?: string;
}
export interface CreateDoctorDto {
diff --git a/angular/src/app/proxy/generate-proxy.json b/angular/src/app/proxy/generate-proxy.json
index dad0237..9faf3e3 100644
--- a/angular/src/app/proxy/generate-proxy.json
+++ b/angular/src/app/proxy/generate-proxy.json
@@ -1157,60 +1157,138 @@
"isIntegrationService": false,
"apiVersion": null,
"type": "HospitalManagementSystem.Departments.DepartmentAppService",
- "interfaces": [
- {
- "type": "HospitalManagementSystem.Departments.IDepartmentAppService",
- "name": "IDepartmentAppService",
- "methods": [
+ "interfaces": [],
+ "actions": {
+ "GetDepartmentListAsyncByInput": {
+ "uniqueName": "GetDepartmentListAsyncByInput",
+ "name": "GetDepartmentListAsync",
+ "httpMethod": "GET",
+ "url": "api/app/department/department-list",
+ "supportedVersions": [],
+ "parametersOnMethod": [
{
- "name": "GetAsync",
- "parametersOnMethod": [],
- "returnValue": {
- "type": "System.Collections.Generic.List",
- "typeSimple": "[HospitalManagementSystem.Dtos.DepartmentDto]"
- }
+ "name": "input",
+ "typeAsString": "HospitalManagementSystem.Dto.PagingSortResultDto, HospitalManagementSystem.Domain.Shared",
+ "type": "HospitalManagementSystem.Dto.PagingSortResultDto",
+ "typeSimple": "HospitalManagementSystem.Dto.PagingSortResultDto",
+ "isOptional": false,
+ "defaultValue": null
+ }
+ ],
+ "parameters": [
+ {
+ "nameOnMethod": "input",
+ "name": "Search",
+ "jsonName": null,
+ "type": "System.String",
+ "typeSimple": "string",
+ "isOptional": false,
+ "defaultValue": null,
+ "constraintTypes": null,
+ "bindingSourceId": "ModelBinding",
+ "descriptorName": "input"
},
{
- "name": "CreateAsync",
- "parametersOnMethod": [
- {
- "name": "input",
- "typeAsString": "HospitalManagementSystem.Dtos.CreateDepartmentDto, HospitalManagementSystem.Application",
- "type": "HospitalManagementSystem.Dtos.CreateDepartmentDto",
- "typeSimple": "HospitalManagementSystem.Dtos.CreateDepartmentDto",
- "isOptional": false,
- "defaultValue": null
- }
- ],
- "returnValue": {
- "type": "HospitalManagementSystem.Dtos.DepartmentDto",
- "typeSimple": "HospitalManagementSystem.Dtos.DepartmentDto"
- }
+ "nameOnMethod": "input",
+ "name": "Sorting",
+ "jsonName": null,
+ "type": "System.String",
+ "typeSimple": "string",
+ "isOptional": false,
+ "defaultValue": null,
+ "constraintTypes": null,
+ "bindingSourceId": "ModelBinding",
+ "descriptorName": "input"
+ },
+ {
+ "nameOnMethod": "input",
+ "name": "SkipCount",
+ "jsonName": null,
+ "type": "System.Int32",
+ "typeSimple": "number",
+ "isOptional": false,
+ "defaultValue": null,
+ "constraintTypes": null,
+ "bindingSourceId": "ModelBinding",
+ "descriptorName": "input"
+ },
+ {
+ "nameOnMethod": "input",
+ "name": "MaxResultCount",
+ "jsonName": null,
+ "type": "System.Int32",
+ "typeSimple": "number",
+ "isOptional": false,
+ "defaultValue": null,
+ "constraintTypes": null,
+ "bindingSourceId": "ModelBinding",
+ "descriptorName": "input"
}
- ]
- }
- ],
- "actions": {
- "GetAsync": {
- "uniqueName": "GetAsync",
- "name": "GetAsync",
+ ],
+ "returnValue": {
+ "type": "Abp.Application.Services.Dto.PagedResultDto",
+ "typeSimple": "Abp.Application.Services.Dto.PagedResultDto"
+ },
+ "allowAnonymous": false,
+ "implementFrom": "HospitalManagementSystem.Departments.DepartmentAppService"
+ },
+ "GetDepartmentByIdAsyncById": {
+ "uniqueName": "GetDepartmentByIdAsyncById",
+ "name": "GetDepartmentByIdAsync",
"httpMethod": "GET",
- "url": "api/app/department",
+ "url": "api/app/department/{id}/department-by-id",
+ "supportedVersions": [],
+ "parametersOnMethod": [
+ {
+ "name": "id",
+ "typeAsString": "System.Guid, System.Private.CoreLib",
+ "type": "System.Guid",
+ "typeSimple": "string",
+ "isOptional": false,
+ "defaultValue": null
+ }
+ ],
+ "parameters": [
+ {
+ "nameOnMethod": "id",
+ "name": "id",
+ "jsonName": null,
+ "type": "System.Guid",
+ "typeSimple": "string",
+ "isOptional": false,
+ "defaultValue": null,
+ "constraintTypes": [],
+ "bindingSourceId": "Path",
+ "descriptorName": ""
+ }
+ ],
+ "returnValue": {
+ "type": "HospitalManagementSystem.Dtos.DepartmentDto",
+ "typeSimple": "HospitalManagementSystem.Dtos.DepartmentDto"
+ },
+ "allowAnonymous": false,
+ "implementFrom": "HospitalManagementSystem.Departments.DepartmentAppService"
+ },
+ "GetExportDepartmentRecordAsync": {
+ "uniqueName": "GetExportDepartmentRecordAsync",
+ "name": "GetExportDepartmentRecordAsync",
+ "httpMethod": "GET",
+ "url": "api/app/department/export-department-record",
"supportedVersions": [],
"parametersOnMethod": [],
"parameters": [],
"returnValue": {
- "type": "System.Collections.Generic.List",
- "typeSimple": "[HospitalManagementSystem.Dtos.DepartmentDto]"
+ "type": "HospitalManagementSystem.Dto.FileDownloadDto",
+ "typeSimple": "HospitalManagementSystem.Dto.FileDownloadDto"
},
- "allowAnonymous": null,
- "implementFrom": "HospitalManagementSystem.Departments.IDepartmentAppService"
+ "allowAnonymous": false,
+ "implementFrom": "HospitalManagementSystem.Departments.DepartmentAppService"
},
- "CreateAsyncByInput": {
- "uniqueName": "CreateAsyncByInput",
- "name": "CreateAsync",
+ "CreateDepartmentAsyncByInput": {
+ "uniqueName": "CreateDepartmentAsyncByInput",
+ "name": "CreateDepartmentAsync",
"httpMethod": "POST",
- "url": "api/app/department",
+ "url": "api/app/department/department",
"supportedVersions": [],
"parametersOnMethod": [
{
@@ -1237,11 +1315,85 @@
}
],
"returnValue": {
- "type": "HospitalManagementSystem.Dtos.DepartmentDto",
- "typeSimple": "HospitalManagementSystem.Dtos.DepartmentDto"
+ "type": "System.Void",
+ "typeSimple": "System.Void"
},
- "allowAnonymous": null,
- "implementFrom": "HospitalManagementSystem.Departments.IDepartmentAppService"
+ "allowAnonymous": false,
+ "implementFrom": "HospitalManagementSystem.Departments.DepartmentAppService"
+ },
+ "UpdateDepartmentAsyncByInput": {
+ "uniqueName": "UpdateDepartmentAsyncByInput",
+ "name": "UpdateDepartmentAsync",
+ "httpMethod": "PUT",
+ "url": "api/app/department/department",
+ "supportedVersions": [],
+ "parametersOnMethod": [
+ {
+ "name": "input",
+ "typeAsString": "HospitalManagementSystem.Dtos.CreateDepartmentDto, HospitalManagementSystem.Application",
+ "type": "HospitalManagementSystem.Dtos.CreateDepartmentDto",
+ "typeSimple": "HospitalManagementSystem.Dtos.CreateDepartmentDto",
+ "isOptional": false,
+ "defaultValue": null
+ }
+ ],
+ "parameters": [
+ {
+ "nameOnMethod": "input",
+ "name": "input",
+ "jsonName": null,
+ "type": "HospitalManagementSystem.Dtos.CreateDepartmentDto",
+ "typeSimple": "HospitalManagementSystem.Dtos.CreateDepartmentDto",
+ "isOptional": false,
+ "defaultValue": null,
+ "constraintTypes": null,
+ "bindingSourceId": "Body",
+ "descriptorName": ""
+ }
+ ],
+ "returnValue": {
+ "type": "System.Void",
+ "typeSimple": "System.Void"
+ },
+ "allowAnonymous": false,
+ "implementFrom": "HospitalManagementSystem.Departments.DepartmentAppService"
+ },
+ "DeleteDepartmentRecordAsyncById": {
+ "uniqueName": "DeleteDepartmentRecordAsyncById",
+ "name": "DeleteDepartmentRecordAsync",
+ "httpMethod": "DELETE",
+ "url": "api/app/department/{id}/department-record",
+ "supportedVersions": [],
+ "parametersOnMethod": [
+ {
+ "name": "id",
+ "typeAsString": "System.Guid, System.Private.CoreLib",
+ "type": "System.Guid",
+ "typeSimple": "string",
+ "isOptional": false,
+ "defaultValue": null
+ }
+ ],
+ "parameters": [
+ {
+ "nameOnMethod": "id",
+ "name": "id",
+ "jsonName": null,
+ "type": "System.Guid",
+ "typeSimple": "string",
+ "isOptional": false,
+ "defaultValue": null,
+ "constraintTypes": [],
+ "bindingSourceId": "Path",
+ "descriptorName": ""
+ }
+ ],
+ "returnValue": {
+ "type": "System.Void",
+ "typeSimple": "System.Void"
+ },
+ "allowAnonymous": false,
+ "implementFrom": "HospitalManagementSystem.Departments.DepartmentAppService"
}
}
},
@@ -4953,8 +5105,8 @@
{
"name": "Doctor",
"jsonName": null,
- "type": "HospitalManagementSystem.Doctors.Doctor",
- "typeSimple": "HospitalManagementSystem.Doctors.Doctor",
+ "type": "HospitalManagementSystem.Doctors.Dto.DoctorDto",
+ "typeSimple": "HospitalManagementSystem.Doctors.Dto.DoctorDto",
"isRequired": false,
"minLength": null,
"maxLength": null,
@@ -5177,453 +5329,6 @@
}
]
},
- "HospitalManagementSystem.Appointments.Appointment": {
- "baseType": "Volo.Abp.Domain.Entities.Auditing.FullAuditedEntity",
- "isEnum": false,
- "enumNames": null,
- "enumValues": null,
- "genericArguments": null,
- "properties": [
- {
- "name": "FirstName",
- "jsonName": null,
- "type": "System.String",
- "typeSimple": "string",
- "isRequired": false,
- "minLength": null,
- "maxLength": null,
- "minimum": null,
- "maximum": null,
- "regex": null
- },
- {
- "name": "LastName",
- "jsonName": null,
- "type": "System.String",
- "typeSimple": "string",
- "isRequired": false,
- "minLength": null,
- "maxLength": null,
- "minimum": null,
- "maximum": null,
- "regex": null
- },
- {
- "name": "Gender",
- "jsonName": null,
- "type": "HospitalManagementSystem.GlobalEnum.Gender",
- "typeSimple": "HospitalManagementSystem.GlobalEnum.Gender",
- "isRequired": false,
- "minLength": null,
- "maxLength": null,
- "minimum": null,
- "maximum": null,
- "regex": null
- },
- {
- "name": "Mobile",
- "jsonName": null,
- "type": "System.String",
- "typeSimple": "string",
- "isRequired": false,
- "minLength": null,
- "maxLength": null,
- "minimum": null,
- "maximum": null,
- "regex": null
- },
- {
- "name": "Address",
- "jsonName": null,
- "type": "System.String",
- "typeSimple": "string",
- "isRequired": false,
- "minLength": null,
- "maxLength": null,
- "minimum": null,
- "maximum": null,
- "regex": null
- },
- {
- "name": "Email",
- "jsonName": null,
- "type": "System.String",
- "typeSimple": "string",
- "isRequired": false,
- "minLength": null,
- "maxLength": null,
- "minimum": null,
- "maximum": null,
- "regex": null
- },
- {
- "name": "DOB",
- "jsonName": null,
- "type": "System.DateTime?",
- "typeSimple": "string?",
- "isRequired": false,
- "minLength": null,
- "maxLength": null,
- "minimum": null,
- "maximum": null,
- "regex": null
- },
- {
- "name": "Doctor",
- "jsonName": null,
- "type": "HospitalManagementSystem.Doctors.Doctor",
- "typeSimple": "HospitalManagementSystem.Doctors.Doctor",
- "isRequired": false,
- "minLength": null,
- "maxLength": null,
- "minimum": null,
- "maximum": null,
- "regex": null
- },
- {
- "name": "DateOfAppointment",
- "jsonName": null,
- "type": "System.DateTime?",
- "typeSimple": "string?",
- "isRequired": false,
- "minLength": null,
- "maxLength": null,
- "minimum": null,
- "maximum": null,
- "regex": null
- },
- {
- "name": "TimeOfAppointment",
- "jsonName": null,
- "type": "System.String",
- "typeSimple": "string",
- "isRequired": false,
- "minLength": null,
- "maxLength": null,
- "minimum": null,
- "maximum": null,
- "regex": null
- },
- {
- "name": "InjuryORContion",
- "jsonName": null,
- "type": "System.String",
- "typeSimple": "string",
- "isRequired": false,
- "minLength": null,
- "maxLength": null,
- "minimum": null,
- "maximum": null,
- "regex": null
- },
- {
- "name": "Note",
- "jsonName": null,
- "type": "System.String",
- "typeSimple": "string",
- "isRequired": false,
- "minLength": null,
- "maxLength": null,
- "minimum": null,
- "maximum": null,
- "regex": null
- },
- {
- "name": "InsuranceProvider",
- "jsonName": null,
- "type": "System.String",
- "typeSimple": "string",
- "isRequired": false,
- "minLength": null,
- "maxLength": null,
- "minimum": null,
- "maximum": null,
- "regex": null
- },
- {
- "name": "AppointmentStatus",
- "jsonName": null,
- "type": "HospitalManagementSystem.GlobalEnum.appointmentStatus",
- "typeSimple": "HospitalManagementSystem.GlobalEnum.appointmentStatus",
- "isRequired": false,
- "minLength": null,
- "maxLength": null,
- "minimum": null,
- "maximum": null,
- "regex": null
- },
- {
- "name": "VisitType",
- "jsonName": null,
- "type": "HospitalManagementSystem.GlobalEnum.visitType",
- "typeSimple": "HospitalManagementSystem.GlobalEnum.visitType",
- "isRequired": false,
- "minLength": null,
- "maxLength": null,
- "minimum": null,
- "maximum": null,
- "regex": null
- },
- {
- "name": "PaymentStatus",
- "jsonName": null,
- "type": "HospitalManagementSystem.GlobalEnum.paymentStatus",
- "typeSimple": "HospitalManagementSystem.GlobalEnum.paymentStatus",
- "isRequired": false,
- "minLength": null,
- "maxLength": null,
- "minimum": null,
- "maximum": null,
- "regex": null
- }
- ]
- },
- "HospitalManagementSystem.Departments.Department": {
- "baseType": "Volo.Abp.Domain.Entities.Auditing.FullAuditedEntity",
- "isEnum": false,
- "enumNames": null,
- "enumValues": null,
- "genericArguments": null,
- "properties": [
- {
- "name": "DepartmentNo",
- "jsonName": null,
- "type": "System.String",
- "typeSimple": "string",
- "isRequired": false,
- "minLength": null,
- "maxLength": null,
- "minimum": null,
- "maximum": null,
- "regex": null
- },
- {
- "name": "DepartmentName",
- "jsonName": null,
- "type": "System.String",
- "typeSimple": "string",
- "isRequired": false,
- "minLength": null,
- "maxLength": null,
- "minimum": null,
- "maximum": null,
- "regex": null
- },
- {
- "name": "DepartmentDate",
- "jsonName": null,
- "type": "System.DateTime?",
- "typeSimple": "string?",
- "isRequired": false,
- "minLength": null,
- "maxLength": null,
- "minimum": null,
- "maximum": null,
- "regex": null
- },
- {
- "name": "DepartmentHead",
- "jsonName": null,
- "type": "System.String",
- "typeSimple": "string",
- "isRequired": false,
- "minLength": null,
- "maxLength": null,
- "minimum": null,
- "maximum": null,
- "regex": null
- },
- {
- "name": "Status",
- "jsonName": null,
- "type": "System.String",
- "typeSimple": "string",
- "isRequired": false,
- "minLength": null,
- "maxLength": null,
- "minimum": null,
- "maximum": null,
- "regex": null
- },
- {
- "name": "Description",
- "jsonName": null,
- "type": "System.String",
- "typeSimple": "string",
- "isRequired": false,
- "minLength": null,
- "maxLength": null,
- "minimum": null,
- "maximum": null,
- "regex": null
- }
- ]
- },
- "HospitalManagementSystem.Doctors.Doctor": {
- "baseType": "Volo.Abp.Domain.Entities.Auditing.FullAuditedEntity",
- "isEnum": false,
- "enumNames": null,
- "enumValues": null,
- "genericArguments": null,
- "properties": [
- {
- "name": "FirstName",
- "jsonName": null,
- "type": "System.String",
- "typeSimple": "string",
- "isRequired": false,
- "minLength": null,
- "maxLength": null,
- "minimum": null,
- "maximum": null,
- "regex": null
- },
- {
- "name": "LastName",
- "jsonName": null,
- "type": "System.String",
- "typeSimple": "string",
- "isRequired": false,
- "minLength": null,
- "maxLength": null,
- "minimum": null,
- "maximum": null,
- "regex": null
- },
- {
- "name": "Gender",
- "jsonName": null,
- "type": "System.String",
- "typeSimple": "string",
- "isRequired": false,
- "minLength": null,
- "maxLength": null,
- "minimum": null,
- "maximum": null,
- "regex": null
- },
- {
- "name": "Mobile",
- "jsonName": null,
- "type": "System.String",
- "typeSimple": "string",
- "isRequired": false,
- "minLength": null,
- "maxLength": null,
- "minimum": null,
- "maximum": null,
- "regex": null
- },
- {
- "name": "Password",
- "jsonName": null,
- "type": "System.String",
- "typeSimple": "string",
- "isRequired": false,
- "minLength": null,
- "maxLength": null,
- "minimum": null,
- "maximum": null,
- "regex": null
- },
- {
- "name": "Designation",
- "jsonName": null,
- "type": "System.String",
- "typeSimple": "string",
- "isRequired": false,
- "minLength": null,
- "maxLength": null,
- "minimum": null,
- "maximum": null,
- "regex": null
- },
- {
- "name": "DepartmentId",
- "jsonName": null,
- "type": "System.Guid?",
- "typeSimple": "string?",
- "isRequired": false,
- "minLength": null,
- "maxLength": null,
- "minimum": null,
- "maximum": null,
- "regex": null
- },
- {
- "name": "Department",
- "jsonName": null,
- "type": "HospitalManagementSystem.Departments.Department",
- "typeSimple": "HospitalManagementSystem.Departments.Department",
- "isRequired": false,
- "minLength": null,
- "maxLength": null,
- "minimum": null,
- "maximum": null,
- "regex": null
- },
- {
- "name": "Address",
- "jsonName": null,
- "type": "System.String",
- "typeSimple": "string",
- "isRequired": false,
- "minLength": null,
- "maxLength": null,
- "minimum": null,
- "maximum": null,
- "regex": null
- },
- {
- "name": "Email",
- "jsonName": null,
- "type": "System.String",
- "typeSimple": "string",
- "isRequired": false,
- "minLength": null,
- "maxLength": null,
- "minimum": null,
- "maximum": null,
- "regex": null
- },
- {
- "name": "DOB",
- "jsonName": null,
- "type": "System.String",
- "typeSimple": "string",
- "isRequired": false,
- "minLength": null,
- "maxLength": null,
- "minimum": null,
- "maximum": null,
- "regex": null
- },
- {
- "name": "Education",
- "jsonName": null,
- "type": "System.String",
- "typeSimple": "string",
- "isRequired": false,
- "minLength": null,
- "maxLength": null,
- "minimum": null,
- "maximum": null,
- "regex": null
- },
- {
- "name": "Appointments",
- "jsonName": null,
- "type": "[HospitalManagementSystem.Appointments.Appointment]",
- "typeSimple": "[HospitalManagementSystem.Appointments.Appointment]",
- "isRequired": false,
- "minLength": null,
- "maxLength": null,
- "minimum": null,
- "maximum": null,
- "regex": null
- }
- ]
- },
"HospitalManagementSystem.Doctors.Dto.DoctorDto": {
"baseType": "Volo.Abp.Domain.Entities.Auditing.FullAuditedEntity",
"isEnum": false,
@@ -5952,6 +5657,18 @@
"enumValues": null,
"genericArguments": null,
"properties": [
+ {
+ "name": "Id",
+ "jsonName": null,
+ "type": "System.Guid",
+ "typeSimple": "string",
+ "isRequired": false,
+ "minLength": null,
+ "maxLength": null,
+ "minimum": null,
+ "maximum": null,
+ "regex": null
+ },
{
"name": "DepartmentNo",
"jsonName": null,
@@ -6011,6 +5728,18 @@
"minimum": null,
"maximum": null,
"regex": null
+ },
+ {
+ "name": "Status",
+ "jsonName": null,
+ "type": "System.String",
+ "typeSimple": "string",
+ "isRequired": false,
+ "minLength": null,
+ "maxLength": null,
+ "minimum": null,
+ "maximum": null,
+ "regex": null
}
]
},
diff --git a/angular/src/app/route.provider.ts b/angular/src/app/route.provider.ts
index e8b1509..0bcfff3 100644
--- a/angular/src/app/route.provider.ts
+++ b/angular/src/app/route.provider.ts
@@ -61,6 +61,22 @@ function configureRoutes(routesService: RoutesService) {
// order: 203,
// requiredPolicy:'HospitalManagementSystem.Patient'
// },
+ {
+ path: '',
+ name: 'Departments',
+ order: 301,
+ iconClass: 'fa fa-building-o',
+ layout: eLayoutType.application,
+ },
+ {
+ path: '/departments',
+ name: 'All Departments',
+ parentName: 'Departments',
+ iconClass: 'fas fa-clock',
+ order: 302,
+ requiredPolicy:'HospitalManagementSystem.Department'
+ },
+
]);
};
}
diff --git a/aspnet-core/src/HospitalManagementSystem.Application.Contracts/Permissions/HospitalManagementSystemPermissionDefinitionProvider.cs b/aspnet-core/src/HospitalManagementSystem.Application.Contracts/Permissions/HospitalManagementSystemPermissionDefinitionProvider.cs
index e8d17f2..e6adb0f 100644
--- a/aspnet-core/src/HospitalManagementSystem.Application.Contracts/Permissions/HospitalManagementSystemPermissionDefinitionProvider.cs
+++ b/aspnet-core/src/HospitalManagementSystem.Application.Contracts/Permissions/HospitalManagementSystemPermissionDefinitionProvider.cs
@@ -9,11 +9,23 @@ public class HospitalManagementSystemPermissionDefinitionProvider : PermissionDe
public override void Define(IPermissionDefinitionContext context)
{
var HostipalManagementGroup = context.AddGroup(HospitalManagementSystemPermissions.GroupName);
-
+ //patient
var PatientPermission = HostipalManagementGroup.AddPermission(HospitalManagementSystemPermissions.Patient.Default);
PatientPermission.AddChild(HospitalManagementSystemPermissions.Patient.Create);
PatientPermission.AddChild(HospitalManagementSystemPermissions.Patient.Edit);
PatientPermission.AddChild(HospitalManagementSystemPermissions.Patient.Delete);
+ //Department
+
+ var DepartmentPermission = HostipalManagementGroup.AddPermission(HospitalManagementSystemPermissions.Department.Default);
+ DepartmentPermission.AddChild(HospitalManagementSystemPermissions.Department.Create);
+ DepartmentPermission.AddChild(HospitalManagementSystemPermissions.Department.Edit);
+ DepartmentPermission.AddChild(HospitalManagementSystemPermissions.Department.Delete);
+
+
+
+
+
+
//Define your own permissions here. Example:
//myGroup.AddPermission(HospitalManagementSystemPermissions.MyPermission1, L("Permission:MyPermission1"));
}
diff --git a/aspnet-core/src/HospitalManagementSystem.Application.Contracts/Permissions/HospitalManagementSystemPermissions.cs b/aspnet-core/src/HospitalManagementSystem.Application.Contracts/Permissions/HospitalManagementSystemPermissions.cs
index ce83cf0..3fe0162 100644
--- a/aspnet-core/src/HospitalManagementSystem.Application.Contracts/Permissions/HospitalManagementSystemPermissions.cs
+++ b/aspnet-core/src/HospitalManagementSystem.Application.Contracts/Permissions/HospitalManagementSystemPermissions.cs
@@ -13,4 +13,11 @@ public static class HospitalManagementSystemPermissions
public const string Edit = Default + ".Edit";
public const string Delete = Default + ".Delete";
}
+ public static class Department
+ {
+ public const string Default = GroupName + ".Department";
+ public const string Create = Default + ".Create";
+ public const string Edit = Default + ".Edit";
+ public const string Delete = Default + ".Delete";
+ }
}
diff --git a/aspnet-core/src/HospitalManagementSystem.Application/Departments/DepartmentAppService.cs b/aspnet-core/src/HospitalManagementSystem.Application/Departments/DepartmentAppService.cs
index bcf9f06..609585d 100644
--- a/aspnet-core/src/HospitalManagementSystem.Application/Departments/DepartmentAppService.cs
+++ b/aspnet-core/src/HospitalManagementSystem.Application/Departments/DepartmentAppService.cs
@@ -1,31 +1,189 @@
-using HospitalManagementSystem.Dtos;
+using Abp.Application.Services.Dto;
+using HospitalManagementSystem.Appoinments.Dto;
+using HospitalManagementSystem.Appointments;
+using HospitalManagementSystem.Dto;
+using HospitalManagementSystem.Dtos;
+using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories;
+using System.IO;
+using System.Linq;
+using System.Linq.Dynamic.Core;
+using Abp.UI;
+using ClosedXML.Excel;
+using Microsoft.AspNetCore.Hosting;
+using HospitalManagementSystem.Permissions;
+using Microsoft.AspNetCore.Authorization;
namespace HospitalManagementSystem.Departments
{
- public class DepartmentAppService : ApplicationService, IDepartmentAppService
+ public class DepartmentAppService : ApplicationService
{
private readonly IRepository _departmentRepository;
- public DepartmentAppService(IRepository departmentRepository)
+ private readonly IWebHostEnvironment _env;
+
+ public DepartmentAppService(IRepository departmentRepository, IWebHostEnvironment env)
{
_departmentRepository = departmentRepository;
+ _env = env;
}
- public async Task> GetAsync()
- {
- var departmentDtos = new List();
- var data = await _departmentRepository.GetListAsync();
- departmentDtos = ObjectMapper.Map, List>(data);
- return departmentDtos;
- }
+ //public async Task> GetAsync()
+ //{
+ // var departmentDtos = new List();
+ // var data = await _departmentRepository.GetListAsync();
+ // departmentDtos = ObjectMapper.Map, List>(data);
+ // return departmentDtos;
+ //}
- public async Task CreateAsync(CreateDepartmentDto input)
+
+ #region Get Department List with Paging and Searching
+ [Authorize(HospitalManagementSystemPermissions.Department.Default)]
+
+ public async Task> GetDepartmentListAsync(PagingSortResultDto input)
{
- var department = new Department(Guid.NewGuid(), input.DepartmentNo, input.DepartmentName, input.DepartmentDate, input.DepartmentHead, "Active", input.Description);
- await _departmentRepository.InsertAsync(department);
+ var queryable = await _departmentRepository.GetQueryableAsync();
+
+ var filteredQuery = queryable
+ .WhereIf(!string.IsNullOrEmpty(input.Search), x => x.DepartmentName.ToLower().Contains(input.Search.ToLower()) || x.DepartmentHead.ToLower().Contains(input.Search.ToLower()));
+
+ var totalCount = await filteredQuery.CountAsync();
+
+ filteredQuery = !string.IsNullOrEmpty(input.Sorting)
+ ? filteredQuery.OrderBy(input.Sorting)
+ : filteredQuery.OrderBy(x => x.Id);
+
+ var pagedQuery = await filteredQuery
+ .Skip(input.SkipCount)
+ .Take(input.MaxResultCount)
+ .ToListAsync();
+ var appoinmentdto = ObjectMapper.Map, List>(pagedQuery);
+
+ return new PagedResultDto(
+ totalCount,
+ appoinmentdto
+ );
+
+ }
+ #endregion
+
+ #region Get Department by ID
+ [Authorize(HospitalManagementSystemPermissions.Department.Default)]
+
+ public async Task GetDepartmentByIdAsync(Guid id)
+ {
+ var department = await _departmentRepository.FirstOrDefaultAsync(x => x.Id == id);
+
+ if (department == null)
+ {
+ throw new UserFriendlyException("Department Details not found");
+ }
+
return ObjectMapper.Map(department);
}
+
+ #endregion
+ #region Export Department Data to Excel
+ [Authorize(HospitalManagementSystemPermissions.Department.Default)]
+
+ public async Task GetExportDepartmentRecordAsync()
+ {
+ var DepartmentRecord = await _departmentRepository.ToListAsync();
+
+ var folderPath = Path.Combine(_env.WebRootPath, "temp");
+ if (!Directory.Exists(folderPath))
+ {
+ Directory.CreateDirectory(folderPath);
+ }
+
+ var filename = "Departments_" + DateTime.Now.ToString("yyyyMMdd_HHmmss") + ".xlsx";
+ var filePath = Path.Combine(folderPath, filename);
+
+ // Create a workbook and worksheet
+ using (var workbook = new XLWorkbook())
+ {
+ var worksheet = workbook.Worksheets.Add("Department");
+
+ // Add headers
+ worksheet.Cell(1, 1).Value = "Department Number";
+ worksheet.Cell(1, 2).Value = "Department Name";
+ worksheet.Cell(1, 3).Value = "Description";
+ worksheet.Cell(1, 4).Value = "Date";
+ worksheet.Cell(1, 5).Value = "Department Head";
+ worksheet.Cell(1, 6).Value = "Status";
+
+ for (int i = 0; i < DepartmentRecord.Count; i++)
+ {
+ worksheet.Cell(i + 2, 1).Value = DepartmentRecord[i].DepartmentNo;
+ worksheet.Cell(i + 2, 2).Value = DepartmentRecord[i].DepartmentName;
+ worksheet.Cell(i + 2, 3).Value = DepartmentRecord[i].Description;
+ worksheet.Cell(i + 2, 4).Value = DepartmentRecord[i].DepartmentDate?.ToShortDateString();
+ worksheet.Cell(i + 2, 5).Value = DepartmentRecord[i].DepartmentHead;
+ worksheet.Cell(i + 2, 6).Value = DepartmentRecord[i].Status;
+
+ }
+
+ worksheet.Columns().AdjustToContents();
+ workbook.SaveAs(filePath);
+ }
+
+ byte[] fileBytes = await File.ReadAllBytesAsync(filePath);
+ File.Delete(filePath);
+
+ return new FileDownloadDto
+ {
+ FileName = filename,
+ FileContent = Convert.ToBase64String(fileBytes) // Use Base64 encoding for file content
+ };
+ }
+
+ #endregion
+
+ //public async Task CreateAsync(CreateDepartmentDto input)
+ //{
+ // var department = new Department(Guid.NewGuid(), input.DepartmentNo, input.DepartmentName, input.DepartmentDate, input.DepartmentHead, "Active", input.Description);
+ // await _departmentRepository.InsertAsync(department);
+ // return ObjectMapper.Map(department);
+ //}
+
+
+ #region Create Department
+ [Authorize(HospitalManagementSystemPermissions.Department.Create)]
+
+ public async Task CreateDepartmentAsync(CreateDepartmentDto input)
+ {
+
+
+ var newdata = ObjectMapper.Map(input);
+ await _departmentRepository.InsertAsync(newdata);
+
+ }
+ #endregion
+
+ #region Update Department
+ [Authorize(HospitalManagementSystemPermissions.Department.Edit)]
+
+ public async Task UpdateDepartmentAsync(CreateDepartmentDto input)
+ {
+ try
+ {
+ var newdata = ObjectMapper.Map(input);
+
+ await _departmentRepository.UpdateAsync(newdata);
+ }
+ catch (Exception ex)
+ {
+ throw new Exception(ex.Message);
+ }
+ }
+ #endregion
+ #region Delete Department
+ [Authorize(HospitalManagementSystemPermissions.Department.Delete)]
+ public async Task DeleteDepartmentRecordAsync(Guid id)
+ {
+ await _departmentRepository.DeleteAsync(id);
+ }
+ #endregion
}
}
diff --git a/aspnet-core/src/HospitalManagementSystem.Application/Dtos/CreateDepartmentDto.cs b/aspnet-core/src/HospitalManagementSystem.Application/Dtos/CreateDepartmentDto.cs
index 892a404..1a35d8f 100644
--- a/aspnet-core/src/HospitalManagementSystem.Application/Dtos/CreateDepartmentDto.cs
+++ b/aspnet-core/src/HospitalManagementSystem.Application/Dtos/CreateDepartmentDto.cs
@@ -8,10 +8,14 @@ namespace HospitalManagementSystem.Dtos
{
public class CreateDepartmentDto
{
+ public Guid Id { get; set; }
+
public string? DepartmentNo { get; set; }
public string? DepartmentName { get; set; }
public DateTime? DepartmentDate { get; set; }
public string? DepartmentHead { get; set; }
public string? Description { get; set; }
+ public string? Status { get; set; }
+
}
}
diff --git a/aspnet-core/src/HospitalManagementSystem.Application/MainAppAutoMapperProfile.cs b/aspnet-core/src/HospitalManagementSystem.Application/MainAppAutoMapperProfile.cs
index a9e5600..0bfdff6 100644
--- a/aspnet-core/src/HospitalManagementSystem.Application/MainAppAutoMapperProfile.cs
+++ b/aspnet-core/src/HospitalManagementSystem.Application/MainAppAutoMapperProfile.cs
@@ -43,6 +43,8 @@ namespace HospitalManagementSystem
#region Department
CreateMap();
+ CreateMap();
+ CreateMap();
#endregion
#region Doctor