@rinse-dental/open-dental 1.0.2 → 1.0.4

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.
Files changed (42) hide show
  1. package/dist/api/discountPlanSubs.d.ts +5 -5
  2. package/dist/api/discountPlanSubs.d.ts.map +1 -1
  3. package/dist/api/discountPlanSubs.js +20 -9
  4. package/dist/api/familyModules.d.ts +17 -0
  5. package/dist/api/familyModules.d.ts.map +1 -0
  6. package/dist/api/familyModules.js +24 -0
  7. package/dist/api/insSubs.d.ts +64 -0
  8. package/dist/api/insSubs.d.ts.map +1 -0
  9. package/dist/api/insSubs.js +114 -0
  10. package/dist/api/patFields.js +1 -1
  11. package/dist/api/patPlans.d.ts +48 -0
  12. package/dist/api/patPlans.d.ts.map +1 -0
  13. package/dist/api/patPlans.js +83 -0
  14. package/dist/api/procedureLog.d.ts +54 -39
  15. package/dist/api/procedureLog.d.ts.map +1 -1
  16. package/dist/api/procedureLog.js +76 -39
  17. package/dist/openDental.d.ts +10 -0
  18. package/dist/openDental.d.ts.map +1 -1
  19. package/dist/openDental.js +20 -0
  20. package/dist/types/familyModuleTypes.d.ts +33 -0
  21. package/dist/types/familyModuleTypes.d.ts.map +1 -0
  22. package/dist/types/familyModuleTypes.js +2 -0
  23. package/dist/types/insSubTypes.d.ts +62 -0
  24. package/dist/types/insSubTypes.d.ts.map +1 -0
  25. package/dist/types/insSubTypes.js +2 -0
  26. package/dist/types/patPlanTypes.d.ts +52 -0
  27. package/dist/types/patPlanTypes.d.ts.map +1 -0
  28. package/dist/types/patPlanTypes.js +2 -0
  29. package/dist/types/procedurelogTypes.d.ts +12 -0
  30. package/dist/types/procedurelogTypes.d.ts.map +1 -1
  31. package/package.json +1 -1
  32. package/src/api/discountPlanSubs.ts +33 -9
  33. package/src/api/familyModules.ts +28 -0
  34. package/src/api/insSubs.ts +155 -0
  35. package/src/api/patFields.ts +1 -1
  36. package/src/api/patPlans.ts +113 -0
  37. package/src/api/procedureLog.ts +96 -39
  38. package/src/openDental.ts +23 -0
  39. package/src/types/familyModuleTypes.ts +33 -0
  40. package/src/types/insSubTypes.ts +65 -0
  41. package/src/types/patPlanTypes.ts +55 -0
  42. package/src/types/procedurelogTypes.ts +41 -28
