waybill.go 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. package model
  2. import (
  3. model2 "cold-delivery/common/model"
  4. "database/sql/driver"
  5. "encoding/json"
  6. )
  7. // // 1未确定订单 2待审核订单 3已审核订单 4待配送 5已配送 6已签收 7已拒收
  8. var (
  9. WaybillStatusWaitDelivery = 1 // 未确定订单
  10. WaybillStatusAudits = 2 // 待审核订单
  11. WaybillStatusInDeliverys = 3 // 待配送
  12. WaybillStatusInShippeds = 4 // 配送中
  13. WaybillStatusReceipts = 5 // 已签收
  14. WaybillStatusRejections = 6 // 已拒收
  15. WaybillStatusoverrule = 7 // 已驳回
  16. WaybillStatusCancel = 8 // 取消订单
  17. WaybillStatusMap = map[int]string{
  18. WaybillStatusWaitDelivery: "未确定订单",
  19. WaybillStatusAudits: "待审核订单",
  20. WaybillStatusInDeliverys: "待配送",
  21. WaybillStatusInShippeds: "配送中",
  22. WaybillStatusReceipts: "已签收",
  23. WaybillStatusRejections: "已拒收",
  24. WaybillStatusoverrule: "已驳回",
  25. WaybillStatusCancel: "取消订单",
  26. }
  27. )
  28. //var (
  29. // WaybillStatusWaitDelivery = 1 // 已下单
  30. // WaybillStatusInDelivery = 2 // 配送中
  31. //
  32. // WaybillStatusReceipt = 3 // 已签收
  33. // WaybillStatusRejection = 4 // 已拒收
  34. // WaybillStatusMap = map[int]string{
  35. // WaybillStatusWaitDelivery: "已下单",
  36. // WaybillStatusInDelivery: "配送中",
  37. // WaybillStatusReceipt: "已签收",
  38. // WaybillStatusRejection: "已拒收",
  39. // }
  40. //)
  41. // 运单短信发送日志
  42. type WaybillSendLog struct {
  43. Phone string `json:"phone"`
  44. Content string `json:"content"`
  45. }
  46. func (e WaybillSendLog) Value() (driver.Value, error) {
  47. d, err := json.Marshal(e)
  48. return string(d), err
  49. }
  50. func (e *WaybillSendLog) Scan(src interface{}) error {
  51. return json.Unmarshal(src.([]byte), e)
  52. }
  53. type IceRaftCode []string
  54. func (e IceRaftCode) Value() (driver.Value, error) {
  55. d, err := json.Marshal(e)
  56. return string(d), err
  57. }
  58. func (e *IceRaftCode) Scan(src interface{}) error {
  59. return json.Unmarshal(src.([]byte), e)
  60. }
  61. // 运单
  62. type Waybill struct {
  63. model2.Model
  64. WaybillNo string `json:"waybillNo" gorm:"size:128"` // 单号
  65. OrderNo string `json:"orderNo" gorm:"size:128"` // 订单号
  66. Status int `json:"status" gorm:"size:128"` // 订单状态:1未确定订单 2已确定订单 3待审核订单 4审核完成 5待配送 6已配送 7已签收 8已拒收
  67. SenderAddressDetails string `json:"senderAddressDetails" gorm:"size:128"` // 发货地址详情
  68. SenderAddressName string `json:"senderAddressName" gorm:"size:128"` // 发货地址名称
  69. SenderAddressPhone string `json:"senderAddressPhone" gorm:"size:128"` // 发货地址电话
  70. ConsigneeAddressDetails string `json:"consigneeAddressDetails" gorm:"size:128"` // 收发货地址详情
  71. ConsigneeAddressName string `json:"consigneeAddressName" gorm:"size:128"` // 收发货地址名称
  72. ConsigneeAddressPhone string `json:"consigneeAddressPhone" gorm:"size:128"` // 收发货地址电话
  73. DeliveryName string `json:"deliveryName" gorm:"size:128"` // 配送人名称
  74. DeliveryPhone string `json:"deliveryPhone" gorm:"size:128"` // 配送人电话
  75. DeliveryId int `json:"deliveryId" gorm:"size:128"` // 配送人id
  76. ReCheckId int `json:"reCheckId" gorm:"size:128"` // 复核id
  77. Remark string `json:"remark" gorm:"size:text"` // 运输备注
  78. OrderTime model2.Time `json:"orderTime" gorm:"size:128"` // 下单时间
  79. DeliveryTime model2.Time `json:"deliveryTime" gorm:"size:128"` // 配送时间
  80. DeliveryDuration int `json:"deliveryDuration" gorm:"size:128;comment:冷冻时长"` // 配送耗时 单位分钟
  81. ReceiptTime model2.Time `json:"receiptTime" gorm:"size:128"` // 签收时间
  82. Quantity int `json:"quantity" gorm:"size:128"` // 药品数量
  83. CoolerBoxId int `json:"coolerBoxId" gorm:"size:128"` // 保温箱id
  84. ReceiptImg string `json:"receiptImg" gorm:"size:text"` // 签收图片
  85. Receiptsign string `json:"receiptsign" gorm:"size:text"` // 签收图片签字
  86. TamperProofLabel string `json:"tamperProofLabel" gorm:"size:128"` // 防拆标签
  87. TamperProofLabelImg string `json:"tamperProofLabelImg" gorm:"size:text"` // 防拆标签
  88. RejectionReason string `json:"rejectionReason" gorm:"size:128"` // 拒收原因
  89. SendLog WaybillSendLog `json:"sendLog" gorm:"size:text"` // 运单短信发送日志
  90. CoolerBox CoolerBoxOmit `json:"coolerBox" gorm:"->"` // 保温箱
  91. Dept SysDeptOmit `json:"dept" gorm:"->"` // 部门
  92. Delivery SysUserOmit `json:"delivery" gorm:"->"` // 部门
  93. ReCheck SysUserOmit `json:"reCheck" gorm:"->"` // 部门
  94. Drugs []Drug `json:"drugs" gorm:"-"` // 药品信息
  95. ChildWaybills model2.StringList `json:"childWaybills"` // 子运单编号
  96. IceRaftCode IceRaftCode `json:"iceRaftCode" gorm:"size:text"`
  97. AssessStar int `json:"assessStar" gorm:"size:128"` // 评价星星
  98. AssessContent string `json:"assessContent" gorm:"size:128"` // 评价内容
  99. PrescriptionIsAudit int `json:"prescriptionIssue" gorm:"size:128;default:1"` // 处方是否审核 1 未审核 2已审核
  100. InvoiceIsAudit int `json:"invoiceIssue" gorm:"size:128;default:1"` // 发票是否审核 1 未审核 2已审核
  101. InspectionReportIsAudit int `json:"inspectionReportIssue" gorm:"size:128;default:1"` // 检验报告是否审核 1 未审核 2已审核
  102. DispensingMedicinesIsAudit int `json:"dispensingMedicinesIssue" gorm:"size:128;default:1"` // 调配药品信息是否审核 1 未审核 2已审核
  103. IsCold int `json:"isCold" gorm:"size:128;default:1"` // 是否冷链 1 否 2 是
  104. PaymentStatus int `json:"paymentStatus" gorm:"size:128;default:1"` //支付状态 1 结清 2 未结清 3 支付完成
  105. PaymentType int `json:"paymentType" gorm:"size:128;default:0"` //支付方式 1现金 2线上支付 3银行卡 4医保 5其他
  106. PaymentRemark string `json:"paymentremark" gorm:"size:128;"` //支付备注
  107. AssignmentStatus int `json:"assignmentStatus" gorm:"size:128;default:1"` //分配状态 1 未分配 2已分配
  108. AuditRemark string `json:"audit_remark" gorm:"size:255;"` //驳回原因
  109. AdminAuditRemark string `json:"admin_audit_remark" gorm:"size:255;"` //管理员审核备注
  110. IsSecondaryDistribution bool `json:"is_secondary_distribution" gorm:"type:boolean;default:false"` //是否二次分配
  111. Confirmer string `json:"confirmer" gorm:"size:255;"` // 确认人
  112. ConfirmerPhone string `json:"confirmerPhone" gorm:"size:255;"` // 确认人电话
  113. Prescription model2.StringList `json:"prescription"` // 处方
  114. model2.ControlBy
  115. model2.ModelTime
  116. model2.DeptBy
  117. }
  118. func (Waybill) TableName() string {
  119. return "waybill"
  120. }