package models

type VmSchedules struct {
	ID           int64 `gorm:"column:id" json:"id" form:"id"`
	UserOrgId    int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
	PartitionId  int64 `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
	BedId        int64 `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
	PatientId    int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
	ScheduleDate int64 `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
	ScheduleType int64 `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
	ScheduleWeek int64 `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
	ModeId       int64 `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
	Status       int64 `gorm:"column:status" json:"status" form:"status"`
	CreatedTime  int64 `gorm:"column:created_time" json:"created_time" form:"created_time"`
	UpdatedTime  int64 `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
	IsExport     int64 `gorm:"column:is_export" json:"is_export" form:"is_export"`

	DeviceZone           DeviceZone             `json:"zone" gorm:"foreignkey:ID;AssociationForeignKey:PartitionId;"`
	DeviceNumber         DeviceNumber           `json:"number" gorm:"foreignkey:ID;AssociationForeignKey:BedId;"`
	DialysisOrder        DialysisOrder          `json:"order" gorm:"foreignkey:DialysisDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId;"`
	XtPatients           XtPatients             `json:"patient" gorm:"foreignkey:ID;AssociationForeignKey:PatientId;"`
	DoctorAdvice         []*DoctorAdvice        `json:"doctoradvice" gorm:"foreignkey:AdviceDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId;"`
	DialysisPrescription DialysisPrescription   `json:"prescription" gorm:"foreignkey:RecordDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId;"`
	HisDoctorAdviceInfo  []*HisDoctorAdviceInfo `json:"hisdoctoradviceinfo" gorm:"foreignkey:AdviceDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId;"`
	DialysisSolution     []*DialysisSolution    `json:"dialysissolution" gorm:"foreignkey:RecordDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId;"`
}

func (VmSchedules) TableName() string {
	return "xt_schedule"
}

type Schedule struct {
	ID           int64 `gorm:"column:id" json:"id" form:"id"`
	UserOrgId    int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
	PartitionId  int64 `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
	BedId        int64 `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
	PatientId    int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
	ScheduleDate int64 `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
	ScheduleType int64 `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
	ScheduleWeek int64 `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
	ModeId       int64 `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
	Status       int64 `gorm:"column:status" json:"status" form:"status"`
	CreatedTime  int64 `gorm:"column:created_time" json:"created_time" form:"created_time"`
	UpdatedTime  int64 `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
	IsExport     int64 `gorm:"column:is_export" json:"is_export" form:"is_export"`

	Patient                   string               `gorm:"-" json:"patient" form:"patient"`
	DeviceZone                DeviceZone           `json:"zone" gorm:"foreignkey:ID;AssociationForeignKey:PartitionId;"`
	DeviceNumber              DeviceNumber         `json:"number" gorm:"foreignkey:ID;AssociationForeignKey:BedId;"`
	TreatmentMode             TreatmentMode        `json:"mode" gorm:"foreignkey:ModeId"`
	DialysisOrder             DialysisOrder        `json:"order" gorm:"foreignkey:DialysisDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId;"`
	DialysisPrescription      DialysisPrescription `json:"dialysis_prescription" gorm:"foreignkey:RecordDate,PatientId;AssociationForeignKey:RecordDate,PatientId;"`
	PatientInfectiousDiseases []InfectiousDiseases `json:"patient_contagions" gorm:"foreignkey:PatientId;AssociationForeignKey:PatientId;"`
}

func (Schedule) TableName() string {
	return "xt_schedule"
}

type SchedulePatients struct {
	ID           int64              `gorm:"column:id" json:"id" form:"id"`
	UserOrgId    int64              `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
	PartitionId  int64              `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
	BedId        int64              `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
	PatientId    int64              `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
	ScheduleDate int64              `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
	ScheduleType int64              `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
	ScheduleWeek int64              `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
	ModeId       int64              `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
	Status       int64              `gorm:"column:status" json:"status" form:"status"`
	CreatedTime  int64              `gorm:"column:created_time" json:"created_time" form:"created_time"`
	UpdatedTime  int64              `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
	IsExport     int64              `gorm:"column:is_export" json:"is_export" form:"is_export"`
	Patient      PatientListForFace `json:"patient" gorm:"foreignkey:ID;AssociationForeignKey:PatientId;"`
}

func (SchedulePatients) TableName() string {
	return "xt_schedule"
}

type PatientSchedule struct {
	Schedule

	DeviceZone   DeviceZone   `json:"zone" gorm:"foreignkey:PartitionId"`
	DeviceNumber DeviceNumber `json:"bed" gorm:"foreignkey:BedId"`

	Week int64 `gorm:"-" json:"week" form:"week"`

	TreatmentMode TreatmentMode `json:"mode" gorm:"foreignkey:ModeId"`
}

type Partition struct {
	DeviceZone

	Jihaos []DeviceNumber `json:"jihaos" gorm:"foreignkey:ZoneID"`
}

type Search_Schedule struct {
	ID           int64 `gorm:"column:id" json:"id" form:"id"`
	UserOrgId    int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
	PartitionId  int64 `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
	BedId        int64 `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
	PatientId    int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
	ScheduleDate int64 `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
	ScheduleType int64 `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
	ScheduleWeek int64 `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
	ModeId       int64 `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
	Status       int64 `gorm:"column:status" json:"status" form:"status"`
	CreatedTime  int64 `gorm:"column:created_time" json:"created_time" form:"created_time"`
	UpdatedTime  int64 `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
	IsExport     int64 `gorm:"column:is_export" json:"is_export" form:"is_export"`

	Patient string `gorm:"-" json:"patient" form:"patient"`
}

