using LinqToDB.Mapping;
using System;
using System.Collections.Generic;
using System.Linq;
namespace MasaBlazorApp3.Pojo
{
    /// <summary>
    /// 
    ///</summary>
    [Table("order_info")]
    public class OrderInfo
    {
        /// <summary>
        ///  
        ///</summary>
        ///
        [PrimaryKey, Identity]
        [Column("order_id")]
        public int OrderId { get; set; }
        /// <summary>
        ///  
        /// 默认值: NULL
        ///</summary>
        [Column("pharmacy")]
        public string Pharmacy { get; set; }
        /// <summary>
        ///  
        ///</summary>
        [Column("order_no")]
        public string OrderNo { get; set; }
        /// <summary>
        ///  
        ///</summary>
        [Column("patient_id")]
        public string PatientId { get; set; }
        /// <summary>
        ///  
        ///</summary>
        [Column("p_name")]
        public string PatientName { get; set; }
        
        /// <summary>
        ///  
        /// 默认值: NULL
        ///</summary>
        [Column("sex")]
        public string Sex { get; set; }
        /// <summary>
        ///  
        /// 默认值: NULL
        ///</summary>
        [Column("age")]
        public string Age { get; set; }
        
        /// <summary>
        ///  
        /// 默认值: NULL
        ///</summary>
        [Column("id_number")]
        public string IdNumber { get; set; }

       
        /// <summary>
        ///  
        /// 默认值: NULL
        ///</summary>
        [Column("invoice_no")]
        public string InvoiceNo { get; set; }
        /// <summary>
        ///  
        /// 默认值: NULL
        ///</summary>
        [Column("patient_no")]
        public string PatientNo { get; set; }
        
        /// <summary>
        ///  
        /// 默认值: NULL
        ///</summary>
        [Column("doctor_name")]
        public string DoctorName { get; set; }
        /// <summary>
        ///  
        /// 默认值: NULL
        ///</summary>
        [Column("order_date")]
        public DateTime OrderDate { get; set; }
        /// <summary>
        ///  
        ///</summary>
        [Column("charge_date")]
        public DateTime ChargeDate { get; set; } = DateTime.Now;
        /// <summary>
        ///  
        /// 默认值: NULL
        ///</summary>
        [Column("recv_date")]
        public DateTime RecvDate { get; set; }
        
        
        /// <summary>
        ///  
        /// 默认值: NULL
        ///</summary>
        [Column("dept_name")]
        public string DeptName { get; set; }
        /// <summary>
        ///  
        /// 默认值: NULL
        ///</summary>
        [Column("disease")]
        public string Disease { get; set; }
        /// <summary>
        ///  
        /// 默认值: NULL
        ///</summary>
        [Column("order_type")]
        public string OrderType { get; set; }
        /// <summary>
        ///  
        /// 默认值: NULL
        ///</summary>
        [Column("charge_type")]
        public string ChargeType { get; set; }
        /// <summary>
        ///  
        ///</summary>
        [Column("dm_status")]
        public int Status { get; set; }
        /// <summary>
        ///  
        /// 默认值: 0
        ///</summary>
        [Column("his_disp_flag")]
        public int? HisDispFlag { get; set; }
        
        /// <summary>
        ///  
        /// 默认值: 0
        ///</summary>
        [Column("cancel_flag")]
        public int? CancelFlag { get; set; }

        /// <summary>
        ///  
        /// 默认值: 0
        ///</summary>
        [Column("win_no")]
        public int WinNo { get; set; } = 0;
        /// <summary>
        ///  
        /// 默认值: 0
        ///</summary>
        [Column("state")]
        public int state { get; set; } = 0;

        //[Association(ThisKey = nameof(OrderNo), OtherKey = nameof(OrderDetail.OrderNo))]
        //public List<OrderDetail> DetailList { get; set; } = new();


        [Association(ThisKey = nameof(OrderNo), OtherKey = nameof(OrderDetail.OrderNo))]
        public OrderDetail DetailInfo { get; set; } = new();

        /// <summary>
        /// 是否选中
        /// </summary>
        [Column(IsColumn = false)]
        public bool ItemIsChecked { get; set; } = true;
        /// <summary>
        /// 是否全先中
        /// </summary>
        [Column(IsColumn = false)]
        public bool AllItemIsChecked { get; set; } = true;

        /// <summary>
        ///  麻醉师
        ///</summary>
        [Column("anaesthetist_name")]
        public string anaesthetistName { get; set; }
        /// <summary>
        ///  手术室
        ///</summary>
        [Column("op_room_name")]
        public string RoomName { get; set; }
        //药盒中药品对应的选中的处方信息
        [Column(IsColumn = false)]
        public IList<OrderInfo> SelectedOrderList { get; set; }
    }
}