Skip to content

domain ​

go
import "github.com/prescriptoo/prescriptoo-api/services/prescription/internal/domain"

Package domain contains core business entities for the prescription service.

Index ​

Variables ​

Prescription errors identify invalid data and unavailable lifecycle operations.

go
var (
    ErrPrescriptionNotFound      = errors.New("prescription not found")
    ErrPrescriptionAlreadyExists = errors.New("prescription already exists")
    ErrInvalidPrescription       = errors.New("invalid prescription data")
    ErrPrescriptionNotDraft      = errors.New("prescription can only be edited in draft status")
)

type Prescription ​

Prescription represents a medical prescription entity. Prescriptions are OWNED by doctors, not organizations. OrganizationID is the CONTEXT (which org was it created for).

go
type Prescription struct {
    ID             string             `json:"id"`
    DoctorID       string             `json:"doctor_id"`
    OrganizationID string             `json:"organization_id"`
    PatientName    string             `json:"patient_name"`
    PatientAge     int                `json:"patient_age"`
    PatientGender  string             `json:"patient_gender"`
    Diagnosis      string             `json:"diagnosis"`
    Notes          string             `json:"notes"`
    Status         PrescriptionStatus `json:"status"`
    IssuedAt       *time.Time         `json:"issued_at,omitempty"`
    CreatedAt      time.Time          `json:"created_at"`
    UpdatedAt      time.Time          `json:"updated_at"`
}

type PrescriptionItem ​

PrescriptionItem represents a medication line item in a prescription.

go
type PrescriptionItem struct {
    ID             string `json:"id"`
    PrescriptionID string `json:"prescription_id"`
    MedicationName string `json:"medication_name"`
    Dosage         string `json:"dosage"`
    Frequency      string `json:"frequency"`
    Duration       string `json:"duration"`
    Instructions   string `json:"instructions"`
    Quantity       int    `json:"quantity"`
}

type PrescriptionStatus ​

PrescriptionStatus represents the state of a prescription.

go
type PrescriptionStatus string

Supported prescription lifecycle states.

go
const (
    PrescriptionStatusDraft    PrescriptionStatus = "draft"
    PrescriptionStatusIssued   PrescriptionStatus = "issued"
    PrescriptionStatusCanceled PrescriptionStatus = "canceled"
)

type SuggestionAdvice ​

SuggestionAdvice is a globally shared advice phrase for prescription generation.

go
type SuggestionAdvice struct {
    ID, Label string
}

type SuggestionDiagnosis ​

SuggestionDiagnosis is a globally shared diagnosis phrase for prescription generation.

go
type SuggestionDiagnosis struct {
    ID, Label string
}

type SuggestionInvestigation ​

SuggestionInvestigation is a globally shared investigation phrase for prescription generation.

go
type SuggestionInvestigation struct {
    ID, Label string
}

type SuggestionQuery ​

SuggestionQuery contains shared search and pagination parameters, not a catalog entity.

go
type SuggestionQuery struct {
    Q, AfterLabel, AfterID string
    Limit                  int
}

Generated by gomarkdoc

Documentation follows the source. Planned contracts are marked explicitly.