@@ -0,0 +1,155 @@
1
+ import HttpClient from "../utils/httpClient";
2
+ import {
3
+ InsSub,
4
+ GetInsSubsParams,
5
+ CreateInsSubParams,
6
+ UpdateInsSubParams,
7
+ } from "../types/insSubTypes";
8
+
9
+ export default class InsSubs {
10
+ private httpClient: HttpClient;
11
+
12
+ constructor(httpClient: HttpClient) {
13
+ this.httpClient = httpClient;
14
+ }
15
+
16
+ /**
17
+ * Fetch a single inssub by its ID.
18
+ * @param {number} InsSubNum - The unique identifier for the inssub.
19
+ * @returns {Promise<InsSub>} - The inssub object.
20
+ * @throws {Error} - If `InsSubNum` is not provided.
21
+ */
22
+ public async getInsSub(InsSubNum: number): Promise<InsSub> {
23
+ if (!InsSubNum) {
24
+ throw new Error("InsSubNum is required.");
25
+ }
26
+ return this.httpClient.get<InsSub>(`/inssubs/${InsSubNum}`);
27
+ }
28
+
29
+ /**
30
+ * Fetch multiple inssubs with optional filtering and pagination.
31
+ * @param {Object} params - The parameters for filtering and pagination.
32
+ * @param {number} [params.PlanNum] - The PlanNum of the InsPlan.
33
+ * @param {number} [params.Subscriber] - The PatNum of the patient who is subscribed to this plan.
34
+ * @param {string} [params.SecDateTEdit] - The last date the InsPlan was edited. Returns all InsSubs on or after this date.
35
+ * @param {number} [params.Offset] - Pagination offset for results.
36
+ * @returns {Promise<InsSub[]>} - A list of inssubs.
37
+ */
38
+ public async getInsSubs({
39
+ PlanNum,
40
+ Subscriber,
41
+ SecDateTEdit,
42
+ Offset,
43
+ }: GetInsSubsParams = {}): Promise<InsSub[]> {
44
+ const params = {
45
+ PlanNum,
46
+ Subscriber,
47
+ SecDateTEdit,
48
+ Offset,
49
+ };
50
+
51
+ return this.httpClient.get<InsSub[]>("/inssubs", params);
52
+ }
53
+
54
+ /**
55
+ * Create a new inssub.
56
+ * @param {Object} data - The details of InsSub to create.
57
+ * @param {number} data.PlanNum - Required. The PlanNum of the InsPlan.
58
+ * @param {number} data.Subscriber - Required. The PatNum of the patient who is subscribed to this plan.
59
+ * @param {string} data.SubscriberID - Required. Number assigned by insurance company.
60
+ * @param {string} [data.DateEffective] - Optional. The date this InsPlan became effective.
61
+ * @param {string} [data.DateTerm] - Optional. Not usually used. The date this InsPlan was terminated.
62
+ * @param {string} [data.BenefitNotes] - Optional. BenefitNotes are specifically designed to store automated notes. For example, when automatically requesting benefits through Trojan. Benefits are stored here in text form for later reference. Not at plan level because might be specific to subscriber. If blank, it may display a benefitNote for another subscriber to the plan.
63
+ * @param {"true" | "false"} [data.ReleaseInfo] - Optional. This is set to either "true" or "false". Default "true". This authorizes the release of information based on if there is a signature on file.
64
+ * @param {"true" | "false"} [data.AssignBen] - Optional. This is set to either "true" or "false". Default "true". This authorizes the release of information based on if there is a signature on file.
65
+ * @param {string} [data.SubscNote] - Optional. Use to store any other info that affects coverage.
66
+ * @returns {Promise<InsSub>} - The created inssub.
67
+ * @throws {Error} - If required fields are missing or the API returns an error.
68
+ */
69
+ public async createInsSub({
70
+ PlanNum,
71
+ Subscriber,
72
+ SubscriberID,
73
+ DateEffective,
74
+ DateTerm,
75
+ BenefitNotes,
76
+ ReleaseInfo,
77
+ AssignBen,
78
+ SubscNote,
79
+ } : CreateInsSubParams): Promise<InsSub> {
80
+ if (!PlanNum || !Subscriber || !SubscriberID) {
81
+ throw new Error("Invalid data: PlanNum, Subscriber, and SubscriberID are required.");
82
+ }
83
+
84
+ return this.httpClient.post<InsSub>("/inssubs", {
85
+ PlanNum,
86
+ Subscriber,
87
+ SubscriberID,
88
+ DateEffective,
89
+ DateTerm,
90
+ BenefitNotes,
91
+ ReleaseInfo,
92
+ AssignBen,
93
+ SubscNote,
94
+ });
95
+ }
96
+
97
+ /**
98
+ * Update an inssub.
99
+ * @param {Object} data - The details of InsSub to update.
100
+ * @param {number} data.InsSubNum - Required in the URL. The PK of the InsSub.
101
+ * @param {number} [data.PlanNum] - Optional. The PlanNum of the InsPlan.
102
+ * @param {number} [data.Subscriber] - Optional. The PatNum of the patient who is subscribed to this plan.
103
+ * @param {string} [data.SubscriberID] - Optional. Number assigned by insurance company.
104
+ * @param {string} [data.DateEffective] - Optional. The date this InsPlan became effective.
105
+ * @param {string} [data.DateTerm] - Optional. Not usually used. The date this InsPlan was terminated.
106
+ * @param {string} [data.BenefitNotes] - Optional. BenefitNotes are specifically designed to store automated notes. For example, when automatically requesting benefits through Trojan. Benefits are stored here in text form for later reference. Not at plan level because might be specific to subscriber. If blank, it may display a benefitNote for another subscriber to the plan.
107
+ * @param {"true" | "false"} [data.ReleaseInfo] - Optional. This is set to either "true" or "false". Default "true". This authorizes the release of information based on if there is a signature on file.
108
+ * @param {"true" | "false"} [data.AssignBen] - Optional. This is set to either "true" or "false". Default "true". This authorizes the release of information based on if there is a signature on file.
109
+ * @param {string} [data.SubscNote] - Optional. Use to store any other info that affects coverage.
110
+ * @returns {Promise<InsSub>} - The updated inssub.
111
+ * @throws {Error} - If required fields are missing or the API returns an error.
112
+ */
113
+ public async updateInsSub({
114
+ InsSubNum,
115
+ PlanNum,
116
+ Subscriber,
117
+ SubscriberID,
118
+ DateEffective,
119
+ DateTerm,
120
+ BenefitNotes,
121
+ ReleaseInfo,
122
+ AssignBen,
123
+ SubscNote,
124
+ } : UpdateInsSubParams): Promise<InsSub> {
125
+ if (!InsSubNum || typeof InsSubNum !== "number") {
126
+ throw new Error("Invalid data: A Valid InsSubNum is required.");
127
+ }
128
+
129
+ return this.httpClient.put<InsSub>(`/inssubs/${InsSubNum}`, {
130
+ PlanNum,
131
+ Subscriber,
132
+ SubscriberID,
133
+ DateEffective,
134
+ DateTerm,
135
+ BenefitNotes,
136
+ ReleaseInfo,
137
+ AssignBen,
138
+ SubscNote,
139
+ });
140
+ }
141
+
142
+ /**
143
+ * Delete an inssub entry. Will fail if any PatPlans exist. You can obtain the InsSubNum from FamilyModules GET Insurance.
144
+ * @param {number} InsSubNum - Required: The unique identifier of the inssub to delete.
145
+ * @returns {Promise<void>} - Resolves when the discount plan sub is deleted.
146
+ * @throws {Error} - If `InsSubNum` is not valid or the API returns an error.
147
+ */
148
+ public async deleteInsSub(InsSubNum: number): Promise<void> {
149
+ if (!InsSubNum || typeof InsSubNum !== "number") {
150
+ throw new Error("Invalid parameter: InsSubNum must be a valid number.");
151
+ }
152
+
153
+ return this.httpClient.delete<void>(`/inssubs/${InsSubNum}`);
154
+ }
155
+ }
@@ -104,7 +104,7 @@ export default class PatFields {
104
104
  */
105
105
  public async deletePatField(PatFieldNum: number): Promise<{ status: number }> {
106
106
  if (!PatFieldNum || typeof PatFieldNum !== "number") {
107
- throw new Error("Invalid parameter: PatNum must be a valid number.");
107
+ throw new Error("Invalid parameter: PatFieldNum must be a valid number.");
108
108
  }
109
109
 
110
110
  return await this.httpClient.delete<{ status: number }>(`/patfields/${PatFieldNum}`);
@@ -0,0 +1,113 @@
1
+ import HttpClient from "../utils/httpClient";
2
+ import {
3
+ PatPlan,
4
+ GetPatPlansParams,
5
+ CreatePatPlanParams,
6
+ UpdatePatPlanParams,
7
+ } from "../types/patPlanTypes";
8
+
9
+ export default class PatPlans {
10
+ private httpClient: HttpClient;
11
+
12
+ constructor(httpClient: HttpClient) {
13
+ this.httpClient = httpClient;
14
+ }
15
+
16
+ /**
17
+ * Fetch multiple patplans with optional filtering and pagination.
18
+ * @param {Object} params - The parameters for filtering and pagination.
19
+ * @param {number} [params.PatNum] - FK to patient.PatNum.
20
+ * @param {number} [params.InsSubNum] - FK to inssub.InsSubNum
21
+ * @param {number} [params.Offset] - Pagination offset for results.
22
+ * @returns {Promise<PatPlan[]>} - A list of patplans.
23
+ */
24
+ public async getPatPlans({
25
+ PatNum,
26
+ InsSubNum,
27
+ Offset,
28
+ }: GetPatPlansParams = {}): Promise<PatPlan[]> {
29
+ const params = {
30
+ PatNum,
31
+ InsSubNum,
32
+ Offset,
33
+ };
34
+
35
+ return this.httpClient.get<PatPlan[]>("/patplans", params);
36
+ }
37
+
38
+ /**
39
+ * This adds a PatPlan row to the database.
40
+ * @param {Object} data - The details of the patplan to create.
41
+ * @param {number} data.PatNum - Required. FK of patient
42
+ * @param {number} data.InsSubNum - Required. This requires that a valid InsSub is already in place. You can obtain the InsSubNum from FamilyModules GET Insurance, or you can obtain it from an InsSubs POST. If this plan is already linked to this InsSub, then response will be BadRequest.
43
+ * @param {string} [data.Ordinal] - Optional with a default of 1. This is a single digit numeric field (example: 1, 2, 3...). It represents the primary insurance, secondary insurance, etc. 0 is not used. If Ordinal is set to1, and there is already primary insurance, the other insurance will get bumped to Ordinal 2.
44
+ * @param {"Self" | "Spouse" | "Child" | "Employee" | "HandicapDep" | "SignifOther" | "InjuredPlantiff" | "LifePartner" | "Dependent"} [data.Relationship] - Optional. Default is Self. Values can be "Self", "Spouse", "Child", "Employee", "HandicapDep", "SignifOther", "InjuredPlantiff", "LifePartner" or "Dependent".
45
+ * @param {string} [data.PatID] - Optional. A patient ID which will override the subscriber ID on eclaims. Also used for Canada.
46
+ * @returns {Promise<PatPlan>} - The created patplan.
47
+ * @throws {Error} - If required fields are missing or the API returns an error.
48
+ */
49
+ public async createPatPlan({
50
+ PatNum,
51
+ InsSubNum,
52
+ Ordinal,
53
+ Relationship,
54
+ PatID,
55
+ } : CreatePatPlanParams): Promise<PatPlan> {
56
+ if (!PatNum || !InsSubNum) {
57
+ throw new Error("Invalid data: PatNum and InsSubNum are required.");
58
+ }
59
+
60
+ return this.httpClient.post<PatPlan>("/patplans", {
61
+ PatNum,
62
+ InsSubNum,
63
+ Ordinal,
64
+ Relationship,
65
+ PatID,
66
+ });
67
+ }
68
+
69
+ /**
70
+ * Update a PatPlan.
71
+ * @param {Object} data - The details of PatPlan to update.
72
+ * @param {number} data.PatPlanNum - Required. PK
73
+ * @param {number} [data.InsSubNum] - Optional. This corresponds to the Change button in the Subscriber Information section of the Insurance Plan window.
74
+ * @param {string} [data.Ordinal] - Optional. This is a single digit numeric field (example: 1, 2, 3...). It represents the primary insurance, secondary insurance, etc. 0 is not used. If Ordinal is set to1, and there is already primary insurance, the other insurance will get bumped to Ordinal 2.
75
+ * @param {"Self" | "Spouse" | "Child" | "Employee" | "HandicapDep" | "SignifOther" | "InjuredPlantiff" | "LifePartner" | "Dependent"} [data.Relationship] - Optional. Default is Self. Values can be "Self", "Spouse", "Child", "Employee", "HandicapDep", "SignifOther", "InjuredPlantiff", "LifePartner" or "Dependent".
76
+ * @param {string} [data.PatID] - Optional. A patient ID which will override the subscriber ID on eclaims. Also used for Canada.
77
+ * @returns {Promise<PatPlan>} - The updated patplan.
78
+ * @throws {Error} - If required fields are missing or the API returns an error.
79
+ */
80
+ public async updatePatPlan({
81
+ PatPlanNum,
82
+ InsSubNum,
83
+ Ordinal,
84
+ Relationship,
85
+ PatID,
86
+ } : UpdatePatPlanParams): Promise<PatPlan> {
87
+ if (!PatPlanNum || typeof PatPlanNum !== "number") {
88
+ throw new Error("Invalid data: A Valid PatPlanNum is required.");
89
+ }
90
+
91
+ return this.httpClient.put<PatPlan>(`/patplans/${PatPlanNum}`, {
92
+ InsSubNum,
93
+ Ordinal,
94
+ Relationship,
95
+ PatID,
96
+ });
97
+ }
98
+
99
+ /**
100
+ * Delete an PatPlan entry.
101
+ * This is called "Drop" in the Open Dental UI. This removes a PatPlan row from the database, indicating no coverage, but does not affect the InsPlan itself.
102
+ * @param {number} PatPlanNum - Required: The unique identifier of the inssub to delete.
103
+ * @returns {Promise<void>} - Resolves when the discount plan sub is deleted.
104
+ * @throws {Error} - If `PatPlanNum` is not valid or the API returns an error.
105
+ */
106
+ public async deletePatPlan(PatPlanNum: number): Promise<void> {
107
+ if (!PatPlanNum || typeof PatPlanNum !== "number") {
108
+ throw new Error("Invalid parameter: PatPlanNum must be a valid number.");
109
+ }
110
+
111
+ return this.httpClient.delete<void>(`/patplans/${PatPlanNum}`);
112
+ }
113
+ }
@@ -1,6 +1,7 @@
1
1
  import HttpClient from "../utils/httpClient";
2
2
  import {
3
3
  ProcedureLog,
4
+ GetProcedureLogParams,
4
5
  createProcedureLogParams,
5
6
  updateProcedureLogParams,
6
7
  InsuranceHistory,
@@ -29,16 +30,47 @@ export default class ProcedureLogs {
29
30
  return this.httpClient.get<ProcedureLog>(`/procedurelogs/${ProcNum}`);
30
31
  }
31
32
 
33
+ /**
34
+ * Fetch multiple procedurelogs with optional filtering and pagination.
35
+ * @param {Object} params - Filtering and pagination parameters.
36
+ * @param {number} [params.PatNum] - Get procedurelogs by PatNum
37
+ * @param {number} [params.AptNum] - Get procedurelogs by AptNum
38
+ * @param {number} [params.PlannedAptNum] - Get procedurelogs by PlannedAptNum
39
+ * @param {number} [params.ClinicNum] - Get procedurelogs by ClinicNum
40
+ * @param {string} [params.DateTStamp] - Get procedurelogs altered after the specified date and time
41
+ * @param {string} [params.Offset] - Pagination
42
+ * @returns {Promise<ProcedureLog[]>} - A list of procedurelogs.
43
+ * @throws {Error} - If the API returns an error.
44
+ */
45
+ public async getProcedureLogs({
46
+ PatNum,
47
+ AptNum,
48
+ PlannedAptNum,
49
+ ClinicNum,
50
+ DateTStamp,
51
+ Offset,
52
+ }: GetProcedureLogParams = {}): Promise<ProcedureLog[]> {
53
+
54
+ return await this.httpClient.get<ProcedureLog[]>("/procedurelogs", {
55
+ PatNum,
56
+ AptNum,
57
+ PlannedAptNum,
58
+ ClinicNum,
59
+ DateTStamp,
60
+ Offset,
61
+ });
62
+ }
63
+
32
64
  /**
33
65
  * Create a new procedure log entry.
34
- * @param {Object} params - The details of the procedure log to create.
35
- * @param {number} params.PatNum - Required: Patient number.
36
- * @param {string} params.ProcDate - Required: Procedure date in "yyyy-MM-dd" format.
37
- * @param {'TP' | 'C' | 'EO'} params.ProcStatus - Required: Procedure status.
38
- * @param {string} params.procCode - Required: Procedure code (D code).
39
- * @param {number} [params.AptNum] - Optional: Associated appointment number.
40
- * @param {number} [params.ProcFee] - Optional: Fee for the procedure.
41
- * @param {Surf} [Surf] - Optional: Tooth surface or treatment area. Options include:
66
+ * @param {Object} data - The details of the procedure log to create.
67
+ * @param {number} data.PatNum - Required: Patient number.
68
+ * @param {string} data.ProcDate - Required: Procedure date in "yyyy-MM-dd" format.
69
+ * @param {'TP' | 'C' | 'EO'} data.ProcStatus - Required: Procedure status.
70
+ * @param {string} data.procCode - Required: Procedure code (D code).
71
+ * @param {number} [data.AptNum] - Optional: Associated appointment number.
72
+ * @param {number} [data.ProcFee] - Optional: Fee for the procedure.
73
+ * @param {Surf} [data.Surf] - Optional: Tooth surface or treatment area. Options include:
42
74
  * - "B/F" (Buccal/Facial)
43
75
  * - "V" (Vestibular)
44
76
  * - "M" (Mesial)
@@ -57,13 +89,13 @@ export default class ProcedureLogs {
57
89
  * - "6" (Sextant 6)
58
90
  * - "U" (Upper Arch)
59
91
  * - "L" (Lower Arch)
60
- * @param {string} [params.ToothNum] - Optional: Tooth number.
61
- * @param {string} [params.ToothRange] - Optional: Tooth range.
62
- * @param {number} [params.Priority] - Optional: Priority code.
63
- * @param {number} [params.ProvNum] - Optional: Provider number.
64
- * @param {string} [params.Dx] - Optional: Diagnosis code.
65
- * @param {number} [params.PlannedAptNum] - Optional: Planned appointment number.
66
- * @param {number} [params.ClinicNum] - Optional: Clinic number.
92
+ * @param {string} [data.ToothNum] - Optional: Tooth number.
93
+ * @param {string} [data.ToothRange] - Optional: Tooth range.
94
+ * @param {number} [data.Priority] - Optional: Priority code.
95
+ * @param {number} [data.ProvNum] - Optional: Provider number.
96
+ * @param {string} [data.Dx] - Optional: Diagnosis code.
97
+ * @param {number} [data.PlannedAptNum] - Optional: Planned appointment number.
98
+ * @param {number} [data.ClinicNum] - Optional: Clinic number.
67
99
  * @returns {Promise<ProcedureLog>} - The created procedure log.
68
100
  * @throws {Error} - If required fields are missing or the API returns an error.
69
101
  */
@@ -72,7 +104,19 @@ export default class ProcedureLogs {
72
104
  ProcDate,
73
105
  ProcStatus,
74
106
  procCode,
75
- ...optionalData
107
+ AptNum,
108
+ ProcFee,
109
+ Surf,
110
+ ToothNum,
111
+ ToothRange,
112
+ Priority,
113
+ priority,
114
+ ProvNum,
115
+ Dx,
116
+ dxName,
117
+ PlannedAptNum,
118
+ ClinicNum,
119
+ //...optionalData
76
120
  }: createProcedureLogParams): Promise<ProcedureLog> {
77
121
  if (!PatNum || !ProcDate || !ProcStatus || !procCode) {
78
122
  throw new Error("Invalid data: PatNum, ProcDate, ProcStatus, and procCode are required.");
@@ -83,21 +127,32 @@ export default class ProcedureLogs {
83
127
  ProcDate,
84
128
  ProcStatus,
85
129
  procCode,
86
- ...optionalData,
130
+ AptNum,
131
+ ProcFee,
132
+ Surf,
133
+ ToothNum,
134
+ ToothRange,
135
+ Priority,
136
+ priority,
137
+ ProvNum,
138
+ Dx,
139
+ dxName,
140
+ PlannedAptNum,
141
+ ClinicNum,
87
142
  });
88
143
  }
89
144
 
90
145
  /**
91
146
  * Update an existing procedure log entry.
92
- * @param {number} ProcNum - Required: The unique identifier of the procedure log to update.
93
- * @param {Object} params - The updated details of the procedure log.
94
- * @param {string} [params.ProcDate] - Optional: Updated procedure date in "yyyy-MM-dd" format.
95
- * @param {number} [params.AptNum] - Optional: Updated associated appointment number.
96
- * @param {number} [params.ProcFee] - Optional: Updated fee for the procedure.
97
- * @param {number} [params.Priority] - Optional: Updated priority code.
98
- * @param {'TP' | 'C' | 'EO'} [params.ProcStatus] - Optional: Updated procedure status.
99
- * @param {string} [params.procCode] - Optional: Updated procedure code (D code).
100
- * @param {Surf} [Surf] - Optional: Tooth surface or treatment area. Options include:
147
+ * @param {Object} data - The updated details of the procedure log.
148
+ * @param {number} data.ProcNum - Required: The unique identifier of the procedure log to update.
149
+ * @param {string} [data.ProcDate] - Optional: Updated procedure date in "yyyy-MM-dd" format.
150
+ * @param {number} [data.AptNum] - Optional: Updated associated appointment number.
151
+ * @param {number} [data.ProcFee] - Optional: Updated fee for the procedure.
152
+ * @param {number} [data.Priority] - Optional: Updated priority code.
153
+ * @param {'TP' | 'C' | 'EO'} [data.ProcStatus] - Optional: Updated procedure status.
154
+ * @param {string} [data.procCode] - Optional: Updated procedure code (D code).
155
+ * @param {Surf} [data.Surf] - Optional: Tooth surface or treatment area. Options include:
101
156
  * - "B/F" (Buccal/Facial)
102
157
  * - "V" (Vestibular)
103
158
  * - "M" (Mesial)
@@ -116,18 +171,18 @@ export default class ProcedureLogs {
116
171
  * - "6" (Sextant 6)
117
172
  * - "U" (Upper Arch)
118
173
  * - "L" (Lower Arch)
119
- * @param {string} [params.ToothNum] - Optional: Updated tooth number.
120
- * @param {string} [params.ToothRange] - Optional: Updated tooth range.
121
- * @param {number} [params.ProvNum] - Optional: Updated provider number.
122
- * @param {string} [params.Dx] - Optional: Updated diagnosis code.
123
- * @param {number} [params.PlannedAptNum] - Optional: Updated planned appointment number.
124
- * @param {number} [params.ClinicNum] - Optional: Updated clinic number.
174
+ * @param {string} [data.ToothNum] - Optional: Updated tooth number.
175
+ * @param {string} [data.ToothRange] - Optional: Updated tooth range.
176
+ * @param {number} [data.ProvNum] - Optional: Updated provider number.
177
+ * @param {string} [data.Dx] - Optional: Updated diagnosis code.
178
+ * @param {number} [data.PlannedAptNum] - Optional: Updated planned appointment number.
179
+ * @param {number} [data.ClinicNum] - Optional: Updated clinic number.
125
180
  * @returns {Promise<ProcedureLog>} - The updated procedure log.
126
181
  * @throws {Error} - If required fields are missing or the API returns an error.
127
182
  */
128
183
  public async updateProcedureLog(
129
- ProcNum: number,
130
184
  {
185
+ ProcNum,
131
186
  ProcDate,
132
187
  AptNum,
133
188
  ProcFee,
@@ -180,8 +235,9 @@ export default class ProcedureLogs {
180
235
 
181
236
  /**
182
237
  * Fetch insurance history for a patient.
183
- * @param {number} PatNum - Required: The patient number.
184
- * @param {number} InsSubNum - Required: The insurance subscription number.
238
+ * @param {Object} params - the params to filter
239
+ * @param {number} params.PatNum - Required: The patient number.
240
+ * @param {number} params.InsSubNum - Required: The insurance subscription number.
185
241
  * @returns {Promise<InsuranceHistory[]>} - The insurance history details.
186
242
  * @throws {Error} - If required fields are missing or the API returns an error.
187
243
  */
@@ -201,10 +257,11 @@ export default class ProcedureLogs {
201
257
 
202
258
  /**
203
259
  * Add an insurance history entry.
204
- * @param {number} PatNum - Required: The patient number.
205
- * @param {number} InsSubNum - Required: The insurance subscription number.
206
- * @param {"InsHistBWCodes" | "InsHistPanoCodes" | "InsHistExamCodes" | "InsHistProphyCodes" | "InsHistPerioURCodes" | "InsHistPerioULCodes" | "InsHistPerioLRCodes" | "InsHistPerioLLCodes" | "InsHistPerioMaintCodes" | "InsHistDebridementCodes"} insHistPrefName - Required: The insurance history category name.
207
- * @param {string} ProcDate - Required: Procedure date in "yyyy-MM-dd" format.
260
+ * @param {Object} data - the insurance history object to create.
261
+ * @param {number} data.PatNum - Required: The patient number.
262
+ * @param {number} data.InsSubNum - Required: The insurance subscription number.
263
+ * @param {"InsHistBWCodes" | "InsHistPanoCodes" | "InsHistExamCodes" | "InsHistProphyCodes" | "InsHistPerioURCodes" | "InsHistPerioULCodes" | "InsHistPerioLRCodes" | "InsHistPerioLLCodes" | "InsHistPerioMaintCodes" | "InsHistDebridementCodes"} data.insHistPrefName - Required: The insurance history category name.
264
+ * @param {string} data.ProcDate - Required: Procedure date in "yyyy-MM-dd" format.
208
265
  * @returns {Promise<InsuranceHistory>} - The created insurance history entry.
209
266
  * @throws {Error} - If required fields are missing or the API returns an error.
210
267
  */
package/src/openDental.ts CHANGED
@@ -13,6 +13,8 @@ import Operatories from "./api/operatories";
13
13
  import Payments from "./api/payments";
14
14
  import Definitions from "./api/definitions";
15
15
  import DiscountPlanSubs from "./api/discountPlanSubs";
16
+ import FamilyModules from "./api/familyModules";
17
+ import InsSubs from "./api/insSubs";
16
18
 
17
19
  class OpenDental {
18
20
  private static httpClient: HttpClient;
@@ -161,6 +163,7 @@ class OpenDental {
161
163
  }
162
164
  return new Definitions(this.httpClient);
163
165
  }
166
+
164
167
  /**
165
168
  * Create a new instance of the DiscountPlanSubs API.
166
169
  */
@@ -170,6 +173,26 @@ class OpenDental {
170
173
  }
171
174
  return new DiscountPlanSubs(this.httpClient);
172
175
  }
176
+
177
+ /**
178
+ * Create a new instance of the FamilyModules API.
179
+ */
180
+ public static FamilyModules() {
181
+ if (!this.httpClient) {
182
+ throw new Error("OpenDental not initialized. Call OpenDental.initialize() first.");
183
+ }
184
+ return new FamilyModules(this.httpClient);
185
+ }
186
+
187
+ /**
188
+ * Create a new instance of the InsSub API.
189
+ */
190
+ public static InsSubs() {
191
+ if (!this.httpClient) {
192
+ throw new Error("OpenDental not initialized. Call OpenDental.initialize() first.");
193
+ }
194
+ return new InsSubs(this.httpClient);
195
+ }
173
196
  }
174
197
 
175
198
  export { OpenDental };
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Represents the insurance information for a patient similar to how it shows in the Family Module in Open Dental.
3
+ * @see https://www.opendental.com/site/apifamilymodules.html
4
+ */
5
+ export interface Insurance {
6
+ PatNum?: number; //PK to patient
7
+ InsSubNum?: number; //inssub.InsSubNum. Primary key to insurance subscriber.
8
+ Subscriber?: number; //inssub.Subscriber. The PatNum of the subscriber.
9
+ subscriber?: string; //First and last name of Subscriber from patient table.
10
+ SubscriberID?: string; //inssub.SubscriberID. Number assigned by insurance company, may be Medicaid ID.
11
+ SubscNote?: string; //inssub.SubscNote. Stores any other information that affects coverage.
12
+ PatPlanNum?: number; //patplan.PatPlanNum. Primary key to patient plan.
13
+ Ordinal?: number; //patplan.Ordinal. Numerical representation of the patient's insurance order. 1, 2, 3, etc.
14
+ ordinal?: string; //Description of Ordinal. Primary, Secondary, Medical, or Other insurance.
15
+ IsPending?: 'true' | 'false'; //patplan.IsPending. Informational only. true or false. Identifies insurance information that is incomplete or unverified.
16
+ Relationship?: string; //patplan.Relationship to subscriber. Self, Spouse, Child, Employee, HandicapDep, SignifOther, InjuredPlaintiff, LifePartner, or Dependant.
17
+ PatID?: string; //patplan.PatID. Optional patient ID which overrides Subscriber ID on eclaims.
18
+ CarrierNum?: number; //carrier.CarrierNum. Primary key to the carrier.
19
+ CarrierName?: string; //carrier.CarrierName. Full name of carrier.
20
+ PlanNum?: number; //insplan.PlanNum. Primary key to the insurance plan.
21
+ GroupName?: string; //insplan.GroupName. Each plan has a group name, typically similar to employer.
22
+ GroupNum?: string; //insplan.GroupNum. Issued by the carrier.
23
+ PlanNote?: string; //insplan.PlanNote. Notes specific to the subscriber and associated family members.
24
+ FeeSched?: number; //insplan.FeeSched, foreign key to feesched.FeeSchedNum.
25
+ feeSchedule?: string; //feesched.Description of the fee schedule.
26
+ PlanType?: string; //insplan.PlanType. ""=percentage, "p"=ppo percentage, "f"=flat copay, "c"=capitation.
27
+ planType?: string; //Description of PlanType. Category Percentage, PPO Fixed Benefit, PPO Percentage, Medicaid or Flat Co-pay, or Capitation.
28
+ CopayFeeSched?: number; //insplan.CopayFeeSched, foreign key to feesched.FeeSchedNum.
29
+ EmployerNum?: number; //insplan.EmployerNum, foreign key to employer.EmployerNum.
30
+ employer?: string; //employer.EmpName. Description of EmployerNum.
31
+ IsMedical?: 'true' | 'false'; // insplan.IsMedical. True if this is medical insurance rather than dental insurance.
32
+ }
33
+
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Represents an InsSub in the Open Dental system. Links an InsPlan to a Subscriber (patient.PatNum). Also, see PatPlans to indicate coverage.
3
+ * @see https://www.opendental.com/site/apiinssubs.html
4
+ */
5
+ export interface InsSub {
6
+ InsSubNum?: number; //PK
7
+ PlanNum?: number; //FK to insplan.plannnum
8
+ Subscriber?: number; //FK to patient.guarantor
9
+ DateEffective?: string; //String in "yyyy-MM-dd" format.
10
+ DateTerm?: string; //String in "yyyy-MM-dd" format.
11
+ SubscriberID?: string; //
12
+ BenefitNotes?: string; //
13
+ ReleaseInfo?: "true" | "false"; //
14
+ AssignBen?: "true" | "false"; //
15
+ SubscNote?: string; //
16
+ SecDateTEdit?: string; //String in "yyyy-MM-dd HH:mm:ss" format
17
+ }
18
+
19
+ /**
20
+ * Gets all InsSubs based on provided parameters. If no parameter is given, it will get all InsSubs ordered by InsSubNum.
21
+ * @see https://www.opendental.com/site/apiinssubs.html
22
+ */
23
+ export interface GetInsSubsParams {
24
+ PlanNum?: number; // Optional. The PlanNum of the InsPlan.
25
+ Subscriber?: number; // Optional. The PatNum of the patient who is subscribed to this plan.
26
+ SecDateTEdit?: string; // Optional. The last date the InsPlan was edited. Returns all InsSubs on or after this date.
27
+ Offset?: number; // Pagination offset for results
28
+ }
29
+
30
+ /**
31
+ * Parameters for creating an InsSub. This does not create a new insurance plan or change benefits.
32
+ * @see https://www.opendental.com/site/apiinssubs.html
33
+ */
34
+ export interface CreateInsSubParams {
35
+ PlanNum: number; // Required. The PlanNum of the InsPlan.
36
+ Subscriber: number; // Required. The PatNum of the patient who is subscribed to this plan.
37
+ SubscriberID: string; // Required. Number assigned by insurance company.
38
+ DateEffective?: string; // Optional. The date this InsPlan became effective.
39
+ DateTerm?: string; // Optional. Not usually used. The date this InsPlan was terminated.
40
+ BenefitNotes?: string; //Optional. Optional. BenefitNotes are specifically designed to store automated notes. For example, when automatically requesting benefits through Trojan. Benefits are stored here in text form for later reference. Not at plan level because might be specific to subscriber. If blank, it may display a benefitNote for another subscriber to the plan.
41
+ ReleaseInfo?: "true" | "false"; // Optional. This is set to either "true" or "false". Default "true". This authorizes the release of information based on if there is a signature on file.
42
+ AssignBen?: "true" | "false"; // Optional. Either "true" or "false". Default is according to global preference within Open Dental. This authorizes the assignment of benefits based on if there is a signature on file.
43
+ SubscNote?: string; // Optional. Use to store any other info that affects coverage.
44
+ }
45
+
46
+ /**
47
+ * Parameters for updating an InsSub. This can be used to assign a different PlanNum or Subscriber to this InsSub.
48
+ * None of these changes affect the InsSubNum, so all the PatPlans (coverage) for family members will continue to point to this InsSub and will be untouched.
49
+ * You can obtain the InsSubNum from FamilyModules GET Insurance.
50
+ * SecDateTEdit is updated automatically and cannot be set by developers.
51
+ * @see https://www.opendental.com/site/apiinssubs.html
52
+ */
53
+ export interface UpdateInsSubParams {
54
+ InsSubNum: number; // Required. PK of the record to update
55
+ PlanNum?: number; // Optional. The PlanNum of the InsPlan.
56
+ Subscriber?: number; // Optional. The PatNum of the patient who is subscribed to this plan.
57
+ SubscriberID: string; // Required. Number assigned by insurance company.
58
+ DateEffective?: string; // Optional. The date this InsPlan became effective.
59
+ DateTerm?: string; // Optional. Not usually used. The date this InsPlan was terminated.
60
+ BenefitNotes?: string; //Optional. Optional. BenefitNotes are specifically designed to store automated notes. For example, when automatically requesting benefits through Trojan. Benefits are stored here in text form for later reference. Not at plan level because might be specific to subscriber. If blank, it may display a benefitNote for another subscriber to the plan.
61
+ ReleaseInfo?: "true" | "false"; // Optional. This is set to either "true" or "false". Default "true". This authorizes the release of information based on if there is a signature on file.
62
+ AssignBen?: "true" | "false"; // Optional. Either "true" or "false". Default is according to global preference within Open Dental. This authorizes the assignment of benefits based on if there is a signature on file.
63
+ SubscNote?: string; // Optional. Use to store any other info that affects coverage.
64
+ }
65
+