/// <summary>
/// 该药品是否存在发药信息
/// 存在返回true,否则返回false
/// </summary>
/// <param name="Idm"></param>
/// <returns></returns>
public bool IsExistOutBillDataByIdm(int Idm)
{
int count = his.OPDrugOutBillData.Count(b => b.Idm == Idm);
if (count == 0)
return false;
else
return true;
}

///<summary>
///通过药品Id获取发药信息(已判定该药品发药信息存在)
///如果不存在该药品发药信息,提示无相应数据
///</summary>
///
public List<OutBillInfor> GetDrugOutBillDetailsByIdm(int Idm)
{
var q=(from bill in his.OPDrugOutBill
from data in his.OPDrugOutBillData
from r in his.OPDrugSendRequest
from pat in his.Patient
from staff in his.Staff
from pha in his.Pharmacy
where Idm==data.Idm && data.BillXh==bill.Xh && bill.AuditStaffId==staff.Id && r.PatId==pat.Id && bill.WarehouseId==pha.Id
select new
{
Xh=bill.Xh,
AuditDate=bill.AuditDate,
PatId=r.PatId,
PatName=pat.GivenName,
Sex=r.Sex,
Age=r.Age,
StaffId=bill.StaffId,
StaffName=staff.Name,
RecFlag=bill.RecFlag,
RequestXh=r.Xh,
WarehouseId=bill.WarehouseId,
WarehouseName=pha.Name
}).ToList().Select(o=>new OutBillInfor
{
Xh = o.Xh,
AuditDate =Convert.ToDateTime(o.AuditDate),
PatId = o.PatId,
PatName = o.PatName,
Sex =o.Sex,
Age = o.Age,
StaffId = o.StaffId,
StaffName = o.StaffName,
RecFlag = o.RecFlag,
RequestXh = o.RequestXh,
WarehouseId = o.WarehouseId,
WarehouseName = o.WarehouseName
}).ToList();
return q;
}

05-08 15:23