emr-types
Version:
Comprehensive TypeScript Types Library for Electronic Medical Record (EMR) Applications - Domain-Driven Design with Zod Validation
494 lines • 13.2 kB
TypeScript
import { NoteEntry, Attachment } from '../../shared/entities/BaseEntity';
import { Id } from '../../shared/value-objects/Id';
import { Money } from '../../shared/value-objects/Money';
import { Email } from '../../shared/value-objects/Email';
import { PhoneNumber } from '../../shared/value-objects/PhoneNumber';
import { Address } from '../../shared/value-objects/Address';
import { AppointmentId } from '../value-objects/AppointmentId';
import { PatientId } from '../../patient/value-objects/PatientId';
import { TenantId } from '../../tenant/value-objects/TenantId';
import { UserId } from '../../user/value-objects/UserId';
/**
* Core Appointment entity representing a medical appointment
*/
export interface Appointment {
id: AppointmentId;
tenantId: TenantId;
createdAt: Date;
updatedAt: Date;
createdBy: UserId;
updatedBy: UserId;
createdFromIp?: string;
updatedFromIp?: string;
createdUserAgent?: string;
updatedUserAgent?: string;
status: AppointmentStatus;
statusChangedAt?: Date;
statusChangedBy?: UserId;
statusChangeReason?: string;
tags?: string[];
categories?: string[];
labels?: Record<string, string>;
notes?: string;
internalNotes?: string;
notesHistory?: NoteEntry[];
attachments?: Attachment[];
appointmentCode: string;
appointmentType: AppointmentType;
title: string;
description?: string;
scheduledDate: Date;
startTime: Date;
endTime: Date;
duration: number;
timeZone: string;
patientId: PatientId;
doctorId: UserId;
nurseId?: UserId;
specialistId?: UserId;
location: AppointmentLocation;
roomNumber?: string;
building?: string;
floor?: string;
chiefComplaint?: string;
symptoms?: string[];
diagnosis?: string;
treatmentPlan?: string;
followUpRequired: boolean;
followUpDate?: Date;
insuranceInfo?: AppointmentInsuranceInfo;
billingInfo?: AppointmentBillingInfo;
copayAmount?: Money;
reminderSettings: ReminderSettings;
notificationPreferences: AppointmentNotificationPreferences;
cancellationPolicy: CancellationPolicy;
rescheduleHistory: RescheduleRecord[];
checkInTime?: Date;
checkOutTime?: Date;
waitTime?: number;
patientSatisfaction?: PatientSatisfaction;
qualityMetrics?: QualityMetrics;
}
/**
* Appointment slot representing available time slots
*/
export interface AppointmentSlot {
id: Id;
tenantId: TenantId;
createdAt: Date;
updatedAt: Date;
createdBy: UserId;
updatedBy: UserId;
doctorId: UserId;
date: Date;
startTime: Date;
endTime: Date;
duration: number;
slotType: SlotType;
isAvailable: boolean;
isBooked: boolean;
isBlocked: boolean;
blockReason?: string;
appointmentId?: AppointmentId;
patientId?: PatientId;
bookingTime?: Date;
bookingMethod: BookingMethod;
location: AppointmentLocation;
roomNumber?: string;
isRecurring: boolean;
recurrencePattern?: RecurrencePattern;
parentSlotId?: Id;
childSlotIds?: Id[];
}
/**
* Appointment location information
*/
export interface AppointmentLocation {
id: Id;
name: string;
type: LocationType;
address: Address;
phoneNumber?: PhoneNumber;
email?: Email;
website?: string;
facilityType: FacilityType;
department?: string;
floor?: string;
building?: string;
availableEquipment: string[];
specialFeatures: string[];
isWheelchairAccessible: boolean;
isHearingAccessible: boolean;
isVisionAccessible: boolean;
operatingHours: OperatingHours[];
isOpenOnWeekends: boolean;
isOpenOnHolidays: boolean;
}
/**
* Insurance information for appointment
*/
export interface AppointmentInsuranceInfo {
id: Id;
insuranceType: AppointmentInsuranceType;
providerName: string;
policyNumber: string;
groupNumber?: string;
subscriberName: string;
relationshipToPatient: string;
effectiveDate: Date;
expirationDate?: Date;
copayAmount?: Money;
deductibleAmount?: Money;
coveragePercentage?: number;
preAuthorizationRequired: boolean;
preAuthorizationNumber?: string;
notes?: string;
}
/**
* Billing information for appointment
*/
export interface AppointmentBillingInfo {
id: Id;
billingAmount: Money;
insuranceCoverage?: Money;
patientResponsibility: Money;
copayCollected?: Money;
deductibleApplied?: Money;
coinsuranceAmount?: Money;
billingStatus: BillingStatus;
paymentMethod?: AppointmentPaymentMethod;
invoiceNumber?: string;
notes?: string;
}
/**
* Reminder settings for appointment
*/
export interface ReminderSettings {
id: Id;
enabled: boolean;
reminderAdvanceTime: number;
reminderMethods: ReminderMethod[];
customMessage?: string;
sendToPatient: boolean;
sendToGuardian: boolean;
sendToDoctor: boolean;
sendToNurse: boolean;
}
/**
* Notification preferences for appointment
*/
export interface AppointmentNotificationPreferences {
id: Id;
emailNotifications: boolean;
smsNotifications: boolean;
pushNotifications: boolean;
phoneCallReminders: boolean;
inAppNotifications: boolean;
preferredContactMethod: AppointmentContactMethod;
preferredContactTime: string;
doNotDisturbHours?: {
startTime: string;
endTime: string;
};
}
/**
* Cancellation policy for appointment
*/
export interface CancellationPolicy {
id: Id;
cancellationWindow: number;
cancellationFee?: Money;
refundPolicy: RefundPolicy;
reschedulePolicy: ReschedulePolicy;
noShowPolicy: NoShowPolicy;
emergencyCancellationAllowed: boolean;
notes?: string;
}
/**
* Reschedule record
*/
export interface RescheduleRecord {
id: Id;
originalDate: Date;
newDate: Date;
reason: string;
requestedBy: UserId;
approvedBy?: UserId;
approvalStatus: ApprovalStatus;
approvalDate?: Date;
notes?: string;
}
/**
* Patient satisfaction survey
*/
export interface PatientSatisfaction {
id: Id;
overallRating: number;
waitTimeRating: number;
doctorRating: number;
nurseRating: number;
facilityRating: number;
communicationRating: number;
treatmentEffectivenessRating: number;
wouldRecommend: boolean;
comments?: string;
surveyDate: Date;
followUpRequired: boolean;
}
/**
* Quality metrics for appointment
*/
export interface QualityMetrics {
id: Id;
waitTime: number;
consultationTime: number;
patientArrivalTime: Date;
doctorArrivalTime: Date;
treatmentEffectiveness: TreatmentEffectiveness;
patientCompliance: PatientCompliance;
followUpCompliance: boolean;
readmissionRisk: ReadmissionRisk;
notes?: string;
}
/**
* Operating hours for location
*/
export interface OperatingHours {
id: Id;
dayOfWeek: DayOfWeek;
openTime: string;
closeTime: string;
isOpen: boolean;
specialHours?: string;
}
/**
* Recurrence pattern for recurring appointments
*/
export interface RecurrencePattern {
id: Id;
frequency: RecurrenceFrequency;
interval: number;
dayOfWeek?: DayOfWeek[];
dayOfMonth?: number[];
endDate?: Date;
maxOccurrences?: number;
exceptions?: Date[];
}
export declare enum AppointmentStatus {
SCHEDULED = "scheduled",
CONFIRMED = "confirmed",
CHECKED_IN = "checked_in",
IN_PROGRESS = "in_progress",
COMPLETED = "completed",
CANCELLED = "cancelled",
NO_SHOW = "no_show",
RESCHEDULED = "rescheduled",
PENDING = "pending",
ON_HOLD = "on_hold"
}
export declare enum AppointmentType {
CONSULTATION = "consultation",
FOLLOW_UP = "follow_up",
EMERGENCY = "emergency",
ROUTINE_CHECKUP = "routine_checkup",
SPECIALIST_VISIT = "specialist_visit",
PROCEDURE = "procedure",
SURGERY = "surgery",
LAB_TEST = "lab_test",
IMAGING = "imaging",
VACCINATION = "vaccination",
PHYSICAL_THERAPY = "physical_therapy",
MENTAL_HEALTH = "mental_health",
DENTAL = "dental",
VISION = "vision",
OTHER = "other"
}
export declare enum SlotType {
REGULAR = "regular",
URGENT = "urgent",
EMERGENCY = "emergency",
WALK_IN = "walk_in",
TELEMEDICINE = "telemedicine",
HOME_VISIT = "home_visit",
SPECIALIST = "specialist",
PROCEDURE = "procedure",
SURGERY = "surgery"
}
export declare enum BookingMethod {
ONLINE = "online",
PHONE = "phone",
IN_PERSON = "in_person",
MOBILE_APP = "mobile_app",
WALK_IN = "walk_in",
REFERRAL = "referral",
EMERGENCY = "emergency"
}
export declare enum LocationType {
HOSPITAL = "hospital",
CLINIC = "clinic",
OFFICE = "office",
URGENT_CARE = "urgent_care",
EMERGENCY_ROOM = "emergency_room",
LABORATORY = "laboratory",
IMAGING_CENTER = "imaging_center",
PHARMACY = "pharmacy",
HOME = "home",
TELEMEDICINE = "telemedicine"
}
export declare enum FacilityType {
HOSPITAL = "hospital",
CLINIC = "clinic",
MEDICAL_OFFICE = "medical_office",
URGENT_CARE = "urgent_care",
EMERGENCY_CENTER = "emergency_center",
LABORATORY = "laboratory",
IMAGING_CENTER = "imaging_center",
SURGERY_CENTER = "surgery_center",
REHABILITATION_CENTER = "rehabilitation_center",
MENTAL_HEALTH_CENTER = "mental_health_center"
}
export declare enum AppointmentInsuranceType {
PRIVATE = "private",
MEDICARE = "medicare",
MEDICAID = "medicaid",
TRICARE = "tricare",
WORKERS_COMPENSATION = "workers_compensation",
AUTO_INSURANCE = "auto_insurance",
OTHER = "other"
}
export declare enum BillingStatus {
PENDING = "pending",
BILLED = "billed",
PAID = "paid",
PARTIALLY_PAID = "partially_paid",
OVERDUE = "overdue",
WRITTEN_OFF = "written_off",
DISPUTED = "disputed"
}
export declare enum AppointmentPaymentMethod {
CASH = "cash",
CHECK = "check",
CREDIT_CARD = "credit_card",
DEBIT_CARD = "debit_card",
BANK_TRANSFER = "bank_transfer",
INSURANCE = "insurance",
PAYMENT_PLAN = "payment_plan"
}
export declare enum ReminderMethod {
EMAIL = "email",
SMS = "sms",
PHONE_CALL = "phone_call",
PUSH_NOTIFICATION = "push_notification",
IN_APP = "in_app",
MAIL = "mail"
}
export declare enum AppointmentContactMethod {
EMAIL = "email",
PHONE = "phone",
SMS = "sms",
MAIL = "mail",
IN_PERSON = "in_person"
}
export declare enum RefundPolicy {
FULL_REFUND = "full_refund",
PARTIAL_REFUND = "partial_refund",
NO_REFUND = "no_refund",
CREDIT_TO_ACCOUNT = "credit_to_account"
}
export declare enum ReschedulePolicy {
FREE_RESCHEDULE = "free_reschedule",
FEE_APPLIED = "fee_applied",
NO_RESCHEDULE = "no_reschedule",
LIMITED_RESCHEDULE = "limited_reschedule"
}
export declare enum NoShowPolicy {
FEE_APPLIED = "fee_applied",
ACCOUNT_SUSPENSION = "account_suspension",
PREPAYMENT_REQUIRED = "prepayment_required",
NO_PENALTY = "no_penalty"
}
export declare enum ApprovalStatus {
PENDING = "pending",
APPROVED = "approved",
REJECTED = "rejected",
CANCELLED = "cancelled"
}
export declare enum TreatmentEffectiveness {
EXCELLENT = "excellent",
GOOD = "good",
FAIR = "fair",
POOR = "poor",
UNKNOWN = "unknown"
}
export declare enum PatientCompliance {
EXCELLENT = "excellent",
GOOD = "good",
FAIR = "fair",
POOR = "poor",
UNKNOWN = "unknown"
}
export declare enum ReadmissionRisk {
LOW = "low",
MEDIUM = "medium",
HIGH = "high",
VERY_HIGH = "very_high"
}
export declare enum RecurrenceFrequency {
DAILY = "daily",
WEEKLY = "weekly",
MONTHLY = "monthly",
YEARLY = "yearly"
}
export declare enum DayOfWeek {
MONDAY = "monday",
TUESDAY = "tuesday",
WEDNESDAY = "wednesday",
THURSDAY = "thursday",
FRIDAY = "friday",
SATURDAY = "saturday",
SUNDAY = "sunday"
}
/**
* Type for creating a new appointment
*/
export type CreateAppointmentRequest = Omit<Appointment, 'id' | 'tenantId' | 'createdAt' | 'updatedAt'>;
/**
* Type for updating an appointment
*/
export type UpdateAppointmentRequest = Partial<Omit<Appointment, 'id' | 'tenantId' | 'createdAt' | 'updatedAt'>>;
/**
* Type for appointment search filters
*/
export interface AppointmentSearchFilters {
patientId?: PatientId;
doctorId?: UserId;
appointmentType?: AppointmentType;
status?: AppointmentStatus;
startDate?: Date;
endDate?: Date;
locationId?: Id;
tags?: string[];
}
/**
* Type for appointment search results
*/
export interface AppointmentSearchResult {
appointments: Appointment[];
totalCount: number;
page: number;
pageSize: number;
}
/**
* Type for appointment statistics
*/
export interface AppointmentStatistics {
totalAppointments: number;
completedAppointments: number;
cancelledAppointments: number;
noShowAppointments: number;
averageWaitTime: number;
patientSatisfactionScore: number;
appointmentsByType: Record<AppointmentType, number>;
appointmentsByStatus: Record<AppointmentStatus, number>;
}
//# sourceMappingURL=Appointment.d.ts.map