improvement: Some improvements done. some bugs fixed.

This commit is contained in:
2026-09-02 17:24:01 +03:30
parent a3c14a18c1
commit 7f92e735fb
32 changed files with 1092 additions and 315 deletions

View File

@@ -53,19 +53,21 @@ export const LEGACY_TREATMENT_TYPES: readonly TreatmentTypeSeed[] = [
export const LAB_WORKFLOW_STEPS = [
{ code: 'intraoral_scan', sortOrder: 1 },
{ code: 'design', sortOrder: 2 },
{ code: 'milling_dry', sortOrder: 3 },
{ code: 'milling_wet', sortOrder: 4 },
{ code: 'printer_resin', sortOrder: 5 },
{ code: 'printer_metal', sortOrder: 6 },
{ code: 'sinter', sortOrder: 7 },
{ code: 'build_up', sortOrder: 8 },
{ code: 'stain', sortOrder: 9 },
{ code: 'glaze', sortOrder: 10 },
{ code: 'polish_prep', sortOrder: 11 },
{ code: 'packing', sortOrder: 12 },
{ code: 'shipping', sortOrder: 13 },
{ code: 'pressing', sortOrder: 14 },
{ code: 'choosing_abutment', sortOrder: 2 },
{ code: 'design', sortOrder: 3 },
{ code: 'model_create', sortOrder: 4 },
{ code: 'milling_dry', sortOrder: 5 },
{ code: 'milling_wet', sortOrder: 6 },
{ code: 'printer_resin', sortOrder: 7 },
{ code: 'printer_metal', sortOrder: 8 },
{ code: 'pressing', sortOrder: 9 },
{ code: 'sinter', sortOrder: 10 },
{ code: 'build_up', sortOrder: 11 },
{ code: 'stain', sortOrder: 12 },
{ code: 'glaze', sortOrder: 13 },
{ code: 'polish_prep', sortOrder: 14 },
{ code: 'packing', sortOrder: 15 },
{ code: 'shipping', sortOrder: 16 },
] as const;
export type ProsthesisChartRegion = 'crown' | 'root' | 'arch';
@@ -82,15 +84,42 @@ export type ProsthesisTypeSeed = {
chartRegion: ProsthesisChartRegion;
stackGroup: ProsthesisStackGroup;
addonKind?: ProsthesisAddonKind;
/** Manufacturing steps between design and packing (exclusive of universal scan/design/pack/ship). */
/** Manufacturing sequence. Packing and shipping are appended except for smile_design. */
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;
const SCAN_DESIGN_MODEL = ['intraoral_scan', 'design', 'model_create'] as const;
const INDIRECT_FULL = [...SCAN_DESIGN_MODEL, 'milling_wet', 'sinter', 'stain', 'glaze'] as const;
const INDIRECT_LAYERED = [
...SCAN_DESIGN_MODEL,
'milling_wet',
'sinter',
'build_up',
'stain',
'glaze',
] as const;
/** Unlisted types keep scan+design plus todays manufacturing (no model-create). */
const KEEP_FULL_CONTOUR = [
'intraoral_scan',
'design',
'milling_wet',
'stain',
'glaze',
'polish_prep',
] as const;
const KEEP_LAYERED = [
'intraoral_scan',
'design',
'milling_dry',
'sinter',
'build_up',
'stain',
'glaze',
'polish_prep',
] as const;
const DENTURE = ['intraoral_scan', 'design', 'printer_resin', 'polish_prep'] as const;
const APPLIANCE = ['intraoral_scan', 'design', 'printer_resin', 'polish_prep'] as const;
const POST_CORE = ['intraoral_scan', 'design', 'milling_wet', 'polish_prep'] as const;
function crown(
code: string,
@@ -113,6 +142,7 @@ function implantAddon(
code: string,
sortOrder: number,
manufacturingSteps: readonly string[],
extra?: Partial<ProsthesisTypeSeed>,
): ProsthesisTypeSeed {
return {
code,
@@ -122,6 +152,7 @@ function implantAddon(
stackGroup: 'implant',
addonKind: 'implant',
manufacturingSteps,
...extra,
};
}
@@ -137,20 +168,54 @@ function indirect(
subcategory: indication,
chartRegion: 'crown',
stackGroup: 'restoration',
manufacturingSteps: technique === 'layered' ? LAYERED : FULL_CONTOUR,
manufacturingSteps: technique === 'layered' ? INDIRECT_LAYERED : INDIRECT_FULL,
};
}
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']),
crown('pfm_crown', 1, [
...SCAN_DESIGN_MODEL,
'milling_wet',
'sinter',
'build_up',
'stain',
'glaze',
]),
crown('pfz_crown', 2, [
...SCAN_DESIGN_MODEL,
'milling_dry',
'sinter',
'build_up',
'stain',
'glaze',
]),
crown('monolithic_zirconia', 3, [
...SCAN_DESIGN_MODEL,
'milling_dry',
'sinter',
'stain',
'glaze',
]),
crown('glass_ceramic_crown', 4, [
...SCAN_DESIGN_MODEL,
'milling_dry',
'sinter',
'stain',
'glaze',
]),
crown('full_metal_crown', 5, [...SCAN_DESIGN_MODEL, 'milling_wet', 'polish_prep']),
crown('temporary_resin_crown', 6, ['intraoral_scan', 'design', 'milling_wet', 'polish_prep']),
crown('pmma', 7, ['intraoral_scan', 'design', 'milling_dry', 'polish_prep']),
crown('peek_crown', 8, ['intraoral_scan', 'design', 'milling_dry', 'polish_prep']),
crown('press_ceramic', 9, [
'intraoral_scan',
'design',
'printer_resin',
'pressing',
'stain',
'glaze',
'polish_prep',
]),
indirect('veneer', 'full_contour', 20),
indirect('veneer', 'layered', 21),
indirect('inlay', 'full_contour', 22),
@@ -177,19 +242,31 @@ export const PROSTHESIS_TYPES: ProsthesisTypeSeed[] = [
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: 'screw_retained',
sortOrder: 45,
category: 'implant',
chartRegion: 'crown',
stackGroup: 'restoration',
manufacturingSteps: ['milling_wet', 'polish_prep'],
},
implantAddon('prefabricated_abutment', 40, [
'intraoral_scan',
'choosing_abutment',
'model_create',
'polish_prep',
]),
implantAddon('ti_base_abutment', 41, ['intraoral_scan', 'model_create', 'polish_prep']),
implantAddon('multi_unit_abutment', 42, [
'intraoral_scan',
'choosing_abutment',
'model_create',
'polish_prep',
]),
implantAddon('customized_abutment', 43, [
...SCAN_DESIGN_MODEL,
'milling_wet',
'polish_prep',
]),
implantAddon('zirconia_abutment', 44, [...SCAN_DESIGN_MODEL, 'milling_dry', 'sinter']),
implantAddon(
'screw_retained',
45,
[...SCAN_DESIGN_MODEL, 'milling_wet', 'polish_prep'],
{ chartRegion: 'crown' },
),
{
code: 'complete_denture',
sortOrder: 50,
@@ -202,7 +279,7 @@ export const PROSTHESIS_TYPES: ProsthesisTypeSeed[] = [
code: 'partial_denture',
sortOrder: 51,
category: 'removable',
chartRegion: 'arch',
chartRegion: 'crown',
stackGroup: 'arch',
manufacturingSteps: DENTURE,
},
@@ -263,7 +340,7 @@ export const PROSTHESIS_TYPES: ProsthesisTypeSeed[] = [
category: 'appliance',
chartRegion: 'arch',
stackGroup: 'arch',
manufacturingSteps: ['milling_dry', 'sinter'],
manufacturingSteps: ['intraoral_scan', 'design', 'milling_dry', 'sinter'],
},
{
code: 'surgical_guide',
@@ -280,7 +357,7 @@ export const PROSTHESIS_TYPES: ProsthesisTypeSeed[] = [
chartRegion: 'arch',
stackGroup: 'arch',
skipPackingShipping: true,
manufacturingSteps: [],
manufacturingSteps: ['intraoral_scan', 'design'],
},
{
code: 'mockup',
@@ -288,7 +365,7 @@ export const PROSTHESIS_TYPES: ProsthesisTypeSeed[] = [
category: 'digital',
chartRegion: 'arch',
stackGroup: 'arch',
manufacturingSteps: ['printer_resin'],
manufacturingSteps: ['intraoral_scan', 'design', 'model_create'],
},
// Legacy leaves — labels for historical cases; hidden from the picker.
{
@@ -299,7 +376,7 @@ export const PROSTHESIS_TYPES: ProsthesisTypeSeed[] = [
subcategory: 'veneer',
chartRegion: 'crown',
stackGroup: 'restoration',
manufacturingSteps: LAYERED,
manufacturingSteps: KEEP_LAYERED,
},
{
code: 'veneer_ips_press',
@@ -309,7 +386,16 @@ export const PROSTHESIS_TYPES: ProsthesisTypeSeed[] = [
subcategory: 'veneer',
chartRegion: 'crown',
stackGroup: 'restoration',
manufacturingSteps: ['printer_resin', 'build_up', 'stain', 'glaze', 'polish_prep', 'pressing'],
manufacturingSteps: [
'intraoral_scan',
'design',
'printer_resin',
'build_up',
'stain',
'glaze',
'polish_prep',
'pressing',
],
},
{
code: 'veneer_ips_cad',
@@ -319,7 +405,7 @@ export const PROSTHESIS_TYPES: ProsthesisTypeSeed[] = [
subcategory: 'veneer',
chartRegion: 'crown',
stackGroup: 'restoration',
manufacturingSteps: FULL_CONTOUR,
manufacturingSteps: KEEP_FULL_CONTOUR,
},
{
code: 'zirconia_overlay',
@@ -329,7 +415,15 @@ export const PROSTHESIS_TYPES: ProsthesisTypeSeed[] = [
subcategory: 'overlay',
chartRegion: 'crown',
stackGroup: 'restoration',
manufacturingSteps: ['milling_dry', 'sinter', 'stain', 'glaze', 'polish_prep'],
manufacturingSteps: [
'intraoral_scan',
'design',
'milling_dry',
'sinter',
'stain',
'glaze',
'polish_prep',
],
},
{
code: 'ips_overlay',
@@ -339,17 +433,16 @@ export const PROSTHESIS_TYPES: ProsthesisTypeSeed[] = [
subcategory: 'overlay',
chartRegion: 'crown',
stackGroup: 'restoration',
manufacturingSteps: FULL_CONTOUR,
manufacturingSteps: KEEP_FULL_CONTOUR,
},
];
const UNIVERSAL_PREFIX = ['intraoral_scan', 'design'] as const;
const UNIVERSAL_SUFFIX = ['packing', 'shipping'] as const;
const PACK_SHIP = ['packing', 'shipping'] as const;
export function buildProsthesisStepCodes(type: ProsthesisTypeSeed): string[] {
const steps = [...UNIVERSAL_PREFIX, ...type.manufacturingSteps];
const steps = [...type.manufacturingSteps];
if (!type.skipPackingShipping) {
steps.push(...UNIVERSAL_SUFFIX);
steps.push(...PACK_SHIP);
}
return steps;
}
@@ -427,7 +520,13 @@ export const PROSTHESIS_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' },
choosing_abutment: {
en: 'Choosing Abutment',
fa: 'انتخاب اباتمنت',
nl: 'Abutment kiezen',
},
design: { en: 'Design', fa: 'طراحی', nl: 'Ontwerp' },
model_create: { en: 'Model Create', fa: 'ساخت مدل', nl: 'Model maken' },
milling_dry: { en: 'Milling Dry', fa: 'فرز خشک', nl: 'Droog Frezen' },
milling_wet: { en: 'Milling Wet', fa: 'فرز تر', nl: 'Nat Frezen' },
printer_resin: { en: 'Printer Resin', fa: 'پرینتر رزین', nl: 'Harsprinter' },