using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using DevExpress.XtraReports.UI;
using System.Data;
using CYYFCheckupMgr.BLL;
using CYYFCheckupMgr.Model;
using CYYFCheckupMgr.Util;
using CYYFCheckupMgr.UC.UtilClass;
using System.Drawing.Drawing2D;
namespace CYYFCheckupMgr.OccupationalDisease.UC.Rpt.仪器检查报告.肺功能报告
{
/// <summary>
/// NoiseInducedDeafNessReport
/// author CYTD Young
/// 2016-12-08 20:11:34
/// music: Status Quo - In the Army Now
/// </summary>
public partial class NoiseInducedDeafNessReport : DevExpress.XtraReports.UI.XtraReport
{
public NoiseInducedDeafNessReport()
{
InitializeComponent();
}
public void InitData(string sglcheckid, string checkDoctor, string checkDate, int[] Value_left, int[] Value_right, string jielun)
{
if (string.IsNullOrWhiteSpace(sglcheckid))
{
return;
}
#region 个人信息
DataTable dtSglInfo = BLLUtil.GetTableData(TableFieldBase.T_SINGLE_CHECKINFO.T_NAME, TableFieldBase.T_SINGLE_CHECKINFO.SGLCHECKID, sglcheckid);
if (dtSglInfo == null || dtSglInfo.Rows.Count < 1)
{
return;
}
DataRow drSglInfo = dtSglInfo.Rows[0];
this.xrLabel_name.Text = drSglInfo[TableFieldBase.T_SINGLE_CHECKINFO.NAME].ToString();
this.xrBarCode_sgl.Text = drSglInfo[TableFieldBase.T_SINGLE_CHECKINFO.SGLCHECKID].ToString();
this.xrLabel_sex.Text = drSglInfo[TableFieldBase.T_SINGLE_CHECKINFO.SEX] == null ? "" : (drSglInfo[TableFieldBase.T_SINGLE_CHECKINFO.SEX].ToString().Equals("1") ? "男" : "女");
this.xrLabel_age.Text = drSglInfo[TableFieldBase.T_SINGLE_CHECKINFO.AGE].ToString();
this.xrLabel_telephone.Text = drSglInfo[TableFieldBase.T_SINGLE_CHECKINFO.MOBILEPHONE] == null ? "" : drSglInfo[TableFieldBase.T_SINGLE_CHECKINFO.MOBILEPHONE].ToString();
this.xrLabel_idcard.Text = drSglInfo[TableFieldBase.T_SINGLE_CHECKINFO.IDCARD].ToString();
this.xrLabel_enterprice.Text = drSglInfo[TableFieldBase.T_SINGLE_CHECKINFO.ENTERPRICE].ToString();
DataTable dtSglInfoExtend = BLLUtil.GetTableData(TableFieldBase.T_SINGLE_CHECKINFO_EXTEND.T_NAME, TableFieldBase.T_SINGLE_CHECKINFO_EXTEND.SGLCHECKID, sglcheckid);
if (dtSglInfoExtend == null || dtSglInfoExtend.Rows.Count < 1 || dtSglInfoExtend.Rows[0] != null)
{
DataRow drSglInfoExtend = dtSglInfoExtend.Rows[0];
this.xrLabel_worktype.Text = drSglInfoExtend[TableFieldBase.T_SINGLE_CHECKINFO_EXTEND.PROFESSIONAL].ToString();
this.xrLabel_ohsCheckType.Text = EnumUtil.GetEnumNameByValue(typeof(EnumJobStatus),
int.Parse(string.IsNullOrEmpty(drSglInfoExtend[TableField.T_SINGLE_CHECKINFO_EXTEND.JOBSTATUS].ToString()) ? "1" : drSglInfoExtend[TableField.T_SINGLE_CHECKINFO_EXTEND.JOBSTATUS].ToString()));
string strFactor = string.Empty;
string groupid = drSglInfo[TableFieldBase.T_SINGLE_CHECKINFO.GROUPID].ToString();
if (string.IsNullOrWhiteSpace(groupid))
{
strFactor = drSglInfoExtend[TableFieldBase.T_SINGLE_CHECKINFO_EXTEND.RISKFACTORS].ToString();
}
else
{
strFactor = BLLOccupationalDisease.GetGroupRisks(groupid);
}
this.xrLabel_ohsWHYS.Text = strFactor;
}
#endregion
#region 项目结果
int age = Convert.ToInt32(this.xrLabel_age.Text);
int sex = this.xrLabel_sex.Text.Equals("男性") ? 1 : 2;
int z500 = Convert.ToInt32(Value_left[0]);
int fix_l_500 = FixValue(EnumHz.Hz500, z500, age, (EnumSex4Input)sex);
int z1000 = Convert.ToInt32(Value_left[1]);
int fix_l_1000 = FixValue(EnumHz.Hz1000, z1000, age, (EnumSex4Input)sex);
int z2000 = Convert.ToInt32(Value_left[2]);
int fix_l_2000 = FixValue(EnumHz.Hz2000, z2000, age, (EnumSex4Input)sex);
int z3000 = Convert.ToInt32(Value_left[3]);
int fix_l_3000 = FixValue(EnumHz.Hz3000, z3000, age, (EnumSex4Input)sex);
int z4000 = Convert.ToInt32(Value_left[4]);
int fix_l_4000 = FixValue(EnumHz.Hz4000, z4000, age, (EnumSex4Input)sex);
int z6000 = Convert.ToInt32(Value_left[5]);
int fix_l_6000 = FixValue(EnumHz.Hz6000, z6000, age, (EnumSex4Input)sex);
int z8000 = Convert.ToInt32(Value_left[6]);
int fix_l_8000 = FixValue(EnumHz.Hz8000, z8000, age, (EnumSex4Input)sex);
int y500 = Convert.ToInt32(Value_right[0]);
int fix_r_500 = FixValue(EnumHz.Hz500, y500, age, (EnumSex4Input)sex);
int y1000 = Convert.ToInt32(Value_right[1]);
int fix_r_1000 = FixValue(EnumHz.Hz1000, y1000, age, (EnumSex4Input)sex);
int y2000 = Convert.ToInt32(Value_right[2]);
int fix_r_2000 = FixValue(EnumHz.Hz2000, y2000, age, (EnumSex4Input)sex);
int y3000 = Convert.ToInt32(Value_right[3]);
int fix_r_3000 = FixValue(EnumHz.Hz3000, y3000, age, (EnumSex4Input)sex);
int y4000 = Convert.ToInt32(Value_right[4]);
int fix_r_4000 = FixValue(EnumHz.Hz4000, y4000, age, (EnumSex4Input)sex);
int y6000 = Convert.ToInt32(Value_right[5]);
int fix_r_6000 = FixValue(EnumHz.Hz6000, y6000, age, (EnumSex4Input)sex);
int y8000 = Convert.ToInt32(Value_right[6]);
int fix_r_8000 = FixValue(EnumHz.Hz8000, y8000, age, (EnumSex4Input)sex);
//int[] xy_ValueR = new int[] { y500, y1000, y2000, y3000, y4000, y6000, y8000 };
//int[] xy_ValueL = new int[] { z500, z1000, z2000, z3000, z4000, z6000, z8000 };
#region BHFTA
int iBHFTA = (fix_l_3000 + fix_l_4000 + fix_l_6000 + fix_r_3000 + fix_r_4000 + fix_r_6000) / 6;
#endregion
#region MTMV
string sMTMV_L = "", sMTMV_R = "";
int iMTMV_L = Convert.ToInt32((fix_l_500 + fix_l_1000 + fix_l_2000) * 0.3 + fix_l_4000 * 0.1);
int iMTMV_R = Convert.ToInt32((fix_r_500 + fix_r_1000 + fix_r_2000) * 0.3 + fix_r_4000 * 0.1);
int iMTMV_Better;
if (iMTMV_L > iMTMV_R)
{
sMTMV_R = "" + iMTMV_R + "(较好耳)";
sMTMV_L = "" + iMTMV_L;
}
else if (iMTMV_R > iMTMV_L)
{
sMTMV_L = "" + iMTMV_L + "(较好耳)";
sMTMV_R = "" + iMTMV_R;
}
else
{
iMTMV_Better = iMTMV_L;
}
#endregion
#region SLGTA
int iSLGTA_L = (fix_l_500 + fix_l_1000 + fix_l_2000) / 3;
int iSLGTA_R = (fix_r_500 + fix_r_1000 + fix_r_2000) / 3;
#endregion
#region 双耳高频
int iSHFTA_L = (fix_l_3000 + fix_l_4000 + fix_l_6000) / 3;
int iSHFTA_R = (fix_r_3000 + fix_r_4000 + fix_r_6000) / 3;
#endregion
this.xrTableCell右耳500实.Text = "" + y500;
this.xrTableCell右耳500修.Text = "" + fix_r_500;
this.xrTableCell左耳500实.Text = "" + z500;
this.xrTableCell左耳500修.Text = "" + fix_l_500;
this.xrTableCell右耳1000实.Text = "" + y1000;
this.xrTableCell右耳1000修.Text = "" + fix_r_1000;
this.xrTableCell左耳1000实.Text = "" + z1000;
this.xrTableCell左耳1000修.Text = "" + fix_l_1000;
this.xrTableCell右耳2000实.Text = "" + y2000;
this.xrTableCell右耳2000修.Text = "" + fix_r_2000;
this.xrTableCell左耳2000实.Text = "" + z2000;
this.xrTableCell左耳2000修.Text = "" + fix_l_2000;
this.xrTableCell右耳3000实.Text = "" + y3000;
this.xrTableCell右耳3000修.Text = "" + fix_r_3000;
this.xrTableCell左耳3000实.Text = "" + z3000;
this.xrTableCell左耳3000修.Text = "" + fix_r_3000;
this.xrTableCell右耳4000实.Text = "" + y4000;
this.xrTableCell右耳4000修.Text = "" + fix_r_4000;
this.xrTableCell左耳4000实.Text = "" + z4000;
this.xrTableCell左耳4000修.Text = "" + fix_l_4000;
this.xrTableCell右耳6000实.Text = "" + y6000;
this.xrTableCell右耳6000修.Text = "" + fix_r_6000;
this.xrTableCell左耳6000实.Text = "" + z6000;
this.xrTableCell左耳6000修.Text = "" + fix_l_6000;
this.xrTableCell右耳8000实.Text = "" + y8000;
this.xrTableCell右耳8000修.Text = "" + fix_r_8000;
this.xrTableCell左耳8000实.Text = "" + z8000;
this.xrTableCell左耳8000修.Text = "" + fix_l_8000;
this.xrTableCell双耳高频平均听阈.Text = "" + iBHFTA;
this.xrTableCell左耳听阈加权.Text = "" + sMTMV_L;
this.xrTableCell左耳平均听损.Text = "" + iSLGTA_L;
this.xrTableCell左耳高频听损.Text = "" + iSHFTA_L;
this.xrTableCell右耳听阈加权.Text = "" + sMTMV_R;
this.xrTableCell右耳平均听损.Text = "" + iSLGTA_R;
this.xrTableCell右耳高频听损.Text = "" + iSHFTA_R;
#endregion
#region 签名
Image imageSign = ReportSignPictureUtil.GetDoctorSignPictureByName(checkDoctor.Trim());
if (imageSign == null)
{
this.xrLabel检查者姓名.Visible = true;
this.xrPictureBox检查者签名.Visible = false;
this.xrLabel检查者姓名.Text = checkDoctor;
}
else
{
this.xrLabel检查者姓名.Visible = false;
this.xrPictureBox检查者签名.Visible = true;
this.xrPictureBox检查者签名.Image = imageSign;
}
this.xrLabel检查日期.Text = checkDate;
#endregion
#region 画图
EnumUpDown enumUpDown = LocalConfig.IniReadValueBool(TableField.DianCeTing, TableField.str电测听图形正向) ? EnumUpDown.正向 : EnumUpDown.反向;
this.xrPictureBox右耳.Image = DrawPictures(Value_right, EnumAirBone.气导, EnumLeftRight.右耳, enumUpDown);
this.xrPictureBox左耳.Image = DrawPictures(Value_left, EnumAirBone.气导, EnumLeftRight.左耳, enumUpDown);
#endregion
#region 项目结论
this.xrLabel检查结果诊断.Text = jielun;
#endregion
}
int iOPointX_up = 40;//圆点X
int iOPointY_up = 450;//圆点Y
int iOPointX_down = 40;//圆点X
int iOPointY_down = 50;//圆点Y
int iXSpan = 60;//X轴跨度——小格宽度
int iYSpan = 30;//Y周跨度--小格高度
int 骨导曲线大小 = 5;
int 气导圆大小 = 6;
int 气导叉大小 = 3;
int 骨导曲线曲度 = 1;
int iY = 3;//y轴值的换算倍数,一般是iYSpan/Y周刻度(y_dB)
private Image DrawPictures(int[] xy_Value, EnumAirBone enumAirBone, EnumLeftRight enumLeftRight, EnumUpDown enumUpDown)
{
string[] x_Hz = { "250", "500", "1K", "2K", "3K", "4K", "6K", "8k" };
string[] y_dB = { "-20", "-10", "0", "10", "20", "30", "40", "50", "60", "70", "80", "90", "100", "110", "120" };
#region 初始化字体和画笔
Font font_title_picture = new Font("宋体", 14);
Font font_title_xy = new Font("宋体", 12);
Font font_xy = new Font("宋体", 11);
Pen pen_dash = new Pen(Color.LightGray);
pen_dash.DashStyle = DashStyle.Dash;
Pen pen_light = new Pen(Color.LightGray);
pen_light.DashStyle = DashStyle.Solid;
Pen pen_value_zuo = new Pen(Color.Blue, 2);
pen_value_zuo.DashStyle = DashStyle.Solid;
Pen pen_value_you = new Pen(Color.Red, 2);
pen_value_you.DashStyle = DashStyle.Solid;
#endregion
//画图初始化
int iWidth = 500;//宽度
int iHieght = 500;//高度
Bitmap bmap = new Bitmap(iWidth, iHieght);
Graphics gph = Graphics.FromImage(bmap);
try
{
#region 正向
if (enumUpDown == EnumUpDown.正向)
{
gph.Clear(Color.White);
//设置中心点:在物理图的左下角,也就是Ymax和X0的位置附近
PointF theOPoint = new PointF(iOPointX_up, iOPointY_up);
//图表标题
gph.DrawString(enumLeftRight == EnumLeftRight.右耳 ? "右耳(R)" : "左耳(L)", font_title_picture, enumLeftRight == EnumLeftRight.右耳 ? Brushes.Red : Brushes.Blue, new PointF(theOPoint.X + 60, theOPoint.X));
//画x轴线和 X轴名称
gph.DrawLine(Pens.Black, theOPoint.X, theOPoint.Y, iWidth, theOPoint.Y);
gph.DrawString("赫兹(Hz)", font_title_xy, Brushes.Black, new PointF(theOPoint.Y - 20, theOPoint.Y + 25));
//画y轴线和 Y轴名称
gph.DrawLine(Pens.Black, theOPoint.X, theOPoint.Y, theOPoint.X, 0);
gph.DrawString("分贝", font_title_xy, Brushes.Black, new PointF(0, 7));
gph.DrawString("(dB)", font_title_xy, Brushes.Black, new PointF(0, 25));
//画y轴刻度和刻度线
for (int i = 0; i < y_dB.Length; i++)
{
//画Y轴刻度【与标题冲突,所以把120的隐藏】
gph.DrawString(y_dB[i], font_xy, enumLeftRight == EnumLeftRight.右耳 ? Brushes.Red : Brushes.Blue, new PointF(theOPoint.X - iYSpan, theOPoint.Y - i * iYSpan - 6));
//画网格线(圆点不画)
if (i > 0)
{
gph.DrawLine(pen_light, theOPoint.X, theOPoint.Y - i * iYSpan, iWidth, theOPoint.Y - i * iYSpan);
}
//半网格虚线
gph.DrawLine(pen_dash, theOPoint.X, theOPoint.Y - i * iYSpan - iYSpan / 2, iWidth, theOPoint.Y - i * iYSpan - iYSpan / 2);
}
//画x轴刻度和X轴线
for (int i = 0; i < x_Hz.Length; i++)
{
//画x轴刻度
gph.DrawString(x_Hz[i], font_xy, enumLeftRight == EnumLeftRight.右耳 ? Brushes.Red : Brushes.Blue, new PointF(theOPoint.X + i * iXSpan - 5, theOPoint.Y + 10));
if (i > 0)
{
gph.DrawLine(pen_light, theOPoint.X + i * iXSpan, 0, theOPoint.X + i * iXSpan, theOPoint.Y);
}
}
//画值点和连线
for (int i = 0; i < xy_Value.Length; i++)
{
//画点 气导左x右o
if (enumAirBone == EnumAirBone.气导)
{
if (enumLeftRight == EnumLeftRight.右耳)
{// Y坐标纠正:iYSpan*2 起点是-20, iYSpan起点是-10
gph.DrawEllipse(pen_value_you, theOPoint.X + i * iXSpan + iXSpan - 3, theOPoint.Y - iYSpan * 2 - xy_Value[i] * iY - 3, 气导圆大小, 气导圆大小);
}
else
{
gph.DrawLine(pen_value_zuo, theOPoint.X + i * iXSpan + iXSpan - 气导叉大小, theOPoint.Y - iYSpan * 2 - xy_Value[i] * iY - 气导叉大小, theOPoint.X + i * iXSpan + iXSpan + 气导叉大小, theOPoint.Y - iYSpan * 2 - xy_Value[i] * iY + 气导叉大小);
gph.DrawLine(pen_value_zuo, theOPoint.X + i * iXSpan + iXSpan - 气导叉大小, theOPoint.Y - iYSpan * 2 - xy_Value[i] * iY + 气导叉大小, theOPoint.X + i * iXSpan + iXSpan + 气导叉大小, theOPoint.Y - iYSpan * 2 - xy_Value[i] * iY - 气导叉大小);
}
}
else//骨导左>右<
{
if (enumLeftRight == EnumLeftRight.右耳)
{
gph.DrawCurve(pen_value_you, new PointF[] { new PointF(theOPoint.X + i * iXSpan + iXSpan - 3 + 骨导曲线大小, theOPoint.Y - iYSpan * 2 - xy_Value[i] * iY - 骨导曲线大小), new PointF(theOPoint.X + i * iXSpan + iXSpan - 3, theOPoint.Y - iYSpan - xy_Value[i] * iY - 20), new PointF(theOPoint.X + i * iXSpan + iXSpan - 3 + 骨导曲线大小, theOPoint.Y - iYSpan * 2 - xy_Value[i] * iY + 骨导曲线大小) }, 骨导曲线曲度);
}
else
{
gph.DrawCurve(pen_value_zuo, new PointF[] { new PointF(theOPoint.X + i * iXSpan + iXSpan - 骨导曲线大小, theOPoint.Y - iYSpan * 2 - xy_Value[i] * iY - 3 - 骨导曲线大小), new PointF(theOPoint.X + i * iXSpan + iXSpan, theOPoint.Y - iYSpan - xy_Value[i] * iY - 3 - 20), new PointF(theOPoint.X + i * iXSpan + iXSpan - 骨导曲线大小, theOPoint.Y - iYSpan * 2 - xy_Value[i] * iY - 3 + 骨导曲线大小) }, 骨导曲线曲度);
}
}
//画数值Label
gph.DrawString(xy_Value[i].ToString(), font_xy, Brushes.Black, new PointF(theOPoint.X + i * iXSpan + iXSpan - 8, theOPoint.Y - iYSpan * 2 - xy_Value[i] * iY - 20));
//画折线
if (i > 0)
{
gph.DrawLine(Pens.Black, theOPoint.X + (i - 1) * iXSpan + iXSpan, theOPoint.Y - iYSpan * 2 - xy_Value[i - 1] * iY, theOPoint.X + i * iXSpan + iXSpan, theOPoint.Y - iYSpan * 2 - xy_Value[i] * iY);
}
}
}
#endregion
#region 反向
else//反向
{
gph.Clear(Color.White);
//设置中心点:在物理图的左上角,也就是Y0和X0的位置附近
PointF theOPoint = new PointF(iOPointX_down, iOPointY_down);//50,50
//图表标题
gph.DrawString(enumLeftRight == EnumLeftRight.右耳 ? "右耳(R)" : "左耳(L)", font_title_picture, Brushes.Black, new PointF(iWidth - 120, iHieght - 80));
//画x轴线和 X轴名称
gph.DrawLine(Pens.Black, theOPoint.X, theOPoint.Y, iWidth, theOPoint.Y);
gph.DrawString("赫兹(Hz)", font_title_xy, Brushes.Black, new PointF(iWidth - 80, 10));
//画y轴线和 Y轴名称
gph.DrawLine(Pens.Black, theOPoint.X, theOPoint.Y, theOPoint.X, 450);
gph.DrawString("分贝", font_title_xy, Brushes.Black, new PointF(0, 450));
gph.DrawString("(dB)", font_title_xy, Brushes.Black, new PointF(0, 475));
//画y轴刻度和刻度线
for (int i = 0; i < y_dB.Length; i++)
{
//画Y轴刻度【与标题冲突,所以把120的隐藏】
if (y_dB[i].Equals("120")) { }
else
{
gph.DrawString(y_dB[i], font_xy, enumLeftRight == EnumLeftRight.右耳 ? Brushes.Red : Brushes.Blue, new PointF(theOPoint.X - iYSpan, theOPoint.Y + i * iYSpan - 6));
}
//画刻度线
//gph.DrawLine(Pens.Black, theOPoint.X - 6, theOPoint.Y + i * iYSpan - 3, theOPoint.X, theOPoint.Y + i * iYSpan);
//画网格线(圆点不画)
if (i > 0)
{
gph.DrawLine(pen_light, theOPoint.X, theOPoint.Y + i * iYSpan, iWidth, theOPoint.Y + i * iYSpan);
}
//画半刻度线
//gph.DrawLine(pen_dash, theOPoint.X + 3, theOPoint.Y + i * iYSpan + iYSpan / 2 + 3, theOPoint.X, theOPoint.Y + i * iYSpan + iYSpan / 2);
//半网格虚线
gph.DrawLine(pen_dash, theOPoint.X, theOPoint.Y + i * iYSpan + iYSpan / 2, iWidth, theOPoint.Y + i * iYSpan + iYSpan / 2);
}
//画x轴刻度和X轴线
for (int i = 0; i < x_Hz.Length; i++)
{
//画x轴刻度
gph.DrawString(x_Hz[i], font_xy, enumLeftRight == EnumLeftRight.右耳 ? Brushes.Red : Brushes.Blue, new PointF(theOPoint.X + i * iXSpan, theOPoint.Y - 20));
//话X轴刻度线
//gph.DrawLine(Pens.Black, theOPoint.X + i * iXSpan, theOPoint.Y, theOPoint.X + i * iXSpan + 3, theOPoint.Y - 3);
if (i > 0)
{
gph.DrawLine(pen_light, theOPoint.X + i * iXSpan, iHieght, theOPoint.X + i * iXSpan, theOPoint.Y);
}
}
//画值点和连线
for (int i = 0; i < xy_Value.Length; i++)
{
//画点 气导左x右o
if (enumAirBone == EnumAirBone.气导)
{
if (enumLeftRight == EnumLeftRight.右耳)
{
gph.DrawEllipse(pen_value_you, theOPoint.X + i * iXSpan + iXSpan - 3, theOPoint.Y + iYSpan * 2 + xy_Value[i] * iY - 3, 气导圆大小, 气导圆大小);
}
else
{
gph.DrawLine(pen_value_zuo, theOPoint.X + i * iXSpan + iXSpan - 气导叉大小, theOPoint.Y + iYSpan * 2 + xy_Value[i] * iY - 气导叉大小,
theOPoint.X + i * iXSpan + iXSpan + 气导叉大小, theOPoint.Y + iYSpan * 2 + xy_Value[i] * iY + 气导叉大小);
gph.DrawLine(pen_value_zuo, theOPoint.X + i * iXSpan + iXSpan - 气导叉大小, theOPoint.Y + iYSpan * 2 + xy_Value[i] * iY + 气导叉大小,
theOPoint.X + i * iXSpan + iXSpan + 气导叉大小, theOPoint.Y + iYSpan * 2 + xy_Value[i] * iY - 气导叉大小);
}
}
else//骨导左>右<
{
if (enumLeftRight == EnumLeftRight.右耳)
{
gph.DrawCurve(pen_value_you, new PointF[] {
new PointF(theOPoint.X + i * iXSpan+ iXSpan - 3 + 骨导曲线大小, theOPoint.Y + iYSpan*2 + xy_Value[i] * iY - 骨导曲线大小),
new PointF(theOPoint.X + i * iXSpan + iXSpan- 3, theOPoint.Y + iYSpan*2 + xy_Value[i] * iY),
new PointF(theOPoint.X + i * iXSpan+ iXSpan - 3 + 骨导曲线大小, theOPoint.Y + iYSpan*2 + xy_Value[i] * iY + 骨导曲线大小) }, 骨导曲线曲度);
}
else
{
gph.DrawCurve(pen_value_zuo, new PointF[] {
new PointF(theOPoint.X + i * iXSpan+ iXSpan - 骨导曲线大小, theOPoint.Y + iYSpan*2 + xy_Value[i] * iY - 3 - 骨导曲线大小),
new PointF(theOPoint.X + i * iXSpan+ iXSpan, theOPoint.Y + iYSpan*2 + xy_Value[i] * iY - 3),
new PointF(theOPoint.X + i * iXSpan + iXSpan- 骨导曲线大小, theOPoint.Y + iYSpan*2 + xy_Value[i] * iY - 3 + 骨导曲线大小) }, 骨导曲线曲度);
}
}
//画数值
gph.DrawString(xy_Value[i].ToString(), font_xy, Brushes.Black, new PointF(theOPoint.X + i * iXSpan + iXSpan - 8, theOPoint.Y + iYSpan * 2 + xy_Value[i] * iY - 15));
//画折线
if (i > 0)
gph.DrawLine(Pens.Black, theOPoint.X + (i - 1) * iXSpan + iXSpan, theOPoint.Y + iYSpan * 2 + xy_Value[i - 1] * iY, theOPoint.X + i * iXSpan + iXSpan, theOPoint.Y + iYSpan * 2 + xy_Value[i] * iY);
}
}
#endregion
return bmap;
}
finally
{
gph.Dispose();
}
}
/// <summary>
/// 取修正值 125Hz-8000Hz
/// </summary>
/// <param name="hz"></param>
/// <param name="result"></param>
/// <param name="age"></param>
/// <param name="sex"></param>
/// <returns></returns>
public static int FixValue(EnumHz hz, int result, int age, EnumSex4Input sex)
{
switch (hz)
{
case EnumHz.Hz8000:
{
switch (sex)
{
case EnumSex4Input.男:
{
if (age >= 70)
{
result = result - 60;
}
else
if (age >= 60)
{
result = result - 39;
}
else
if (age >= 50)
{
result = result - 23;
}
else
if (age >= 40)
{
result = result - 11;
}
else
if (age >= 30)
{
result = result - 3;
}
break;
}
case EnumSex4Input.女:
{
if (age >= 70)
{
result = result - 41;
}
else
if (age >= 60)
{
result = result - 27;
}
else
if (age >= 50)
{
result = result - 15;
}
else
if (age >= 40)
{
result = result - 7;
}
else
if (age >= 30)
{
result = result - 2;
}
break;
}
}
break;
}
case EnumHz.Hz6000:
{
switch (sex)
{
case EnumSex4Input.男:
{
if (age >= 70)
{
result = result - 49;
}
else
if (age >= 60)
{
result = result - 32;
}
else
if (age >= 50)
{
result = result - 18;
}
else
if (age >= 40)
{
result = result - 9;
}
else
if (age >= 30)
{
result = result - 3;
}
break;
}
case EnumSex4Input.女:
{
if (age >= 70)
{
result = result - 32;
}
else
if (age >= 60)
{
result = result - 21;
}
else
if (age >= 50)
{
result = result - 12;
}
else
if (age >= 40)
{
result = result - 6;
}
else
if (age >= 30)
{
result = result - 2;
}
break;
}
}
break;
}
case EnumHz.Hz4000:
{
switch (sex)
{
case EnumSex4Input.男:
{
if (age >= 70)
{
result = result - 43;
}
else
if (age >= 60)
{
result = result - 28;
}
else
if (age >= 50)
{
result = result - 16;
}
else
if (age >= 40)
{
result = result - 8;
}
else
if (age >= 30)
{
result = result - 2;
}
break;
}
case EnumSex4Input.女:
{
if (age >= 70)
{
result = result - 24;
}
else
if (age >= 60)
{
result = result - 16;
}
else
if (age >= 50)
{
result = result - 9;
}
else
if (age >= 40)
{
result = result - 4;
}
else
if (age >= 30)
{
result = result - 1;
}
break;
}
}
break;
}
case EnumHz.Hz3000:
{
switch (sex)
{
case EnumSex4Input.男:
{
if (age >= 70)
{
result = result - 31;
}
else
if (age >= 60)
{
result = result - 20;
}
else
if (age >= 50)
{
result = result - 12;
}
else
if (age >= 40)
{
result = result - 6;
}
else
if (age >= 30)
{
result = result - 2;
}
break;
}
case EnumSex4Input.女:
{
if (age >= 70)
{
result = result - 20;
}
else
if (age >= 60)
{
result = result - 13;
}
else
if (age >= 50)
{
result = result - 8;
}
else
if (age >= 40)
{
result = result - 4;
}
else
if (age >= 30)
{
result = result - 1;
}
break;
}
}
break;
}
case EnumHz.Hz2000:
{
switch (sex)
{
case EnumSex4Input.男:
{
if (age >= 70)
{
result = result - 19;
}
else
if (age >= 60)
{
result = result - 12;
}
else
if (age >= 50)
{
result = result - 7;
}
else
if (age >= 40)
{
result = result - 3;
}
else
if (age >= 30)
{
result = result - 1;
}
break;
}
case EnumSex4Input.女:
{
if (age >= 70)
{
result = result - 16;
}
else
if (age >= 60)
{
result = result - 11;
}
else
if (age >= 50)
{
result = result - 6;
}
else
if (age >= 40)
{
result = result - 3;
}
else
if (age >= 30)
{
result = result - 1;
}
break;
}
}
break;
}
case EnumHz.Hz1000:
{
if (age >= 70)
{
result = result - 11;
}
else
if (age >= 60)
{
result = result - 7;
}
else
if (age >= 50)
{
result = result - 4;
}
else
if (age >= 40)
{
result = result - 2;
}
else
if (age >= 30)
{
result = result - 1;
}
break;
}
case EnumHz.Hz500:
{
if (age >= 70)
{
result = result - 9;
}
else
if (age >= 60)
{
result = result - 6;
}
else
if (age >= 50)
{
result = result - 4;
}
else
if (age >= 40)
{
result = result - 2;
}
else
if (age >= 30)
{
result = result - 1;
}
break;
}
case EnumHz.Hz250:
case EnumHz.Hz125:
{
if (age >= 70)
{
result = result - 8;
}
else
if (age >= 60)
{
result = result - 5;
}
else
if (age >= 50)
{
result = result - 3;
}
else
if (age >= 40)
{
result = result - 2;
}
else
if (age >= 30)
{
result = result - 0;
}
break;
}
}
return result;
}
}
}