12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- package model
- import (
- "encoding/json"
- pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
- )
- type EventCowTreatment struct {
- Id int64 `json:"id"`
- CowId int64 `json:"cowId"`
- CowDiseaseId int64 `json:"cowDiseaseId"`
- DiseaseId int64 `json:"diseaseId"`
- DiseaseName string `json:"diseaseName"`
- PrescriptionId int32 `json:"prescriptionId"`
- PrescriptionName string `json:"prescriptionName"`
- PrescriptionDetail string `json:"prescriptionDetail"`
- TreatmentResult pasturePb.TreatmentResult_Kind `json:"treatmentResult"`
- OperationId int64 `json:"operationId"`
- OperationName string `json:"operationName"`
- Remarks string `json:"remarks"`
- TreatmentAt int64 `json:"treatmentAt"`
- CreatedAt int64 `json:"createdAt"`
- UpdatedAt int64 `json:"updatedAt"`
- }
- func (e *EventCowTreatment) TableName() string {
- return "event_cow_treatment"
- }
- func NewEventCowTreatment(prescription *Prescription, req *pasturePb.CowTreatmentRequest, operation *SystemUser) *EventCowTreatment {
- b, _ := json.Marshal(req.PrescriptionDetail)
- return &EventCowTreatment{
- CowId: int64(req.CowId),
- CowDiseaseId: int64(req.Id),
- DiseaseId: int64(req.DiseaseId),
- DiseaseName: req.DiseaseName,
- PrescriptionId: req.PrescriptionId,
- PrescriptionName: prescription.Name,
- PrescriptionDetail: string(b),
- TreatmentResult: req.TreatmentResult,
- OperationId: operation.Id,
- OperationName: operation.Name,
- Remarks: req.Remarks,
- }
- }
|