80 lines
2.4 KiB
TypeScript
Raw Permalink Normal View History

2026-07-27 11:28:33 +08:00
const { ObjectId } = require('mongodb');
/**
*
*/
enum Status {
abnormal = 'abnormal', // 异常状态
expired = 'expired', // 已过期
shipped = 'shipped', // 已发货
ybFeeRefunded = 'ybFeeRefunded', // 医保已退费 (医保药费 + 挂号费 已退费)
refunded = 'refunded', // 已全部退费
unpay = 'unpay', // 未支付
ybPaid = 'ybPaid', // 医保支付成功
}
interface Drug {
_id: string,
drugName: string,
spec: string,
insuranceCode: string,
quantity: number,
price: number,
totalPrice: number,
}
interface AfterSale {
notes: string,
waybillNo: string
}
interface RefundRecord {
amount: number; //退费金额
applyTime: number; //退费申请时间
platform: 'alipay' | 'his';
reason: string; //退费原因
refundTime?: number; //退费时间
refundSerialNo: string; //退费流水号
result: 'refunding' | 'refunded' | 'refund_fail'; //退费状态
tradeStatus: string;//交易状态 (各个平台交易状态可能不同)
operator: string;//操作人
operatorId: string;//操作人id
}
interface MedicinePurchaseOrder {
_id: ObjectId;
accountId: string;//账号id
shippingType: 'ems' | 'fengniao';//配送公司
shippingNo: string;//配送单号
corpId: string;//机构id
orderNo: string;//订单号
drugs: Drug[],
name: string,
status: Status;
drugFee: number;//药品费用
regFee: number;//挂号费
shippingFee: number;//配送费用
shippingOriginalFee: number;//配送原价
shippingDiscount: number;//配送优惠
orderId: string; // 关联咨询订单号
rpNo: string;//关联处方订单
receiveName: string;//收货人姓名
receivePhone: string;//收货人电话
receiveRegion: string[];//收货人地区
receiveAddress: string;//收货人地址
receiveLatitude: number;//收货人纬度
receiveLongitude: number;//收货人经度
tradeNo: string;//交易号
createTime: number;
updateTime: number;
payTime?: number;
disabled: boolean;
blhno: string;//病历号
syncHisChargeStatus: 'charged' | 'refunded';// 已同步his支付状态 charged: 已收取医保退款 refunded: 已退还医保退款
syncHisDelivery: 'charged' | 'refunded';// 已同步his物流状态 charged: 已收取运费 refunded: 已退还运费
refundRecords?: RefundRecord[];//退费记录
deliveryCancelled?: boolean;//配送已取消
afterSale?: AfterSale;//售后信息
pickupCode?: string;//取件码
}