12345678910111213141516171819202122232425262728293031323334353637383940 |
- 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"`
- PrescriptionId int32 `json:"prescriptionId"`
- 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(req *pasturePb.CowTreatmentRequest, systemUser *SystemUser) *EventCowTreatment {
- b, _ := json.Marshal(req.PrescriptionDetail)
- return &EventCowTreatment{
- CowId: int64(req.CowId),
- CowDiseaseId: int64(req.Id),
- PrescriptionId: req.PrescriptionId,
- PrescriptionDetail: string(b),
- TreatmentResult: req.TreatmentResult,
- OperationId: systemUser.Id,
- OperationName: systemUser.Name,
- Remarks: req.Remarks,
- }
- }
|