@blackcode_sa/metaestetics-api 1.6.24 → 1.6.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/index.d.mts +31 -3
- package/dist/admin/index.d.ts +31 -3
- package/dist/admin/index.js +122 -87
- package/dist/admin/index.mjs +122 -87
- package/dist/backoffice/index.d.mts +67 -54
- package/dist/backoffice/index.d.ts +67 -54
- package/dist/backoffice/index.js +19 -14
- package/dist/backoffice/index.mjs +19 -14
- package/dist/index.d.mts +273 -259
- package/dist/index.d.ts +273 -259
- package/dist/index.js +25 -16
- package/dist/index.mjs +25 -16
- package/package.json +1 -1
- package/src/admin/booking/booking.admin.ts +46 -63
- package/src/admin/documentation-templates/document-manager.admin.ts +128 -0
- package/src/backoffice/types/technology.types.ts +16 -2
- package/src/services/documentation-templates/documentation-template.service.ts +37 -21
- package/src/services/documentation-templates/filled-document.service.ts +6 -1
- package/src/types/procedure/index.ts +5 -2
package/dist/backoffice/index.js
CHANGED
|
@@ -1615,25 +1615,30 @@ var DocumentationTemplateService = class extends BaseService {
|
|
|
1615
1615
|
* @returns The template or null if not found
|
|
1616
1616
|
*/
|
|
1617
1617
|
async getTemplateById(templateId, version) {
|
|
1618
|
-
if (version !== void 0) {
|
|
1619
|
-
try {
|
|
1620
|
-
const versionTemplate = await this.getTemplateVersion(
|
|
1621
|
-
templateId,
|
|
1622
|
-
version
|
|
1623
|
-
);
|
|
1624
|
-
if (versionTemplate) {
|
|
1625
|
-
return versionTemplate;
|
|
1626
|
-
}
|
|
1627
|
-
} catch (error) {
|
|
1628
|
-
console.error(`Error getting template version ${version}:`, error);
|
|
1629
|
-
}
|
|
1630
|
-
}
|
|
1631
1618
|
const docRef = (0, import_firestore7.doc)(this.collectionRef, templateId);
|
|
1632
1619
|
const docSnap = await (0, import_firestore7.getDoc)(docRef);
|
|
1633
1620
|
if (!docSnap.exists()) {
|
|
1634
1621
|
return null;
|
|
1635
1622
|
}
|
|
1636
|
-
|
|
1623
|
+
const currentTemplate = docSnap.data();
|
|
1624
|
+
if (version === void 0) {
|
|
1625
|
+
return currentTemplate;
|
|
1626
|
+
}
|
|
1627
|
+
if (currentTemplate.version === version) {
|
|
1628
|
+
return currentTemplate;
|
|
1629
|
+
}
|
|
1630
|
+
try {
|
|
1631
|
+
const versionTemplate = await this.getTemplateVersion(
|
|
1632
|
+
templateId,
|
|
1633
|
+
version
|
|
1634
|
+
);
|
|
1635
|
+
if (versionTemplate) {
|
|
1636
|
+
return versionTemplate;
|
|
1637
|
+
}
|
|
1638
|
+
} catch (error) {
|
|
1639
|
+
console.error(`Error getting template version ${version}:`, error);
|
|
1640
|
+
}
|
|
1641
|
+
return null;
|
|
1637
1642
|
}
|
|
1638
1643
|
/**
|
|
1639
1644
|
* Update an existing document template
|
|
@@ -1592,25 +1592,30 @@ var DocumentationTemplateService = class extends BaseService {
|
|
|
1592
1592
|
* @returns The template or null if not found
|
|
1593
1593
|
*/
|
|
1594
1594
|
async getTemplateById(templateId, version) {
|
|
1595
|
-
if (version !== void 0) {
|
|
1596
|
-
try {
|
|
1597
|
-
const versionTemplate = await this.getTemplateVersion(
|
|
1598
|
-
templateId,
|
|
1599
|
-
version
|
|
1600
|
-
);
|
|
1601
|
-
if (versionTemplate) {
|
|
1602
|
-
return versionTemplate;
|
|
1603
|
-
}
|
|
1604
|
-
} catch (error) {
|
|
1605
|
-
console.error(`Error getting template version ${version}:`, error);
|
|
1606
|
-
}
|
|
1607
|
-
}
|
|
1608
1595
|
const docRef = doc7(this.collectionRef, templateId);
|
|
1609
1596
|
const docSnap = await getDoc7(docRef);
|
|
1610
1597
|
if (!docSnap.exists()) {
|
|
1611
1598
|
return null;
|
|
1612
1599
|
}
|
|
1613
|
-
|
|
1600
|
+
const currentTemplate = docSnap.data();
|
|
1601
|
+
if (version === void 0) {
|
|
1602
|
+
return currentTemplate;
|
|
1603
|
+
}
|
|
1604
|
+
if (currentTemplate.version === version) {
|
|
1605
|
+
return currentTemplate;
|
|
1606
|
+
}
|
|
1607
|
+
try {
|
|
1608
|
+
const versionTemplate = await this.getTemplateVersion(
|
|
1609
|
+
templateId,
|
|
1610
|
+
version
|
|
1611
|
+
);
|
|
1612
|
+
if (versionTemplate) {
|
|
1613
|
+
return versionTemplate;
|
|
1614
|
+
}
|
|
1615
|
+
} catch (error) {
|
|
1616
|
+
console.error(`Error getting template version ${version}:`, error);
|
|
1617
|
+
}
|
|
1618
|
+
return null;
|
|
1614
1619
|
}
|
|
1615
1620
|
/**
|
|
1616
1621
|
* Update an existing document template
|
package/dist/index.d.mts
CHANGED
|
@@ -355,265 +355,18 @@ interface CertificationRequirement {
|
|
|
355
355
|
}
|
|
356
356
|
|
|
357
357
|
/**
|
|
358
|
-
*
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
*
|
|
362
|
-
|
|
363
|
-
declare const DOCUMENTATION_TEMPLATES_COLLECTION = "documentation-templates";
|
|
364
|
-
declare const FILLED_DOCUMENTS_COLLECTION = "filled-documents";
|
|
365
|
-
declare const USER_FORMS_SUBCOLLECTION = "user-forms";
|
|
366
|
-
declare const DOCTOR_FORMS_SUBCOLLECTION = "doctor-forms";
|
|
367
|
-
/**
|
|
368
|
-
* Enum for element types in documentation templates
|
|
369
|
-
*/
|
|
370
|
-
declare enum DocumentElementType {
|
|
371
|
-
HEADING = "heading",
|
|
372
|
-
PARAGRAPH = "paragraph",
|
|
373
|
-
LIST = "list",
|
|
374
|
-
DYNAMIC_TEXT = "dynamic_text",
|
|
375
|
-
BINARY_CHOICE = "binary_choice",
|
|
376
|
-
MULTIPLE_CHOICE = "multiple_choice",
|
|
377
|
-
SINGLE_CHOICE = "single_choice",
|
|
378
|
-
RATING_SCALE = "rating_scale",
|
|
379
|
-
TEXT_INPUT = "text_input",
|
|
380
|
-
DATE_PICKER = "date_picker",
|
|
381
|
-
SIGNATURE = "signature",
|
|
382
|
-
DITIGAL_SIGNATURE = "digital_signature",
|
|
383
|
-
FILE_UPLOAD = "file_upload"
|
|
384
|
-
}
|
|
385
|
-
/**
|
|
386
|
-
* Enum for list types
|
|
387
|
-
*/
|
|
388
|
-
declare enum ListType {
|
|
389
|
-
ORDERED = "ordered",
|
|
390
|
-
UNORDERED = "unordered"
|
|
391
|
-
}
|
|
392
|
-
/**
|
|
393
|
-
* Enum for heading levels
|
|
394
|
-
*/
|
|
395
|
-
declare enum HeadingLevel {
|
|
396
|
-
H1 = "h1",
|
|
397
|
-
H2 = "h2",
|
|
398
|
-
H3 = "h3",
|
|
399
|
-
H4 = "h4",
|
|
400
|
-
H5 = "h5",
|
|
401
|
-
H6 = "h6"
|
|
402
|
-
}
|
|
403
|
-
/**
|
|
404
|
-
* Enum for dynamic variable placeholders
|
|
405
|
-
*/
|
|
406
|
-
declare enum DynamicVariable {
|
|
407
|
-
PATIENT_NAME = "$[PATIENT_NAME]",
|
|
408
|
-
DOCTOR_NAME = "$[DOCTOR_NAME]",
|
|
409
|
-
CLINIC_NAME = "$[CLINIC_NAME]",
|
|
410
|
-
PATIENT_BIRTHDAY = "$[PATIENT_BIRTHDAY]",
|
|
411
|
-
APPOINTMENT_DATE = "$[APPOINTMENT_DATE]",
|
|
412
|
-
CURRENT_DATE = "$[CURRENT_DATE]",
|
|
413
|
-
PROCEDURE_NAME = "$[PROCEDURE_NAME]",
|
|
414
|
-
PROCEDURE_DESCRIPTION = "$[PROCEDURE_DESCRIPTION]",
|
|
415
|
-
PROCEDURE_COST = "$[PROCEDURE_COST]",
|
|
416
|
-
PROCEDURE_DURATION = "$[PROCEDURE_DURATION]",
|
|
417
|
-
PROCEDURE_RISK = "$[PROCEDURE_RISK]"
|
|
418
|
-
}
|
|
419
|
-
/**
|
|
420
|
-
* Base interface for all document elements
|
|
421
|
-
*/
|
|
422
|
-
interface BaseDocumentElement {
|
|
423
|
-
id: string;
|
|
424
|
-
type: DocumentElementType;
|
|
425
|
-
required?: boolean;
|
|
426
|
-
}
|
|
427
|
-
/**
|
|
428
|
-
* Interface for heading element
|
|
429
|
-
*/
|
|
430
|
-
interface HeadingElement extends BaseDocumentElement {
|
|
431
|
-
type: DocumentElementType.HEADING;
|
|
432
|
-
text: string;
|
|
433
|
-
level: HeadingLevel;
|
|
434
|
-
}
|
|
435
|
-
/**
|
|
436
|
-
* Interface for paragraph element
|
|
437
|
-
*/
|
|
438
|
-
interface ParagraphElement extends BaseDocumentElement {
|
|
439
|
-
type: DocumentElementType.PARAGRAPH;
|
|
440
|
-
text: string;
|
|
441
|
-
}
|
|
442
|
-
/**
|
|
443
|
-
* Interface for list element
|
|
444
|
-
*/
|
|
445
|
-
interface ListElement extends BaseDocumentElement {
|
|
446
|
-
type: DocumentElementType.LIST;
|
|
447
|
-
items: string[];
|
|
448
|
-
listType: ListType;
|
|
449
|
-
}
|
|
450
|
-
/**
|
|
451
|
-
* Interface for dynamic text element
|
|
452
|
-
*/
|
|
453
|
-
interface DynamicTextElement extends BaseDocumentElement {
|
|
454
|
-
type: DocumentElementType.DYNAMIC_TEXT;
|
|
455
|
-
text: string;
|
|
456
|
-
}
|
|
457
|
-
/**
|
|
458
|
-
* Interface for binary choice element (Yes/No)
|
|
459
|
-
*/
|
|
460
|
-
interface BinaryChoiceElement extends BaseDocumentElement {
|
|
461
|
-
type: DocumentElementType.BINARY_CHOICE;
|
|
462
|
-
question: string;
|
|
463
|
-
defaultValue?: boolean;
|
|
464
|
-
}
|
|
465
|
-
/**
|
|
466
|
-
* Interface for multiple choice element
|
|
467
|
-
*/
|
|
468
|
-
interface MultipleChoiceElement extends BaseDocumentElement {
|
|
469
|
-
type: DocumentElementType.MULTIPLE_CHOICE;
|
|
470
|
-
question: string;
|
|
471
|
-
options: string[];
|
|
472
|
-
defaultValues?: string[];
|
|
473
|
-
}
|
|
474
|
-
/**
|
|
475
|
-
* Interface for single choice element
|
|
476
|
-
*/
|
|
477
|
-
interface SingleChoiceElement extends BaseDocumentElement {
|
|
478
|
-
type: DocumentElementType.SINGLE_CHOICE;
|
|
479
|
-
question: string;
|
|
480
|
-
options: string[];
|
|
481
|
-
defaultValue?: string;
|
|
482
|
-
}
|
|
483
|
-
/**
|
|
484
|
-
* Interface for rating scale element
|
|
485
|
-
*/
|
|
486
|
-
interface RatingScaleElement extends BaseDocumentElement {
|
|
487
|
-
type: DocumentElementType.RATING_SCALE;
|
|
488
|
-
question: string;
|
|
489
|
-
min: number;
|
|
490
|
-
max: number;
|
|
491
|
-
labels?: {
|
|
492
|
-
[key: number]: string;
|
|
493
|
-
};
|
|
494
|
-
defaultValue?: number;
|
|
495
|
-
}
|
|
496
|
-
/**
|
|
497
|
-
* Interface for text input element
|
|
498
|
-
*/
|
|
499
|
-
interface TextInputElement extends BaseDocumentElement {
|
|
500
|
-
type: DocumentElementType.TEXT_INPUT;
|
|
501
|
-
label: string;
|
|
502
|
-
placeholder?: string;
|
|
503
|
-
multiline?: boolean;
|
|
504
|
-
defaultValue?: string;
|
|
505
|
-
}
|
|
506
|
-
/**
|
|
507
|
-
* Interface for date picker element
|
|
508
|
-
*/
|
|
509
|
-
interface DatePickerElement extends BaseDocumentElement {
|
|
510
|
-
type: DocumentElementType.DATE_PICKER;
|
|
511
|
-
label: string;
|
|
512
|
-
defaultValue?: string;
|
|
513
|
-
}
|
|
514
|
-
/**
|
|
515
|
-
* Interface for signature element
|
|
516
|
-
*/
|
|
517
|
-
interface SignatureElement extends BaseDocumentElement {
|
|
518
|
-
type: DocumentElementType.SIGNATURE;
|
|
519
|
-
label: string;
|
|
520
|
-
}
|
|
521
|
-
/**
|
|
522
|
-
* Interface for digital signature element
|
|
523
|
-
*/
|
|
524
|
-
interface DigitalSignatureElement extends BaseDocumentElement {
|
|
525
|
-
type: DocumentElementType.DITIGAL_SIGNATURE;
|
|
526
|
-
label: string;
|
|
527
|
-
}
|
|
528
|
-
/**
|
|
529
|
-
* Interface for file upload element
|
|
530
|
-
*/
|
|
531
|
-
interface FileUploadElement extends BaseDocumentElement {
|
|
532
|
-
type: DocumentElementType.FILE_UPLOAD;
|
|
533
|
-
label: string;
|
|
534
|
-
allowedFileTypes?: string[];
|
|
535
|
-
maxFileSizeMB?: number;
|
|
536
|
-
}
|
|
537
|
-
/**
|
|
538
|
-
* Union type for all document elements
|
|
539
|
-
*/
|
|
540
|
-
type DocumentElement = HeadingElement | ParagraphElement | ListElement | DynamicTextElement | BinaryChoiceElement | MultipleChoiceElement | SingleChoiceElement | RatingScaleElement | TextInputElement | DatePickerElement | SignatureElement | FileUploadElement;
|
|
541
|
-
/**
|
|
542
|
-
* Interface for document template
|
|
543
|
-
*/
|
|
544
|
-
interface DocumentTemplate {
|
|
545
|
-
id: string;
|
|
546
|
-
title: string;
|
|
547
|
-
description?: string;
|
|
548
|
-
createdAt: number;
|
|
549
|
-
updatedAt: number;
|
|
550
|
-
createdBy: string;
|
|
551
|
-
elements: DocumentElement[];
|
|
552
|
-
tags?: string[];
|
|
553
|
-
isUserForm?: boolean;
|
|
554
|
-
isRequired?: boolean;
|
|
555
|
-
sortingOrder?: number;
|
|
556
|
-
version: number;
|
|
557
|
-
isActive: boolean;
|
|
558
|
-
}
|
|
559
|
-
/**
|
|
560
|
-
* Interface for creating a new document template
|
|
561
|
-
*/
|
|
562
|
-
interface CreateDocumentTemplateData {
|
|
563
|
-
title: string;
|
|
564
|
-
description?: string;
|
|
565
|
-
elements: Omit<DocumentElement, "id">[];
|
|
566
|
-
tags?: string[];
|
|
567
|
-
isUserForm?: boolean;
|
|
568
|
-
isRequired?: boolean;
|
|
569
|
-
sortingOrder?: number;
|
|
570
|
-
}
|
|
571
|
-
/**
|
|
572
|
-
* Interface for updating an existing document template
|
|
573
|
-
*/
|
|
574
|
-
interface UpdateDocumentTemplateData {
|
|
575
|
-
title?: string;
|
|
576
|
-
description?: string;
|
|
577
|
-
elements?: Omit<DocumentElement, "id">[];
|
|
578
|
-
tags?: string[];
|
|
579
|
-
isActive?: boolean;
|
|
580
|
-
isUserForm?: boolean;
|
|
581
|
-
isRequired?: boolean;
|
|
582
|
-
sortingOrder?: number;
|
|
583
|
-
}
|
|
584
|
-
/**
|
|
585
|
-
* Interface for a filled document (completed form)
|
|
358
|
+
* Reference to a documentation template with metadata
|
|
359
|
+
* @property templateId - ID of the documentation template
|
|
360
|
+
* @property isUserForm - Whether this template is filled by users
|
|
361
|
+
* @property isRequired - Whether this template is required
|
|
362
|
+
* @property sortingOrder - The display order of this template
|
|
586
363
|
*/
|
|
587
|
-
interface
|
|
588
|
-
id: string;
|
|
364
|
+
interface TechnologyDocumentationTemplate {
|
|
589
365
|
templateId: string;
|
|
590
|
-
templateVersion: number;
|
|
591
366
|
isUserForm: boolean;
|
|
592
367
|
isRequired: boolean;
|
|
593
|
-
|
|
594
|
-
appointmentId: string;
|
|
595
|
-
patientId: string;
|
|
596
|
-
practitionerId: string;
|
|
597
|
-
clinicId: string;
|
|
598
|
-
createdAt: number;
|
|
599
|
-
updatedAt: number;
|
|
600
|
-
values: {
|
|
601
|
-
[elementId: string]: any;
|
|
602
|
-
};
|
|
603
|
-
status: FilledDocumentStatus;
|
|
604
|
-
}
|
|
605
|
-
/**
|
|
606
|
-
* Enum for filled document status
|
|
607
|
-
*/
|
|
608
|
-
declare enum FilledDocumentStatus {
|
|
609
|
-
DRAFT = "draft",
|
|
610
|
-
SKIPPED = "skipped",
|
|
611
|
-
PENDING = "pending",
|
|
612
|
-
COMPLETED = "completed",// When doctor or patient completes the form
|
|
613
|
-
SIGNED = "signed",// Only used for user forms
|
|
614
|
-
REJECTED = "rejected"
|
|
368
|
+
sortingOrder: number;
|
|
615
369
|
}
|
|
616
|
-
|
|
617
370
|
/**
|
|
618
371
|
* Technology used in medical procedures
|
|
619
372
|
* Technologies are now a top-level collection that reference their full path in the hierarchy
|
|
@@ -631,7 +384,7 @@ declare enum FilledDocumentStatus {
|
|
|
631
384
|
* @property contraindications - List of conditions requiring special attention
|
|
632
385
|
* @property benefits - List of expected benefits from the procedure
|
|
633
386
|
* @property certificationRequirement - Required certification level and specialties
|
|
634
|
-
* @property documentationTemplates - List of documentation
|
|
387
|
+
* @property documentationTemplates - List of documentation template references
|
|
635
388
|
* @property isActive - Whether the technology is active in the system
|
|
636
389
|
* @property createdAt - Creation date
|
|
637
390
|
* @property updatedAt - Last update date
|
|
@@ -652,7 +405,7 @@ interface Technology {
|
|
|
652
405
|
contraindications: Contraindication[];
|
|
653
406
|
benefits: TreatmentBenefit[];
|
|
654
407
|
certificationRequirement: CertificationRequirement;
|
|
655
|
-
documentationTemplates?:
|
|
408
|
+
documentationTemplates?: TechnologyDocumentationTemplate[];
|
|
656
409
|
isActive: boolean;
|
|
657
410
|
createdAt: Date;
|
|
658
411
|
updatedAt: Date;
|
|
@@ -797,7 +550,7 @@ interface Procedure {
|
|
|
797
550
|
/** Certification requirements for performing this procedure */
|
|
798
551
|
certificationRequirement: CertificationRequirement;
|
|
799
552
|
/** Documentation templates required for this procedure */
|
|
800
|
-
documentationTemplates:
|
|
553
|
+
documentationTemplates: TechnologyDocumentationTemplate[];
|
|
801
554
|
/** ID of the practitioner who performs this procedure */
|
|
802
555
|
practitionerId: string;
|
|
803
556
|
/** ID of the clinic branch where this procedure is performed */
|
|
@@ -1986,6 +1739,266 @@ interface PatientProfileInfo {
|
|
|
1986
1739
|
gender: Gender;
|
|
1987
1740
|
}
|
|
1988
1741
|
|
|
1742
|
+
/**
|
|
1743
|
+
* Types for the Medical Documentation Templating System
|
|
1744
|
+
*/
|
|
1745
|
+
/**
|
|
1746
|
+
* Kolekcija u Firestore bazi gde se čuvaju dokumentacijske šablone
|
|
1747
|
+
*/
|
|
1748
|
+
declare const DOCUMENTATION_TEMPLATES_COLLECTION = "documentation-templates";
|
|
1749
|
+
declare const FILLED_DOCUMENTS_COLLECTION = "filled-documents";
|
|
1750
|
+
declare const USER_FORMS_SUBCOLLECTION = "user-forms";
|
|
1751
|
+
declare const DOCTOR_FORMS_SUBCOLLECTION = "doctor-forms";
|
|
1752
|
+
/**
|
|
1753
|
+
* Enum for element types in documentation templates
|
|
1754
|
+
*/
|
|
1755
|
+
declare enum DocumentElementType {
|
|
1756
|
+
HEADING = "heading",
|
|
1757
|
+
PARAGRAPH = "paragraph",
|
|
1758
|
+
LIST = "list",
|
|
1759
|
+
DYNAMIC_TEXT = "dynamic_text",
|
|
1760
|
+
BINARY_CHOICE = "binary_choice",
|
|
1761
|
+
MULTIPLE_CHOICE = "multiple_choice",
|
|
1762
|
+
SINGLE_CHOICE = "single_choice",
|
|
1763
|
+
RATING_SCALE = "rating_scale",
|
|
1764
|
+
TEXT_INPUT = "text_input",
|
|
1765
|
+
DATE_PICKER = "date_picker",
|
|
1766
|
+
SIGNATURE = "signature",
|
|
1767
|
+
DITIGAL_SIGNATURE = "digital_signature",
|
|
1768
|
+
FILE_UPLOAD = "file_upload"
|
|
1769
|
+
}
|
|
1770
|
+
/**
|
|
1771
|
+
* Enum for list types
|
|
1772
|
+
*/
|
|
1773
|
+
declare enum ListType {
|
|
1774
|
+
ORDERED = "ordered",
|
|
1775
|
+
UNORDERED = "unordered"
|
|
1776
|
+
}
|
|
1777
|
+
/**
|
|
1778
|
+
* Enum for heading levels
|
|
1779
|
+
*/
|
|
1780
|
+
declare enum HeadingLevel {
|
|
1781
|
+
H1 = "h1",
|
|
1782
|
+
H2 = "h2",
|
|
1783
|
+
H3 = "h3",
|
|
1784
|
+
H4 = "h4",
|
|
1785
|
+
H5 = "h5",
|
|
1786
|
+
H6 = "h6"
|
|
1787
|
+
}
|
|
1788
|
+
/**
|
|
1789
|
+
* Enum for dynamic variable placeholders
|
|
1790
|
+
*/
|
|
1791
|
+
declare enum DynamicVariable {
|
|
1792
|
+
PATIENT_NAME = "$[PATIENT_NAME]",
|
|
1793
|
+
DOCTOR_NAME = "$[DOCTOR_NAME]",
|
|
1794
|
+
CLINIC_NAME = "$[CLINIC_NAME]",
|
|
1795
|
+
PATIENT_BIRTHDAY = "$[PATIENT_BIRTHDAY]",
|
|
1796
|
+
APPOINTMENT_DATE = "$[APPOINTMENT_DATE]",
|
|
1797
|
+
CURRENT_DATE = "$[CURRENT_DATE]",
|
|
1798
|
+
PROCEDURE_NAME = "$[PROCEDURE_NAME]",
|
|
1799
|
+
PROCEDURE_DESCRIPTION = "$[PROCEDURE_DESCRIPTION]",
|
|
1800
|
+
PROCEDURE_COST = "$[PROCEDURE_COST]",
|
|
1801
|
+
PROCEDURE_DURATION = "$[PROCEDURE_DURATION]",
|
|
1802
|
+
PROCEDURE_RISK = "$[PROCEDURE_RISK]"
|
|
1803
|
+
}
|
|
1804
|
+
/**
|
|
1805
|
+
* Base interface for all document elements
|
|
1806
|
+
*/
|
|
1807
|
+
interface BaseDocumentElement {
|
|
1808
|
+
id: string;
|
|
1809
|
+
type: DocumentElementType;
|
|
1810
|
+
required?: boolean;
|
|
1811
|
+
}
|
|
1812
|
+
/**
|
|
1813
|
+
* Interface for heading element
|
|
1814
|
+
*/
|
|
1815
|
+
interface HeadingElement extends BaseDocumentElement {
|
|
1816
|
+
type: DocumentElementType.HEADING;
|
|
1817
|
+
text: string;
|
|
1818
|
+
level: HeadingLevel;
|
|
1819
|
+
}
|
|
1820
|
+
/**
|
|
1821
|
+
* Interface for paragraph element
|
|
1822
|
+
*/
|
|
1823
|
+
interface ParagraphElement extends BaseDocumentElement {
|
|
1824
|
+
type: DocumentElementType.PARAGRAPH;
|
|
1825
|
+
text: string;
|
|
1826
|
+
}
|
|
1827
|
+
/**
|
|
1828
|
+
* Interface for list element
|
|
1829
|
+
*/
|
|
1830
|
+
interface ListElement extends BaseDocumentElement {
|
|
1831
|
+
type: DocumentElementType.LIST;
|
|
1832
|
+
items: string[];
|
|
1833
|
+
listType: ListType;
|
|
1834
|
+
}
|
|
1835
|
+
/**
|
|
1836
|
+
* Interface for dynamic text element
|
|
1837
|
+
*/
|
|
1838
|
+
interface DynamicTextElement extends BaseDocumentElement {
|
|
1839
|
+
type: DocumentElementType.DYNAMIC_TEXT;
|
|
1840
|
+
text: string;
|
|
1841
|
+
}
|
|
1842
|
+
/**
|
|
1843
|
+
* Interface for binary choice element (Yes/No)
|
|
1844
|
+
*/
|
|
1845
|
+
interface BinaryChoiceElement extends BaseDocumentElement {
|
|
1846
|
+
type: DocumentElementType.BINARY_CHOICE;
|
|
1847
|
+
question: string;
|
|
1848
|
+
defaultValue?: boolean;
|
|
1849
|
+
}
|
|
1850
|
+
/**
|
|
1851
|
+
* Interface for multiple choice element
|
|
1852
|
+
*/
|
|
1853
|
+
interface MultipleChoiceElement extends BaseDocumentElement {
|
|
1854
|
+
type: DocumentElementType.MULTIPLE_CHOICE;
|
|
1855
|
+
question: string;
|
|
1856
|
+
options: string[];
|
|
1857
|
+
defaultValues?: string[];
|
|
1858
|
+
}
|
|
1859
|
+
/**
|
|
1860
|
+
* Interface for single choice element
|
|
1861
|
+
*/
|
|
1862
|
+
interface SingleChoiceElement extends BaseDocumentElement {
|
|
1863
|
+
type: DocumentElementType.SINGLE_CHOICE;
|
|
1864
|
+
question: string;
|
|
1865
|
+
options: string[];
|
|
1866
|
+
defaultValue?: string;
|
|
1867
|
+
}
|
|
1868
|
+
/**
|
|
1869
|
+
* Interface for rating scale element
|
|
1870
|
+
*/
|
|
1871
|
+
interface RatingScaleElement extends BaseDocumentElement {
|
|
1872
|
+
type: DocumentElementType.RATING_SCALE;
|
|
1873
|
+
question: string;
|
|
1874
|
+
min: number;
|
|
1875
|
+
max: number;
|
|
1876
|
+
labels?: {
|
|
1877
|
+
[key: number]: string;
|
|
1878
|
+
};
|
|
1879
|
+
defaultValue?: number;
|
|
1880
|
+
}
|
|
1881
|
+
/**
|
|
1882
|
+
* Interface for text input element
|
|
1883
|
+
*/
|
|
1884
|
+
interface TextInputElement extends BaseDocumentElement {
|
|
1885
|
+
type: DocumentElementType.TEXT_INPUT;
|
|
1886
|
+
label: string;
|
|
1887
|
+
placeholder?: string;
|
|
1888
|
+
multiline?: boolean;
|
|
1889
|
+
defaultValue?: string;
|
|
1890
|
+
}
|
|
1891
|
+
/**
|
|
1892
|
+
* Interface for date picker element
|
|
1893
|
+
*/
|
|
1894
|
+
interface DatePickerElement extends BaseDocumentElement {
|
|
1895
|
+
type: DocumentElementType.DATE_PICKER;
|
|
1896
|
+
label: string;
|
|
1897
|
+
defaultValue?: string;
|
|
1898
|
+
}
|
|
1899
|
+
/**
|
|
1900
|
+
* Interface for signature element
|
|
1901
|
+
*/
|
|
1902
|
+
interface SignatureElement extends BaseDocumentElement {
|
|
1903
|
+
type: DocumentElementType.SIGNATURE;
|
|
1904
|
+
label: string;
|
|
1905
|
+
}
|
|
1906
|
+
/**
|
|
1907
|
+
* Interface for digital signature element
|
|
1908
|
+
*/
|
|
1909
|
+
interface DigitalSignatureElement extends BaseDocumentElement {
|
|
1910
|
+
type: DocumentElementType.DITIGAL_SIGNATURE;
|
|
1911
|
+
label: string;
|
|
1912
|
+
}
|
|
1913
|
+
/**
|
|
1914
|
+
* Interface for file upload element
|
|
1915
|
+
*/
|
|
1916
|
+
interface FileUploadElement extends BaseDocumentElement {
|
|
1917
|
+
type: DocumentElementType.FILE_UPLOAD;
|
|
1918
|
+
label: string;
|
|
1919
|
+
allowedFileTypes?: string[];
|
|
1920
|
+
maxFileSizeMB?: number;
|
|
1921
|
+
}
|
|
1922
|
+
/**
|
|
1923
|
+
* Union type for all document elements
|
|
1924
|
+
*/
|
|
1925
|
+
type DocumentElement = HeadingElement | ParagraphElement | ListElement | DynamicTextElement | BinaryChoiceElement | MultipleChoiceElement | SingleChoiceElement | RatingScaleElement | TextInputElement | DatePickerElement | SignatureElement | FileUploadElement;
|
|
1926
|
+
/**
|
|
1927
|
+
* Interface for document template
|
|
1928
|
+
*/
|
|
1929
|
+
interface DocumentTemplate {
|
|
1930
|
+
id: string;
|
|
1931
|
+
title: string;
|
|
1932
|
+
description?: string;
|
|
1933
|
+
createdAt: number;
|
|
1934
|
+
updatedAt: number;
|
|
1935
|
+
createdBy: string;
|
|
1936
|
+
elements: DocumentElement[];
|
|
1937
|
+
tags?: string[];
|
|
1938
|
+
isUserForm?: boolean;
|
|
1939
|
+
isRequired?: boolean;
|
|
1940
|
+
sortingOrder?: number;
|
|
1941
|
+
version: number;
|
|
1942
|
+
isActive: boolean;
|
|
1943
|
+
}
|
|
1944
|
+
/**
|
|
1945
|
+
* Interface for creating a new document template
|
|
1946
|
+
*/
|
|
1947
|
+
interface CreateDocumentTemplateData {
|
|
1948
|
+
title: string;
|
|
1949
|
+
description?: string;
|
|
1950
|
+
elements: Omit<DocumentElement, "id">[];
|
|
1951
|
+
tags?: string[];
|
|
1952
|
+
isUserForm?: boolean;
|
|
1953
|
+
isRequired?: boolean;
|
|
1954
|
+
sortingOrder?: number;
|
|
1955
|
+
}
|
|
1956
|
+
/**
|
|
1957
|
+
* Interface for updating an existing document template
|
|
1958
|
+
*/
|
|
1959
|
+
interface UpdateDocumentTemplateData {
|
|
1960
|
+
title?: string;
|
|
1961
|
+
description?: string;
|
|
1962
|
+
elements?: Omit<DocumentElement, "id">[];
|
|
1963
|
+
tags?: string[];
|
|
1964
|
+
isActive?: boolean;
|
|
1965
|
+
isUserForm?: boolean;
|
|
1966
|
+
isRequired?: boolean;
|
|
1967
|
+
sortingOrder?: number;
|
|
1968
|
+
}
|
|
1969
|
+
/**
|
|
1970
|
+
* Interface for a filled document (completed form)
|
|
1971
|
+
*/
|
|
1972
|
+
interface FilledDocument {
|
|
1973
|
+
id: string;
|
|
1974
|
+
templateId: string;
|
|
1975
|
+
templateVersion: number;
|
|
1976
|
+
isUserForm: boolean;
|
|
1977
|
+
isRequired: boolean;
|
|
1978
|
+
procedureId: string;
|
|
1979
|
+
appointmentId: string;
|
|
1980
|
+
patientId: string;
|
|
1981
|
+
practitionerId: string;
|
|
1982
|
+
clinicId: string;
|
|
1983
|
+
createdAt: number;
|
|
1984
|
+
updatedAt: number;
|
|
1985
|
+
values: {
|
|
1986
|
+
[elementId: string]: any;
|
|
1987
|
+
};
|
|
1988
|
+
status: FilledDocumentStatus;
|
|
1989
|
+
}
|
|
1990
|
+
/**
|
|
1991
|
+
* Enum for filled document status
|
|
1992
|
+
*/
|
|
1993
|
+
declare enum FilledDocumentStatus {
|
|
1994
|
+
DRAFT = "draft",
|
|
1995
|
+
SKIPPED = "skipped",
|
|
1996
|
+
PENDING = "pending",
|
|
1997
|
+
COMPLETED = "completed",// When doctor or patient completes the form
|
|
1998
|
+
SIGNED = "signed",// Only used for user forms
|
|
1999
|
+
REJECTED = "rejected"
|
|
2000
|
+
}
|
|
2001
|
+
|
|
1989
2002
|
/**
|
|
1990
2003
|
* Brend proizvoda ili opreme
|
|
1991
2004
|
* Predstavlja proizvođača ili dobavljača proizvoda i opreme koja se koristi u procedurama
|
|
@@ -4103,7 +4116,7 @@ declare class TechnologyService extends BaseService {
|
|
|
4103
4116
|
pre: Requirement[];
|
|
4104
4117
|
post: Requirement[];
|
|
4105
4118
|
};
|
|
4106
|
-
documentationTemplates?:
|
|
4119
|
+
documentationTemplates?: TechnologyDocumentationTemplate[] | undefined;
|
|
4107
4120
|
benefits: TreatmentBenefit[];
|
|
4108
4121
|
certificationRequirement: CertificationRequirement;
|
|
4109
4122
|
id: string;
|
|
@@ -6491,6 +6504,7 @@ declare class FilledDocumentService extends BaseService {
|
|
|
6491
6504
|
/**
|
|
6492
6505
|
* Create a new filled document within an appointment's subcollection.
|
|
6493
6506
|
* @param templateId - ID of the template to use.
|
|
6507
|
+
* @param templateVersion - Version of the template to use.
|
|
6494
6508
|
* @param appointmentId - ID of the appointment this form belongs to.
|
|
6495
6509
|
* @param procedureId - ID of the procedure associated with this form.
|
|
6496
6510
|
* @param patientId - ID of the patient.
|
|
@@ -6500,7 +6514,7 @@ declare class FilledDocumentService extends BaseService {
|
|
|
6500
6514
|
* @param initialStatus - Optional initial status for the form.
|
|
6501
6515
|
* @returns The created filled document.
|
|
6502
6516
|
*/
|
|
6503
|
-
createFilledDocumentForAppointment(templateId: string, appointmentId: string, procedureId: string, patientId: string, practitionerId: string, // Consider if this is always available or if a placeholder is needed
|
|
6517
|
+
createFilledDocumentForAppointment(templateId: string, templateVersion: number, appointmentId: string, procedureId: string, patientId: string, practitionerId: string, // Consider if this is always available or if a placeholder is needed
|
|
6504
6518
|
clinicId: string, // Same consideration as practitionerId
|
|
6505
6519
|
initialValues?: {
|
|
6506
6520
|
[elementId: string]: any;
|