improvement: treatment preview and treatment history components overhauled. draft & completed status for treatment plan completely removed from the flow.

This commit is contained in:
2026-06-28 21:45:33 +03:30
parent 94b97aa0fa
commit feb0b26ad0
20 changed files with 571 additions and 608 deletions

View File

@@ -4,7 +4,7 @@ import {
Injectable,
NotFoundException,
} from '@nestjs/common';
import { LinkStatus, TreatmentStatus } from '@prisma/client';
import { LinkStatus } from '@prisma/client';
import { createReadStream, existsSync, mkdirSync } from 'fs';
import { join } from 'path';
import { randomUUID } from 'crypto';
@@ -17,7 +17,6 @@ import {
} from './dto/treatment.dto';
import {
generateTreatmentTitle,
mapTreatmentStatusForApi,
normalizeTeeth,
} from './treatment.utils';
@@ -117,7 +116,7 @@ export class TreatmentsService {
where: {
patientId,
organizationId,
status: TreatmentStatus.COMPLETED,
details: { some: {} },
},
include: treatmentInclude,
orderBy: [{ treatmentAt: 'desc' }],
@@ -144,7 +143,6 @@ export class TreatmentsService {
where: {
appointmentId: appointment.id,
organizationId,
status: TreatmentStatus.DRAFT,
},
include: treatmentInclude,
});
@@ -196,7 +194,6 @@ export class TreatmentsService {
treatmentAt: appointment.startAt,
patientId: appointment.patientId,
providerUserId: appointment.providerUserId,
status: TreatmentStatus.DRAFT,
},
})
: await tx.treatment.create({
@@ -206,7 +203,6 @@ export class TreatmentsService {
appointmentId: appointment.id,
providerUserId: appointment.providerUserId,
title,
status: TreatmentStatus.DRAFT,
treatmentAt: appointment.startAt,
},
});
@@ -314,7 +310,7 @@ export class TreatmentsService {
);
const treatment = await this.prisma.treatment.findFirst({
where: { appointmentId: appointment.id, organizationId, status: TreatmentStatus.DRAFT },
where: { appointmentId: appointment.id, organizationId },
select: { id: true },
});
@@ -605,7 +601,6 @@ export class TreatmentsService {
patientId: string;
appointmentId: string | null;
title: string;
status: TreatmentStatus;
treatmentAt: Date;
details: Array<{
id: string;
@@ -660,7 +655,6 @@ export class TreatmentsService {
appointmentId: treatment.appointmentId,
title: treatment.title,
treatmentAt: treatment.treatmentAt.toISOString(),
status: mapTreatmentStatusForApi(treatment.status),
details: treatment.details.map((d) => this.mapDetail(d)),
labCases: treatment.labCases.map((lc) => this.mapLabCase(lc)),
documents,