@inclouded/fhir-appointment
v3.0.2
Published
``` npm install --save @inclouded/fhir-appointment ```
Downloads
28
Keywords
Readme
FHIR Appointment Firestore SDK
npm install --save @inclouded/fhir-appointment
Introduction
In the repository the Firebase Cloud Firestore SDK can be found that was made for the FHIR Appointment resource in an installable Angular folder form. The SDK can be installed for every Angular 2+ project. The SDK accomplishes the necessary CRUD operations.
Usage
For using the SDK an Angular 2+ project is needed, in which we can establish a connection to a Firestore database instance. (configured in environments.ts)
The SDK can be used in a Service in the following way:
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { AppointmentApi, serviceType } from '@inclouded/fhir-appointment';
import { IAppointment } from '@ahryman40k/ts-fhir-types/lib/R4';
import { AngularFirestore } from '@angular/fire/firestore';
import { File, FhirStorage } from '@inclouded/fhir-storage';
import { AngularFireStorage } from '@angular/fire/storage';
@Injectable()
export class AppointmentService {
AppointmentApi: AppointmentApi;
constructor(private afs: AngularFirestore, private store: AngularFireStorage) {
this.AppointmentApi = new AppointmentApi(this.afs, this.store);
}
uploadfile(data: IAppointment,files: File[]) {
return this.AppointmentApi.addWithFile(data, files);
}
addAppointment(appointment: IAppointment) {
return this.AppointmentApi.add(appointment);
}
getAllAppointments(): Observable<IAppointment[]> {
return this.AppointmentApi.getAll();
}
getAppointmentById(id: string): Observable<IAppointment[]> {
return this.AppointmentApi.getById(id);
}
deleteAppointment(appointmentId: string) {
return this.AppointmentApi.delete(appointmentId);
}
updateAppointment(appointment: IAppointment) {
return this.AppointmentApi.update(appointment);
}
getAppointmentByDate(date: Date) {
return this.AppointmentApi.getAppointmentByDate(date);
}
getAppointmentsByPractitioner(practitioner: string) {
return this.AppointmentApi.getAppointmentsByPractitioner(practitioner);
}
getAppointmentsByPatient(patient: string) {
return this.AppointmentApi.getAppointmentsByPatient(patient);
}
getAppointmentsByStatus(status: string) {
return this.AppointmentApi.getAppointmentsByStatus(status);
}
getAppointmentsByParticipantsForCAPD(patient: string, practitioner: string) {
return this.AppointmentApi.getAppointmentsByParticipantsForCAPD(patient, practitioner);
}
getAppointmentsByServiceType(serviceTypeParam: number) {
return this.AppointmentApi.getAppointmentsByServiceType(serviceTypeParam);
}
getAppointmentsByServiceTypeArray(serviceTypeParam: number[]) {
return this.AppointmentApi.getAppointmentsByServiceTypeArray(serviceTypeParam);
}
getAppointmentsByReasonReference(reasonReference: string) {
return this.AppointmentApi.getAppointmentsByReasonReference(reasonReference);
}
getAppointmentsByParticipantsAndServiceTypeForCAPD(patient: string, practitioner: string, serviceTypeParam: serviceType) {
return this.AppointmentApi.getAppointmentsByParticipantsAndServiceTypeForCAPD(patient, practitioner, serviceTypeParam);
}
}
Usage with MongoDB
See in the description of FhirApi: a link
The Appointment class must be equal with the form.value, this way there's no need for building the object locally. For the usage of the more complex objects there are more available interfaces, the properties of Appointment that possess more complex objects build upon these.
Developer: Zoltán R. Jánki ([email protected]), Gábor Simon ([email protected])