1use chrono::NaiveDateTime;
2use common::utils::serialize_option_naive_date;
3use postgres_types::{FromSql, ToSql};
4use serde::{Deserialize, Serialize};
5
6#[derive(Serialize, Deserialize, Debug, Clone, FromSql, ToSql)]
7#[serde(rename_all = "camelCase")]
8pub struct Allergy {
9 pub allergy: String,
10 pub doctor_diagnosed: bool,
11 pub anaphylaxis: bool,
12 pub hospitalised_allergy: bool,
13 pub hospital_allergy: Option<String>,
14 pub plan_anaphylaxis: bool,
15 pub plan_anaphylaxis_file: Option<String>,
16 pub adrenaline_prescribed: bool,
17 #[serde(default)]
18 #[serde(with = "serialize_option_naive_date")]
19 pub expiry_date_adrenaline: Option<NaiveDateTime>,
20 pub plan_allergic: bool,
21 pub plan_allergic_file: Option<String>,
22 pub other_medication: Option<String>,
23 pub key: i32,
24}