Merge branch 'AppointmentModule_Modified' of https://git.sentientgeeks.us/ranjit/Hospital_Management into AppointmentModule_Modified

This commit is contained in:
Sk Shaifat Murshed 2025-02-04 16:13:48 +05:30
commit 54278bb753
14 changed files with 148 additions and 254 deletions

View File

@ -0,0 +1,26 @@
using HospitalManagementSystem.GlobalEnum;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HospitalManagementSystem.Appoinments.Dto
{
public class AppointmentDto
{
public Guid Id { get; set; }
public string? FirstName { get; set; }
public string? LastName { get; set; }
public Gender Gender { get; set; }
public string? Mobile { get; set; }
public string? Address { get; set; }
public string? Email { get; set; }
public string? DOB { get; set; }
public Guid? DoctorId { get; set; }
public DateTime? DateOfAppointment { get; set; }
public string? TimeOfAppointment { get; set; }
public string? InjuryORContion { get; set; }
public string? Note { get; set; }
}
}

View File

@ -0,0 +1,28 @@
using HospitalManagementSystem.GlobalEnum;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
namespace HospitalManagementSystem.Appoinments.Dto
{
public class CreateOrUpdateAppointmentDto
{
public Guid Id { get; set; }
public string? FirstName { get; set; }
public string? LastName { get; set; }
public Gender Gender { get; set; }
public string? Mobile { get; set; }
public string? Address { get; set; }
public string? Email { get; set; }
public string? DOB { get; set; }
public Guid? DoctorId { get; set; }
public DateTime? DateOfAppointment { get; set; }
public string? TimeOfAppointment { get; set; }
public string? InjuryORContion { get; set; }
public string? Note { get; set; }
}
}

View File

@ -1,4 +1,5 @@
using System;
using Volo.Abp.Domain.Repositories;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -6,17 +7,30 @@ using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.MultiTenancy;
using Volo.Abp.Users;
using HospitalManagementSystem.Documents;
using HospitalManagementSystem.Patients.Dto;
using HospitalManagementSystem.Patients;
using HospitalManagementSystem.Permissions;
using Microsoft.AspNetCore.Authorization;
using HospitalManagementSystem.Appoinments.Dto;
using Volo.Abp.ObjectMapping;
using HospitalManagementSystem.Dto;
using Abp.Application.Services.Dto;
using Microsoft.EntityFrameworkCore;
using System.Linq.Dynamic.Core;
namespace HospitalManagementSystem.Appointments
{
public class AppointmentAppService : HospitalManagementSystemAppService, IAppointmentAppService, ITransientDependency
public class AppointmentAppService : ApplicationService, IAppointmentAppService, ITransientDependency
{
private readonly ICurrentUser _currentUser;
private readonly ICurrentTenant _currentTenant;
public AppointmentAppService(ICurrentUser currentUser, ICurrentTenant currentTenant)
private IRepository<Appointment, Guid> _appointmentsRepository;
public AppointmentAppService(ICurrentUser currentUser, ICurrentTenant currentTenant, IRepository<Appointment, Guid> appointmentsRepository)
{
_currentUser = currentUser;
_currentTenant = currentTenant;
_appointmentsRepository = appointmentsRepository;
}
public async Task<string> GetAsync()
{
@ -24,5 +38,53 @@ namespace HospitalManagementSystem.Appointments
var y = _currentTenant.Id;
return _currentUser.Name + " checking done.";
}
#region Get Patient List with Paging and Searching
public async Task<PagedResultDto<AppointmentDto>> GetAppointmentListAsync(PagingSortResultDto input, Guid Id)
{
var queryable = await _appointmentsRepository.GetQueryableAsync();
var filteredQuery = queryable
.WhereIf(!string.IsNullOrEmpty(input.Search), x => x.FirstName.ToLower().Contains(input.Search.ToLower()) || x.LastName.ToLower().Contains(input.Search.ToLower()))
.Where(x => x.Id == Id);
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<Appointment>, List<AppointmentDto>>(pagedQuery);
return new PagedResultDto<AppointmentDto>(
totalCount,
appoinmentdto
);
}
#endregion
#region Create Appointment
public async Task<AppointmentDto> CreateAppointmentAsync(CreateOrUpdateAppointmentDto input)
{
var appointment = ObjectMapper.Map<CreateOrUpdateAppointmentDto, Appointment>(input);
appointment = await _appointmentsRepository.InsertAsync(appointment);
return ObjectMapper.Map<Appointment, AppointmentDto>(appointment);
}
#endregion
#region Update Appointment
public async Task<PatientRecordDto> UpdateAppointmentAsync(Guid id, CreateOrUpdateAppointmentDto input)
{
var appointment = await _appointmentsRepository.GetAsync(id);
var newdata = ObjectMapper.Map<CreateOrUpdateAppointmentDto, Appointment>(input);
appointment = newdata;
appointment = await _appointmentsRepository.UpdateAsync(appointment);
return ObjectMapper.Map<Appointment, PatientRecordDto>(appointment);
}
#endregion
}
}

View File

