using System; using System.Collections.Generic; using System.Drawing; using System.Linq; using System.Text; namespace DrawGraph { public class FactDrug : EventObj { public int Id; public int PatientId; public int DrugTypeId; public int DrugId; public string DrugName; public decimal Dosage; public string DosageUnit; public int IsContinue; public DateTime DrugBeginTime; public DateTime DrugEndTime; public string DrugChannel; public string GiveDrugType; public string Remark; public string DrugKind; public string OperatorNo { get; set; } public string OperatorName { get; set; } public DateTime OperateDate { get; set; } //private string operatorName; public decimal Density; public string DensityUnit; public decimal Velocity; public string VelocityUnit; public string BloodType; public int ParentId; public List ChildFactDrugList; public bool isZuDrug { get; set; } public double nowY { get; set; } public string EqualDose { get; set; } /// /// 清空所有与某条加药相关的控件。 /// /// public override void clearAddObj(ZedGraphControl zgc) { //if (zgcAnas == null || zgcAnas != zgc) zgcAnas = zgc; clearAddObjPic(zgc); clearDNDTDD(zgc); //clearIm(zgc); delAddObj(this.DrugName + this.DrugId); delLineObj("zhuyDrugs" + this.Id); delLineObj("zhuyDrugstop" + this.Id); delLineObj("zhuyDrugsend" + this.Id); delAddObj("BeforeDrugs0"); delAddObj("BeforeDrugs1"); delAddObj("BeforeDrugs2"); } private void clearAddObjPic(ZedGraphControl zgc) { //if (zgcAnas == null || zgcAnas != zgc) zgcAnas = zgc; delAddObj(TextPrefix.DT + this.DrugName + this.Id.ToString()); delAddObj(TextPrefix.DD + this.DrugName + this.Id.ToString()); delAddObj(TextPrefix.DD + this.DrugName + this.Id.ToString() + "spicle"); delAddObj(TextPrefix.DU + this.DrugName + this.Id.ToString()); delAddArrows(TextPrefix.AR + this.DrugName + this.Id.ToString()); delLineObj("A" + TextPrefix.AR + this.DrugName + this.Id.ToString()); delLineObj("B" + TextPrefix.AR + this.DrugName + this.Id.ToString()); } public override void clearDNAndDT(ZedGraphControl zgc) { //if (zgcAnas == null) zgcAnas = zgc; delAddObj(TextPrefix.DN + this.DrugName + this.Id.ToString()); delAddObj(TextPrefix.DT + this.DrugName + this.Id.ToString()); delAddObj(TextPrefix.DU + this.DrugName + this.Id.ToString()); //delAddObj(TextPrefix.DD + this.DrugName + this.Id.ToString()); delAddObj(this.DrugName + this.DrugId); } public void clearDNDTDD(ZedGraphControl zgc) { //if (zgcAnas == null || zgcAnas != zgc) zgcAnas = zgc; delAddObj(TextPrefix.DN + this.DrugName + this.Id.ToString()); delAddObj(TextPrefix.DT + this.DrugName + this.Id.ToString()); delAddObj(TextPrefix.DU + this.DrugName + this.Id.ToString()); delAddObj(TextPrefix.DD + this.DrugName + this.Id.ToString()); delAddObj(this.DrugName + this.DrugId); } public void clearIm(ZedGraphControl zgc) { if (zgcAnas == null || zgcAnas != zgc) zgcAnas = zgc; delAddObj(TextPrefix.IM + this.DrugName + this.Id.ToString()); } public bool isEqual(double y, DateTime time, double lineHeight) { bool reValue = false; if ((y > nowY && y < nowY + lineHeight)) { if (DrugBeginTime == DrugEndTime) { if ((DateTime.Compare(time, DateTime.Parse(DrugBeginTime.ToString())) > 0) && DateTime.Compare(time, DateTime.Parse(DrugBeginTime.ToString()).AddMinutes(10)) < 0) { reValue = true; } } else { if ((DateTime.Compare(time, DateTime.Parse(DrugBeginTime.ToString())) > 0 && DateTime.Compare(time, DateTime.Parse(DrugEndTime.ToString())) < 0)) { reValue = true; } } } return reValue; } public bool Equal(object drug1) { try { if ((this.DosageUnit == ((FactDrug)drug1).DosageUnit) && (this.DrugChannel == ((FactDrug)drug1).DrugChannel) && (this.DrugName == ((FactDrug)drug1).DrugName))// && (this.DrugEffect == ((DrugsRecord)drug1).DrugEffect)&& (this.Remark == ((DrugsRecord)drug1).Remark) { return true; } return false; } catch (Exception) { return false; } } /// /// 画一条加药记录 /// /// 高度 /// 总量 public override void drawText(double x, double y) { if (zgcAnas == null) return; clearAddObj(zgcAnas); //画添加药品线,底部加加药次数和备注 this.nowY = y; paintAdd(y); //写加药的左边与右信息 drawAddText(x, y); } /// /// 画添加药品线,底部加加药次数和备注信息 /// /// /// public void paintAdd(double y) { string tagName = this.DrugName + this.Id.ToString(); string DoseStr = ""; if (Dosage != 0) DoseStr = (((double)this.Dosage).ToString()); string RemarkStr = this.Remark;// string s = ""; if ((EqualDose == null || EqualDose == "")) { if (Dosage != 0) EqualDose = ((double)Dosage).ToString(); } DateTime dt = DrugEndTime; DateTime drugDt = this.DrugBeginTime; bool isContinued = false; if (IsContinue == 1 && DrugBeginTime == DrugEndTime) { dt = End; isContinued = true; } if (DrugEndTime != null && DrugBeginTime != null && DrugBeginTime != DrugEndTime) { TimeSpan tsp = DrugEndTime - DrugBeginTime; if (tsp.TotalMinutes >= 10) { drugDt = DrugBeginTime.AddMinutes(tsp.TotalMinutes / 2 - 3); } } if (((TimeSpan)(pageEnd - this.DrugBeginTime)).TotalMinutes <= 2) { if (EqualDose == null) { if (s.Trim() != "") drawDoseObj(y, tagName, this.DrugBeginTime, dt, drugDt, s + " " + RemarkStr, 5f, isContinued); else drawDoseObj(y, tagName, this.DrugBeginTime, dt, drugDt, DoseStr + " " + RemarkStr, 5f, isContinued); } else { if (s.Trim() != "") drawDoseObj(y, tagName, this.DrugBeginTime, dt, drugDt, s + "(" + EqualDose + ")" + RemarkStr, 5f, isContinued); else drawDoseObj(y, tagName, this.DrugBeginTime, dt, drugDt, EqualDose + " " + RemarkStr, 5f, isContinued); } } else { if (EqualDose == null) { if (s.Trim() != "") drawDoseObj(y, tagName, this.DrugBeginTime, dt, drugDt, s + " " + RemarkStr, 6f, isContinued); else drawDoseObj(y, tagName, this.DrugBeginTime, dt, drugDt, DoseStr + " " + RemarkStr, 6f, isContinued); } else { if (s.Trim() != "") drawDoseObj(y, tagName, this.DrugBeginTime, dt, drugDt, s + "(" + EqualDose + ")" + RemarkStr, 5.5f, isContinued); else drawDoseObj(y, tagName, this.DrugBeginTime, dt, drugDt, EqualDose + " " + RemarkStr, 5.5f, isContinued); } } } /// /// 写加药的左边与右信息 /// /// 高度 /// 总量 public void drawAddText(double x, double y) { //左边写药名 TextObj text = (TextObj)zgcAnas.MasterPane.GraphObjList[TextPrefix.DN + this.DrugName + this.Id.ToString()]; if (text == null) { double x1 = x;// 0.05f; string DrName = this.DrugName.Trim(); //if (this.Remark != null && this.Remark != "") DrName += "(" + this.Remark + ")"; if (this.DrugChannel != null && this.DrugChannel != "") DrName += "(" + this.DrugChannel + ")"; if (this.DosageUnit != null && this.DosageUnit != "") DrName += "(" + this.DosageUnit + ")"; if (DrugKind == "毒麻药品") ZUtil.DrawText(DrName, x1, y, zgcAnas, TextPrefix.DN + this.DrugName + this.Id.ToString(), Color.Red, 5.75f); else ZUtil.DrawText(DrName, x1, y, zgcAnas, TextPrefix.DN + this.DrugName + this.Id.ToString(), Color.Black, 5.75f); } } } }