func (Search_Schedule) TableName() string {
	return "xt_schedule"
}

type WeekSchedule struct {
	ID           int64 `gorm:"column:id" json:"id" form:"id"`
	UserOrgId    int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
	PartitionId  int64 `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
	BedId        int64 `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
	PatientId    int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
	ScheduleDate int64 `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
	ScheduleType int64 `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
	ScheduleWeek int64 `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
	ModeId       int64 `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
	Status       int64 `gorm:"column:status" json:"status" form:"status"`
	CreatedTime  int64 `gorm:"column:created_time" json:"created_time" form:"created_time"`
	UpdatedTime  int64 `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
	IsExport     int64 `gorm:"column:is_export" json:"is_export" form:"is_export"`

	Patient                    string                     `gorm:"-" json:"patient" form:"patient"`
	DeviceZone                 DeviceZone                 `json:"zone" gorm:"foreignkey:ID;AssociationForeignKey:PartitionId;"`
	DeviceNumber               DeviceNumber               `json:"number" gorm:"foreignkey:ID;AssociationForeignKey:BedId;"`
	DialysisPrescription       DialysisSolution           `json:"prescription" gorm:"foreignkey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId"`
	DoctorAdvice               []*DoctorAdvice            `json:"doctoradvice" gorm:"foreignkey:AdviceDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId;"`
	HisDoctorAdviceInfo        []*HisDoctorAdviceInfo     `json:"hisdoctoradviceinfo" gorm:"foreignkey:AdviceDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId;"`
	Solution                   []*DialysisSolution        `json:"solution" gorm:"foreignkey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId"`
	DialysisSolution           DialysisSolution           `json:"dialysissolution" gorm:"foreignkey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId"`
	XtAssessmentBeforeDislysis XtAssessmentBeforeDislysis `json:"assessmentbefor" gorm:"foreignkey:PatientId,AssessmentDate;AssociationForeignKey:PatientId,ScheduleDate"`
}

func (WeekSchedule) TableName() string {
	return "xt_schedule"
}

type ScheduleTemplate struct {
	ID         int64 `gorm:"column:id" json:"id" form:"id"`
	UserOrgId  int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
	TemplateId int64 `gorm:"column:template_id" json:"template_id" form:"template_id"`
	Status     int64 `gorm:"column:status" json:"status" form:"status"`
	Ctime      int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
	Mtime      int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
}

func (ScheduleTemplate) TableName() string {
	return "xt_schedule_template"
}

type XtDataPrint struct {
	ID        int64 `gorm:"column:id" json:"id" form:"id"`
	IsOpen    int64 `gorm:"column:is_open" json:"is_open" form:"is_open"`
	Status    int64 `gorm:"column:status" json:"status" form:"status"`
	UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
	Ctime     int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
	Mtime     int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
}

func (XtDataPrint) TableName() string {
	return "xt_data_print"
}

type VmSchedulesRemind struct {
	ID           int64 `gorm:"column:id" json:"id" form:"id"`
	UserOrgId    int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
	PartitionId  int64 `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
	BedId        int64 `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
	PatientId    int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
	ScheduleDate int64 `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
	ScheduleType int64 `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
	ScheduleWeek int64 `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
	ModeId       int64 `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
	Status       int64 `gorm:"column:status" json:"status" form:"status"`
	CreatedTime  int64 `gorm:"column:created_time" json:"created_time" form:"created_time"`
	UpdatedTime  int64 `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
	IsExport     int64 `gorm:"column:is_export" json:"is_export" form:"is_export"`

	DeviceZone                 DeviceZone                 `json:"zone" gorm:"foreignkey:ID;AssociationForeignKey:PartitionId;"`
	DeviceNumber               DeviceNumber               `json:"number" gorm:"foreignkey:ID;AssociationForeignKey:BedId;"`
	DialysisOrder              DialysisOrder              `json:"order" gorm:"foreignkey:PatientId;AssociationForeignKey:PatientId;"`
	XtPatients                 XtPatients                 `json:"patient" gorm:"foreignkey:ID;AssociationForeignKey:PatientId;"`
	DoctorAdvice               []*DoctorAdvice            `json:"doctoradvice" gorm:"foreignkey:PatientId;AssociationForeignKey:PatientId;"`
	DialysisPrescription       DialysisPrescription       `json:"prescription" gorm:"foreignkey:PatientId;AssociationForeignKey:PatientId;"`
	HisDoctorAdviceInfo        []*HisDoctorAdviceInfo     `json:"hisdoctoradviceinfo" gorm:"foreignkey:PatientId;AssociationForeignKey:PatientId;"`
	DialysisSolution           DialysisSolution           `json:"dialysissolution" gorm:"foreignkey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId;"`
	XtAssessmentBeforeDislysis XtAssessmentBeforeDislysis `json:"assessmentbefor" gorm:"foreignkey:PatientId;AssociationForeignKey:PatientId;"`
	LastAfterWeight            AssessmentAfterDislysis    `gorm:"ForeignKey:PatientID;AssociationForeignKey:PatientID" json:"lastafterweight"`
}

