using System;
using System.Collections.Generic;
using System.Linq;
using Prism.Mvvm;
using SqlSugar;
namespace DM_Weight.Models
{
///
///
///
[SugarTable("order_detail")]
public class OrderDetail: BindableBase
{
///
///
///
[SugarColumn(ColumnName = "id", IsIdentity = true, IsPrimaryKey = true)]
public int Id { get; set; }
///
///
/// 默认值: NULL
///
//[SugarColumn(ColumnName = "order_id")]
//public int? OrderId { get; set; }
///
///
///
[SugarColumn(ColumnName = "patient_id")]
public string PatientId { get; set; }
///
///
///
[SugarColumn(ColumnName = "order_id")]
public string OrderId { get; set; }
///
///
///
[SugarColumn(ColumnName = "order_no")]
public string OrderNo { get; set; }
///
///
///
[SugarColumn(ColumnName = "charge_date")]
public DateTime ChargeDate { get; set; }
///
///
/// 默认值: NULL
///
//[SugarColumn(ColumnName = "serial_no")]
//public int? SerialNo { get; set; }
///
///
///
[SugarColumn(ColumnName = "drug_id")]
public string DrugId { get; set; }
[Navigate(NavigateType.ManyToOne, nameof(DrugId))]
public DrugInfo DrugInfo { get; set; }
[Navigate(NavigateType.ManyToMany, nameof(DrugId))]
public List DrugInfos { get; set; }
[Navigate(NavigateType.ManyToMany, nameof(DrugId))]
public List MachineRecords { get; set; }
///
///
///
[SugarColumn(ColumnName = "quantity")]
public int Quantity { get; set; }
///
///
/// 默认值: NULL
///
[SugarColumn(ColumnName = "order_unit")]
public string OrderUnit { get; set; }
///
///
/// 默认值: 1
///
[SugarColumn(ColumnName = "unit_convercoef")]
public int? UnitConvercoef { get; set; }
///
///
/// 默认值: NULL
///
[SugarColumn(ColumnName = "set_manu_no")]
public string SetManuNo { get; set; }
///
///
/// 默认值: NULL
///
[SugarColumn(ColumnName = "set_eff_date")]
public string SetEffDate { get; set; }
///
///
/// 默认值: NULL
///
//[SugarColumn(ColumnName = "price")]
//public string Price { get; set; }
///
///
/// 默认值: NULL
///
//[SugarColumn(ColumnName = "total_price")]
//public string TotalPrice { get; set; }
///
///
/// 默认值: NULL
///
[SugarColumn(ColumnName = "use_discrip")]
public string UseDiscrip { get; set; }
///
///
/// 默认值: NULL
///
[SugarColumn(ColumnName = "use_frequ")]
public string UseFrequ { get; set; }
///
///
/// 默认值: NULL
///
[SugarColumn(ColumnName = "use_once")]
public string UseOnce { get; set; }
///
///
/// 默认值: NULL
///
[SugarColumn(ColumnName = "use_by")]
public string UseBy { get; set; }
///
///
/// 默认值: '0'
///
[SugarColumn(ColumnName = "use_self")]
public string UseSelf { get; set; }
///
///
/// 默认值: NULL
///
[SugarColumn(ColumnName = "use_dosage")]
public string UseDosage { get; set; }
///
/// 已还药数
///
private int _returnQuantity = 0;
[SugarColumn(ColumnName = "return_quantity")]
public int ReturnQuantity
{
get;
set;
}
//当前还药数
private int currentReturnQuantity;
[SugarColumn(IsIgnore =true)]
public int CurrentReturnQuantity
{
get => currentReturnQuantity;
set
{
//if (value > Quantity - ReturnQuantity)
// throw new ArgumentException("数量有误");
SetProperty(ref currentReturnQuantity, value);
}
}
private OrderInfo? _orderInfo;
[Navigate(NavigateType.OneToOne,nameof(OrderNo))]
public OrderInfo orderInfo { get => _orderInfo; set => SetProperty(ref _orderInfo, value); }
}
}