@rinse-dental/open-dental 1.1.0 → 1.3.0
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/api/benefits.d.ts +62 -0
- package/dist/api/benefits.d.ts.map +1 -0
- package/dist/api/benefits.js +111 -0
- package/dist/api/insPlans.d.ts +62 -0
- package/dist/api/insPlans.d.ts.map +1 -0
- package/dist/api/insPlans.js +112 -0
- package/dist/api/patPlans.d.ts +2 -2
- package/dist/api/patPlans.js +2 -2
- package/dist/api/refAttaches.d.ts +57 -0
- package/dist/api/refAttaches.d.ts.map +1 -0
- package/dist/api/refAttaches.js +102 -0
- package/dist/api/referrals.d.ts +84 -0
- package/dist/api/referrals.d.ts.map +1 -0
- package/dist/api/referrals.js +156 -0
- package/dist/openDental.d.ts +22 -1
- package/dist/openDental.d.ts.map +1 -1
- package/dist/openDental.js +42 -1
- package/dist/types/benefitTypes.d.ts +67 -0
- package/dist/types/benefitTypes.d.ts.map +1 -0
- package/dist/types/benefitTypes.js +2 -0
- package/dist/types/insPlanTypes.d.ts +69 -0
- package/dist/types/insPlanTypes.d.ts.map +1 -0
- package/dist/types/insPlanTypes.js +2 -0
- package/dist/types/refAttachTypes.d.ts +59 -0
- package/dist/types/refAttachTypes.d.ts.map +1 -0
- package/dist/types/refAttachTypes.js +2 -0
- package/dist/types/referralTypes.d.ts +98 -0
- package/dist/types/referralTypes.d.ts.map +1 -0
- package/dist/types/referralTypes.js +2 -0
- package/package.json +1 -1
- package/release.sh +1 -1
- package/src/api/benefits.ts +155 -0
- package/src/api/insPlans.ts +158 -0
- package/src/api/patPlans.ts +2 -2
- package/src/api/refAttaches.ts +142 -0
- package/src/api/referrals.ts +222 -0
- package/src/openDental.ts +45 -1
- package/src/types/benefitTypes.ts +70 -0
- package/src/types/insPlanTypes.ts +72 -0
- package/src/types/refAttachTypes.ts +63 -0
- package/src/types/referralTypes.ts +102 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents an Referral in the Open Dental system. These can be either a provider, patient, or non-person. The description of non-patient sources is stored in the LName field.
|
|
3
|
+
* @see https://www.opendental.com/site/apireferrals.html
|
|
4
|
+
*/
|
|
5
|
+
export interface Referral {
|
|
6
|
+
ReferralNum?: number;
|
|
7
|
+
LName?: string;
|
|
8
|
+
FName?: string;
|
|
9
|
+
MName?: string;
|
|
10
|
+
SSN?: string;
|
|
11
|
+
UsingTIN?: "true" | "false";
|
|
12
|
+
Specialty?: number;
|
|
13
|
+
specialty?: string;
|
|
14
|
+
ST?: string;
|
|
15
|
+
Telephone?: string;
|
|
16
|
+
Address?: string;
|
|
17
|
+
Address2?: string;
|
|
18
|
+
City?: number;
|
|
19
|
+
Zip?: string;
|
|
20
|
+
Note?: string;
|
|
21
|
+
Phone2?: string;
|
|
22
|
+
IsHidden?: "true" | "false";
|
|
23
|
+
NotPerson?: string;
|
|
24
|
+
Title?: string;
|
|
25
|
+
EMail?: string;
|
|
26
|
+
PatNum?: string;
|
|
27
|
+
IsDoctor?: "true" | "false";
|
|
28
|
+
DateTStamp?: string;
|
|
29
|
+
IsPreferred?: "true" | "false";
|
|
30
|
+
BusinessName?: string;
|
|
31
|
+
DisplayNote?: string;
|
|
32
|
+
isPatient?: "true" | "false";
|
|
33
|
+
}
|
|
34
|
+
export interface GetReferralsParams {
|
|
35
|
+
IsHidden?: "true" | "false";
|
|
36
|
+
NotPerson?: "true" | "false";
|
|
37
|
+
IsDoctor?: "true" | "false";
|
|
38
|
+
IsPreferred?: "true" | "false";
|
|
39
|
+
isPatient?: "true" | "false";
|
|
40
|
+
BusinessName?: string;
|
|
41
|
+
Offset?: number;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Creates a new Referral. Referrals can be for patients (provide PatNum), providers (provide specialty) or non-persons (provide neither PatNum or specialty).
|
|
45
|
+
* In the last case, isPatient and IsDoctor will be set false automatically while NotPerson will be set to true.
|
|
46
|
+
* If you wish to create an associated RefAttach please see RefAttaches POST.
|
|
47
|
+
*/
|
|
48
|
+
export interface CreateReferralParams {
|
|
49
|
+
LName?: string;
|
|
50
|
+
PatNum?: string;
|
|
51
|
+
FName?: string;
|
|
52
|
+
MName?: string;
|
|
53
|
+
SSN?: string;
|
|
54
|
+
UsingTIN?: "true" | "false";
|
|
55
|
+
Specialty?: number;
|
|
56
|
+
specialty?: string;
|
|
57
|
+
ST?: string;
|
|
58
|
+
Telephone?: string;
|
|
59
|
+
Address?: string;
|
|
60
|
+
Address2?: string;
|
|
61
|
+
City?: string;
|
|
62
|
+
Zip?: string;
|
|
63
|
+
Note?: string;
|
|
64
|
+
Phone2?: string;
|
|
65
|
+
NotPerson?: string;
|
|
66
|
+
Title?: string;
|
|
67
|
+
EMail?: string;
|
|
68
|
+
IsDoctor?: "true" | "false";
|
|
69
|
+
BusinessName?: string;
|
|
70
|
+
DisplayNote?: string;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Updates an existing Referral. All fields are optional. Referrals for a patient can only have the Note and DisplayNote fields modified.
|
|
74
|
+
*/
|
|
75
|
+
export interface UpdateReferralParams {
|
|
76
|
+
ReferralNum?: number;
|
|
77
|
+
LName?: string;
|
|
78
|
+
FName?: string;
|
|
79
|
+
MName?: string;
|
|
80
|
+
SSN?: string;
|
|
81
|
+
UsingTIN?: "true" | "false";
|
|
82
|
+
Specialty?: number;
|
|
83
|
+
ST?: string;
|
|
84
|
+
Telephone?: string;
|
|
85
|
+
Address?: string;
|
|
86
|
+
Address2?: string;
|
|
87
|
+
City?: number;
|
|
88
|
+
Zip?: string;
|
|
89
|
+
Note?: string;
|
|
90
|
+
Phone2?: string;
|
|
91
|
+
NotPerson?: string;
|
|
92
|
+
Title?: string;
|
|
93
|
+
EMail?: string;
|
|
94
|
+
IsDoctor?: "true" | "false";
|
|
95
|
+
BusinessName?: string;
|
|
96
|
+
DisplayNote?: string;
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=referralTypes.d.ts.map
|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AM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
|
package/package.json
CHANGED
package/release.sh
CHANGED
|
@@ -41,5 +41,5 @@ gh release create "$NEW_TAG" --title "Release $NEW_TAG" --notes "$COMMIT_MSG"
|
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
#example ./release.sh "Some commit message" patch
|
|
44
|
-
#example ./release.sh "
|
|
44
|
+
#example ./release.sh "Added insplans and benefits" minor
|
|
45
45
|
#example ./release.sh "Some commit message" major
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import HttpClient from "../utils/httpClient";
|
|
2
|
+
import {
|
|
3
|
+
Benefit,
|
|
4
|
+
GetBenefitsParams,
|
|
5
|
+
CreateBenefitParams,
|
|
6
|
+
UpdateBenefitParams,
|
|
7
|
+
} from "../types/benefitTypes";
|
|
8
|
+
|
|
9
|
+
export default class Benefits {
|
|
10
|
+
private httpClient: HttpClient;
|
|
11
|
+
|
|
12
|
+
constructor(httpClient: HttpClient) {
|
|
13
|
+
this.httpClient = httpClient;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Fetch multiple benefits with optional filtering and pagination.
|
|
18
|
+
* @param {Object} params - The parameters for filtering and pagination.
|
|
19
|
+
* @param {number} [params.PlanNum] - FK to InsPlan.PlanNum.
|
|
20
|
+
* @param {number} [params.PatPlanNum] - FK to PatPlan.PatPlanNum.
|
|
21
|
+
* @param {number} [params.Offset] - Pagination offset for results.
|
|
22
|
+
* @returns {Promise<Benefit[]>} - A list of benefits.
|
|
23
|
+
*/
|
|
24
|
+
public async getBenefits({
|
|
25
|
+
PlanNum,
|
|
26
|
+
PatPlanNum,
|
|
27
|
+
Offset,
|
|
28
|
+
}: GetBenefitsParams = {}): Promise<Benefit[]> {
|
|
29
|
+
const params = {
|
|
30
|
+
PlanNum,
|
|
31
|
+
PatPlanNum,
|
|
32
|
+
Offset,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
return this.httpClient.get<Benefit[]>("/benefits", params);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* This adds a Benefit row to the database.
|
|
40
|
+
* @param {Object} data - The details of the Benefit to create.
|
|
41
|
+
* @param {number} data.PlanNum - This or PatPlanNum is required. FK to InsPlan.PlanNum.
|
|
42
|
+
* @param {number} data.PatPlanNum - This or PlanNum is required. FK to PatPlan.PlanNum.
|
|
43
|
+
* @param {"ActiveCoverage" | "CoInsurance" | "Deductible" | "CoPayment" | "Exclusions" | "Limitations" | "WaitingPeriod"} data.BenefitType - Required. Either "ActiveCoverage", "CoInsurance", "Deductible", "CoPayment", "Exclusions", "Limitations", or "WaitingPeriod".
|
|
44
|
+
* @param {"None" | "Individual" | "Family"} data.CoverageLevel - Required. Either "None", "Individual", or "Family".
|
|
45
|
+
* @param {number} [data.CovCatNum] - Optional. FK to covcat.CovCatNum.
|
|
46
|
+
* @param {number} [data.Percent] - Optional. Only allowed if BenefitType is "CoInsurance". Must be a value between 0 and 100. Default -1 (Indicating empty).
|
|
47
|
+
* @param {number} [data.MonetaryAmt] - Optional. Only used if BenefitType is "CoPayment", "Limitations", or "Deductible". Default -1.0 (Indicating empty).
|
|
48
|
+
* @param {"None" | "ServiceYear" | "CalendarYear" | "Lifetime" | "Years" | "NumberInLast12Months"} [data.TimePeriod] - Optional. Either "None", "ServiceYear", "CalendarYear", "Lifetime", "Years", or "NumberInLast12Months". Default "CalendarYear".
|
|
49
|
+
* @param {"None" | "NumberOfServices" | "AgeLimit" | "Visits" | "Years" | "Months"} [data.QuantityQualifier] - Optional. Either "None", "NumberOfServices", "AgeLimit", "Visits", "Years", or "Months". Default "None". Must be "Months" or "Years" if BenefitType is "WaitingPeriod".
|
|
50
|
+
* @param {number} [data.Quantity] - Optional. Must be a value between 0 and 100. Default 0. Must be a value greater than 0 if QuantityQualifier is "AgeLimit".
|
|
51
|
+
* @param {number} [data.CodeNum] - Optional. FK to procedurecode.CodeNum. Only allowed if CovCatNum is 0. Will be used over procCode if both are specified. Default 0.
|
|
52
|
+
* @param {string} [data.procCode] - Optional. FK to procedurecode.ProcCode. Only allowed if CovCatNum is 0. Default empty string.
|
|
53
|
+
* @param {number} [data.CodeGroupNum] - Optional. (Added in version 23.2.62) FK to codegroup.CodeGroupNum. The group of procedure codes that apply to this Frequency Limitation benefit.
|
|
54
|
+
* @returns {Promise<Benefit>} - The created a benefit.
|
|
55
|
+
* @throws {Error} - If required fields are missing or the API returns an error.
|
|
56
|
+
*/
|
|
57
|
+
public async createBenefit({
|
|
58
|
+
PlanNum,
|
|
59
|
+
PatPlanNum,
|
|
60
|
+
BenefitType,
|
|
61
|
+
CoverageLevel,
|
|
62
|
+
CovCatNum,
|
|
63
|
+
Percent,
|
|
64
|
+
MonetaryAmt,
|
|
65
|
+
TimePeriod,
|
|
66
|
+
QuantityQualifier,
|
|
67
|
+
Quantity,
|
|
68
|
+
CodeNum,
|
|
69
|
+
procCode,
|
|
70
|
+
CodeGroupNum,
|
|
71
|
+
} : CreateBenefitParams): Promise<Benefit> {
|
|
72
|
+
if (!BenefitType || !CoverageLevel) {
|
|
73
|
+
throw new Error("Invalid data: Either PlanNum or PatPlanNum and BenefitType and CoverageLevel are required.");
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return this.httpClient.post<Benefit>("/benefits", {
|
|
77
|
+
PlanNum,
|
|
78
|
+
PatPlanNum,
|
|
79
|
+
BenefitType,
|
|
80
|
+
CoverageLevel,
|
|
81
|
+
CovCatNum,
|
|
82
|
+
Percent,
|
|
83
|
+
MonetaryAmt,
|
|
84
|
+
TimePeriod,
|
|
85
|
+
QuantityQualifier,
|
|
86
|
+
Quantity,
|
|
87
|
+
CodeNum,
|
|
88
|
+
procCode,
|
|
89
|
+
CodeGroupNum,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Update a Benefit.
|
|
95
|
+
* @param {Object} data - The details of Benefit to update.
|
|
96
|
+
* @param {number} data.BenefitNum - Required. PK
|
|
97
|
+
* @param {number} [data.CovCatNum] - Optional. FK to covcat.CovCatNum.
|
|
98
|
+
* @param {"ActiveCoverage" | "CoInsurance" | "Deductible" | "CoPayment" | "Exclusions" | "Limitations" | "WaitingPeriod"} [data.BenefitType] - Optional. Either "ActiveCoverage", "CoInsurance", "Deductible", "CoPayment", "Exclusions", "Limitations", or "WaitingPeriod".
|
|
99
|
+
* @param {number} [data.Percent] - Optional. Only allowed if BenefitType is "CoInsurance". Must be a value between 0 and 100. Default -1 (Indicating empty).
|
|
100
|
+
* @param {number} [data.MonetaryAmt] - Optional. Only used if BenefitType is "CoPayment", "Limitations", or "Deductible". Default -1.0 (Indicating empty).
|
|
101
|
+
* @param {"None" | "ServiceYear" | "CalendarYear" | "Lifetime" | "Years" | "NumberInLast12Months"} [data.TimePeriod] - Optional. Either "None", "ServiceYear", "CalendarYear", "Lifetime", "Years", or "NumberInLast12Months". Default "CalendarYear".
|
|
102
|
+
* @param {"None" | "NumberOfServices" | "AgeLimit" | "Visits" | "Years" | "Months"} [data.QuantityQualifier] - Optional. Either "None", "NumberOfServices", "AgeLimit", "Visits", "Years", or "Months". Default "None". Must be "Months" or "Years" if BenefitType is "WaitingPeriod".
|
|
103
|
+
* @param {number} [data.Quantity] - Optional. Must be a value between 0 and 100. Default 0. Must be a value greater than 0 if QuantityQualifier is "AgeLimit".
|
|
104
|
+
* @param {number} [data.CodeNum] - Optional. FK to procedurecode.CodeNum. Only allowed if CovCatNum is 0. Will be used over procCode if both are specified.
|
|
105
|
+
* @param {string} [data.procCode] - Optional. FK to procedurecode.ProcCode. Only allowed if CovCatNum is 0.
|
|
106
|
+
* @param {"None" | "Individual" | "Family"} [data.CoverageLevel] - Optional. Either "None", "Individual", or "Family".
|
|
107
|
+
* @returns {Promise<Benefit>} - The updated Benefit.
|
|
108
|
+
* @throws {Error} - If required fields are missing or the API returns an error.
|
|
109
|
+
*/
|
|
110
|
+
public async updateBenefit({
|
|
111
|
+
BenefitNum,
|
|
112
|
+
CovCatNum,
|
|
113
|
+
BenefitType,
|
|
114
|
+
Percent,
|
|
115
|
+
MonetaryAmt,
|
|
116
|
+
TimePeriod,
|
|
117
|
+
QuantityQualifier,
|
|
118
|
+
Quantity,
|
|
119
|
+
CodeNum,
|
|
120
|
+
procCode,
|
|
121
|
+
CoverageLevel,
|
|
122
|
+
} : UpdateBenefitParams): Promise<Benefit> {
|
|
123
|
+
if (!BenefitNum || typeof BenefitNum !== "number") {
|
|
124
|
+
throw new Error("Invalid data: A Valid BenefitNum is required.");
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return this.httpClient.put<Benefit>(`/benefits/${BenefitNum}`, {
|
|
128
|
+
CovCatNum,
|
|
129
|
+
BenefitType,
|
|
130
|
+
Percent,
|
|
131
|
+
MonetaryAmt,
|
|
132
|
+
TimePeriod,
|
|
133
|
+
QuantityQualifier,
|
|
134
|
+
Quantity,
|
|
135
|
+
CodeNum,
|
|
136
|
+
procCode,
|
|
137
|
+
CoverageLevel,
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Delete a Benefit entry.
|
|
143
|
+
* This removes a Benefit row from the database.
|
|
144
|
+
* @param {number} BenefitNum - Required: The unique identifier of the Benefit to delete.
|
|
145
|
+
* @returns {Promise<void>} - Resolves when the Benefit is deleted.
|
|
146
|
+
* @throws {Error} - If `BenefitNum` is not valid or the API returns an error.
|
|
147
|
+
*/
|
|
148
|
+
public async deletePatPlan(BenefitNum: number): Promise<void> {
|
|
149
|
+
if (!BenefitNum || typeof BenefitNum !== "number") {
|
|
150
|
+
throw new Error("Invalid parameter: BenefitNum must be a valid number.");
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return this.httpClient.delete<void>(`/benefits/${BenefitNum}`);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import HttpClient from "../utils/httpClient";
|
|
2
|
+
import {
|
|
3
|
+
InsPlan,
|
|
4
|
+
GetInsPlansParams,
|
|
5
|
+
CreateInsPlanParams,
|
|
6
|
+
UpdateInsPlanParams,
|
|
7
|
+
} from "../types/insPlanTypes";
|
|
8
|
+
|
|
9
|
+
export default class InsPlans {
|
|
10
|
+
private httpClient: HttpClient;
|
|
11
|
+
|
|
12
|
+
constructor(httpClient: HttpClient) {
|
|
13
|
+
this.httpClient = httpClient;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Fetch a single insplan by its ID.
|
|
18
|
+
* @param {number} PlanNum - The ID of the insplan.
|
|
19
|
+
* @returns {Promise<InsPlan>} - The insplan data.
|
|
20
|
+
* @throws {Error} - If `InsPlan` is not valid or the API returns an error.
|
|
21
|
+
*/
|
|
22
|
+
public async getInsPlan(PlanNum: number): Promise<InsPlan> {
|
|
23
|
+
if (!PlanNum || typeof PlanNum !== "number") {
|
|
24
|
+
throw new Error("Invalid parameter: PlanNum must be a valid number.");
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return await this.httpClient.get<InsPlan>(`/insplans/${PlanNum}`);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Fetch multiple insplans with optional filtering and pagination.
|
|
33
|
+
* @param {Object} params - The parameters for filtering and pagination.
|
|
34
|
+
* @param {"percentage" | "p" | "f" | "c" } [params.PlanType] - Must be one of the following: "percentage" (Percentage), "p" (PPO Percentage), "f" (Flat Copay), or "c" (Capitation). Percentage PlanTypes are stored as blank in the database.
|
|
35
|
+
* @param {number} [params.CarrierNum] - FK to carrier.CarrierNum.
|
|
36
|
+
* @param {number} [params.Offset] - Pagination offset for results.
|
|
37
|
+
* @returns {Promise<InsPlan[]>} - A list of InsPlans.
|
|
38
|
+
*/
|
|
39
|
+
public async getInsPlans({
|
|
40
|
+
PlanType,
|
|
41
|
+
CarrierNum,
|
|
42
|
+
Offset,
|
|
43
|
+
}: GetInsPlansParams = {}): Promise<InsPlan[]> {
|
|
44
|
+
const params = {
|
|
45
|
+
PlanType,
|
|
46
|
+
CarrierNum,
|
|
47
|
+
Offset,
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
return this.httpClient.get<InsPlan[]>("/insplans", params);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* This adds an InsPlan row to the database.
|
|
55
|
+
* @param {Object} data - The details of the insplan to create.
|
|
56
|
+
* @param {number} data.CarrierNum - Required. FK to carrier.CarrierNum.
|
|
57
|
+
* @param {string} [data.GroupName] - Optional. Typically the same as the employer. Used to identify difference in plans.
|
|
58
|
+
* @param {string} [data.GroupNum] - Optional. The carrier assigned identifier, unique for each plan.
|
|
59
|
+
* @param {string} [data.PlanNote] - Optional. Note for this plan. Same for all subscribers.
|
|
60
|
+
* @param {number} [data.FeeSched] - Optional. FK to feesched.FeeSchedNum. Default 0.
|
|
61
|
+
* @param {"" | "p" | "f" | "c"} [data.PlanType] - Optional. Either "" (Percentage), "p" (PPO Percentage), "f" (Flat Copay), or "c". Default is "" (Percentage).
|
|
62
|
+
* @param {number} [data.CopayFeeSched] - Optional. FK to feesched.FeeSchedNum when FeeSchedType is CoPay. Typically only used for capitation or copay plans. Default 0.
|
|
63
|
+
* @param {number} [data.EmployerNum] - Optional. FK to employer.EmployerNum. Default 0.
|
|
64
|
+
* @param {"true" | "false"} [data.CodeSubstNone] - Optional. Either "true" or "false". Set "true" if this Insurance Plan should ignore any Substitution Codes. Default "false".
|
|
65
|
+
* @param {"true" | "false"} [data.IsHidden] - ?: "true" | "false"; // Optional. Either "true" or "false". Default "false".
|
|
66
|
+
* @param {number} [data.MonthRenew] - Optional. The month, 1-12, when the insurance plan renews. It will renew on the first of the month. Default 0 to indicate calendar year.
|
|
67
|
+
* @param {"true" | "false"} [data.IsBlueBookEnabled] - Optional. Determines if the plan utilizes BlueBook or not. Cannot be set to true if PlanType is set to anything other than "" (Percentage). Defaults to true if AllowedFeeSchedsAutomate is set to BlueBook, otherwise defaults to false.
|
|
68
|
+
* @returns {Promise<InsPlan>} - The created insplan.
|
|
69
|
+
* @throws {Error} - If required fields are missing or the API returns an error.
|
|
70
|
+
*/
|
|
71
|
+
public async createInsPlan({
|
|
72
|
+
CarrierNum,
|
|
73
|
+
GroupName,
|
|
74
|
+
GroupNum,
|
|
75
|
+
PlanNote,
|
|
76
|
+
FeeSched,
|
|
77
|
+
PlanType,
|
|
78
|
+
CopayFeeSched,
|
|
79
|
+
EmployerNum,
|
|
80
|
+
CodeSubstNone,
|
|
81
|
+
IsHidden,
|
|
82
|
+
MonthRenew,
|
|
83
|
+
IsBlueBookEnabled,
|
|
84
|
+
} : CreateInsPlanParams): Promise<InsPlan> {
|
|
85
|
+
if (!CarrierNum) {
|
|
86
|
+
throw new Error("Invalid data: CarrierNum is required.");
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return this.httpClient.post<InsPlan>("/insplans", {
|
|
90
|
+
CarrierNum,
|
|
91
|
+
GroupName,
|
|
92
|
+
GroupNum,
|
|
93
|
+
PlanNote,
|
|
94
|
+
FeeSched,
|
|
95
|
+
PlanType,
|
|
96
|
+
CopayFeeSched,
|
|
97
|
+
EmployerNum,
|
|
98
|
+
CodeSubstNone,
|
|
99
|
+
IsHidden,
|
|
100
|
+
MonthRenew,
|
|
101
|
+
IsBlueBookEnabled,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Update a InsPlan.
|
|
107
|
+
* @param {Object} data - The details of InsPlan to update.
|
|
108
|
+
* @param {number} data.PlanNum - Required. Primary key.
|
|
109
|
+
* @param {string} [data.GroupName] - Optional. Typically the same as the employer. Used to identify difference in plans.
|
|
110
|
+
* @param {string} [data.GroupNum] - Optional. The carrier assigned identifier, unique for each plan.
|
|
111
|
+
* @param {string} [data.PlanNote] - Optional. Note for this plan. Same for all subscribers.
|
|
112
|
+
* @param {number} [data.FeeSched] - Optional. FK to feesched.FeeSchedNum. Default 0.
|
|
113
|
+
* @param {"" | "p" | "f" | "c"} [data.PlanType] - Optional. Either "" (Percentage), "p" (PPO Percentage), "f" (Flat Copay), or "c". Default is "" (Percentage).
|
|
114
|
+
* @param {number} [data.CopayFeeSched] - Optional. FK to feesched.FeeSchedNum when FeeSchedType is CoPay. Typically only used for capitation or copay plans. Default 0.
|
|
115
|
+
* @param {number} [data.EmployerNum] - Optional. FK to employer.EmployerNum. Default 0.
|
|
116
|
+
* @param {number} [data.CarrierNum] - Optional. FK to carrier.CarrierNum.
|
|
117
|
+
* @param {"true" | "false"} [data.CodeSubstNone] - Optional. Either "true" or "false". Set "true" if this Insurance Plan should ignore any Substitution Codes. Default "false".
|
|
118
|
+
* @param {"true" | "false"} [data.IsHidden] - ?: "true" | "false"; // Optional. Either "true" or "false". Default "false".
|
|
119
|
+
* @param {number} [data.MonthRenew] - Optional. The month, 1-12, when the insurance plan renews. It will renew on the first of the month. Default 0 to indicate calendar year.
|
|
120
|
+
* @param {"true" | "false"} [data.IsBlueBookEnabled] - Optional. Determines if the plan utilizes BlueBook or not. Cannot be set to true if PlanType is set to anything other than "" (Percentage). Defaults to true if AllowedFeeSchedsAutomate is set to BlueBook, otherwise defaults to false.
|
|
121
|
+
* @returns {Promise<InsPlan>} - The updated InsPlan.
|
|
122
|
+
* @throws {Error} - If required fields are missing or the API returns an error.
|
|
123
|
+
*/
|
|
124
|
+
public async updateInsPlan({
|
|
125
|
+
PlanNum,
|
|
126
|
+
GroupName,
|
|
127
|
+
GroupNum,
|
|
128
|
+
PlanNote,
|
|
129
|
+
FeeSched,
|
|
130
|
+
PlanType,
|
|
131
|
+
CopayFeeSched,
|
|
132
|
+
EmployerNum,
|
|
133
|
+
CarrierNum,
|
|
134
|
+
CodeSubstNone,
|
|
135
|
+
IsHidden,
|
|
136
|
+
MonthRenew,
|
|
137
|
+
IsBlueBookEnabled,
|
|
138
|
+
} : UpdateInsPlanParams): Promise<InsPlan> {
|
|
139
|
+
if (!PlanNum || typeof PlanNum !== "number") {
|
|
140
|
+
throw new Error("Invalid data: A Valid PlanNum is required.");
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return this.httpClient.put<InsPlan>(`/insplans/${PlanNum}`, {
|
|
144
|
+
GroupName,
|
|
145
|
+
GroupNum,
|
|
146
|
+
PlanNote,
|
|
147
|
+
FeeSched,
|
|
148
|
+
PlanType,
|
|
149
|
+
CopayFeeSched,
|
|
150
|
+
EmployerNum,
|
|
151
|
+
CarrierNum,
|
|
152
|
+
CodeSubstNone,
|
|
153
|
+
IsHidden,
|
|
154
|
+
MonthRenew,
|
|
155
|
+
IsBlueBookEnabled,
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
}
|
package/src/api/patPlans.ts
CHANGED
|
@@ -97,10 +97,10 @@ export default class PatPlans {
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
/**
|
|
100
|
-
* Delete
|
|
100
|
+
* Delete a PatPlan entry.
|
|
101
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
102
|
* @param {number} PatPlanNum - Required: The unique identifier of the inssub to delete.
|
|
103
|
-
* @returns {Promise<void>} - Resolves when the
|
|
103
|
+
* @returns {Promise<void>} - Resolves when the PatPlan is deleted.
|
|
104
104
|
* @throws {Error} - If `PatPlanNum` is not valid or the API returns an error.
|
|
105
105
|
*/
|
|
106
106
|
public async deletePatPlan(PatPlanNum: number): Promise<void> {
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import HttpClient from "../utils/httpClient";
|
|
2
|
+
import {
|
|
3
|
+
RefAttach,
|
|
4
|
+
GetRefAttachesParams,
|
|
5
|
+
CreateRefAttachParams,
|
|
6
|
+
UpdateRefAttachParams,
|
|
7
|
+
} from "../types/refAttachTypes"
|
|
8
|
+
|
|
9
|
+
export default class RefAttaches {
|
|
10
|
+
private httpClient: HttpClient;
|
|
11
|
+
|
|
12
|
+
constructor(httpClient: HttpClient) {
|
|
13
|
+
this.httpClient = httpClient;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Fetch multiple refattaches with optional filtering and pagination.
|
|
18
|
+
* @param {Object} params - The parameters for filtering and pagination.
|
|
19
|
+
* @param {number} [params.PatNum] - The PatNum of the RefAttaches.
|
|
20
|
+
* @param {number} [params.Offset] - Pagination offset for results.
|
|
21
|
+
* @returns {Promise<RefAttach[]>} - A list of inssubs.
|
|
22
|
+
*/
|
|
23
|
+
public async getRefAttaches({
|
|
24
|
+
PatNum,
|
|
25
|
+
Offset,
|
|
26
|
+
}: GetRefAttachesParams = {}): Promise<RefAttach[]> {
|
|
27
|
+
const params = {
|
|
28
|
+
PatNum,
|
|
29
|
+
Offset,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
return this.httpClient.get<RefAttach[]>("/refattaches", params);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Attach a referral to a patient.
|
|
37
|
+
* @param {Object} data - The details of RefAttach to create.
|
|
38
|
+
* @param {number} data.PatNum - Required. FK to patient.PatNum.
|
|
39
|
+
* @param {number} [data.ReferralNum] - Required. The PatNum of the patient who is subscribed to this plan.
|
|
40
|
+
* @param {string} [data.referralName] - Required. Number assigned by insurance company.
|
|
41
|
+
* @param {string} [data.RefDate] - Optional. The date this InsPlan became effective.
|
|
42
|
+
* @param {"RefTo" | "RefFrom" | "RefCustom"} [data.ReferralType] - Optional. Not usually used. The date this InsPlan was terminated.
|
|
43
|
+
* @param {"None" | "Declined" | "Scheduled" | "Consulted" | "InTreatment" | "Complete"} [data.RefToStatus] - 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.
|
|
44
|
+
* @param {string} [data.Note] - 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.
|
|
45
|
+
* @param {"true" | "false"} [data.IsTransitionOfCare] - 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.
|
|
46
|
+
* @param {number} [data.ProcNum] - Optional. Use to store any other info that affects coverage.
|
|
47
|
+
* @param {string} [data.DateProcComplete] - Optional. Use to store any other info that affects coverage.
|
|
48
|
+
* @param {number} [data.ProvNum] - Optional. Use to store any other info that affects coverage.
|
|
49
|
+
* @returns {Promise<RefAttach>} - The created refattaches.
|
|
50
|
+
* @throws {Error} - If required fields are missing or the API returns an error.
|
|
51
|
+
*/
|
|
52
|
+
public async createRefAttach({
|
|
53
|
+
PatNum,
|
|
54
|
+
ReferralNum,
|
|
55
|
+
referralName,
|
|
56
|
+
RefDate,
|
|
57
|
+
ReferralType,
|
|
58
|
+
RefToStatus,
|
|
59
|
+
Note,
|
|
60
|
+
IsTransitionOfCare,
|
|
61
|
+
ProcNum,
|
|
62
|
+
DateProcComplete,
|
|
63
|
+
ProvNum,
|
|
64
|
+
} : CreateRefAttachParams): Promise<RefAttach> {
|
|
65
|
+
if (!PatNum || (!ReferralNum && !referralName)) {
|
|
66
|
+
throw new Error("Invalid data: PatNum and either ReferralNum or referralName are required.");
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return this.httpClient.post<RefAttach>("/refattaches", {
|
|
70
|
+
PatNum,
|
|
71
|
+
ReferralNum,
|
|
72
|
+
referralName,
|
|
73
|
+
RefDate,
|
|
74
|
+
ReferralType,
|
|
75
|
+
RefToStatus,
|
|
76
|
+
Note,
|
|
77
|
+
IsTransitionOfCare,
|
|
78
|
+
ProcNum,
|
|
79
|
+
DateProcComplete,
|
|
80
|
+
ProvNum,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Update a refattach.
|
|
86
|
+
* @param {Object} data - The details of RefAttach to create.
|
|
87
|
+
* @param {number} data.RefAttachNum - Required. FK to patient.PatNum.
|
|
88
|
+
* @param {number} [data.ReferralNum] - Required. The PatNum of the patient who is subscribed to this plan.
|
|
89
|
+
* @param {string} [data.RefDate] - Optional. The date this InsPlan became effective.
|
|
90
|
+
* @param {"RefTo" | "RefFrom" | "RefCustom"} [data.ReferralType] - Optional. Not usually used. The date this InsPlan was terminated.
|
|
91
|
+
* @param {"None" | "Declined" | "Scheduled" | "Consulted" | "InTreatment" | "Complete"} [data.RefToStatus] - 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.
|
|
92
|
+
* @param {string} [data.Note] - 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.
|
|
93
|
+
* @param {"true" | "false"} [data.IsTransitionOfCare] - 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.
|
|
94
|
+
* @param {number} [data.ProcNum] - Optional. Use to store any other info that affects coverage.
|
|
95
|
+
* @param {string} [data.DateProcComplete] - Optional. Use to store any other info that affects coverage.
|
|
96
|
+
* @param {number} [data.ProvNum] - Optional. Use to store any other info that affects coverage.
|
|
97
|
+
* @returns {Promise<RefAttach>} - The created refattaches.
|
|
98
|
+
* @throws {Error} - If required fields are missing or the API returns an error.
|
|
99
|
+
*/
|
|
100
|
+
public async updateRefAttach({
|
|
101
|
+
RefAttachNum,
|
|
102
|
+
ReferralNum,
|
|
103
|
+
RefDate,
|
|
104
|
+
ReferralType,
|
|
105
|
+
RefToStatus,
|
|
106
|
+
Note,
|
|
107
|
+
IsTransitionOfCare,
|
|
108
|
+
ProcNum,
|
|
109
|
+
DateProcComplete,
|
|
110
|
+
ProvNum,
|
|
111
|
+
} : UpdateRefAttachParams): Promise<RefAttach> {
|
|
112
|
+
if (!RefAttachNum) {
|
|
113
|
+
throw new Error("Invalid data: RefAttachNum is required.");
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return this.httpClient.put<RefAttach>(`/refattaches/${RefAttachNum}`, {
|
|
117
|
+
ReferralNum,
|
|
118
|
+
RefDate,
|
|
119
|
+
ReferralType,
|
|
120
|
+
RefToStatus,
|
|
121
|
+
Note,
|
|
122
|
+
IsTransitionOfCare,
|
|
123
|
+
ProcNum,
|
|
124
|
+
DateProcComplete,
|
|
125
|
+
ProvNum,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Delete a refattach.
|
|
131
|
+
* @param {number} RefAttachNum - Required: The unique identifier of the RefAttach to delete.
|
|
132
|
+
* @returns {Promise<void>} - Resolves when the discount plan sub is deleted.
|
|
133
|
+
* @throws {Error} - If `RefAttachNum` is not valid or the API returns an error.
|
|
134
|
+
*/
|
|
135
|
+
public async deleteInsSub(RefAttachNum: number): Promise<void> {
|
|
136
|
+
if (!RefAttachNum || typeof RefAttachNum !== "number") {
|
|
137
|
+
throw new Error("Invalid parameter: RefAttachNum must be a valid number.");
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return this.httpClient.delete<void>(`/refattaches/${RefAttachNum}`);
|
|
141
|
+
}
|
|
142
|
+
}
|