AIMS/DrawGraph/AreaManage/FactOutputLiquids.cs
2023-03-01 00:21:03 +08:00

298 lines
10 KiB
C#

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
namespace DrawGraph
{
public class FactOutputLiquids : EventObj
{
private int _id;
private int _patientid;
private int _outputliquidstypeid;
private int _outputliquidsid;
//private int _outputliquidsName;
private DateTime _begintime;
private DateTime _endtime;
private decimal _dosage;
private string _dosageunit;
private int _iscontinue;
private string _remark;
private string _operatorno;
private string _operatorname;
private DateTime _operatedate;
public string OutputLiquidsName;
/// <summary>
///
/// </summary>
public int Id
{
set { _id = value; }
get { return _id; }
}
/// <summary>
///
/// </summary>
public int PatientId
{
set { _patientid = value; }
get { return _patientid; }
}
public int OutputLiquidsTypeId
{
set { _outputliquidstypeid = value; }
get { return _outputliquidstypeid; }
}
/// <summary>
///
/// </summary>
public int OutputLiquidsId
{
set { _outputliquidsid = value; }
get { return _outputliquidsid; }
}
/// <summary>
///
/// </summary>
public DateTime BeginTime
{
set { _begintime = value; }
get { return _begintime; }
}
/// <summary>
///
/// </summary>
public DateTime EndTime
{
set { _endtime = value; }
get { return _endtime; }
}
/// <summary>
///
/// </summary>
public decimal Dosage
{
set { _dosage = value; }
get { return _dosage; }
}
/// <summary>
///
/// </summary>
public string DosageUnit
{
set { _dosageunit = value; }
get { return _dosageunit; }
}
/// <summary>
///
/// </summary>
public int IsContinue
{
set { _iscontinue = value; }
get { return _iscontinue; }
}
/// <summary>
///
/// </summary>
public string Remark
{
set { _remark = value; }
get { return _remark; }
}
/// <summary>
///
/// </summary>
public string OperatorNo
{
set { _operatorno = value; }
get { return _operatorno; }
}
/// <summary>
///
/// </summary>
public string OperatorName
{
set { _operatorname = value; }
get { return _operatorname; }
}
/// <summary>
///
/// </summary>
public DateTime OperateDate
{
set { _operatedate = value; }
get { return _operatedate; }
}
public double nowY { get; set; }
public string EqualDose { get; set; }
public bool Equal(object drug1)
{
try
{
if ((this.DosageUnit == ((FactOutputLiquids)drug1).DosageUnit) && (this.OutputLiquidsName == ((FactOutputLiquids)drug1).OutputLiquidsName))
{
return true;
}
return false;
}
catch (Exception)
{
return false;
}
}
public override void clearAddObj(ZedGraphControl zgc)
{
//if (zgcAnas == null || zgcAnas != zgc)
zgcAnas = zgc;
clearAddObjPic(zgc);
clearDNDTDD(zgc);
delAddObj(this.OutputLiquidsName + this.OutputLiquidsId);
}
private void clearAddObjPic(ZedGraphControl zgc)
{
//if (zgcAnas == null || zgcAnas != zgc)
zgcAnas = zgc;
delAddObj(TextPrefix.DT + this.OutputLiquidsName + this.Id.ToString());
delAddObj(TextPrefix.DD + this.OutputLiquidsName + this.Id.ToString());
delAddObj(TextPrefix.DD + this.OutputLiquidsName + this.Id.ToString() + "spicle");
delAddObj(TextPrefix.DU + this.OutputLiquidsName + this.Id.ToString());
delAddArrows(TextPrefix.AR + this.OutputLiquidsName + this.Id.ToString());
delLineObj("A" + TextPrefix.AR + this.OutputLiquidsName + this.Id.ToString());
delLineObj("B" + TextPrefix.AR + this.OutputLiquidsName + this.Id.ToString());
}
public override void clearDNAndDT(ZedGraphControl zgc)
{
//if (zgcAnas == null)
zgcAnas = zgc;
delAddObj(TextPrefix.DN + this.OutputLiquidsName + this.Id.ToString());
delAddObj(TextPrefix.DT + this.OutputLiquidsName + this.Id.ToString());
delAddObj(TextPrefix.DU + this.OutputLiquidsName + this.Id.ToString());
//delAddObj(TextPrefix.DD + this.OutputLiquidsName + this.Id.ToString());
delAddObj(this.OutputLiquidsName + this.OutputLiquidsId);
}
/// <summary>
/// 画一条加药记录
/// </summary>
/// <param name="index">高度</param>
/// <param name="faRecord">总量</param>
public override void drawText(double x, double y)
{
if (zgcAnas == null) return;
clearAddObj(zgcAnas);
//画添加药品线,底部加加药次数和备注
this.nowY = y;
paintAdd(y);
//写加药的左边与右信息
drawAddText(x, y);
}
/// <summary>
/// 画添加药品线,底部加加药次数和备注信息
/// </summary>
/// <param name="DrugsRecord"></param>
/// <param name="index"></param>
public void paintAdd(double y)
{
string tagName = this.OutputLiquidsName + 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 = EndTime;
DateTime drugDt = this.BeginTime;
bool isContinued = false;
if (IsContinue == 1 && BeginTime == EndTime)
{
dt = End;
isContinued = true;
}
if (EndTime != null && BeginTime != null && BeginTime != EndTime)
{
TimeSpan tsp = EndTime - BeginTime;
if (tsp.TotalMinutes >= 10)
{
drugDt = BeginTime.AddMinutes(tsp.TotalMinutes / 2 - 3);
}
}
if (((TimeSpan)(pageEnd - this.BeginTime)).TotalMinutes <= 2)
{
if (EqualDose == null)
{
if (s.Trim() != "")
drawDoseObj(y, tagName, this.BeginTime, dt, drugDt, s + " " + RemarkStr, 5f, isContinued);
else
drawDoseObj(y, tagName, this.BeginTime, dt, drugDt, DoseStr + " " + RemarkStr, 5f, isContinued);
}
else
{
if (s.Trim() != "")
drawDoseObj(y, tagName, this.BeginTime, dt, drugDt, s + "(" + EqualDose + ")" + RemarkStr, 5f, isContinued);
else
drawDoseObj(y, tagName, this.BeginTime, dt, drugDt, EqualDose + " " + RemarkStr, 5f, isContinued);
}
}
else
{
if (EqualDose == null)
{
if (s.Trim() != "")
drawDoseObj(y, tagName, this.BeginTime, dt, drugDt, s + " " + RemarkStr, 6f, isContinued);
else
drawDoseObj(y, tagName, this.BeginTime, dt, drugDt, DoseStr + " " + RemarkStr, 6f, isContinued);
}
else
{
if (s.Trim() != "")
drawDoseObj(y, tagName, this.BeginTime, dt, drugDt, s + "(" + EqualDose + ")" + RemarkStr, 5.5f, isContinued);
else
drawDoseObj(y, tagName, this.BeginTime, dt, drugDt, EqualDose + " " + RemarkStr, 5.5f, isContinued);
}
}
}
/// <summary>
/// 写加药的左边与右信息
/// </summary>
/// <param name="y">高度</param>
/// <param name="totalDose">总量</param>
public void drawAddText(double x, double y)
{
//左边写药名
TextObj text = (TextObj)zgcAnas.MasterPane.GraphObjList[TextPrefix.DN + this.OutputLiquidsName + this.Id.ToString()];
if (text == null)
{
double x1 = x;// 0.05f;
string DrName = this.OutputLiquidsName.Trim();
//if (this.Remark != null && this.Remark != "") DrName += "(" + this.Remark + ")";
if (this.DosageUnit != null && this.DosageUnit != "") DrName += "(" + this.DosageUnit + ")";
ZUtil.DrawText(DrName, x1, y, zgcAnas, TextPrefix.DN + this.OutputLiquidsName + this.Id.ToString(), Color.Black, 5.75f);
}
}
public void clearDNDTDD(ZedGraphControl zgc)
{
//if (zgcAnas == null || zgcAnas != zgc)
zgcAnas = zgc;
delAddObj(TextPrefix.DN + this.OutputLiquidsName + this.Id.ToString());
delAddObj(TextPrefix.DT + this.OutputLiquidsName + this.Id.ToString());
delAddObj(TextPrefix.DU + this.OutputLiquidsName + this.Id.ToString());
delAddObj(TextPrefix.DD + this.OutputLiquidsName + this.Id.ToString());
delAddObj(this.OutputLiquidsName + this.OutputLiquidsId);
}
}
}