using LinqToDB.Mapping;
using System;
using System.Collections.Generic;
using System.Linq;
namespace MasaBlazorApp3.Pojo
{
    /// <summary>
    /// 
    ///</summary>
    [Table("order_detail")]
    public class OrderDetail
    {
        /// <summary>
        ///  
        ///</summary>
        ///
        [PrimaryKey]
        [Column("id")]
        public int Id { get; set; }
        /// <summary>
        ///  
        /// 默认值: NULL
        ///</summary>
        //[SugarColumn(ColumnName = "order_id")]
        //public int? OrderId { get; set; }
        /// <summary>
        ///  
        ///</summary>
        [Column("patient_id")]
        public string PatientId { get; set; }
        /// <summary>
        ///  
        ///</summary>
        [Column("order_id")]
        public string OrderId { get; set; }
        /// <summary>
        ///  
        ///</summary>
        [Column("order_no")]
        public string OrderNo { get; set; }
        /// <summary>
        ///  
        ///</summary>
        [Column("charge_date")]
        public DateTime ChargeDate { get; set; }
        /// <summary>
        ///  
        /// 默认值: NULL
        ///</summary>
        //[SugarColumn(ColumnName = "serial_no")]
        //public int? SerialNo { get; set; }
        /// <summary>
        ///  
        ///</summary>
        [Column("drug_id")]
        public string DrugId { get; set; }

        [Association(ThisKey = nameof(DrugId), OtherKey = nameof(DrugInfo.DrugId))]
        public DrugInfo Drug { get; set; } = new();

        /// <summary>
        ///  
        ///</summary>
        [Column("quantity")]
        public int Quantity { get; set; }
        /// <summary>
        ///  
        /// 默认值: NULL
        ///</summary>
        [Column("order_unit")]
        public string OrderUnit { get; set; }
        /// <summary>
        ///  
        /// 默认值: 1
        ///</summary>
        [Column("unit_convercoef")]
        public int? UnitConvercoef { get; set; }
        /// <summary>
        ///  
        /// 默认值: NULL
        ///</summary>
        [Column("set_manu_no")]
        public string SetManuNo { get; set; }
        /// <summary>
        ///  
        /// 默认值: NULL
        ///</summary>
        [Column("set_eff_date")]
        public string SetEffDate { get; set; }
        /// <summary>
        ///  
        /// 默认值: NULL
        ///</summary>
        //[SugarColumn(ColumnName = "price")]
        //public string Price { get; set; }
        /// <summary>
        ///  
        /// 默认值: NULL
        ///</summary>
        //[SugarColumn(ColumnName = "total_price")]
        //public string TotalPrice { get; set; }
        /// <summary>
        ///  
        /// 默认值: NULL
        ///</summary>
        [Column("use_discrip")]
        public string UseDiscrip { get; set; }
        /// <summary>
        ///  
        /// 默认值: NULL
        ///</summary>
        [Column("use_frequ")]
        public string UseFrequ { get; set; }
        /// <summary>
        ///  
        /// 默认值: NULL
        ///</summary>
        [Column("use_once")]
        public string UseOnce { get; set; }
        /// <summary>
        ///  
        /// 默认值: NULL
        ///</summary>
        [Column("use_by")]
        public string UseBy { get; set; }
        /// <summary>
        ///  
        /// 默认值: '0'
        ///</summary>
        [Column("use_self")]
        public string UseSelf { get; set; }
        /// <summary>
        ///  
        /// 默认值: NULL
        ///</summary>
        [Column("use_dosage")]
        public string UseDosage { get; set; }
        /// <summary>
        ///  
        /// 默认值: NULL
        ///</summary>
        [Column(IsColumn = false)]
        public int? TotalQuantity { get; set; } = null;

        [LinqToDB.Mapping.Association(ThisKey = nameof(SetManuNo), OtherKey = nameof(DrugManuNo.ManuNo))]
        public DrugManuNo? drugManuNo { get; set; }
        [Column(IsColumn =false)]
        public string DrugName { get; set; }
    }
}