dto modified changes

This commit is contained in:
Sandipan Mitra 2025-02-07 17:37:35 +05:30
parent 49799abf29
commit aec173f9f4
14 changed files with 5354 additions and 13 deletions

View File

@ -239,7 +239,8 @@
</div> </div>
<!-- Buttons --> <!-- Buttons -->
<div class="p-dialog-footer flex justify-content-end"> <div class="p-dialog-footer flex justify-content-end">
<button type="submit" pButton class="btn btn-primary" [disabled]="patientrecord.invalid"> <button type="submit" pButton class="btn btn-primary"
[disabled]="patientrecord.invalid || selectedstatus === 0">
<i class="pi pi-check"></i> Save <i class="pi pi-check"></i> Save
</button> </button>
<button pButton class="btn btn-secondary ml-2" (click)="closeDialog()"> <button pButton class="btn btn-secondary ml-2" (click)="closeDialog()">

View File

@ -53,7 +53,6 @@ export class PatientRecordComponent implements OnInit {
uploadProgress1 = 0; uploadProgress1 = 0;
uploadProgress2 = 0; uploadProgress2 = 0;
uploadProgress3 = 0; uploadProgress3 = 0;
doctors = [];
doctorOptions = []; doctorOptions = [];
doctorname = ''; doctorname = '';
@ -141,8 +140,8 @@ export class PatientRecordComponent implements OnInit {
getdoctorlist() { getdoctorlist() {
this.DoctorService.get().subscribe(result => { this.DoctorService.get().subscribe(result => {
this.doctors = result; const doctors = result;
this.doctorOptions = this.doctors.map(doctor => ({ this.doctorOptions = doctors.map(doctor => ({
label: `Dr. ${doctor.firstName} ${doctor.lastName}`, // Combine first and last name label: `Dr. ${doctor.firstName} ${doctor.lastName}`, // Combine first and last name
value: doctor.id, // Use the ID as the value value: doctor.id, // Use the ID as the value
})); }));
@ -154,7 +153,7 @@ export class PatientRecordComponent implements OnInit {
} }
exportPatient() { exportPatient() {
this.patientService.getExportPatientRecord().subscribe(result => { this.patientService.getExportPatientRecord(this.patientId).subscribe(result => {
const binary = atob(result.fileContent); const binary = atob(result.fileContent);
const len = binary.length; const len = binary.length;
const bytes = new Uint8Array(len); const bytes = new Uint8Array(len);
@ -191,11 +190,13 @@ export class PatientRecordComponent implements OnInit {
this.patientDialogTitle = 'Edit Patient'; this.patientDialogTitle = 'Edit Patient';
this.patientService.getPatientRecordById(Patient.id).subscribe(result => { this.patientService.getPatientRecordById(Patient.id).subscribe(result => {
this.selectedPatientRecord = result; this.selectedPatientRecord = result;
console.log(result);
this.selectedPatientRecord.patientId = this.patientId; this.selectedPatientRecord.patientId = this.patientId;
this.selectdateOfAdmission = new Date(this.selectedPatientRecord.dateOfAdmission); this.selectdateOfAdmission = new Date(this.selectedPatientRecord.dateOfAdmission);
this.selectnextFollowUp = new Date(this.selectedPatientRecord.nextFollowUp); this.selectnextFollowUp = new Date(this.selectedPatientRecord.nextFollowUp);
this.selectdischargeDate = new Date(this.selectedPatientRecord.dischargeDate); this.selectdischargeDate = new Date(this.selectedPatientRecord.dischargeDate);
this.selectedstatus = this.selectedPatientRecord.status; this.selectedstatus = this.selectedPatientRecord.status;
this.selectedPatientRecord.doctorAssignedID = result.doctorAssigned.id;
this.labReportUrlpath = result.labReportUrl != null ? result.labReportUrl.split('\\')[3] : ''; this.labReportUrlpath = result.labReportUrl != null ? result.labReportUrl.split('\\')[3] : '';
this.medicationUrlpath = this.medicationUrlpath =
result.medicationUrl != null ? result.medicationUrl.split('\\')[3] : ''; result.medicationUrl != null ? result.medicationUrl.split('\\')[3] : '';

View File

@ -0,0 +1 @@
export * from './models';

View File

@ -0,0 +1,15 @@
import type { FullAuditedEntity } from '../../volo/abp/domain/entities/auditing/models';
export interface DoctorDto extends FullAuditedEntity<string> {
id?: string;
firstName?: string;
lastName?: string;
gender?: string;
mobile?: string;
designation?: string;
departmentId?: string;
address?: string;
email?: string;
dob?: string;
education?: string;
}

View File

@ -53,10 +53,10 @@ export class PatientService {
{ apiName: this.apiName,...config }); { apiName: this.apiName,...config });
getExportPatientRecord = (config?: Partial<Rest.Config>) => getExportPatientRecord = (patientId: string, config?: Partial<Rest.Config>) =>
this.restService.request<any, FileDownloadDto>({ this.restService.request<any, FileDownloadDto>({
method: 'GET', method: 'GET',
url: '/api/app/patient/export-patient-record', url: `/api/app/patient/export-patient-record/${patientId}`,
}, },
{ apiName: this.apiName,...config }); { apiName: this.apiName,...config });

View File

@ -0,0 +1 @@
export * from './shared.service';

View File

@ -0,0 +1,34 @@
import { RestService, Rest } from '@abp/ng.core';
import { Injectable } from '@angular/core';
import type { EntityDocument } from '../documents/models';
import type { Patient } from '../patients/models';
@Injectable({
providedIn: 'root',
})
export class SharedService {
apiName = 'Default';
saveFileToDocumentByPatientAndUniqueIdsAndIsNew = (patient: Patient, uniqueIds: string[], isNew?: boolean, config?: Partial<Rest.Config>) =>
this.restService.request<any, EntityDocument[]>({
method: 'POST',
url: '/api/app/shared/save-file-to-document',
params: { isNew },
body: uniqueIds,
},
{ apiName: this.apiName,...config });
uploadFile = (TagName: string, file: FormData, config?: Partial<Rest.Config>) =>
this.restService.request<any, string>({
method: 'POST',
responseType: 'text',
url: '/api/app/shared/upload-file',
params: { tagName: TagName },
body: file,
},
{ apiName: this.apiName,...config });
constructor(private restService: RestService) {}
}

View File

@ -1,5 +1,5 @@
export interface Entity<Tkey> { export interface Entity<TKey> {
} }
export interface AggregateRoot<TKey> extends BasicAggregateRoot<TKey> { export interface AggregateRoot<TKey> extends BasicAggregateRoot<TKey> {

View File

@ -9,6 +9,7 @@ namespace HospitalManagementSystem.Doctors.Dto
{ {
public class DoctorDto : FullAuditedEntity<Guid> public class DoctorDto : FullAuditedEntity<Guid>
{ {
public Guid Id { get; set; }
public string? FirstName { get; set; } public string? FirstName { get; set; }
public string? LastName { get; set; } public string? LastName { get; set; }
public string? Gender { get; set; } public string? Gender { get; set; }

View File

@ -94,6 +94,7 @@ namespace HospitalManagementSystem.Patients
public async Task<PatientRecordDto> GetPatientRecordByIdAsync(Guid id) public async Task<PatientRecordDto> GetPatientRecordByIdAsync(Guid id)
{ {
var patient = await _patientrecordRepository.GetQueryableAsync().Result var patient = await _patientrecordRepository.GetQueryableAsync().Result
.Include(x => x.DoctorAssigned)
.Include(x => x.LabReportUrl) .Include(x => x.LabReportUrl)
.Include(x => x.MedicationUrl) .Include(x => x.MedicationUrl)
.Include(x => x.MedicationHistoryUrl) .Include(x => x.MedicationHistoryUrl)
@ -108,9 +109,16 @@ namespace HospitalManagementSystem.Patients
#endregion #endregion
#region Export Patient Data to Excel #region Export Patient Data to Excel
public async Task<FileDownloadDto> GetExportPatientRecordAsync() public async Task<FileDownloadDto> GetExportPatientRecordAsync(Guid patientId)
{ {
var patientrecord = await _patientrecordRepository.GetQueryableAsync().Result.Include(x => x.Patients).ToListAsync(); var patientrecord = await _patientrecordRepository.GetQueryableAsync().Result
.Include(x => x.Patients)
.Include(x => x.LabReportUrl)
.Include(x => x.MedicationUrl)
.Include(x => x.MedicationHistoryUrl)
.Include(x => x.DoctorAssigned)
.Where(x => x.Patients.Id == patientId)
.ToListAsync();
var folderPath = Path.Combine(_env.WebRootPath, "temp"); var folderPath = Path.Combine(_env.WebRootPath, "temp");
if (!Directory.Exists(folderPath)) if (!Directory.Exists(folderPath))
@ -153,9 +161,9 @@ namespace HospitalManagementSystem.Patients
worksheet.Cell(i + 2, 7).Value = (patient.DoctorAssigned?.FirstName + patient.DoctorAssigned?.LastName) ?? "Not Assigned"; worksheet.Cell(i + 2, 7).Value = (patient.DoctorAssigned?.FirstName + patient.DoctorAssigned?.LastName) ?? "Not Assigned";
worksheet.Cell(i + 2, 8).Value = patient.DoctorNotes; worksheet.Cell(i + 2, 8).Value = patient.DoctorNotes;
worksheet.Cell(i + 2, 9).Value = patient.NextFollowUp?.ToShortDateString() ?? "N/A"; worksheet.Cell(i + 2, 9).Value = patient.NextFollowUp?.ToShortDateString() ?? "N/A";
worksheet.Cell(i + 2, 10).Value = patient.LabReportUrl?.FilePath ?? "No Report"; worksheet.Cell(i + 2, 10).Value = patient.LabReportUrl?.GeneratedFileName ?? "No Report";
worksheet.Cell(i + 2, 11).Value = patient.MedicationUrl?.FilePath ?? "No Medication"; worksheet.Cell(i + 2, 11).Value = patient.MedicationUrl?.GeneratedFileName ?? "No Medication";
worksheet.Cell(i + 2, 12).Value = patient.MedicationHistoryUrl?.FilePath ?? "No History"; worksheet.Cell(i + 2, 12).Value = patient.MedicationHistoryUrl?.GeneratedFileName ?? "No History";
worksheet.Cell(i + 2, 13).Value = patient.Status.ToString(); worksheet.Cell(i + 2, 13).Value = patient.Status.ToString();
} }
worksheet.Columns().AdjustToContents(); worksheet.Columns().AdjustToContents();

View File

@ -0,0 +1,122 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace HospitalManagementSystem.Migrations
{
/// <inheritdoc />
public partial class fieldchanges_patient_patientrecord : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "InsuranceProvider",
table: "PatientRecords");
migrationBuilder.DropColumn(
name: "AdmissionDate",
table: "Patient");
migrationBuilder.DropColumn(
name: "DischargeDate",
table: "Patient");
migrationBuilder.DropColumn(
name: "Status",
table: "Patient");
migrationBuilder.RenameColumn(
name: "Treatment",
table: "Patient",
newName: "PatientCardId");
migrationBuilder.RenameColumn(
name: "DoctorAssigned",
table: "Patient",
newName: "InsuranceProvider");
migrationBuilder.AddColumn<DateTime>(
name: "DischargeDate",
table: "PatientRecords",
type: "datetime2",
nullable: true);
migrationBuilder.AddColumn<Guid>(
name: "DoctorAssignedId",
table: "PatientRecords",
type: "uniqueidentifier",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_PatientRecords_DoctorAssignedId",
table: "PatientRecords",
column: "DoctorAssignedId");
migrationBuilder.AddForeignKey(
name: "FK_PatientRecords_Doctors_DoctorAssignedId",
table: "PatientRecords",
column: "DoctorAssignedId",
principalTable: "Doctors",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_PatientRecords_Doctors_DoctorAssignedId",
table: "PatientRecords");
migrationBuilder.DropIndex(
name: "IX_PatientRecords_DoctorAssignedId",
table: "PatientRecords");
migrationBuilder.DropColumn(
name: "DischargeDate",
table: "PatientRecords");
migrationBuilder.DropColumn(
name: "DoctorAssignedId",
table: "PatientRecords");
migrationBuilder.RenameColumn(
name: "PatientCardId",
table: "Patient",
newName: "Treatment");
migrationBuilder.RenameColumn(
name: "InsuranceProvider",
table: "Patient",
newName: "DoctorAssigned");
migrationBuilder.AddColumn<string>(
name: "InsuranceProvider",
table: "PatientRecords",
type: "nvarchar(max)",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<DateTime>(
name: "AdmissionDate",
table: "Patient",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<DateTime>(
name: "DischargeDate",
table: "Patient",
type: "datetime2",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "Status",
table: "Patient",
type: "int",
nullable: false,
defaultValue: 0);
}
}
}

View File

@ -0,0 +1,72 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace HospitalManagementSystem.Migrations
{
/// <inheritdoc />
public partial class nullablechanges_patientrecord : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "TreatmentPlan",
table: "PatientRecords",
type: "nvarchar(max)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(max)");
migrationBuilder.AlterColumn<string>(
name: "DoctorNotes",
table: "PatientRecords",
type: "nvarchar(max)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(max)");
migrationBuilder.AlterColumn<string>(
name: "Diagnosis",
table: "PatientRecords",
type: "nvarchar(max)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(max)");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "TreatmentPlan",
table: "PatientRecords",
type: "nvarchar(max)",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "DoctorNotes",
table: "PatientRecords",
type: "nvarchar(max)",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Diagnosis",
table: "PatientRecords",
type: "nvarchar(max)",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
}
}
}