UNPKG

emr-types

Version:

Comprehensive TypeScript Types Library for Electronic Medical Record (EMR) Applications - Domain-Driven Design with Zod Validation

638 lines 15.1 kB
import { NoteEntry, Attachment } from '../../shared/entities/BaseEntity'; import { Id } from '../../shared/value-objects/Id'; import { Timestamp } from '../../shared/value-objects/Timestamp'; 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 { PatientId } from '../value-objects/PatientId'; import { TenantId } from '../../tenant/value-objects/TenantId'; import { UserId } from '../../user/value-objects/UserId'; import { PatientStatus } from '../enums/PatientStatus'; /** * Core Patient entity representing a patient in the EMR system */ export interface Patient { id: PatientId; tenantId: TenantId; createdAt: Date; updatedAt: Date; createdBy: UserId; updatedBy: UserId; createdFromIp?: string; updatedFromIp?: string; createdUserAgent?: string; updatedUserAgent?: string; status: PatientStatus; statusChangedAt?: Date; statusChangedBy?: UserId; statusChangeReason?: string; tags?: string[]; categories?: string[]; labels?: Record<string, string>; notes?: string; internalNotes?: string; notesHistory?: NoteEntry[]; attachments?: Attachment[]; patientCode: string; firstName: string; lastName: string; middleName?: string; dateOfBirth: Date; gender: Gender; bloodType?: BloodType; height?: number; weight?: number; bmi?: number; email?: Email; phoneNumber?: PhoneNumber; emergencyContact?: EmergencyContact; address?: Address; allergies: Allergy[]; chronicConditions: ChronicCondition[]; currentMedications: CurrentMedication[]; insuranceInfo?: InsuranceInfo; assignedDoctorId?: UserId; assignedNurseId?: UserId; patientGroup?: string; billingInfo?: BillingInfo; paymentMethod?: PaymentMethod; privacySettings: PrivacySettings; consentRecords: ConsentRecord[]; preferences: PatientPreferences; } /** * Patient profile with detailed demographic and personal information */ export interface PatientProfile { patientId: PatientId; createdAt: Date; updatedAt: Date; createdBy: UserId; updatedBy: UserId; nationality?: string; ethnicity?: string; language: string[]; religion?: string; maritalStatus?: MaritalStatus; occupation?: string; employer?: string; workPhone?: PhoneNumber; spouseName?: string; spousePhone?: PhoneNumber; children: Child[]; guardian?: Guardian; smokingStatus: SmokingStatus; alcoholConsumption: AlcoholConsumption; exerciseFrequency: ExerciseFrequency; dietRestrictions: string[]; emergencyContacts: EmergencyContact[]; primaryInsurance?: InsuranceInfo; secondaryInsurance?: InsuranceInfo; communicationPreferences: CommunicationPreferences; appointmentPreferences: AppointmentPreferences; } /** * Comprehensive medical history for a patient */ export interface MedicalHistory { patientId: PatientId; createdAt: Date; updatedAt: Date; createdBy: UserId; updatedBy: UserId; familyHistory: FamilyHistoryItem[]; pastMedicalConditions: PastMedicalCondition[]; pastSurgeries: PastSurgery[]; pastHospitalizations: PastHospitalization[]; currentSymptoms: CurrentSymptom[]; vitalSigns: VitalSigns[]; medicationHistory: MedicationHistoryItem[]; medicationAllergies: MedicationAllergy[]; immunizations: Immunization[]; labResults: LabResult[]; imagingResults: ImagingResult[]; socialHistory: SocialHistory; } /** * Emergency contact information */ export interface EmergencyContact { name: string; relationship: string; phoneNumber: PhoneNumber; email?: Email; address?: Address; isPrimary: boolean; canMakeMedicalDecisions: boolean; } /** * Allergy information */ export interface Allergy { id: Id; allergen: string; severity: AllergySeverity; reaction: string; onsetDate?: Date; isActive: boolean; notes?: string; } /** * Chronic condition information */ export interface ChronicCondition { id: Id; condition: string; diagnosisDate?: Date; severity: ConditionSeverity; isControlled: boolean; medications: string[]; notes?: string; } /** * Current medication information */ export interface CurrentMedication { id: Id; medicationName: string; dosage: string; frequency: string; startDate: Date; endDate?: Date; prescribedBy: UserId; pharmacy?: string; notes?: string; isActive: boolean; } /** * Insurance information */ export interface InsuranceInfo { id: Id; insuranceType: InsuranceType; providerName: string; policyNumber: string; groupNumber?: string; subscriberName: string; relationshipToPatient: string; effectiveDate: Date; expirationDate?: Date; copayAmount?: Money; deductibleAmount?: Money; coveragePercentage?: number; notes?: string; } /** * Billing information */ export interface BillingInfo { id: Id; billingAddress: Address; preferredPaymentMethod: PaymentMethod; autoPayEnabled: boolean; paymentPlan?: PaymentPlan; outstandingBalance: Money; creditLimit?: Money; } /** * Payment method information */ export interface PaymentMethod { id: Id; type: PaymentMethodType; cardNumber?: string; cardType?: CardType; expiryDate?: Date; billingAddress: Address; isDefault: boolean; isActive: boolean; } /** * Privacy settings for patient data */ export interface PrivacySettings { id: Id; dataSharingConsent: boolean; marketingConsent: boolean; researchConsent: boolean; emergencyContactSharing: boolean; familyMemberAccess: boolean; thirdPartyAccess: boolean; dataRetentionPeriod: number; } /** * Consent record for medical procedures */ export interface ConsentRecord { id: Id; procedureName: string; consentType: ConsentType; consentDate: Date; expiresDate?: Date; isActive: boolean; signedBy: string; witnessName?: string; notes?: string; } /** * Patient preferences */ export interface PatientPreferences { id: Id; appointmentReminders: boolean; emailNotifications: boolean; smsNotifications: boolean; preferredContactMethod: ContactMethod; preferredLanguage: string; accessibilityNeeds: string[]; dietaryRestrictions: string[]; religiousConsiderations: string[]; } /** * Child information for family history */ export interface Child { id: Id; name: string; dateOfBirth: Date; gender: Gender; healthConditions: string[]; } /** * Guardian information */ export interface Guardian { id: Id; name: string; relationship: string; phoneNumber: PhoneNumber; email?: Email; address: Address; legalAuthority: string; effectiveDate: Date; expirationDate?: Date; } /** * Family history item */ export interface FamilyHistoryItem { id: Id; relative: string; condition: string; ageAtOnset?: number; isDeceased: boolean; notes?: string; } /** * Past medical condition */ export interface PastMedicalCondition { id: Id; condition: string; diagnosisDate: Date; resolutionDate?: Date; severity: ConditionSeverity; treatment: string; outcome: string; notes?: string; } /** * Past surgery information */ export interface PastSurgery { id: Id; procedureName: string; surgeryDate: Date; surgeon: string; hospital: string; complications?: string; outcome: string; notes?: string; } /** * Past hospitalization */ export interface PastHospitalization { id: Id; reason: string; admissionDate: Date; dischargeDate: Date; hospital: string; attendingPhysician: string; diagnosis: string; treatment: string; outcome: string; notes?: string; } /** * Current symptom */ export interface CurrentSymptom { id: Id; symptom: string; onsetDate: Date; severity: SymptomSeverity; frequency: string; triggers?: string[]; notes?: string; } /** * Vital signs record */ export interface VitalSigns { id: Id; dateTime: Timestamp; temperature?: number; bloodPressure?: { systolic: number; diastolic: number; }; heartRate?: number; respiratoryRate?: number; oxygenSaturation?: number; height?: number; weight?: number; bmi?: number; notes?: string; } /** * Medication history item */ export interface MedicationHistoryItem { id: Id; medicationName: string; dosage: string; frequency: string; startDate: Date; endDate?: Date; reason: string; effectiveness: string; sideEffects?: string[]; notes?: string; } /** * Medication allergy */ export interface MedicationAllergy { id: Id; medicationName: string; reaction: string; severity: AllergySeverity; onsetDate: Date; isActive: boolean; notes?: string; } /** * Immunization record */ export interface Immunization { id: Id; vaccineName: string; administrationDate: Date; nextDueDate?: Date; lotNumber?: string; administeredBy: string; location: string; notes?: string; } /** * Lab result */ export interface LabResult { id: Id; testName: string; testDate: Date; result: string; normalRange?: string; units?: string; isAbnormal: boolean; orderingPhysician: string; lab: string; notes?: string; } /** * Imaging result */ export interface ImagingResult { id: Id; imagingType: string; studyDate: Date; report: string; radiologist: string; facility: string; isAbnormal: boolean; followUpRequired: boolean; notes?: string; } /** * Social history */ export interface SocialHistory { id: Id; occupation: string; education: string; livingSituation: string; supportSystem: string; hobbies: string[]; travelHistory: string[]; exposureHistory: string[]; notes?: string; } /** * Communication preferences */ export interface CommunicationPreferences { id: Id; preferredLanguage: string; interpreterNeeded: boolean; hearingImpaired: boolean; visuallyImpaired: boolean; communicationBarriers: string[]; preferredContactMethod: ContactMethod; preferredContactTime: string; } /** * Appointment preferences */ export interface AppointmentPreferences { id: Id; preferredDays: string[]; preferredTimes: string[]; preferredLocation: string; preferredProvider?: UserId; reminderPreferences: ReminderPreferences; cancellationPolicy: string; } /** * Reminder preferences */ export interface ReminderPreferences { id: Id; appointmentReminders: boolean; medicationReminders: boolean; followUpReminders: boolean; reminderAdvanceTime: number; reminderMethod: ContactMethod[]; } /** * Payment plan */ export interface PaymentPlan { id: Id; planName: string; monthlyPayment: Money; totalAmount: Money; startDate: Date; endDate: Date; remainingBalance: Money; isActive: boolean; } export declare enum Gender { MALE = "male", FEMALE = "female", OTHER = "other", PREFER_NOT_TO_SAY = "prefer_not_to_say" } export declare enum BloodType { A_POSITIVE = "A+", A_NEGATIVE = "A-", B_POSITIVE = "B+", B_NEGATIVE = "B-", AB_POSITIVE = "AB+", AB_NEGATIVE = "AB-", O_POSITIVE = "O+", O_NEGATIVE = "O-" } export declare enum MaritalStatus { SINGLE = "single", MARRIED = "married", DIVORCED = "divorced", WIDOWED = "widowed", SEPARATED = "separated", CIVIL_PARTNERSHIP = "civil_partnership" } export declare enum SmokingStatus { NEVER_SMOKED = "never_smoked", FORMER_SMOKER = "former_smoker", CURRENT_SMOKER = "current_smoker", OCCASIONAL_SMOKER = "occasional_smoker" } export declare enum AlcoholConsumption { NONE = "none", OCCASIONAL = "occasional", MODERATE = "moderate", HEAVY = "heavy", FORMER_DRINKER = "former_drinker" } export declare enum ExerciseFrequency { NEVER = "never", RARELY = "rarely", OCCASIONALLY = "occasionally", REGULARLY = "regularly", DAILY = "daily" } export declare enum AllergySeverity { MILD = "mild", MODERATE = "moderate", SEVERE = "severe", LIFE_THREATENING = "life_threatening" } export declare enum ConditionSeverity { MILD = "mild", MODERATE = "moderate", SEVERE = "severe", CRITICAL = "critical" } export declare enum SymptomSeverity { MILD = "mild", MODERATE = "moderate", SEVERE = "severe", DEBILITATING = "debilitating" } export declare enum InsuranceType { PRIVATE = "private", MEDICARE = "medicare", MEDICAID = "medicaid", TRICARE = "tricare", WORKERS_COMPENSATION = "workers_compensation", AUTO_INSURANCE = "auto_insurance", OTHER = "other" } export declare enum PaymentMethodType { CREDIT_CARD = "credit_card", DEBIT_CARD = "debit_card", BANK_TRANSFER = "bank_transfer", CASH = "cash", CHECK = "check", INSURANCE = "insurance", PAYMENT_PLAN = "payment_plan" } export declare enum CardType { VISA = "visa", MASTERCARD = "mastercard", AMEX = "amex", DISCOVER = "discover", OTHER = "other" } export declare enum ConsentType { INFORMED_CONSENT = "informed_consent", SURGICAL_CONSENT = "surgical_consent", ANESTHESIA_CONSENT = "anesthesia_consent", RESEARCH_CONSENT = "research_consent", DATA_SHARING_CONSENT = "data_sharing_consent" } export declare enum ContactMethod { EMAIL = "email", PHONE = "phone", SMS = "sms", MAIL = "mail", IN_PERSON = "in_person" } /** * Type for creating a new patient */ export type CreatePatientRequest = Omit<Patient, 'id' | 'tenantId' | 'createdAt' | 'updatedAt'>; /** * Type for updating a patient */ export type UpdatePatientRequest = Partial<Omit<Patient, 'id' | 'tenantId' | 'createdAt' | 'updatedAt'>>; /** * Type for patient search filters */ export interface PatientSearchFilters { firstName?: string; lastName?: string; patientCode?: string; dateOfBirth?: Date; gender?: Gender; bloodType?: BloodType; assignedDoctorId?: UserId; status?: string; tags?: string[]; } /** * Type for patient search results */ export interface PatientSearchResult { patients: Patient[]; totalCount: number; page: number; pageSize: number; } /** * Type for patient statistics */ export interface PatientStatistics { totalPatients: number; activePatients: number; newPatientsThisMonth: number; patientsByGender: Record<Gender, number>; patientsByBloodType: Record<BloodType, number>; averageAge: number; topConditions: Array<{ condition: string; count: number; }>; } //# sourceMappingURL=Patient.d.ts.map