improvement: new prosthesis type data structure implemented and finally working!

This commit is contained in:
2026-09-01 21:03:04 +03:30
parent dc71c73ced
commit a3c14a18c1
51 changed files with 3306 additions and 1117 deletions

View File

@@ -29,7 +29,6 @@ export const TREATMENT_TYPES: readonly TreatmentTypeSeed[] = [
{ code: 'perio', labDependent: false, sortOrder: 9 },
{ code: 'pediatrics', labDependent: false, sortOrder: 10 },
{ code: 'extraction', labDependent: false, sortOrder: 11 },
// Appointment-only: not real treatment plan details.
{
code: 'clinic_visit',
labDependent: false,
@@ -69,140 +68,278 @@ export const LAB_WORKFLOW_STEPS = [
{ code: 'pressing', sortOrder: 14 },
] as const;
export type ProsthesisChartRegion = 'crown' | 'root' | 'arch';
export type ProsthesisStackGroup = 'restoration' | 'implant' | 'post_core' | 'arch';
export type ProsthesisAddonKind = '' | 'implant' | 'post_core';
export type ProsthesisTypeSeed = {
code: string;
sortOrder: number;
skipPackingShipping?: boolean;
isActive?: boolean;
category: string;
subcategory?: string;
chartRegion: ProsthesisChartRegion;
stackGroup: ProsthesisStackGroup;
addonKind?: ProsthesisAddonKind;
/** Manufacturing steps between design and packing (exclusive of universal scan/design/pack/ship). */
manufacturingSteps: readonly string[];
};
const FULL_CONTOUR = ['milling_wet', 'stain', 'glaze', 'polish_prep'] as const;
const LAYERED = ['milling_dry', 'sinter', 'build_up', 'stain', 'glaze', 'polish_prep'] as const;
const DENTURE = ['milling_wet', 'polish_prep'] as const;
const APPLIANCE = ['printer_resin', 'polish_prep'] as const;
const POST_CORE = ['milling_wet', 'polish_prep'] as const;
function crown(
code: string,
sortOrder: number,
manufacturingSteps: readonly string[],
extra?: Partial<ProsthesisTypeSeed>,
): ProsthesisTypeSeed {
return {
code,
sortOrder,
category: 'crown',
chartRegion: 'crown',
stackGroup: 'restoration',
manufacturingSteps,
...extra,
};
}
function implantAddon(
code: string,
sortOrder: number,
manufacturingSteps: readonly string[],
): ProsthesisTypeSeed {
return {
code,
sortOrder,
category: 'implant',
chartRegion: 'root',
stackGroup: 'implant',
addonKind: 'implant',
manufacturingSteps,
};
}
function indirect(
indication: string,
technique: 'full_contour' | 'layered',
sortOrder: number,
): ProsthesisTypeSeed {
return {
code: `${indication}_${technique}`,
sortOrder,
category: 'indirect',
subcategory: indication,
chartRegion: 'crown',
stackGroup: 'restoration',
manufacturingSteps: technique === 'layered' ? LAYERED : FULL_CONTOUR,
};
}
export const PROSTHESIS_TYPES: ProsthesisTypeSeed[] = [
crown('pfm_crown', 1, ['milling_wet', 'build_up', 'stain', 'glaze', 'polish_prep']),
crown('pfz_crown', 2, ['milling_dry', 'sinter', 'build_up', 'stain', 'glaze', 'polish_prep']),
crown('monolithic_zirconia', 3, ['milling_dry', 'sinter', 'stain', 'glaze', 'polish_prep']),
crown('glass_ceramic_crown', 4, FULL_CONTOUR),
crown('full_metal_crown', 5, ['milling_wet', 'polish_prep']),
crown('temporary_resin_crown', 6, ['milling_wet', 'polish_prep']),
crown('pmma', 7, ['milling_dry', 'polish_prep']),
crown('peek_crown', 8, ['milling_dry', 'polish_prep']),
crown('press_ceramic', 9, ['printer_resin', 'pressing', 'stain', 'glaze', 'polish_prep']),
indirect('veneer', 'full_contour', 20),
indirect('veneer', 'layered', 21),
indirect('inlay', 'full_contour', 22),
indirect('inlay', 'layered', 23),
indirect('onlay', 'full_contour', 24),
indirect('onlay', 'layered', 25),
indirect('overlay', 'full_contour', 26),
indirect('overlay', 'layered', 27),
{
code: 'pfm_crown',
sortOrder: 1,
manufacturingSteps: ['milling_wet', 'build_up', 'stain', 'glaze', 'polish_prep'],
code: 'cast_post_core',
sortOrder: 30,
category: 'post_core',
chartRegion: 'root',
stackGroup: 'post_core',
addonKind: 'post_core',
manufacturingSteps: POST_CORE,
},
{
code: 'pfz_crown',
sortOrder: 2,
manufacturingSteps: ['milling_dry', 'sinter', 'build_up', 'stain', 'glaze', 'polish_prep'],
code: 'fiber_post_core',
sortOrder: 31,
category: 'post_core',
chartRegion: 'root',
stackGroup: 'post_core',
addonKind: 'post_core',
manufacturingSteps: POST_CORE,
},
implantAddon('prefabricated_abutment', 40, ['polish_prep']),
implantAddon('ti_base_abutment', 41, ['polish_prep']),
implantAddon('multi_unit_abutment', 42, ['polish_prep']),
implantAddon('customized_abutment', 43, ['milling_wet', 'polish_prep']),
implantAddon('zirconia_abutment', 44, ['milling_dry', 'sinter', 'polish_prep']),
{
code: 'monolithic_zirconia',
sortOrder: 3,
manufacturingSteps: ['milling_dry', 'sinter', 'stain', 'glaze', 'polish_prep'],
},
{
code: 'glass_ceramic_crown',
sortOrder: 4,
manufacturingSteps: ['milling_wet', 'stain', 'glaze', 'polish_prep'],
},
{
code: 'full_metal_crown',
sortOrder: 5,
code: 'screw_retained',
sortOrder: 45,
category: 'implant',
chartRegion: 'crown',
stackGroup: 'restoration',
manufacturingSteps: ['milling_wet', 'polish_prep'],
},
{
code: 'temporary_resin_crown',
sortOrder: 6,
manufacturingSteps: ['milling_wet', 'polish_prep'],
code: 'complete_denture',
sortOrder: 50,
category: 'removable',
chartRegion: 'arch',
stackGroup: 'arch',
manufacturingSteps: DENTURE,
},
{
code: 'pmma',
sortOrder: 7,
manufacturingSteps: ['milling_dry', 'polish_prep'],
code: 'partial_denture',
sortOrder: 51,
category: 'removable',
chartRegion: 'arch',
stackGroup: 'arch',
manufacturingSteps: DENTURE,
},
{
code: 'peek_crown',
sortOrder: 8,
manufacturingSteps: ['milling_dry', 'polish_prep'],
code: 'overdenture',
sortOrder: 52,
category: 'removable',
chartRegion: 'arch',
stackGroup: 'arch',
manufacturingSteps: DENTURE,
},
{
code: 'veneer_zirconia',
sortOrder: 9,
manufacturingSteps: ['milling_dry', 'sinter', 'build_up', 'stain', 'glaze', 'polish_prep'],
code: 'night_guard_soft',
sortOrder: 60,
category: 'appliance',
subcategory: 'night_guard',
chartRegion: 'arch',
stackGroup: 'arch',
manufacturingSteps: APPLIANCE,
},
{
code: 'veneer_ips_press',
sortOrder: 10,
manufacturingSteps: [
'printer_resin',
'build_up',
'stain',
'glaze',
'polish_prep',
'pressing',
],
code: 'night_guard_hard',
sortOrder: 61,
category: 'appliance',
subcategory: 'night_guard',
chartRegion: 'arch',
stackGroup: 'arch',
manufacturingSteps: APPLIANCE,
},
{
code: 'veneer_ips_cad',
sortOrder: 11,
manufacturingSteps: ['milling_wet', 'stain', 'glaze', 'polish_prep'],
code: 'night_guard_dual',
sortOrder: 62,
category: 'appliance',
subcategory: 'night_guard',
chartRegion: 'arch',
stackGroup: 'arch',
manufacturingSteps: APPLIANCE,
},
{
code: 'bleaching_tray',
sortOrder: 63,
category: 'appliance',
chartRegion: 'arch',
stackGroup: 'arch',
manufacturingSteps: APPLIANCE,
},
{
code: 'clear_aligner',
sortOrder: 64,
category: 'appliance',
chartRegion: 'arch',
stackGroup: 'arch',
manufacturingSteps: APPLIANCE,
},
{
code: 'soft_structure',
sortOrder: 12,
sortOrder: 65,
category: 'appliance',
chartRegion: 'arch',
stackGroup: 'arch',
manufacturingSteps: ['milling_dry', 'sinter'],
},
{
code: 'customized_abutment',
sortOrder: 13,
manufacturingSteps: ['milling_wet', 'polish_prep'],
code: 'surgical_guide',
sortOrder: 70,
category: 'digital',
chartRegion: 'arch',
stackGroup: 'arch',
manufacturingSteps: APPLIANCE,
},
{
code: 'prefabricated_abutment',
sortOrder: 14,
manufacturingSteps: ['polish_prep'],
code: 'smile_design',
sortOrder: 71,
category: 'digital',
chartRegion: 'arch',
stackGroup: 'arch',
skipPackingShipping: true,
manufacturingSteps: [],
},
{
code: 'ti_base_abutment',
sortOrder: 15,
manufacturingSteps: ['polish_prep'],
code: 'mockup',
sortOrder: 72,
category: 'digital',
chartRegion: 'arch',
stackGroup: 'arch',
manufacturingSteps: ['printer_resin'],
},
// Legacy leaves — labels for historical cases; hidden from the picker.
{
code: 'veneer_zirconia',
sortOrder: 200,
isActive: false,
category: 'indirect',
subcategory: 'veneer',
chartRegion: 'crown',
stackGroup: 'restoration',
manufacturingSteps: LAYERED,
},
{
code: 'multi_unit_abutment',
sortOrder: 16,
manufacturingSteps: ['polish_prep'],
code: 'veneer_ips_press',
sortOrder: 201,
isActive: false,
category: 'indirect',
subcategory: 'veneer',
chartRegion: 'crown',
stackGroup: 'restoration',
manufacturingSteps: ['printer_resin', 'build_up', 'stain', 'glaze', 'polish_prep', 'pressing'],
},
{
code: 'zirconia_abutment',
sortOrder: 17,
manufacturingSteps: ['milling_dry', 'sinter', 'polish_prep'],
},
{
code: 'screw_retained',
sortOrder: 18,
manufacturingSteps: [
'milling_wet',
'printer_metal',
'sinter',
'build_up',
'stain',
'glaze',
'polish_prep',
],
code: 'veneer_ips_cad',
sortOrder: 202,
isActive: false,
category: 'indirect',
subcategory: 'veneer',
chartRegion: 'crown',
stackGroup: 'restoration',
manufacturingSteps: FULL_CONTOUR,
},
{
code: 'zirconia_overlay',
sortOrder: 19,
sortOrder: 203,
isActive: false,
category: 'indirect',
subcategory: 'overlay',
chartRegion: 'crown',
stackGroup: 'restoration',
manufacturingSteps: ['milling_dry', 'sinter', 'stain', 'glaze', 'polish_prep'],
},
{
code: 'ips_overlay',
sortOrder: 20,
manufacturingSteps: ['milling_wet', 'stain', 'glaze', 'polish_prep'],
},
{
code: 'smile_design',
sortOrder: 21,
skipPackingShipping: true,
manufacturingSteps: ['printer_resin'],
},
{
code: 'mockup',
sortOrder: 22,
manufacturingSteps: ['printer_resin'],
sortOrder: 204,
isActive: false,
category: 'indirect',
subcategory: 'overlay',
chartRegion: 'crown',
stackGroup: 'restoration',
manufacturingSteps: FULL_CONTOUR,
},
];
@@ -217,6 +354,12 @@ export function buildProsthesisStepCodes(type: ProsthesisTypeSeed): string[] {
return steps;
}
export {
unionWorkflowStepCodes,
prosthesisGroupKey,
splitProsthesisGroupKey,
} from '../src/common/prosthesis-group';
const TREATMENT_LABELS: Record<string, Record<string, string>> = {
restoration: { en: 'Restoration', fa: 'ترمیم', nl: 'Restauratie' },
specialized_restoration: { en: 'Specialized Restoration', fa: 'ترمیم تخصصی', nl: 'Gespecialiseerde Restauratie' },
@@ -237,7 +380,7 @@ const TREATMENT_LABELS: Record<string, Record<string, string>> = {
hygiene: { en: 'Hygiene', fa: 'بهداشت', nl: 'Hygiëne' },
};
const PROSTHESIS_LABELS: Record<string, Record<string, string>> = {
export const PROSTHESIS_LABELS: Record<string, Record<string, string>> = {
pfm_crown: { en: 'PFM Crown', fa: 'روکش PFM', nl: 'PFM Kroon' },
pfz_crown: { en: 'PFZ Crown', fa: 'روکش PFZ', nl: 'PFZ Kroon' },
monolithic_zirconia: { en: 'Monolithic Zirconia', fa: 'زیرکونیا مونولیتیک', nl: 'Monolithisch Zirconia' },
@@ -246,23 +389,43 @@ const PROSTHESIS_LABELS: Record<string, Record<string, string>> = {
temporary_resin_crown: { en: 'Temporary Resin Crown', fa: 'روکش موقت رزینی', nl: 'Tijdelijke Harskroon' },
pmma: { en: 'PMMA', fa: 'PMMA', nl: 'PMMA' },
peek_crown: { en: 'PEEK Crown', fa: 'روکش PEEK', nl: 'PEEK Kroon' },
veneer_zirconia: { en: 'Veneer Zirconia', fa: 'ونیر زیرکونیا', nl: 'Veneer Zirconia' },
veneer_ips_press: { en: 'Veneer IPS Press', fa: 'ونیر IPS پرس', nl: 'Veneer IPS Press' },
veneer_ips_cad: { en: 'Veneer IPS CAD', fa: 'ونیر IPS CAD', nl: 'Veneer IPS CAD' },
soft_structure: { en: 'Soft Structure', fa: 'ساختار نرم', nl: 'Zachte Structuur' },
customized_abutment: { en: 'Customized Abutment', fa: 'اباتمنت سفارشی', nl: 'Aangepast Abutment' },
press_ceramic: { en: 'Pressed Ceramic / IPS e.max', fa: 'سرامیک پرس / IPS e.max', nl: 'Perskeramiek / IPS e.max' },
veneer_full_contour: { en: 'Veneer · Full contour', fa: 'ونیر · تمام‌کانتور', nl: 'Veneer · Full contour' },
veneer_layered: { en: 'Veneer · Layered ceramic', fa: 'ونیر · سرامیک لایه‌ای', nl: 'Veneer · Gelaagd keramiek' },
inlay_full_contour: { en: 'Inlay · Full contour', fa: 'اینلی · تمام‌کانتور', nl: 'Inlay · Full contour' },
inlay_layered: { en: 'Inlay · Layered ceramic', fa: 'اینلی · سرامیک لایه‌ای', nl: 'Inlay · Gelaagd keramiek' },
onlay_full_contour: { en: 'Onlay · Full contour', fa: 'آنلی · تمام‌کانتور', nl: 'Onlay · Full contour' },
onlay_layered: { en: 'Onlay · Layered ceramic', fa: 'آنلی · سرامیک لایه‌ای', nl: 'Onlay · Gelaagd keramiek' },
overlay_full_contour: { en: 'Overlay · Full contour', fa: 'اورلی · تمام‌کانتور', nl: 'Overlay · Full contour' },
overlay_layered: { en: 'Overlay · Layered ceramic', fa: 'اورلی · سرامیک لایه‌ای', nl: 'Overlay · Gelaagd keramiek' },
cast_post_core: { en: 'Cast Post & Core', fa: 'پست و کور ریختگی', nl: 'Gegoten Stiftopbouw' },
fiber_post_core: { en: 'Fiber Post & Core', fa: 'پست و کور فایبر', nl: 'Fiber Stiftopbouw' },
customized_abutment: { en: 'Custom Abutment (Titanium)', fa: 'اباتمنت سفارشی (تیتانیوم)', nl: 'Aangepast abutment (titanium)' },
prefabricated_abutment: { en: 'Prefabricated Abutment', fa: 'اباتمنت آماده', nl: 'Prefab Abutment' },
ti_base_abutment: { en: 'Ti Base Abutment', fa: 'اباتمنت پایه تیتانیوم', nl: 'Ti Basis Abutment' },
multi_unit_abutment: { en: 'Multi Unit Abutment', fa: 'اباتمنت مولتی یونیت', nl: 'Multi Unit Abutment' },
zirconia_abutment: { en: 'Zirconia Abutment', fa: 'اباتمنت زیرکونیا', nl: 'Zirconia Abutment' },
zirconia_abutment: { en: 'Custom Abutment (Zirconia)', fa: 'اباتمنت سفارشی (زیرکونیا)', nl: 'Aangepast abutment (zirconia)' },
screw_retained: { en: 'Screw Retained', fa: 'پیچی', nl: 'Schroefgehouden' },
zirconia_overlay: { en: 'Zirconia Overlay', fa: 'اورلی زیرکونیا', nl: 'Zirconia Overlay' },
ips_overlay: { en: 'IPS Overlay', fa: 'اورلی IPS', nl: 'IPS Overlay' },
complete_denture: { en: 'Complete Denture', fa: 'دنچر کامل', nl: 'Volledige prothese' },
partial_denture: { en: 'Partial Denture', fa: 'دنچر پارسیل', nl: 'Partiële prothese' },
overdenture: { en: 'Overdenture', fa: 'اوردنچر', nl: 'Overkappingsprothese' },
night_guard_soft: { en: 'Night Guard · Soft', fa: 'نایت گارد · نرم', nl: 'Nachtbeugel · Zacht' },
night_guard_hard: { en: 'Night Guard · Hard', fa: 'نایت گارد · سخت', nl: 'Nachtbeugel · Hard' },
night_guard_dual: { en: 'Night Guard · Dual laminate', fa: 'نایت گارد · دو لایه', nl: 'Nachtbeugel · Dual laminate' },
bleaching_tray: { en: 'Bleaching Tray', fa: 'تری بلیچینگ', nl: 'Bleeklepel' },
clear_aligner: { en: 'Clear Aligner', fa: 'الاینر شفاف', nl: 'Clear aligner' },
soft_structure: { en: 'Soft Structure', fa: 'ساختار نرم', nl: 'Zachte Structuur' },
surgical_guide: { en: 'Surgical Guide', fa: 'گاید جراحی', nl: 'Chirurgische mal' },
smile_design: { en: 'Smile Design', fa: 'طراحی لبخند', nl: 'Smile Design' },
mockup: { en: 'Mockup', fa: 'ماکاپ', nl: 'Mockup' },
veneer_zirconia: { en: 'Veneer Zirconia', fa: 'ونیر زیرکونیا', nl: 'Veneer Zirconia' },
veneer_ips_press: { en: 'Veneer IPS Press', fa: 'ونیر IPS پرس', nl: 'Veneer IPS Press' },
veneer_ips_cad: { en: 'Veneer IPS CAD', fa: 'ونیر IPS CAD', nl: 'Veneer IPS CAD' },
zirconia_overlay: { en: 'Zirconia Overlay', fa: 'اورلی زیرکونیا', nl: 'Zirconia Overlay' },
ips_overlay: { en: 'IPS Overlay', fa: 'اورلی IPS', nl: 'IPS Overlay' },
};
const WORKFLOW_STEP_LABELS: Record<string, Record<string, string>> = {
export const WORKFLOW_STEP_LABELS: Record<string, Record<string, string>> = {
intraoral_scan: { en: 'Intraoral Scan', fa: 'اسکن داخل دهان', nl: 'Intraorale Scan' },
design: { en: 'Design', fa: 'طراحی', nl: 'Ontwerp' },
milling_dry: { en: 'Milling Dry', fa: 'فرز خشک', nl: 'Droog Frezen' },