@icure/be-fhc-api 0.4.4 → 0.4.7
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/api/fhcDataAttributeServiceApi.d.ts +37 -0
- package/api/fhcDataAttributeServiceApi.js +65 -0
- package/api/fhcEhboxV3Api.d.ts +10 -0
- package/api/fhcEhboxV3Api.js +23 -0
- package/api/fhcSchematronApi.d.ts +29 -0
- package/api/fhcSchematronApi.js +53 -0
- package/fhcApi.d.ts +2 -6
- package/fhcApi.js +2 -7
- package/model/Acknowledgement.d.ts +19 -0
- package/model/Acknowledgement.js +9 -0
- package/model/ActivePattern.d.ts +18 -0
- package/model/ActivePattern.js +20 -0
- package/model/DaasResponse.d.ts +20 -0
- package/model/DaasResponse.js +9 -0
- package/model/DiagnosticReference.d.ts +16 -0
- package/model/DiagnosticReference.js +20 -0
- package/model/EhboxIdentifierType.d.ts +20 -0
- package/model/EhboxIdentifierType.js +9 -0
- package/model/FailedAssert.d.ts +22 -0
- package/model/FailedAssert.js +9 -0
- package/model/FiredRule.d.ts +18 -0
- package/model/FiredRule.js +20 -0
- package/model/ItemType.d.ts +2 -2
- package/model/KmehrRegimen.d.ts +16 -0
- package/model/KmehrRegimen.js +9 -0
- package/model/Mapstringstring.d.ts +15 -0
- package/model/Mapstringstring.js +20 -0
- package/model/MessageOperationResponse.d.ts +1 -0
- package/model/MessageStatusOperationResponse.d.ts +19 -0
- package/model/MessageStatusOperationResponse.js +9 -0
- package/model/Ns.d.ts +16 -0
- package/model/Ns.js +20 -0
- package/model/NsPrefixInAttributeValues.d.ts +16 -0
- package/model/NsPrefixInAttributeValues.js +20 -0
- package/model/SchematronOutput.d.ts +30 -0
- package/model/SchematronOutput.js +9 -0
- package/model/SchematronValidationResult.d.ts +20 -0
- package/model/SchematronValidationResult.js +9 -0
- package/model/SuccessfulReport.d.ts +22 -0
- package/model/SuccessfulReport.js +9 -0
- package/model/User.d.ts +17 -0
- package/model/User.js +20 -0
- package/model/models.d.ts +19 -0
- package/model/models.js +19 -0
- package/package.json +1 -1
- package/x-api/message-x-api.d.ts +0 -35
- package/x-api/message-x-api.js +0 -790
- package/x-api/receipt-x-api.d.ts +0 -10
- package/x-api/receipt-x-api.js +0 -42
- package/x-api/utils/efact-parser.d.ts +0 -234
- package/x-api/utils/efact-parser.js +0 -1121
- package/x-api/utils/efact-util.d.ts +0 -28
- package/x-api/utils/efact-util.js +0 -316
- package/x-api/utils/fhc-invoice-sender-util.d.ts +0 -3
- package/x-api/utils/fhc-invoice-sender-util.js +0 -31
- package/x-api/utils/fhc-patient-util.d.ts +0 -3
- package/x-api/utils/fhc-patient-util.js +0 -20
- package/x-api/utils/formatting-util.d.ts +0 -76
- package/x-api/utils/formatting-util.js +0 -218
- package/x-api/utils/hcp-util.d.ts +0 -16
- package/x-api/utils/hcp-util.js +0 -131
- package/x-api/utils/insurability-util.d.ts +0 -22
- package/x-api/utils/insurability-util.js +0 -56
- package/x-api/utils/uuid-encoder.d.ts +0 -44
- package/x-api/utils/uuid-encoder.js +0 -110
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { HealthcareParty, Invoice, Patient } from "@icure/api";
|
|
2
|
-
import { IccInvoiceXApi, IccMessageXApi, IccInsuranceApi, Insurance } from "@icure/api";
|
|
3
|
-
import { InvoicesBatch, InvoiceItem } from "../../model/models";
|
|
4
|
-
export interface RelatedInvoiceInfo {
|
|
5
|
-
invoiceId: string;
|
|
6
|
-
invoiceReference?: string;
|
|
7
|
-
sendNumber?: string;
|
|
8
|
-
insuranceCode?: string;
|
|
9
|
-
invoicingYear?: string;
|
|
10
|
-
invoicingMonth?: string;
|
|
11
|
-
}
|
|
12
|
-
export interface InvoiceWithPatient {
|
|
13
|
-
patient: Patient;
|
|
14
|
-
invoice: Invoice;
|
|
15
|
-
aggregatedInvoice?: Invoice;
|
|
16
|
-
}
|
|
17
|
-
export declare function getFederaton(invoices: Array<InvoiceWithPatient>, insuranceApi: IccInsuranceApi): Promise<Insurance>;
|
|
18
|
-
export declare function getRelatedInvoicesInfo(invoicesWithPatient: InvoiceWithPatient[], insuranceApi: IccInsuranceApi, invoiceXApi: IccInvoiceXApi, messageXApi: IccMessageXApi): Promise<RelatedInvoiceInfo[]>;
|
|
19
|
-
export declare function toInvoiceBatch(invoicesWithPatient: Array<InvoiceWithPatient>, hcp: HealthcareParty, batchRef: string, batchNumber: number, fileRef: string, insuranceApi: IccInsuranceApi, invoiceXApi: IccInvoiceXApi, messageXApi: IccMessageXApi, flatrateInvoice?: boolean): Promise<InvoicesBatch>;
|
|
20
|
-
export declare function getDerogationMaxNumber(code: number): InvoiceItem.DerogationMaxNumberEnum;
|
|
21
|
-
export declare function toDerogationMaxNumber(derogation: InvoiceItem.DerogationMaxNumberEnum): number;
|
|
22
|
-
export declare function uuidBase36(uuid: string): string;
|
|
23
|
-
/**
|
|
24
|
-
* This function encodes an uuid in 13 characters in base36, this is
|
|
25
|
-
* for the fileRef in efact, zone 303
|
|
26
|
-
*/
|
|
27
|
-
export declare function uuidBase36Half(uuid: string): string;
|
|
28
|
-
export declare function decodeBase36Uuid(base36: string): string | null;
|
|
@@ -1,316 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.decodeBase36Uuid = exports.uuidBase36Half = exports.uuidBase36 = exports.toDerogationMaxNumber = exports.getDerogationMaxNumber = exports.toInvoiceBatch = exports.getRelatedInvoicesInfo = exports.getFederaton = void 0;
|
|
4
|
-
const api_1 = require("@icure/api");
|
|
5
|
-
const models_1 = require("../../model/models");
|
|
6
|
-
const formatting_util_1 = require("./formatting-util");
|
|
7
|
-
const fhc_patient_util_1 = require("./fhc-patient-util");
|
|
8
|
-
const fhc_invoice_sender_util_1 = require("./fhc-invoice-sender-util");
|
|
9
|
-
const insurability_util_1 = require("./insurability-util");
|
|
10
|
-
const _ = require("lodash");
|
|
11
|
-
const moment = require("moment");
|
|
12
|
-
const uuid_encoder_1 = require("./uuid-encoder");
|
|
13
|
-
const base36UUID = new uuid_encoder_1.UuidEncoder();
|
|
14
|
-
function ensureNoFederation(invoices, insurances) {
|
|
15
|
-
// We will check here for recipient which are federations (except 306).
|
|
16
|
-
const federations = insurances.filter(i => i.code !== "306" && i.code !== "675" && i.id === i.parent);
|
|
17
|
-
if (federations.length > 0) {
|
|
18
|
-
console.error(`Invoices directed to ${federations.map(i => i.code).join()}, invoices ${invoices.map(i => i.invoice.id)}`);
|
|
19
|
-
throw "Some invoices are directly destinated to federations inside of mutuality office !";
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
function getFederaton(invoices, insuranceApi) {
|
|
23
|
-
return insuranceApi
|
|
24
|
-
.getInsurances(new api_1.ListOfIds({
|
|
25
|
-
ids: _.compact(invoices.map(iwp => iwp.invoice.recipientId))
|
|
26
|
-
}))
|
|
27
|
-
.then((insurances) => {
|
|
28
|
-
ensureNoFederation(invoices, insurances);
|
|
29
|
-
return insuranceApi
|
|
30
|
-
.getInsurances(new api_1.ListOfIds({ ids: _.uniq(_.compact(insurances.map(i => i.parent))) }))
|
|
31
|
-
.then((parents) => {
|
|
32
|
-
const parentsWithFedCode = parents.filter(i => i.code);
|
|
33
|
-
if (!parentsWithFedCode.length) {
|
|
34
|
-
throw "The federation is missing from the recipients of the invoices";
|
|
35
|
-
}
|
|
36
|
-
if (parentsWithFedCode.length > 1) {
|
|
37
|
-
throw "The provided invoices are not addressed to insurances belonging to the same federation";
|
|
38
|
-
}
|
|
39
|
-
return parentsWithFedCode[0];
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
exports.getFederaton = getFederaton;
|
|
44
|
-
function getRelatedInvoicesInfo(invoicesWithPatient, insuranceApi, invoiceXApi, messageXApi) {
|
|
45
|
-
// Return the id of the related parentInvoice
|
|
46
|
-
const getRelatedInvoiceId = (iv) => (iv.creditNote && iv.creditNoteRelatedInvoiceId) || iv.correctedInvoiceId;
|
|
47
|
-
return Promise.resolve(invoicesWithPatient).then(invoicesWithPatient => {
|
|
48
|
-
const invoices = _(invoicesWithPatient)
|
|
49
|
-
.map(iwp => iwp.invoice)
|
|
50
|
-
.filter(piv => !!getRelatedInvoiceId(piv))
|
|
51
|
-
.value();
|
|
52
|
-
if (invoices.length === 0) {
|
|
53
|
-
return Promise.resolve([]);
|
|
54
|
-
}
|
|
55
|
-
const relatedInvoiceIds = new api_1.ListOfIds({
|
|
56
|
-
ids: invoices.map(iv => getRelatedInvoiceId(iv))
|
|
57
|
-
});
|
|
58
|
-
return Promise.all([
|
|
59
|
-
messageXApi.listMessagesByInvoiceIds(relatedInvoiceIds),
|
|
60
|
-
invoiceXApi.getInvoices(relatedInvoiceIds)
|
|
61
|
-
]).then(result => {
|
|
62
|
-
const messages = result[0];
|
|
63
|
-
const relatedInvoices = result[1];
|
|
64
|
-
const insuranceIds = _(relatedInvoices)
|
|
65
|
-
.map(civ => civ.recipientId)
|
|
66
|
-
.uniq()
|
|
67
|
-
.value();
|
|
68
|
-
return insuranceApi
|
|
69
|
-
.getInsurances(new api_1.ListOfIds({ ids: insuranceIds }))
|
|
70
|
-
.then((insurances) => {
|
|
71
|
-
const relatedInvoicesInfo = [];
|
|
72
|
-
_.forEach(invoices, invoice => {
|
|
73
|
-
const relatedInvoice = _.find(relatedInvoices, riv => !!(riv.id === getRelatedInvoiceId(invoice)));
|
|
74
|
-
const message = _.find(messages, m => !!(relatedInvoice && m.invoiceIds.indexOf(relatedInvoice.id) > -1));
|
|
75
|
-
const insurance = _.find(insurances, ins => !!(relatedInvoice && ins.id === relatedInvoice.recipientId));
|
|
76
|
-
if (!relatedInvoice || !message || !insurance)
|
|
77
|
-
return;
|
|
78
|
-
relatedInvoicesInfo.push({
|
|
79
|
-
invoiceId: invoice.id,
|
|
80
|
-
insuranceCode: insurance.code,
|
|
81
|
-
invoiceReference: relatedInvoice.invoiceReference,
|
|
82
|
-
sendNumber: message.externalRef,
|
|
83
|
-
invoicingYear: _.padStart(message.metas.invoiceYear, 4, "0"),
|
|
84
|
-
invoicingMonth: _.padStart(message.metas.invoiceMonth, 2, "0")
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
return relatedInvoicesInfo;
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
exports.getRelatedInvoicesInfo = getRelatedInvoicesInfo;
|
|
93
|
-
// Here we trust the invoices argument for grouping validity (month, year and patient)
|
|
94
|
-
function toInvoiceBatch(invoicesWithPatient, hcp, batchRef, batchNumber, fileRef, insuranceApi, invoiceXApi, messageXApi, flatrateInvoice = false) {
|
|
95
|
-
return insuranceApi
|
|
96
|
-
.getInsurances(new api_1.ListOfIds({
|
|
97
|
-
ids: _.compact(invoicesWithPatient.map(iwp => iwp.invoice.recipientId))
|
|
98
|
-
}))
|
|
99
|
-
.then((insurances) => {
|
|
100
|
-
ensureNoFederation(invoicesWithPatient, insurances);
|
|
101
|
-
return insuranceApi
|
|
102
|
-
.getInsurances(new api_1.ListOfIds({ ids: _.uniq(_.compact(insurances.map(i => i.parent))) }))
|
|
103
|
-
.then((parents) => {
|
|
104
|
-
const fedCodes = _.compact(parents.map(i => i.code && i.code.substr(0, 3)));
|
|
105
|
-
if (!fedCodes.length) {
|
|
106
|
-
throw "The federation is missing from the recipients of the invoices";
|
|
107
|
-
}
|
|
108
|
-
if (fedCodes.length > 1) {
|
|
109
|
-
throw "The provided invoices are not addressed to insurances belonging to the same federation";
|
|
110
|
-
}
|
|
111
|
-
return getRelatedInvoicesInfo(invoicesWithPatient, insuranceApi, invoiceXApi, messageXApi).then((relatedInvoicesInfo) => {
|
|
112
|
-
const invoicesBatch = new models_1.InvoicesBatch({});
|
|
113
|
-
invoicesBatch.batchRef = batchRef;
|
|
114
|
-
invoicesBatch.fileRef = fileRef;
|
|
115
|
-
invoicesBatch.magneticInvoice = flatrateInvoice; //flatrateInvoice have some different fields
|
|
116
|
-
if (flatrateInvoice) {
|
|
117
|
-
invoicesBatch.invoiceContent = 0;
|
|
118
|
-
}
|
|
119
|
-
invoicesBatch.invoices = _.map(invoicesWithPatient, (invWithPat) => {
|
|
120
|
-
const invoice = invWithPat.aggregatedInvoice || invWithPat.invoice;
|
|
121
|
-
const relatedInvoiceInfo = _.find(relatedInvoicesInfo, rivi => rivi.invoiceId === invoice.id);
|
|
122
|
-
const insurance = insurances.find(ins => ins.id === invoice.recipientId);
|
|
123
|
-
if (!insurance) {
|
|
124
|
-
throw "Insurance is invalid for patient " + invWithPat.patient.id;
|
|
125
|
-
}
|
|
126
|
-
return toInvoice(hcp.nihii, invoice, invWithPat.patient, insurance, relatedInvoiceInfo, flatrateInvoice);
|
|
127
|
-
});
|
|
128
|
-
const now = new Date();
|
|
129
|
-
const invoiceDate = (0, formatting_util_1.toMoment)(invoicesWithPatient[0].invoice.invoiceDate);
|
|
130
|
-
const invoicingMonth = invoiceDate.month() + 1;
|
|
131
|
-
const invoicingYear = invoiceDate.year();
|
|
132
|
-
// The OA 500, matches the monthYear (zone 300) to check the batch sending number
|
|
133
|
-
// Use sending year to prevent duplicate sending number in case of invoices made
|
|
134
|
-
// on the previous year
|
|
135
|
-
if (now.getFullYear() === invoicingYear) {
|
|
136
|
-
invoicesBatch.invoicingMonth = invoicingMonth;
|
|
137
|
-
invoicesBatch.invoicingYear = invoicingYear;
|
|
138
|
-
}
|
|
139
|
-
else {
|
|
140
|
-
invoicesBatch.invoicingMonth = now.getMonth() + 1;
|
|
141
|
-
invoicesBatch.invoicingYear = now.getFullYear();
|
|
142
|
-
}
|
|
143
|
-
invoicesBatch.ioFederationCode = fedCodes[0];
|
|
144
|
-
invoicesBatch.numericalRef =
|
|
145
|
-
moment().get("year") * 1000000 + Number(fedCodes[0]) * 1000 + batchNumber;
|
|
146
|
-
invoicesBatch.sender = (0, fhc_invoice_sender_util_1.toInvoiceSender)(hcp, fedCodes[0]);
|
|
147
|
-
invoicesBatch.uniqueSendNumber = batchNumber;
|
|
148
|
-
return invoicesBatch;
|
|
149
|
-
});
|
|
150
|
-
});
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
exports.toInvoiceBatch = toInvoiceBatch;
|
|
154
|
-
function toInvoice(nihiiHealthcareProvider, invoice, patient, insurance, relatedInvoiceInfo, flatrateInvoice = false) {
|
|
155
|
-
const efactInvoice = new models_1.Invoice({});
|
|
156
|
-
const invoiceYear = moment(invoice.created)
|
|
157
|
-
.year()
|
|
158
|
-
.toString();
|
|
159
|
-
efactInvoice.hospitalisedPatient = (0, insurability_util_1.isPatientHospitalized)(patient);
|
|
160
|
-
// FIXME : coder l'invoice ref
|
|
161
|
-
efactInvoice.invoiceNumber = Number(invoiceYear + invoice.invoiceReference) || 0;
|
|
162
|
-
// FIXME : coder l'invoice ref
|
|
163
|
-
efactInvoice.invoiceRef = uuidBase36(invoice.id);
|
|
164
|
-
efactInvoice.ioCode = insurance.code.substr(0, 3);
|
|
165
|
-
efactInvoice.items = _.map(invoice.invoicingCodes, (invoicingCode) => {
|
|
166
|
-
return toInvoiceItem(invoice.supervisorNihii || nihiiHealthcareProvider, patient, invoice, invoicingCode, flatrateInvoice);
|
|
167
|
-
});
|
|
168
|
-
efactInvoice.patient = (0, fhc_patient_util_1.toPatient)(patient);
|
|
169
|
-
efactInvoice.ignorePrescriptionDate = !!invoice.longDelayJustification;
|
|
170
|
-
efactInvoice.creditNote = invoice.creditNote;
|
|
171
|
-
if (relatedInvoiceInfo) {
|
|
172
|
-
efactInvoice.relatedBatchSendNumber = Number(relatedInvoiceInfo.sendNumber);
|
|
173
|
-
efactInvoice.relatedBatchYearMonth = Number(relatedInvoiceInfo.invoicingYear + relatedInvoiceInfo.invoicingMonth);
|
|
174
|
-
efactInvoice.relatedInvoiceNumber = Number(relatedInvoiceInfo.invoicingYear + relatedInvoiceInfo.invoiceReference);
|
|
175
|
-
efactInvoice.relatedInvoiceIoCode = relatedInvoiceInfo.insuranceCode;
|
|
176
|
-
}
|
|
177
|
-
// TODO : fix me later
|
|
178
|
-
efactInvoice.reason = models_1.Invoice.ReasonEnum.Other;
|
|
179
|
-
efactInvoice.creditNote = invoice.creditNote;
|
|
180
|
-
if (flatrateInvoice) {
|
|
181
|
-
efactInvoice.startOfCoveragePeriod = invoice.invoicingCodes[0].contractDate;
|
|
182
|
-
}
|
|
183
|
-
return efactInvoice;
|
|
184
|
-
}
|
|
185
|
-
function toInvoiceItem(nihiiHealthcareProvider, patient, invoice, invoicingCode, flatrateInvoice = false) {
|
|
186
|
-
const invoiceItem = new models_1.InvoiceItem({});
|
|
187
|
-
invoiceItem.codeNomenclature = Number(invoicingCode.tarificationId.split("|")[1]);
|
|
188
|
-
invoiceItem.dateCode = (0, formatting_util_1.dateEncode)((0, formatting_util_1.toMoment)(invoicingCode.dateCode).toDate());
|
|
189
|
-
invoiceItem.endDateCode =
|
|
190
|
-
invoiceItem.codeNomenclature === 109594
|
|
191
|
-
? (0, formatting_util_1.dateEncode)((0, formatting_util_1.toMoment)(invoicingCode.dateCode).toDate())
|
|
192
|
-
: (0, formatting_util_1.dateEncode)((0, formatting_util_1.toMoment)(invoicingCode.dateCode)
|
|
193
|
-
.endOf("month")
|
|
194
|
-
.toDate());
|
|
195
|
-
invoiceItem.doctorIdentificationNumber = nihiiHealthcareProvider;
|
|
196
|
-
invoiceItem.doctorSupplement = Number(((invoicingCode.doctorSupplement || 0) * 100).toFixed(0));
|
|
197
|
-
if (invoicingCode.eidReadingHour && invoicingCode.eidReadingValue) {
|
|
198
|
-
invoiceItem.eidItem = new models_1.EIDItem({
|
|
199
|
-
deviceType: "1",
|
|
200
|
-
readType: "1",
|
|
201
|
-
readDate: invoiceItem.dateCode,
|
|
202
|
-
readHour: invoicingCode.eidReadingHour,
|
|
203
|
-
readvalue: invoicingCode.eidReadingValue
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
invoiceItem.gnotionNihii = invoice.gnotionNihii;
|
|
207
|
-
invoiceItem.insuranceRef = invoicingCode.contract || undefined; // Must be != ""
|
|
208
|
-
invoiceItem.insuranceRefDate = invoicingCode.contractDate || invoiceItem.dateCode;
|
|
209
|
-
invoiceItem.invoiceRef = uuidBase36(invoicingCode.id);
|
|
210
|
-
invoiceItem.override3rdPayerCode = invoicingCode.override3rdPayerCode;
|
|
211
|
-
invoiceItem.patientFee = Number(((invoicingCode.patientIntervention || 0) * 100).toFixed(0));
|
|
212
|
-
invoiceItem.percentNorm = models_1.InvoiceItem.PercentNormEnum.None;
|
|
213
|
-
invoiceItem.personalInterventionCoveredByThirdPartyCode =
|
|
214
|
-
invoicingCode.cancelPatientInterventionReason;
|
|
215
|
-
invoiceItem.prescriberNihii = invoicingCode.prescriberNihii;
|
|
216
|
-
invoiceItem.prescriberNorm = getPrescriberNorm(invoicingCode.prescriberNorm || 0);
|
|
217
|
-
invoiceItem.reimbursedAmount = Number(((invoicingCode.reimbursement || 0) * 100).toFixed(0));
|
|
218
|
-
invoiceItem.relatedCode = Number(invoicingCode.relatedCode || 0);
|
|
219
|
-
invoiceItem.sideCode = getSideCode(invoicingCode.side || 0);
|
|
220
|
-
invoiceItem.timeOfDay = getTimeOfDay(invoicingCode.timeOfDay || 0);
|
|
221
|
-
invoiceItem.units = invoicingCode.units || 1;
|
|
222
|
-
invoiceItem.derogationMaxNumber = getDerogationMaxNumber(invoicingCode.derogationMaxNumber || 0);
|
|
223
|
-
invoiceItem.internshipNihii = invoice.internshipNihii;
|
|
224
|
-
return invoiceItem;
|
|
225
|
-
}
|
|
226
|
-
function getSideCode(code) {
|
|
227
|
-
return code === 0
|
|
228
|
-
? models_1.InvoiceItem.SideCodeEnum.None
|
|
229
|
-
: code === 1
|
|
230
|
-
? models_1.InvoiceItem.SideCodeEnum.Left
|
|
231
|
-
: code === 2
|
|
232
|
-
? models_1.InvoiceItem.SideCodeEnum.Right
|
|
233
|
-
: models_1.InvoiceItem.SideCodeEnum.None;
|
|
234
|
-
}
|
|
235
|
-
function getTimeOfDay(code) {
|
|
236
|
-
return code === 0
|
|
237
|
-
? models_1.InvoiceItem.TimeOfDayEnum.Other
|
|
238
|
-
: code === 1
|
|
239
|
-
? models_1.InvoiceItem.TimeOfDayEnum.Night
|
|
240
|
-
: code === 2
|
|
241
|
-
? models_1.InvoiceItem.TimeOfDayEnum.Weekend
|
|
242
|
-
: code === 3
|
|
243
|
-
? models_1.InvoiceItem.TimeOfDayEnum.Bankholiday
|
|
244
|
-
: code === 4
|
|
245
|
-
? models_1.InvoiceItem.TimeOfDayEnum.Urgent
|
|
246
|
-
: models_1.InvoiceItem.TimeOfDayEnum.Other;
|
|
247
|
-
}
|
|
248
|
-
function getPrescriberNorm(code) {
|
|
249
|
-
return code === 0
|
|
250
|
-
? models_1.InvoiceItem.PrescriberNormEnum.None
|
|
251
|
-
: code === 1
|
|
252
|
-
? models_1.InvoiceItem.PrescriberNormEnum.OnePrescriber
|
|
253
|
-
: code === 3
|
|
254
|
-
? models_1.InvoiceItem.PrescriberNormEnum.SelfPrescriber
|
|
255
|
-
: code === 4
|
|
256
|
-
? models_1.InvoiceItem.PrescriberNormEnum.AddedCode
|
|
257
|
-
: code === 9
|
|
258
|
-
? models_1.InvoiceItem.PrescriberNormEnum.ManyPrescribers
|
|
259
|
-
: models_1.InvoiceItem.PrescriberNormEnum.None;
|
|
260
|
-
}
|
|
261
|
-
function getDerogationMaxNumber(code) {
|
|
262
|
-
return code === 0
|
|
263
|
-
? models_1.InvoiceItem.DerogationMaxNumberEnum.Other
|
|
264
|
-
: code === 1
|
|
265
|
-
? models_1.InvoiceItem.DerogationMaxNumberEnum.DerogationMaxNumber
|
|
266
|
-
: code === 2
|
|
267
|
-
? models_1.InvoiceItem.DerogationMaxNumberEnum.OtherPrescription
|
|
268
|
-
: code === 3
|
|
269
|
-
? models_1.InvoiceItem.DerogationMaxNumberEnum.SecondPrestationOfDay
|
|
270
|
-
: models_1.InvoiceItem.DerogationMaxNumberEnum.ThirdAndNextPrestationOfDay;
|
|
271
|
-
}
|
|
272
|
-
exports.getDerogationMaxNumber = getDerogationMaxNumber;
|
|
273
|
-
function toDerogationMaxNumber(derogation) {
|
|
274
|
-
return derogation === models_1.InvoiceItem.DerogationMaxNumberEnum.Other
|
|
275
|
-
? 0
|
|
276
|
-
: derogation === models_1.InvoiceItem.DerogationMaxNumberEnum.DerogationMaxNumber
|
|
277
|
-
? 1
|
|
278
|
-
: derogation === models_1.InvoiceItem.DerogationMaxNumberEnum.OtherPrescription
|
|
279
|
-
? 2
|
|
280
|
-
: derogation === models_1.InvoiceItem.DerogationMaxNumberEnum.SecondPrestationOfDay
|
|
281
|
-
? 3
|
|
282
|
-
: 4;
|
|
283
|
-
}
|
|
284
|
-
exports.toDerogationMaxNumber = toDerogationMaxNumber;
|
|
285
|
-
function uuidBase36(uuid) {
|
|
286
|
-
return base36UUID.encode(uuid);
|
|
287
|
-
}
|
|
288
|
-
exports.uuidBase36 = uuidBase36;
|
|
289
|
-
/**
|
|
290
|
-
* This function encodes an uuid in 13 characters in base36, this is
|
|
291
|
-
* for the fileRef in efact, zone 303
|
|
292
|
-
*/
|
|
293
|
-
function uuidBase36Half(uuid) {
|
|
294
|
-
const rawEndcode = base36UUID.encode(uuid.substr(0, 18));
|
|
295
|
-
return _.padStart(rawEndcode, 13, "0");
|
|
296
|
-
}
|
|
297
|
-
exports.uuidBase36Half = uuidBase36Half;
|
|
298
|
-
function decodeBase36Uuid(base36) {
|
|
299
|
-
try {
|
|
300
|
-
const decoded = base36UUID.decode(base36);
|
|
301
|
-
if (base36.length !== 13) {
|
|
302
|
-
return decoded;
|
|
303
|
-
}
|
|
304
|
-
else {
|
|
305
|
-
const truncated = decoded.substr(19, decoded.length);
|
|
306
|
-
const raw = truncated.replace(/-/g, "");
|
|
307
|
-
const formatted = raw.substr(0, 8) + "-" + raw.substring(8, 12) + "-" + raw.substring(12, 16);
|
|
308
|
-
return formatted;
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
catch (e) {
|
|
312
|
-
console.log("Cannot interpret: " + base36, e);
|
|
313
|
-
}
|
|
314
|
-
return null;
|
|
315
|
-
}
|
|
316
|
-
exports.decodeBase36Uuid = decodeBase36Uuid;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toInvoiceSender = void 0;
|
|
4
|
-
const hcp_util_1 = require("./hcp-util");
|
|
5
|
-
function toInvoiceSender(hcp, fedCode) {
|
|
6
|
-
const phoneNumber = (0, hcp_util_1.getPhoneNumber)(hcp, 10) || 484082978;
|
|
7
|
-
if (!phoneNumber) {
|
|
8
|
-
throw new Error("NO_PHONE_NUMBER_IN_HCP");
|
|
9
|
-
}
|
|
10
|
-
const fi = hcp.financialInstitutionInformation &&
|
|
11
|
-
(hcp.financialInstitutionInformation.find(fii => fii.key === fedCode) ||
|
|
12
|
-
hcp.financialInstitutionInformation[0]);
|
|
13
|
-
const bic = hcp.bic || (fi && fi.bic);
|
|
14
|
-
const iban = hcp.bankAccount || (fi && fi.bankAccount);
|
|
15
|
-
if (!bic || !iban) {
|
|
16
|
-
throw new Error("Missing bic or iban for HCP");
|
|
17
|
-
}
|
|
18
|
-
const invoiceSender = {
|
|
19
|
-
bce: Number(hcp.cbe),
|
|
20
|
-
bic: bic.replace(/ /g, ""),
|
|
21
|
-
conventionCode: hcp.convention,
|
|
22
|
-
firstName: hcp.firstName,
|
|
23
|
-
iban: iban.replace(/ /g, ""),
|
|
24
|
-
lastName: hcp.lastName,
|
|
25
|
-
nihii: Number(hcp.nihii),
|
|
26
|
-
phoneNumber: phoneNumber,
|
|
27
|
-
ssin: hcp.ssin
|
|
28
|
-
};
|
|
29
|
-
return invoiceSender;
|
|
30
|
-
}
|
|
31
|
-
exports.toInvoiceSender = toInvoiceSender;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toPatient = void 0;
|
|
4
|
-
const models_1 = require("../../model/models");
|
|
5
|
-
const _ = require("lodash");
|
|
6
|
-
function toPatient(patient) {
|
|
7
|
-
const efactPatient = new models_1.Patient(patient);
|
|
8
|
-
_.each(efactPatient.insurabilities, ins => {
|
|
9
|
-
ins.parameters = _.pick(ins.parameters, [
|
|
10
|
-
"status",
|
|
11
|
-
"tc1",
|
|
12
|
-
"tc2",
|
|
13
|
-
"preferentialstatus",
|
|
14
|
-
"chronicaldisease",
|
|
15
|
-
"paymentapproval"
|
|
16
|
-
]);
|
|
17
|
-
});
|
|
18
|
-
return efactPatient;
|
|
19
|
-
}
|
|
20
|
-
exports.toPatient = toPatient;
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { Moment } from "moment";
|
|
2
|
-
export declare function isValidIBAN(iban: string): boolean;
|
|
3
|
-
export declare function ibanValidate(iban: string): boolean;
|
|
4
|
-
export declare function ibanFormat(iban: string): string;
|
|
5
|
-
export declare function nihiiFormat(nihii: string): string;
|
|
6
|
-
export declare function nihiiValidate(nihii: string): boolean;
|
|
7
|
-
export declare function ssinFormat(ssin: string): string;
|
|
8
|
-
export declare function ssinValidate(ssin: string): boolean;
|
|
9
|
-
export declare function phoneNumberValidate(phoneNumber: string): boolean;
|
|
10
|
-
export declare function phoneNumberFormat(phoneNumber: string): string;
|
|
11
|
-
/**
|
|
12
|
-
* Converts a backend date number (e.g., patient birth date) into a Date object.
|
|
13
|
-
* @param dateNumber a YYYYMMDD date number from the backend
|
|
14
|
-
* @return a Date object
|
|
15
|
-
* @throws Error if it is impossible to create a date from the number, other if dateNumber is negative.
|
|
16
|
-
* @see #dateEncode
|
|
17
|
-
* @see #timeDecode
|
|
18
|
-
*/
|
|
19
|
-
export declare function dateDecode(dateNumber: number): Date | undefined;
|
|
20
|
-
/**
|
|
21
|
-
* Converts a backend time number (e.g., health element openingDate) into a Date object.
|
|
22
|
-
* @param timeNumber a YYYYMMDD date number from the backend
|
|
23
|
-
* @return a Date object
|
|
24
|
-
* @see #timeEncode
|
|
25
|
-
* @see #dateDecode
|
|
26
|
-
*/
|
|
27
|
-
export declare function timeDecode(timeNumber: number): Date | undefined;
|
|
28
|
-
/**
|
|
29
|
-
* Encodes a Date object into a backend date number (e.g., patient birth date).
|
|
30
|
-
* @param date a Date object
|
|
31
|
-
* @return a YYYYMMDD date number for the backend
|
|
32
|
-
* @see #dateDecode
|
|
33
|
-
* @see #timeEncode
|
|
34
|
-
*/
|
|
35
|
-
export declare function dateEncode(date: Date): number | undefined;
|
|
36
|
-
/**
|
|
37
|
-
* Encodes a Date object into a backend time number (e.g., health element openingDate).
|
|
38
|
-
* @param date a Date object
|
|
39
|
-
* @return a YYYYMMDDHHmmss date number for the backend
|
|
40
|
-
* @see #timeDecode
|
|
41
|
-
* @see #dateEncode
|
|
42
|
-
*/
|
|
43
|
-
export declare function timeEncode(date: Date): number | undefined;
|
|
44
|
-
/**
|
|
45
|
-
* Formats a value and a physical unit into text.
|
|
46
|
-
* @param value the numerical or string value to encode
|
|
47
|
-
* @param unit the unit represented as a string (an empty string is also supported)
|
|
48
|
-
*/
|
|
49
|
-
export declare function unit(value: number | string, unit: string | null): string;
|
|
50
|
-
/**
|
|
51
|
-
* 0.1 + 0.2 = 0.30000000000000004. Use this function to be better at maths.
|
|
52
|
-
* @param a number
|
|
53
|
-
* @return the rounded number, two after the comma
|
|
54
|
-
*/
|
|
55
|
-
export declare function amount(value: number): number;
|
|
56
|
-
/**
|
|
57
|
-
* A simple formatter to keep the logic across the app.
|
|
58
|
-
* Input: 2.1 ; Output: 2.10€
|
|
59
|
-
*/
|
|
60
|
-
export declare function money(value: number): string;
|
|
61
|
-
/**
|
|
62
|
-
* Transform a dictionary to a url params.
|
|
63
|
-
* From { key1: value1, key2: value2, ... } returns key1=value1&key2=value2&...=...
|
|
64
|
-
*/
|
|
65
|
-
export declare function toUrlParams(params: {
|
|
66
|
-
[key: string]: string;
|
|
67
|
-
}): string;
|
|
68
|
-
export declare function personName(person: {
|
|
69
|
-
firstName?: string;
|
|
70
|
-
lastName?: string;
|
|
71
|
-
}): string;
|
|
72
|
-
export declare function personNameAbbrev(person: {
|
|
73
|
-
firstName?: string;
|
|
74
|
-
lastName?: string;
|
|
75
|
-
}): string;
|
|
76
|
-
export declare function toMoment(epochOrLongCalendar: number): Moment | null;
|