package com.emoon.chat.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 患者病历记录表 (patient_record) 实体类
 * 用于存储患者基本信息、住院信息、诊疗记录及质控状态。
 * </p>
 *
 * @author han
 * @since 2025-12-17
 */
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@TableName("patient_record") // MyBatis-Plus 注解：指定表名
public class PatientRecord implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键 - 雪花ID (字符串主键，非自增)
     */
    @TableId(value = "id", type = IdType.NONE) // 雪花ID由程序生成，不使用数据库自增
    private String id;

    /**
     * 患者ID（病历记录ID）
     */
    @TableField("patient_id")
    private String patientId;

    /**
     * 入院编号
     */
    @TableField("admission_no")
    private String admissionNo;

    /**
     * 就诊ID
     */
    @TableField("visit_id")
    private String visitId;

    /**
     * 患者姓名
     */
    @TableField("name")
    private String name;

    /**
     * 性别
     */
    @TableField("gender")
    private String gender;

    /**
     * 年龄
     */
    @TableField("age")
    private Integer age;

    /**
     * 出生日期
     */
    @TableField("birth_date")
    private LocalDateTime birthDate;

    /**
     * 入院日期
     */
    @TableField("admission_date")
    private LocalDateTime admissionDate;

    /**
     * 出院日期
     */
    @TableField("discharge_date")
    private LocalDateTime dischargeDate;

    /**
     * 入院科室
     */
    @TableField("admission_dept")
    private String admissionDept;

    /**
     * 出院科室
     */
    @TableField("discharge_dept")
    private String dischargeDept;

    /**
     * 主治医生姓名
     */
    @TableField("attending_doctor")
    private String attendingDoctor;

    /**
     * 责任护士姓名
     */
    @TableField("nurse")
    private String nurse;

    /**
     * 入院记录
     */
    @TableField("admission_note")
    private String admissionNote;

    /**
     * 首次病程记录
     */
    @TableField("first_course_record")
    private String firstCourseRecord;
//
//    /**
//     * 查房记录 (JSON 格式)
//     * 示例: [{"date": "2025-01-01", "doctor": "张三", "content": "..."}]
//     */
//    @JsonInclude(JsonInclude.Include.NON_NULL)
//    @TableField("round_records")
//    private String roundRecords;

    /**
     * 手术记录 (JSON 格式)
     * 示例: [{"surgeryName": "阑尾切除术", "date": "2025-01-03", "surgeon": "李四"}]
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @TableField("surgery_records")
    private String surgeryRecords;

    /**
     * 检验报告 (JSON 格式)
     * 示例: [{"testName": "血常规", "result": "正常", "date": "2025-01-02"}]
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @TableField("lab_reports")
    private String labReports;

    /**
     * 检查报告 (JSON 格式)
     * 示例: [{"examName": "CT", "result": "肺部阴影", "date": "2025-01-01"}]
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @TableField("exam_reports")
    private String examReports;

    /**
     * 医嘱记录 (JSON 格式)
     * 示例: [{"order": "静脉滴注", "drug": "头孢", "dosage": "2g", "date": "2025-01-01"}]
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @TableField("orders")
    private String orders;

    /**
     * 出院小结
     */
    @TableField("discharge_summary")
    private String dischargeSummary;

    /**
     * 知情同意书 (JSON 格式)
     * 示例: [{"formType": "手术同意书", "signed": true, "date": "2025-01-03"}]
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @TableField("consent_forms")
    private String consentForms;

    /**
     * 状态: 0 删除, 1 未质控, 2 已质控
     */
    @TableField("status")
    private Integer status;

    /**
     * 入库时间 (默认 CURRENT_TIMESTAMP)
     */
    @TableField("create_date")
    private LocalDateTime createDate;


    /** 病程记录 (JSON) */
    @TableField("course_records")
    private String courseRecords;

    /** 阶段小结 (JSON) */
    @TableField("stage_summary")
    private String stageSummary;

    /** 查房记录 (JSON) */
    @TableField("ward_rounds")
    private String wardRounds;

    /** 会诊记录 (JSON) */
    @TableField("consultation_records")
    private String consultationRecords;

    /** 疑难病例讨论 (JSON) */
    @TableField("difficult_case_discussion")
    private String difficultCaseDiscussion;

    /** 超长住院讨论 (JSON) */
    @TableField("long_stay_discussion")
    private String longStayDiscussion;

    /** 死亡病例讨论 (JSON) */
    @TableField("death_case_discussion")
    private String deathCaseDiscussion;

    /** 抢救记录 (JSON) */
    @TableField("rescue_records")
    private String rescueRecords;



}
