@icure/be-fhc-api 0.4.10 → 0.4.13
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.
|
@@ -51,8 +51,10 @@ class fhcDataAttributeserviceApi {
|
|
|
51
51
|
(from ? "&from=" + encodeURIComponent(String(from)) : "") +
|
|
52
52
|
(to ? "&to=" + encodeURIComponent(String(to)) : "") +
|
|
53
53
|
(cause ? "&cause=" + encodeURIComponent(String(cause)) : "") +
|
|
54
|
-
(prolongation
|
|
55
|
-
|
|
54
|
+
(prolongation !== undefined
|
|
55
|
+
? "&prolongation=" + encodeURIComponent(String(prolongation))
|
|
56
|
+
: "") +
|
|
57
|
+
(total !== undefined ? "&total=" + encodeURIComponent(String(total)) : "");
|
|
56
58
|
let headers = this.headers;
|
|
57
59
|
xFHCKeystoreId && (headers = headers.concat(new XHR_1.XHR.Header("X-FHC-keystoreId", xFHCKeystoreId)));
|
|
58
60
|
xFHCTokenId && (headers = headers.concat(new XHR_1.XHR.Header("X-FHC-tokenId", xFHCTokenId)));
|
package/package.json
CHANGED
package/x-api/message-x-api.js
CHANGED
|
@@ -352,6 +352,7 @@ class MessageXApi {
|
|
|
352
352
|
const parentMessage = msgsForHcp[0];
|
|
353
353
|
return this.receiptXApi.iccApi
|
|
354
354
|
.createReceipt(new api_1.Receipt({
|
|
355
|
+
id: this.crypto.randomUuid(),
|
|
355
356
|
documentId: parentMessage.id,
|
|
356
357
|
references: [
|
|
357
358
|
`mycarenet:efact:inputReference:${ref}`,
|
|
@@ -126,9 +126,21 @@ function toInvoiceBatch(invoicesWithPatient, hcp, batchRef, batchNumber, fileRef
|
|
|
126
126
|
return toInvoice(hcp.nihii, invoice, invWithPat.patient, insurance, relatedInvoiceInfo, flatrateInvoice);
|
|
127
127
|
});
|
|
128
128
|
const now = new Date();
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
|
|
129
|
+
const invoiceDates = _.groupBy(invoicesWithPatient.map(inv => { var _a, _b; return ((_b = (_a = inv === null || inv === void 0 ? void 0 : inv.invoice) === null || _a === void 0 ? void 0 : _a.invoiceDate) !== null && _b !== void 0 ? _b : 100001).toString().substring(0, 6) + "01"; }));
|
|
130
|
+
//The invoiceMonth/Year of the batch must be equal to the most recent month/year of the invoices that has the highest count within the batch.
|
|
131
|
+
//From the INAMI Rules: (https://www.riziv.fgov.be/SiteCollectionDocuments/instructions_facturation_electronique_2021.pdf page 213)
|
|
132
|
+
// In deze zone bedoelt men de maand waarin het merendeel der prestaties, die op deze factuur staan,
|
|
133
|
+
// werden verricht. Deze maand kan verschillend zijn van de maand waarin de factuur werd opgemaakt
|
|
134
|
+
//Examples:
|
|
135
|
+
//A. 10 invoices 02/2020, 10 invoices 03/2020, 5 invoices 04/2020 --> 03/2020
|
|
136
|
+
//B. 10 invoices 02/2020; 9 invoices 03/2020, 5 invoices 04/2020 --> 02/2020
|
|
137
|
+
let dateCounts = [];
|
|
138
|
+
_.forOwn(invoiceDates, function (val, key) {
|
|
139
|
+
dateCounts.push({ date: key, count: val.length });
|
|
140
|
+
});
|
|
141
|
+
const invoiceDate = (0, formatting_util_1.toMoment)(_.get(_.head(_.orderBy(dateCounts, ["count", "date"], ["desc", "desc"])), "date", invoicesWithPatient[0].invoice.invoiceDate));
|
|
142
|
+
const invoicingMonth = !!invoiceDate ? invoiceDate.month() + 1 : 0;
|
|
143
|
+
const invoicingYear = !!invoiceDate ? invoiceDate.year() : 0;
|
|
132
144
|
// The OA 500, matches the monthYear (zone 300) to check the batch sending number
|
|
133
145
|
// Use sending year to prevent duplicate sending number in case of invoices made
|
|
134
146
|
// on the previous year
|
|
@@ -186,12 +198,13 @@ function toInvoiceItem(nihiiHealthcareProvider, patient, invoice, invoicingCode,
|
|
|
186
198
|
const invoiceItem = new models_1.InvoiceItem({});
|
|
187
199
|
invoiceItem.codeNomenclature = Number(invoicingCode.tarificationId.split("|")[1]);
|
|
188
200
|
invoiceItem.dateCode = (0, formatting_util_1.dateEncode)((0, formatting_util_1.toMoment)(invoicingCode.dateCode).toDate());
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
.
|
|
194
|
-
.toDate());
|
|
201
|
+
// Only applies to flatrate invoicing (https://medispring.atlassian.net/wiki/spaces/EN/pages/2536013825/Behavior+of+diabetes+pre-care+pathways+flatrate+invoicing)
|
|
202
|
+
if (flatrateInvoice) {
|
|
203
|
+
invoiceItem.endDateCode =
|
|
204
|
+
invoiceItem.codeNomenclature === 109594 // Diabetes pre-care pathways
|
|
205
|
+
? (0, formatting_util_1.dateEncode)((0, formatting_util_1.toMoment)(invoicingCode.dateCode).toDate())
|
|
206
|
+
: (0, formatting_util_1.dateEncode)((0, formatting_util_1.toMoment)(invoicingCode.dateCode).endOf("month").toDate());
|
|
207
|
+
}
|
|
195
208
|
invoiceItem.doctorIdentificationNumber = nihiiHealthcareProvider;
|
|
196
209
|
invoiceItem.doctorSupplement = Number(((invoicingCode.doctorSupplement || 0) * 100).toFixed(0));
|
|
197
210
|
if (invoicingCode.eidReadingHour && invoicingCode.eidReadingValue) {
|
|
@@ -209,10 +222,11 @@ function toInvoiceItem(nihiiHealthcareProvider, patient, invoice, invoicingCode,
|
|
|
209
222
|
invoiceItem.invoiceRef = uuidBase36(invoicingCode.id);
|
|
210
223
|
invoiceItem.override3rdPayerCode = invoicingCode.override3rdPayerCode;
|
|
211
224
|
invoiceItem.patientFee = Number(((invoicingCode.patientIntervention || 0) * 100).toFixed(0));
|
|
212
|
-
invoiceItem.percentNorm =
|
|
225
|
+
invoiceItem.percentNorm = getPercentNorm(invoicingCode.percentNorm || 0);
|
|
213
226
|
invoiceItem.personalInterventionCoveredByThirdPartyCode =
|
|
214
227
|
invoicingCode.cancelPatientInterventionReason;
|
|
215
228
|
invoiceItem.prescriberNihii = invoicingCode.prescriberNihii;
|
|
229
|
+
invoiceItem.prescriptionDate = invoicingCode.prescriptionDate;
|
|
216
230
|
invoiceItem.prescriberNorm = getPrescriberNorm(invoicingCode.prescriberNorm || 0);
|
|
217
231
|
invoiceItem.reimbursedAmount = Number(((invoicingCode.reimbursement || 0) * 100).toFixed(0));
|
|
218
232
|
invoiceItem.relatedCode = Number(invoicingCode.relatedCode || 0);
|
|
@@ -223,6 +237,25 @@ function toInvoiceItem(nihiiHealthcareProvider, patient, invoice, invoicingCode,
|
|
|
223
237
|
invoiceItem.internshipNihii = invoice.internshipNihii;
|
|
224
238
|
return invoiceItem;
|
|
225
239
|
}
|
|
240
|
+
function getPercentNorm(norm) {
|
|
241
|
+
return norm === 0
|
|
242
|
+
? models_1.InvoiceItem.PercentNormEnum.None
|
|
243
|
+
: norm === 1
|
|
244
|
+
? models_1.InvoiceItem.PercentNormEnum.SurgicalAid1
|
|
245
|
+
: norm === 2
|
|
246
|
+
? models_1.InvoiceItem.PercentNormEnum.SurgicalAid2
|
|
247
|
+
: norm === 3
|
|
248
|
+
? models_1.InvoiceItem.PercentNormEnum.ReducedFee
|
|
249
|
+
: norm === 4
|
|
250
|
+
? models_1.InvoiceItem.PercentNormEnum.Ah1n1
|
|
251
|
+
: norm === 5
|
|
252
|
+
? models_1.InvoiceItem.PercentNormEnum.HalfPriceSecondAct
|
|
253
|
+
: norm === 6
|
|
254
|
+
? models_1.InvoiceItem.PercentNormEnum.InvoiceException
|
|
255
|
+
: norm === 7
|
|
256
|
+
? models_1.InvoiceItem.PercentNormEnum.ForInformation
|
|
257
|
+
: models_1.InvoiceItem.PercentNormEnum.None;
|
|
258
|
+
}
|
|
226
259
|
function getSideCode(code) {
|
|
227
260
|
return code === 0
|
|
228
261
|
? models_1.InvoiceItem.SideCodeEnum.None
|