@ -6,7 +6,7 @@ using Volo.Abp.Domain.Repositories;
namespace HospitalManagementSystem.Departments
{
public class DepartmentAppService : HospitalManagementSystemAppService, IDepartmentAppService
public class DepartmentAppService : ApplicationService, IDepartmentAppService
{
private readonly IRepository<Department, Guid> _departmentRepository;
public DepartmentAppService(IRepository<Department, Guid> departmentRepository)

View File

@ -7,7 +7,7 @@ using Volo.Abp.Domain.Repositories;
namespace HospitalManagementSystem.Doctors
{
public class DoctorAppService : HospitalManagementSystemAppService, IDoctorAppService
public class DoctorAppService : ApplicationService, IDoctorAppService
{
private readonly IRepository<Doctor, Guid> _doctorRepository;
public DoctorAppService(IRepository<Doctor, Guid> doctorRepository)

View File

@ -8,9 +8,9 @@ namespace HospitalManagementSystem;
/* Inherit your application services from this class.
*/
public abstract class HospitalManagementSystemAppService : ApplicationService
public abstract class ApplicationService : Volo.Abp.Application.Services.ApplicationService
{
protected HospitalManagementSystemAppService()
protected ApplicationService()
{
LocalizationResource = typeof(HospitalManagementSystemResource);
}

View File

@ -1,4 +1,6 @@
using AutoMapper;
using HospitalManagementSystem.Appoinments.Dto;
using HospitalManagementSystem.Appointments;
using HospitalManagementSystem.Patients;
using HospitalManagementSystem.Patients.Dto;
using System;
@ -9,10 +11,11 @@ using System.Threading.Tasks;
namespace HospitalManagementSystem
{
public class PatientAutoMapperProfile : Profile
public class MainAppAutoMapperProfile : Profile
{
public PatientAutoMapperProfile()
public MainAppAutoMapperProfile()
{
#region Patient
// Entity to DTO mappings
CreateMap<PatientRecord, PatientRecordDto>();
CreateMap<PatientRecord, CreateUpdatePatientRecordDto>();
@ -26,6 +29,13 @@ namespace HospitalManagementSystem
// DTO to Entity mappings
CreateMap<CreateUpdatePatientDto, Patient>();
#endregion
#region Appointment
CreateMap<Appointment, AppointmentDto>();
CreateMap<Appointment, CreateOrUpdateAppointmentDto>();
CreateMap<CreateOrUpdateAppointmentDto, Appointment>();
#endregion
}
}
}

View File

@ -23,7 +23,7 @@ using static HospitalManagementSystem.Permissions.HospitalManagementSystemPermis
namespace HospitalManagementSystem.Patients
{
public class PatientAppService : ApplicationService
public class PatientAppService : Volo.Abp.Application.Services.ApplicationService
{
private IRepository<PatientRecord, Guid> _patientrecordRepository;
private IRepository<Patient, Guid> _patientRepository;
@ -45,7 +45,7 @@ namespace HospitalManagementSystem.Patients
#region Get Patient List with Paging and Searching
[Authorize(HospitalManagementSystemPermissions.Patient.Default)]
public async Task<PagedResultDto<PatientRecordDto>> GetPatientRecordListAsync(PagingSortPatientResultDto input, Guid Id)
public async Task<PagedResultDto<PatientRecordDto>> GetPatientRecordListAsync(PagingSortResultDto input, Guid Id)
{
var queryable = await _patientrecordRepository.GetQueryableAsync();
@ -263,7 +263,7 @@ namespace HospitalManagementSystem.Patients
#region Get Patient List with Paging and Searching
[Authorize(HospitalManagementSystemPermissions.Patient.Default)]
public async Task<PagedResultDto<PatientDto>> GetPatientListAsync(PagingSortPatientResultDto input)
public async Task<PagedResultDto<PatientDto>> GetPatientListAsync(PagingSortResultDto input)
{
List<Patient> query;

View File

@ -1,6 +1,6 @@
{
"ConnectionStrings": {
"Default": "Server=DESKTOP-JMNM6B1\\MSSQLSERVER19;Database=HospitalManagementSystemTestDb;Trusted_Connection=True;TrustServerCertificate=True"
"Default": "Server=DESKTOP-UO4Q385\\SQLEXPRESS;Database=HospitalManagementSystemTestDb;Trusted_Connection=True;TrustServerCertificate=True"
},
"OpenIddict": {
"Applications": {

View File

@ -7,7 +7,7 @@ using Volo.Abp.Application.Dtos;
namespace HospitalManagementSystem.Dto
{
public class PagingSortPatientResultDto : PagedAndSortedResultRequestDto
public class PagingSortResultDto : PagedAndSortedResultRequestDto
{
public string? Search { get; set; }
}

View File

@ -9,7 +9,7 @@ namespace HospitalManagementSystem.GlobalEnum
public enum Gender
{
Male = 1,
Female = 2
Female = 2,
}
public enum Status

View File

@ -1,5 +1,5 @@
using HospitalManagementSystem.Doctors;
using HospitalManagementSystem.Enums;
using HospitalManagementSystem.GlobalEnum;
using System;
using System.ComponentModel.DataAnnotations.Schema;
using Volo.Abp.Domain.Entities.Auditing;
@ -10,7 +10,7 @@ namespace HospitalManagementSystem.Appointments
{
public string? FirstName { get; set; }
public string? LastName { get; set; }
public GenderEnum? Gender { get; set; }
public Gender Gender { get; set; }
public string? Mobile { get; set; }
public string? Address { get; set; }
public string? Email { get; set; }

View File

@ -24,218 +24,7 @@ namespace HospitalManagementSystem.Migrations
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("HospitalManagementSystem.Appointments.Appointment", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<string>("Address")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<string>("DOB")
.HasColumnType("nvarchar(max)");
b.Property<DateTime?>("DateOfAppointment")
.HasColumnType("datetime2");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<Guid?>("DoctorId")
.HasColumnType("uniqueidentifier");
b.Property<string>("Email")
.HasColumnType("nvarchar(max)");
b.Property<string>("FirstName")
.HasColumnType("nvarchar(max)");
b.Property<int?>("Gender")
.HasColumnType("int");
b.Property<string>("InjuryORContion")
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<string>("LastName")
.HasColumnType("nvarchar(max)");
b.Property<string>("Mobile")
.HasColumnType("nvarchar(max)");
b.Property<string>("Note")
.HasColumnType("nvarchar(max)");
b.Property<string>("TimeOfAppointment")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("DoctorId");
b.ToTable("Appointments");
});
modelBuilder.Entity("HospitalManagementSystem.Departments.Department", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<DateTime?>("DepartmentDate")
.HasColumnType("datetime2");
b.Property<string>("DepartmentHead")
.HasColumnType("nvarchar(max)");
b.Property<string>("DepartmentName")
.HasColumnType("nvarchar(max)");
b.Property<string>("DepartmentNo")
.HasColumnType("nvarchar(max)");
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<string>("Status")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Departments");
});
modelBuilder.Entity("HospitalManagementSystem.Doctors.Doctor", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<string>("Address")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<string>("DOB")
.HasColumnType("nvarchar(max)");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<Guid?>("DepartmentId")
.HasColumnType("uniqueidentifier");
b.Property<string>("Designation")
.HasColumnType("nvarchar(max)");
b.Property<string>("Education")
.HasColumnType("nvarchar(max)");
b.Property<string>("Email")
.HasColumnType("nvarchar(max)");
b.Property<string>("FirstName")
.HasColumnType("nvarchar(max)");
b.Property<string>("Gender")
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<string>("LastName")
.HasColumnType("nvarchar(max)");
b.Property<string>("Mobile")
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("DepartmentId");
b.ToTable("Doctors");
});
modelBuilder.Entity("HospitalManagementSystem.Documents.EntityDocument", b =>
modelBuilder.Entity("HospitalManagementSystem.Documents.EntityDocument", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
@ -520,6 +309,7 @@ namespace HospitalManagementSystem.Migrations
b.ToTable("PatientRecords", (string)null);
});
modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b =>
{
b.Property<Guid>("Id")
@ -2260,25 +2050,7 @@ namespace HospitalManagementSystem.Migrations
b.ToTable("AbpTenantConnectionStrings", (string)null);
});
modelBuilder.Entity("HospitalManagementSystem.Appointments.Appointment", b =>
{
b.HasOne("HospitalManagementSystem.Doctors.Doctor", "Doctor")
.WithMany("Appointments")
.HasForeignKey("DoctorId");
b.Navigation("Doctor");
});
modelBuilder.Entity("HospitalManagementSystem.Doctors.Doctor", b =>
{
b.HasOne("HospitalManagementSystem.Departments.Department", "Department")
.WithMany()
.HasForeignKey("DepartmentId");
b.Navigation("Department");
});
modelBuilder.Entity("HospitalManagementSystem.Documents.PatientDocument", b =>
modelBuilder.Entity("HospitalManagementSystem.Documents.PatientDocument", b =>
{
b.HasOne("HospitalManagementSystem.Documents.EntityDocument", "EntityDocuments")
.WithMany()
@ -2334,6 +2106,7 @@ namespace HospitalManagementSystem.Migrations
b.Navigation("Patients");
});
modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b =>
{
b.HasOne("Volo.Abp.AuditLogging.AuditLog", null)
@ -2476,11 +2249,6 @@ namespace HospitalManagementSystem.Migrations
.IsRequired();
});
modelBuilder.Entity("HospitalManagementSystem.Doctors.Doctor", b =>
{
b.Navigation("Appointments");
});
modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b =>
{
b.Navigation("Actions");

View File

@ -6,7 +6,7 @@
"RedirectAllowedUrls": "http://localhost:4200"
},
"ConnectionStrings": {
"Default": "Server=DESKTOP-JMNM6B1\\MSSQLSERVER19;Database=HospitalManagementSystemTestDb;Trusted_Connection=True;TrustServerCertificate=True"
"Default": "Server=DESKTOP-UO4Q385\\SQLEXPRESS;Database=HospitalManagementSystemTestDb;Trusted_Connection=True;TrustServerCertificate=True"
},
"AuthServer": {
"Authority": "https://localhost:44360",