- import { Component, OnInit, OnDestroy, HostListener, enableProdMode, ViewChild } from "@angular/core";
- import { Router, ActivatedRoute } from "@angular/router";
- import { LoginService } from "src/app/login/services/login.service";
- import { LogoutService } from "src/app/login/services/logout.service";
- import { Patient } from "src/app/shared/model/patient";
- import { SessionStorageService } from "src/app/shared/services/session-storage.service";
- import { AppConstants } from "src/app/shared/constants/app-constants";
- import { DatePipe } from "@angular/common";
- import { PatientCollectionService } from "./services/patient-collection.service";
- import { NotificationService } from "src/app/shared/services/notification.service";
- import { DeviceDetectorService } from "ngx-device-detector";
- import { UserService } from "src/app/shared/services/user.service";
- import { User } from "src/app/shared/model/user";
- import { SharePointService } from "../sharepoint/services/sharePoint.service";
- import { DxTextBoxComponent, DxPopupComponent, DxSelectBoxComponent, DxDateBoxComponent, DxScrollViewComponent } from "devextreme-angular";
- import { VDASService } from "./services/vdas.service";
- import { Doctor } from "src/app/shared/model/doctor";
- import { DoctorService } from "./services/doctor.service";
- import { OrganisationService } from "./services/organisation.service";
- import { ValidationService } from "src/app/shared/services/validation.service";
- import { TimeSlot } from "src/app/shared/model/timeslot";
- import { SchedulerService } from "../scheduler/services/scheduler.service";
- import { ResidenceService } from "./services/residence.service";
- import { EndpointConfigService } from "src/app/shared/services/endpoint-config.service";
- import { LoadingIndicatorService } from "src/app/shared/services/loading-indicator.service";
- import validationEngine from 'devextreme/ui/validation_engine';
- enableProdMode();
- @Component({
- selector: 'app-patient-collection',
- templateUrl: './patient-collection.component.html',
- styleUrls: ['./patient-collection.component.css']
- })
- export class PatientCollectionComponent implements OnInit, OnDestroy {
- @ViewChild('lastnameInput', { static: false }) lastnameInput: DxTextBoxComponent;
- @ViewChild('secondAppointmentInput', { static: false }) secondAppointmentInput: DxDateBoxComponent;
- @ViewChild('appointmentInput', { static: false }) appointmentInput: DxDateBoxComponent;
- @ViewChild('authorityAssignedIdInput', { static: false }) authorityAssignedIdInput: DxTextBoxComponent;
- @ViewChild('driveInAssignedIdInput', { static: false }) driveInAssignedIdInput: DxTextBoxComponent;
- @ViewChild('birthdateInput', { static: false }) birthdateInput: DxDateBoxComponent;
- @ViewChild('ssnInput', { static: false }) ssnInput: DxTextBoxComponent;
- @ViewChild('vdasPopup', { static: false }) vdasPopup: DxPopupComponent;
- @ViewChild('driveInSelectBox', { static: false }) driveInSelectBox: DxSelectBoxComponent;
- @ViewChild('authoritySelectBox', { static: false }) authoritySelectBox: DxSelectBoxComponent;
- @ViewChild('scrollView', { static: false }) scrollView: DxScrollViewComponent;
- @ViewChild('statusInput', { static: false }) statusInput: DxSelectBoxComponent;
- @ViewChild('laborInput', { static: false }) laborInput: DxSelectBoxComponent;
- @ViewChild('svtCodeInput', { static: false }) svtCodeInput: DxSelectBoxComponent;
- @ViewChild('contactDateInput', { static: false }) contactDateInput: DxDateBoxComponent;
- user: User = JSON.parse(this.sessionStorageService.get(AppConstants.USER));
- collectPatient: boolean = true;
- collectPatientForRetest: boolean = false;
- origin: string = '';
- ssn: string = '';
- lastname: string = '';
- birthdate: string = '';
- pageTitle: string = '';
- tabIndex: number = 0;
- patient: Patient;
- canEdit: boolean = false;
- callCenterCanEdit: boolean = false;
- canEditAppointmentHealth: boolean = false;
- maxDate = new Date();
- sexEntries = [
- { name: 'Unknown', text: 'keine Angabe' },
- { name: 'Male', text: "männlich" },
- { name: 'Female', text: "weiblich" },
- { name: 'Diverse', text: 'divers' }
- ];
- areaEntries = JSON.parse(this.sessionStorageService.get(AppConstants.AREAS));
- priorityEntries = JSON.parse(this.sessionStorageService.get(AppConstants.PRIORITIES));
- driveInEntries = JSON.parse(this.sessionStorageService.get(AppConstants.DRIVE_INS));
- authorityEntries = JSON.parse(this.sessionStorageService.get(AppConstants.AUTHORITIES));
- countryCodeEntries = JSON.parse(this.sessionStorageService.get(AppConstants.COUNTRY_CODES));
- statusEntries = JSON.parse(this.sessionStorageService.get(AppConstants.PHONE_STATI));
- setStatusEntries = JSON.parse(this.sessionStorageService.get(AppConstants.SET_STATI));
- laborEntries = JSON.parse(this.sessionStorageService.get(AppConstants.LABORS));
- socialInsuranceCarriers = JSON.parse(this.sessionStorageService.get(AppConstants.SOCIAL_INSURANCE_CARRIERS));
- appointmentEntries: TimeSlot[] = [];
- secAppointmentEntries: TimeSlot[] = [];
- pickerType = 'calendar';
- isDesktop: boolean = false;
- isMobile: boolean = false;
- isTablet: boolean = false;
- vdasPopupVisible = false;
- vdasPatient: Patient;
- doctors: Doctor[];
- organisations;
- residences;
- isVDASLoading = false;
- schedulePopupVisible: boolean = false;
- type: string;
- status: string;
- daysInFuture: number;
- daysToContactDate: number;
- constructor(private router: Router,
- private route: ActivatedRoute,
- private loginService: LoginService,
- private logoutService: LogoutService,
- private userService: UserService,
- private patientCollectionService: PatientCollectionService,
- private vdasService: VDASService,
- private doctorService: DoctorService,
- private organisationService: OrganisationService,
- private residenceService: ResidenceService,
- private sharePointService: SharePointService,
- private schedulerService: SchedulerService,
- private validationService: ValidationService,
- private endpointConfigService: EndpointConfigService,
- private loadingIndicatorService: LoadingIndicatorService,
- private notificationService: NotificationService,
- private sessionStorageService: SessionStorageService,
- private deviceDetector: DeviceDetectorService,
- private datePipe: DatePipe) { }
- @HostListener('window:unload', ['$event'])
- unload(evt) {
- if (this.patient.id && this.patient.id.length > 0)
- this.patientCollectionService.deletePersonLock(this.patient.id).subscribe();
- }
- @HostListener('window:resize', ['$event'])
- onResize(event) {
- window.dispatchEvent(new Event('patientCollectionResize'));
- }
- ngOnInit() {
- if (this.loginService.isLoggedIn()) {
- this.origin = this.route.snapshot.queryParamMap.get('origin');
- this.ssn = this.route.snapshot.queryParamMap.get('ssn');
- this.lastname = this.route.snapshot.queryParamMap.get('lastname');
- this.birthdate = this.route.snapshot.queryParamMap.get('birthdate');
- this.tabIndex = this.sessionStorageService.get(AppConstants.SELECTED_TAB) && this.sessionStorageService.get(AppConstants.SELECTED_TAB).length > 0 ? Number(this.sessionStorageService.get(AppConstants.SELECTED_TAB)) : 0;
- this.collectPatient = Boolean(JSON.parse(this.route.snapshot.queryParamMap.get('collectPatient')));
- this.collectPatientForRetest = Boolean(JSON.parse(this.route.snapshot.queryParamMap.get('collectPatientForRetest')));
- if (this.collectPatient) {
- this.pageTitle = 'Drive-In Klientenerfassung';
- } else {
- this.pageTitle = 'Drive-In Klient ändern';
- }
- if (!this.collectPatient) {
- this.patient = this.route.snapshot.data.person.body.data.personDetails;
- this.setPatient();
- } else {
- if (!this.collectPatientForRetest) {
- this.patient = new Patient();
- this.patient.priority = "Other";
- this.patient.gesundTestung = false;
- this.patient.gesundTestungEinfach = false;
- this.patient.isDriveInPossible = false;
- this.patient.dataTransferAccepted = false;
- this.patient.nationality = 'AT';
- this.patient.vip = false;
- this.patient.phone = '+43';
- this.patient.contactPerson1OneAppointment = false;
- this.patient.contactPerson1TwoAppointments = false;
- this.patient.notification = true;
- this.patient.appointmentRecording = false;
- // this.patient.familyDoctor = new Doctor();
- }
- else {
- this.patient = this.route.snapshot.data.person.body.data.personDetails;
- this.patient.status = null;
- this.patient.authorityId = null;
- this.patient.isDriveInPossible = false;
- this.patient.gesundTestung = false;
- this.patient.gesundTestungEinfach = false;
- this.patient.priority = "Other";
- this.patient.organisationText = null;
- this.patient.authorityAssignedId = null;
- this.patient.driveInAssignedId = null;
- this.patient.appointment = null;
- this.patient.secondAppointment = null;
- this.patient.driveInId = null;
- this.patient.secondDriveInId = null;
- this.patient.laboratoryId = null;
- this.patient.contactDate = null;
- this.patient.countryOfResidence = null;
- this.patient.contactPerson1OneAppointment = false;
- this.patient.contactPerson1TwoAppointments = false;
- this.patient.notification = true;
- this.patient.appointmentRecording = false;
- }
- }
- } else {
- this.logoutService.logout();
- }
- setTimeout(() => {
- window.dispatchEvent(new Event('patientCollectionResize'));
- });
- this.isDesktop = this.deviceDetector.isDesktop();
- this.isMobile = this.deviceDetector.isMobile();
- this.isTablet = this.deviceDetector.isTablet();
- this.setCanEditFields();
- if (this.canEdit && this.deviceDetector.isDesktop()) {
- setTimeout(() => {
- if (this.lastnameInput && this.lastnameInput.instance) {
- this.lastnameInput.instance.focus();
- }
- }, 500);
- }
- if (this.deviceDetector.isMobile()) {
- $('#patientCollection').css('width', '95%');
- $('#patientCollection').css('margin-left', '2.5%');
- $('#patientCollection').css('margin-right', '2.5%');
- }
- setTimeout(() => {
- this.setVdasStyle();
- });
- if (this.deviceDetector.isDesktop()) {
- this.pickerType = 'calendar';
- } else {
- this.pickerType = 'native';
- }
- setTimeout(() => {
- if (!this.authoritySelectBox.disabled && this.patient.priority && this.patient.priority === 'PrivateTesting') {
- this.laborInput.disabled = false;
- } else {
- this.laborInput.disabled = true;
- }
- if (!this.authoritySelectBox.disabled && this.patient.priority && (this.patient.priority === 'ContactPerson1WithNotification' || this.patient.priority === 'ContactPerson1')) {
- this.contactDateInput.disabled = false;
- } else {
- this.contactDateInput.disabled = true;
- }
- if (this.patient.driveInId && !this.patient.secondDriveInId && (this.patient.gesundTestung || this.patient.contactDate)) {
- this.patient.secondDriveInId = this.patient.driveInId;
- }
- });
- this.priorityComparison = this.priorityComparison.bind(this);
- this.statusComparison = this.statusComparison.bind(this);
- this.contactDateComparison = this.contactDateComparison.bind(this);
- this.contactSecondAppointmentComparison = this.contactSecondAppointmentComparison.bind(this);
- this.phoneComparison = this.phoneComparison.bind(this);
- if (this.ssn && this.ssn.length > 0) {
- this.patient.ssn = this.ssn;
- this.vdas('');
- }
- if (this.lastname && this.lastname.length > 0)
- this.patient.lastname = this.lastname;
- if (this.birthdate && this.birthdate.length > 0)
- this.patient.birthdate = JSON.parse(this.birthdate);
- this.daysToContactDate = this.endpointConfigService.getDaysToContactDateWhereTestRequired();
- this.daysInFuture = this.endpointConfigService.getLoadAppointmentsDaysInFuture();
- this.queryTimeSlots();
- }
- ngOnDestroy() {
- if (this.patient.id && this.patient.id.length > 0) {
- this.patientCollectionService.deletePersonLock(this.patient.id).subscribe(response => {
- if (response && response.body && response.body.errors && response.body.errors.length > 0) {
- this.notificationService.notifyError('Klient konnte nicht freigegeben werden: ' + response.body.errors[0].message);
- }
- }, error => {
- this.notificationService.notifyError('Klient konnte nicht freigegeben werden: ' + error.message);
- });
- }
- }
- onShowing(e) {
- if (this.vdasPopup && this.vdasPopup.instance) {
- if (!this.isMobile && !this.isTablet) {
- this.vdasPopup.width = '50%';
- this.vdasPopup.height = '50%';
- } else {
- this.vdasPopup.width = '80%';
- this.vdasPopup.height = '80%';
- }
- }
- }
- onShown(e) {
- if (this.vdasPopup && this.vdasPopup.instance) {
- this.vdasPopup.instance.repaint();
- }
- }
- setCanEditFields() {
- if (this.origin === 'worklist' && this.patient &&
- (this.patient.status === AppConstants.STATUS_ACCEPTED ||
- this.patient.status === AppConstants.STATUS_RETEST ||
- this.patient.status === AppConstants.STATUS_SEEN ||
- this.patient.status === AppConstants.STATUS_SAMPLED_ACCEPTED ||
- !this.patient.status)) {
- this.canEdit = true;
- if (this.tabIndex === 0)
- this.callCenterCanEdit = true;
- if (this.tabIndex === 0 && this.patient.gesundTestung)
- this.canEditAppointmentHealth = true;
- } else if (this.origin === 'sharepoint' && this.patient &&
- (this.patient.status === AppConstants.STATUS_CREATED ||
- this.patient.status === AppConstants.STATUS_AUTHORITY ||
- this.patient.status === AppConstants.STATUS_ACCEPTED ||
- this.patient.status === AppConstants.STATUS_RETEST ||
- this.patient.status === AppConstants.STATUS_RECALL_1_NEGATIVE ||
- this.patient.status === AppConstants.STATUS_RECALL_2_NEGATIVE ||
- this.patient.status === AppConstants.STATUS_RECALL_3_NEGATIVE ||
- !this.patient.status)) {
- this.canEdit = true;
- if (this.patient.status && (this.tabIndex === 1 || this.tabIndex === 2))
- this.callCenterCanEdit = true;
- if (this.patient.status && (this.tabIndex === 1 || this.tabIndex === 2) && this.patient.gesundTestung) {
- this.canEditAppointmentHealth = true;
- }
- if (this.tabIndex === 0 && this.patient.appointmentRecording) {
- this.callCenterCanEdit = true;
- }
- }
- if (this.origin === 'worklist' && this.tabIndex === 4) {
- this.canEdit = false;
- this.callCenterCanEdit = false;
- this.canEditAppointmentHealth = false;
- }
- }
- setPatient() {
- if (this.patient) {
- if (this.patient.gesundTestung === null || this.patient.gesundTestung === undefined) {
- this.patient.gesundTestung = false;
- }
- if (this.patient.gesundTestungEinfach === null || this.patient.gesundTestungEinfach === undefined) {
- this.patient.gesundTestungEinfach = false;
- }
- if (this.patient.isDriveInPossible === null || this.patient.isDriveInPossible === undefined) {
- this.patient.isDriveInPossible = false;
- }
- if (this.patient.dataTransferAccepted === null || this.patient.dataTransferAccepted === undefined) {
- this.patient.dataTransferAccepted = false;
- }
- if (this.patient.vip === null || this.patient.vip === undefined) {
- this.patient.vip = false;
- }
- if (this.patient.contactPerson1OneAppointment === null || this.patient.contactPerson1OneAppointment === undefined) {
- this.patient.contactPerson1OneAppointment = false;
- }
- if (this.patient.contactPerson1TwoAppointments === null || this.patient.contactPerson1TwoAppointments === undefined) {
- this.patient.contactPerson1TwoAppointments = false;
- }
- if (this.patient.notification === null || this.patient.notification === undefined) {
- this.patient.notification = false;
- }
- this.patient.appointmentRecording = false;
- this.status = this.patient.status;
- }
- }
- setVdasStyle() {
- if (this.patient && this.patient.isVDASQueryAccepted)
- $('.vdasStyle').css('background-color', '#4cae4c');
- else
- $('.vdasStyle').css('background-color', '#b1000a');
- }
- getPatient() {
- if (this.patient.isVDASQueryAccepted === null || this.patient.isVDASQueryAccepted === undefined)
- this.patient.isVDASQueryAccepted = false;
- return this.patient;
- }
- back(e) {
- let result = confirm("Eingegebene Daten gehen möglicherweise verloren.");
- if (result)
- this.userService.navigatePatientBack(this.origin);
- }
- submit(e) {
- this.authoritySelectBox.isValid = true;
- this.driveInSelectBox.isValid = true;
- if (this.validationService.validate(e, this.patient, this.authorityAssignedIdInput, this.secondAppointmentInput, this.driveInAssignedIdInput, this.appointmentInput, this.birthdateInput, this.ssnInput) &&
- (this.origin === 'sharepoint' ? true : (this.patient.authorityId && this.patient.driveInId))) {
- this.loadingIndicatorService.showIndicator();
- let status = AppConstants.STATUS_CREATED;
- if (this.origin === 'worklist' || (this.origin === 'sharepoint' && this.patient.appointmentRecording)) {
- status = AppConstants.STATUS_ACCEPTED;
- }
- this.patientCollectionService.collectPatient(this.getPatient(), status).subscribe(response => {
- if (response && response.body && response.body.errors && response.body.errors.length > 0) {
- this.notificationService.notifyInfo('Klient konnte nicht angelegt werden: ' + response.body.errors[0].message, 5000);
- } else {
- this.notificationService.notifyInfo('Klient wurde erfolgreich angelegt', 5000);
- this.userService.navigatePatientBack(this.origin);
- }
- this.loadingIndicatorService.hideIndicator();
- }, error => {
- this.loadingIndicatorService.hideIndicator();
- this.notificationService.notifyInfo('Klient konnte nicht angelegt werden: ' + error.message, 5000);
- });
- } else {
- if (this.origin === 'worklist') {
- if (!this.patient.authorityId)
- this.authoritySelectBox.isValid = false;
- if (!this.patient.driveInId)
- this.driveInSelectBox.isValid = false;
- }
- this.notificationService.notifyInfo('Bitte überprüfen Sie Ihre Eingaben', 2500);
- }
- }
- change(e) {
- if ((this.statusInput && this.statusInput.instance && this.status !== AppConstants.STATUS_ACCEPTED && validationEngine.validateGroup().isValid) || this.validationService.validate(e, this.patient, this.authorityAssignedIdInput, this.secondAppointmentInput, this.driveInAssignedIdInput, this.appointmentInput, this.birthdateInput, this.ssnInput)) {
- this.loadingIndicatorService.showIndicator();
- let patient: Patient = this.getPatient();
- if (this.origin === 'sharepoint' && this.patient.appointmentRecording) {
- patient.status = AppConstants.STATUS_ACCEPTED;
- }
- this.patientCollectionService.changePatient(patient).subscribe(response => {
- if (response && response.body && response.body.errors && response.body.errors.length > 0) {
- this.notificationService.notifyInfo('Klient konnte nicht geändert werden: ' + response.body.errors[0].message, 5000);
- } else {
- if (this.statusInput && this.statusInput.instance) {
- this.authorize(e, this.patient, 'false');
- }
- this.notificationService.notifyInfo('Klient wurde erfolgreich geändert', 5000);
- this.userService.navigatePatientBack(this.origin);
- }
- this.loadingIndicatorService.hideIndicator();
- }, error => {
- this.loadingIndicatorService.hideIndicator();
- this.notificationService.notifyInfo('Klient konnte nicht geändert werden: ' + error.message, 5000);
- });
- } else {
- this.notificationService.notifyInfo('Bitte überprüfen Sie Ihre Eingaben', 2500);
- }
- }
- sendToAuthority(e) {
- this.authoritySelectBox.isValid = true;
- this.patientCollectionService.changePatient(this.getPatient()).subscribe(response => {
- if (this.patient.authorityId && validationEngine.validateGroup().isValid) {
- let status = null;
- if (this.origin === 'sharepoint' && this.patient.appointmentRecording) {
- status = AppConstants.STATUS_ACCEPTED;
- }
- this.sharePointService.sendToAuthority(this.patient.id, status).subscribe(response => {
- if (response && response.body && response.body.errors && response.body.errors.length > 0) {
- this.notificationService.notifyInfo('Klient konnte nicht an Behörde übermittelt werden: ' + response.body.errors[0].message, 5000);
- } else {
- this.userService.navigatePatientBack(this.origin);
- }
- }, error => {
- this.notificationService.notifyInfo('Klient konnte nicht an Behörde übermittelt werden: ' + error.message, 5000);
- });
- } else {
- this.notificationService.notifyInfo('Klient konnte nicht an Behörde übermittelt werden', 5000);
- if (!this.patient.authorityId)
- this.authoritySelectBox.isValid = false;
- }
- });
- }
- authorize(e, data, isAuthorized: string) {
- this.sharePointService.authorize(data.id, data.status, this.status).subscribe(response => {
- if (response && response.body && response.body.errors && response.body.errors.length > 0) {
- this.notificationService.notifyInfo('Klient konnte nicht bewilligt / abgelehnt werden: ' + response.body.errors[0].message, 5000);
- } else {
- this.userService.navigatePatientBack(this.origin);
- }
- }, error => {
- this.notificationService.notifyInfo('Klient konnte nicht bewilligt / abgelehnt werden: ' + error.message, 5000);
- });
- }
- getBarcode(e) {
- if (this.deviceDetector.isDesktop() && this.patient && this.patient.currentSample && this.patient.currentSample.id) {
- window.open('./label/forSampleId/' + this.patient.currentSample.id, '_blank');
- }
- }
- vdas(e) {
- if (this.patient.ssn) {
- this.isVDASLoading = true;
- this.vdasService.vdas(this.patient.ssn, this.patient.firstname, this.patient.lastname, this.patient.birthdate).subscribe(response => {
- this.isVDASLoading = false;
- if (response && response.body && response.body.errors && response.body.errors.length > 0) {
- this.notificationService.notifyInfo('VDAS-Abfrage konnte nicht durchgeführt werden: ' + response.body.errors[0].extensions.errorMessage, 5000);
- } else {
- if (response && response.body && response.body.data && response.body.data.vdasQuery) {
- this.vdasPatient = response.body.data.vdasQuery;
- if (this.vdasPatient && this.vdasPatient.insurance && this.vdasPatient.insurance.length === 1) this.vdasPatient.svtCode = this.vdasPatient.insurance[0].svtCode;
- this.vdasPopupVisible = true;
- } else {
- this.vdasPopupVisible = false;
- this.notificationService.notifyInfo('VDAS-Abfrage liefert kein korrektes Ergebnis', 5000);
- }
- }
- }, error => {
- this.isVDASLoading = false;
- this.notificationService.notifyInfo('VDAS-Abfrage konnte nicht durchgeführt werden: ' + error.message, 5000);
- });
- } else {
- this.notificationService.notifyInfo('Bitte geben Sie für eine VDAS-Abfrage eine gültige Sozialversicherungsnummer ein', 5000);
- }
- }
- takeAddress(e) {
- this.patient.secondaryAddressStreet = this.patient.addressStreet;
- this.patient.secondaryAddressZip = this.patient.addressZip;
- this.patient.secondaryAddressCity = this.patient.addressCity;
- }
- getAuthorityButtonStyle(status, type) {
- if (status && status === AppConstants.STATUS_ACCEPTED && type === AppConstants.STATUS_ACCEPTED)
- return 'authorityButtonAccepted';
- else if (status && status === AppConstants.STATUS_REJECTED && type === AppConstants.STATUS_REJECTED)
- return 'authorityButtonRejected';
- else
- return '';
- }
- cancel() {
- this.vdasPopupVisible = false;
- this.vdasPatient = new Patient();
- this.setVdasStyle();
- this.svtCodeInput.isValid = true;
- }
- assign() {
- if (this.vdasPatient && this.vdasPatient.lastname) {
- this.patient.lastname = this.vdasPatient.lastname;
- }
- if (this.vdasPatient && this.vdasPatient.firstname) {
- this.patient.firstname = this.vdasPatient.firstname
- }
- if (this.vdasPatient && this.vdasPatient.birthdate) {
- this.patient.birthdate = this.vdasPatient.birthdate;
- }
- if (this.vdasPatient && this.vdasPatient.sex) {
- this.patient.sex = this.vdasPatient.sex;
- }
- if (this.vdasPatient && this.vdasPatient.svtCode) {
- this.patient.svtCode = this.vdasPatient.svtCode;
- } else {
- if (this.vdasPatient.insurance && this.vdasPatient.insurance.length > 0) {
- this.svtCodeInput.isValid = false;
- return;
- }
- }
- if(this.vdasPatient && this.vdasPatient.patientZPI.length > 0 && this.vdasPatient.patientZPI[0].patientAddress){
- if (this.vdasPatient.patientZPI[0].patientAddress.streetName) {
- this.patient.addressStreet = this.vdasPatient.patientZPI[0].patientAddress.streetName;
- }
- if (this.vdasPatient.patientZPI[0].patientAddress.postalCode) {
- this.patient.addressZip = this.vdasPatient.patientZPI[0].patientAddress.postalCode;
- }
- if (this.vdasPatient.patientZPI[0].patientAddress.city) {
- this.patient.addressCity = this.vdasPatient.patientZPI[0].patientAddress.city;
- }
- }
- this.patient.isVDASQueryAccepted = true;
- this.cancel();
- }
- getZPIStreetName(vdasPatient: Patient){
- if(this.vdasPatient && this.vdasPatient.patientZPI.length > 0 && this.vdasPatient.patientZPI[0].patientAddress && this.vdasPatient.patientZPI[0].patientAddress.streetName){
- return this.vdasPatient.patientZPI[0].patientAddress.streetName;
- }
- }
- getZPIPostalCode(vdasPatient: Patient){
- if(this.vdasPatient && this.vdasPatient.patientZPI.length > 0 && this.vdasPatient.patientZPI[0].patientAddress && this.vdasPatient.patientZPI[0].patientAddress.postalCode){
- return this.vdasPatient.patientZPI[0].patientAddress.postalCode;
- }
- }
- getZPICity(vdasPatient: Patient){
- if(this.vdasPatient && this.vdasPatient.patientZPI.length > 0 && this.vdasPatient.patientZPI[0].patientAddress && this.vdasPatient.patientZPI[0].patientAddress.city){
- return this.vdasPatient.patientZPI[0].patientAddress.city;
- }
- }
- clearDoctors() {
- //this.doctors = [];
- }
- clearOrganisations() {
- //this.organisations = [];
- }
- onDoctorChanged(e) {
- this.doctorService.searchDoctor(e.value).subscribe(response => {
- if (response && response.body && response.body.data && response.body.data.searchDoctor) {
- this.doctors = response.body.data.searchDoctor;
- }
- });
- }
- onOrganisationChanged(e) {
- this.organisationService.searchOrganisation(e.value).subscribe(response => {
- if (response && response.body && response.body.data && response.body.data.searchOrganisation) {
- this.organisations = response.body.data.searchOrganisation;
- }
- });
- }
- onResidenceChanged(e) {
- this.residenceService.searchResidences(e.value).subscribe(response => {
- if (response && response.body && response.body.data && response.body.data.searchCountryResisdence) {
- this.residences = response.body.data.searchCountryResisdence;
- }
- });
- }
- onDoctorClick(e) {
- if (e && e.itemData && e.itemData.hvUid)
- this.patient.familyDoctorHvUid = e.itemData.hvUid;
- if (e && e.itemData && e.itemData.fullname)
- this.patient.familyDoctor = e.itemData.fullname;
- if (e && e.itemData && e.itemData.city)
- this.patient.familyDoctor += ' (' + e.itemData.city + ')';
- }
- onOrganisationClick(e) {
- if (e && e.itemData && e.itemData.text) {
- this.patient.organisationText = e.itemData.text;
- }
- }
- onResidenceClick(e) {
- if (e && e.itemData && e.itemData.text) {
- this.patient.countryOfResidence = e.itemData.text;
- }
- }
- onGesundTestungChanged(e) {
- if ((this.patient.status && (this.tabIndex === 1 || this.tabIndex === 2)) || (this.origin === 'worklist' && this.tabIndex === 0) || (this.patient.appointmentRecording && this.tabIndex === 0)) {
- if (e && e.value) {
- this.canEditAppointmentHealth = true;
- } else if (e && !e.value) {
- this.canEditAppointmentHealth = false;
- this.patient.secondAppointment = null;
- this.patient.secondDriveInId = null;
- }
- }
- if (e && e.value) {
- this.patient.gesundTestungEinfach = false;
- if (this.patient.driveInId && !this.patient.secondDriveInId && (this.patient.gesundTestung || this.patient.contactDate)) {
- this.patient.secondDriveInId = this.patient.driveInId;
- }
- }
- }
- onGesundTestungEinfachChanged(e) {
- if (e && e.value) {
- this.patient.gesundTestung = false;
- }
- }
- onContactPersonTwoAppointmentsChanged(e) {
- if (e && e.value) {
- this.patient.contactPerson1OneAppointment = false;
- if (this.patient.driveInId && !this.patient.secondDriveInId && this.patient.contactPerson1TwoAppointments) {
- this.patient.secondDriveInId = this.patient.driveInId;
- }
- }
- if (e && !e.value) {
- this.patient.secondDriveInId = null;
- this.patient.secondAppointment = null;
- }
- if (!this.patient.contactPerson1OneAppointment && !this.patient.contactPerson1TwoAppointments)
- this.patient.contactPerson1OneAppointment = true;
- }
- onContactPersonOneAppointmentChanged(e) {
- if (e && e.value) {
- this.patient.contactPerson1TwoAppointments = false;
- this.patient.secondDriveInId = null;
- this.patient.secondAppointment = null;
- }
- setTimeout(() => {
- if (!this.patient.contactPerson1OneAppointment && !this.patient.contactPerson1TwoAppointments)
- this.patient.contactPerson1OneAppointment = true;
- });
- }
- onAppointmentRecordingChanged(e) {
- if (e && e.value) {
- this.callCenterCanEdit = true;
- }
- if (e && !e.value) {
- this.patient.authorityAssignedId = null;
- this.patient.driveInAssignedId = null;
- this.patient.driveInId = null;
- this.patient.appointment = null;
- this.patient.secondDriveInId = null;
- this.patient.secondAppointment = null;
- this.callCenterCanEdit = false;
- }
- }
- onFocusIn(e) {
- setTimeout(() => {
- this.scrollView.instance.scrollToElement(e.element);
- }, 250);
- }
- onBirthdateOpened(e) {
- if (!this.isDesktop)
- this.notificationService.notifyInfo('Hinweis: Durch einen Klick auf das Jahr kann dieses schneller ausgewählt werden', 3000);
- }
- onCall(e, phone) {
- if (phone && phone.length > 0)
- return true
- else
- return false;
- }
- cancelPatient(e) {
- let confirmResult = confirm('Wollen Sie den Klienten wirklich stornieren?');
- if (confirmResult) {
- if (this.patient && this.patient.id && this.patient.status) {
- this.cancelPatientRaw(this.patient.id, this.patient.status);
- } else {
- if (this.patient.lastname && this.patient.birthdate && this.patient.ssn) {
- this.patientCollectionService.collectPatient(this.getPatient(), AppConstants.STATUS_CREATED).subscribe(response => {
- if (response && response.body && response.body.data && response.body.data.createPerson && response.body.data.createPerson.id) {
- this.cancelPatientRaw(response.body.data.createPerson.id, AppConstants.STATUS_CREATED);
- } else {
- this.notificationService.notifyError('Klient konnte nicht storniert werden');
- }
- }, error => {
- this.notificationService.notifyError('Klient konnte nicht storniert werden: ' + error.message);
- });
- } else {
- this.validationService.validate(e, this.patient, this.authorityAssignedIdInput, this.secondAppointmentInput, this.driveInAssignedIdInput, this.appointmentInput, this.birthdateInput, this.ssnInput);
- this.notificationService.notifyError('Klient konnte nicht storniert werden');
- }
- }
- }
- }
- cancelPatientRaw(personId: string, fromStatus: string) {
- this.patientCollectionService.cancelPatient(personId, fromStatus).subscribe(response => {
- if (response && response.body && response.body.errors && response.body.errors.length > 0) {
- this.notificationService.notifyError('Klient konnte nicht storniert werden: ' + response.body.errors[0].message);
- } else {
- this.userService.navigatePatientBack(this.origin);
- }
- }, error => {
- this.notificationService.notifyError('Klient konnte nicht storniert werden: ' + error.message);
- });
- }
- showSchedulerApp(e) {
- this.type = AppConstants.SCHEDULE_TYPE_APP;
- this.schedulePopupVisible = true;
- }
- showSchedulerSecApp(e) {
- this.type = AppConstants.SCHEDULE_TYPE_SEC_APP;
- this.schedulePopupVisible = true;
- }
- closeScheduler(e) {
- this.schedulePopupVisible = false;
- }
- scheduleAppointment(e) {
- if (e && e.type && e.date) {
- if (e.type === AppConstants.SCHEDULE_TYPE_APP) {
- this.patient.appointment = e.date;
- this.patient.driveInId = e.driveInId;
- } else if (e.type === AppConstants.SCHEDULE_TYPE_SEC_APP) {
- this.patient.secondAppointment = e.date;
- this.patient.secondDriveInId = e.driveInId;
- }
- this.status = AppConstants.STATUS_ACCEPTED;
- if (e.date && !this.appointmentEntries.find(timeSlot => timeSlot.startDate === e.date)) {
- this.appointmentEntries.push(new TimeSlot('Frei', e.date, 0));
- this.appointmentEntries.sort((a, b) => a.startDate.localeCompare(b.startDate));
- }
- if (e.date && !this.secAppointmentEntries.find(timeSlot => timeSlot.startDate === e.date)) {
- this.secAppointmentEntries.push(new TimeSlot('Frei', e.date, 0));
- this.secAppointmentEntries.sort((a, b) => a.startDate.localeCompare(b.startDate));
- }
- }
- }
- cancelSecondAppointmentGesundTestung(e) {
- let confirmResult = confirm('Wollen Sie den Termin (Gesundtestung) wirklich stornieren?');
- if (confirmResult)
- this.patient.gesundTestungEinfach = true;
- }
- cancelSecondAppointmentContact(e) {
- let confirmResult = confirm('Wollen Sie den 2. Termin wirklich stornieren?');
- if (confirmResult)
- this.patient.contactPerson1OneAppointment = true;
- }
- createDriveInId(e) {
- this.patientCollectionService.createDriveInId().subscribe(response => {
- if (response && response.body && response.body.data && response.body.data.nextDriveInId) {
- this.patient.driveInAssignedId = response.body.data.nextDriveInId;
- } else {
- this.notificationService.notifyError('DriveIn-ID konnte nicht generiert werden');
- }
- }, error => {
- this.notificationService.notifyError('DriveIn-ID konnte nicht generiert werden: ' + error.message);
- });
- }
- onStatusChanged(e) {
- if (e && e.previousValue === AppConstants.STATUS_ACCEPTED) {
- this.patient.appointment = null;
- this.patient.secondAppointment = null;
- this.patient.gesundTestung = false;
- this.patient.gesundTestungEinfach = false;
- }
- setTimeout(() => {
- if (e.value === null) {
- this.status = e.previousValue;
- }
- });
- }
- onAuthorityChanged(e) {
- setTimeout(() => {
- if (e.value === null) {
- this.patient.authorityId = e.previousValue;
- }
- });
- }
- onDriveInChanged(e) {
- setTimeout(() => {
- if (e.value === null) {
- if (!this.patient.appointmentRecording && this.tabIndex === 0 && this.origin === 'sharepoint') { }
- else {
- this.patient.driveInId = e.previousValue;
- }
- }
- if (this.patient.driveInId && !this.patient.secondDriveInId && (this.patient.gesundTestung || this.patient.contactDate)) {
- this.patient.secondDriveInId = this.patient.driveInId;
- }
- this.queryTimeSlots();
- });
- }
- onSecondDriveInChanged(e) {
- setTimeout(() => {
- this.queryTimeSlots();
- });
- }
- onAppointmentChanged(e) {
- setTimeout(() => {
- if (this.patient.appointment) {
- this.status = AppConstants.STATUS_ACCEPTED;
- }
- });
- }
- onPriorityChanged(e) {
- if (e && e.value && e.value === 'PrivateTesting') {
- this.laborInput.disabled = false;
- } else {
- this.laborInput.disabled = true;
- this.patient.laboratoryId = null;
- }
- if (e && e.value && (e.value === 'ContactPerson1WithNotification' || e.value === 'ContactPerson1')) {
- this.contactDateInput.disabled = false;
- this.patient.gesundTestung = false;
- this.patient.gesundTestungEinfach = false;
- this.patient.secondAppointment = null;
- } else {
- this.contactDateInput.disabled = true;
- this.patient.contactDate = null;
- if (e.previousValue === 'ContactPerson1WithNotification' || e.previousValue === 'ContactPerson1') {
- this.patient.secondAppointment = null;
- this.patient.secondDriveInId = null;
- this.patient.contactPerson1OneAppointment = false;
- this.patient.contactPerson1TwoAppointments = false;
- this.canEditAppointmentHealth = false;
- }
- }
- if (e.previousValue === 'ReturneesVoluntarily') {
- this.patient.countryOfResidence = null;
- }
- }
- priorityComparison() {
- if (this.patient.priority === 'PrivateTesting' && !this.patient.laboratoryId)
- return false;
- else
- return true;
- }
- statusComparison() {
- if (this.patient.appointment && !this.status)
- return false;
- else
- return true;
- }
- contactDateComparison() {
- if ((this.patient.priority === 'ContactPerson1WithNotification' || this.patient.priority === 'ContactPerson1') && !this.patient.contactDate)
- return false;
- else
- return true;
- }
- contactSecondAppointmentComparison() {
- if ((this.origin === 'sharepoint' && this.tabIndex === 0) || (this.origin === 'sharepoint' && this.tabIndex === 1 && this.status && this.status !== AppConstants.STATUS_ACCEPTED))
- return true;
- let contactDate = new Date(this.patient.contactDate);
- let days = Math.floor((new Date().getTime() - contactDate.getTime()) / 1000 / 60 / 60 / 24);
- if ((days < this.daysToContactDate || this.patient.contactPerson1TwoAppointments) && !this.patient.secondAppointment)
- return false;
- else
- return true;
- }
- phoneComparison() {
- if (!this.patient.phone || this.patient.phone.length <= 3)
- return false;
- else
- return true;
- }
- onSetStatusChanged(e) {
- setTimeout(() => {
- if (e.value === null) {
- this.patient.status = e.previousValue;
- }
- });
- }
- onContactDateChanged(e) {
- let contactDate = new Date(this.patient.contactDate);
- let days = Math.floor((new Date().getTime() - contactDate.getTime()) / 1000 / 60 / 60 / 24);
- if (this.patient.contactDate && days < this.daysToContactDate)
- this.patient.contactPerson1TwoAppointments = true;
- else if (this.patient.contactDate)
- this.patient.contactPerson1OneAppointment = true;
- if (this.patient.driveInId && !this.patient.secondDriveInId && (this.patient.gesundTestung || this.patient.contactDate)) {
- this.patient.secondDriveInId = this.patient.driveInId;
- }
- this.queryTimeSlots();
- }
- queryTimeSlots() {
- if (this.patient.driveInId || this.patient.secondDriveInId) {
- this.schedulerService.queryTimeSlots([this.patient.driveInId], new Date(), true, this.daysInFuture ? this.daysInFuture : 3).subscribe(response => {
- if (response && response.body && response.body.data && response.body.data.driveInTimeSlots) {
- this.appointmentEntries = response.body.data.driveInTimeSlots;
- if (this.patient.appointment && !this.appointmentEntries.find(timeSlot => timeSlot.startDate === this.patient.appointment)) {
- this.appointmentEntries.push(new TimeSlot('Frei', this.patient.appointment, 0));
- this.appointmentEntries.sort((a, b) => a.startDate.localeCompare(b.startDate));
- }
- } else {
- this.appointmentEntries = [];
- if (this.patient.appointment) {
- this.appointmentEntries.push(new TimeSlot('Frei', this.patient.appointment, 0));
- }
- this.notificationService.notifyError('Termindaten konnten nicht abgefragt werden');
- }
- this.schedulerService.queryTimeSlots([this.patient.secondDriveInId], this.patient.appointment ? new Date(this.patient.appointment) : new Date(), true, this.calculateDaysInFuture()).subscribe(response => {
- if (response && response.body && response.body.data && response.body.data.driveInTimeSlots) {
- this.secAppointmentEntries = response.body.data.driveInTimeSlots;
- if (this.patient.secondAppointment && !this.secAppointmentEntries.find(timeSlot => timeSlot.startDate === this.patient.secondAppointment)) {
- this.secAppointmentEntries.push(new TimeSlot('Frei', this.patient.secondAppointment, 0));
- this.secAppointmentEntries.sort((a, b) => a.startDate.localeCompare(b.startDate));
- }
- } else {
- this.secAppointmentEntries = [];
- if (this.patient.secondAppointment) {
- this.secAppointmentEntries.push(new TimeSlot('Frei', this.patient.secondAppointment, 0));
- }
- this.notificationService.notifyError('Termindaten konnten nicht abgefragt werden');
- }
- });
- });
- }
- }
- calculateDaysInFuture(): number {
- if (this.patient.contactDate)
- return this.daysToContactDate;
- return this.daysInFuture;
- }
- driveInDisplayValue = (data) => {
- if (data) {
- if (data.address) {
- return data.name + " (" + data.address + ")";
- } else {
- return data.name;
- }
- }
- }
- }
[text] patient-collection.component.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: