domain
import "github.com/prescriptoo/prescriptoo-api/services/prescription/internal/domain"Package domain contains core business entities for the prescription service.
Index
- Variables
- type Prescription
- type PrescriptionItem
- type PrescriptionStatus
- type SuggestionAdvice
- type SuggestionDiagnosis
- type SuggestionInvestigation
- type SuggestionQuery
Variables
Prescription errors identify invalid data and unavailable lifecycle operations.
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).
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.
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.
type PrescriptionStatus stringSupported prescription lifecycle states.
const (
PrescriptionStatusDraft PrescriptionStatus = "draft"
PrescriptionStatusIssued PrescriptionStatus = "issued"
PrescriptionStatusCanceled PrescriptionStatus = "canceled"
)type SuggestionAdvice
SuggestionAdvice is a globally shared advice phrase for prescription generation.
type SuggestionAdvice struct {
ID, Label string
}type SuggestionDiagnosis
SuggestionDiagnosis is a globally shared diagnosis phrase for prescription generation.
type SuggestionDiagnosis struct {
ID, Label string
}type SuggestionInvestigation
SuggestionInvestigation is a globally shared investigation phrase for prescription generation.
type SuggestionInvestigation struct {
ID, Label string
}type SuggestionQuery
SuggestionQuery contains shared search and pagination parameters, not a catalog entity.
type SuggestionQuery struct {
Q, AfterLabel, AfterID string
Limit int
}Generated by gomarkdoc