waybill.go 9.1 KB

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