- import { Injectable } from "@angular/core";
- import { EndpointConfigService } from "src/app/shared/services/endpoint-config.service";
- import { HttpClient } from "@angular/common/http";
- import { Observable } from "rxjs";
- import { environment } from "src/environments/environment";
- import { VDASQuery, VDASQueryVariables } from "src/app/shared/model/vdas-query";
- @Injectable({
- providedIn: 'root'
- })
- export class VDASService {
- constructor(private endpointConfigService: EndpointConfigService, private http: HttpClient) { }
- vdas(ssn: string, firstname?: string, lastname?: string, birthdate?: string): Observable<any> {
- const body = this.createVDASBody(ssn, firstname, lastname, birthdate);
- const apiURL = this.getApiUrlGraphQL() + (environment.envName === 'dev' ? '/vdas' : '');
- return this.http.post(apiURL, body, { observe: 'response' });
- }
- createVDASBody(ssn: string, firstname?: string, lastname?: string, birthdate?: string) {
- let body: VDASQuery = new VDASQuery();
- body.query = 'query ($ssn: String){vdasQuery(ssn: $ssn) {firstname lastname birthdate ssn sex insurance { svtCode svtName } patientZPI { demographicData { familyName givenName middleName prefix birthDate genderCode } patientAddress { streetName postalCode city } patientIdList { id domain_oid namespace }}}}'
- body.variables = new VDASQueryVariables();
- body.variables.ssn = ssn;
- return body;
- }
- private getApiUrlGraphQL(): string {
- return this.endpointConfigService.getEndpointUrl(EndpointConfigService.GRAPH_QL);
- }
- }
[text] vdas.service.ts
Viewer
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
Editor
You can edit this paste and save as new: