using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace DrawGraph { public class PhysioData : PointPair, IComparable { public PhysioData() { } private int _id; private int _patientid; private int _physiodataconfigid; private DateTime _recordtime; private double _value; public bool IsClick { get; set; } public int YAisx { get; set; } public PhysioDataConfig ppter { get; set; } /// /// /// public int Id { set { _id = value; } get { return _id; } } /// /// /// public int PatientId { set { _patientid = value; } get { return _patientid; } } /// /// /// public int PhysioDataConfigId { set { _physiodataconfigid = value; } get { return _physiodataconfigid; } } /// /// /// public DateTime RecordTime { get { int second = _recordtime.Second; _recordtime = _recordtime.AddSeconds(-second); return _recordtime; } set { int second = value.Second; _recordtime = value.AddSeconds(-second); //得到整的分钟数 this.X = new XDate(value); } } /// /// /// public double Value { set { _value = value; this.Y = value; } get { return _value; } } public bool isEquert(PhysioData pd) { double yDiff = Value - pd.Value; TimeSpan ts1 = new TimeSpan(RecordTime.Ticks); TimeSpan ts2 = new TimeSpan(pd.RecordTime.Ticks); double minDiff = (ts1.Subtract(ts2).TotalMinutes); //如果外新加的点Y轴的值和X轴的值已经存在,删除当前位置的点 if ((-2.5 < minDiff) && (minDiff < 2.5)) { return true; } return false; } public bool isEquertTrue(PhysioData pd, string collectInterval) { double yDiff = Value - pd.Value; TimeSpan ts1 = new TimeSpan(RecordTime.Ticks); TimeSpan ts2 = new TimeSpan(pd.RecordTime.Ticks); double minDiff = (ts1.Subtract(ts2).TotalMinutes); //如果外新加的点Y轴的值和X轴的值已经存在,删除当前位置的点 if ((-1.5 < minDiff && minDiff < 1.5) && (-2 < yDiff && yDiff < 2)) { return true; } return false; } public PhysioData Clone() { PhysioData pdTemp = new PhysioData(); pdTemp.RecordTime = this.RecordTime; pdTemp.Value = this.Value; pdTemp.PhysioDataConfigId = this.Id; pdTemp.PatientId = this.PatientId; return pdTemp; } public int CompareTo(object obj) { var pd = obj as PhysioData; if (pd == null) { throw new Exception("传入对象类型不正确"); } if (pd.RecordTime > this.RecordTime) { return -1; } else if (pd.RecordTime < this.RecordTime) { return 1; } else { return 0; } } } }