improvement: treatment preview and treatment history components overhauled. draft & completed status for treatment plan completely removed from the flow.
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
import { TreatmentStatus } from '@prisma/client';
|
||||
|
||||
const FDI_TOOTH_IDS = new Set([
|
||||
'11', '12', '13', '14', '15', '16', '17', '18',
|
||||
'21', '22', '23', '24', '25', '26', '27', '28',
|
||||
@@ -39,7 +37,3 @@ export function generateTreatmentTitle(
|
||||
|
||||
return parts.join(' · ');
|
||||
}
|
||||
|
||||
export function mapTreatmentStatusForApi(status: TreatmentStatus): string {
|
||||
return status === TreatmentStatus.DRAFT ? 'draft' : 'completed';
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ export class TreatmentsController {
|
||||
}
|
||||
|
||||
@Get('patients/:patientId/history')
|
||||
@ApiOperation({ summary: 'List completed treatments for a patient (TAB_TREATMENT_READ)' })
|
||||
@ApiOperation({ summary: 'List treatments for a patient (draft and completed, TAB_TREATMENT_READ)' })
|
||||
listPatientHistory(
|
||||
@Param('patientId') patientId: string,
|
||||
@Query('limit', new ParseIntPipe({ optional: true })) limit = 20,
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user