func (VmSchedulesRemind) TableName() string {
	return "xt_schedule"
}

type WeekScheduleSix struct {
	ID           int64 `gorm:"column:id" json:"id" form:"id"`
	UserOrgId    int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
	PartitionId  int64 `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
	BedId        int64 `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
	PatientId    int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
	ScheduleDate int64 `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
	ScheduleType int64 `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
	ScheduleWeek int64 `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
	ModeId       int64 `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
	Status       int64 `gorm:"column:status" json:"status" form:"status"`
	CreatedTime  int64 `gorm:"column:created_time" json:"created_time" form:"created_time"`
	UpdatedTime  int64 `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
	IsExport     int64 `gorm:"column:is_export" json:"is_export" form:"is_export"`

	Patient                    string                     `gorm:"-" json:"patient" form:"patient"`
	DeviceZone                 DeviceZone                 `json:"zone" gorm:"foreignkey:ID;AssociationForeignKey:PartitionId;"`
	DeviceNumber               DeviceNumber               `json:"number" gorm:"foreignkey:ID;AssociationForeignKey:BedId;"`
	DialysisPrescription       DialysisSolution           `json:"prescription" gorm:"foreignkey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId"`
	DoctorAdvice               []*DoctorAdvice            `json:"doctoradvice" gorm:"foreignkey:AdviceDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId;"`
	HisDoctorAdviceInfo        []*HisDoctorAdviceInfo     `json:"hisdoctoradviceinfo" gorm:"foreignkey:AdviceDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId;"`
	DialysisSolution           DialysisSolution           `json:"dialysissolution" gorm:"foreignkey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId"`
	XtAssessmentBeforeDislysis XtAssessmentBeforeDislysis `json:"assessmentbefor" gorm:"foreignkey:PatientId,AssessmentDate;AssociationForeignKey:PatientId,ScheduleDate"`
}

func (WeekScheduleSix) TableName() string {
	return "xt_schedule"
}

type BlodSchedule struct {
	ID                        int64                     `gorm:"column:id" json:"id" form:"id"`
	UserOrgId                 int64                     `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
	PartitionId               int64                     `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
	BedId                     int64                     `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
	PatientId                 int64                     `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
	ScheduleDate              int64                     `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
	ScheduleType              int64                     `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
	ScheduleWeek              int64                     `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
	ModeId                    int64                     `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
	Status                    int64                     `gorm:"column:status" json:"status" form:"status"`
	VmBloodPatients           VmBloodPatients           `json:"patient" gorm:"foreignkey:ID;AssociationForeignKey:PatientId;"`
	BloodDialysisOrder        BloodPatientDialysisOrder `json:"order" gorm:"foreignkey:DialysisDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId;"`
	BloodDialysisPrescription BloodDialysisPrescription `json:"prescription" gorm:"foreignkey:RecordDate,PatientId;AssociationForeignKey:RecordDate,PatientId;"`
}

func (BlodSchedule) TableName() string {
	return "xt_schedule"
}

type BloodPatientDialysisOrder struct {
	ID           int64 `gorm:"column:id" json:"id" form:"id"`
	DialysisDate int64 `gorm:"column:dialysis_date" json:"dialysis_date" form:"dialysis_date"`
	PatientId    int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
	Stage        int64 `gorm:"column:stage" json:"stage" form:"stage"`
	BedId        int64 `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
}

func (BloodPatientDialysisOrder) TableName() string {
	return "xt_dialysis_order"
}

type BloodPatientDialysisPrescription struct {
	ID                         int64  `gorm:"column:id" json:"id" form:"id"`
	PatientId                  int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
	MachineType                string `gorm:"column:machine_type" json:"machine_type" form:"machine_type"`
	ModeId                     int64  `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
	DialysisDialyszers         string `gorm:"column:dialysis_dialyszers" json:"dialysis_dialyszers" form:"dialysis_dialyszers"`
	DialysisIrrigation         string `gorm:"column:dialysis_irrigation" json:"dialysis_irrigation" form:"dialysis_irrigation"`
	DialyzerPerfusionApparatus string `gorm:"column:dialyzer_perfusion_apparatus" json:"dialyzer_perfusion_apparatus" form:"dialyzer_perfusion_apparatus"`
}

func (BloodPatientDialysisPrescription) TableName() string {
	return "xt_dialysis_prescription"
}

type VmBloodPatients struct {
	ID    int64  `gorm:"column:id" json:"id" form:"id"`
	BedId int64  `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
	Name  string `gorm:"column:name" json:"name" form:"name"`
}

func (VmBloodPatients) TableName() string {
	return "xt_patients"
}
