@blackcode_sa/metaestetics-api 1.6.24 → 1.6.25
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 +126 -36
- package/dist/admin/index.mjs +126 -36
- 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 +271 -258
- package/dist/index.d.ts +271 -258
- package/dist/index.js +19 -14
- package/dist/index.mjs +19 -14
- package/package.json +1 -1
- package/src/admin/booking/booking.admin.ts +8 -5
- 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/types/procedure/index.ts +5 -2
package/dist/index.d.ts
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;
|
package/dist/index.js
CHANGED
|
@@ -8430,25 +8430,30 @@ var DocumentationTemplateService = class extends BaseService {
|
|
|
8430
8430
|
* @returns The template or null if not found
|
|
8431
8431
|
*/
|
|
8432
8432
|
async getTemplateById(templateId, version) {
|
|
8433
|
-
if (version !== void 0) {
|
|
8434
|
-
try {
|
|
8435
|
-
const versionTemplate = await this.getTemplateVersion(
|
|
8436
|
-
templateId,
|
|
8437
|
-
version
|
|
8438
|
-
);
|
|
8439
|
-
if (versionTemplate) {
|
|
8440
|
-
return versionTemplate;
|
|
8441
|
-
}
|
|
8442
|
-
} catch (error) {
|
|
8443
|
-
console.error(`Error getting template version ${version}:`, error);
|
|
8444
|
-
}
|
|
8445
|
-
}
|
|
8446
8433
|
const docRef = (0, import_firestore25.doc)(this.collectionRef, templateId);
|
|
8447
8434
|
const docSnap = await (0, import_firestore25.getDoc)(docRef);
|
|
8448
8435
|
if (!docSnap.exists()) {
|
|
8449
8436
|
return null;
|
|
8450
8437
|
}
|
|
8451
|
-
|
|
8438
|
+
const currentTemplate = docSnap.data();
|
|
8439
|
+
if (version === void 0) {
|
|
8440
|
+
return currentTemplate;
|
|
8441
|
+
}
|
|
8442
|
+
if (currentTemplate.version === version) {
|
|
8443
|
+
return currentTemplate;
|
|
8444
|
+
}
|
|
8445
|
+
try {
|
|
8446
|
+
const versionTemplate = await this.getTemplateVersion(
|
|
8447
|
+
templateId,
|
|
8448
|
+
version
|
|
8449
|
+
);
|
|
8450
|
+
if (versionTemplate) {
|
|
8451
|
+
return versionTemplate;
|
|
8452
|
+
}
|
|
8453
|
+
} catch (error) {
|
|
8454
|
+
console.error(`Error getting template version ${version}:`, error);
|
|
8455
|
+
}
|
|
8456
|
+
return null;
|
|
8452
8457
|
}
|
|
8453
8458
|
/**
|
|
8454
8459
|
* Update an existing document template
|
package/dist/index.mjs
CHANGED
|
@@ -8418,25 +8418,30 @@ var DocumentationTemplateService = class extends BaseService {
|
|
|
8418
8418
|
* @returns The template or null if not found
|
|
8419
8419
|
*/
|
|
8420
8420
|
async getTemplateById(templateId, version) {
|
|
8421
|
-
if (version !== void 0) {
|
|
8422
|
-
try {
|
|
8423
|
-
const versionTemplate = await this.getTemplateVersion(
|
|
8424
|
-
templateId,
|
|
8425
|
-
version
|
|
8426
|
-
);
|
|
8427
|
-
if (versionTemplate) {
|
|
8428
|
-
return versionTemplate;
|
|
8429
|
-
}
|
|
8430
|
-
} catch (error) {
|
|
8431
|
-
console.error(`Error getting template version ${version}:`, error);
|
|
8432
|
-
}
|
|
8433
|
-
}
|
|
8434
8421
|
const docRef = doc16(this.collectionRef, templateId);
|
|
8435
8422
|
const docSnap = await getDoc19(docRef);
|
|
8436
8423
|
if (!docSnap.exists()) {
|
|
8437
8424
|
return null;
|
|
8438
8425
|
}
|
|
8439
|
-
|
|
8426
|
+
const currentTemplate = docSnap.data();
|
|
8427
|
+
if (version === void 0) {
|
|
8428
|
+
return currentTemplate;
|
|
8429
|
+
}
|
|
8430
|
+
if (currentTemplate.version === version) {
|
|
8431
|
+
return currentTemplate;
|
|
8432
|
+
}
|
|
8433
|
+
try {
|
|
8434
|
+
const versionTemplate = await this.getTemplateVersion(
|
|
8435
|
+
templateId,
|
|
8436
|
+
version
|
|
8437
|
+
);
|
|
8438
|
+
if (versionTemplate) {
|
|
8439
|
+
return versionTemplate;
|
|
8440
|
+
}
|
|
8441
|
+
} catch (error) {
|
|
8442
|
+
console.error(`Error getting template version ${version}:`, error);
|
|
8443
|
+
}
|
|
8444
|
+
return null;
|
|
8440
8445
|
}
|
|
8441
8446
|
/**
|
|
8442
8447
|
* Update an existing document template
|
package/package.json
CHANGED
|
@@ -44,6 +44,7 @@ import {
|
|
|
44
44
|
USER_FORMS_SUBCOLLECTION,
|
|
45
45
|
DOCTOR_FORMS_SUBCOLLECTION,
|
|
46
46
|
} from "../../types/documentation-templates";
|
|
47
|
+
import { TechnologyDocumentationTemplate } from "../../backoffice/types/technology.types";
|
|
47
48
|
import {
|
|
48
49
|
ClinicInfo,
|
|
49
50
|
PractitionerProfileInfo,
|
|
@@ -539,12 +540,14 @@ export class BookingAdmin {
|
|
|
539
540
|
) {
|
|
540
541
|
pendingUserFormsIds = procedure.documentationTemplates
|
|
541
542
|
.filter(
|
|
542
|
-
(template:
|
|
543
|
+
(template: TechnologyDocumentationTemplate) =>
|
|
543
544
|
template.isUserForm && template.isRequired
|
|
544
545
|
)
|
|
545
|
-
.map(
|
|
546
|
+
.map(
|
|
547
|
+
(template: TechnologyDocumentationTemplate) => template.templateId
|
|
548
|
+
);
|
|
546
549
|
linkedFormIds = procedure.documentationTemplates.map(
|
|
547
|
-
(template:
|
|
550
|
+
(template: TechnologyDocumentationTemplate) => template.templateId
|
|
548
551
|
);
|
|
549
552
|
}
|
|
550
553
|
|
|
@@ -675,11 +678,11 @@ export class BookingAdmin {
|
|
|
675
678
|
procedure.documentationTemplates.length > 0
|
|
676
679
|
) {
|
|
677
680
|
const formInitResult =
|
|
678
|
-
this.documentManagerAdmin.
|
|
681
|
+
await this.documentManagerAdmin.batchInitializeAppointmentFormsFromTechnologyTemplates(
|
|
679
682
|
batch,
|
|
680
683
|
newAppointmentId,
|
|
681
684
|
procedure.id, // Pass the actual procedureId for the forms
|
|
682
|
-
procedure.documentationTemplates
|
|
685
|
+
procedure.documentationTemplates,
|
|
683
686
|
data.patientId,
|
|
684
687
|
procedure.practitionerId,
|
|
685
688
|
procedure.clinicBranchId,
|