From 6d987a7cdea201ae1d6ffe8c6c3e7fff1528ca9f Mon Sep 17 00:00:00 2001 From: Antoine Pairet Date: Tue, 17 Sep 2019 16:21:08 +0200 Subject: [PATCH 01/75] genloc against backendb --- icc-api/api/XHR.ts | 5 +- icc-api/api/iccBeSamv2Api.ts | 4 +- icc-api/api/iccBekmehrApi.ts | 245 +++++++++++++++++++++++++ icc-api/api/iccUserApi.ts | 12 ++ icc-api/model/AmppDto.ts | 4 +- icc-api/model/Code.ts | 2 + icc-api/model/CodeDto.ts | 2 + icc-api/model/ParagraphAgreementDto.ts | 4 +- icc-api/model/Periodicity.ts | 34 ++++ icc-api/model/PlanOfActionDto.ts | 2 + icc-api/model/TarificationDto.ts | 2 + icc-api/model/VmpDto.ts | 2 +- icc-api/model/VmpGroupPaginatedList.ts | 38 ++++ icc-api/model/VmpStubDto.ts | 20 +- icc-api/model/models.ts | 2 + 15 files changed, 349 insertions(+), 29 deletions(-) create mode 100644 icc-api/model/Periodicity.ts create mode 100644 icc-api/model/VmpGroupPaginatedList.ts diff --git a/icc-api/api/XHR.ts b/icc-api/api/XHR.ts index d27d0f50..ff4efeb5 100644 --- a/icc-api/api/XHR.ts +++ b/icc-api/api/XHR.ts @@ -57,8 +57,7 @@ export namespace XHR { method: string, url: string, headers: Array
| null, - data: any = "", - contentTypeOverride?: "application/json" | "text/plain" | "application/octet-stream" + data: string | any = "" ): Promise { const contentType = headers && @@ -102,7 +101,7 @@ export namespace XHR { if (response.status >= 400) { throw new XHRError(response.statusText, response.status, response.status, response.headers) } - const ct = contentTypeOverride || response.headers.get("content-type") || "text/plain" + const ct = response.headers.get("content-type") || "text/plain" return (ct.startsWith("application/json") ? response.json() : ct.startsWith("application/xml") || ct.startsWith("text/") diff --git a/icc-api/api/iccBeSamv2Api.ts b/icc-api/api/iccBeSamv2Api.ts index 92e7f8dd..e5c759a3 100644 --- a/icc-api/api/iccBeSamv2Api.ts +++ b/icc-api/api/iccBeSamv2Api.ts @@ -171,7 +171,7 @@ export class iccBeSamv2Api { startKey?: string, startDocumentId?: string, limit?: number - ): Promise { + ): Promise { let _body = null const _url = @@ -189,7 +189,7 @@ export class iccBeSamv2Api { .filter(h => h.header !== "Content-Type") .concat(new XHR.Header("Content-Type", "application/json")) return XHR.sendCommand("GET", _url, headers, _body) - .then(doc => new models.AmpPaginatedList(doc.body as JSON)) + .then(doc => new models.VmpGroupPaginatedList(doc.body as JSON)) .catch(err => this.handleError(err)) } findPaginatedVmpsByGroupCode( diff --git a/icc-api/api/iccBekmehrApi.ts b/icc-api/api/iccBekmehrApi.ts index b6954678..c14ad4d2 100644 --- a/icc-api/api/iccBekmehrApi.ts +++ b/icc-api/api/iccBekmehrApi.ts @@ -71,6 +71,76 @@ export class iccBeKmehrApi { .then(doc => (doc.body as Array).map(it => new models.CheckSMFPatientResult(it))) .catch(err => this.handleError(err)) } + generateContactreportExport( + patientId: string, + id: string, + date?: number, + language?: string, + recipientNihii?: string, + recipientFirstName?: string, + recipientLastName?: string, + mimeType?: string, + body?: Array + ): Promise { + let _body = null + _body = body + + const _url = + this.host + + "/be_kmehr/contactreport/{patientId}/export/{id}" + .replace("{patientId}", patientId + "") + .replace("{id}", id + "") + + "?ts=" + + new Date().getTime() + + (date ? "&date=" + date : "") + + (language ? "&language=" + language : "") + + (recipientNihii ? "&recipientNihii=" + recipientNihii : "") + + (recipientFirstName ? "&recipientFirstName=" + recipientFirstName : "") + + (recipientLastName ? "&recipientLastName=" + recipientLastName : "") + + (mimeType ? "&mimeType=" + mimeType : "") + let headers = this.headers + headers = headers + .filter(h => h.header !== "Content-Type") + .concat(new XHR.Header("Content-Type", "application/octet-stream")) + return XHR.sendCommand("POST", _url, headers, _body) + .then(doc => doc.body) + .catch(err => this.handleError(err)) + } + generateLabresultExport( + patientId: string, + id: string, + date?: number, + language?: string, + recipientNihii?: string, + recipientFirstName?: string, + recipientLastName?: string, + mimeType?: string, + body?: Array + ): Promise { + let _body = null + _body = body + + const _url = + this.host + + "/be_kmehr/labresult/{patientId}/export/{id}" + .replace("{patientId}", patientId + "") + .replace("{id}", id + "") + + "?ts=" + + new Date().getTime() + + (date ? "&date=" + date : "") + + (language ? "&language=" + language : "") + + (recipientNihii ? "&recipientNihii=" + recipientNihii : "") + + (recipientFirstName ? "&recipientFirstName=" + recipientFirstName : "") + + (recipientLastName ? "&recipientLastName=" + recipientLastName : "") + + (mimeType ? "&mimeType=" + mimeType : "") + let headers = this.headers + headers = headers + .filter(h => h.header !== "Content-Type") + .concat(new XHR.Header("Content-Type", "application/octet-stream")) + return XHR.sendCommand("POST", _url, headers, _body) + .then(doc => doc.body) + .catch(err => this.handleError(err)) + } generateMedicationSchemeExport( patientId: string, language?: string, @@ -95,6 +165,181 @@ export class iccBeKmehrApi { .then(doc => doc.body) .catch(err => this.handleError(err)) } + generateNoteExport( + patientId: string, + id: string, + date?: number, + language?: string, + recipientNihii?: string, + recipientFirstName?: string, + recipientLastName?: string, + mimeType?: string, + body?: Array + ): Promise { + let _body = null + _body = body + + const _url = + this.host + + "/be_kmehr/note/{patientId}/export/{id}" + .replace("{patientId}", patientId + "") + .replace("{id}", id + "") + + "?ts=" + + new Date().getTime() + + (date ? "&date=" + date : "") + + (language ? "&language=" + language : "") + + (recipientNihii ? "&recipientNihii=" + recipientNihii : "") + + (recipientFirstName ? "&recipientFirstName=" + recipientFirstName : "") + + (recipientLastName ? "&recipientLastName=" + recipientLastName : "") + + (mimeType ? "&mimeType=" + mimeType : "") + let headers = this.headers + headers = headers + .filter(h => h.header !== "Content-Type") + .concat(new XHR.Header("Content-Type", "application/octet-stream")) + return XHR.sendCommand("POST", _url, headers, _body) + .then(doc => doc.body) + .catch(err => this.handleError(err)) + } + generatePrescriptionExport( + patientId: string, + id: string, + date?: number, + language?: string, + recipientNihii?: string, + recipientFirstName?: string, + recipientLastName?: string, + mimeType?: string, + body?: Array + ): Promise { + let _body = null + _body = body + + const _url = + this.host + + "/be_kmehr/prescription/{patientId}/export/{id}" + .replace("{patientId}", patientId + "") + .replace("{id}", id + "") + + "?ts=" + + new Date().getTime() + + (date ? "&date=" + date : "") + + (language ? "&language=" + language : "") + + (recipientNihii ? "&recipientNihii=" + recipientNihii : "") + + (recipientFirstName ? "&recipientFirstName=" + recipientFirstName : "") + + (recipientLastName ? "&recipientLastName=" + recipientLastName : "") + + (mimeType ? "&mimeType=" + mimeType : "") + let headers = this.headers + headers = headers + .filter(h => h.header !== "Content-Type") + .concat(new XHR.Header("Content-Type", "application/octet-stream")) + return XHR.sendCommand("POST", _url, headers, _body) + .then(doc => doc.body) + .catch(err => this.handleError(err)) + } + generateReportExport( + patientId: string, + id: string, + date?: number, + language?: string, + recipientNihii?: string, + recipientFirstName?: string, + recipientLastName?: string, + mimeType?: string, + body?: Array + ): Promise { + let _body = null + _body = body + + const _url = + this.host + + "/be_kmehr/report/{patientId}/export/{id}" + .replace("{patientId}", patientId + "") + .replace("{id}", id + "") + + "?ts=" + + new Date().getTime() + + (date ? "&date=" + date : "") + + (language ? "&language=" + language : "") + + (recipientNihii ? "&recipientNihii=" + recipientNihii : "") + + (recipientFirstName ? "&recipientFirstName=" + recipientFirstName : "") + + (recipientLastName ? "&recipientLastName=" + recipientLastName : "") + + (mimeType ? "&mimeType=" + mimeType : "") + let headers = this.headers + headers = headers + .filter(h => h.header !== "Content-Type") + .concat(new XHR.Header("Content-Type", "application/octet-stream")) + return XHR.sendCommand("POST", _url, headers, _body) + .then(doc => doc.body) + .catch(err => this.handleError(err)) + } + generateRequestExport( + patientId: string, + id: string, + date?: number, + language?: string, + recipientNihii?: string, + recipientFirstName?: string, + recipientLastName?: string, + mimeType?: string, + body?: Array + ): Promise { + let _body = null + _body = body + + const _url = + this.host + + "/be_kmehr/request/{patientId}/export/{id}" + .replace("{patientId}", patientId + "") + .replace("{id}", id + "") + + "?ts=" + + new Date().getTime() + + (date ? "&date=" + date : "") + + (language ? "&language=" + language : "") + + (recipientNihii ? "&recipientNihii=" + recipientNihii : "") + + (recipientFirstName ? "&recipientFirstName=" + recipientFirstName : "") + + (recipientLastName ? "&recipientLastName=" + recipientLastName : "") + + (mimeType ? "&mimeType=" + mimeType : "") + let headers = this.headers + headers = headers + .filter(h => h.header !== "Content-Type") + .concat(new XHR.Header("Content-Type", "application/octet-stream")) + return XHR.sendCommand("POST", _url, headers, _body) + .then(doc => doc.body) + .catch(err => this.handleError(err)) + } + generateResultExport( + patientId: string, + id: string, + date?: number, + language?: string, + recipientNihii?: string, + recipientFirstName?: string, + recipientLastName?: string, + mimeType?: string, + body?: Array + ): Promise { + let _body = null + _body = body + + const _url = + this.host + + "/be_kmehr/result/{patientId}/export/{id}" + .replace("{patientId}", patientId + "") + .replace("{id}", id + "") + + "?ts=" + + new Date().getTime() + + (date ? "&date=" + date : "") + + (language ? "&language=" + language : "") + + (recipientNihii ? "&recipientNihii=" + recipientNihii : "") + + (recipientFirstName ? "&recipientFirstName=" + recipientFirstName : "") + + (recipientLastName ? "&recipientLastName=" + recipientLastName : "") + + (mimeType ? "&mimeType=" + mimeType : "") + let headers = this.headers + headers = headers + .filter(h => h.header !== "Content-Type") + .concat(new XHR.Header("Content-Type", "application/octet-stream")) + return XHR.sendCommand("POST", _url, headers, _body) + .then(doc => doc.body) + .catch(err => this.handleError(err)) + } generateSmfExport( patientId: string, language?: string, diff --git a/icc-api/api/iccUserApi.ts b/icc-api/api/iccUserApi.ts index c0e83ef6..63b883c5 100644 --- a/icc-api/api/iccUserApi.ts +++ b/icc-api/api/iccUserApi.ts @@ -157,6 +157,18 @@ export class iccUserApi { .then(doc => new models.UserDto(doc.body as JSON)) .catch(err => this.handleError(err)) } + getMatchingUsers(): Promise | any> { + let _body = null + + const _url = this.host + "/user/matches" + "?ts=" + new Date().getTime() + let headers = this.headers + headers = headers + .filter(h => h.header !== "Content-Type") + .concat(new XHR.Header("Content-Type", "application/json")) + return XHR.sendCommand("GET", _url, headers, _body) + .then(doc => (doc.body as Array).map(it => new models.UserDto(it))) + .catch(err => this.handleError(err)) + } getUser(userId: string): Promise { let _body = null diff --git a/icc-api/model/AmppDto.ts b/icc-api/model/AmppDto.ts index 10dc8b07..83890849 100644 --- a/icc-api/model/AmppDto.ts +++ b/icc-api/model/AmppDto.ts @@ -96,9 +96,9 @@ export class AmppDto { dmpps?: Array - singleUse?: boolean - orphan?: boolean + + singleUse?: boolean } export namespace AmppDto { export enum StatusEnum { diff --git a/icc-api/model/Code.ts b/icc-api/model/Code.ts index f353ab77..c9bd39b1 100644 --- a/icc-api/model/Code.ts +++ b/icc-api/model/Code.ts @@ -32,6 +32,8 @@ export class Code { regions?: Array + periodicity?: Array + type?: string code?: string diff --git a/icc-api/model/CodeDto.ts b/icc-api/model/CodeDto.ts index dce7ff78..40724595 100644 --- a/icc-api/model/CodeDto.ts +++ b/icc-api/model/CodeDto.ts @@ -62,6 +62,8 @@ export class CodeDto { appendices?: { [key: string]: string } + periodicity?: Array + disabled?: boolean } export namespace CodeDto { diff --git a/icc-api/model/ParagraphAgreementDto.ts b/icc-api/model/ParagraphAgreementDto.ts index a46fd0a6..c23a9961 100644 --- a/icc-api/model/ParagraphAgreementDto.ts +++ b/icc-api/model/ParagraphAgreementDto.ts @@ -74,7 +74,7 @@ export class ParagraphAgreementDto { canceled?: boolean - inTreatment?: boolean - accepted?: boolean + + inTreatment?: boolean } diff --git a/icc-api/model/Periodicity.ts b/icc-api/model/Periodicity.ts new file mode 100644 index 00000000..55960002 --- /dev/null +++ b/icc-api/model/Periodicity.ts @@ -0,0 +1,34 @@ +/** + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.0.2 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import * as models from "./models" + +export class Periodicity { + constructor(json: JSON | any) { + Object.assign(this as Periodicity, json) + } + relatedCode?: models.CodeStub + + relatedPeriodicity?: models.CodeStub +} diff --git a/icc-api/model/PlanOfActionDto.ts b/icc-api/model/PlanOfActionDto.ts index c4b11711..f66c8e2d 100644 --- a/icc-api/model/PlanOfActionDto.ts +++ b/icc-api/model/PlanOfActionDto.ts @@ -40,6 +40,8 @@ export class PlanOfActionDto { closingDate?: number + deadlineDate?: number + idOpeningContact?: string idClosingContact?: string diff --git a/icc-api/model/TarificationDto.ts b/icc-api/model/TarificationDto.ts index e45dcfb2..77ba38e6 100644 --- a/icc-api/model/TarificationDto.ts +++ b/icc-api/model/TarificationDto.ts @@ -62,6 +62,8 @@ export class TarificationDto { appendices?: { [key: string]: string } + periodicity?: Array + disabled?: boolean valorisations?: Array diff --git a/icc-api/model/VmpDto.ts b/icc-api/model/VmpDto.ts index 0fd6d23f..6435f1e7 100644 --- a/icc-api/model/VmpDto.ts +++ b/icc-api/model/VmpDto.ts @@ -34,7 +34,7 @@ export class VmpDto { code?: string - vmpGroup?: models.VmpGroupDto + vmpGroup?: models.VmpGroupStubDto name?: models.SamTextDto diff --git a/icc-api/model/VmpGroupPaginatedList.ts b/icc-api/model/VmpGroupPaginatedList.ts new file mode 100644 index 00000000..2f58b1d6 --- /dev/null +++ b/icc-api/model/VmpGroupPaginatedList.ts @@ -0,0 +1,38 @@ +/** + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.0.2 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import * as models from "./models" + +export class VmpGroupPaginatedList { + constructor(json: JSON | any) { + Object.assign(this as VmpGroupPaginatedList, json) + } + totalSize?: number + + pageSize?: number + + nextKeyPair?: models.PaginatedDocumentKeyIdPair + + rows?: Array +} diff --git a/icc-api/model/VmpStubDto.ts b/icc-api/model/VmpStubDto.ts index 8a65cf7e..d06df730 100644 --- a/icc-api/model/VmpStubDto.ts +++ b/icc-api/model/VmpStubDto.ts @@ -28,29 +28,11 @@ export class VmpStubDto { constructor(json: JSON | any) { Object.assign(this as VmpStubDto, json) } - from?: number - - to?: number + id?: string code?: string vmpGroup?: models.VmpGroupStubDto name?: models.SamTextDto - - attachments?: { [key: string]: models.Attachment } - - deleted?: number - - id?: string - - rev?: string - - revsInfo?: Array - - conflicts?: Array - - javaType?: string - - revHistory?: { [key: string]: string } } diff --git a/icc-api/model/models.ts b/icc-api/model/models.ts index 3de68a84..5db3ef04 100644 --- a/icc-api/model/models.ts +++ b/icc-api/model/models.ts @@ -145,6 +145,7 @@ export * from "./PatientDto" export * from "./PatientHealthCarePartyDto" export * from "./PatientPaginatedList" export * from "./Payment" +export * from "./Periodicity" export * from "./PermissionCriterionDto" export * from "./PermissionDto" export * from "./PharmaceuticalFormDto" @@ -202,6 +203,7 @@ export * from "./VirtualIngredientDto" export * from "./VmpComponentDto" export * from "./VmpDto" export * from "./VmpGroupDto" +export * from "./VmpGroupPaginatedList" export * from "./VmpGroupStubDto" export * from "./VmpPaginatedList" export * from "./VmpStubDto" From 79f68300ee8eb6254576c7d1f593000d9edd064e Mon Sep 17 00:00:00 2001 From: Antoine Pairet Date: Tue, 17 Sep 2019 16:48:57 +0200 Subject: [PATCH 02/75] restore contentTypeOverride --- icc-api/api/XHR.ts | 5 +++-- icc-x-api/icc-crypto-x-api.ts | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/icc-api/api/XHR.ts b/icc-api/api/XHR.ts index ff4efeb5..f37e97e3 100644 --- a/icc-api/api/XHR.ts +++ b/icc-api/api/XHR.ts @@ -57,7 +57,8 @@ export namespace XHR { method: string, url: string, headers: Array
| null, - data: string | any = "" + data: string | any = "", + contentTypeOverride?: "application/json" | "text/plain" | "application/octet-stream" ): Promise { const contentType = headers && @@ -101,7 +102,7 @@ export namespace XHR { if (response.status >= 400) { throw new XHRError(response.statusText, response.status, response.status, response.headers) } - const ct = response.headers.get("content-type") || "text/plain" + const ct = contentTypeOverride || response.headers.get("content-type") || "text/plain" return (ct.startsWith("application/json") ? response.json() : ct.startsWith("application/xml") || ct.startsWith("text/") diff --git a/icc-x-api/icc-crypto-x-api.ts b/icc-x-api/icc-crypto-x-api.ts index 0577fb1a..1dc11c98 100644 --- a/icc-x-api/icc-crypto-x-api.ts +++ b/icc-x-api/icc-crypto-x-api.ts @@ -58,7 +58,7 @@ export class IccCryptoXApi { } private getCachedHcpOrPatientType(hcpartyId: string): string | null | undefined { - return (this.hcPartiesRequestsCache[hcpartyId] || {}).entityType + return (this.hcPartiesRequestsCache[hcpartyId] || { entityType: undefined }).entityType } /** From 4137fb06c078ace30ff09081dd8afe66c2cb51ea Mon Sep 17 00:00:00 2001 From: Antoine Pairet Date: Tue, 17 Sep 2019 22:47:06 +0200 Subject: [PATCH 03/75] fix case sensitive filenames --- ...{iccApplicationsettingsApi.ts => iccApplicationSettingsApi.ts} | 0 icc-api/api/{iccBedrugsApi.ts => iccBeDrugsApi.ts} | 0 icc-api/api/{iccBeefactApi.ts => iccBeEfactApi.ts} | 0 icc-api/api/{iccBekmehrApi.ts => iccBeKmehrApi.ts} | 0 icc-api/api/{iccBemikronoApi.ts => iccBeMikronoApi.ts} | 0 icc-api/api/{iccBeresultexportApi.ts => iccBeResultExportApi.ts} | 0 icc-api/api/{iccBeresultimportApi.ts => iccBeResultImportApi.ts} | 0 7 files changed, 0 insertions(+), 0 deletions(-) rename icc-api/api/{iccApplicationsettingsApi.ts => iccApplicationSettingsApi.ts} (100%) rename icc-api/api/{iccBedrugsApi.ts => iccBeDrugsApi.ts} (100%) rename icc-api/api/{iccBeefactApi.ts => iccBeEfactApi.ts} (100%) rename icc-api/api/{iccBekmehrApi.ts => iccBeKmehrApi.ts} (100%) rename icc-api/api/{iccBemikronoApi.ts => iccBeMikronoApi.ts} (100%) rename icc-api/api/{iccBeresultexportApi.ts => iccBeResultExportApi.ts} (100%) rename icc-api/api/{iccBeresultimportApi.ts => iccBeResultImportApi.ts} (100%) diff --git a/icc-api/api/iccApplicationsettingsApi.ts b/icc-api/api/iccApplicationSettingsApi.ts similarity index 100% rename from icc-api/api/iccApplicationsettingsApi.ts rename to icc-api/api/iccApplicationSettingsApi.ts diff --git a/icc-api/api/iccBedrugsApi.ts b/icc-api/api/iccBeDrugsApi.ts similarity index 100% rename from icc-api/api/iccBedrugsApi.ts rename to icc-api/api/iccBeDrugsApi.ts diff --git a/icc-api/api/iccBeefactApi.ts b/icc-api/api/iccBeEfactApi.ts similarity index 100% rename from icc-api/api/iccBeefactApi.ts rename to icc-api/api/iccBeEfactApi.ts diff --git a/icc-api/api/iccBekmehrApi.ts b/icc-api/api/iccBeKmehrApi.ts similarity index 100% rename from icc-api/api/iccBekmehrApi.ts rename to icc-api/api/iccBeKmehrApi.ts diff --git a/icc-api/api/iccBemikronoApi.ts b/icc-api/api/iccBeMikronoApi.ts similarity index 100% rename from icc-api/api/iccBemikronoApi.ts rename to icc-api/api/iccBeMikronoApi.ts diff --git a/icc-api/api/iccBeresultexportApi.ts b/icc-api/api/iccBeResultExportApi.ts similarity index 100% rename from icc-api/api/iccBeresultexportApi.ts rename to icc-api/api/iccBeResultExportApi.ts diff --git a/icc-api/api/iccBeresultimportApi.ts b/icc-api/api/iccBeResultImportApi.ts similarity index 100% rename from icc-api/api/iccBeresultimportApi.ts rename to icc-api/api/iccBeResultImportApi.ts From 6e43c6e638eab6e9563ac949dc3c193802089ed0 Mon Sep 17 00:00:00 2001 From: Antoine Pairet Date: Tue, 17 Sep 2019 22:56:05 +0200 Subject: [PATCH 04/75] iccMedicalLocationApi --- .../api/{iccMedicallocationApi.ts => iccMedicalLocationApi.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename icc-api/api/{iccMedicallocationApi.ts => iccMedicalLocationApi.ts} (100%) diff --git a/icc-api/api/iccMedicallocationApi.ts b/icc-api/api/iccMedicalLocationApi.ts similarity index 100% rename from icc-api/api/iccMedicallocationApi.ts rename to icc-api/api/iccMedicalLocationApi.ts From 9aba1ead98bc3343bb7a781d2ea2e8fb9a2ff52c Mon Sep 17 00:00:00 2001 From: Bogdan Safta Date: Wed, 18 Sep 2019 16:41:02 +0300 Subject: [PATCH 05/75] Format files using pretty-quick --- icc-x-api/icc-contact-x-api.ts | 268 +++++++++++++++++---------------- 1 file changed, 137 insertions(+), 131 deletions(-) diff --git a/icc-x-api/icc-contact-x-api.ts b/icc-x-api/icc-contact-x-api.ts index 77cc382a..68eac247 100644 --- a/icc-x-api/icc-contact-x-api.ts +++ b/icc-x-api/icc-contact-x-api.ts @@ -374,43 +374,46 @@ export class IccContactXApi extends iccContactApi { const bypassEncryption = false //Used for debug return Promise.all( - ctcs.map(ctc => - bypassEncryption //Prevent encryption for test ctc - ? ctc - : (ctc.encryptionKeys && Object.keys(ctc.encryptionKeys || {}).length - ? Promise.resolve(ctc) - : this.initEncryptionKeys(user, ctc) - ) - .then(ctc => - this.crypto.extractKeysFromDelegationsForHcpHierarchy( - hcpartyId, - ctc.id!, - ctc.encryptionKeys! - ) + ctcs.map( + ctc => + bypassEncryption //Prevent encryption for test ctc + ? ctc + : (ctc.encryptionKeys && Object.keys(ctc.encryptionKeys || {}).length + ? Promise.resolve(ctc) + : this.initEncryptionKeys(user, ctc) ) - .then((sfks: { extractedKeys: Array; hcpartyId: string }) => - AES.importKey("raw", utils.hex2ua(sfks.extractedKeys[0].replace(/-/g, ""))) - ) - .then((key: CryptoKey) => - Promise.all( - ctc.services!.map(svc => - AES.encrypt(key, utils.utf82ua(JSON.stringify({ content: svc.content }))) + .then(ctc => + this.crypto.extractKeysFromDelegationsForHcpHierarchy( + hcpartyId, + ctc.id!, + ctc.encryptionKeys! ) ) - .then(eSvcs => { - console.log("eSvcs ", eSvcs) - ctc.services!.forEach((svc, idx) => { - svc.encryptedSelf = btoa(utils.ua2text(eSvcs[idx])) - delete svc.content + .then((sfks: { extractedKeys: Array; hcpartyId: string }) => + AES.importKey("raw", utils.hex2ua(sfks.extractedKeys[0].replace(/-/g, ""))) + ) + .then((key: CryptoKey) => + Promise.all( + ctc.services!.map(svc => + AES.encrypt(key, utils.utf82ua(JSON.stringify({ content: svc.content }))) + ) + ) + .then(eSvcs => { + console.log("eSvcs ", eSvcs) + ctc.services!.forEach((svc, idx) => { + svc.encryptedSelf = btoa(utils.ua2text(eSvcs[idx])) + delete svc.content + }) }) - }) - .then(() => AES.encrypt(key, utils.utf82ua(JSON.stringify({ descr: ctc.descr })))) - .then(es => { - ctc.encryptedSelf = btoa(utils.ua2text(es)) - delete ctc.descr - return ctc - }) - ) + .then(() => + AES.encrypt(key, utils.utf82ua(JSON.stringify({ descr: ctc.descr }))) + ) + .then(es => { + ctc.encryptedSelf = btoa(utils.ua2text(es)) + delete ctc.descr + return ctc + }) + ) ) ) } @@ -458,27 +461,27 @@ export class IccContactXApi extends iccContactApi { } ) : svc.encryptedSelf - ? AES.decrypt(key, utils.text2ua(atob(svc.encryptedSelf!))).then( - s => { - let jsonContent - try { - jsonContent = utils.ua2utf8(s!).replace(/\0+$/g, "") - resolve(s && JSON.parse(jsonContent)) - } catch (e) { - console.log( - "Cannot parse service", - svc.id, - jsonContent || "<- Invalid encoding" - ) + ? AES.decrypt(key, utils.text2ua(atob(svc.encryptedSelf!))).then( + s => { + let jsonContent + try { + jsonContent = utils.ua2utf8(s!).replace(/\0+$/g, "") + resolve(s && JSON.parse(jsonContent)) + } catch (e) { + console.log( + "Cannot parse service", + svc.id, + jsonContent || "<- Invalid encoding" + ) + resolve(null) + } + }, + () => { + console.log("Cannot decrypt service", svc.id) resolve(null) } - }, - () => { - console.log("Cannot decrypt service", svc.id) - resolve(null) - } - ) - : resolve(null) + ) + : resolve(null) }) ) .then(decrypted => { @@ -539,62 +542,63 @@ export class IccContactXApi extends iccContactApi { svc.id!, _.size(svc.encryptionKeys) ? svc.encryptionKeys! : svc.delegations! ) - .then(({ extractedKeys: sfks }) => - svc.encryptedContent || svc.encryptedSelf - ? AES.importKey("raw", utils.hex2ua(sfks[0].replace(/-/g, ""))) - .then( - (key: CryptoKey) => - new Promise((resolve: (value: any) => any) => { - svc.encryptedContent - ? AES.decrypt(key, utils.text2ua(atob(svc.encryptedContent!))).then( - c => { - let jsonContent - try { - jsonContent = utils.ua2utf8(c!).replace(/\0+$/g, "") - resolve(c && { content: JSON.parse(jsonContent) }) - } catch (e) { - console.log( - "Cannot parse service", - svc.id, - jsonContent || "<- Invalid encoding" - ) - resolve(null) - } - }, - () => { - console.log("Cannot decrypt service", svc.id) - resolve(null) - } - ) - : svc.encryptedSelf - ? AES.decrypt(key, utils.text2ua(atob(svc.encryptedSelf!))).then( - s => { - let jsonContent - try { - jsonContent = utils.ua2utf8(s!).replace(/\0+$/g, "") - resolve(s && JSON.parse(jsonContent)) - } catch (e) { - console.log( - "Cannot parse service", - svc.id, - jsonContent || "<- Invalid encoding" - ) + .then( + ({ extractedKeys: sfks }) => + svc.encryptedContent || svc.encryptedSelf + ? AES.importKey("raw", utils.hex2ua(sfks[0].replace(/-/g, ""))) + .then( + (key: CryptoKey) => + new Promise((resolve: (value: any) => any) => { + svc.encryptedContent + ? AES.decrypt(key, utils.text2ua(atob(svc.encryptedContent!))).then( + c => { + let jsonContent + try { + jsonContent = utils.ua2utf8(c!).replace(/\0+$/g, "") + resolve(c && { content: JSON.parse(jsonContent) }) + } catch (e) { + console.log( + "Cannot parse service", + svc.id, + jsonContent || "<- Invalid encoding" + ) + resolve(null) + } + }, + () => { + console.log("Cannot decrypt service", svc.id) resolve(null) } - }, - () => { - console.log("Cannot decrypt service", svc.id) - resolve(null) - } - ) - : resolve(null) - }) - ) - .then(decrypted => { - decrypted && _.assign(svc, decrypted) - return svc - }) - : svc + ) + : svc.encryptedSelf + ? AES.decrypt(key, utils.text2ua(atob(svc.encryptedSelf!))).then( + s => { + let jsonContent + try { + jsonContent = utils.ua2utf8(s!).replace(/\0+$/g, "") + resolve(s && JSON.parse(jsonContent)) + } catch (e) { + console.log( + "Cannot parse service", + svc.id, + jsonContent || "<- Invalid encoding" + ) + resolve(null) + } + }, + () => { + console.log("Cannot decrypt service", svc.id) + resolve(null) + } + ) + : resolve(null) + }) + ) + .then(decrypted => { + decrypted && _.assign(svc, decrypted) + return svc + }) + : svc ) ) ) @@ -616,15 +620,13 @@ export class IccContactXApi extends iccContactApi { filteredServices(ctcs: Array, filter: any): Array { const byIds: { [key: string]: models.ServiceDto } = {} ctcs.forEach(c => - (c.services || []) - .filter(s => filter(s, c)) - .forEach(s => { - const ps = byIds[s.id!] - if (!ps || !ps.modified || (s.modified && ps.modified < s.modified)) { - byIds[s.id!] = s - s.contactId = c.id - } - }) + (c.services || []).filter(s => filter(s, c)).forEach(s => { + const ps = byIds[s.id!] + if (!ps || !ps.modified || (s.modified && ps.modified < s.modified)) { + byIds[s.id!] = s + s.contactId = c.id + } + }) ) return _.values(byIds).filter((s: any) => !s.deleted && !s.endOfLife) } @@ -923,8 +925,8 @@ export class IccContactXApi extends iccContactApi { return m && m.compoundPrescription ? m.compoundPrescription : m && m.substanceProduct - ? myself.productToString(m && m.substanceProduct) - : myself.productToString(m && m.medicinalProduct) + ? myself.productToString(m && m.substanceProduct) + : myself.productToString(m && m.medicinalProduct) }, medicationToString: (m: any, lang: string) => { let res = `${myself.medicationNameToString(m)}, ${myself.posologyToString(m, lang)}` @@ -984,8 +986,8 @@ export class IccContactXApi extends iccContactApi { ) ? this.i18n[lang].weekly : m.regimen.find((r: any) => r.date) - ? this.i18n[lang].monthly - : this.i18n[lang].daily + ? this.i18n[lang].monthly + : this.i18n[lang].daily return `${quantityUnit}, ${m.regimen.length} x ${dayPeriod}, ${_.sortBy( m.regimen, @@ -996,11 +998,12 @@ export class IccContactXApi extends iccContactApi { (r.timeOfDay ? r.timeOfDay : r.dayPeriod && r.dayPeriod.code - ? (regimenScores[r.dayPeriod.code] as number) - : 0) + ? (regimenScores[r.dayPeriod.code] as number) + : 0) ) - .map(r => - cplxRegimen ? myself.regimenToExtString(r, lang) : myself.regimenToString(r, lang) + .map( + r => + cplxRegimen ? myself.regimenToExtString(r, lang) : myself.regimenToString(r, lang) ) .join(", ")}` } @@ -1016,8 +1019,8 @@ export class IccContactXApi extends iccContactApi { const dayPeriod = m.regimen.find((r: any) => r.weekday !== null && r.weekday !== undefined) ? this.i18n[lang].weekly : m.regimen.find((r: any) => r.date) - ? this.i18n[lang].monthly - : this.i18n[lang].daily + ? this.i18n[lang].monthly + : this.i18n[lang].daily return `${m.regimen.length} x ${dayPeriod}` }, @@ -1039,10 +1042,10 @@ export class IccContactXApi extends iccContactApi { let res = r.date ? `${this.i18n[lang].the} ${moment(r.date).format("DD/MM/YYYY")}` : r.dayNumber - ? `${this.i18n[lang].onDay} ${r.dayNumber}` - : r.weekday && r.weekday.weekday - ? `${this.i18n[lang].on} ${r.weekday.weekday}` - : null + ? `${this.i18n[lang].onDay} ${r.dayNumber}` + : r.weekday && r.weekday.weekday + ? `${this.i18n[lang].on} ${r.weekday.weekday}` + : null if (r.dayPeriod && r.dayPeriod.code && r.dayPeriod.code.length) { res = res ? `${res} ${this.i18n[lang][r.dayPeriod.code] || @@ -1073,8 +1076,11 @@ export class IccContactXApi extends iccContactApi { (this.i18n[lang][s.toLowerCase()] && this.i18n[lang][s.toLowerCase()] .split("") - .map((c: string, idx: number) => - idx >= s.length || s[idx].toLocaleLowerCase() === s[idx] ? c : c.toLocaleUpperCase() + .map( + (c: string, idx: number) => + idx >= s.length || s[idx].toLocaleLowerCase() === s[idx] + ? c + : c.toLocaleUpperCase() ) .join("")) || s From 4113332168bc291776e01b9fbe513fa68fa6d216 Mon Sep 17 00:00:00 2001 From: whyoleg Date: Mon, 14 Oct 2019 18:00:18 +0300 Subject: [PATCH 06/75] MS-1256 add possibility to create diary note --- icc-api/api/XHR.ts | 5 +- icc-api/api/iccBeEfactApi.ts | 6 +- icc-api/api/iccBeKmehrApi.ts | 22 +++++++ icc-api/api/iccInvoiceApi.ts | 13 +++++ icc-api/model/Address.ts | 63 ++++++++++++++++++++ icc-api/model/AddressDto.ts | 2 + icc-api/model/AmppDto.ts | 4 +- icc-api/model/CareTeamMemberDto.ts | 45 +++++++++++++++ icc-api/model/CareTeamMembershipDto.ts | 45 +++++++++++++++ icc-api/model/DiaryNoteExportInfoDto.ts | 46 +++++++++++++++ icc-api/model/EmployerDto.ts | 34 +++++++++++ icc-api/model/EmploymentInfoDto.ts | 38 +++++++++++++ icc-api/model/HealthElementDto.ts | 2 +- icc-api/model/ParagraphAgreementDto.ts | 4 +- icc-api/model/PatientDto.ts | 20 ++++++- icc-api/model/PlanOfActionDto.ts | 2 + icc-api/model/Property.ts | 50 ++++++++++++++++ icc-api/model/PropertyType.ts | 76 +++++++++++++++++++++++++ icc-api/model/SchoolingInfoDto.ts | 38 +++++++++++++ icc-api/model/SumehrExportInfoDto.ts | 2 + icc-api/model/Telecom.ts | 54 ++++++++++++++++++ icc-api/model/TypedValue.ts | 53 +++++++++++++++++ icc-api/model/models.ts | 12 +++- icc-x-api/icc-document-x-api.ts | 2 +- 24 files changed, 623 insertions(+), 15 deletions(-) create mode 100644 icc-api/model/Address.ts create mode 100644 icc-api/model/CareTeamMemberDto.ts create mode 100644 icc-api/model/CareTeamMembershipDto.ts create mode 100644 icc-api/model/DiaryNoteExportInfoDto.ts create mode 100644 icc-api/model/EmployerDto.ts create mode 100644 icc-api/model/EmploymentInfoDto.ts create mode 100644 icc-api/model/Property.ts create mode 100644 icc-api/model/PropertyType.ts create mode 100644 icc-api/model/SchoolingInfoDto.ts create mode 100644 icc-api/model/Telecom.ts create mode 100644 icc-api/model/TypedValue.ts diff --git a/icc-api/api/XHR.ts b/icc-api/api/XHR.ts index f37e97e3..ff4efeb5 100644 --- a/icc-api/api/XHR.ts +++ b/icc-api/api/XHR.ts @@ -57,8 +57,7 @@ export namespace XHR { method: string, url: string, headers: Array
| null, - data: string | any = "", - contentTypeOverride?: "application/json" | "text/plain" | "application/octet-stream" + data: string | any = "" ): Promise { const contentType = headers && @@ -102,7 +101,7 @@ export namespace XHR { if (response.status >= 400) { throw new XHRError(response.statusText, response.status, response.status, response.headers) } - const ct = contentTypeOverride || response.headers.get("content-type") || "text/plain" + const ct = response.headers.get("content-type") || "text/plain" return (ct.startsWith("application/json") ? response.json() : ct.startsWith("application/xml") || ct.startsWith("text/") diff --git a/icc-api/api/iccBeEfactApi.ts b/icc-api/api/iccBeEfactApi.ts index efcc5299..31c2ad33 100644 --- a/icc-api/api/iccBeEfactApi.ts +++ b/icc-api/api/iccBeEfactApi.ts @@ -44,7 +44,7 @@ export class iccBeEfactApi { createBatchAndMessage( insuranceId: string, - batchRef: string, + newMessageId: string, numericalRef: number, body?: models.MapOfIdsDto ): Promise { @@ -53,9 +53,9 @@ export class iccBeEfactApi { const _url = this.host + - "/be_efact/{insuranceId}/{batchRef}/{numericalRef}" + "/be_efact/{insuranceId}/{newMessageId}/{numericalRef}" .replace("{insuranceId}", insuranceId + "") - .replace("{batchRef}", batchRef + "") + .replace("{newMessageId}", newMessageId + "") .replace("{numericalRef}", numericalRef + "") + "?ts=" + new Date().getTime() diff --git a/icc-api/api/iccBeKmehrApi.ts b/icc-api/api/iccBeKmehrApi.ts index c14ad4d2..372fd249 100644 --- a/icc-api/api/iccBeKmehrApi.ts +++ b/icc-api/api/iccBeKmehrApi.ts @@ -106,6 +106,28 @@ export class iccBeKmehrApi { .then(doc => doc.body) .catch(err => this.handleError(err)) } + generateDiaryNote( + patientId: string, + language?: string, + body?: models.DiaryNoteExportInfoDto + ): Promise { + let _body = null + _body = body + + const _url = + this.host + + "/be_kmehr/diarynote/{patientId}/export".replace("{patientId}", patientId + "") + + "?ts=" + + new Date().getTime() + + (language ? "&language=" + language : "") + let headers = this.headers + headers = headers + .filter(h => h.header !== "Content-Type") + .concat(new XHR.Header("Content-Type", "application/json")) + return XHR.sendCommand("POST", _url, headers, _body) + .then(doc => doc.body) + .catch(err => this.handleError(err)) + } generateLabresultExport( patientId: string, id: string, diff --git a/icc-api/api/iccInvoiceApi.ts b/icc-api/api/iccInvoiceApi.ts index 22b6ed47..5bf512ca 100644 --- a/icc-api/api/iccInvoiceApi.ts +++ b/icc-api/api/iccInvoiceApi.ts @@ -104,6 +104,19 @@ export class iccInvoiceApi { .then(doc => true) .catch(err => this.handleError(err)) } + filterBy(body?: models.FilterChain): Promise | any> { + let _body = null + _body = body + + const _url = this.host + "/invoice/filter" + "?ts=" + new Date().getTime() + let headers = this.headers + headers = headers + .filter(h => h.header !== "Content-Type") + .concat(new XHR.Header("Content-Type", "application/json")) + return XHR.sendCommand("POST", _url, headers, _body) + .then(doc => (doc.body as Array).map(it => JSON.parse(JSON.stringify(it)))) + .catch(err => this.handleError(err)) + } findByAuthor( hcPartyId: string, fromDate?: number, diff --git a/icc-api/model/Address.ts b/icc-api/model/Address.ts new file mode 100644 index 00000000..152d592a --- /dev/null +++ b/icc-api/model/Address.ts @@ -0,0 +1,63 @@ +/** + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.0.2 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import * as models from "./models" + +export class Address { + constructor(json: JSON | any) { + Object.assign(this as Address, json) + } + addressType?: Address.AddressTypeEnum + + descr?: string + + street?: string + + houseNumber?: string + + postboxNumber?: string + + postalCode?: string + + city?: string + + country?: string + + encryptedSelf?: string + + note?: string + + telecoms?: Array +} +export namespace Address { + export enum AddressTypeEnum { + Home = "home", + Work = "work", + Vacation = "vacation", + Hospital = "hospital", + Clinic = "clinic", + Hq = "hq", + Other = "other" + } +} diff --git a/icc-api/model/AddressDto.ts b/icc-api/model/AddressDto.ts index 6ed08f16..39375a9b 100644 --- a/icc-api/model/AddressDto.ts +++ b/icc-api/model/AddressDto.ts @@ -48,6 +48,8 @@ export class AddressDto { encryptedSelf?: string + note?: string + telecoms?: Array } export namespace AddressDto { diff --git a/icc-api/model/AmppDto.ts b/icc-api/model/AmppDto.ts index 83890849..10dc8b07 100644 --- a/icc-api/model/AmppDto.ts +++ b/icc-api/model/AmppDto.ts @@ -96,9 +96,9 @@ export class AmppDto { dmpps?: Array - orphan?: boolean - singleUse?: boolean + + orphan?: boolean } export namespace AmppDto { export enum StatusEnum { diff --git a/icc-api/model/CareTeamMemberDto.ts b/icc-api/model/CareTeamMemberDto.ts new file mode 100644 index 00000000..bf641056 --- /dev/null +++ b/icc-api/model/CareTeamMemberDto.ts @@ -0,0 +1,45 @@ +/** + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.0.2 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import * as models from "./models" + +export class CareTeamMemberDto { + constructor(json: JSON | any) { + Object.assign(this as CareTeamMemberDto, json) + } + id?: string + + careTeamMemberType?: CareTeamMemberDto.CareTeamMemberTypeEnum + + healthcarePartyId?: string + + quality?: models.CodeStub +} +export namespace CareTeamMemberDto { + export enum CareTeamMemberTypeEnum { + Physician = "physician", + Specialist = "specialist", + Other = "other" + } +} diff --git a/icc-api/model/CareTeamMembershipDto.ts b/icc-api/model/CareTeamMembershipDto.ts new file mode 100644 index 00000000..33e5a71e --- /dev/null +++ b/icc-api/model/CareTeamMembershipDto.ts @@ -0,0 +1,45 @@ +/** + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.0.2 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import * as models from "./models" + +export class CareTeamMembershipDto { + constructor(json: JSON | any) { + Object.assign(this as CareTeamMembershipDto, json) + } + startDate?: number + + endDate?: number + + careTeamMemberId?: string + + membershipType?: CareTeamMembershipDto.MembershipTypeEnum +} +export namespace CareTeamMembershipDto { + export enum MembershipTypeEnum { + Doctor = "doctor", + Mutuality = "mutuality", + Patient = "patient" + } +} diff --git a/icc-api/model/DiaryNoteExportInfoDto.ts b/icc-api/model/DiaryNoteExportInfoDto.ts new file mode 100644 index 00000000..0155eefd --- /dev/null +++ b/icc-api/model/DiaryNoteExportInfoDto.ts @@ -0,0 +1,46 @@ +/** + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.0.2 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import * as models from "./models" + +export class DiaryNoteExportInfoDto { + constructor(json: JSON | any) { + Object.assign(this as DiaryNoteExportInfoDto, json) + } + secretForeignKeys?: Array + + tags?: Array + + contexts?: Array + + documentId?: string + + attachmentId?: string + + recipient?: models.HealthcarePartyDto + + note?: string + + isPsy?: boolean +} diff --git a/icc-api/model/EmployerDto.ts b/icc-api/model/EmployerDto.ts new file mode 100644 index 00000000..1203159a --- /dev/null +++ b/icc-api/model/EmployerDto.ts @@ -0,0 +1,34 @@ +/** + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.0.2 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import * as models from "./models" + +export class EmployerDto { + constructor(json: JSON | any) { + Object.assign(this as EmployerDto, json) + } + name?: string + + addresse?: models.Address +} diff --git a/icc-api/model/EmploymentInfoDto.ts b/icc-api/model/EmploymentInfoDto.ts new file mode 100644 index 00000000..f061ddbf --- /dev/null +++ b/icc-api/model/EmploymentInfoDto.ts @@ -0,0 +1,38 @@ +/** + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.0.2 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import * as models from "./models" + +export class EmploymentInfoDto { + constructor(json: JSON | any) { + Object.assign(this as EmploymentInfoDto, json) + } + startDate?: number + + endDate?: number + + professionType?: models.CodeStub + + employer?: models.EmployerDto +} diff --git a/icc-api/model/HealthElementDto.ts b/icc-api/model/HealthElementDto.ts index d1370ee7..e2ccb626 100644 --- a/icc-api/model/HealthElementDto.ts +++ b/icc-api/model/HealthElementDto.ts @@ -84,7 +84,7 @@ export class HealthElementDto { episodes?: Array - careTeam?: Array + careTeam?: Array encryptedSelf?: string } diff --git a/icc-api/model/ParagraphAgreementDto.ts b/icc-api/model/ParagraphAgreementDto.ts index c23a9961..c6b5cf11 100644 --- a/icc-api/model/ParagraphAgreementDto.ts +++ b/icc-api/model/ParagraphAgreementDto.ts @@ -72,9 +72,9 @@ export class ParagraphAgreementDto { documentId?: string - canceled?: boolean + inTreatment?: boolean accepted?: boolean - inTreatment?: boolean + canceled?: boolean } diff --git a/icc-api/model/PatientDto.ts b/icc-api/model/PatientDto.ts index 16e3cded..80c856ba 100644 --- a/icc-api/model/PatientDto.ts +++ b/icc-api/model/PatientDto.ts @@ -112,6 +112,8 @@ export class PatientDto { preferredUserId?: string + comment?: string + encryptedAdministrativesDocuments?: Array picture?: string @@ -140,10 +142,24 @@ export class PatientDto { parameters?: { [key: string]: Array } - importedData?: { [key: string]: string } - patientProfessions?: Array + fatherBirthCountry?: models.CodeStub + + birthCountry?: models.CodeStub + + nativeCountry?: models.CodeStub + + socialStatus?: models.CodeStub + + mainSourceOfIncome?: models.CodeStub + + schoolingInfos?: Array + + employementInfos?: Array + + properties?: Array + encryptedSelf?: string } export namespace PatientDto { diff --git a/icc-api/model/PlanOfActionDto.ts b/icc-api/model/PlanOfActionDto.ts index f66c8e2d..b46cf804 100644 --- a/icc-api/model/PlanOfActionDto.ts +++ b/icc-api/model/PlanOfActionDto.ts @@ -68,5 +68,7 @@ export class PlanOfActionDto { status?: number + careTeamMemberships?: Array + encryptedSelf?: string } diff --git a/icc-api/model/Property.ts b/icc-api/model/Property.ts new file mode 100644 index 00000000..b32f5049 --- /dev/null +++ b/icc-api/model/Property.ts @@ -0,0 +1,50 @@ +/** + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.0.2 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import * as models from "./models" + +export class Property { + constructor(json: JSON | any) { + Object.assign(this as Property, json) + } + type?: models.PropertyType + + typedValue?: models.TypedValue + + attachments?: { [key: string]: models.Attachment } + + deleted?: number + + id?: string + + rev?: string + + revsInfo?: Array + + conflicts?: Array + + javaType?: string + + revHistory?: { [key: string]: string } +} diff --git a/icc-api/model/PropertyType.ts b/icc-api/model/PropertyType.ts new file mode 100644 index 00000000..88a28bab --- /dev/null +++ b/icc-api/model/PropertyType.ts @@ -0,0 +1,76 @@ +/** + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.0.2 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import * as models from "./models" + +export class PropertyType { + constructor(json: JSON | any) { + Object.assign(this as PropertyType, json) + } + identifier?: string + + type?: PropertyType.TypeEnum + + scope?: PropertyType.ScopeEnum + + unique?: boolean + + editor?: string + + localized?: boolean + + attachments?: { [key: string]: models.Attachment } + + deleted?: number + + id?: string + + rev?: string + + revsInfo?: Array + + conflicts?: Array + + javaType?: string + + revHistory?: { [key: string]: string } +} +export namespace PropertyType { + export enum TypeEnum { + BOOLEAN = "BOOLEAN", + INTEGER = "INTEGER", + DOUBLE = "DOUBLE", + STRING = "STRING", + DATE = "DATE", + CLOB = "CLOB", + JSON = "JSON" + } + export enum ScopeEnum { + SYSTEM = "SYSTEM", + NODE = "NODE", + ROLE = "ROLE", + USER = "USER", + EVENT = "EVENT" + } +} diff --git a/icc-api/model/SchoolingInfoDto.ts b/icc-api/model/SchoolingInfoDto.ts new file mode 100644 index 00000000..4dbb7add --- /dev/null +++ b/icc-api/model/SchoolingInfoDto.ts @@ -0,0 +1,38 @@ +/** + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.0.2 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import * as models from "./models" + +export class SchoolingInfoDto { + constructor(json: JSON | any) { + Object.assign(this as SchoolingInfoDto, json) + } + startDate?: number + + endDate?: number + + school?: string + + typeOfEducation?: models.CodeStub +} diff --git a/icc-api/model/SumehrExportInfoDto.ts b/icc-api/model/SumehrExportInfoDto.ts index 3d4820a1..30f2de84 100644 --- a/icc-api/model/SumehrExportInfoDto.ts +++ b/icc-api/model/SumehrExportInfoDto.ts @@ -35,4 +35,6 @@ export class SumehrExportInfoDto { recipient?: models.HealthcarePartyDto comment?: string + + includeIrrelevantInformation?: boolean } diff --git a/icc-api/model/Telecom.ts b/icc-api/model/Telecom.ts new file mode 100644 index 00000000..8452307d --- /dev/null +++ b/icc-api/model/Telecom.ts @@ -0,0 +1,54 @@ +/** + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.0.2 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import * as models from "./models" + +export class Telecom { + constructor(json: JSON | any) { + Object.assign(this as Telecom, json) + } + telecomType?: Telecom.TelecomTypeEnum + + telecomNumber?: string + + telecomDescription?: string + + encryptedSelf?: string +} +export namespace Telecom { + export enum TelecomTypeEnum { + Mobile = "mobile", + Phone = "phone", + Email = "email", + Fax = "fax", + Skype = "skype", + Im = "im", + Medibridge = "medibridge", + Ehealthbox = "ehealthbox", + Apicrypt = "apicrypt", + Web = "web", + Print = "print", + Disk = "disk" + } +} diff --git a/icc-api/model/TypedValue.ts b/icc-api/model/TypedValue.ts new file mode 100644 index 00000000..578753c2 --- /dev/null +++ b/icc-api/model/TypedValue.ts @@ -0,0 +1,53 @@ +/** + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.0.2 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import * as models from "./models" + +export class TypedValue { + constructor(json: JSON | any) { + Object.assign(this as TypedValue, json) + } + type?: TypedValue.TypeEnum + + booleanValue?: boolean + + integerValue?: number + + doubleValue?: number + + stringValue?: string + + dateValue?: number +} +export namespace TypedValue { + export enum TypeEnum { + BOOLEAN = "BOOLEAN", + INTEGER = "INTEGER", + DOUBLE = "DOUBLE", + STRING = "STRING", + DATE = "DATE", + CLOB = "CLOB", + JSON = "JSON" + } +} diff --git a/icc-api/model/models.ts b/icc-api/model/models.ts index 5db3ef04..bcefc481 100644 --- a/icc-api/model/models.ts +++ b/icc-api/model/models.ts @@ -1,5 +1,6 @@ export * from "./AccessLogDto" export * from "./AccessLogPaginatedList" +export * from "./Address" export * from "./AddressDto" export * from "./AdministrationQuantity" export * from "./AgendaDto" @@ -21,7 +22,8 @@ export * from "./ByteArrayDto" export * from "./CalendarItemDto" export * from "./CalendarItemTagDto" export * from "./CalendarItemTypeDto" -export * from "./CareMemberDto" +export * from "./CareTeamMemberDto" +export * from "./CareTeamMembershipDto" export * from "./CheckSMFPatientResult" export * from "./ClassificationDto" export * from "./ClassificationTemplateDto" @@ -43,6 +45,7 @@ export * from "./CopaymentDto" export * from "./DatabaseSynchronizationDto" export * from "./DelegationDto" export * from "./DeviceTypeDto" +export * from "./DiaryNoteExportInfoDto" export * from "./DmppDto" export * from "./DocId" export * from "./DocPreview" @@ -54,6 +57,8 @@ export * from "./EIDItem" export * from "./Editor" export * from "./EmailOrSmsMessageDto" export * from "./EmailTemplateDto" +export * from "./EmployerDto" +export * from "./EmploymentInfoDto" export * from "./EntityReference" export * from "./EntityTemplateDto" export * from "./EpisodeDto" @@ -153,7 +158,9 @@ export * from "./PlaceDto" export * from "./PlanOfActionDto" export * from "./Predicate" export * from "./PricingDto" +export * from "./Property" export * from "./PropertyDto" +export * from "./PropertyType" export * from "./PropertyTypeDto" export * from "./PublicKeyDto" export * from "./QuantityDto" @@ -170,6 +177,7 @@ export * from "./RevisionInfo" export * from "./Right" export * from "./RouteOfAdministrationDto" export * from "./SamTextDto" +export * from "./SchoolingInfoDto" export * from "./ServiceDto" export * from "./ServiceLink" export * from "./ServicePaginatedList" @@ -188,10 +196,12 @@ export * from "./SumehrValidityDto" export * from "./Tag" export * from "./TarificationDto" export * from "./TarificationPaginatedList" +export * from "./Telecom" export * from "./TelecomDtoEmbed" export * from "./TimeTableDto" export * from "./TimeTableHourDto" export * from "./TimeTableItemDto" +export * from "./TypedValue" export * from "./TypedValueDto" export * from "./UserDto" export * from "./UserPaginatedList" diff --git a/icc-x-api/icc-document-x-api.ts b/icc-x-api/icc-document-x-api.ts index 48038dc2..46cdeb92 100644 --- a/icc-x-api/icc-document-x-api.ts +++ b/icc-x-api/icc-document-x-api.ts @@ -733,7 +733,7 @@ export class IccDocumentXApi extends iccDocumentApi { new Date().getTime() + (enckeys ? `&enckeys=${enckeys}` : "") + (fileName ? `&fileName=${fileName}` : "") - return XHR.sendCommand("GET", url, this.headers, null, returnType) + return XHR.sendCommand("GET", url, this.headers, null) .then(doc => doc.body) .catch(err => this.handleError(err)) } From f06d75a2ed1e7a314b7a04efa690a1b3e3b43d35 Mon Sep 17 00:00:00 2001 From: whyoleg Date: Tue, 22 Oct 2019 11:42:25 +0300 Subject: [PATCH 07/75] fix --- icc-api/api/XHR.ts | 5 +++-- icc-x-api/icc-document-x-api.ts | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/icc-api/api/XHR.ts b/icc-api/api/XHR.ts index ff4efeb5..f37e97e3 100644 --- a/icc-api/api/XHR.ts +++ b/icc-api/api/XHR.ts @@ -57,7 +57,8 @@ export namespace XHR { method: string, url: string, headers: Array
| null, - data: string | any = "" + data: string | any = "", + contentTypeOverride?: "application/json" | "text/plain" | "application/octet-stream" ): Promise { const contentType = headers && @@ -101,7 +102,7 @@ export namespace XHR { if (response.status >= 400) { throw new XHRError(response.statusText, response.status, response.status, response.headers) } - const ct = response.headers.get("content-type") || "text/plain" + const ct = contentTypeOverride || response.headers.get("content-type") || "text/plain" return (ct.startsWith("application/json") ? response.json() : ct.startsWith("application/xml") || ct.startsWith("text/") diff --git a/icc-x-api/icc-document-x-api.ts b/icc-x-api/icc-document-x-api.ts index 46cdeb92..48038dc2 100644 --- a/icc-x-api/icc-document-x-api.ts +++ b/icc-x-api/icc-document-x-api.ts @@ -733,7 +733,7 @@ export class IccDocumentXApi extends iccDocumentApi { new Date().getTime() + (enckeys ? `&enckeys=${enckeys}` : "") + (fileName ? `&fileName=${fileName}` : "") - return XHR.sendCommand("GET", url, this.headers, null) + return XHR.sendCommand("GET", url, this.headers, null, returnType) .then(doc => doc.body) .catch(err => this.handleError(err)) } From 79f55108ff5ccaffb4b0f2edd58a2562bb9108e3 Mon Sep 17 00:00:00 2001 From: Antoine Pairet Date: Tue, 22 Oct 2019 10:42:38 +0200 Subject: [PATCH 08/75] genloc --- icc-api/api/iccBeEfactApi.ts | 6 +- icc-api/api/iccBeKmehrApi.ts | 22 ++++++ icc-api/api/iccCodeApi.ts | 26 +++++++ icc-api/api/iccInvoiceApi.ts | 13 ++++ icc-api/api/iccUserApi.ts | 12 --- icc-api/iccApi.ts | 2 - icc-api/model/Address.ts | 63 +++++++++++++++ icc-api/model/AddressDto.ts | 2 + icc-api/model/AmppDto.ts | 4 +- icc-api/model/CareTeamMemberDto.ts | 45 +++++++++++ icc-api/model/CareTeamMembershipDto.ts | 45 +++++++++++ icc-api/model/Code.ts | 2 - icc-api/model/DiaryNoteExportInfoDto.ts | 46 +++++++++++ icc-api/model/EmployerDto.ts | 34 +++++++++ icc-api/model/EmploymentInfoDto.ts | 38 ++++++++++ icc-api/model/HealthElementDto.ts | 2 +- .../model/MedicationSchemeExportInfoDto.ts | 2 + icc-api/model/ParagraphAgreementDto.ts | 4 +- icc-api/model/PatientDto.ts | 20 ++++- icc-api/model/PlanOfActionDto.ts | 2 + icc-api/model/Property.ts | 50 ++++++++++++ icc-api/model/PropertyType.ts | 76 +++++++++++++++++++ icc-api/model/SchoolingInfoDto.ts | 38 ++++++++++ icc-api/model/SumehrExportInfoDto.ts | 2 + icc-api/model/Telecom.ts | 54 +++++++++++++ icc-api/model/TypedValue.ts | 53 +++++++++++++ icc-api/model/UserDto.ts | 4 +- icc-api/model/UserStubDto.ts | 4 +- icc-api/model/models.ts | 13 +++- 29 files changed, 652 insertions(+), 32 deletions(-) create mode 100644 icc-api/model/Address.ts create mode 100644 icc-api/model/CareTeamMemberDto.ts create mode 100644 icc-api/model/CareTeamMembershipDto.ts create mode 100644 icc-api/model/DiaryNoteExportInfoDto.ts create mode 100644 icc-api/model/EmployerDto.ts create mode 100644 icc-api/model/EmploymentInfoDto.ts create mode 100644 icc-api/model/Property.ts create mode 100644 icc-api/model/PropertyType.ts create mode 100644 icc-api/model/SchoolingInfoDto.ts create mode 100644 icc-api/model/Telecom.ts create mode 100644 icc-api/model/TypedValue.ts diff --git a/icc-api/api/iccBeEfactApi.ts b/icc-api/api/iccBeEfactApi.ts index efcc5299..31c2ad33 100644 --- a/icc-api/api/iccBeEfactApi.ts +++ b/icc-api/api/iccBeEfactApi.ts @@ -44,7 +44,7 @@ export class iccBeEfactApi { createBatchAndMessage( insuranceId: string, - batchRef: string, + newMessageId: string, numericalRef: number, body?: models.MapOfIdsDto ): Promise { @@ -53,9 +53,9 @@ export class iccBeEfactApi { const _url = this.host + - "/be_efact/{insuranceId}/{batchRef}/{numericalRef}" + "/be_efact/{insuranceId}/{newMessageId}/{numericalRef}" .replace("{insuranceId}", insuranceId + "") - .replace("{batchRef}", batchRef + "") + .replace("{newMessageId}", newMessageId + "") .replace("{numericalRef}", numericalRef + "") + "?ts=" + new Date().getTime() diff --git a/icc-api/api/iccBeKmehrApi.ts b/icc-api/api/iccBeKmehrApi.ts index c14ad4d2..372fd249 100644 --- a/icc-api/api/iccBeKmehrApi.ts +++ b/icc-api/api/iccBeKmehrApi.ts @@ -106,6 +106,28 @@ export class iccBeKmehrApi { .then(doc => doc.body) .catch(err => this.handleError(err)) } + generateDiaryNote( + patientId: string, + language?: string, + body?: models.DiaryNoteExportInfoDto + ): Promise { + let _body = null + _body = body + + const _url = + this.host + + "/be_kmehr/diarynote/{patientId}/export".replace("{patientId}", patientId + "") + + "?ts=" + + new Date().getTime() + + (language ? "&language=" + language : "") + let headers = this.headers + headers = headers + .filter(h => h.header !== "Content-Type") + .concat(new XHR.Header("Content-Type", "application/json")) + return XHR.sendCommand("POST", _url, headers, _body) + .then(doc => doc.body) + .catch(err => this.handleError(err)) + } generateLabresultExport( patientId: string, id: string, diff --git a/icc-api/api/iccCodeApi.ts b/icc-api/api/iccCodeApi.ts index 33f9ca34..f0c5feb1 100644 --- a/icc-api/api/iccCodeApi.ts +++ b/icc-api/api/iccCodeApi.ts @@ -189,6 +189,32 @@ export class iccCodeApi { .then(doc => new models.CodePaginatedList(doc.body as JSON)) .catch(err => this.handleError(err)) } + findPaginatedCodesWithLink( + linkType: string, + linkedId?: string, + startKey?: string, + startDocumentId?: string, + limit?: number + ): Promise { + let _body = null + + const _url = + this.host + + "/code/link/{linkType}".replace("{linkType}", linkType + "") + + "?ts=" + + new Date().getTime() + + (linkedId ? "&linkedId=" + linkedId : "") + + (startKey ? "&startKey=" + startKey : "") + + (startDocumentId ? "&startDocumentId=" + startDocumentId : "") + + (limit ? "&limit=" + limit : "") + let headers = this.headers + headers = headers + .filter(h => h.header !== "Content-Type") + .concat(new XHR.Header("Content-Type", "application/json")) + return XHR.sendCommand("GET", _url, headers, _body) + .then(doc => new models.CodePaginatedList(doc.body as JSON)) + .catch(err => this.handleError(err)) + } findTagTypes(region?: string, type?: string): Promise | any> { let _body = null diff --git a/icc-api/api/iccInvoiceApi.ts b/icc-api/api/iccInvoiceApi.ts index 22b6ed47..5bf512ca 100644 --- a/icc-api/api/iccInvoiceApi.ts +++ b/icc-api/api/iccInvoiceApi.ts @@ -104,6 +104,19 @@ export class iccInvoiceApi { .then(doc => true) .catch(err => this.handleError(err)) } + filterBy(body?: models.FilterChain): Promise | any> { + let _body = null + _body = body + + const _url = this.host + "/invoice/filter" + "?ts=" + new Date().getTime() + let headers = this.headers + headers = headers + .filter(h => h.header !== "Content-Type") + .concat(new XHR.Header("Content-Type", "application/json")) + return XHR.sendCommand("POST", _url, headers, _body) + .then(doc => (doc.body as Array).map(it => JSON.parse(JSON.stringify(it)))) + .catch(err => this.handleError(err)) + } findByAuthor( hcPartyId: string, fromDate?: number, diff --git a/icc-api/api/iccUserApi.ts b/icc-api/api/iccUserApi.ts index 63b883c5..c0e83ef6 100644 --- a/icc-api/api/iccUserApi.ts +++ b/icc-api/api/iccUserApi.ts @@ -157,18 +157,6 @@ export class iccUserApi { .then(doc => new models.UserDto(doc.body as JSON)) .catch(err => this.handleError(err)) } - getMatchingUsers(): Promise | any> { - let _body = null - - const _url = this.host + "/user/matches" + "?ts=" + new Date().getTime() - let headers = this.headers - headers = headers - .filter(h => h.header !== "Content-Type") - .concat(new XHR.Header("Content-Type", "application/json")) - return XHR.sendCommand("GET", _url, headers, _body) - .then(doc => (doc.body as Array).map(it => new models.UserDto(it))) - .catch(err => this.handleError(err)) - } getUser(userId: string): Promise { let _body = null diff --git a/icc-api/iccApi.ts b/icc-api/iccApi.ts index 788826c8..14b9ba8f 100644 --- a/icc-api/iccApi.ts +++ b/icc-api/iccApi.ts @@ -14,7 +14,6 @@ export * from "./api/iccCalendarItemApi" export * from "./api/iccCalendarItemTypeApi" export * from "./api/iccClassificationApi" export * from "./api/iccClassificationTemplateApi" -export * from "./api/iccClusterApi" export * from "./api/iccCodeApi" export * from "./api/iccContactApi" export * from "./api/iccDoctemplateApi" @@ -24,7 +23,6 @@ export * from "./api/iccEntitytemplateApi" export * from "./api/iccFormApi" export * from "./api/iccFrontendmigrationApi" export * from "./api/iccGenericApi" -export * from "./api/iccGroupApi" export * from "./api/iccHcpartyApi" export * from "./api/iccHelementApi" export * from "./api/iccIcureApi" diff --git a/icc-api/model/Address.ts b/icc-api/model/Address.ts new file mode 100644 index 00000000..152d592a --- /dev/null +++ b/icc-api/model/Address.ts @@ -0,0 +1,63 @@ +/** + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.0.2 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import * as models from "./models" + +export class Address { + constructor(json: JSON | any) { + Object.assign(this as Address, json) + } + addressType?: Address.AddressTypeEnum + + descr?: string + + street?: string + + houseNumber?: string + + postboxNumber?: string + + postalCode?: string + + city?: string + + country?: string + + encryptedSelf?: string + + note?: string + + telecoms?: Array +} +export namespace Address { + export enum AddressTypeEnum { + Home = "home", + Work = "work", + Vacation = "vacation", + Hospital = "hospital", + Clinic = "clinic", + Hq = "hq", + Other = "other" + } +} diff --git a/icc-api/model/AddressDto.ts b/icc-api/model/AddressDto.ts index 6ed08f16..39375a9b 100644 --- a/icc-api/model/AddressDto.ts +++ b/icc-api/model/AddressDto.ts @@ -48,6 +48,8 @@ export class AddressDto { encryptedSelf?: string + note?: string + telecoms?: Array } export namespace AddressDto { diff --git a/icc-api/model/AmppDto.ts b/icc-api/model/AmppDto.ts index 83890849..10dc8b07 100644 --- a/icc-api/model/AmppDto.ts +++ b/icc-api/model/AmppDto.ts @@ -96,9 +96,9 @@ export class AmppDto { dmpps?: Array - orphan?: boolean - singleUse?: boolean + + orphan?: boolean } export namespace AmppDto { export enum StatusEnum { diff --git a/icc-api/model/CareTeamMemberDto.ts b/icc-api/model/CareTeamMemberDto.ts new file mode 100644 index 00000000..bf641056 --- /dev/null +++ b/icc-api/model/CareTeamMemberDto.ts @@ -0,0 +1,45 @@ +/** + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.0.2 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import * as models from "./models" + +export class CareTeamMemberDto { + constructor(json: JSON | any) { + Object.assign(this as CareTeamMemberDto, json) + } + id?: string + + careTeamMemberType?: CareTeamMemberDto.CareTeamMemberTypeEnum + + healthcarePartyId?: string + + quality?: models.CodeStub +} +export namespace CareTeamMemberDto { + export enum CareTeamMemberTypeEnum { + Physician = "physician", + Specialist = "specialist", + Other = "other" + } +} diff --git a/icc-api/model/CareTeamMembershipDto.ts b/icc-api/model/CareTeamMembershipDto.ts new file mode 100644 index 00000000..33e5a71e --- /dev/null +++ b/icc-api/model/CareTeamMembershipDto.ts @@ -0,0 +1,45 @@ +/** + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.0.2 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import * as models from "./models" + +export class CareTeamMembershipDto { + constructor(json: JSON | any) { + Object.assign(this as CareTeamMembershipDto, json) + } + startDate?: number + + endDate?: number + + careTeamMemberId?: string + + membershipType?: CareTeamMembershipDto.MembershipTypeEnum +} +export namespace CareTeamMembershipDto { + export enum MembershipTypeEnum { + Doctor = "doctor", + Mutuality = "mutuality", + Patient = "patient" + } +} diff --git a/icc-api/model/Code.ts b/icc-api/model/Code.ts index c9bd39b1..70833e3e 100644 --- a/icc-api/model/Code.ts +++ b/icc-api/model/Code.ts @@ -54,8 +54,6 @@ export class Code { data?: string - parent?: string - appendices?: { [key: string]: string } disabled?: boolean diff --git a/icc-api/model/DiaryNoteExportInfoDto.ts b/icc-api/model/DiaryNoteExportInfoDto.ts new file mode 100644 index 00000000..3ed6fc9c --- /dev/null +++ b/icc-api/model/DiaryNoteExportInfoDto.ts @@ -0,0 +1,46 @@ +/** + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.0.2 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import * as models from "./models" + +export class DiaryNoteExportInfoDto { + constructor(json: JSON | any) { + Object.assign(this as DiaryNoteExportInfoDto, json) + } + secretForeignKeys?: Array + + tags?: Array + + contexts?: Array + + documentId?: string + + attachmentId?: string + + recipient?: models.HealthcarePartyDto + + note?: string + + psy?: boolean +} diff --git a/icc-api/model/EmployerDto.ts b/icc-api/model/EmployerDto.ts new file mode 100644 index 00000000..1203159a --- /dev/null +++ b/icc-api/model/EmployerDto.ts @@ -0,0 +1,34 @@ +/** + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.0.2 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import * as models from "./models" + +export class EmployerDto { + constructor(json: JSON | any) { + Object.assign(this as EmployerDto, json) + } + name?: string + + addresse?: models.Address +} diff --git a/icc-api/model/EmploymentInfoDto.ts b/icc-api/model/EmploymentInfoDto.ts new file mode 100644 index 00000000..f061ddbf --- /dev/null +++ b/icc-api/model/EmploymentInfoDto.ts @@ -0,0 +1,38 @@ +/** + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.0.2 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import * as models from "./models" + +export class EmploymentInfoDto { + constructor(json: JSON | any) { + Object.assign(this as EmploymentInfoDto, json) + } + startDate?: number + + endDate?: number + + professionType?: models.CodeStub + + employer?: models.EmployerDto +} diff --git a/icc-api/model/HealthElementDto.ts b/icc-api/model/HealthElementDto.ts index d1370ee7..e2ccb626 100644 --- a/icc-api/model/HealthElementDto.ts +++ b/icc-api/model/HealthElementDto.ts @@ -84,7 +84,7 @@ export class HealthElementDto { episodes?: Array - careTeam?: Array + careTeam?: Array encryptedSelf?: string } diff --git a/icc-api/model/MedicationSchemeExportInfoDto.ts b/icc-api/model/MedicationSchemeExportInfoDto.ts index 6edb549c..07f0f249 100644 --- a/icc-api/model/MedicationSchemeExportInfoDto.ts +++ b/icc-api/model/MedicationSchemeExportInfoDto.ts @@ -30,6 +30,8 @@ export class MedicationSchemeExportInfoDto { } secretForeignKeys?: Array + services?: Array + recipient?: models.HealthcarePartyDto comment?: string diff --git a/icc-api/model/ParagraphAgreementDto.ts b/icc-api/model/ParagraphAgreementDto.ts index c23a9961..c6b5cf11 100644 --- a/icc-api/model/ParagraphAgreementDto.ts +++ b/icc-api/model/ParagraphAgreementDto.ts @@ -72,9 +72,9 @@ export class ParagraphAgreementDto { documentId?: string - canceled?: boolean + inTreatment?: boolean accepted?: boolean - inTreatment?: boolean + canceled?: boolean } diff --git a/icc-api/model/PatientDto.ts b/icc-api/model/PatientDto.ts index 16e3cded..80c856ba 100644 --- a/icc-api/model/PatientDto.ts +++ b/icc-api/model/PatientDto.ts @@ -112,6 +112,8 @@ export class PatientDto { preferredUserId?: string + comment?: string + encryptedAdministrativesDocuments?: Array picture?: string @@ -140,10 +142,24 @@ export class PatientDto { parameters?: { [key: string]: Array } - importedData?: { [key: string]: string } - patientProfessions?: Array + fatherBirthCountry?: models.CodeStub + + birthCountry?: models.CodeStub + + nativeCountry?: models.CodeStub + + socialStatus?: models.CodeStub + + mainSourceOfIncome?: models.CodeStub + + schoolingInfos?: Array + + employementInfos?: Array + + properties?: Array + encryptedSelf?: string } export namespace PatientDto { diff --git a/icc-api/model/PlanOfActionDto.ts b/icc-api/model/PlanOfActionDto.ts index f66c8e2d..b46cf804 100644 --- a/icc-api/model/PlanOfActionDto.ts +++ b/icc-api/model/PlanOfActionDto.ts @@ -68,5 +68,7 @@ export class PlanOfActionDto { status?: number + careTeamMemberships?: Array + encryptedSelf?: string } diff --git a/icc-api/model/Property.ts b/icc-api/model/Property.ts new file mode 100644 index 00000000..b32f5049 --- /dev/null +++ b/icc-api/model/Property.ts @@ -0,0 +1,50 @@ +/** + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.0.2 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import * as models from "./models" + +export class Property { + constructor(json: JSON | any) { + Object.assign(this as Property, json) + } + type?: models.PropertyType + + typedValue?: models.TypedValue + + attachments?: { [key: string]: models.Attachment } + + deleted?: number + + id?: string + + rev?: string + + revsInfo?: Array + + conflicts?: Array + + javaType?: string + + revHistory?: { [key: string]: string } +} diff --git a/icc-api/model/PropertyType.ts b/icc-api/model/PropertyType.ts new file mode 100644 index 00000000..88a28bab --- /dev/null +++ b/icc-api/model/PropertyType.ts @@ -0,0 +1,76 @@ +/** + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.0.2 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import * as models from "./models" + +export class PropertyType { + constructor(json: JSON | any) { + Object.assign(this as PropertyType, json) + } + identifier?: string + + type?: PropertyType.TypeEnum + + scope?: PropertyType.ScopeEnum + + unique?: boolean + + editor?: string + + localized?: boolean + + attachments?: { [key: string]: models.Attachment } + + deleted?: number + + id?: string + + rev?: string + + revsInfo?: Array + + conflicts?: Array + + javaType?: string + + revHistory?: { [key: string]: string } +} +export namespace PropertyType { + export enum TypeEnum { + BOOLEAN = "BOOLEAN", + INTEGER = "INTEGER", + DOUBLE = "DOUBLE", + STRING = "STRING", + DATE = "DATE", + CLOB = "CLOB", + JSON = "JSON" + } + export enum ScopeEnum { + SYSTEM = "SYSTEM", + NODE = "NODE", + ROLE = "ROLE", + USER = "USER", + EVENT = "EVENT" + } +} diff --git a/icc-api/model/SchoolingInfoDto.ts b/icc-api/model/SchoolingInfoDto.ts new file mode 100644 index 00000000..4dbb7add --- /dev/null +++ b/icc-api/model/SchoolingInfoDto.ts @@ -0,0 +1,38 @@ +/** + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.0.2 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import * as models from "./models" + +export class SchoolingInfoDto { + constructor(json: JSON | any) { + Object.assign(this as SchoolingInfoDto, json) + } + startDate?: number + + endDate?: number + + school?: string + + typeOfEducation?: models.CodeStub +} diff --git a/icc-api/model/SumehrExportInfoDto.ts b/icc-api/model/SumehrExportInfoDto.ts index 3d4820a1..30f2de84 100644 --- a/icc-api/model/SumehrExportInfoDto.ts +++ b/icc-api/model/SumehrExportInfoDto.ts @@ -35,4 +35,6 @@ export class SumehrExportInfoDto { recipient?: models.HealthcarePartyDto comment?: string + + includeIrrelevantInformation?: boolean } diff --git a/icc-api/model/Telecom.ts b/icc-api/model/Telecom.ts new file mode 100644 index 00000000..8452307d --- /dev/null +++ b/icc-api/model/Telecom.ts @@ -0,0 +1,54 @@ +/** + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.0.2 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import * as models from "./models" + +export class Telecom { + constructor(json: JSON | any) { + Object.assign(this as Telecom, json) + } + telecomType?: Telecom.TelecomTypeEnum + + telecomNumber?: string + + telecomDescription?: string + + encryptedSelf?: string +} +export namespace Telecom { + export enum TelecomTypeEnum { + Mobile = "mobile", + Phone = "phone", + Email = "email", + Fax = "fax", + Skype = "skype", + Im = "im", + Medibridge = "medibridge", + Ehealthbox = "ehealthbox", + Apicrypt = "apicrypt", + Web = "web", + Print = "print", + Disk = "disk" + } +} diff --git a/icc-api/model/TypedValue.ts b/icc-api/model/TypedValue.ts new file mode 100644 index 00000000..578753c2 --- /dev/null +++ b/icc-api/model/TypedValue.ts @@ -0,0 +1,53 @@ +/** + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.0.2 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import * as models from "./models" + +export class TypedValue { + constructor(json: JSON | any) { + Object.assign(this as TypedValue, json) + } + type?: TypedValue.TypeEnum + + booleanValue?: boolean + + integerValue?: number + + doubleValue?: number + + stringValue?: string + + dateValue?: number +} +export namespace TypedValue { + export enum TypeEnum { + BOOLEAN = "BOOLEAN", + INTEGER = "INTEGER", + DOUBLE = "DOUBLE", + STRING = "STRING", + DATE = "DATE", + CLOB = "CLOB", + JSON = "JSON" + } +} diff --git a/icc-api/model/UserDto.ts b/icc-api/model/UserDto.ts index 01fd42d6..bf6706a1 100644 --- a/icc-api/model/UserDto.ts +++ b/icc-api/model/UserDto.ts @@ -84,9 +84,9 @@ export class UserDto { applicationTokens?: { [key: string]: string } - virtualHostDependency?: UserDto.VirtualHostDependencyEnum - virtualHosts?: Array + + virtualHostDependency?: UserDto.VirtualHostDependencyEnum } export namespace UserDto { export enum TypeEnum { diff --git a/icc-api/model/UserStubDto.ts b/icc-api/model/UserStubDto.ts index ed82a81c..60fc5aa8 100644 --- a/icc-api/model/UserStubDto.ts +++ b/icc-api/model/UserStubDto.ts @@ -44,9 +44,9 @@ export class UserStubDto { autoDelegations?: { [key: string]: Array } - virtualHostDependency?: UserStubDto.VirtualHostDependencyEnum - virtualHosts?: Array + + virtualHostDependency?: UserStubDto.VirtualHostDependencyEnum } export namespace UserStubDto { export enum VirtualHostDependencyEnum { diff --git a/icc-api/model/models.ts b/icc-api/model/models.ts index 5db3ef04..288bf7b6 100644 --- a/icc-api/model/models.ts +++ b/icc-api/model/models.ts @@ -1,5 +1,6 @@ export * from "./AccessLogDto" export * from "./AccessLogPaginatedList" +export * from "./Address" export * from "./AddressDto" export * from "./AdministrationQuantity" export * from "./AgendaDto" @@ -21,7 +22,8 @@ export * from "./ByteArrayDto" export * from "./CalendarItemDto" export * from "./CalendarItemTagDto" export * from "./CalendarItemTypeDto" -export * from "./CareMemberDto" +export * from "./CareTeamMemberDto" +export * from "./CareTeamMembershipDto" export * from "./CheckSMFPatientResult" export * from "./ClassificationDto" export * from "./ClassificationTemplateDto" @@ -43,6 +45,7 @@ export * from "./CopaymentDto" export * from "./DatabaseSynchronizationDto" export * from "./DelegationDto" export * from "./DeviceTypeDto" +export * from "./DiaryNoteExportInfoDto" export * from "./DmppDto" export * from "./DocId" export * from "./DocPreview" @@ -54,6 +57,8 @@ export * from "./EIDItem" export * from "./Editor" export * from "./EmailOrSmsMessageDto" export * from "./EmailTemplateDto" +export * from "./EmployerDto" +export * from "./EmploymentInfoDto" export * from "./EntityReference" export * from "./EntityTemplateDto" export * from "./EpisodeDto" @@ -75,7 +80,6 @@ export * from "./Formula" export * from "./FrontEndMigrationDto" export * from "./FullTextSearchResult" export * from "./GalInfos" -export * from "./GroupDto" export * from "./HcPartyPaginatedList" export * from "./HealthElementDto" export * from "./HealthcarePartyDto" @@ -153,7 +157,9 @@ export * from "./PlaceDto" export * from "./PlanOfActionDto" export * from "./Predicate" export * from "./PricingDto" +export * from "./Property" export * from "./PropertyDto" +export * from "./PropertyType" export * from "./PropertyTypeDto" export * from "./PublicKeyDto" export * from "./QuantityDto" @@ -170,6 +176,7 @@ export * from "./RevisionInfo" export * from "./Right" export * from "./RouteOfAdministrationDto" export * from "./SamTextDto" +export * from "./SchoolingInfoDto" export * from "./ServiceDto" export * from "./ServiceLink" export * from "./ServicePaginatedList" @@ -188,10 +195,12 @@ export * from "./SumehrValidityDto" export * from "./Tag" export * from "./TarificationDto" export * from "./TarificationPaginatedList" +export * from "./Telecom" export * from "./TelecomDtoEmbed" export * from "./TimeTableDto" export * from "./TimeTableHourDto" export * from "./TimeTableItemDto" +export * from "./TypedValue" export * from "./TypedValueDto" export * from "./UserDto" export * from "./UserPaginatedList" From 00b9680c629fc4c46338bd1bd296b49e5ccc37de Mon Sep 17 00:00:00 2001 From: whyoleg Date: Tue, 22 Oct 2019 13:09:04 +0300 Subject: [PATCH 09/75] MS-1367 add buttons to download medispring xml and to send last uploaded xml to hub --- icc-x-api/icc-bekmehr-x-api.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/icc-x-api/icc-bekmehr-x-api.ts b/icc-x-api/icc-bekmehr-x-api.ts index fba55290..eee76d99 100644 --- a/icc-x-api/icc-bekmehr-x-api.ts +++ b/icc-x-api/icc-bekmehr-x-api.ts @@ -136,7 +136,9 @@ export class IccBekmehrXApi extends iccBeKmehrApi { ): Promise { return new Promise((resolve, reject) => { const socket = new WebSocket( - `${this.wssHost}/be_kmehr/generateSmf${sessionId ? `;jsessionid=${sessionId}` : ""}` + `${this.wssHost}/be_kmehr/generateMedicationScheme${ + sessionId ? `;jsessionid=${sessionId}` : "" + }` ) socket.addEventListener("open", function() { socket.send( From 7d079f31a00943c11c17866a85b456d4b5ff7e4e Mon Sep 17 00:00:00 2001 From: Antoine Pairet Date: Wed, 30 Oct 2019 11:57:50 +0100 Subject: [PATCH 10/75] export accesslog extended api --- icc-x-api/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/icc-x-api/index.ts b/icc-x-api/index.ts index 19b3d9c4..e7d67eeb 100644 --- a/icc-x-api/index.ts +++ b/icc-x-api/index.ts @@ -1,3 +1,4 @@ +export * from "./icc-accesslog-x-api" export * from "./icc-bedrugs-x-api" export * from "./icc-bekmehr-x-api" export * from "./icc-calendar-item-x-api" From aa1e877c7abf591ef055de1f490402cc5e8c3811 Mon Sep 17 00:00:00 2001 From: Antoine Pairet Date: Wed, 30 Oct 2019 17:04:03 +0100 Subject: [PATCH 11/75] formatting --- icc-x-api/icc-accesslog-x-api.ts | 19 +++---- icc-x-api/icc-patient-x-api.ts | 96 +++++++++++++++----------------- 2 files changed, 54 insertions(+), 61 deletions(-) diff --git a/icc-x-api/icc-accesslog-x-api.ts b/icc-x-api/icc-accesslog-x-api.ts index afb1a0eb..072f64bc 100644 --- a/icc-x-api/icc-accesslog-x-api.ts +++ b/icc-x-api/icc-accesslog-x-api.ts @@ -110,16 +110,15 @@ export class IccAccesslogXApi extends iccAccesslogApi { findBy(hcpartyId: string, patient: models.PatientDto) { return this.crypto .extractDelegationsSFKs(patient, hcpartyId) - .then( - secretForeignKeys => - secretForeignKeys && - secretForeignKeys.extractedKeys && - secretForeignKeys.extractedKeys.length > 0 - ? this.findByHCPartyPatientSecretFKeys( - secretForeignKeys.hcpartyId!, - secretForeignKeys.extractedKeys.join(",") - ) - : Promise.resolve([]) + .then(secretForeignKeys => + secretForeignKeys && + secretForeignKeys.extractedKeys && + secretForeignKeys.extractedKeys.length > 0 + ? this.findByHCPartyPatientSecretFKeys( + secretForeignKeys.hcpartyId!, + secretForeignKeys.extractedKeys.join(",") + ) + : Promise.resolve([]) ) } diff --git a/icc-x-api/icc-patient-x-api.ts b/icc-x-api/icc-patient-x-api.ts index 63952291..88821318 100644 --- a/icc-x-api/icc-patient-x-api.ts +++ b/icc-x-api/icc-patient-x-api.ts @@ -696,13 +696,12 @@ export class IccPatientXApi extends iccPatientApi { patient: { success: false, error: null } as { success: boolean; error: Error | null } } return retry(() => this.getPatientWithUser(user, patId)) - .then( - (patient: models.PatientDto) => - patient.encryptionKeys && Object.keys(patient.encryptionKeys || {}).length - ? Promise.resolve(patient) - : this.initEncryptionKeys(user, patient).then((patient: models.PatientDto) => - this.modifyPatientWithUser(user, patient) - ) + .then((patient: models.PatientDto) => + patient.encryptionKeys && Object.keys(patient.encryptionKeys || {}).length + ? Promise.resolve(patient) + : this.initEncryptionKeys(user, patient).then((patient: models.PatientDto) => + this.modifyPatientWithUser(user, patient) + ) ) .then((patient: models.PatientDto | null) => { if (!patient) { @@ -721,70 +720,65 @@ export class IccPatientXApi extends iccPatientApi { retry(() => this.helementApi .findDelegationsStubsByHCPartyPatientSecretFKeys(ownerId, delSfks.join(",")) - .then( - hes => - parentId - ? this.helementApi - .findDelegationsStubsByHCPartyPatientSecretFKeys( - parentId, - delSfks.join(",") - ) - .then(moreHes => _.uniqBy(hes.concat(moreHes), "id")) - : hes + .then(hes => + parentId + ? this.helementApi + .findDelegationsStubsByHCPartyPatientSecretFKeys( + parentId, + delSfks.join(",") + ) + .then(moreHes => _.uniqBy(hes.concat(moreHes), "id")) + : hes ) ) as Promise>, retry(() => this.formApi .findDelegationsStubsByHCPartyPatientSecretFKeys(ownerId, delSfks.join(",")) - .then( - frms => - parentId - ? this.formApi - .findDelegationsStubsByHCPartyPatientSecretFKeys( - parentId, - delSfks.join(",") - ) - .then(moreFrms => _.uniqBy(frms.concat(moreFrms), "id")) - : frms + .then(frms => + parentId + ? this.formApi + .findDelegationsStubsByHCPartyPatientSecretFKeys( + parentId, + delSfks.join(",") + ) + .then(moreFrms => _.uniqBy(frms.concat(moreFrms), "id")) + : frms ) ) as Promise>, retry(() => this.contactApi .findByHCPartyPatientSecretFKeys(ownerId, delSfks.join(",")) - .then( - ctcs => - parentId - ? this.contactApi - .findByHCPartyPatientSecretFKeys(parentId, delSfks.join(",")) - .then(moreCtcs => _.uniqBy(ctcs.concat(moreCtcs), "id")) - : ctcs + .then(ctcs => + parentId + ? this.contactApi + .findByHCPartyPatientSecretFKeys(parentId, delSfks.join(",")) + .then(moreCtcs => _.uniqBy(ctcs.concat(moreCtcs), "id")) + : ctcs ) ) as Promise>, retry(() => this.invoiceApi .findDelegationsStubsByHCPartyPatientSecretFKeys(ownerId, delSfks.join(",")) - .then( - ivs => - parentId - ? this.invoiceApi - .findDelegationsStubsByHCPartyPatientSecretFKeys( - parentId, - delSfks.join(",") - ) - .then(moreIvs => _.uniqBy(ivs.concat(moreIvs), "id")) - : ivs + .then(ivs => + parentId + ? this.invoiceApi + .findDelegationsStubsByHCPartyPatientSecretFKeys( + parentId, + delSfks.join(",") + ) + .then(moreIvs => _.uniqBy(ivs.concat(moreIvs), "id")) + : ivs ) ) as Promise>, retry(() => this.classificationApi .findByHCPartyPatientSecretFKeys(ownerId, delSfks.join(",")) - .then( - cls => - parentId - ? this.classificationApi - .findByHCPartyPatientSecretFKeys(parentId, delSfks.join(",")) - .then(moreCls => _.uniqBy(cls.concat(moreCls), "id")) - : cls + .then(cls => + parentId + ? this.classificationApi + .findByHCPartyPatientSecretFKeys(parentId, delSfks.join(",")) + .then(moreCls => _.uniqBy(cls.concat(moreCls), "id")) + : cls ) ) as Promise> ]).then(([hes, frms, ctcs, ivs, cls]) => { From 3a195420472f7333def49626886173ff3e0dcb8e Mon Sep 17 00:00:00 2001 From: Antoine Pairet Date: Wed, 30 Oct 2019 17:04:15 +0100 Subject: [PATCH 12/75] getPatientIdOfChildDocumentForHcpAndHcpParents add accesslog --- icc-x-api/icc-patient-x-api.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/icc-x-api/icc-patient-x-api.ts b/icc-x-api/icc-patient-x-api.ts index 88821318..eed577e5 100644 --- a/icc-x-api/icc-patient-x-api.ts +++ b/icc-x-api/icc-patient-x-api.ts @@ -1158,7 +1158,11 @@ export class IccPatientXApi extends iccPatientApi { } async getPatientIdOfChildDocumentForHcpAndHcpParents( - childDocument: models.InvoiceDto | models.CalendarItemDto | models.ContactDto, + childDocument: + | models.InvoiceDto + | models.CalendarItemDto + | models.ContactDto + | models.AccessLogDto, hcpId: string ): Promise { const parentIdsArray = (await this.crypto.extractCryptedFKs(childDocument, hcpId)).extractedKeys From e345f6db649d4f76abd66a87e53e30cb5c259f7b Mon Sep 17 00:00:00 2001 From: Antoine Pairet Date: Wed, 30 Oct 2019 18:26:04 +0100 Subject: [PATCH 13/75] npm run gen --- icc-api/api/XHR.ts | 21 +++++--------------- icc-api/api/iccBeKmehrApi.ts | 22 --------------------- icc-api/api/iccCodeApi.ts | 26 ------------------------- icc-api/iccApi.ts | 2 ++ icc-api/model/DiaryNoteExportInfoDto.ts | 2 +- icc-api/model/ParagraphAgreementDto.ts | 4 ++-- icc-api/model/UserDto.ts | 4 ++-- icc-api/model/UserStubDto.ts | 4 ++-- icc-api/model/models.ts | 1 + 9 files changed, 15 insertions(+), 71 deletions(-) diff --git a/icc-api/api/XHR.ts b/icc-api/api/XHR.ts index 70e6fb7e..1c0bbfc2 100644 --- a/icc-api/api/XHR.ts +++ b/icc-api/api/XHR.ts @@ -38,12 +38,7 @@ export namespace XHR { url: string, init: RequestInit, timeout = 10000, - fetchImpl: (input: RequestInfo, init?: RequestInit) => Promise = typeof window !== - "undefined" - ? window.fetch - : typeof self !== "undefined" - ? self.fetch - : fetch + fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise ): Promise { return new Promise((resolve, reject) => { // Set timeout timer @@ -51,7 +46,7 @@ export namespace XHR { () => reject({ message: "Request timed out", status: "Request timed out" }), timeout ) - fetchImpl(url, init) + ;(fetchImpl || window.fetch)(url, init) .then(response => { clearTimeout(timer) resolve(response) @@ -68,12 +63,7 @@ export namespace XHR { url: string, headers: Array
| null, data: string | any = "", - fetchImpl: (input: RequestInfo, init?: RequestInit) => Promise = typeof window !== - "undefined" - ? window.fetch - : typeof self !== "undefined" - ? self.fetch - : fetch, + fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise, contentTypeOverride?: "application/json" | "text/plain" | "application/octet-stream" ): Promise { const contentType = @@ -113,13 +103,12 @@ export namespace XHR { } : {} ), - timeout, - fetchImpl + timeout ).then(function(response) { if (response.status >= 400) { throw new XHRError(response.statusText, response.status, response.status, response.headers) } - const ct = contentTypeOverride || response.headers.get("content-type") || "text/plain" + const ct = response.headers.get("content-type") || "text/plain" return (ct.startsWith("application/json") ? response.json() : ct.startsWith("application/xml") || ct.startsWith("text/") diff --git a/icc-api/api/iccBeKmehrApi.ts b/icc-api/api/iccBeKmehrApi.ts index 19ab2cca..33ddeae7 100644 --- a/icc-api/api/iccBeKmehrApi.ts +++ b/icc-api/api/iccBeKmehrApi.ts @@ -135,28 +135,6 @@ export class iccBeKmehrApi { .then(doc => doc.body) .catch(err => this.handleError(err)) } - generateDiaryNote( - patientId: string, - language?: string, - body?: models.DiaryNoteExportInfoDto - ): Promise { - let _body = null - _body = body - - const _url = - this.host + - "/be_kmehr/diarynote/{patientId}/export".replace("{patientId}", patientId + "") + - "?ts=" + - new Date().getTime() + - (language ? "&language=" + language : "") - let headers = this.headers - headers = headers - .filter(h => h.header !== "Content-Type") - .concat(new XHR.Header("Content-Type", "application/json")) - return XHR.sendCommand("POST", _url, headers, _body) - .then(doc => doc.body) - .catch(err => this.handleError(err)) - } generateLabresultExport( patientId: string, id: string, diff --git a/icc-api/api/iccCodeApi.ts b/icc-api/api/iccCodeApi.ts index 8035502f..ffd933d5 100644 --- a/icc-api/api/iccCodeApi.ts +++ b/icc-api/api/iccCodeApi.ts @@ -222,32 +222,6 @@ export class iccCodeApi { .then(doc => new models.CodePaginatedList(doc.body as JSON)) .catch(err => this.handleError(err)) } - findPaginatedCodesWithLink( - linkType: string, - linkedId?: string, - startKey?: string, - startDocumentId?: string, - limit?: number - ): Promise { - let _body = null - - const _url = - this.host + - "/code/link/{linkType}".replace("{linkType}", linkType + "") + - "?ts=" + - new Date().getTime() + - (linkedId ? "&linkedId=" + linkedId : "") + - (startKey ? "&startKey=" + startKey : "") + - (startDocumentId ? "&startDocumentId=" + startDocumentId : "") + - (limit ? "&limit=" + limit : "") - let headers = this.headers - headers = headers - .filter(h => h.header !== "Content-Type") - .concat(new XHR.Header("Content-Type", "application/json")) - return XHR.sendCommand("GET", _url, headers, _body) - .then(doc => new models.CodePaginatedList(doc.body as JSON)) - .catch(err => this.handleError(err)) - } findTagTypes(region?: string, type?: string): Promise | any> { let _body = null diff --git a/icc-api/iccApi.ts b/icc-api/iccApi.ts index 14b9ba8f..788826c8 100644 --- a/icc-api/iccApi.ts +++ b/icc-api/iccApi.ts @@ -14,6 +14,7 @@ export * from "./api/iccCalendarItemApi" export * from "./api/iccCalendarItemTypeApi" export * from "./api/iccClassificationApi" export * from "./api/iccClassificationTemplateApi" +export * from "./api/iccClusterApi" export * from "./api/iccCodeApi" export * from "./api/iccContactApi" export * from "./api/iccDoctemplateApi" @@ -23,6 +24,7 @@ export * from "./api/iccEntitytemplateApi" export * from "./api/iccFormApi" export * from "./api/iccFrontendmigrationApi" export * from "./api/iccGenericApi" +export * from "./api/iccGroupApi" export * from "./api/iccHcpartyApi" export * from "./api/iccHelementApi" export * from "./api/iccIcureApi" diff --git a/icc-api/model/DiaryNoteExportInfoDto.ts b/icc-api/model/DiaryNoteExportInfoDto.ts index 0155eefd..3ed6fc9c 100644 --- a/icc-api/model/DiaryNoteExportInfoDto.ts +++ b/icc-api/model/DiaryNoteExportInfoDto.ts @@ -42,5 +42,5 @@ export class DiaryNoteExportInfoDto { note?: string - isPsy?: boolean + psy?: boolean } diff --git a/icc-api/model/ParagraphAgreementDto.ts b/icc-api/model/ParagraphAgreementDto.ts index c6b5cf11..188f3df2 100644 --- a/icc-api/model/ParagraphAgreementDto.ts +++ b/icc-api/model/ParagraphAgreementDto.ts @@ -74,7 +74,7 @@ export class ParagraphAgreementDto { inTreatment?: boolean - accepted?: boolean - canceled?: boolean + + accepted?: boolean } diff --git a/icc-api/model/UserDto.ts b/icc-api/model/UserDto.ts index bf6706a1..01fd42d6 100644 --- a/icc-api/model/UserDto.ts +++ b/icc-api/model/UserDto.ts @@ -84,9 +84,9 @@ export class UserDto { applicationTokens?: { [key: string]: string } - virtualHosts?: Array - virtualHostDependency?: UserDto.VirtualHostDependencyEnum + + virtualHosts?: Array } export namespace UserDto { export enum TypeEnum { diff --git a/icc-api/model/UserStubDto.ts b/icc-api/model/UserStubDto.ts index 60fc5aa8..ed82a81c 100644 --- a/icc-api/model/UserStubDto.ts +++ b/icc-api/model/UserStubDto.ts @@ -44,9 +44,9 @@ export class UserStubDto { autoDelegations?: { [key: string]: Array } - virtualHosts?: Array - virtualHostDependency?: UserStubDto.VirtualHostDependencyEnum + + virtualHosts?: Array } export namespace UserStubDto { export enum VirtualHostDependencyEnum { diff --git a/icc-api/model/models.ts b/icc-api/model/models.ts index 288bf7b6..bcefc481 100644 --- a/icc-api/model/models.ts +++ b/icc-api/model/models.ts @@ -80,6 +80,7 @@ export * from "./Formula" export * from "./FrontEndMigrationDto" export * from "./FullTextSearchResult" export * from "./GalInfos" +export * from "./GroupDto" export * from "./HcPartyPaginatedList" export * from "./HealthElementDto" export * from "./HealthcarePartyDto" From 3f9fc0ea1122b46c0148e13560cf5d8370354177 Mon Sep 17 00:00:00 2001 From: Antoine Pairet Date: Wed, 30 Oct 2019 18:34:41 +0100 Subject: [PATCH 14/75] Update XHR.ts --- icc-api/api/XHR.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/icc-api/api/XHR.ts b/icc-api/api/XHR.ts index 1c0bbfc2..dc57e177 100644 --- a/icc-api/api/XHR.ts +++ b/icc-api/api/XHR.ts @@ -108,7 +108,7 @@ export namespace XHR { if (response.status >= 400) { throw new XHRError(response.statusText, response.status, response.status, response.headers) } - const ct = response.headers.get("content-type") || "text/plain" + const ct = contentTypeOverride || response.headers.get("content-type") || "text/plain" return (ct.startsWith("application/json") ? response.json() : ct.startsWith("application/xml") || ct.startsWith("text/") From ba09d4306d6628c8feeba679948c492ff50689d0 Mon Sep 17 00:00:00 2001 From: Bogdan Safta Date: Mon, 7 Oct 2019 11:41:21 +0300 Subject: [PATCH 15/75] MS-1825 Add rest method to retrieve patients duplicates by name and ssin --- icc-api/api/iccPatientApi.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/icc-api/api/iccPatientApi.ts b/icc-api/api/iccPatientApi.ts index f5484bc4..e2426975 100644 --- a/icc-api/api/iccPatientApi.ts +++ b/icc-api/api/iccPatientApi.ts @@ -211,6 +211,19 @@ export class iccPatientApi { .then(doc => new models.PatientPaginatedList(doc.body as JSON)) .catch(err => this.handleError(err)) } + findDuplicates(body?: models.ListOfIdsDto): Promise | any> { + let _body = null + _body = body + + const _url = this.host + "/patient/duplicates" + "?ts=" + new Date().getTime() + let headers = this.headers + headers = headers + .filter(h => h.header !== "Content-Type") + .concat(new XHR.Header("Content-Type", "application/json")) + return XHR.sendCommand("POST", _url, headers, _body) + .then(doc => (doc.body as Array).map(it => JSON.parse(JSON.stringify(it)))) + .catch(err => this.handleError(err)) + } fuzzySearch( firstName?: string, lastName?: string, From f043600d16bbc66981e828caaf8e849e31db86c9 Mon Sep 17 00:00:00 2001 From: Antoine Pairet Date: Fri, 1 Nov 2019 15:44:23 +0100 Subject: [PATCH 16/75] Update icc-accesslog-x-api.ts --- icc-x-api/icc-accesslog-x-api.ts | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/icc-x-api/icc-accesslog-x-api.ts b/icc-x-api/icc-accesslog-x-api.ts index 072f64bc..a87d47e8 100644 --- a/icc-x-api/icc-accesslog-x-api.ts +++ b/icc-x-api/icc-accesslog-x-api.ts @@ -110,22 +110,23 @@ export class IccAccesslogXApi extends iccAccesslogApi { findBy(hcpartyId: string, patient: models.PatientDto) { return this.crypto .extractDelegationsSFKs(patient, hcpartyId) - .then(secretForeignKeys => - secretForeignKeys && - secretForeignKeys.extractedKeys && - secretForeignKeys.extractedKeys.length > 0 - ? this.findByHCPartyPatientSecretFKeys( - secretForeignKeys.hcpartyId!, - secretForeignKeys.extractedKeys.join(",") - ) - : Promise.resolve([]) + .then( + secretForeignKeys => + secretForeignKeys && + secretForeignKeys.extractedKeys && + secretForeignKeys.extractedKeys.length > 0 + ? this.findByHCPartyPatientSecretFKeys( + secretForeignKeys.hcpartyId!, + secretForeignKeys.extractedKeys.join(",") + ) + : Promise.resolve([]) ) } findByHCPartyPatientSecretFKeys( hcPartyId: string, secretFKeys?: string - ): Promise | any> { + ): Promise> { return super .findByHCPartyPatientSecretFKeys(hcPartyId, secretFKeys) .then(accesslogs => this.decrypt(hcPartyId, accesslogs)) From 1687ba62c2284753319f758042ea6af42081f7f5 Mon Sep 17 00:00:00 2001 From: Bogdan Safta Date: Fri, 1 Nov 2019 22:49:08 +0200 Subject: [PATCH 17/75] MS-1890 Add search for duplicates rest methods --- icc-api/api/iccPatientApi.ts | 43 +++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/icc-api/api/iccPatientApi.ts b/icc-api/api/iccPatientApi.ts index e2426975..daeb8869 100644 --- a/icc-api/api/iccPatientApi.ts +++ b/icc-api/api/iccPatientApi.ts @@ -211,17 +211,50 @@ export class iccPatientApi { .then(doc => new models.PatientPaginatedList(doc.body as JSON)) .catch(err => this.handleError(err)) } - findDuplicates(body?: models.ListOfIdsDto): Promise | any> { + findDuplicatesByName( + hcPartyId?: string, + startKey?: string, + limit?: number + ): Promise { let _body = null - _body = body - const _url = this.host + "/patient/duplicates" + "?ts=" + new Date().getTime() + const _url = + this.host + + "/patient/duplicates/name" + + "?ts=" + + new Date().getTime() + + (hcPartyId ? "&hcPartyId=" + hcPartyId : "") + + (startKey ? "&startKey=" + startKey : "") + + (limit ? "&limit=" + limit : "") let headers = this.headers headers = headers .filter(h => h.header !== "Content-Type") .concat(new XHR.Header("Content-Type", "application/json")) - return XHR.sendCommand("POST", _url, headers, _body) - .then(doc => (doc.body as Array).map(it => JSON.parse(JSON.stringify(it)))) + return XHR.sendCommand("POST", _url, headers, _body, this.fetchImpl) + .then(doc => new models.PatientPaginatedList(doc.body as JSON)) + .catch(err => this.handleError(err)) + } + findDuplicatesBySsin( + hcPartyId?: string, + startKey?: string, + limit?: number + ): Promise { + let _body = null + + const _url = + this.host + + "/patient/duplicates/ssin" + + "?ts=" + + new Date().getTime() + + (hcPartyId ? "&hcPartyId=" + hcPartyId : "") + + (startKey ? "&startKey=" + startKey : "") + + (limit ? "&limit=" + limit : "") + let headers = this.headers + headers = headers + .filter(h => h.header !== "Content-Type") + .concat(new XHR.Header("Content-Type", "application/json")) + return XHR.sendCommand("POST", _url, headers, _body, this.fetchImpl) + .then(doc => new models.PatientPaginatedList(doc.body as JSON)) .catch(err => this.handleError(err)) } fuzzySearch( From 27bb8980baef289ec2fe4789a7175505e66a4f4d Mon Sep 17 00:00:00 2001 From: Antoine Pairet Date: Thu, 28 Nov 2019 21:28:41 +0100 Subject: [PATCH 18/75] genloc --- icc-api/api/XHR.ts | 2 +- icc-api/api/iccBeKmehrApi.ts | 8 +++-- icc-api/api/iccBeMikronoApi.ts | 15 +++++++++ icc-api/api/iccBeSamv2Api.ts | 16 ++++++++++ icc-api/api/iccFormApi.ts | 2 +- icc-api/api/iccUserApi.ts | 12 ------- icc-api/iccApi.ts | 2 -- icc-api/model/CalendarItemDto.ts | 2 ++ icc-api/model/CalendarItemTypeDto.ts | 10 ++++++ icc-api/model/DiaryNoteExportInfoDto.ts | 10 ++++-- icc-api/model/HealthcarePartyDto.ts | 2 ++ icc-api/model/InvoiceDto.ts | 6 ++++ icc-api/model/InvoicingCodeDto.ts | 2 ++ icc-api/model/MedicationDto.ts | 2 ++ .../model/MikronoAppointmentTypeRestDto.ts | 31 +++++++++++++++++++ icc-api/model/ParagraphAgreementDto.ts | 4 +-- icc-api/model/SoftwareMedicalFileExportDto.ts | 2 ++ icc-api/model/SumehrExportInfoDto.ts | 4 +++ icc-api/model/UserDto.ts | 4 +-- icc-api/model/UserStubDto.ts | 4 +-- icc-api/model/models.ts | 2 +- 21 files changed, 115 insertions(+), 27 deletions(-) create mode 100644 icc-api/model/MikronoAppointmentTypeRestDto.ts diff --git a/icc-api/api/XHR.ts b/icc-api/api/XHR.ts index dc57e177..1c0bbfc2 100644 --- a/icc-api/api/XHR.ts +++ b/icc-api/api/XHR.ts @@ -108,7 +108,7 @@ export namespace XHR { if (response.status >= 400) { throw new XHRError(response.statusText, response.status, response.status, response.headers) } - const ct = contentTypeOverride || response.headers.get("content-type") || "text/plain" + const ct = response.headers.get("content-type") || "text/plain" return (ct.startsWith("application/json") ? response.json() : ct.startsWith("application/xml") || ct.startsWith("text/") diff --git a/icc-api/api/iccBeKmehrApi.ts b/icc-api/api/iccBeKmehrApi.ts index 33ddeae7..2631ed2b 100644 --- a/icc-api/api/iccBeKmehrApi.ts +++ b/icc-api/api/iccBeKmehrApi.ts @@ -173,7 +173,8 @@ export class iccBeKmehrApi { generateMedicationSchemeExport( patientId: string, language?: string, - version?: number, + version?: string, + version2?: number, body?: models.MedicationSchemeExportInfoDto ): Promise { let _body = null @@ -185,7 +186,8 @@ export class iccBeKmehrApi { "?ts=" + new Date().getTime() + (language ? "&language=" + language : "") + - (version ? "&version=" + version : "") + (version ? "&version=" + version : "") + + (version2 ? "&version2=" + version2 : "") let headers = this.headers headers = headers .filter(h => h.header !== "Content-Type") @@ -546,6 +548,7 @@ export class iccBeKmehrApi { importSmf( documentId: string, documentKey?: string, + dryRun?: boolean, patientId?: string, language?: string, body?: any @@ -559,6 +562,7 @@ export class iccBeKmehrApi { "?ts=" + new Date().getTime() + (documentKey ? "&documentKey=" + documentKey : "") + + (dryRun ? "&dryRun=" + dryRun : "") + (patientId ? "&patientId=" + patientId : "") + (language ? "&language=" + language : "") let headers = this.headers diff --git a/icc-api/api/iccBeMikronoApi.ts b/icc-api/api/iccBeMikronoApi.ts index 0f743a6b..5bda699b 100644 --- a/icc-api/api/iccBeMikronoApi.ts +++ b/icc-api/api/iccBeMikronoApi.ts @@ -87,6 +87,21 @@ export class iccBeMikronoApi { .then(doc => (doc.body as Array).map(it => new models.AppointmentDto(it))) .catch(err => this.handleError(err)) } + createAppointmentTypes( + body?: Array + ): Promise { + let _body = null + _body = body + + const _url = this.host + "/be_mikrono/appointmentTypes" + "?ts=" + new Date().getTime() + let headers = this.headers + headers = headers + .filter(h => h.header !== "Content-Type") + .concat(new XHR.Header("Content-Type", "application/json")) + return XHR.sendCommand("POST", _url, headers, _body, this.fetchImpl) + .then(doc => true) + .catch(err => this.handleError(err)) + } createAppointments( body?: Array ): Promise | any> { diff --git a/icc-api/api/iccBeSamv2Api.ts b/icc-api/api/iccBeSamv2Api.ts index 741b3ec5..91be52fb 100644 --- a/icc-api/api/iccBeSamv2Api.ts +++ b/icc-api/api/iccBeSamv2Api.ts @@ -49,6 +49,22 @@ export class iccBeSamv2Api { else throw Error("api-error" + e.status) } + findAmpsByDmppCode(dmppCode: string): Promise | any> { + let _body = null + + const _url = + this.host + + "/be_samv2/amp/byDmppCode/{dmppCode}".replace("{dmppCode}", dmppCode + "") + + "?ts=" + + new Date().getTime() + let headers = this.headers + headers = headers + .filter(h => h.header !== "Content-Type") + .concat(new XHR.Header("Content-Type", "application/json")) + return XHR.sendCommand("GET", _url, headers, _body, this.fetchImpl) + .then(doc => (doc.body as Array).map(it => new models.AmpDto(it))) + .catch(err => this.handleError(err)) + } findPaginatedAmpsByGroupCode( vmpgCode: string, startKey?: string, diff --git a/icc-api/api/iccFormApi.ts b/icc-api/api/iccFormApi.ts index 4d44abc3..e1f8f956 100644 --- a/icc-api/api/iccFormApi.ts +++ b/icc-api/api/iccFormApi.ts @@ -358,7 +358,7 @@ export class iccFormApi { .then(doc => JSON.parse(JSON.stringify(doc.body))) .catch(err => this.handleError(err)) } - setHealthElementsDelegations(body?: Array): Promise { + setFormsDelegations(body?: Array): Promise { let _body = null _body = body diff --git a/icc-api/api/iccUserApi.ts b/icc-api/api/iccUserApi.ts index 5a8a4650..3c77326d 100644 --- a/icc-api/api/iccUserApi.ts +++ b/icc-api/api/iccUserApi.ts @@ -164,18 +164,6 @@ export class iccUserApi { .then(doc => new models.UserDto(doc.body as JSON)) .catch(err => this.handleError(err)) } - getMatchingUsers(): Promise | any> { - let _body = null - - const _url = this.host + "/user/matches" + "?ts=" + new Date().getTime() - let headers = this.headers - headers = headers - .filter(h => h.header !== "Content-Type") - .concat(new XHR.Header("Content-Type", "application/json")) - return XHR.sendCommand("GET", _url, headers, _body, this.fetchImpl) - .then(doc => (doc.body as Array).map(it => new models.UserDto(it))) - .catch(err => this.handleError(err)) - } getUser(userId: string): Promise { let _body = null diff --git a/icc-api/iccApi.ts b/icc-api/iccApi.ts index 788826c8..14b9ba8f 100644 --- a/icc-api/iccApi.ts +++ b/icc-api/iccApi.ts @@ -14,7 +14,6 @@ export * from "./api/iccCalendarItemApi" export * from "./api/iccCalendarItemTypeApi" export * from "./api/iccClassificationApi" export * from "./api/iccClassificationTemplateApi" -export * from "./api/iccClusterApi" export * from "./api/iccCodeApi" export * from "./api/iccContactApi" export * from "./api/iccDoctemplateApi" @@ -24,7 +23,6 @@ export * from "./api/iccEntitytemplateApi" export * from "./api/iccFormApi" export * from "./api/iccFrontendmigrationApi" export * from "./api/iccGenericApi" -export * from "./api/iccGroupApi" export * from "./api/iccHcpartyApi" export * from "./api/iccHelementApi" export * from "./api/iccIcureApi" diff --git a/icc-api/model/CalendarItemDto.ts b/icc-api/model/CalendarItemDto.ts index f57ed9bd..6c7a97ca 100644 --- a/icc-api/model/CalendarItemDto.ts +++ b/icc-api/model/CalendarItemDto.ts @@ -82,6 +82,8 @@ export class CalendarItemDto { endTime?: number + confirmTime?: number + duration?: number allDay?: boolean diff --git a/icc-api/model/CalendarItemTypeDto.ts b/icc-api/model/CalendarItemTypeDto.ts index 3418d600..5bc50290 100644 --- a/icc-api/model/CalendarItemTypeDto.ts +++ b/icc-api/model/CalendarItemTypeDto.ts @@ -41,4 +41,14 @@ export class CalendarItemTypeDto { duration?: number visit?: boolean + + externalRef?: string + + mikronoId?: string + + docIds?: Array + + otherInfos?: { [key: string]: string } + + subjectByLanguage?: { [key: string]: string } } diff --git a/icc-api/model/DiaryNoteExportInfoDto.ts b/icc-api/model/DiaryNoteExportInfoDto.ts index 3ed6fc9c..86009bf7 100644 --- a/icc-api/model/DiaryNoteExportInfoDto.ts +++ b/icc-api/model/DiaryNoteExportInfoDto.ts @@ -30,6 +30,14 @@ export class DiaryNoteExportInfoDto { } secretForeignKeys?: Array + excludedIds?: Array + + recipient?: models.HealthcarePartyDto + + softwareName?: string + + softwareVersion?: string + tags?: Array contexts?: Array @@ -38,8 +46,6 @@ export class DiaryNoteExportInfoDto { attachmentId?: string - recipient?: models.HealthcarePartyDto - note?: string psy?: boolean diff --git a/icc-api/model/HealthcarePartyDto.ts b/icc-api/model/HealthcarePartyDto.ts index a1e4ebdd..74b2bfff 100644 --- a/icc-api/model/HealthcarePartyDto.ts +++ b/icc-api/model/HealthcarePartyDto.ts @@ -70,6 +70,8 @@ export class HealthcarePartyDto { cbe?: string + ehp?: string + convention?: number userId?: string diff --git a/icc-api/model/InvoiceDto.ts b/icc-api/model/InvoiceDto.ts index 95168a04..ad4e1fdf 100644 --- a/icc-api/model/InvoiceDto.ts +++ b/icc-api/model/InvoiceDto.ts @@ -96,6 +96,8 @@ export class InvoiceDto { thirdPartyPaymentReason?: string + reason?: string + gnotionNihii?: string gnotionSsin?: string @@ -148,6 +150,10 @@ export class InvoiceDto { encounterLocationNorm?: number + cancelReason?: string + + cancelDate?: number + receipts?: { [key: string]: string } idDocument?: models.IdentityDocumentReader diff --git a/icc-api/model/InvoicingCodeDto.ts b/icc-api/model/InvoicingCodeDto.ts index 52d51050..1b828443 100644 --- a/icc-api/model/InvoicingCodeDto.ts +++ b/icc-api/model/InvoicingCodeDto.ts @@ -58,6 +58,8 @@ export class InvoicingCodeDto { vat?: number + transplantationCode?: number + code?: string error?: string diff --git a/icc-api/model/MedicationDto.ts b/icc-api/model/MedicationDto.ts index 2274e17c..dd2c0d4c 100644 --- a/icc-api/model/MedicationDto.ts +++ b/icc-api/model/MedicationDto.ts @@ -101,4 +101,6 @@ export class MedicationDto { posologyChanged?: boolean prescriptionRID?: string + + status?: number } diff --git a/icc-api/model/MikronoAppointmentTypeRestDto.ts b/icc-api/model/MikronoAppointmentTypeRestDto.ts new file mode 100644 index 00000000..54a68989 --- /dev/null +++ b/icc-api/model/MikronoAppointmentTypeRestDto.ts @@ -0,0 +1,31 @@ +/** + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.0.2 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import * as models from "./models" + +export class MikronoAppointmentTypeRestDto { + constructor(json: JSON | any) { + Object.assign(this as MikronoAppointmentTypeRestDto, json) + } +} diff --git a/icc-api/model/ParagraphAgreementDto.ts b/icc-api/model/ParagraphAgreementDto.ts index 188f3df2..c6b5cf11 100644 --- a/icc-api/model/ParagraphAgreementDto.ts +++ b/icc-api/model/ParagraphAgreementDto.ts @@ -74,7 +74,7 @@ export class ParagraphAgreementDto { inTreatment?: boolean - canceled?: boolean - accepted?: boolean + + canceled?: boolean } diff --git a/icc-api/model/SoftwareMedicalFileExportDto.ts b/icc-api/model/SoftwareMedicalFileExportDto.ts index a3a90faa..14a6ad3e 100644 --- a/icc-api/model/SoftwareMedicalFileExportDto.ts +++ b/icc-api/model/SoftwareMedicalFileExportDto.ts @@ -31,4 +31,6 @@ export class SoftwareMedicalFileExportDto { secretForeignKeys?: Array comment?: string + + exportAsPMF?: boolean } diff --git a/icc-api/model/SumehrExportInfoDto.ts b/icc-api/model/SumehrExportInfoDto.ts index 30f2de84..4add58a0 100644 --- a/icc-api/model/SumehrExportInfoDto.ts +++ b/icc-api/model/SumehrExportInfoDto.ts @@ -34,6 +34,10 @@ export class SumehrExportInfoDto { recipient?: models.HealthcarePartyDto + softwareName?: string + + softwareVersion?: string + comment?: string includeIrrelevantInformation?: boolean diff --git a/icc-api/model/UserDto.ts b/icc-api/model/UserDto.ts index 01fd42d6..bf6706a1 100644 --- a/icc-api/model/UserDto.ts +++ b/icc-api/model/UserDto.ts @@ -84,9 +84,9 @@ export class UserDto { applicationTokens?: { [key: string]: string } - virtualHostDependency?: UserDto.VirtualHostDependencyEnum - virtualHosts?: Array + + virtualHostDependency?: UserDto.VirtualHostDependencyEnum } export namespace UserDto { export enum TypeEnum { diff --git a/icc-api/model/UserStubDto.ts b/icc-api/model/UserStubDto.ts index ed82a81c..60fc5aa8 100644 --- a/icc-api/model/UserStubDto.ts +++ b/icc-api/model/UserStubDto.ts @@ -44,9 +44,9 @@ export class UserStubDto { autoDelegations?: { [key: string]: Array } - virtualHostDependency?: UserStubDto.VirtualHostDependencyEnum - virtualHosts?: Array + + virtualHostDependency?: UserStubDto.VirtualHostDependencyEnum } export namespace UserStubDto { export enum VirtualHostDependencyEnum { diff --git a/icc-api/model/models.ts b/icc-api/model/models.ts index bcefc481..0f089fce 100644 --- a/icc-api/model/models.ts +++ b/icc-api/model/models.ts @@ -80,7 +80,6 @@ export * from "./Formula" export * from "./FrontEndMigrationDto" export * from "./FullTextSearchResult" export * from "./GalInfos" -export * from "./GroupDto" export * from "./HcPartyPaginatedList" export * from "./HealthElementDto" export * from "./HealthcarePartyDto" @@ -126,6 +125,7 @@ export * from "./MessagePaginatedList" export * from "./MessageReadStatus" export * from "./MessageWithBatch" export * from "./MessagesReadStatusUpdate" +export * from "./MikronoAppointmentTypeRestDto" export * from "./MikronoCredentialsDto" export * from "./MpExtendedInfos" export * from "./MpFullInfos" From 5be9cbdd866d33b4b4096619612fa69159695847 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ce=CC=81dric=20Judicq?= Date: Sat, 30 Nov 2019 15:43:02 +0100 Subject: [PATCH 19/75] MS-2380 Detailed error messages do not appear in some cases for eAttests --- icc-api/api/XHR.ts | 4 ++-- icc-api/model/AmppDto.ts | 4 ++-- icc-api/model/InvoicingCodeDto.ts | 2 ++ icc-api/model/ParagraphAgreementDto.ts | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/icc-api/api/XHR.ts b/icc-api/api/XHR.ts index 1c0bbfc2..6be987c6 100644 --- a/icc-api/api/XHR.ts +++ b/icc-api/api/XHR.ts @@ -112,8 +112,8 @@ export namespace XHR { return (ct.startsWith("application/json") ? response.json() : ct.startsWith("application/xml") || ct.startsWith("text/") - ? response.text() - : response.arrayBuffer() + ? response.text() + : response.arrayBuffer() ).then(d => new Data(response.status, ct, d)) }) } diff --git a/icc-api/model/AmppDto.ts b/icc-api/model/AmppDto.ts index 10dc8b07..83890849 100644 --- a/icc-api/model/AmppDto.ts +++ b/icc-api/model/AmppDto.ts @@ -96,9 +96,9 @@ export class AmppDto { dmpps?: Array - singleUse?: boolean - orphan?: boolean + + singleUse?: boolean } export namespace AmppDto { export enum StatusEnum { diff --git a/icc-api/model/InvoicingCodeDto.ts b/icc-api/model/InvoicingCodeDto.ts index 1b828443..9a699644 100644 --- a/icc-api/model/InvoicingCodeDto.ts +++ b/icc-api/model/InvoicingCodeDto.ts @@ -120,6 +120,8 @@ export class InvoicingCodeDto { locationCdHcParty?: string + locationService?: number + prescriptionDate?: number status?: number diff --git a/icc-api/model/ParagraphAgreementDto.ts b/icc-api/model/ParagraphAgreementDto.ts index c6b5cf11..c23a9961 100644 --- a/icc-api/model/ParagraphAgreementDto.ts +++ b/icc-api/model/ParagraphAgreementDto.ts @@ -72,9 +72,9 @@ export class ParagraphAgreementDto { documentId?: string - inTreatment?: boolean + canceled?: boolean accepted?: boolean - canceled?: boolean + inTreatment?: boolean } From 9307c9e1455410f100e090162a3ea92771f909e4 Mon Sep 17 00:00:00 2001 From: Adrian Meyvn Date: Thu, 5 Dec 2019 10:02:02 +0200 Subject: [PATCH 20/75] MS-2246: bugfix , error handling --- icc-x-api/icc-bekmehr-x-api.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/icc-x-api/icc-bekmehr-x-api.ts b/icc-x-api/icc-bekmehr-x-api.ts index 68b606d2..cea69c16 100644 --- a/icc-x-api/icc-bekmehr-x-api.ts +++ b/icc-x-api/icc-bekmehr-x-api.ts @@ -68,10 +68,14 @@ export class IccBekmehrXApi extends iccBeKmehrApi { ) ) } - } else if ((msg.command = "progress")) { + } else if (msg.command === "progress") { if (progressCallback && msg.body && msg.body[0]) { progressCallback(msg.body[0].progress) } + } else { + console.error("error received from backend:" + event.data) + reject("websocket error: " + event.data) + socket.close(4000, "backend error") } } else { resolve(event.data) From d52a3489d38be2faa00109beb5b7af98a09ad58a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ce=CC=81dric=20Judicq?= Date: Thu, 12 Dec 2019 15:18:15 +0100 Subject: [PATCH 21/75] MS-2475 AccessLogs trigger thousands of calls to retrieve patients that will never be used --- icc-x-api/icc-accesslog-x-api.ts | 62 ++++++++++++++++++++++++++------ 1 file changed, 52 insertions(+), 10 deletions(-) diff --git a/icc-x-api/icc-accesslog-x-api.ts b/icc-x-api/icc-accesslog-x-api.ts index 4d578749..cffd0a9e 100644 --- a/icc-x-api/icc-accesslog-x-api.ts +++ b/icc-x-api/icc-accesslog-x-api.ts @@ -5,6 +5,7 @@ import * as models from "../icc-api/model/models" import * as _ from "lodash" import { utils } from "./crypto/utils" +import { AccessLogDto } from "../icc-api/model/models" export class IccAccesslogXApi extends iccAccesslogApi { crypto: IccCryptoXApi @@ -110,16 +111,15 @@ export class IccAccesslogXApi extends iccAccesslogApi { findBy(hcpartyId: string, patient: models.PatientDto) { return this.crypto .extractDelegationsSFKs(patient, hcpartyId) - .then( - secretForeignKeys => - secretForeignKeys && - secretForeignKeys.extractedKeys && - secretForeignKeys.extractedKeys.length > 0 - ? this.findByHCPartyPatientSecretFKeys( - secretForeignKeys.hcpartyId!, - secretForeignKeys.extractedKeys.join(",") - ) - : Promise.resolve([]) + .then(secretForeignKeys => + secretForeignKeys && + secretForeignKeys.extractedKeys && + secretForeignKeys.extractedKeys.length > 0 + ? this.findByHCPartyPatientSecretFKeys( + secretForeignKeys.hcpartyId!, + secretForeignKeys.extractedKeys.join(",") + ) + : Promise.resolve([]) ) } @@ -353,4 +353,46 @@ export class IccAccesslogXApi extends iccAccesslogApi { ) ) } + + findLatestAccessLogsOfPatientsWithUser( + user: models.UserDto, + userId: string, + limit?: number, + startDate?: number + ): Promise { + return this.findLatestAccessLogsOfPatients(userId, limit, startDate).then(logs => { + return this.decrypt((user.healthcarePartyId || user.patientId)!, logs).then() + }) + } + + findLatestAccessLogsOfPatients( + userId: string, + limit?: number, + startDate?: number, + startKey?: string, + startDocumentId?: string, + foundIds: string[] = [] + ): Promise { + return super + .findByUserAfterDate(userId, "USER_ACCESS", startDate, startKey, startDocumentId, 50, true) + .then(({ rows: logs, nextKeyPair }: models.AccessLogPaginatedList) => { + const uniqueLogs: models.AccessLogDto[] = _.chain(logs) + .reject(log => foundIds.includes(log.id)) + .uniqBy((log: AccessLogDto) => _.head(log.secretForeignKeys)) + .value() + .slice(0, limit) + + if (uniqueLogs.length < limit && logs.length === 50) { + return this.findLatestAccessLogsOfPatients( + userId, + limit - uniqueLogs.length, + startDate, + null, + nextKeyPair.startKeyDocId, + [...foundIds, ..._.map(uniqueLogs, "id")] + ).then(logs => [...logs, ...uniqueLogs]) + } + return uniqueLogs + }) + } } From 7ae864d07783a5635753aa72305263dc4f959154 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ce=CC=81dric=20Judicq?= Date: Fri, 13 Dec 2019 11:14:12 +0100 Subject: [PATCH 22/75] MS-2475 AccessLogs trigger thousands of calls to retrieve patients that will never be used --- icc-x-api/icc-accesslog-x-api.ts | 86 ++++++++++++++++++++------------ 1 file changed, 53 insertions(+), 33 deletions(-) diff --git a/icc-x-api/icc-accesslog-x-api.ts b/icc-x-api/icc-accesslog-x-api.ts index cffd0a9e..5a7d16a0 100644 --- a/icc-x-api/icc-accesslog-x-api.ts +++ b/icc-x-api/icc-accesslog-x-api.ts @@ -354,45 +354,65 @@ export class IccAccesslogXApi extends iccAccesslogApi { ) } - findLatestAccessLogsOfPatientsWithUser( + async findLatestAccessLogsOfPatientsWithUser( user: models.UserDto, userId: string, limit?: number, startDate?: number ): Promise { - return this.findLatestAccessLogsOfPatients(userId, limit, startDate).then(logs => { - return this.decrypt((user.healthcarePartyId || user.patientId)!, logs).then() - }) - } + let foundAccessLogs: models.AccessLogDto[] = [], + callCount = 0, + startDocumentId + const CALL_SIZE = 100 + const MAX_CALL_COUNT = 100 - findLatestAccessLogsOfPatients( - userId: string, - limit?: number, - startDate?: number, - startKey?: string, - startDocumentId?: string, - foundIds: string[] = [] - ): Promise { - return super - .findByUserAfterDate(userId, "USER_ACCESS", startDate, startKey, startDocumentId, 50, true) - .then(({ rows: logs, nextKeyPair }: models.AccessLogPaginatedList) => { - const uniqueLogs: models.AccessLogDto[] = _.chain(logs) - .reject(log => foundIds.includes(log.id)) - .uniqBy((log: AccessLogDto) => _.head(log.secretForeignKeys)) - .value() - .slice(0, limit) + while (foundAccessLogs.length < limit && callCount < MAX_CALL_COUNT) { + const currentLimit = limit - foundAccessLogs.length + const { + rows: logs, + nextKeyPair + }: models.AccessLogPaginatedList = await super.findByUserAfterDate( + userId, + "USER_ACCESS", + startDate, + null, + startDocumentId, + CALL_SIZE, + true + ) + const logsWithPatientId = await this.decrypt( + (user.healthcarePartyId || user.patientId)!, + logs + ).then(decryptedLogs => + Promise.all( + _.map(decryptedLogs, decryptedLog => { + return this.crypto + .extractCryptedFKs(decryptedLog, user.healthcarePartyId) + .then(keys => ({ + ...decryptedLog, + patientId: _.head(keys.extractedKeys) + })) + }) + ) + ) - if (uniqueLogs.length < limit && logs.length === 50) { - return this.findLatestAccessLogsOfPatients( - userId, - limit - uniqueLogs.length, - startDate, - null, - nextKeyPair.startKeyDocId, - [...foundIds, ..._.map(uniqueLogs, "id")] - ).then(logs => [...logs, ...uniqueLogs]) - } - return uniqueLogs - }) + const uniqueLogs: models.AccessLogDto[] = _.chain(logsWithPatientId) + .reject(log => _.some(foundAccessLogs, ({ patientId }) => patientId === log.patientId)) + .uniqBy((log: AccessLogDto) => log.patientId) + .value() + .slice(0, currentLimit) + + foundAccessLogs = [...foundAccessLogs, ...uniqueLogs] + + if (logs.length < CALL_SIZE) { + break + } else { + startDocumentId = nextKeyPair.startKeyDocId + } + + callCount++ + } + + return foundAccessLogs } } From b01aaaa2236c215de978a6163d42f3dc6ff14504 Mon Sep 17 00:00:00 2001 From: Bogdan Safta Date: Fri, 13 Dec 2019 18:54:32 +0200 Subject: [PATCH 23/75] MS-2047 Patch treatment frequencies after decryption --- icc-x-api/icc-bekmehr-x-api.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/icc-x-api/icc-bekmehr-x-api.ts b/icc-x-api/icc-bekmehr-x-api.ts index 68b606d2..13963e53 100644 --- a/icc-x-api/icc-bekmehr-x-api.ts +++ b/icc-x-api/icc-bekmehr-x-api.ts @@ -4,6 +4,7 @@ import { XHR } from "../icc-api/api/XHR" import * as models from "../icc-api/model/models" import { IccContactXApi } from "./icc-contact-x-api" import { IccHelementXApi } from "./icc-helement-x-api" +import { ContactDto } from "../icc-api/model/models" export class IccBekmehrXApi extends iccBeKmehrApi { private readonly ctcApi: IccContactXApi @@ -35,7 +36,8 @@ export class IccBekmehrXApi extends iccBeKmehrApi { healthcarePartyId: string, resolve: (value?: Promise) => void, reject: (reason?: any) => void, - progressCallback?: (progress: number) => void + progressCallback?: (progress: number) => void, + patcher?: (response: any[]) => Promise ) { const that = this return (event: MessageEvent) => { @@ -62,6 +64,7 @@ export class IccBekmehrXApi extends iccBeKmehrApi { } else { that.ctcApi .decryptServices(healthcarePartyId, msg.body) + .then(res => (patcher ? patcher(res) : Promise.resolve(res))) .then(res => socket.send( JSON.stringify({ command: "decryptResponse", uuid: msg.uuid, body: res }) @@ -184,6 +187,7 @@ export class IccBekmehrXApi extends iccBeKmehrApi { language: string, version: number, body: models.MedicationSchemeExportInfoDto, + patcher: (response: ContactDto[]) => Promise, sessionId?: string ): Promise { return new Promise((resolve, reject) => { @@ -202,7 +206,7 @@ export class IccBekmehrXApi extends iccBeKmehrApi { // Listen for messages socket.addEventListener( "message", - this.socketEventListener(socket, healthcarePartyId, resolve, reject) + this.socketEventListener(socket, healthcarePartyId, resolve, reject, undefined, patcher) ) }) } From e365b250073de2bba1704a55f5195d6bff75c208 Mon Sep 17 00:00:00 2001 From: Antoine Pairet Date: Tue, 24 Dec 2019 10:26:30 +0100 Subject: [PATCH 24/75] restore closed source models and methods --- icc-api/api/iccUserApi.ts | 12 ++++++++++++ icc-api/iccApi.ts | 2 ++ icc-api/model/models.ts | 1 + 3 files changed, 15 insertions(+) diff --git a/icc-api/api/iccUserApi.ts b/icc-api/api/iccUserApi.ts index 3c77326d..5a8a4650 100644 --- a/icc-api/api/iccUserApi.ts +++ b/icc-api/api/iccUserApi.ts @@ -164,6 +164,18 @@ export class iccUserApi { .then(doc => new models.UserDto(doc.body as JSON)) .catch(err => this.handleError(err)) } + getMatchingUsers(): Promise | any> { + let _body = null + + const _url = this.host + "/user/matches" + "?ts=" + new Date().getTime() + let headers = this.headers + headers = headers + .filter(h => h.header !== "Content-Type") + .concat(new XHR.Header("Content-Type", "application/json")) + return XHR.sendCommand("GET", _url, headers, _body, this.fetchImpl) + .then(doc => (doc.body as Array).map(it => new models.UserDto(it))) + .catch(err => this.handleError(err)) + } getUser(userId: string): Promise { let _body = null diff --git a/icc-api/iccApi.ts b/icc-api/iccApi.ts index 14b9ba8f..788826c8 100644 --- a/icc-api/iccApi.ts +++ b/icc-api/iccApi.ts @@ -14,6 +14,7 @@ export * from "./api/iccCalendarItemApi" export * from "./api/iccCalendarItemTypeApi" export * from "./api/iccClassificationApi" export * from "./api/iccClassificationTemplateApi" +export * from "./api/iccClusterApi" export * from "./api/iccCodeApi" export * from "./api/iccContactApi" export * from "./api/iccDoctemplateApi" @@ -23,6 +24,7 @@ export * from "./api/iccEntitytemplateApi" export * from "./api/iccFormApi" export * from "./api/iccFrontendmigrationApi" export * from "./api/iccGenericApi" +export * from "./api/iccGroupApi" export * from "./api/iccHcpartyApi" export * from "./api/iccHelementApi" export * from "./api/iccIcureApi" diff --git a/icc-api/model/models.ts b/icc-api/model/models.ts index 0f089fce..3dab8fab 100644 --- a/icc-api/model/models.ts +++ b/icc-api/model/models.ts @@ -80,6 +80,7 @@ export * from "./Formula" export * from "./FrontEndMigrationDto" export * from "./FullTextSearchResult" export * from "./GalInfos" +export * from "./GroupDto" export * from "./HcPartyPaginatedList" export * from "./HealthElementDto" export * from "./HealthcarePartyDto" From 4a845f083bc0f77c55bcbffce9f343e0e95681e1 Mon Sep 17 00:00:00 2001 From: Antoine Pairet Date: Tue, 24 Dec 2019 10:36:57 +0100 Subject: [PATCH 25/75] Update AccessLogDto.ts --- icc-api/model/AccessLogDto.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/icc-api/model/AccessLogDto.ts b/icc-api/model/AccessLogDto.ts index ddab5bd2..888c665a 100644 --- a/icc-api/model/AccessLogDto.ts +++ b/icc-api/model/AccessLogDto.ts @@ -64,8 +64,6 @@ export class AccessLogDto { date?: number - patientId?: string - objectId?: string user?: string From e93f6429bb2514fa9dba5c1bad91fdd3c659d88f Mon Sep 17 00:00:00 2001 From: Antoine Pairet Date: Tue, 24 Dec 2019 12:25:25 +0100 Subject: [PATCH 26/75] fix accessLog with patientId --- icc-x-api/icc-accesslog-x-api.ts | 37 ++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/icc-x-api/icc-accesslog-x-api.ts b/icc-x-api/icc-accesslog-x-api.ts index 33a14cef..acb01ed6 100644 --- a/icc-x-api/icc-accesslog-x-api.ts +++ b/icc-x-api/icc-accesslog-x-api.ts @@ -7,6 +7,10 @@ import * as _ from "lodash" import { utils } from "./crypto/utils" import { AccessLogDto } from "../icc-api/model/models" +export interface AccessLogWithPatientId extends AccessLogDto { + patientId: string +} + export class IccAccesslogXApi extends iccAccesslogApi { crypto: IccCryptoXApi cryptedKeys = ["detail", "objectId"] @@ -365,10 +369,10 @@ export class IccAccesslogXApi extends iccAccesslogApi { async findLatestAccessLogsOfPatientsWithUser( user: models.UserDto, userId: string, - limit?: number, + limit: number = 100, startDate?: number ): Promise { - let foundAccessLogs: models.AccessLogDto[] = [], + let foundAccessLogs: AccessLogWithPatientId[] = [], callCount = 0, startDocumentId const CALL_SIZE = 100 @@ -383,39 +387,44 @@ export class IccAccesslogXApi extends iccAccesslogApi { userId, "USER_ACCESS", startDate, - null, + undefined, startDocumentId, CALL_SIZE, true ) - const logsWithPatientId = await this.decrypt( + const logsWithPatientId: AccessLogWithPatientId[] = await this.decrypt( (user.healthcarePartyId || user.patientId)!, - logs + logs as AccessLogDto[] ).then(decryptedLogs => Promise.all( _.map(decryptedLogs, decryptedLog => { return this.crypto - .extractCryptedFKs(decryptedLog, user.healthcarePartyId) - .then(keys => ({ - ...decryptedLog, - patientId: _.head(keys.extractedKeys) - })) + .extractCryptedFKs(decryptedLog, user.healthcarePartyId as string) + .then( + keys => + ({ + ...decryptedLog, + patientId: _.head(keys.extractedKeys) + } as AccessLogWithPatientId) + ) }) ) ) - const uniqueLogs: models.AccessLogDto[] = _.chain(logsWithPatientId) + const uniqueLogs: AccessLogWithPatientId[] = _.chain(logsWithPatientId) .reject(log => _.some(foundAccessLogs, ({ patientId }) => patientId === log.patientId)) - .uniqBy((log: AccessLogDto) => log.patientId) + .uniqBy((log: AccessLogWithPatientId) => log.patientId) .value() .slice(0, currentLimit) foundAccessLogs = [...foundAccessLogs, ...uniqueLogs] - if (logs.length < CALL_SIZE) { + if ((logs || []).length < CALL_SIZE) { break - } else { + } else if (nextKeyPair) { startDocumentId = nextKeyPair.startKeyDocId + } else { + break } callCount++ From dcdd901f067df4a5313216ecfa04f17bde1d81a6 Mon Sep 17 00:00:00 2001 From: Antoine Pairet Date: Tue, 7 Jan 2020 12:11:56 +0100 Subject: [PATCH 27/75] Adapt accesslog retrieval logic to avoid looping in tests --- icc-x-api/icc-accesslog-x-api.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/icc-x-api/icc-accesslog-x-api.ts b/icc-x-api/icc-accesslog-x-api.ts index acb01ed6..b53b3a6d 100644 --- a/icc-x-api/icc-accesslog-x-api.ts +++ b/icc-x-api/icc-accesslog-x-api.ts @@ -373,12 +373,12 @@ export class IccAccesslogXApi extends iccAccesslogApi { startDate?: number ): Promise { let foundAccessLogs: AccessLogWithPatientId[] = [], - callCount = 0, + currentIteration = 0, startDocumentId - const CALL_SIZE = 100 - const MAX_CALL_COUNT = 100 + const numberRequestedAccessLogs = 100 + const MAX_WHILE_ITERATIONS = 5 - while (foundAccessLogs.length < limit && callCount < MAX_CALL_COUNT) { + while (foundAccessLogs.length < limit && currentIteration < MAX_WHILE_ITERATIONS) { const currentLimit = limit - foundAccessLogs.length const { rows: logs, @@ -389,7 +389,7 @@ export class IccAccesslogXApi extends iccAccesslogApi { startDate, undefined, startDocumentId, - CALL_SIZE, + numberRequestedAccessLogs, true ) const logsWithPatientId: AccessLogWithPatientId[] = await this.decrypt( @@ -419,7 +419,7 @@ export class IccAccesslogXApi extends iccAccesslogApi { foundAccessLogs = [...foundAccessLogs, ...uniqueLogs] - if ((logs || []).length < CALL_SIZE) { + if ((logs || []).length < numberRequestedAccessLogs) { break } else if (nextKeyPair) { startDocumentId = nextKeyPair.startKeyDocId @@ -427,7 +427,7 @@ export class IccAccesslogXApi extends iccAccesslogApi { break } - callCount++ + currentIteration++ } return foundAccessLogs From d3d726a191d980608b27a347ad1e286c6bd4f2b1 Mon Sep 17 00:00:00 2001 From: Adrian Meyvn Date: Thu, 16 Jan 2020 15:49:13 +0200 Subject: [PATCH 28/75] MS-2723 added exception handling for calendar item --- icc-x-api/icc-patient-x-api.ts | 111 +++++++++++++++++---------------- 1 file changed, 58 insertions(+), 53 deletions(-) diff --git a/icc-x-api/icc-patient-x-api.ts b/icc-x-api/icc-patient-x-api.ts index dc633e35..8bc8a621 100644 --- a/icc-x-api/icc-patient-x-api.ts +++ b/icc-x-api/icc-patient-x-api.ts @@ -1174,13 +1174,12 @@ export class IccPatientXApi extends iccPatientApi { const parentId = hcp.parentId return retry(() => this.getPatientWithUser(user, patId)) - .then( - (patient: models.PatientDto) => - patient.encryptionKeys && Object.keys(patient.encryptionKeys || {}).length - ? Promise.resolve(patient) - : this.initEncryptionKeys(user, patient).then((patient: models.PatientDto) => - this.modifyPatientWithUser(user, patient) - ) + .then((patient: models.PatientDto) => + patient.encryptionKeys && Object.keys(patient.encryptionKeys || {}).length + ? Promise.resolve(patient) + : this.initEncryptionKeys(user, patient).then((patient: models.PatientDto) => + this.modifyPatientWithUser(user, patient) + ) ) .then((patient: models.PatientDto | null) => { if (!patient) { @@ -1195,75 +1194,81 @@ export class IccPatientXApi extends iccPatientApi { retry(() => this.helementApi .findByHCPartyPatientSecretFKeys(ownerId, delSfks.join(",")) - .then( - hes => - parentId - ? this.helementApi - .findByHCPartyPatientSecretFKeys(parentId, delSfks.join(",")) - .then(moreHes => _.uniqBy(hes.concat(moreHes), "id")) - : hes + .then(hes => + parentId + ? this.helementApi + .findByHCPartyPatientSecretFKeys(parentId, delSfks.join(",")) + .then(moreHes => _.uniqBy(hes.concat(moreHes), "id")) + : hes ) ) as Promise>, retry(() => this.formApi .findByHCPartyPatientSecretFKeys(ownerId, delSfks.join(",")) - .then( - frms => - parentId - ? this.formApi - .findByHCPartyPatientSecretFKeys(parentId, delSfks.join(",")) - .then(moreFrms => _.uniqBy(frms.concat(moreFrms), "id")) - : frms + .then(frms => + parentId + ? this.formApi + .findByHCPartyPatientSecretFKeys(parentId, delSfks.join(",")) + .then(moreFrms => _.uniqBy(frms.concat(moreFrms), "id")) + : frms ) ) as Promise>, retry(() => this.contactApi .findByHCPartyPatientSecretFKeys(ownerId, delSfks.join(",")) - .then( - ctcs => - parentId - ? this.contactApi - .findByHCPartyPatientSecretFKeys(parentId, delSfks.join(",")) - .then(moreCtcs => _.uniqBy(ctcs.concat(moreCtcs), "id")) - : ctcs + .then(ctcs => + parentId + ? this.contactApi + .findByHCPartyPatientSecretFKeys(parentId, delSfks.join(",")) + .then(moreCtcs => _.uniqBy(ctcs.concat(moreCtcs), "id")) + : ctcs ) ) as Promise>, retry(() => this.invoiceApi .findByHCPartyPatientSecretFKeys(ownerId, delSfks.join(",")) - .then( - ivs => - parentId - ? this.invoiceApi - .findByHCPartyPatientSecretFKeys(parentId, delSfks.join(",")) - .then(moreIvs => _.uniqBy(ivs.concat(moreIvs), "id")) - : ivs + .then(ivs => + parentId + ? this.invoiceApi + .findByHCPartyPatientSecretFKeys(parentId, delSfks.join(",")) + .then(moreIvs => _.uniqBy(ivs.concat(moreIvs), "id")) + : ivs ) ) as Promise>, retry(() => this.classificationApi .findByHCPartyPatientSecretFKeys(ownerId, delSfks.join(",")) - .then( - cls => - parentId - ? this.classificationApi - .findByHCPartyPatientSecretFKeys(parentId, delSfks.join(",")) - .then(moreCls => _.uniqBy(cls.concat(moreCls), "id")) - : cls + .then(cls => + parentId + ? this.classificationApi + .findByHCPartyPatientSecretFKeys(parentId, delSfks.join(",")) + .then(moreCls => _.uniqBy(cls.concat(moreCls), "id")) + : cls ) ) as Promise>, - retry(() => - this.calendarItemApi - .findByHCPartyPatientSecretFKeys(ownerId, delSfks.join(",")) - .then( - cls => - parentId - ? this.calendarItemApi - .findByHCPartyPatientSecretFKeys(parentId, delSfks.join(",")) - .then(moreCls => _.uniqBy(cls.concat(moreCls), "id")) - : cls + retry(async () => { + const delegationSFKs = delSfks.join(",") + try { + let calendarItems = await this.calendarItemApi.findByHCPartyPatientSecretFKeys( + ownerId, + delegationSFKs ) - ) as Promise> + + if (parentId) { + const moreCalendarItems = await this.calendarItemApi.findByHCPartyPatientSecretFKeys( + parentId, + delegationSFKs + ) + + calendarItems = _.uniqBy(calendarItems.concat(moreCalendarItems), "id") + } + + console.log("#### calendar item export worked ####") + return calendarItems + } catch (ex) { + console.log(`ownerId: ${ownerId} ${ex}`) + } + }) as Promise> ]).then(([hes, frms, ctcs, ivs, cls, cis]) => { const docIds: { [key: string]: number } = {} ctcs.forEach( From 59eb76b4842c57b66d3c7c1e6698d7294d2c9063 Mon Sep 17 00:00:00 2001 From: Adrian Meyvn Date: Fri, 17 Jan 2020 09:13:40 +0200 Subject: [PATCH 29/75] MS-2723 - exception is rethrown --- icc-x-api/icc-patient-x-api.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/icc-x-api/icc-patient-x-api.ts b/icc-x-api/icc-patient-x-api.ts index 8bc8a621..6c8a259d 100644 --- a/icc-x-api/icc-patient-x-api.ts +++ b/icc-x-api/icc-patient-x-api.ts @@ -1263,10 +1263,12 @@ export class IccPatientXApi extends iccPatientApi { calendarItems = _.uniqBy(calendarItems.concat(moreCalendarItems), "id") } - console.log("#### calendar item export worked ####") return calendarItems } catch (ex) { - console.log(`ownerId: ${ownerId} ${ex}`) + console.log( + `exception occured exporting calendarItem for ownerId: ${ownerId} - ${ex}` + ) + throw ex } }) as Promise> ]).then(([hes, frms, ctcs, ivs, cls, cis]) => { From 91aa58c2543c9584f8dcc1c6b8d57c585b4cf830 Mon Sep 17 00:00:00 2001 From: Bogdan Safta Date: Tue, 28 Jan 2020 12:15:28 +0200 Subject: [PATCH 30/75] MS-2204 Regenerate SumehrExportInfoDto to contain healthElements and services fields --- icc-api/model/SumehrExportInfoDto.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/icc-api/model/SumehrExportInfoDto.ts b/icc-api/model/SumehrExportInfoDto.ts index 4add58a0..885a628f 100644 --- a/icc-api/model/SumehrExportInfoDto.ts +++ b/icc-api/model/SumehrExportInfoDto.ts @@ -1,9 +1,9 @@ /** - * + * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * OpenAPI spec version: 1.0.2 - * + * * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -24,7 +24,7 @@ import * as models from "./models" -export class SumehrExportInfoDto { +export class SumehrExportInfoDto { constructor(json: JSON | any) { Object.assign(this as SumehrExportInfoDto, json) } @@ -41,4 +41,8 @@ export class SumehrExportInfoDto { comment?: string includeIrrelevantInformation?: boolean + + services?: Array + + healthElements?: Array } From c217de1966c110e9b45e97899df6373b898567e8 Mon Sep 17 00:00:00 2001 From: Antoine Pairet Date: Tue, 28 Jan 2020 17:34:34 +0100 Subject: [PATCH 31/75] ms-2697 --- icc-x-api/icc-contact-x-api.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/icc-x-api/icc-contact-x-api.ts b/icc-x-api/icc-contact-x-api.ts index 12dbff2f..09d29178 100644 --- a/icc-x-api/icc-contact-x-api.ts +++ b/icc-x-api/icc-contact-x-api.ts @@ -322,7 +322,7 @@ export class IccContactXApi extends iccContactApi { return super .filterBy(startKey, startDocumentId, limit, body) .then(ctcs => - this.decrypt(user.healthcarePartyId!, ctcs.rows).then(decryptedRows => + this.decrypt(user.healthcarePartyId! || user.patientId!, ctcs.rows).then(decryptedRows => Object.assign(ctcs, { rows: decryptedRows }) ) ) @@ -338,10 +338,11 @@ export class IccContactXApi extends iccContactApi { ): Promise { return super .listContactsByOpeningDate(startKey, endKey, hcpartyid, startDocumentId, limit) - .then(ctcs => { - ctcs.rows = this.decrypt((user.healthcarePartyId || user.patientId)!, ctcs.rows) - return ctcs - }) + .then(ctcs => + this.decrypt(user.healthcarePartyId! || user.patientId!, ctcs.rows).then(decryptedRows => + Object.assign(ctcs, { rows: decryptedRows }) + ) + ) } findByHCPartyFormIdWithUser( From c64e972d9faef344f344ca7d75ab726c3927659d Mon Sep 17 00:00:00 2001 From: Antoine Pairet Date: Thu, 30 Jan 2020 11:39:24 +0100 Subject: [PATCH 32/75] actually use the fetch implementation --- icc-api/api/XHR.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/icc-api/api/XHR.ts b/icc-api/api/XHR.ts index 6be987c6..0982f13f 100644 --- a/icc-api/api/XHR.ts +++ b/icc-api/api/XHR.ts @@ -103,7 +103,8 @@ export namespace XHR { } : {} ), - timeout + timeout, + fetchImpl ).then(function(response) { if (response.status >= 400) { throw new XHRError(response.statusText, response.status, response.status, response.headers) From 84a23562444c1e8393f875d751fb9b8447aceddf Mon Sep 17 00:00:00 2001 From: Alina Zagan Date: Wed, 5 Feb 2020 15:30:36 +0200 Subject: [PATCH 33/75] Add contact patcher for pmf socketEventListener --- icc-x-api/icc-bekmehr-x-api.ts | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/icc-x-api/icc-bekmehr-x-api.ts b/icc-x-api/icc-bekmehr-x-api.ts index a7ef75c4..09dfcdf1 100644 --- a/icc-x-api/icc-bekmehr-x-api.ts +++ b/icc-x-api/icc-bekmehr-x-api.ts @@ -37,7 +37,9 @@ export class IccBekmehrXApi extends iccBeKmehrApi { resolve: (value?: Promise) => void, reject: (reason?: any) => void, progressCallback?: (progress: number) => void, - patcher?: (response: any[]) => Promise + servicesPatcher?: (response: any[]) => Promise, + contactsPatcher?: (response: any[]) => Promise, + healthElementsPatcher?: (response: any[]) => Promise ) { const that = this return (event: MessageEvent) => { @@ -48,6 +50,7 @@ export class IccBekmehrXApi extends iccBeKmehrApi { if (msg.type === "ContactDto") { that.ctcApi .decrypt(healthcarePartyId, msg.body) + .then(res => (contactsPatcher ? contactsPatcher(res) : Promise.resolve(res))) .then(res => socket.send( JSON.stringify({ command: "decryptResponse", uuid: msg.uuid, body: res }) @@ -56,6 +59,9 @@ export class IccBekmehrXApi extends iccBeKmehrApi { } else if (msg.type === "HealthElementDto") { that.helementApi .decrypt(healthcarePartyId, msg.body) + .then( + res => (healthElementsPatcher ? healthElementsPatcher(res) : Promise.resolve(res)) + ) .then(res => socket.send( JSON.stringify({ command: "decryptResponse", uuid: msg.uuid, body: res }) @@ -64,7 +70,7 @@ export class IccBekmehrXApi extends iccBeKmehrApi { } else { that.ctcApi .decryptServices(healthcarePartyId, msg.body) - .then(res => (patcher ? patcher(res) : Promise.resolve(res))) + .then(res => (servicesPatcher ? servicesPatcher(res) : Promise.resolve(res))) .then(res => socket.send( JSON.stringify({ command: "decryptResponse", uuid: msg.uuid, body: res }) @@ -93,7 +99,8 @@ export class IccBekmehrXApi extends iccBeKmehrApi { language: string, body: models.SoftwareMedicalFileExportDto, progressCallback?: (progress: number) => void, - sessionId?: string + sessionId?: string, + contactsPatcher?: (response: ContactDto[]) => Promise ): Promise { return new Promise((resolve, reject) => { const socket = new WebSocket( @@ -108,7 +115,15 @@ export class IccBekmehrXApi extends iccBeKmehrApi { // Listen for messages socket.addEventListener( "message", - this.socketEventListener(socket, healthcarePartyId, resolve, reject, progressCallback) + this.socketEventListener( + socket, + healthcarePartyId, + resolve, + reject, + progressCallback, + undefined, + contactsPatcher + ) ) }) } From e8ba1de2fefd1dcb579b6f3cf8da30d1e850894a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ce=CC=81dric=20Bamps?= Date: Wed, 5 Feb 2020 14:54:08 +0100 Subject: [PATCH 34/75] optimize Uint8Array <-> UTF-8 conversion for modern platforms (keeping the existing implementations for Node.js < 11 and IE) --- icc-x-api/crypto/utils.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/icc-x-api/crypto/utils.ts b/icc-x-api/crypto/utils.ts index 934cd906..9e10489e 100644 --- a/icc-x-api/crypto/utils.ts +++ b/icc-x-api/crypto/utils.ts @@ -6,6 +6,9 @@ import * as _ from "lodash" export class UtilsClass { private crypto: Crypto + private textDecoder = TextDecoder ? new TextDecoder() : null + private textEncoder = TextEncoder ? new TextEncoder() : null + constructor( crypto: Crypto = typeof window !== "undefined" ? window.crypto @@ -148,6 +151,10 @@ export class UtilsClass { } utf82ua(str: string): Uint8Array { + if (this.textEncoder) { + return this.textEncoder.encode(str) + } + const utf8 = new Uint8Array(4 * str.length) let j = 0 for (var i = 0; i < str.length; i++) { @@ -185,6 +192,10 @@ export class UtilsClass { } ua2utf8(arrBuf: Uint8Array | ArrayBuffer): string { + if (this.textDecoder) { + return this.textDecoder.decode(arrBuf) + } + var out, i, len, c, u var char2, char3, char4 From d35ca0ec458ce70c16c907b04a28729ee724924c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ce=CC=81dric=20Bamps?= Date: Wed, 5 Feb 2020 15:13:38 +0100 Subject: [PATCH 35/75] clean out unused crypto property --- icc-x-api/crypto/utils.ts | 13 +---- icc-x-api/icc-crypto-x-api.ts | 100 +++++++++++++++++++--------------- 2 files changed, 58 insertions(+), 55 deletions(-) diff --git a/icc-x-api/crypto/utils.ts b/icc-x-api/crypto/utils.ts index 9e10489e..aff89abd 100644 --- a/icc-x-api/crypto/utils.ts +++ b/icc-x-api/crypto/utils.ts @@ -4,20 +4,11 @@ import { Moment } from "moment" import * as _ from "lodash" export class UtilsClass { - private crypto: Crypto - private textDecoder = TextDecoder ? new TextDecoder() : null private textEncoder = TextEncoder ? new TextEncoder() : null - constructor( - crypto: Crypto = typeof window !== "undefined" - ? window.crypto - : typeof self !== "undefined" - ? self.crypto - : ({} as Crypto) - ) { - this.crypto = crypto - } + constructor() {} + /** * String to Uint8Array * diff --git a/icc-x-api/icc-crypto-x-api.ts b/icc-x-api/icc-crypto-x-api.ts index ef11a9f8..b02025b6 100644 --- a/icc-x-api/icc-crypto-x-api.ts +++ b/icc-x-api/icc-crypto-x-api.ts @@ -119,8 +119,8 @@ export class IccCryptoXApi { crypto: Crypto = typeof window !== "undefined" ? window.crypto : typeof self !== "undefined" - ? self.crypto - : ({} as Crypto) + ? self.crypto + : ({} as Crypto) ) { this.hcpartyBaseApi = hcpartyBaseApi this.patientBaseApi = patientBaseApi @@ -128,7 +128,7 @@ export class IccCryptoXApi { this._AES = new AESUtils(crypto) this._RSA = new RSAUtils(crypto) - this._utils = new UtilsClass(crypto) + this._utils = new UtilsClass() this._shamir = new ShamirClass(crypto) } @@ -341,10 +341,11 @@ export class IccCryptoXApi { delegatorIds[delegationItem.owner!] = true //TODO: why is set to true? }) } else if (fallbackOnParent) { - return this.getHcpOrPatient(healthcarePartyId).then(hcp => - (hcp as any).parentId - ? this.decryptAndImportAesHcPartyKeysInDelegations((hcp as any).parentId, delegations) - : Promise.resolve([]) + return this.getHcpOrPatient(healthcarePartyId).then( + hcp => + (hcp as any).parentId + ? this.decryptAndImportAesHcPartyKeysInDelegations((hcp as any).parentId, delegations) + : Promise.resolve([]) ) } @@ -514,7 +515,9 @@ export class IccCryptoXApi { .decrypt(importedAESHcPartyKey.key, this._utils.hex2ua(d.key)) .catch(() => { console.log( - `Cannot decrypt delegation from ${d.owner} to ${d.delegatedTo} for object with id ${modifiedObject.id}:`, + `Cannot decrypt delegation from ${d.owner} to ${ + d.delegatedTo + } for object with id ${modifiedObject.id}:`, modifiedObject ) return null @@ -530,7 +533,9 @@ export class IccCryptoXApi { .decrypt(importedAESHcPartyKey.key, this._utils.hex2ua(d.key)) .catch(() => { console.log( - `Cannot decrypt cryptedForeignKeys from ${d.owner} to ${d.delegatedTo} for object with id ${modifiedObject.id}:`, + `Cannot decrypt cryptedForeignKeys from ${d.owner} to ${ + d.delegatedTo + } for object with id ${modifiedObject.id}:`, modifiedObject ) return null @@ -734,7 +739,9 @@ export class IccCryptoXApi { d.owner === ownerId && this._AES.decrypt(decryptedHcPartyKey.key, this._utils.hex2ua(d.key)).catch(() => { console.log( - `Cannot decrypt encryption key from ${d.owner} to ${d.delegatedTo} for object with id ${modifiedObject.id}:`, + `Cannot decrypt encryption key from ${d.owner} to ${ + d.delegatedTo + } for object with id ${modifiedObject.id}:`, modifiedObject ) return null @@ -862,19 +869,20 @@ export class IccCryptoXApi { ) : Promise.resolve({ delegations: {}, cryptedForeignKeys: {} }) ) - .then(extendedChildObjectSPKsAndCFKs => - secretEncryptionKey - ? this.appendEncryptionKeys(child, ownerId, delegateId, secretEncryptionKey).then( - //TODO: extendedDelegationsAndCryptedForeignKeys and appendEncryptionKeys can be done in parallel - extendedChildObjectEKs => ({ + .then( + extendedChildObjectSPKsAndCFKs => + secretEncryptionKey + ? this.appendEncryptionKeys(child, ownerId, delegateId, secretEncryptionKey).then( + //TODO: extendedDelegationsAndCryptedForeignKeys and appendEncryptionKeys can be done in parallel + extendedChildObjectEKs => ({ + extendedSPKsAndCFKs: extendedChildObjectSPKsAndCFKs, + extendedEKs: extendedChildObjectEKs + }) + ) + : Promise.resolve({ extendedSPKsAndCFKs: extendedChildObjectSPKsAndCFKs, - extendedEKs: extendedChildObjectEKs + extendedEKs: { encryptionKeys: {} } }) - ) - : Promise.resolve({ - extendedSPKsAndCFKs: extendedChildObjectSPKsAndCFKs, - extendedEKs: { encryptionKeys: {} } - }) ) .then( ({ @@ -1120,16 +1128,17 @@ export class IccCryptoXApi { } ) : Promise.resolve([]) - ).then(extractedKeys => - (hcp as HealthcarePartyDto).parentId - ? this.extractKeysHierarchyFromDelegationLikes( - (hcp as HealthcarePartyDto).parentId!, - objectId, - delegations - ).then(parentResponse => - parentResponse.concat({ extractedKeys: extractedKeys, hcpartyId: hcpartyId }) - ) - : [{ extractedKeys: extractedKeys, hcpartyId: hcpartyId }] + ).then( + extractedKeys => + (hcp as HealthcarePartyDto).parentId + ? this.extractKeysHierarchyFromDelegationLikes( + (hcp as HealthcarePartyDto).parentId!, + objectId, + delegations + ).then(parentResponse => + parentResponse.concat({ extractedKeys: extractedKeys, hcpartyId: hcpartyId }) + ) + : [{ extractedKeys: extractedKeys, hcpartyId: hcpartyId }] ) ) } @@ -1169,18 +1178,19 @@ export class IccCryptoXApi { } ) : Promise.resolve([]) - ).then(extractedKeys => - (hcp as HealthcarePartyDto).parentId - ? this.extractKeysFromDelegationsForHcpHierarchy( - (hcp as HealthcarePartyDto).parentId!, - objectId, - delegations - ).then(parentResponse => - _.assign(parentResponse, { - extractedKeys: parentResponse.extractedKeys.concat(extractedKeys) - }) - ) - : { extractedKeys: extractedKeys, hcpartyId: hcpartyId } + ).then( + extractedKeys => + (hcp as HealthcarePartyDto).parentId + ? this.extractKeysFromDelegationsForHcpHierarchy( + (hcp as HealthcarePartyDto).parentId!, + objectId, + delegations + ).then(parentResponse => + _.assign(parentResponse, { + extractedKeys: parentResponse.extractedKeys.concat(extractedKeys) + }) + ) + : { extractedKeys: extractedKeys, hcpartyId: hcpartyId } ) ) } @@ -1241,7 +1251,9 @@ export class IccCryptoXApi { }) .catch(err => { console.log( - `Could not decrypt generic delegation in object with ID: ${masterId} from ${genericDelegationItem.owner} to ${genericDelegationItem.delegatedTo}: ${err}` + `Could not decrypt generic delegation in object with ID: ${masterId} from ${ + genericDelegationItem.owner + } to ${genericDelegationItem.delegatedTo}: ${err}` ) return undefined }) From d646c792b41f67dea274c17433ce3cde4b3bb851 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ce=CC=81dric=20Bamps?= Date: Wed, 5 Feb 2020 15:41:09 +0100 Subject: [PATCH 36/75] add method to truncate padding nulls --- icc-x-api/crypto/utils.ts | 19 +++++++++++++++++++ test/crypto-utils.ts | 31 +++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 test/crypto-utils.ts diff --git a/icc-x-api/crypto/utils.ts b/icc-x-api/crypto/utils.ts index aff89abd..d80adbb7 100644 --- a/icc-x-api/crypto/utils.ts +++ b/icc-x-api/crypto/utils.ts @@ -242,6 +242,25 @@ export class UtilsClass { return out } + /** + * Provide a view over the given Uint8Array where any trailing null bytes at + * the end are truncated. + * + * This can be used to ignore null bytes at the end of a padded UTF-8 string + * without needing to copy that string, assuming code point U+0000 is encoded + * in one null byte according to standards rather than in a multi-byte + * overlong form. + */ + truncateTrailingNulls(a: Uint8Array) { + let end = a.byteLength - 1 + while (a[end] === 0 && end >= 0) { + end-- + } + // end is now either the last non-null position in a or -1; in the latter + // case the returned array will have length 0. + return a.subarray(0, end + 1) + } + base64url(b: Uint8Array): string { return base64js .fromByteArray(b) diff --git a/test/crypto-utils.ts b/test/crypto-utils.ts new file mode 100644 index 00000000..eaa3ad38 --- /dev/null +++ b/test/crypto-utils.ts @@ -0,0 +1,31 @@ +import { UtilsClass } from "../icc-x-api/crypto/utils" +import { expect } from "chai" +import "mocha" + +describe("ArrayBuffer methods", () => { + let utils: UtilsClass + + before(() => { + utils = new UtilsClass() + }) + + describe("truncateTrailingNulls", () => { + it("should truncate trailing nulls out of an Uint8Array without copying", () => { + const bytes = [72, 101, 108, 108, 111, 33] + const originalArray = Uint8Array.from([...bytes, 0, 0]) + const truncatedArray = utils.truncateTrailingNulls(originalArray) + expect(truncatedArray.buffer).to.equal(originalArray.buffer) + expect(Array.from(truncatedArray)).to.eql(bytes) + }) + + it("should preserve the offset into the buffer", () => { + const bytes = [72, 101, 108, 108, 111, 33] + const originalBuffer = new Uint8Array([0, 0, ...bytes, 0, 0]).buffer + const originalArray = new Uint8Array(originalBuffer, 2, bytes.length) + const truncatedArray = utils.truncateTrailingNulls(originalArray) + expect(truncatedArray.buffer).to.equal(originalArray.buffer) + expect(truncatedArray.byteOffset).to.equal(originalArray.byteOffset) + expect(Array.from(truncatedArray)).to.eql(bytes) + }) + }) +}) From 85468f37de65888e923d97701823dcc9c17ccc5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ce=CC=81dric=20Bamps?= Date: Wed, 5 Feb 2020 16:23:46 +0100 Subject: [PATCH 37/75] be a bit safer about potential undefined inputs to ua2utf8 --- icc-x-api/crypto/utils.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/icc-x-api/crypto/utils.ts b/icc-x-api/crypto/utils.ts index d80adbb7..cdff78a4 100644 --- a/icc-x-api/crypto/utils.ts +++ b/icc-x-api/crypto/utils.ts @@ -184,7 +184,8 @@ export class UtilsClass { ua2utf8(arrBuf: Uint8Array | ArrayBuffer): string { if (this.textDecoder) { - return this.textDecoder.decode(arrBuf) + // if arrBuf is undefined, imitate the JS implementation below which returns an empty string + return arrBuf ? this.textDecoder.decode(arrBuf) : "" } var out, i, len, c, u From 78d7aa4c52fa7a5ae65836851a905a5d20d97d53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ce=CC=81dric=20Bamps?= Date: Wed, 5 Feb 2020 16:31:06 +0100 Subject: [PATCH 38/75] optimize JS ua2utf8 by avoiding copies --- icc-x-api/crypto/utils.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/icc-x-api/crypto/utils.ts b/icc-x-api/crypto/utils.ts index cdff78a4..b31627d1 100644 --- a/icc-x-api/crypto/utils.ts +++ b/icc-x-api/crypto/utils.ts @@ -191,7 +191,9 @@ export class UtilsClass { var out, i, len, c, u var char2, char3, char4 - const array = new Uint8Array(arrBuf) + // avoid applying the Uint8Array constructor: on ArrayBuffer it creates a + // view but on Uint8Array it creates a copy + const array = ArrayBuffer.isView(arrBuf) ? arrBuf : new Uint8Array(arrBuf) out = "" len = array.length || array.byteLength From c6c4b9e4f5c28b10f587fced95a87af56f8b3bf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ce=CC=81dric=20Bamps?= Date: Wed, 5 Feb 2020 16:43:36 +0100 Subject: [PATCH 39/75] truncate nulls before utf-8 conversion to avoid copying data --- icc-x-api/icc-contact-x-api.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/icc-x-api/icc-contact-x-api.ts b/icc-x-api/icc-contact-x-api.ts index 09d29178..b904fb76 100644 --- a/icc-x-api/icc-contact-x-api.ts +++ b/icc-x-api/icc-contact-x-api.ts @@ -502,7 +502,9 @@ export class IccContactXApi extends iccContactApi { c => { let jsonContent try { - jsonContent = utils.ua2utf8(c!).replace(/\0+$/g, "") + jsonContent = utils.ua2utf8( + utils.truncateTrailingNull(new Uint8Array(c!)) + ) resolve(c && { content: JSON.parse(jsonContent) }) } catch (e) { console.log( @@ -526,7 +528,9 @@ export class IccContactXApi extends iccContactApi { s => { let jsonContent try { - jsonContent = utils.ua2utf8(s!).replace(/\0+$/g, "") + jsonContent = utils.ua2utf8( + utils.truncateTrailingNulls(new Uint8Array(s!)) + ) resolve(s && JSON.parse(jsonContent)) } catch (e) { console.log( @@ -620,7 +624,9 @@ export class IccContactXApi extends iccContactApi { c => { let jsonContent try { - jsonContent = utils.ua2utf8(c!).replace(/\0+$/g, "") + jsonContent = utils.ua2utf8( + utils.truncateTrailingNulls(new Uint8Array(c!)) + ) resolve(c && { content: JSON.parse(jsonContent) }) } catch (e) { console.log( @@ -644,7 +650,9 @@ export class IccContactXApi extends iccContactApi { s => { let jsonContent try { - jsonContent = utils.ua2utf8(s!).replace(/\0+$/g, "") + jsonContent = utils.ua2utf8( + utils.truncateTrailingNulls(new Uint8Array(s!)) + ) resolve(s && JSON.parse(jsonContent)) } catch (e) { console.log( From 577629ebfe37d4cbcea1187741a29ddbbdd699c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ce=CC=81dric=20Bamps?= Date: Thu, 6 Feb 2020 09:50:59 +0100 Subject: [PATCH 40/75] fix typo --- icc-x-api/icc-contact-x-api.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/icc-x-api/icc-contact-x-api.ts b/icc-x-api/icc-contact-x-api.ts index b904fb76..af53e204 100644 --- a/icc-x-api/icc-contact-x-api.ts +++ b/icc-x-api/icc-contact-x-api.ts @@ -503,7 +503,7 @@ export class IccContactXApi extends iccContactApi { let jsonContent try { jsonContent = utils.ua2utf8( - utils.truncateTrailingNull(new Uint8Array(c!)) + utils.truncateTrailingNulls(new Uint8Array(c!)) ) resolve(c && { content: JSON.parse(jsonContent) }) } catch (e) { From 6db8b679318990da34997c0b1179e6f1e372762a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ce=CC=81dric=20Judicq?= Date: Thu, 6 Feb 2020 20:17:41 +0700 Subject: [PATCH 41/75] Fix issue with the new unfetch --- icc-api/api/XHR.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/icc-api/api/XHR.ts b/icc-api/api/XHR.ts index 0982f13f..551fe899 100644 --- a/icc-api/api/XHR.ts +++ b/icc-api/api/XHR.ts @@ -114,7 +114,7 @@ export namespace XHR { ? response.json() : ct.startsWith("application/xml") || ct.startsWith("text/") ? response.text() - : response.arrayBuffer() + : response.blob().then(blob => new Response(blob).arrayBuffer()) ).then(d => new Data(response.status, ct, d)) }) } From 00e30577e43ee6c236c273da7f077c96d182f342 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ce=CC=81dric=20Judicq?= Date: Fri, 7 Feb 2020 12:02:59 +0700 Subject: [PATCH 42/75] MS-2918 --- icc-api/api/XHR.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/icc-api/api/XHR.ts b/icc-api/api/XHR.ts index 6be987c6..18f2d3f3 100644 --- a/icc-api/api/XHR.ts +++ b/icc-api/api/XHR.ts @@ -113,7 +113,9 @@ export namespace XHR { ? response.json() : ct.startsWith("application/xml") || ct.startsWith("text/") ? response.text() - : response.arrayBuffer() + : response.arrayBuffer + ? response.arrayBuffer() + : response.blob().then(blob => new Response(blob).arrayBuffer()) ).then(d => new Data(response.status, ct, d)) }) } From 4521eaaae7f551335ded666c7c5b2cdf3f9d5582 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ce=CC=81dric=20Bamps?= Date: Mon, 10 Feb 2020 11:58:21 +0100 Subject: [PATCH 43/75] fix incomplete pagination query Note that this requires a corresponding fix on the backend to parse that startKey parameter correctly. Otherwise, paginated queries will return a 500 error. --- icc-x-api/icc-accesslog-x-api.ts | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/icc-x-api/icc-accesslog-x-api.ts b/icc-x-api/icc-accesslog-x-api.ts index b53b3a6d..22145877 100644 --- a/icc-x-api/icc-accesslog-x-api.ts +++ b/icc-x-api/icc-accesslog-x-api.ts @@ -373,22 +373,25 @@ export class IccAccesslogXApi extends iccAccesslogApi { startDate?: number ): Promise { let foundAccessLogs: AccessLogWithPatientId[] = [], - currentIteration = 0, - startDocumentId + nextKeyPair: models.PaginatedDocumentKeyIdPair | undefined = undefined const numberRequestedAccessLogs = 100 const MAX_WHILE_ITERATIONS = 5 - while (foundAccessLogs.length < limit && currentIteration < MAX_WHILE_ITERATIONS) { + for ( + let currentIteration = 0; + foundAccessLogs.length < limit && currentIteration < MAX_WHILE_ITERATIONS; + currentIteration++ + ) { const currentLimit = limit - foundAccessLogs.length const { rows: logs, - nextKeyPair + nextKeyPair: newNextKeyPair }: models.AccessLogPaginatedList = await super.findByUserAfterDate( userId, "USER_ACCESS", startDate, - undefined, - startDocumentId, + nextKeyPair && JSON.stringify(nextKeyPair.startKey!), + nextKeyPair && nextKeyPair.startKeyDocId!, numberRequestedAccessLogs, true ) @@ -421,13 +424,11 @@ export class IccAccesslogXApi extends iccAccesslogApi { if ((logs || []).length < numberRequestedAccessLogs) { break - } else if (nextKeyPair) { - startDocumentId = nextKeyPair.startKeyDocId + } else if (newNextKeyPair) { + nextKeyPair = newNextKeyPair } else { break } - - currentIteration++ } return foundAccessLogs From ea352fc13f6d06f98e9b51aca18f02316eac5d97 Mon Sep 17 00:00:00 2001 From: Bogdan Safta Date: Wed, 11 Mar 2020 11:37:09 +0200 Subject: [PATCH 44/75] MS-2247 Patch health elements on PMF export --- icc-x-api/icc-bekmehr-x-api.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/icc-x-api/icc-bekmehr-x-api.ts b/icc-x-api/icc-bekmehr-x-api.ts index 09dfcdf1..bb74aec2 100644 --- a/icc-x-api/icc-bekmehr-x-api.ts +++ b/icc-x-api/icc-bekmehr-x-api.ts @@ -59,8 +59,8 @@ export class IccBekmehrXApi extends iccBeKmehrApi { } else if (msg.type === "HealthElementDto") { that.helementApi .decrypt(healthcarePartyId, msg.body) - .then( - res => (healthElementsPatcher ? healthElementsPatcher(res) : Promise.resolve(res)) + .then(res => + healthElementsPatcher ? healthElementsPatcher(res) : Promise.resolve(res) ) .then(res => socket.send( @@ -100,7 +100,8 @@ export class IccBekmehrXApi extends iccBeKmehrApi { body: models.SoftwareMedicalFileExportDto, progressCallback?: (progress: number) => void, sessionId?: string, - contactsPatcher?: (response: ContactDto[]) => Promise + contactsPatcher?: (response: ContactDto[]) => Promise, + healthElementsPatcher?: (response: any[]) => Promise ): Promise { return new Promise((resolve, reject) => { const socket = new WebSocket( @@ -122,7 +123,8 @@ export class IccBekmehrXApi extends iccBeKmehrApi { reject, progressCallback, undefined, - contactsPatcher + contactsPatcher, + healthElementsPatcher ) ) }) From b3d59539a0925af538cf017f7b9e65ea2a8fc8e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20Ducha=CC=82teau?= Date: Wed, 11 Mar 2020 12:18:27 +0100 Subject: [PATCH 45/75] Support for suspensions in Medications, laterality in healthElements and compoundValues in Service content. Improved sumehr generation dto. --- icc-api/model/ContentDto.ts | 2 ++ icc-api/model/HealthElementDto.ts | 8 +++++++ icc-api/model/MedicationDto.ts | 2 ++ icc-api/model/SuspensionDto.ts | 36 +++++++++++++++++++++++++++++++ icc-api/model/models.ts | 1 + 5 files changed, 49 insertions(+) create mode 100644 icc-api/model/SuspensionDto.ts diff --git a/icc-api/model/ContentDto.ts b/icc-api/model/ContentDto.ts index ab49a3dc..f4a52fcc 100644 --- a/icc-api/model/ContentDto.ts +++ b/icc-api/model/ContentDto.ts @@ -44,5 +44,7 @@ export class ContentDto { medicationValue?: models.MedicationDto + compoundValue?: Array + binaryValue?: Array } diff --git a/icc-api/model/HealthElementDto.ts b/icc-api/model/HealthElementDto.ts index 53961c35..8bd2160f 100644 --- a/icc-api/model/HealthElementDto.ts +++ b/icc-api/model/HealthElementDto.ts @@ -82,9 +82,17 @@ export class HealthElementDto { idService?: string + laterality?: HealthElementDto.LateralityEnum + plansOfAction?: Array episodes?: Array careTeam?: Array } +export namespace HealthElementDto { + export enum LateralityEnum { + Left = "left", + Right = "right" + } +} diff --git a/icc-api/model/MedicationDto.ts b/icc-api/model/MedicationDto.ts index 58338492..f09130b6 100644 --- a/icc-api/model/MedicationDto.ts +++ b/icc-api/model/MedicationDto.ts @@ -74,6 +74,8 @@ export class MedicationDto { agreements?: { [key: string]: models.ParagraphAgreementDto } + suspension?: Array + medicationSchemeIdOnSafe?: string medicationSchemeSafeVersion?: number diff --git a/icc-api/model/SuspensionDto.ts b/icc-api/model/SuspensionDto.ts new file mode 100644 index 00000000..43c2cd08 --- /dev/null +++ b/icc-api/model/SuspensionDto.ts @@ -0,0 +1,36 @@ +/** + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.0.2 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import * as models from "./models" + +export class SuspensionDto { + constructor(json: JSON | any) { + Object.assign(this as SuspensionDto, json) + } + beginMoment?: number + + endMoment?: number + + suspensionReason?: string +} diff --git a/icc-api/model/models.ts b/icc-api/model/models.ts index 3dab8fab..4ee13ec7 100644 --- a/icc-api/model/models.ts +++ b/icc-api/model/models.ts @@ -194,6 +194,7 @@ export * from "./Suggest" export * from "./SumehrContentDto" export * from "./SumehrExportInfoDto" export * from "./SumehrValidityDto" +export * from "./SuspensionDto" export * from "./Tag" export * from "./TarificationDto" export * from "./TarificationPaginatedList" From c13560502d9ffab81fa0bd48b4328d138820b7cc Mon Sep 17 00:00:00 2001 From: Cedric Judicq Date: Sat, 14 Mar 2020 18:02:39 +0700 Subject: [PATCH 46/75] Fix calendar item decryption --- icc-x-api/icc-calendar-item-x-api.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/icc-x-api/icc-calendar-item-x-api.ts b/icc-x-api/icc-calendar-item-x-api.ts index cd9dac82..05615d9c 100755 --- a/icc-x-api/icc-calendar-item-x-api.ts +++ b/icc-x-api/icc-calendar-item-x-api.ts @@ -403,6 +403,9 @@ export class IccCalendarItemXApi extends iccCalendarItemApi { ) return {} } + }).catch(err => { + console.log('Error during AES decryption', err); + return {}; }) ) ) From a5f13bb04acb2082c85ccf01d46afb9ca228466a Mon Sep 17 00:00:00 2001 From: Adrian Date: Sat, 11 Apr 2020 12:37:02 +0300 Subject: [PATCH 47/75] MS-3460 - ignore errors caused by CalendarItem export on server side --- icc-x-api/icc-patient-x-api.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/icc-x-api/icc-patient-x-api.ts b/icc-x-api/icc-patient-x-api.ts index cd79f10b..c1abbcc8 100644 --- a/icc-x-api/icc-patient-x-api.ts +++ b/icc-x-api/icc-patient-x-api.ts @@ -1304,7 +1304,7 @@ export class IccPatientXApi extends iccPatientApi { console.log( `exception occured exporting calendarItem for ownerId: ${ownerId} - ${ex}` ) - throw ex + //throw ex } }) as Promise> ]).then(([hes, frms, ctcs, ivs, cls, cis]) => { From 01c0eb176abf7c8d7b79b6ddd9fdfae69f4b77c4 Mon Sep 17 00:00:00 2001 From: Phil Mertens Date: Thu, 16 Apr 2020 10:21:14 +0200 Subject: [PATCH 48/75] Genloc icc-api from icure backend master branch ICure master commit : dbd6878fb17b27d376b17878e6b6f797049bdf3a --- icc-api/LICENSE | 201 ------------------------- icc-api/api/XHR.ts | 9 +- icc-api/api/iccBeKmehrApi.ts | 14 ++ icc-api/api/iccClusterApi.ts | 64 -------- icc-api/api/iccGroupApi.ts | 76 ---------- icc-api/api/iccUserApi.ts | 12 -- icc-api/iccApi.ts | 2 - icc-api/model/AccessLogDto.ts | 2 + icc-api/model/CareMemberDto.ts | 34 ----- icc-api/model/GroupDto.ts | 50 ------ icc-api/model/ImportResultDto.ts | 2 + icc-api/model/InvoiceDto.ts | 2 + icc-api/model/MedicalLocationDto.ts | 2 + icc-api/model/ParagraphAgreementDto.ts | 4 +- icc-api/model/models.ts | 1 - 15 files changed, 27 insertions(+), 448 deletions(-) delete mode 100644 icc-api/LICENSE delete mode 100644 icc-api/api/iccClusterApi.ts delete mode 100644 icc-api/api/iccGroupApi.ts delete mode 100644 icc-api/model/CareMemberDto.ts delete mode 100644 icc-api/model/GroupDto.ts diff --git a/icc-api/LICENSE b/icc-api/LICENSE deleted file mode 100644 index 8dada3ed..00000000 --- a/icc-api/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/icc-api/api/XHR.ts b/icc-api/api/XHR.ts index 1d29ad14..1c0bbfc2 100644 --- a/icc-api/api/XHR.ts +++ b/icc-api/api/XHR.ts @@ -103,8 +103,7 @@ export namespace XHR { } : {} ), - timeout, - fetchImpl + timeout ).then(function(response) { if (response.status >= 400) { throw new XHRError(response.statusText, response.status, response.status, response.headers) @@ -113,10 +112,8 @@ export namespace XHR { return (ct.startsWith("application/json") ? response.json() : ct.startsWith("application/xml") || ct.startsWith("text/") - ? response.text() - : response.arrayBuffer - ? response.arrayBuffer() - : response.blob().then(blob => new Response(blob).arrayBuffer()) + ? response.text() + : response.arrayBuffer() ).then(d => new Data(response.status, ct, d)) }) } diff --git a/icc-api/api/iccBeKmehrApi.ts b/icc-api/api/iccBeKmehrApi.ts index aa402ad7..12f242a5 100644 --- a/icc-api/api/iccBeKmehrApi.ts +++ b/icc-api/api/iccBeKmehrApi.ts @@ -84,6 +84,7 @@ export class iccBeKmehrApi { date?: number, language?: string, recipientNihii?: string, + recipientSsin?: string, recipientFirstName?: string, recipientLastName?: string, mimeType?: string, @@ -102,6 +103,7 @@ export class iccBeKmehrApi { (date ? "&date=" + date : "") + (language ? "&language=" + language : "") + (recipientNihii ? "&recipientNihii=" + recipientNihii : "") + + (recipientSsin ? "&recipientSsin=" + recipientSsin : "") + (recipientFirstName ? "&recipientFirstName=" + recipientFirstName : "") + (recipientLastName ? "&recipientLastName=" + recipientLastName : "") + (mimeType ? "&mimeType=" + mimeType : "") @@ -141,6 +143,7 @@ export class iccBeKmehrApi { date?: number, language?: string, recipientNihii?: string, + recipientSsin?: string, recipientFirstName?: string, recipientLastName?: string, mimeType?: string, @@ -159,6 +162,7 @@ export class iccBeKmehrApi { (date ? "&date=" + date : "") + (language ? "&language=" + language : "") + (recipientNihii ? "&recipientNihii=" + recipientNihii : "") + + (recipientSsin ? "&recipientSsin=" + recipientSsin : "") + (recipientFirstName ? "&recipientFirstName=" + recipientFirstName : "") + (recipientLastName ? "&recipientLastName=" + recipientLastName : "") + (mimeType ? "&mimeType=" + mimeType : "") @@ -202,6 +206,7 @@ export class iccBeKmehrApi { date?: number, language?: string, recipientNihii?: string, + recipientSsin?: string, recipientFirstName?: string, recipientLastName?: string, mimeType?: string, @@ -220,6 +225,7 @@ export class iccBeKmehrApi { (date ? "&date=" + date : "") + (language ? "&language=" + language : "") + (recipientNihii ? "&recipientNihii=" + recipientNihii : "") + + (recipientSsin ? "&recipientSsin=" + recipientSsin : "") + (recipientFirstName ? "&recipientFirstName=" + recipientFirstName : "") + (recipientLastName ? "&recipientLastName=" + recipientLastName : "") + (mimeType ? "&mimeType=" + mimeType : "") @@ -237,6 +243,7 @@ export class iccBeKmehrApi { date?: number, language?: string, recipientNihii?: string, + recipientSsin?: string, recipientFirstName?: string, recipientLastName?: string, mimeType?: string, @@ -255,6 +262,7 @@ export class iccBeKmehrApi { (date ? "&date=" + date : "") + (language ? "&language=" + language : "") + (recipientNihii ? "&recipientNihii=" + recipientNihii : "") + + (recipientSsin ? "&recipientSsin=" + recipientSsin : "") + (recipientFirstName ? "&recipientFirstName=" + recipientFirstName : "") + (recipientLastName ? "&recipientLastName=" + recipientLastName : "") + (mimeType ? "&mimeType=" + mimeType : "") @@ -272,6 +280,7 @@ export class iccBeKmehrApi { date?: number, language?: string, recipientNihii?: string, + recipientSsin?: string, recipientFirstName?: string, recipientLastName?: string, mimeType?: string, @@ -290,6 +299,7 @@ export class iccBeKmehrApi { (date ? "&date=" + date : "") + (language ? "&language=" + language : "") + (recipientNihii ? "&recipientNihii=" + recipientNihii : "") + + (recipientSsin ? "&recipientSsin=" + recipientSsin : "") + (recipientFirstName ? "&recipientFirstName=" + recipientFirstName : "") + (recipientLastName ? "&recipientLastName=" + recipientLastName : "") + (mimeType ? "&mimeType=" + mimeType : "") @@ -307,6 +317,7 @@ export class iccBeKmehrApi { date?: number, language?: string, recipientNihii?: string, + recipientSsin?: string, recipientFirstName?: string, recipientLastName?: string, mimeType?: string, @@ -325,6 +336,7 @@ export class iccBeKmehrApi { (date ? "&date=" + date : "") + (language ? "&language=" + language : "") + (recipientNihii ? "&recipientNihii=" + recipientNihii : "") + + (recipientSsin ? "&recipientSsin=" + recipientSsin : "") + (recipientFirstName ? "&recipientFirstName=" + recipientFirstName : "") + (recipientLastName ? "&recipientLastName=" + recipientLastName : "") + (mimeType ? "&mimeType=" + mimeType : "") @@ -342,6 +354,7 @@ export class iccBeKmehrApi { date?: number, language?: string, recipientNihii?: string, + recipientSsin?: string, recipientFirstName?: string, recipientLastName?: string, mimeType?: string, @@ -360,6 +373,7 @@ export class iccBeKmehrApi { (date ? "&date=" + date : "") + (language ? "&language=" + language : "") + (recipientNihii ? "&recipientNihii=" + recipientNihii : "") + + (recipientSsin ? "&recipientSsin=" + recipientSsin : "") + (recipientFirstName ? "&recipientFirstName=" + recipientFirstName : "") + (recipientLastName ? "&recipientLastName=" + recipientLastName : "") + (mimeType ? "&mimeType=" + mimeType : "") diff --git a/icc-api/api/iccClusterApi.ts b/icc-api/api/iccClusterApi.ts deleted file mode 100644 index 7effcf9e..00000000 --- a/icc-api/api/iccClusterApi.ts +++ /dev/null @@ -1,64 +0,0 @@ -/** - * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: 1.0.2 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { XHR } from "./XHR" -import * as models from "../model/models" - -export class iccClusterApi { - host: string - headers: Array - fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise - - constructor( - host: string, - headers: any, - fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise - ) { - this.host = host - this.headers = Object.keys(headers).map(k => new XHR.Header(k, headers[k])) - this.fetchImpl = fetchImpl - } - - setHeaders(h: Array) { - this.headers = h - } - - handleError(e: XHR.Data) { - if (e.status == 401) throw Error("auth-failed") - else throw Error("api-error" + e.status) - } - - groupSyncStatus(): Promise { - let _body = null - - const _url = this.host + "/cluster/gsyncs" + "?ts=" + new Date().getTime() - let headers = this.headers - headers = headers - .filter(h => h.header !== "Content-Type") - .concat(new XHR.Header("Content-Type", "application/json")) - return XHR.sendCommand("GET", _url, headers, _body, this.fetchImpl) - .then(doc => new models.CodePaginatedList(doc.body as JSON)) - .catch(err => this.handleError(err)) - } -} diff --git a/icc-api/api/iccGroupApi.ts b/icc-api/api/iccGroupApi.ts deleted file mode 100644 index eb179833..00000000 --- a/icc-api/api/iccGroupApi.ts +++ /dev/null @@ -1,76 +0,0 @@ -/** - * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: 1.0.2 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { XHR } from "./XHR" -import * as models from "../model/models" - -export class iccGroupApi { - host: string - headers: Array - fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise - - constructor( - host: string, - headers: any, - fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise - ) { - this.host = host - this.headers = Object.keys(headers).map(k => new XHR.Header(k, headers[k])) - this.fetchImpl = fetchImpl - } - - setHeaders(h: Array) { - this.headers = h - } - - handleError(e: XHR.Data) { - if (e.status == 401) throw Error("auth-failed") - else throw Error("api-error" + e.status) - } - - createGroup( - id: string, - name?: string, - password?: string, - body?: models.ReplicationDto - ): Promise { - let _body = null - _body = body - - const _url = - this.host + - "/group/{id}".replace("{id}", id + "") + - "?ts=" + - new Date().getTime() + - (name ? "&name=" + name : "") + - (password ? "&password=" + password : "") - let headers = this.headers - headers = headers - .filter(h => h.header !== "Content-Type") - .concat(new XHR.Header("Content-Type", "application/json")) - return XHR.sendCommand("POST", _url, headers, _body, this.fetchImpl) - .then(doc => new models.GroupDto(doc.body as JSON)) - .catch(err => this.handleError(err)) - } -} diff --git a/icc-api/api/iccUserApi.ts b/icc-api/api/iccUserApi.ts index 5a8a4650..3c77326d 100644 --- a/icc-api/api/iccUserApi.ts +++ b/icc-api/api/iccUserApi.ts @@ -164,18 +164,6 @@ export class iccUserApi { .then(doc => new models.UserDto(doc.body as JSON)) .catch(err => this.handleError(err)) } - getMatchingUsers(): Promise | any> { - let _body = null - - const _url = this.host + "/user/matches" + "?ts=" + new Date().getTime() - let headers = this.headers - headers = headers - .filter(h => h.header !== "Content-Type") - .concat(new XHR.Header("Content-Type", "application/json")) - return XHR.sendCommand("GET", _url, headers, _body, this.fetchImpl) - .then(doc => (doc.body as Array).map(it => new models.UserDto(it))) - .catch(err => this.handleError(err)) - } getUser(userId: string): Promise { let _body = null diff --git a/icc-api/iccApi.ts b/icc-api/iccApi.ts index 788826c8..14b9ba8f 100644 --- a/icc-api/iccApi.ts +++ b/icc-api/iccApi.ts @@ -14,7 +14,6 @@ export * from "./api/iccCalendarItemApi" export * from "./api/iccCalendarItemTypeApi" export * from "./api/iccClassificationApi" export * from "./api/iccClassificationTemplateApi" -export * from "./api/iccClusterApi" export * from "./api/iccCodeApi" export * from "./api/iccContactApi" export * from "./api/iccDoctemplateApi" @@ -24,7 +23,6 @@ export * from "./api/iccEntitytemplateApi" export * from "./api/iccFormApi" export * from "./api/iccFrontendmigrationApi" export * from "./api/iccGenericApi" -export * from "./api/iccGroupApi" export * from "./api/iccHcpartyApi" export * from "./api/iccHelementApi" export * from "./api/iccIcureApi" diff --git a/icc-api/model/AccessLogDto.ts b/icc-api/model/AccessLogDto.ts index 888c665a..ddab5bd2 100644 --- a/icc-api/model/AccessLogDto.ts +++ b/icc-api/model/AccessLogDto.ts @@ -64,6 +64,8 @@ export class AccessLogDto { date?: number + patientId?: string + objectId?: string user?: string diff --git a/icc-api/model/CareMemberDto.ts b/icc-api/model/CareMemberDto.ts deleted file mode 100644 index fcafd57a..00000000 --- a/icc-api/model/CareMemberDto.ts +++ /dev/null @@ -1,34 +0,0 @@ -/** - * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: 1.0.2 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import * as models from "./models" - -export class CareMemberDto { - constructor(json: JSON | any) { - Object.assign(this as CareMemberDto, json) - } - healthcarePartyId?: string - - quality?: models.CodeStub -} diff --git a/icc-api/model/GroupDto.ts b/icc-api/model/GroupDto.ts deleted file mode 100644 index d051266d..00000000 --- a/icc-api/model/GroupDto.ts +++ /dev/null @@ -1,50 +0,0 @@ -/** - * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: 1.0.2 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import * as models from "./models" - -export class GroupDto { - constructor(json: JSON | any) { - Object.assign(this as GroupDto, json) - } - name?: string - - password?: string - - attachments?: { [key: string]: models.Attachment } - - deleted?: number - - id?: string - - rev?: string - - revsInfo?: Array - - conflicts?: Array - - javaType?: string - - revHistory?: { [key: string]: string } -} diff --git a/icc-api/model/ImportResultDto.ts b/icc-api/model/ImportResultDto.ts index 8c7bcc32..9ea5f582 100644 --- a/icc-api/model/ImportResultDto.ts +++ b/icc-api/model/ImportResultDto.ts @@ -43,4 +43,6 @@ export class ImportResultDto { hcps?: Array documents?: Array + + attachments?: { [key: string]: models.Attachment } } diff --git a/icc-api/model/InvoiceDto.ts b/icc-api/model/InvoiceDto.ts index 9a30043f..b96a0997 100644 --- a/icc-api/model/InvoiceDto.ts +++ b/icc-api/model/InvoiceDto.ts @@ -159,6 +159,8 @@ export class InvoiceDto { receipts?: { [key: string]: string } idDocument?: models.IdentityDocumentReader + + options?: { [key: string]: string } } export namespace InvoiceDto { export enum PaymentTypeEnum { diff --git a/icc-api/model/MedicalLocationDto.ts b/icc-api/model/MedicalLocationDto.ts index 52e5e565..30dac492 100644 --- a/icc-api/model/MedicalLocationDto.ts +++ b/icc-api/model/MedicalLocationDto.ts @@ -54,5 +54,7 @@ export class MedicalLocationDto { agendaIds?: Array + options?: { [key: string]: string } + guardPost?: boolean } diff --git a/icc-api/model/ParagraphAgreementDto.ts b/icc-api/model/ParagraphAgreementDto.ts index c6b5cf11..c23a9961 100644 --- a/icc-api/model/ParagraphAgreementDto.ts +++ b/icc-api/model/ParagraphAgreementDto.ts @@ -72,9 +72,9 @@ export class ParagraphAgreementDto { documentId?: string - inTreatment?: boolean + canceled?: boolean accepted?: boolean - canceled?: boolean + inTreatment?: boolean } diff --git a/icc-api/model/models.ts b/icc-api/model/models.ts index 4ee13ec7..f114bf04 100644 --- a/icc-api/model/models.ts +++ b/icc-api/model/models.ts @@ -80,7 +80,6 @@ export * from "./Formula" export * from "./FrontEndMigrationDto" export * from "./FullTextSearchResult" export * from "./GalInfos" -export * from "./GroupDto" export * from "./HcPartyPaginatedList" export * from "./HealthElementDto" export * from "./HealthcarePartyDto" From c3b6d47f771190e5b3e69343ae1013bd1d6b6f70 Mon Sep 17 00:00:00 2001 From: Phil Mertens Date: Thu, 16 Apr 2020 10:24:22 +0200 Subject: [PATCH 49/75] Reset XHR changes --- icc-api/api/XHR.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/icc-api/api/XHR.ts b/icc-api/api/XHR.ts index 1c0bbfc2..b1571e26 100644 --- a/icc-api/api/XHR.ts +++ b/icc-api/api/XHR.ts @@ -103,7 +103,8 @@ export namespace XHR { } : {} ), - timeout + timeout, + fetchImpl ).then(function(response) { if (response.status >= 400) { throw new XHRError(response.statusText, response.status, response.status, response.headers) @@ -113,7 +114,9 @@ export namespace XHR { ? response.json() : ct.startsWith("application/xml") || ct.startsWith("text/") ? response.text() - : response.arrayBuffer() + : response.arrayBuffer + ? response.arrayBuffer() + : response.blob().then(blob => new Response(blob).arrayBuffer()) ).then(d => new Data(response.status, ct, d)) }) } From 63f027e5c3b01d546c91fd2d9ff64e1194c478e3 Mon Sep 17 00:00:00 2001 From: Phil Mertens Date: Thu, 16 Apr 2020 14:01:06 +0200 Subject: [PATCH 50/75] Re-instate icc-api/LICENSE --- icc-api/LICENSE | 201 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 201 insertions(+) create mode 100644 icc-api/LICENSE diff --git a/icc-api/LICENSE b/icc-api/LICENSE new file mode 100644 index 00000000..81830d3e --- /dev/null +++ b/icc-api/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file From 5393231637a302279ac989a3727c718ed229d71b Mon Sep 17 00:00:00 2001 From: Phil Mertens Date: Thu, 16 Apr 2020 14:04:38 +0200 Subject: [PATCH 51/75] Fix identation --- icc-api/LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/icc-api/LICENSE b/icc-api/LICENSE index 81830d3e..7f8889ba 100644 --- a/icc-api/LICENSE +++ b/icc-api/LICENSE @@ -1,4 +1,4 @@ - Apache License + Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ From cb49bbff40d2f5767dd97f2f60a35c623e62a9bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ce=CC=81dric=20Bamps?= Date: Thu, 16 Apr 2020 14:07:09 +0200 Subject: [PATCH 52/75] restore LICENSE as-is from master branch --- icc-api/LICENSE | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/icc-api/LICENSE b/icc-api/LICENSE index 7f8889ba..8dada3ed 100644 --- a/icc-api/LICENSE +++ b/icc-api/LICENSE @@ -1,4 +1,4 @@ - Apache License + Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -198,4 +198,4 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and - limitations under the License. \ No newline at end of file + limitations under the License. From c5f0d68fa632ca6be20d5c8bb94fb69e29718421 Mon Sep 17 00:00:00 2001 From: Phil Mertens Date: Wed, 29 Apr 2020 11:11:24 +0200 Subject: [PATCH 53/75] Add support for eHealth certificate date storing Cleaning Remove auto formatting Revert "Remove auto formatting " This reverts commit 2d099d953e279af0cee48df8c587a5e93410dce0. --- icc-x-api/icc-crypto-x-api.ts | 71 +++++++++++++++++++++++------------ 1 file changed, 46 insertions(+), 25 deletions(-) diff --git a/icc-x-api/icc-crypto-x-api.ts b/icc-x-api/icc-crypto-x-api.ts index b02025b6..ac21c328 100644 --- a/icc-x-api/icc-crypto-x-api.ts +++ b/icc-x-api/icc-crypto-x-api.ts @@ -99,8 +99,10 @@ export class IccCryptoXApi { ]).then(([a, b]) => Object.assign({}, a, b)) } - keychainLocalStoreIdPrefix: String = "org.taktik.icure.ehealth.keychain." + keychainLocalStoreIdPrefix = "org.taktik.icure.ehealth.keychain." + keychainValidityDateLocalStoreIdPrefix = "org.taktik.icure.ehealth.keychain-date." hcpPreferenceKeyEhealthCert: string = "eHealthCRT" + hcpPreferenceKeyEhealthCertDate = "eHealthCRTDate" private hcpartyBaseApi: iccHcpartyApi private patientBaseApi: iccPatientApi @@ -119,8 +121,8 @@ export class IccCryptoXApi { crypto: Crypto = typeof window !== "undefined" ? window.crypto : typeof self !== "undefined" - ? self.crypto - : ({} as Crypto) + ? self.crypto + : ({} as Crypto) ) { this.hcpartyBaseApi = hcpartyBaseApi this.patientBaseApi = patientBaseApi @@ -874,15 +876,15 @@ export class IccCryptoXApi { secretEncryptionKey ? this.appendEncryptionKeys(child, ownerId, delegateId, secretEncryptionKey).then( //TODO: extendedDelegationsAndCryptedForeignKeys and appendEncryptionKeys can be done in parallel - extendedChildObjectEKs => ({ - extendedSPKsAndCFKs: extendedChildObjectSPKsAndCFKs, - extendedEKs: extendedChildObjectEKs - }) - ) - : Promise.resolve({ + extendedChildObjectEKs => ({ extendedSPKsAndCFKs: extendedChildObjectSPKsAndCFKs, - extendedEKs: { encryptionKeys: {} } + extendedEKs: extendedChildObjectEKs }) + ) + : Promise.resolve({ + extendedSPKsAndCFKs: extendedChildObjectSPKsAndCFKs, + extendedEKs: { encryptionKeys: {} } + }) ) .then( ({ @@ -1133,12 +1135,12 @@ export class IccCryptoXApi { (hcp as HealthcarePartyDto).parentId ? this.extractKeysHierarchyFromDelegationLikes( (hcp as HealthcarePartyDto).parentId!, - objectId, - delegations - ).then(parentResponse => - parentResponse.concat({ extractedKeys: extractedKeys, hcpartyId: hcpartyId }) - ) - : [{ extractedKeys: extractedKeys, hcpartyId: hcpartyId }] + objectId, + delegations + ).then(parentResponse => + parentResponse.concat({ extractedKeys: extractedKeys, hcpartyId: hcpartyId }) + ) + : [{ extractedKeys: extractedKeys, hcpartyId: hcpartyId }] ) ) } @@ -1183,14 +1185,14 @@ export class IccCryptoXApi { (hcp as HealthcarePartyDto).parentId ? this.extractKeysFromDelegationsForHcpHierarchy( (hcp as HealthcarePartyDto).parentId!, - objectId, - delegations - ).then(parentResponse => - _.assign(parentResponse, { - extractedKeys: parentResponse.extractedKeys.concat(extractedKeys) - }) - ) - : { extractedKeys: extractedKeys, hcpartyId: hcpartyId } + objectId, + delegations + ).then(parentResponse => + _.assign(parentResponse, { + extractedKeys: parentResponse.extractedKeys.concat(extractedKeys) + }) + ) + : { extractedKeys: extractedKeys, hcpartyId: hcpartyId } ) ) } @@ -1334,6 +1336,14 @@ export class IccCryptoXApi { ) } + // noinspection JSUnusedGlobalSymbols + saveKeychainValidityDateInBrowserLocalStorage(id: string, date: number) { + localStorage.setItem( + this.keychainValidityDateLocalStoreIdPrefix + id, + date.toString() || undefined + ) + } + saveKeychainInBrowserLocalStorageAsBase64(id: string, keyChainB64: string) { localStorage.setItem(this.keychainLocalStoreIdPrefix + id, keyChainB64) } @@ -1342,9 +1352,16 @@ export class IccCryptoXApi { return this.hcpartyBaseApi .getHealthcareParty(hcpId) .then(hcp => { - const crt = this.getKeychainInBrowserLocalStorageAsBase64(hcp.id!!) const opts = hcp.options || {} + + const crt = this.getKeychainInBrowserLocalStorageAsBase64(hcp.id!!) _.set(opts, this.hcpPreferenceKeyEhealthCert, crt) + + const crtValidityDate = this.getKeychainValidityDateInBrowserLocalStorage(hcp.id!!) + if (opts[this.hcpPreferenceKeyEhealthCertDate] !== crtValidityDate) { + _.set(opts, this.hcpPreferenceKeyEhealthCertDate, crtValidityDate) + } + hcp.options = opts return hcp }) @@ -1392,6 +1409,10 @@ export class IccCryptoXApi { return localStorage.getItem(this.keychainLocalStoreIdPrefix + id) } + getKeychainValidityDateInBrowserLocalStorage(id: string): string { + return localStorage.getItem(this.keychainValidityDateLocalStoreIdPrefix + id) + } + // noinspection JSUnusedGlobalSymbols loadKeychainFromBrowserLocalStorage(id: String) { const lsItem = localStorage.getItem("org.taktik.icure.ehealth.keychain." + id) From 42389cd799a0a7e00ca0889d9408071c598c8dda Mon Sep 17 00:00:00 2001 From: Phil Mertens Date: Wed, 29 Apr 2020 11:11:54 +0200 Subject: [PATCH 54/75] Add encryptedSelf field on TypedValue (model and DTO) Update icc-api --- icc-api/model/Property.ts | 2 ++ icc-api/model/PropertyDto.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/icc-api/model/Property.ts b/icc-api/model/Property.ts index b32f5049..745aa3cb 100644 --- a/icc-api/model/Property.ts +++ b/icc-api/model/Property.ts @@ -32,6 +32,8 @@ export class Property { typedValue?: models.TypedValue + encryptedSelf?: string + attachments?: { [key: string]: models.Attachment } deleted?: number diff --git a/icc-api/model/PropertyDto.ts b/icc-api/model/PropertyDto.ts index 2f1fe8da..5b700376 100644 --- a/icc-api/model/PropertyDto.ts +++ b/icc-api/model/PropertyDto.ts @@ -37,4 +37,6 @@ export class PropertyDto { type?: models.PropertyTypeDto typedValue?: models.TypedValueDto + + encryptedSelf?: string } From 56a92af38490542d345eebb6ed81b2b7a707cd7d Mon Sep 17 00:00:00 2001 From: Phil Mertens Date: Wed, 29 Apr 2020 18:26:55 +0200 Subject: [PATCH 55/75] Cleaning --- icc-x-api/icc-crypto-x-api.ts | 53 +++++++++++++++++------------------ 1 file changed, 25 insertions(+), 28 deletions(-) diff --git a/icc-x-api/icc-crypto-x-api.ts b/icc-x-api/icc-crypto-x-api.ts index ac21c328..4a434728 100644 --- a/icc-x-api/icc-crypto-x-api.ts +++ b/icc-x-api/icc-crypto-x-api.ts @@ -121,8 +121,8 @@ export class IccCryptoXApi { crypto: Crypto = typeof window !== "undefined" ? window.crypto : typeof self !== "undefined" - ? self.crypto - : ({} as Crypto) + ? self.crypto + : ({} as Crypto) ) { this.hcpartyBaseApi = hcpartyBaseApi this.patientBaseApi = patientBaseApi @@ -876,15 +876,15 @@ export class IccCryptoXApi { secretEncryptionKey ? this.appendEncryptionKeys(child, ownerId, delegateId, secretEncryptionKey).then( //TODO: extendedDelegationsAndCryptedForeignKeys and appendEncryptionKeys can be done in parallel - extendedChildObjectEKs => ({ + extendedChildObjectEKs => ({ + extendedSPKsAndCFKs: extendedChildObjectSPKsAndCFKs, + extendedEKs: extendedChildObjectEKs + }) + ) + : Promise.resolve({ extendedSPKsAndCFKs: extendedChildObjectSPKsAndCFKs, - extendedEKs: extendedChildObjectEKs + extendedEKs: { encryptionKeys: {} } }) - ) - : Promise.resolve({ - extendedSPKsAndCFKs: extendedChildObjectSPKsAndCFKs, - extendedEKs: { encryptionKeys: {} } - }) ) .then( ({ @@ -1135,12 +1135,12 @@ export class IccCryptoXApi { (hcp as HealthcarePartyDto).parentId ? this.extractKeysHierarchyFromDelegationLikes( (hcp as HealthcarePartyDto).parentId!, - objectId, - delegations - ).then(parentResponse => - parentResponse.concat({ extractedKeys: extractedKeys, hcpartyId: hcpartyId }) - ) - : [{ extractedKeys: extractedKeys, hcpartyId: hcpartyId }] + objectId, + delegations + ).then(parentResponse => + parentResponse.concat({ extractedKeys: extractedKeys, hcpartyId: hcpartyId }) + ) + : [{ extractedKeys: extractedKeys, hcpartyId: hcpartyId }] ) ) } @@ -1185,14 +1185,14 @@ export class IccCryptoXApi { (hcp as HealthcarePartyDto).parentId ? this.extractKeysFromDelegationsForHcpHierarchy( (hcp as HealthcarePartyDto).parentId!, - objectId, - delegations - ).then(parentResponse => - _.assign(parentResponse, { - extractedKeys: parentResponse.extractedKeys.concat(extractedKeys) - }) - ) - : { extractedKeys: extractedKeys, hcpartyId: hcpartyId } + objectId, + delegations + ).then(parentResponse => + _.assign(parentResponse, { + extractedKeys: parentResponse.extractedKeys.concat(extractedKeys) + }) + ) + : { extractedKeys: extractedKeys, hcpartyId: hcpartyId } ) ) } @@ -1338,10 +1338,7 @@ export class IccCryptoXApi { // noinspection JSUnusedGlobalSymbols saveKeychainValidityDateInBrowserLocalStorage(id: string, date: number) { - localStorage.setItem( - this.keychainValidityDateLocalStoreIdPrefix + id, - date.toString() || undefined - ) + localStorage.setItem(this.keychainValidityDateLocalStoreIdPrefix + id, date.toString()) } saveKeychainInBrowserLocalStorageAsBase64(id: string, keyChainB64: string) { @@ -1409,7 +1406,7 @@ export class IccCryptoXApi { return localStorage.getItem(this.keychainLocalStoreIdPrefix + id) } - getKeychainValidityDateInBrowserLocalStorage(id: string): string { + getKeychainValidityDateInBrowserLocalStorage(id: string) { return localStorage.getItem(this.keychainValidityDateLocalStoreIdPrefix + id) } From 57cb2bd5ce14261303dd3b8223cc7ac6aac2ea2b Mon Sep 17 00:00:00 2001 From: alina-meyvn Date: Fri, 1 May 2020 20:37:05 +0300 Subject: [PATCH 56/75] MS-3554 - Fix access journal: no patient name in the access logs The reason why there was no patient name in the access logs is because no patient id was set in AccessLogDto object used to save the logs --- icc-x-api/icc-accesslog-x-api.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/icc-x-api/icc-accesslog-x-api.ts b/icc-x-api/icc-accesslog-x-api.ts index b53b3a6d..2ce1d663 100644 --- a/icc-x-api/icc-accesslog-x-api.ts +++ b/icc-x-api/icc-accesslog-x-api.ts @@ -42,7 +42,8 @@ export class IccAccesslogXApi extends iccAccesslogApi { codes: [], tags: [], user: user.id, - accessType: "USER_ACCESS" + accessType: "USER_ACCESS", + patientId: patient.id }, h || {} ) From 987560fba0b548d9580b09501a9228552100a8fc Mon Sep 17 00:00:00 2001 From: Phil Mertens Date: Thu, 7 May 2020 08:13:04 +0200 Subject: [PATCH 57/75] Cleaning --- icc-x-api/icc-crypto-x-api.ts | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/icc-x-api/icc-crypto-x-api.ts b/icc-x-api/icc-crypto-x-api.ts index 4a434728..b56b9e7e 100644 --- a/icc-x-api/icc-crypto-x-api.ts +++ b/icc-x-api/icc-crypto-x-api.ts @@ -101,7 +101,7 @@ export class IccCryptoXApi { keychainLocalStoreIdPrefix = "org.taktik.icure.ehealth.keychain." keychainValidityDateLocalStoreIdPrefix = "org.taktik.icure.ehealth.keychain-date." - hcpPreferenceKeyEhealthCert: string = "eHealthCRT" + hcpPreferenceKeyEhealthCert = "eHealthCRT" hcpPreferenceKeyEhealthCertDate = "eHealthCRTDate" private hcpartyBaseApi: iccHcpartyApi @@ -1337,12 +1337,25 @@ export class IccCryptoXApi { } // noinspection JSUnusedGlobalSymbols - saveKeychainValidityDateInBrowserLocalStorage(id: string, date: number) { - localStorage.setItem(this.keychainValidityDateLocalStoreIdPrefix + id, date.toString()) + saveKeychainValidityDateInBrowserLocalStorage(id: string, date: string) { + if (!id) return + + if (!date) { + localStorage.removeItem(this.keychainValidityDateLocalStoreIdPrefix + id) + } else { + localStorage.setItem(this.keychainValidityDateLocalStoreIdPrefix + id, date) + } } + // noinspection JSUnusedGlobalSymbols saveKeychainInBrowserLocalStorageAsBase64(id: string, keyChainB64: string) { - localStorage.setItem(this.keychainLocalStoreIdPrefix + id, keyChainB64) + if (!id) return + + if (!keyChainB64) { + localStorage.removeItem(this.keychainLocalStoreIdPrefix + id) + } else { + localStorage.setItem(this.keychainLocalStoreIdPrefix + id, keyChainB64) + } } saveKeyChainInHCPFromLocalStorage(hcpId: string): Promise { @@ -1355,7 +1368,7 @@ export class IccCryptoXApi { _.set(opts, this.hcpPreferenceKeyEhealthCert, crt) const crtValidityDate = this.getKeychainValidityDateInBrowserLocalStorage(hcp.id!!) - if (opts[this.hcpPreferenceKeyEhealthCertDate] !== crtValidityDate) { + if (!!crtValidityDate) { _.set(opts, this.hcpPreferenceKeyEhealthCertDate, crtValidityDate) } @@ -1370,9 +1383,14 @@ export class IccCryptoXApi { importKeychainInBrowserFromHCP(hcpId: string): Promise { return this.hcpartyBaseApi.getHealthcareParty(hcpId).then(hcp => { const crt = _.get(hcp.options, this.hcpPreferenceKeyEhealthCert) + const crtValidityDate = _.get(hcp.options, this.hcpPreferenceKeyEhealthCertDate) if (crt) { this.saveKeychainInBrowserLocalStorageAsBase64(hcp.id!!, crt) } + + if (crtValidityDate) { + this.saveKeychainValidityDateInBrowserLocalStorage(hcp.id!!, crtValidityDate) + } }) } From db5aa784d9ec3b0cfb2080397ba0d7bc4dc44ff5 Mon Sep 17 00:00:00 2001 From: Phil Mertens Date: Fri, 8 May 2020 08:24:52 +0200 Subject: [PATCH 58/75] Encode icure ids in message api query params --- icc-api/api/iccMessageApi.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/icc-api/api/iccMessageApi.ts b/icc-api/api/iccMessageApi.ts index 226f925e..6d44c14d 100644 --- a/icc-api/api/iccMessageApi.ts +++ b/icc-api/api/iccMessageApi.ts @@ -165,9 +165,9 @@ export class iccMessageApi { new Date().getTime() + (fromAddress ? "&fromAddress=" + fromAddress : "") + (startKey ? "&startKey=" + startKey : "") + - (startDocumentId ? "&startDocumentId=" + startDocumentId : "") + + (startDocumentId ? "&startDocumentId=" + encodeURIComponent(startDocumentId) : "") + (limit ? "&limit=" + limit : "") + - (hcpId ? "&hcpId=" + hcpId : "") + (hcpId ? "&hcpId=" + encodeURIComponent(hcpId) : "") let headers = this.headers headers = headers .filter(h => h.header !== "Content-Type") @@ -193,10 +193,10 @@ export class iccMessageApi { new Date().getTime() + (toAddress ? "&toAddress=" + toAddress : "") + (startKey ? "&startKey=" + startKey : "") + - (startDocumentId ? "&startDocumentId=" + startDocumentId : "") + + (startDocumentId ? "&startDocumentId=" + encodeURIComponent(startDocumentId) : "") + (limit ? "&limit=" + limit : "") + (reverse ? "&reverse=" + reverse : "") + - (hcpId ? "&hcpId=" + hcpId : "") + (hcpId ? "&hcpId=" + encodeURIComponent(hcpId) : "") let headers = this.headers headers = headers .filter(h => h.header !== "Content-Type") @@ -223,9 +223,9 @@ export class iccMessageApi { (transportGuid ? "&transportGuid=" + transportGuid : "") + (received ? "&received=" + received : "") + (startKey ? "&startKey=" + startKey : "") + - (startDocumentId ? "&startDocumentId=" + startDocumentId : "") + + (startDocumentId ? "&startDocumentId=" + encodeURIComponent(startDocumentId) : "") + (limit ? "&limit=" + limit : "") + - (hcpId ? "&hcpId=" + hcpId : "") + (hcpId ? "&hcpId=" + encodeURIComponent(hcpId) : "") let headers = this.headers headers = headers .filter(h => h.header !== "Content-Type") @@ -254,9 +254,9 @@ export class iccMessageApi { (from ? "&from=" + from : "") + (to ? "&to=" + to : "") + (startKey ? "&startKey=" + startKey : "") + - (startDocumentId ? "&startDocumentId=" + startDocumentId : "") + + (startDocumentId ? "&startDocumentId=" + encodeURIComponent(startDocumentId) : "") + (limit ? "&limit=" + limit : "") + - (hcpId ? "&hcpId=" + hcpId : "") + (hcpId ? "&hcpId=" + encodeURIComponent(hcpId) : "") let headers = this.headers headers = headers .filter(h => h.header !== "Content-Type") From 1bac76a7eaf3374132db1998c2c8dc5dc8dc4a9c Mon Sep 17 00:00:00 2001 From: Alan Morano Date: Thu, 21 May 2020 17:07:04 +0800 Subject: [PATCH 59/75] MS-3054 --- icc-x-api/icc-doctemplate-x-api.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/icc-x-api/icc-doctemplate-x-api.ts b/icc-x-api/icc-doctemplate-x-api.ts index 92bf321f..8a0ca30e 100644 --- a/icc-x-api/icc-doctemplate-x-api.ts +++ b/icc-x-api/icc-doctemplate-x-api.ts @@ -94,7 +94,8 @@ export class IccDoctemplateXApi extends iccDoctemplateApi { return enc.decode(arr) } else if ( doc.contentType.startsWith("text/plain") || - doc.contentType.startsWith("text/html") + doc.contentType.startsWith("text/html") || + doc.contentType.startsWith("text/xml") ) { return doc.body } else { From 5ef70f7bedb8ad3aca4121b352e1d175d519826a Mon Sep 17 00:00:00 2001 From: Dylan Friedrich Date: Wed, 22 Jul 2020 10:49:39 +0200 Subject: [PATCH 60/75] feat/MS-549_Add function to delete magistral --- icc-api/api/iccEntitytemplateApi.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/icc-api/api/iccEntitytemplateApi.ts b/icc-api/api/iccEntitytemplateApi.ts index 1dc3c052..38d57d89 100644 --- a/icc-api/api/iccEntitytemplateApi.ts +++ b/icc-api/api/iccEntitytemplateApi.ts @@ -62,6 +62,27 @@ export class iccEntitytemplateApi { .then(doc => new models.EntityTemplateDto(doc.body as JSON)) .catch(err => this.handleError(err)) } + + deleteEntityTemplate(entityTemplateIds: string): Promise { + let _body = null + + const _url = + this.host + + "/entityTemplate/{entityTemplateIds}".replace( + "{entityTemplateIds}", + entityTemplateIds + "" + ) + + "?ts=" + + new Date().getTime() + let headers = this.headers + headers = headers + .filter(h => h.header !== "Content-Type") + .concat(new XHR.Header("Content-Type", "application/json")) + return XHR.sendCommand("DELETE", _url, headers, _body, this.fetchImpl) + .then(doc => new models.DocumentDto(doc.body as JSON)) + .catch(err => this.handleError(err)) + } + findAllEntityTemplates( type: string, searchString?: string, From f37c1326583237037bf13c4cb42bdc4619146cd4 Mon Sep 17 00:00:00 2001 From: Dylan Friedrich Date: Wed, 22 Jul 2020 16:33:35 +0200 Subject: [PATCH 61/75] feat/MS-549_Corrected the function return type --- icc-api/api/iccEntitytemplateApi.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/icc-api/api/iccEntitytemplateApi.ts b/icc-api/api/iccEntitytemplateApi.ts index 38d57d89..686dafaa 100644 --- a/icc-api/api/iccEntitytemplateApi.ts +++ b/icc-api/api/iccEntitytemplateApi.ts @@ -63,12 +63,12 @@ export class iccEntitytemplateApi { .catch(err => this.handleError(err)) } - deleteEntityTemplate(entityTemplateIds: string): Promise { + deleteEntityTemplate(entityTemplateIds: string): Promise { let _body = null const _url = this.host + - "/entityTemplate/{entityTemplateIds}".replace( + "/entitytemplate/{entityTemplateIds}".replace( "{entityTemplateIds}", entityTemplateIds + "" ) + @@ -79,7 +79,6 @@ export class iccEntitytemplateApi { .filter(h => h.header !== "Content-Type") .concat(new XHR.Header("Content-Type", "application/json")) return XHR.sendCommand("DELETE", _url, headers, _body, this.fetchImpl) - .then(doc => new models.DocumentDto(doc.body as JSON)) .catch(err => this.handleError(err)) } From c5dcff2bbc7543a16977d8f4abf4a491c41c12da Mon Sep 17 00:00:00 2001 From: Phil Mertens Date: Mon, 3 Aug 2020 16:29:42 +0200 Subject: [PATCH 62/75] Add indexation warmup update update to updateDesignDoc --- icc-api/api/iccIcureApi.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/icc-api/api/iccIcureApi.ts b/icc-api/api/iccIcureApi.ts index 7bf48bc7..8726a7bd 100644 --- a/icc-api/api/iccIcureApi.ts +++ b/icc-api/api/iccIcureApi.ts @@ -238,14 +238,15 @@ export class iccIcureApi { .then(doc => true) .catch(err => this.handleError(err)) } - updateDesignDoc(entityName: string): Promise { + updateDesignDoc(entityName: string, warmup = false): Promise { let _body = null const _url = this.host + "/icure/dd/{entityName}".replace("{entityName}", entityName + "") + "?ts=" + - new Date().getTime() + new Date().getTime() + + (!!warmup ? "&warmup=" + "true" : "false") let headers = this.headers headers = headers .filter(h => h.header !== "Content-Type") From 5542dbb37a5bba1b32c7559c99d72a662e9ad654 Mon Sep 17 00:00:00 2001 From: Joze Zobec Date: Thu, 6 Aug 2020 16:33:45 +0200 Subject: [PATCH 63/75] encrypt EH Certificate --- icc-x-api/icc-crypto-x-api.ts | 233 ++++++++++++++++++++++++---------- 1 file changed, 163 insertions(+), 70 deletions(-) diff --git a/icc-x-api/icc-crypto-x-api.ts b/icc-x-api/icc-crypto-x-api.ts index b56b9e7e..3558ad38 100644 --- a/icc-x-api/icc-crypto-x-api.ts +++ b/icc-x-api/icc-crypto-x-api.ts @@ -1,12 +1,11 @@ -import { iccHcpartyApi, iccPatientApi } from "../icc-api/iccApi" -import { AES, AESUtils } from "./crypto/AES" -import { RSA, RSAUtils } from "./crypto/RSA" -import { utils, UtilsClass } from "./crypto/utils" -import { shamir, ShamirClass } from "./crypto/shamir" - import * as _ from "lodash" +import { iccHcpartyApi, iccPatientApi } from "../icc-api/iccApi" import * as models from "../icc-api/model/models" import { DelegationDto, HealthcarePartyDto, PatientDto } from "../icc-api/model/models" +import { AESUtils } from "./crypto/AES" +import { RSAUtils } from "./crypto/RSA" +import { ShamirClass } from "./crypto/shamir" +import { utils, UtilsClass } from "./crypto/utils" export class IccCryptoXApi { get shamir(): ShamirClass { @@ -102,7 +101,9 @@ export class IccCryptoXApi { keychainLocalStoreIdPrefix = "org.taktik.icure.ehealth.keychain." keychainValidityDateLocalStoreIdPrefix = "org.taktik.icure.ehealth.keychain-date." hcpPreferenceKeyEhealthCert = "eHealthCRT" + hcpPreferenceKeyEhealthCertEncrypted = "eHealthCRT_encrypted" hcpPreferenceKeyEhealthCertDate = "eHealthCRTDate" + hcpPreferenceKeyEhealthCertDateEncrypted = "eHealthCRTDate_encrypted" private hcpartyBaseApi: iccHcpartyApi private patientBaseApi: iccPatientApi @@ -121,8 +122,8 @@ export class IccCryptoXApi { crypto: Crypto = typeof window !== "undefined" ? window.crypto : typeof self !== "undefined" - ? self.crypto - : ({} as Crypto) + ? self.crypto + : ({} as Crypto) ) { this.hcpartyBaseApi = hcpartyBaseApi this.patientBaseApi = patientBaseApi @@ -343,11 +344,10 @@ export class IccCryptoXApi { delegatorIds[delegationItem.owner!] = true //TODO: why is set to true? }) } else if (fallbackOnParent) { - return this.getHcpOrPatient(healthcarePartyId).then( - hcp => - (hcp as any).parentId - ? this.decryptAndImportAesHcPartyKeysInDelegations((hcp as any).parentId, delegations) - : Promise.resolve([]) + return this.getHcpOrPatient(healthcarePartyId).then(hcp => + (hcp as any).parentId + ? this.decryptAndImportAesHcPartyKeysInDelegations((hcp as any).parentId, delegations) + : Promise.resolve([]) ) } @@ -517,9 +517,7 @@ export class IccCryptoXApi { .decrypt(importedAESHcPartyKey.key, this._utils.hex2ua(d.key)) .catch(() => { console.log( - `Cannot decrypt delegation from ${d.owner} to ${ - d.delegatedTo - } for object with id ${modifiedObject.id}:`, + `Cannot decrypt delegation from ${d.owner} to ${d.delegatedTo} for object with id ${modifiedObject.id}:`, modifiedObject ) return null @@ -535,9 +533,7 @@ export class IccCryptoXApi { .decrypt(importedAESHcPartyKey.key, this._utils.hex2ua(d.key)) .catch(() => { console.log( - `Cannot decrypt cryptedForeignKeys from ${d.owner} to ${ - d.delegatedTo - } for object with id ${modifiedObject.id}:`, + `Cannot decrypt cryptedForeignKeys from ${d.owner} to ${d.delegatedTo} for object with id ${modifiedObject.id}:`, modifiedObject ) return null @@ -741,9 +737,7 @@ export class IccCryptoXApi { d.owner === ownerId && this._AES.decrypt(decryptedHcPartyKey.key, this._utils.hex2ua(d.key)).catch(() => { console.log( - `Cannot decrypt encryption key from ${d.owner} to ${ - d.delegatedTo - } for object with id ${modifiedObject.id}:`, + `Cannot decrypt encryption key from ${d.owner} to ${d.delegatedTo} for object with id ${modifiedObject.id}:`, modifiedObject ) return null @@ -871,20 +865,19 @@ export class IccCryptoXApi { ) : Promise.resolve({ delegations: {}, cryptedForeignKeys: {} }) ) - .then( - extendedChildObjectSPKsAndCFKs => - secretEncryptionKey - ? this.appendEncryptionKeys(child, ownerId, delegateId, secretEncryptionKey).then( - //TODO: extendedDelegationsAndCryptedForeignKeys and appendEncryptionKeys can be done in parallel - extendedChildObjectEKs => ({ - extendedSPKsAndCFKs: extendedChildObjectSPKsAndCFKs, - extendedEKs: extendedChildObjectEKs - }) - ) - : Promise.resolve({ + .then(extendedChildObjectSPKsAndCFKs => + secretEncryptionKey + ? this.appendEncryptionKeys(child, ownerId, delegateId, secretEncryptionKey).then( + //TODO: extendedDelegationsAndCryptedForeignKeys and appendEncryptionKeys can be done in parallel + extendedChildObjectEKs => ({ extendedSPKsAndCFKs: extendedChildObjectSPKsAndCFKs, - extendedEKs: { encryptionKeys: {} } + extendedEKs: extendedChildObjectEKs }) + ) + : Promise.resolve({ + extendedSPKsAndCFKs: extendedChildObjectSPKsAndCFKs, + extendedEKs: { encryptionKeys: {} } + }) ) .then( ({ @@ -1130,17 +1123,16 @@ export class IccCryptoXApi { } ) : Promise.resolve([]) - ).then( - extractedKeys => - (hcp as HealthcarePartyDto).parentId - ? this.extractKeysHierarchyFromDelegationLikes( - (hcp as HealthcarePartyDto).parentId!, - objectId, - delegations - ).then(parentResponse => - parentResponse.concat({ extractedKeys: extractedKeys, hcpartyId: hcpartyId }) - ) - : [{ extractedKeys: extractedKeys, hcpartyId: hcpartyId }] + ).then(extractedKeys => + (hcp as HealthcarePartyDto).parentId + ? this.extractKeysHierarchyFromDelegationLikes( + (hcp as HealthcarePartyDto).parentId!, + objectId, + delegations + ).then(parentResponse => + parentResponse.concat({ extractedKeys: extractedKeys, hcpartyId: hcpartyId }) + ) + : [{ extractedKeys: extractedKeys, hcpartyId: hcpartyId }] ) ) } @@ -1180,19 +1172,18 @@ export class IccCryptoXApi { } ) : Promise.resolve([]) - ).then( - extractedKeys => - (hcp as HealthcarePartyDto).parentId - ? this.extractKeysFromDelegationsForHcpHierarchy( - (hcp as HealthcarePartyDto).parentId!, - objectId, - delegations - ).then(parentResponse => - _.assign(parentResponse, { - extractedKeys: parentResponse.extractedKeys.concat(extractedKeys) - }) - ) - : { extractedKeys: extractedKeys, hcpartyId: hcpartyId } + ).then(extractedKeys => + (hcp as HealthcarePartyDto).parentId + ? this.extractKeysFromDelegationsForHcpHierarchy( + (hcp as HealthcarePartyDto).parentId!, + objectId, + delegations + ).then(parentResponse => + _.assign(parentResponse, { + extractedKeys: parentResponse.extractedKeys.concat(extractedKeys) + }) + ) + : { extractedKeys: extractedKeys, hcpartyId: hcpartyId } ) ) } @@ -1253,9 +1244,7 @@ export class IccCryptoXApi { }) .catch(err => { console.log( - `Could not decrypt generic delegation in object with ID: ${masterId} from ${ - genericDelegationItem.owner - } to ${genericDelegationItem.delegatedTo}: ${err}` + `Could not decrypt generic delegation in object with ID: ${masterId} from ${genericDelegationItem.owner} to ${genericDelegationItem.delegatedTo}: ${err}` ) return undefined }) @@ -1361,15 +1350,62 @@ export class IccCryptoXApi { saveKeyChainInHCPFromLocalStorage(hcpId: string): Promise { return this.hcpartyBaseApi .getHealthcareParty(hcpId) - .then(hcp => { + .then(async (hcp: HealthcarePartyDto) => { + let encryptionKey = null + try { + encryptionKey = _.find( + await this.decryptAndImportAesHcPartyKeysForDelegators([hcp.id!], hcp.id!), + delegator => delegator.delegatorId === hcp.id + )!.key + } catch (e) { + console.error("Error while importing the AES key.") + } + if (!encryptionKey) { + console.error("No encryption key!") + } + const opts = hcp.options || {} const crt = this.getKeychainInBrowserLocalStorageAsBase64(hcp.id!!) _.set(opts, this.hcpPreferenceKeyEhealthCert, crt) + if (!!encryptionKey && !!crt) { + let crtEncrypted: ArrayBuffer | null = null + try { + crtEncrypted = await this.AES.encrypt( + encryptionKey, + new Uint8Array(utils.text2ua(atob(crt))) + ) + } catch (e) { + console.error("Error while encrypting the certificate", e) + } + _.set( + opts, + this.hcpPreferenceKeyEhealthCertEncrypted, + utils.ua2text(new Uint8Array(crtEncrypted!)) + ) + } + const crtValidityDate = this.getKeychainValidityDateInBrowserLocalStorage(hcp.id!!) if (!!crtValidityDate) { _.set(opts, this.hcpPreferenceKeyEhealthCertDate, crtValidityDate) + + if (!!encryptionKey) { + let crtValidityDateEncrypted: ArrayBuffer | null = null + try { + crtValidityDateEncrypted = await this.AES.encrypt( + encryptionKey, + utils.hex2ua(utils.text2hex(crtValidityDate)) + ) + } catch (e) { + console.error("Error while encrypting the certificate date", e) + } + _.set( + opts, + this.hcpPreferenceKeyEhealthCertDateEncrypted, + utils.ua2text(new Uint8Array(crtValidityDateEncrypted!)) + ) + } } hcp.options = opts @@ -1381,16 +1417,73 @@ export class IccCryptoXApi { } importKeychainInBrowserFromHCP(hcpId: string): Promise { - return this.hcpartyBaseApi.getHealthcareParty(hcpId).then(hcp => { - const crt = _.get(hcp.options, this.hcpPreferenceKeyEhealthCert) - const crtValidityDate = _.get(hcp.options, this.hcpPreferenceKeyEhealthCertDate) - if (crt) { - this.saveKeychainInBrowserLocalStorageAsBase64(hcp.id!!, crt) + return this.hcpartyBaseApi.getHealthcareParty(hcpId).then(async hcp => { + const crtCryp: ArrayBuffer = _.get(hcp.options, this.hcpPreferenceKeyEhealthCertEncrypted) + const crtValidityDateCryp: ArrayBuffer = _.get( + hcp.options, + this.hcpPreferenceKeyEhealthCertDateEncrypted + ) + + let crt: ArrayBuffer | null = null + let crtValidityDate: ArrayBuffer | null = null + + let decryptionKey: CryptoKey | null = null + try { + decryptionKey = _.find( + await this.decryptAndImportAesHcPartyKeysForDelegators([hcp.id!], hcp.id!), + delegator => delegator.delegatorId === hcp.id + )!.key + } catch (e) { + console.error("Error while importing the AES key.") } + if (!decryptionKey) { + console.error("No encryption key!") + } + + const errors = [] - if (crtValidityDate) { - this.saveKeychainValidityDateInBrowserLocalStorage(hcp.id!!, crtValidityDate) + if (crtCryp && decryptionKey) { + crt = await this.AES.decrypt( + decryptionKey, + new Uint8Array(utils.base64toArrayBuffer(btoa(utils.ua2text(new Uint8Array(crtCryp))))) + ) + } else { + crt = _.get(hcp.options, this.hcpPreferenceKeyEhealthCert) } + + if (!crt) { + errors.push( + new Error( + `Error while saving certificate in browser local storage! Hcp ${hcp.id} has no certificate.` + ) + ) + } else { + this.saveKeychainInBrowserLocalStorageAsBase64( + hcp.id!!, + utils.base64url(new Uint8Array(crt)) + ) + } + + if (crtValidityDateCryp && decryptionKey) { + crtValidityDate = await this.AES.decrypt(decryptionKey, new Uint8Array(crtValidityDateCryp)) + } else { + crtValidityDate = _.get(hcp.options, this.hcpPreferenceKeyEhealthCert) + } + + if (!crtValidityDate) { + errors.push( + new Error( + `Error while saving certificate validity date in browser local storage! Hcp ${hcp.id} has no certificate.` + ) + ) + } else { + this.saveKeychainValidityDateInBrowserLocalStorage( + hcp.id!!, + utils.hex2text(utils.ua2hex(crtValidityDate)) + ) + } + + return errors.length ? Promise.reject(errors) : Promise.resolve() }) } @@ -1400,7 +1493,7 @@ export class IccCryptoXApi { */ syncEhealthCertificate(hcpId: string): Promise { return this.hcpartyBaseApi.getHealthcareParty(hcpId).then(hcp => { - const crtHCP = _.get(hcp.options, this.hcpPreferenceKeyEhealthCert) + const crtHCP = _.get(hcp.options, this.hcpPreferenceKeyEhealthCertEncrypted) const crtLC = this.getKeychainInBrowserLocalStorageAsBase64(hcp.id!!) const xor_hcp_localstorage = !(crtHCP && crtLC) && (crtHCP || crtLC) From ab3e5151e43169f60613dd72939fb3665369262d Mon Sep 17 00:00:00 2001 From: Joze Zobec Date: Mon, 10 Aug 2020 10:59:59 +0200 Subject: [PATCH 64/75] minor changes to deal with caching --- icc-x-api/icc-crypto-x-api.ts | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/icc-x-api/icc-crypto-x-api.ts b/icc-x-api/icc-crypto-x-api.ts index 3558ad38..9528354c 100644 --- a/icc-x-api/icc-crypto-x-api.ts +++ b/icc-x-api/icc-crypto-x-api.ts @@ -1347,20 +1347,20 @@ export class IccCryptoXApi { } } - saveKeyChainInHCPFromLocalStorage(hcpId: string): Promise { - return this.hcpartyBaseApi + async saveKeyChainInHCPFromLocalStorage(hcpId: string): Promise { + return await this.hcpartyBaseApi .getHealthcareParty(hcpId) .then(async (hcp: HealthcarePartyDto) => { - let encryptionKey = null + let aesKey: CryptoKey | null = null try { - encryptionKey = _.find( + aesKey = _.find( await this.decryptAndImportAesHcPartyKeysForDelegators([hcp.id!], hcp.id!), delegator => delegator.delegatorId === hcp.id )!.key } catch (e) { console.error("Error while importing the AES key.") } - if (!encryptionKey) { + if (!aesKey) { console.error("No encryption key!") } @@ -1369,13 +1369,10 @@ export class IccCryptoXApi { const crt = this.getKeychainInBrowserLocalStorageAsBase64(hcp.id!!) _.set(opts, this.hcpPreferenceKeyEhealthCert, crt) - if (!!encryptionKey && !!crt) { + if (!!aesKey && !!crt) { let crtEncrypted: ArrayBuffer | null = null try { - crtEncrypted = await this.AES.encrypt( - encryptionKey, - new Uint8Array(utils.text2ua(atob(crt))) - ) + crtEncrypted = await this.AES.encrypt(aesKey, new Uint8Array(utils.text2ua(atob(crt)))) } catch (e) { console.error("Error while encrypting the certificate", e) } @@ -1390,11 +1387,11 @@ export class IccCryptoXApi { if (!!crtValidityDate) { _.set(opts, this.hcpPreferenceKeyEhealthCertDate, crtValidityDate) - if (!!encryptionKey) { + if (!!aesKey) { let crtValidityDateEncrypted: ArrayBuffer | null = null try { crtValidityDateEncrypted = await this.AES.encrypt( - encryptionKey, + aesKey, utils.hex2ua(utils.text2hex(crtValidityDate)) ) } catch (e) { @@ -1411,8 +1408,12 @@ export class IccCryptoXApi { hcp.options = opts return hcp }) - .then(hcp => { - return this.hcpartyBaseApi.modifyHealthcareParty(hcp) + .then(async hcp => { + return await this.hcpartyBaseApi.getHealthcareParty(hcp.id!).then(async fetchedHCP => { + return await this.hcpartyBaseApi.modifyHealthcareParty( + _.set(fetchedHCP, "options", hcp.options) + ) + }) }) } From 53cfb49f4b0b23f3d37fbd8032cfcadd633690b3 Mon Sep 17 00:00:00 2001 From: Joze Zobec Date: Mon, 10 Aug 2020 12:49:21 +0200 Subject: [PATCH 65/75] add a way to not make an update call using base hcp api service --- icc-x-api/icc-crypto-x-api.ts | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/icc-x-api/icc-crypto-x-api.ts b/icc-x-api/icc-crypto-x-api.ts index 9528354c..b53bdb47 100644 --- a/icc-x-api/icc-crypto-x-api.ts +++ b/icc-x-api/icc-crypto-x-api.ts @@ -1347,7 +1347,17 @@ export class IccCryptoXApi { } } - async saveKeyChainInHCPFromLocalStorage(hcpId: string): Promise { + /** + * Save eHealth certificate and validity in the encrypted fields of the HCP. + * @param hcpId Id of the hcp to modify + * @param autoupdateHCP update the HCP using the base HCP service; if false simply return the new HCP, + * without publishing the modifications on the db (this way this can be handled elsewhere e.g. by the + * HCP x api service, which makes use of caching). + */ + async saveKeyChainInHCPFromLocalStorage( + hcpId: string, + autoupdateHCP = true + ): Promise { return await this.hcpartyBaseApi .getHealthcareParty(hcpId) .then(async (hcp: HealthcarePartyDto) => { @@ -1409,11 +1419,11 @@ export class IccCryptoXApi { return hcp }) .then(async hcp => { - return await this.hcpartyBaseApi.getHealthcareParty(hcp.id!).then(async fetchedHCP => { - return await this.hcpartyBaseApi.modifyHealthcareParty( - _.set(fetchedHCP, "options", hcp.options) - ) - }) + if (autoupdateHCP) { + return await this.hcpartyBaseApi.modifyHealthcareParty(hcp) + } else { + return hcp + } }) } From ef3b39a5409560e8c77a31c532c95bbef262cdf2 Mon Sep 17 00:00:00 2001 From: Joze Zobec Date: Mon, 10 Aug 2020 14:34:44 +0200 Subject: [PATCH 66/75] leave the date unencrypted, do not publish modified HCP in crypto-api service --- icc-x-api/icc-crypto-x-api.ts | 89 +++++++++-------------------------- 1 file changed, 23 insertions(+), 66 deletions(-) diff --git a/icc-x-api/icc-crypto-x-api.ts b/icc-x-api/icc-crypto-x-api.ts index b53bdb47..2db89695 100644 --- a/icc-x-api/icc-crypto-x-api.ts +++ b/icc-x-api/icc-crypto-x-api.ts @@ -98,12 +98,16 @@ export class IccCryptoXApi { ]).then(([a, b]) => Object.assign({}, a, b)) } + /** + * @deprecated only encrypted version of the certificate should be stored, if this key is present, + * it and its value should be deleted from the hcp.options dict + */ + hcpPreferenceKeyEhealthCert = "eHealthCRT" + keychainLocalStoreIdPrefix = "org.taktik.icure.ehealth.keychain." keychainValidityDateLocalStoreIdPrefix = "org.taktik.icure.ehealth.keychain-date." - hcpPreferenceKeyEhealthCert = "eHealthCRT" hcpPreferenceKeyEhealthCertEncrypted = "eHealthCRT_encrypted" hcpPreferenceKeyEhealthCertDate = "eHealthCRTDate" - hcpPreferenceKeyEhealthCertDateEncrypted = "eHealthCRTDate_encrypted" private hcpartyBaseApi: iccHcpartyApi private patientBaseApi: iccPatientApi @@ -1348,16 +1352,12 @@ export class IccCryptoXApi { } /** - * Save eHealth certificate and validity in the encrypted fields of the HCP. + * Populate the HCP.options dict with an encrypted eHealth certificate and unencryped expiry date. + * Any potentially unencrypted certificates will be pruned from the HCP. * @param hcpId Id of the hcp to modify - * @param autoupdateHCP update the HCP using the base HCP service; if false simply return the new HCP, - * without publishing the modifications on the db (this way this can be handled elsewhere e.g. by the - * HCP x api service, which makes use of caching). + * @returns modified HCP, without publishing the modifications to the back-end */ - async saveKeyChainInHCPFromLocalStorage( - hcpId: string, - autoupdateHCP = true - ): Promise { + async saveKeyChainInHCPFromLocalStorage(hcpId: string): Promise { return await this.hcpartyBaseApi .getHealthcareParty(hcpId) .then(async (hcp: HealthcarePartyDto) => { @@ -1377,8 +1377,6 @@ export class IccCryptoXApi { const opts = hcp.options || {} const crt = this.getKeychainInBrowserLocalStorageAsBase64(hcp.id!!) - _.set(opts, this.hcpPreferenceKeyEhealthCert, crt) - if (!!aesKey && !!crt) { let crtEncrypted: ArrayBuffer | null = null try { @@ -1386,6 +1384,11 @@ export class IccCryptoXApi { } catch (e) { console.error("Error while encrypting the certificate", e) } + + // remove any unencrypted certificates, both key and value + delete opts[this.hcpPreferenceKeyEhealthCert] + + // add the encrypted certificate to the options _.set( opts, this.hcpPreferenceKeyEhealthCertEncrypted, @@ -1396,47 +1399,18 @@ export class IccCryptoXApi { const crtValidityDate = this.getKeychainValidityDateInBrowserLocalStorage(hcp.id!!) if (!!crtValidityDate) { _.set(opts, this.hcpPreferenceKeyEhealthCertDate, crtValidityDate) - - if (!!aesKey) { - let crtValidityDateEncrypted: ArrayBuffer | null = null - try { - crtValidityDateEncrypted = await this.AES.encrypt( - aesKey, - utils.hex2ua(utils.text2hex(crtValidityDate)) - ) - } catch (e) { - console.error("Error while encrypting the certificate date", e) - } - _.set( - opts, - this.hcpPreferenceKeyEhealthCertDateEncrypted, - utils.ua2text(new Uint8Array(crtValidityDateEncrypted!)) - ) - } } hcp.options = opts return hcp }) - .then(async hcp => { - if (autoupdateHCP) { - return await this.hcpartyBaseApi.modifyHealthcareParty(hcp) - } else { - return hcp - } - }) } importKeychainInBrowserFromHCP(hcpId: string): Promise { return this.hcpartyBaseApi.getHealthcareParty(hcpId).then(async hcp => { const crtCryp: ArrayBuffer = _.get(hcp.options, this.hcpPreferenceKeyEhealthCertEncrypted) - const crtValidityDateCryp: ArrayBuffer = _.get( - hcp.options, - this.hcpPreferenceKeyEhealthCertDateEncrypted - ) - + const crtValidityDate: ArrayBuffer = _.get(hcp.options, this.hcpPreferenceKeyEhealthCertDate) let crt: ArrayBuffer | null = null - let crtValidityDate: ArrayBuffer | null = null let decryptionKey: CryptoKey | null = null try { @@ -1451,7 +1425,7 @@ export class IccCryptoXApi { console.error("No encryption key!") } - const errors = [] + let error = null if (crtCryp && decryptionKey) { crt = await this.AES.decrypt( @@ -1463,10 +1437,8 @@ export class IccCryptoXApi { } if (!crt) { - errors.push( - new Error( - `Error while saving certificate in browser local storage! Hcp ${hcp.id} has no certificate.` - ) + error = new Error( + `Error while saving certificate in browser local storage! Hcp ${hcp.id} has no certificate.` ) } else { this.saveKeychainInBrowserLocalStorageAsBase64( @@ -1475,26 +1447,11 @@ export class IccCryptoXApi { ) } - if (crtValidityDateCryp && decryptionKey) { - crtValidityDate = await this.AES.decrypt(decryptionKey, new Uint8Array(crtValidityDateCryp)) - } else { - crtValidityDate = _.get(hcp.options, this.hcpPreferenceKeyEhealthCert) - } - - if (!crtValidityDate) { - errors.push( - new Error( - `Error while saving certificate validity date in browser local storage! Hcp ${hcp.id} has no certificate.` - ) - ) - } else { - this.saveKeychainValidityDateInBrowserLocalStorage( - hcp.id!!, - utils.hex2text(utils.ua2hex(crtValidityDate)) - ) + if (!!crtValidityDate) { + this.saveKeychainValidityDateInBrowserLocalStorage(hcp.id!!, utils.ua2text(crtValidityDate)) } - return errors.length ? Promise.reject(errors) : Promise.resolve() + return !!error ? Promise.reject(error) : Promise.resolve() }) } @@ -1534,7 +1491,7 @@ export class IccCryptoXApi { // noinspection JSUnusedGlobalSymbols loadKeychainFromBrowserLocalStorage(id: String) { - const lsItem = localStorage.getItem("org.taktik.icure.ehealth.keychain." + id) + const lsItem = localStorage.getItem(this.keychainLocalStoreIdPrefix + id) return lsItem !== null ? this._utils.base64toByteArray(lsItem) : null } From 00039cc2c453136df8768af09c6c731248be4e21 Mon Sep 17 00:00:00 2001 From: Joze Zobec Date: Mon, 10 Aug 2020 14:50:30 +0200 Subject: [PATCH 67/75] cleaning --- icc-x-api/icc-crypto-x-api.ts | 36 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/icc-x-api/icc-crypto-x-api.ts b/icc-x-api/icc-crypto-x-api.ts index 2db89695..f1ceab5a 100644 --- a/icc-x-api/icc-crypto-x-api.ts +++ b/icc-x-api/icc-crypto-x-api.ts @@ -1409,9 +1409,14 @@ export class IccCryptoXApi { importKeychainInBrowserFromHCP(hcpId: string): Promise { return this.hcpartyBaseApi.getHealthcareParty(hcpId).then(async hcp => { const crtCryp: ArrayBuffer = _.get(hcp.options, this.hcpPreferenceKeyEhealthCertEncrypted) - const crtValidityDate: ArrayBuffer = _.get(hcp.options, this.hcpPreferenceKeyEhealthCertDate) - let crt: ArrayBuffer | null = null + const crtValidityDate = _.get(hcp.options, this.hcpPreferenceKeyEhealthCertDate) + + // store the validity date + if (!!crtValidityDate) { + this.saveKeychainValidityDateInBrowserLocalStorage(hcp.id!!, crtValidityDate) + } + let crt: ArrayBuffer | null = null let decryptionKey: CryptoKey | null = null try { decryptionKey = _.find( @@ -1422,23 +1427,20 @@ export class IccCryptoXApi { console.error("Error while importing the AES key.") } if (!decryptionKey) { - console.error("No encryption key!") + return Promise.reject( + new Error("No encryption key! eHealth certificate cannot be decrypted.") + ) } - let error = null - - if (crtCryp && decryptionKey) { - crt = await this.AES.decrypt( - decryptionKey, - new Uint8Array(utils.base64toArrayBuffer(btoa(utils.ua2text(new Uint8Array(crtCryp))))) - ) - } else { - crt = _.get(hcp.options, this.hcpPreferenceKeyEhealthCert) + if (!!crtCryp && decryptionKey) { + crt = await this.AES.decrypt(decryptionKey, crtCryp) } if (!crt) { - error = new Error( - `Error while saving certificate in browser local storage! Hcp ${hcp.id} has no certificate.` + return Promise.reject( + new Error( + `Error while saving certificate in browser local storage! Hcp ${hcp.id} has no certificate.` + ) ) } else { this.saveKeychainInBrowserLocalStorageAsBase64( @@ -1447,11 +1449,7 @@ export class IccCryptoXApi { ) } - if (!!crtValidityDate) { - this.saveKeychainValidityDateInBrowserLocalStorage(hcp.id!!, utils.ua2text(crtValidityDate)) - } - - return !!error ? Promise.reject(error) : Promise.resolve() + return Promise.resolve() }) } From bb00d1d4cbebdc39277469a9923a78968b2d454f Mon Sep 17 00:00:00 2001 From: Joze Zobec Date: Mon, 10 Aug 2020 14:59:15 +0200 Subject: [PATCH 68/75] changed the encrypted certificate key to not include the underscore character --- icc-x-api/icc-crypto-x-api.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/icc-x-api/icc-crypto-x-api.ts b/icc-x-api/icc-crypto-x-api.ts index f1ceab5a..e72acad2 100644 --- a/icc-x-api/icc-crypto-x-api.ts +++ b/icc-x-api/icc-crypto-x-api.ts @@ -106,7 +106,7 @@ export class IccCryptoXApi { keychainLocalStoreIdPrefix = "org.taktik.icure.ehealth.keychain." keychainValidityDateLocalStoreIdPrefix = "org.taktik.icure.ehealth.keychain-date." - hcpPreferenceKeyEhealthCertEncrypted = "eHealthCRT_encrypted" + hcpPreferenceKeyEhealthCertEncrypted = "eHealthCRTCrypt" hcpPreferenceKeyEhealthCertDate = "eHealthCRTDate" private hcpartyBaseApi: iccHcpartyApi From 66dd181027b94de9cdb9c4599cfb65e39f8ccc22 Mon Sep 17 00:00:00 2001 From: Joze Zobec Date: Mon, 10 Aug 2020 15:13:19 +0200 Subject: [PATCH 69/75] add some useful comments --- icc-x-api/icc-crypto-x-api.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/icc-x-api/icc-crypto-x-api.ts b/icc-x-api/icc-crypto-x-api.ts index e72acad2..712d8a2b 100644 --- a/icc-x-api/icc-crypto-x-api.ts +++ b/icc-x-api/icc-crypto-x-api.ts @@ -1355,7 +1355,8 @@ export class IccCryptoXApi { * Populate the HCP.options dict with an encrypted eHealth certificate and unencryped expiry date. * Any potentially unencrypted certificates will be pruned from the HCP. * @param hcpId Id of the hcp to modify - * @returns modified HCP, without publishing the modifications to the back-end + * @returns modified HCP, without publishing the modifications to the back-end. To also publish + * the modifications, use the EhAuthenticationService#saveKeyChainInHCPFromLocalStorage */ async saveKeyChainInHCPFromLocalStorage(hcpId: string): Promise { return await this.hcpartyBaseApi From aa147afe83f3038c93c435bb53ff142923188795 Mon Sep 17 00:00:00 2001 From: jb Date: Mon, 17 Aug 2020 12:08:01 +0200 Subject: [PATCH 70/75] Rename function in camelCase and suppress redundant parameter --- icc-x-api/icc-message-x-api.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/icc-x-api/icc-message-x-api.ts b/icc-x-api/icc-message-x-api.ts index ec75af26..b39036df 100644 --- a/icc-x-api/icc-message-x-api.ts +++ b/icc-x-api/icc-message-x-api.ts @@ -30,7 +30,7 @@ import { uuidBase36Half } from "./utils/efact-util" import { timeEncode } from "./utils/formatting-util" -import { fhcEfactcontrollerApi, EfactSendResponse } from "fhc-api" +import { fhcEfactControllerApi, EfactSendResponse } from "fhc-api" import { utils } from "./crypto/utils" import { EfactMessage } from "fhc-api" import { @@ -1049,7 +1049,7 @@ export class IccMessageXApi extends iccMessageApi { xFHCKeystoreId: string, xFHCTokenId: string, xFHCPassPhrase: string, - efactApi: fhcEfactcontrollerApi, + efactApi: fhcEfactControllerApi, fhcServer: string | undefined = undefined, prefixer?: (fed: InsuranceDto, hcpId: string) => Promise, isConnectedAsPmg: boolean = false, @@ -1099,8 +1099,7 @@ export class IccMessageXApi extends iccMessageApi { xFHCKeystoreId, xFHCTokenId, xFHCPassPhrase, - batch, - isConnectedAsPmg + batch ) //.then(() => { throw "ERREUR FORCEE" }) .catch(err => { From b95aee54756fcbf1bf017b3e934f3720a40695ea Mon Sep 17 00:00:00 2001 From: Phil Mertens Date: Tue, 18 Aug 2020 10:16:20 +0200 Subject: [PATCH 71/75] Fix typing and Base64 format --- icc-x-api/icc-crypto-x-api.ts | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/icc-x-api/icc-crypto-x-api.ts b/icc-x-api/icc-crypto-x-api.ts index 712d8a2b..99200b39 100644 --- a/icc-x-api/icc-crypto-x-api.ts +++ b/icc-x-api/icc-crypto-x-api.ts @@ -1355,8 +1355,7 @@ export class IccCryptoXApi { * Populate the HCP.options dict with an encrypted eHealth certificate and unencryped expiry date. * Any potentially unencrypted certificates will be pruned from the HCP. * @param hcpId Id of the hcp to modify - * @returns modified HCP, without publishing the modifications to the back-end. To also publish - * the modifications, use the EhAuthenticationService#saveKeyChainInHCPFromLocalStorage + * @returns modified HCP */ async saveKeyChainInHCPFromLocalStorage(hcpId: string): Promise { return await this.hcpartyBaseApi @@ -1408,8 +1407,12 @@ export class IccCryptoXApi { } importKeychainInBrowserFromHCP(hcpId: string): Promise { - return this.hcpartyBaseApi.getHealthcareParty(hcpId).then(async hcp => { - const crtCryp: ArrayBuffer = _.get(hcp.options, this.hcpPreferenceKeyEhealthCertEncrypted) + return this.hcpartyBaseApi.getHealthcareParty(hcpId).then(async (hcp: HealthcarePartyDto) => { + let crtCryp: Uint8Array | null = null; + if (!!hcp.options && !!hcp.options[this.hcpPreferenceKeyEhealthCertEncrypted]) { + crtCryp = this.utils.text2ua(hcp.options[this.hcpPreferenceKeyEhealthCertEncrypted]); + } + const crtValidityDate = _.get(hcp.options, this.hcpPreferenceKeyEhealthCertDate) // store the validity date @@ -1434,7 +1437,11 @@ export class IccCryptoXApi { } if (!!crtCryp && decryptionKey) { - crt = await this.AES.decrypt(decryptionKey, crtCryp) + try { + crt = await this.AES.decrypt(decryptionKey, crtCryp) + } catch (e) { + console.error(e) + } } if (!crt) { @@ -1446,7 +1453,7 @@ export class IccCryptoXApi { } else { this.saveKeychainInBrowserLocalStorageAsBase64( hcp.id!!, - utils.base64url(new Uint8Array(crt)) + btoa(String.fromCharCode.apply(null, new Uint8Array(crt))) ) } From 2223c35fa5c0d3677d1c13261594da79ea7e9cf1 Mon Sep 17 00:00:00 2001 From: Phil Mertens Date: Tue, 18 Aug 2020 10:22:57 +0200 Subject: [PATCH 72/75] Cleaning --- icc-x-api/icc-crypto-x-api.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/icc-x-api/icc-crypto-x-api.ts b/icc-x-api/icc-crypto-x-api.ts index 99200b39..16ef7031 100644 --- a/icc-x-api/icc-crypto-x-api.ts +++ b/icc-x-api/icc-crypto-x-api.ts @@ -1431,9 +1431,7 @@ export class IccCryptoXApi { console.error("Error while importing the AES key.") } if (!decryptionKey) { - return Promise.reject( - new Error("No encryption key! eHealth certificate cannot be decrypted.") - ) + throw new Error("No encryption key! eHealth certificate cannot be decrypted.") } if (!!crtCryp && decryptionKey) { @@ -1445,11 +1443,9 @@ export class IccCryptoXApi { } if (!crt) { - return Promise.reject( - new Error( + throw new Error( `Error while saving certificate in browser local storage! Hcp ${hcp.id} has no certificate.` - ) - ) + ) } else { this.saveKeychainInBrowserLocalStorageAsBase64( hcp.id!!, @@ -1457,7 +1453,7 @@ export class IccCryptoXApi { ) } - return Promise.resolve() + return }) } From 56e9574f9df9bd0dfd53cee539c61f5e254765e5 Mon Sep 17 00:00:00 2001 From: Dylan Friedrich Date: Wed, 26 Aug 2020 15:28:33 +0200 Subject: [PATCH 73/75] Fix error with adresseDTO Map --- icc-api/model/AddressDto.ts | 24 +++++++++++++------- icc-api/model/TelecomDtoEmbed.ts | 39 +++++++++++++++++++++----------- 2 files changed, 42 insertions(+), 21 deletions(-) diff --git a/icc-api/model/AddressDto.ts b/icc-api/model/AddressDto.ts index 39375a9b..101a841f 100644 --- a/icc-api/model/AddressDto.ts +++ b/icc-api/model/AddressDto.ts @@ -53,13 +53,21 @@ export class AddressDto { telecoms?: Array } export namespace AddressDto { - export enum AddressTypeEnum { - Home = "home", - Work = "work", - Vacation = "vacation", - Hospital = "hospital", - Clinic = "clinic", - Hq = "hq", - Other = "other" + export type AddressTypeEnum = + | "home" + | "work" + | "vacation" + | "hospital" + | "clinic" + | "hq" + | "other" + export const AddressTypeEnum = { + Home: "home" as AddressTypeEnum, + Work: "work" as AddressTypeEnum, + Vacation: "vacation" as AddressTypeEnum, + Hospital: "hospital" as AddressTypeEnum, + Clinic: "clinic" as AddressTypeEnum, + Hq: "hq" as AddressTypeEnum, + Other: "other" as AddressTypeEnum } } diff --git a/icc-api/model/TelecomDtoEmbed.ts b/icc-api/model/TelecomDtoEmbed.ts index 43410cf8..fc410e4d 100644 --- a/icc-api/model/TelecomDtoEmbed.ts +++ b/icc-api/model/TelecomDtoEmbed.ts @@ -37,18 +37,31 @@ export class TelecomDtoEmbed { encryptedSelf?: string } export namespace TelecomDtoEmbed { - export enum TelecomTypeEnum { - Mobile = "mobile", - Phone = "phone", - Email = "email", - Fax = "fax", - Skype = "skype", - Im = "im", - Medibridge = "medibridge", - Ehealthbox = "ehealthbox", - Apicrypt = "apicrypt", - Web = "web", - Print = "print", - Disk = "disk" + export type TelecomTypeEnum = + | "mobile" + | "phone" + | "email" + | "fax" + | "skype" + | "im" + | "medibridge" + | "ehealthbox" + | "apicrypt" + | "web" + | "print" + | "disk" + export const TelecomTypeEnum = { + Mobile: "mobile" as TelecomTypeEnum, + Phone: "phone" as TelecomTypeEnum, + Email: "email" as TelecomTypeEnum, + Fax: "fax" as TelecomTypeEnum, + Skype: "skype" as TelecomTypeEnum, + Im: "im" as TelecomTypeEnum, + Medibridge: "medibridge" as TelecomTypeEnum, + Ehealthbox: "ehealthbox" as TelecomTypeEnum, + Apicrypt: "apicrypt" as TelecomTypeEnum, + Web: "web" as TelecomTypeEnum, + Print: "print" as TelecomTypeEnum, + Disk: "disk" as TelecomTypeEnum } } From 8c033c943e84d3cc459d06e607c3e86b2ab4f6fd Mon Sep 17 00:00:00 2001 From: Dylan Friedrich Date: Wed, 26 Aug 2020 15:29:01 +0200 Subject: [PATCH 74/75] Fix error with sideEnum --- icc-api/model/InvoiceItem.ts | 131 ++++++++++++++---------------- icc-api/model/InvoicingCodeDto.ts | 8 +- icc-x-api/utils/efact-util.ts | 2 +- 3 files changed, 69 insertions(+), 72 deletions(-) diff --git a/icc-api/model/InvoiceItem.ts b/icc-api/model/InvoiceItem.ts index 6e15d249..bb177b71 100644 --- a/icc-api/model/InvoiceItem.ts +++ b/icc-api/model/InvoiceItem.ts @@ -1,110 +1,101 @@ /** + * iCure Cloud API Documentation + * Spring shop sample application * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: 1.0.2 + * OpenAPI spec version: v0.0.1 * * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ - -import * as models from "./models" +import { EIDItem } from "./EIDItem" export class InvoiceItem { constructor(json: JSON | any) { Object.assign(this as InvoiceItem, json) } - dateCode?: number + dateCode?: number codeNomenclature?: number - relatedCode?: number - - eidItem?: models.EIDItem - + eidItem?: EIDItem insuranceRef?: string - insuranceRefDate?: number - units?: number - reimbursedAmount?: number - patientFee?: number - doctorSupplement?: number - sideCode?: InvoiceItem.SideCodeEnum - timeOfDay?: InvoiceItem.TimeOfDayEnum - override3rdPayerCode?: number - gnotionNihii?: string - derogationMaxNumber?: InvoiceItem.DerogationMaxNumberEnum - prescriberNorm?: InvoiceItem.PrescriberNormEnum - prescriberNihii?: string - personalInterventionCoveredByThirdPartyCode?: number - doctorIdentificationNumber?: string - invoiceRef?: string - percentNorm?: InvoiceItem.PercentNormEnum } export namespace InvoiceItem { - export enum SideCodeEnum { - None = "None", - Left = "Left", - Right = "Right" + export type SideCodeEnum = "None" | "Left" | "Right" + export const SideCodeEnum = { + None: "None" as SideCodeEnum, + Left: "Left" as SideCodeEnum, + Right: "Right" as SideCodeEnum } - export enum TimeOfDayEnum { - Other = "Other", - Night = "Night", - Weekend = "Weekend", - Bankholiday = "Bankholiday", - Urgent = "Urgent" + export type TimeOfDayEnum = "Other" | "Night" | "Weekend" | "Bankholiday" | "Urgent" + export const TimeOfDayEnum = { + Other: "Other" as TimeOfDayEnum, + Night: "Night" as TimeOfDayEnum, + Weekend: "Weekend" as TimeOfDayEnum, + Bankholiday: "Bankholiday" as TimeOfDayEnum, + Urgent: "Urgent" as TimeOfDayEnum } - export enum DerogationMaxNumberEnum { - Other = "Other", - DerogationMaxNumber = "DerogationMaxNumber", - OtherPrescription = "OtherPrescription", - SecondPrestationOfDay = "SecondPrestationOfDay", - ThirdAndNextPrestationOfDay = "ThirdAndNextPrestationOfDay" + export type DerogationMaxNumberEnum = + | "Other" + | "DerogationMaxNumber" + | "OtherPrescription" + | "SecondPrestationOfDay" + | "ThirdAndNextPrestationOfDay" + export const DerogationMaxNumberEnum = { + Other: "Other" as DerogationMaxNumberEnum, + DerogationMaxNumber: "DerogationMaxNumber" as DerogationMaxNumberEnum, + OtherPrescription: "OtherPrescription" as DerogationMaxNumberEnum, + SecondPrestationOfDay: "SecondPrestationOfDay" as DerogationMaxNumberEnum, + ThirdAndNextPrestationOfDay: "ThirdAndNextPrestationOfDay" as DerogationMaxNumberEnum } - export enum PrescriberNormEnum { - None = "None", - OnePrescriber = "OnePrescriber", - SelfPrescriber = "SelfPrescriber", - AddedCode = "AddedCode", - ManyPrescribers = "ManyPrescribers" + export type PrescriberNormEnum = + | "None" + | "OnePrescriber" + | "SelfPrescriber" + | "AddedCode" + | "ManyPrescribers" + export const PrescriberNormEnum = { + None: "None" as PrescriberNormEnum, + OnePrescriber: "OnePrescriber" as PrescriberNormEnum, + SelfPrescriber: "SelfPrescriber" as PrescriberNormEnum, + AddedCode: "AddedCode" as PrescriberNormEnum, + ManyPrescribers: "ManyPrescribers" as PrescriberNormEnum } - export enum PercentNormEnum { - None = "None", - SurgicalAid1 = "SurgicalAid1", - SurgicalAid2 = "SurgicalAid2", - ReducedFee = "ReducedFee", - Ah1n1 = "Ah1n1", - HalfPriceSecondAct = "HalfPriceSecondAct", - InvoiceException = "InvoiceException", - ForInformation = "ForInformation" + export type PercentNormEnum = + | "None" + | "SurgicalAid1" + | "SurgicalAid2" + | "ReducedFee" + | "Ah1n1" + | "HalfPriceSecondAct" + | "InvoiceException" + | "ForInformation" + export const PercentNormEnum = { + None: "None" as PercentNormEnum, + SurgicalAid1: "SurgicalAid1" as PercentNormEnum, + SurgicalAid2: "SurgicalAid2" as PercentNormEnum, + ReducedFee: "ReducedFee" as PercentNormEnum, + Ah1n1: "Ah1n1" as PercentNormEnum, + HalfPriceSecondAct: "HalfPriceSecondAct" as PercentNormEnum, + InvoiceException: "InvoiceException" as PercentNormEnum, + ForInformation: "ForInformation" as PercentNormEnum } -} +} \ No newline at end of file diff --git a/icc-api/model/InvoicingCodeDto.ts b/icc-api/model/InvoicingCodeDto.ts index 9a699644..8214cb09 100644 --- a/icc-api/model/InvoicingCodeDto.ts +++ b/icc-api/model/InvoicingCodeDto.ts @@ -70,7 +70,7 @@ export class InvoicingCodeDto { units?: number - side?: number + side?: InvoicingCodeDto.SideEnum timeOfDay?: number @@ -136,4 +136,10 @@ export namespace InvoicingCodeDto { Paypal = "paypal", Bitcoin = "bitcoin" } + export type SideEnum = "None" | "Left" | "Right" + export const SideEnum = { + None: "None" as SideEnum, + Left: "Left" as SideEnum, + Right: "Right" as SideEnum + } } diff --git a/icc-x-api/utils/efact-util.ts b/icc-x-api/utils/efact-util.ts index 1163d53d..6b76487f 100644 --- a/icc-x-api/utils/efact-util.ts +++ b/icc-x-api/utils/efact-util.ts @@ -329,7 +329,7 @@ function toInvoiceItem( invoiceItem.prescriberNorm = getPrescriberNorm(invoicingCode.prescriberNorm || 0) invoiceItem.reimbursedAmount = Number(((invoicingCode.reimbursement || 0) * 100).toFixed(0)) invoiceItem.relatedCode = Number(invoicingCode.relatedCode || 0) - invoiceItem.sideCode = getSideCode(invoicingCode.side || 0) + invoiceItem.sideCode = invoicingCode.side invoiceItem.timeOfDay = getTimeOfDay(invoicingCode.timeOfDay || 0) invoiceItem.units = invoicingCode.units || 1 invoiceItem.derogationMaxNumber = getDerogationMaxNumber(invoicingCode.derogationMaxNumber || 0) From 1588e39006d756cc80e6dcee40d021b6de39e0c1 Mon Sep 17 00:00:00 2001 From: Dylan Friedrich Date: Wed, 26 Aug 2020 15:29:23 +0200 Subject: [PATCH 75/75] Fix error efactApi --- icc-x-api/icc-message-x-api.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/icc-x-api/icc-message-x-api.ts b/icc-x-api/icc-message-x-api.ts index b39036df..86a8d29d 100644 --- a/icc-x-api/icc-message-x-api.ts +++ b/icc-x-api/icc-message-x-api.ts @@ -30,7 +30,7 @@ import { uuidBase36Half } from "./utils/efact-util" import { timeEncode } from "./utils/formatting-util" -import { fhcEfactControllerApi, EfactSendResponse } from "fhc-api" +import { fhcEfactApi, EfactSendResponse } from "fhc-api" import { utils } from "./crypto/utils" import { EfactMessage } from "fhc-api" import { @@ -1049,7 +1049,7 @@ export class IccMessageXApi extends iccMessageApi { xFHCKeystoreId: string, xFHCTokenId: string, xFHCPassPhrase: string, - efactApi: fhcEfactControllerApi, + efactApi: fhcEfactApi, fhcServer: string | undefined = undefined, prefixer?: (fed: InsuranceDto, hcpId: string) => Promise, isConnectedAsPmg: boolean = false,