/** * * 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 iccBekmehrApi { host: string headers: Array constructor(host: string, headers: any) { this.host = host this.headers = Object.keys(headers).map(k => new XHR.Header(k, headers[k])) } 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) } checkIfSMFPatientsExists( documentId: string, documentKey?: string, patientId?: string, language?: string, body?: any ): Promise | any> { let _body = null _body = body const _url = this.host + "/be_kmehr/smf/{documentId}/checkIfSMFPatientsExists".replace( "{documentId}", documentId + "" ) + "?ts=" + new Date().getTime() + (documentKey ? "&documentKey=" + documentKey : "") + (patientId ? "&patientId=" + patientId : "") + (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 as Array).map(it => new models.CheckSMFPatientResult(it))) .catch(err => this.handleError(err)) } generateMedicationSchemeExport( patientId: string, language?: string, version?: number, body?: models.MedicationSchemeExportInfoDto ): Promise { let _body = null _body = body const _url = this.host + "/be_kmehr/medicationscheme/{patientId}/export".replace("{patientId}", patientId + "") + "?ts=" + new Date().getTime() + (language ? "&language=" + language : "") + (version ? "&version=" + version : "") 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)) } generateSmfExport( patientId: string, language?: string, body?: models.SoftwareMedicalFileExportDto ): Promise { let _body = null _body = body const _url = this.host + "/be_kmehr/smf/{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)) } generateSumehr( patientId: string, language?: string, body?: models.SumehrExportInfoDto ): Promise { let _body = null _body = body const _url = this.host + "/be_kmehr/sumehr/{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)) } generateSumehrV2( patientId: string, language?: string, body?: models.SumehrExportInfoDto ): Promise { let _body = null _body = body const _url = this.host + "/be_kmehr/sumehrv2/{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)) } getSumehrContent( patientId: string, body?: models.SumehrExportInfoDto ): Promise { let _body = null _body = body const _url = this.host + "/be_kmehr/sumehr/{patientId}/content".replace("{patientId}", patientId + "") + "?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 => new models.SumehrContentDto(doc.body as JSON)) .catch(err => this.handleError(err)) } getSumehrMd5( patientId: string, body?: models.SumehrExportInfoDto ): Promise { let _body = null _body = body const _url = this.host + "/be_kmehr/sumehr/{patientId}/md5".replace("{patientId}", patientId + "") + "?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 => new models.ContentDto(doc.body as JSON)) .catch(err => this.handleError(err)) } getSumehrV2Content( patientId: string, body?: models.SumehrExportInfoDto ): Promise { let _body = null _body = body const _url = this.host + "/be_kmehr/sumehrv2/{patientId}/content".replace("{patientId}", patientId + "") + "?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 => new models.SumehrContentDto(doc.body as JSON)) .catch(err => this.handleError(err)) } getSumehrV2Md5( patientId: string, body?: models.SumehrExportInfoDto ): Promise { let _body = null _body = body const _url = this.host + "/be_kmehr/sumehrv2/{patientId}/md5".replace("{patientId}", patientId + "") + "?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 => new models.ContentDto(doc.body as JSON)) .catch(err => this.handleError(err)) } importMedicationScheme( documentId: string, documentKey?: string, patientId?: string, language?: string, body?: any ): Promise | any> { let _body = null _body = body const _url = this.host + "/be_kmehr/medicationscheme/{documentId}/import".replace("{documentId}", documentId + "") + "?ts=" + new Date().getTime() + (documentKey ? "&documentKey=" + documentKey : "") + (patientId ? "&patientId=" + patientId : "") + (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 as Array).map(it => new models.ImportResultDto(it))) .catch(err => this.handleError(err)) } importSmf( documentId: string, documentKey?: string, patientId?: string, language?: string, body?: any ): Promise | any> { let _body = null _body = body const _url = this.host + "/be_kmehr/smf/{documentId}/import".replace("{documentId}", documentId + "") + "?ts=" + new Date().getTime() + (documentKey ? "&documentKey=" + documentKey : "") + (patientId ? "&patientId=" + patientId : "") + (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 as Array).map(it => new models.ImportResultDto(it))) .catch(err => this.handleError(err)) } importSumehr( documentId: string, documentKey?: string, patientId?: string, language?: string, body?: any ): Promise | any> { let _body = null _body = body const _url = this.host + "/be_kmehr/sumehr/{documentId}/import".replace("{documentId}", documentId + "") + "?ts=" + new Date().getTime() + (documentKey ? "&documentKey=" + documentKey : "") + (patientId ? "&patientId=" + patientId : "") + (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 as Array).map(it => new models.ImportResultDto(it))) .catch(err => this.handleError(err)) } isSumehrV2Valid(patientId: string, body?: models.SumehrExportInfoDto): Promise { let _body = null _body = body const _url = this.host + "/be_kmehr/sumehrv2/{patientId}/valid".replace("{patientId}", patientId + "") + "?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 => JSON.parse(JSON.stringify(doc.body))) .catch(err => this.handleError(err)) } isSumehrValid(patientId: string, body?: models.SumehrExportInfoDto): Promise { let _body = null _body = body const _url = this.host + "/be_kmehr/sumehr/{patientId}/valid".replace("{patientId}", patientId + "") + "?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 => JSON.parse(JSON.stringify(doc.body))) .catch(err => this.handleError(err)) } validateSumehr( patientId: string, language?: string, body?: models.SumehrExportInfoDto ): Promise { let _body = null _body = body const _url = this.host + "/be_kmehr/sumehr/{patientId}/validate".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)) } validateSumehrV2( patientId: string, language?: string, body?: models.SumehrExportInfoDto ): Promise { let _body = null _body = body const _url = this.host + "/be_kmehr/sumehrv2/{patientId}/validate".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)) } }