@icure/be-fhc-api 0.4.34 → 0.4.35
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/package.json +1 -1
- package/x-api/message-x-api.js +11 -8
package/package.json
CHANGED
package/x-api/message-x-api.js
CHANGED
|
@@ -711,15 +711,18 @@ class MessageXApi {
|
|
|
711
711
|
: Promise.resolve(`efact:${hcp.id}:${year}:${fed.code === "306" ? "300" : fed.code === "675" ? "600" : fed.code}:`)).then(prefix => {
|
|
712
712
|
return this.entityReferenceApi
|
|
713
713
|
.getLatest(prefix)
|
|
714
|
-
.then((er) =>
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
}));
|
|
714
|
+
.then((er) => er && er.id && er.id.startsWith(prefix)
|
|
715
|
+
? (Number(er.id.split(":").pop()) || 0) + 1
|
|
716
|
+
: 1, (e) => {
|
|
717
|
+
if (e.statusCode === 404)
|
|
718
|
+
return 1;
|
|
719
|
+
else
|
|
720
|
+
throw e;
|
|
722
721
|
})
|
|
722
|
+
.then((nextSeqNumber) => this.entityReferenceApi.createEntityReference(new api_1.EntityReference({
|
|
723
|
+
id: prefix + _.padStart("" + (nextSeqNumber % 1000000000), 9, "0"),
|
|
724
|
+
docId: uuid
|
|
725
|
+
})))
|
|
723
726
|
.then(er => (0, efact_util_1.toInvoiceBatch)(invoices, hcp, fullBase36, er && er.id ? Number(er.id.substr(prefix.length)) % 1000 : 0, smallBase36, this.insuranceApi, this.invoiceXApi, this.api, speciality, professionCode))
|
|
724
727
|
.then(batch => efactApi
|
|
725
728
|
.sendBatchUsingPOST(xFHCKeystoreId, xFHCTokenId, xFHCPassPhrase, batch)
|