
// VerbpoDlg.cpp : 实现文件
//

#include "stdafx.h"
#include "Verbpo.h"
#include "VerbpoDlg.h"
#include "DlgProxy.h"
#include "afxdialogex.h"
#include "UartDataThread.h"
#include "ThreadDataAlmRec.h"
#include "Data.h"
#include "Patient.h"
#include "ThreadDraw.h"

#include "WaveFile.h"
#pragma comment(lib,"dxguid")
#include <mmsystem.h>
#include <dsound.h>
#pragma comment(lib,"dsound")
#pragma comment(lib, "dxguid.lib ")
#pragma comment(lib, "winmm.lib")
#pragma comment(lib, "dsound.lib")
#pragma comment(lib, "DxErr.lib")
#ifdef _DEBUG
#define new DEBUG_NEW
#endif

//http://download.csdn.net/detail/caiming1987612/1890778  VC TAB 控件派生类  
//http://download.csdn.net/detail/tian870216/9342583 VC MFC CEDIT派生类 控件背景色 字体修改
//http://www.softechsoftware.it/main.html 
// CVerbpoDlg 对话框

INT CVerbpoDlg::m_i32Normal_ECG_X = 940, CVerbpoDlg::m_i32Normal_ECG_Y=60;

IMPLEMENT_DYNAMIC(CVerbpoDlg, CDialogEx);

CVerbpoDlg::CVerbpoDlg(CWnd* pParent /*=NULL*/)
	: CDialogEx(CVerbpoDlg::IDD, pParent)
{
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
	m_pAutoProxy = NULL;
}

CVerbpoDlg::~CVerbpoDlg()
{
	int i = 0;
	// 如果该对话框有自动化代理，则
	//  将此代理指向该对话框的后向指针设置为 NULL，以便
	//  此代理知道该对话框已被删除。
	if (m_pAutoProxy != NULL)
		m_pAutoProxy->m_pDialog = NULL;


	delete MainButtonShow;//0
	delete MainButtonLeft;
	delete MainButtonRight;
	delete MainButtonMute;//1
	delete MainButtonPrint;//2
	delete MainButtonDataRec;//3
	delete MainButtonBP;//4
	delete MainButtonFreeze;//5
	delete MainButtonAlarmSet;//6
	delete MainButtonAlarmRec;
	delete MainButtonTrendChartRec;//7
	delete MainButtonTrendTableRec;//8
	delete MainButtonTrendNIBPRec;//9
	delete MainButtonSysRec;
	delete MainButtonPat;//10
	delete MainButtonMedCal;//11
	delete MainButtonSys;//11
	delete MainButtonMenu;//12
	delete MainButtonShut;//13


	delete NormalLabelECG1;
	delete NormalLabelECG2;
	delete NormalLabelResp;
	delete NormalLabelPleth;


	for (i = 0; i < 7; i++)
	{
		delete m_pCECGWaveN[i];
	}

	delete m_pCRespWave;
	delete m_pCPlethWave;

	for (i = 0; i < 7; i++)
	{
		delete m_stECGData.pECGData[i];
	}
	
	delete m_stRespData.pRespData ;
	delete m_stOXYData.pPlethData ;
	

	delete NormalComboECG1Lead;
	delete NormalComboECG2Lead;
	delete NormalComboECGFilter;
	delete NormalComboECGSpeed;
	delete NormalComboECGGain;
	delete NormalComboRespSpeed;
	delete NormalComboRespGain;
	delete NormalComboPlethSpeed;

	delete m_ECGValueNormal;
	delete m_BPValueNormal;
	delete m_TempValueNormal;
	delete m_SPO2ValueNormal;
	delete m_RespValueNormal;
	delete m_FAValueNormal;
	delete m_pCECGRespSpo2Trend;
	delete m_DisplayField;

	delete m_ECGTrendResult;
	delete m_NIBPTrendResult;
	delete m_TempTrendResult;
	delete m_Spo2TrendResult;
	delete m_RespTrendResult;
	delete m_AirOxyTrendResult;
}

void CVerbpoDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_COMBO_COM_HR, m_ComboComHR);
	DDX_Control(pDX, IDC_COMBO_COM_ST, m_ComboComST);
	DDX_Control(pDX, IDC_COMBO_COM_RR, m_ComboComRR);
	DDX_Control(pDX, IDC_COMBO_COM_SPO2, m_ComboComSpo2);
	DDX_Control(pDX, IDC_COMBO_COM_PR, m_ComboComPR);
	DDX_Control(pDX, IDC_COMBO_COM_TEMP, m_ComboComTemp);
	DDX_Control(pDX, IDC_BUTTON_COM_APNEA, m_CButtonComAPNEA);
	DDX_Control(pDX, IDC_BUTTON_COM_SPO2_ALM_FIGNER, m_CButtonComFinger);
	DDX_Control(pDX, IDC_BUTTON_COM_SPO2_PROBE, m_CButtonComProbe);
	DDX_Control(pDX, IDC_BUTTON_COM_TEMP_ALM, m_CButtonComTempProbe);
	DDX_Control(pDX, IDC_COMBO_COM_SBP, m_ComboComSBP);
	DDX_Control(pDX, IDC_COMBO_COM_DBP, m_ComboComDBP);
	DDX_Control(pDX, IDC_BUTTON_COM_NIBP, m_ButtonComNIBP);
	DDX_Control(pDX, IDC_COMBO_COM_OXY, m_ComboComOXY);
	DDX_Control(pDX, IDC_BUTTON_COM_OXY_ALM, m_ButtonComOXYAlm);
	DDX_Control(pDX, IDC_COMBO_COM_LEAD, m_CComboComLead);
	DDX_Control(pDX, IDC_COMBO_COM_ARRA, m_CComboComARRA);
	DDX_Control(pDX, IDC_COMBO_COM_FINGER, m_CComboFinger);
	DDX_Control(pDX, IDC_COMBO_COM_PROBE, m_CComboProbe);
	DDX_Control(pDX, IDC_COMBO_COM_AIROXY_PROBE, m_CComboAirOxyProbe);
	DDX_Control(pDX, IDC_COMBO_COM_TEMP_PROBE, m_CComboTempProbe);
	DDX_Control(pDX, IDC_COMBO_COM_APNEA, m_CComboAPNEA);
}



BEGIN_MESSAGE_MAP(CVerbpoDlg, CDialogEx)
	ON_MESSAGE(WM_STATIC_VALUE_ECG_NORMAL_DBLCLK, OnStaticValueECGNormalDBLCLK)
	ON_MESSAGE(WM_STATIC_VALUE_BP_NORMAL_DBLCLK, OnStaticValueBPNormalDBLCLK)
	ON_MESSAGE(WM_STATIC_VALUE_TEMP_NORMAL_DBLCLK, OnStaticValueTEMPNormalDBLCLK)
	ON_MESSAGE(WM_STATIC_VALUE_OXY_NORMAL_DBLCLK, OnStaticValueOXYNormalDBLCLK)
	ON_MESSAGE(WM_STATIC_VALUE_RESP_NORMAL_DBLCLK, OnStaticValueRESPNormalDBLCLK)
	ON_MESSAGE(WM_STATIC_VALUE_FA_NORMAL_DBLCLK, OnStaticValueFANormalDBLCLK)
	ON_CBN_SELCHANGE(IDC_NORMAL_COMBO_LEAD1, &CVerbpoDlg::OnCbnSelchangeComboLead1)
	ON_CBN_SELCHANGE(IDC_NORMAL_COMBO_LEAD2, &CVerbpoDlg::OnCbnSelchangeComboLead2)
	ON_CBN_SELCHANGE(IDC_NORMAL_COMBO_FILTER, &CVerbpoDlg::OnCbnSelchangeComboECGFilter)
	ON_CBN_SELCHANGE(IDC_NORMAL_COMBO_SPEED, &CVerbpoDlg::OnCbnSelchangeComboECGSpeed)
	ON_CBN_SELCHANGE(IDC_NORMAL_COMBO_GAIN, &CVerbpoDlg::OnCbnSelchangeComboECGGain)
	ON_CBN_SELCHANGE(IDC_NORMAL_COMBO_RESP_SPEED, &CVerbpoDlg::OnCbnSelchangeComboRespSpeed)
	ON_CBN_SELCHANGE(IDC_NORMAL_COMBO_RESP_GAIN, &CVerbpoDlg::OnCbnSelchangeComboRespGain)
	ON_CBN_SELCHANGE(IDC_NORMAL_COMBO_PLETH_SPEED, &CVerbpoDlg::OnCbnSelchangeComboPlethSpeed)
	ON_BN_CLICKED(IDC_MAIN_BUTTON_SHOW, OnBnClickedButtonShow)
	ON_BN_CLICKED(IDC_MAIN_BUTTON_LEFT, OnBnClickedButtonLeft)
	ON_BN_CLICKED(IDC_MAIN_BUTTON_RIGHT, OnBnClickedButtonRight)
	ON_BN_CLICKED(IDC_MAIN_BUTTON_MUTE, OnBnClickedButtonMute)
	ON_BN_CLICKED(IDC_MAIN_BUTTON_PRINT, OnBnClickedButtonPrint)
	ON_BN_CLICKED(IDC_MAIN_BUTTON_DATA_REC, OnBnClickedButtonDataRec)
	ON_BN_CLICKED(IDC_MAIN_BUTTON_BP, OnBnClickedButtonBP)
	ON_BN_CLICKED(IDC_MAIN_BUTTON_PRINT, OnBnClickedButtonPrint)
	ON_BN_CLICKED(IDC_MAIN_BUTTON_FREEZE, OnBnClickedButtonFreeze)
	ON_BN_CLICKED(IDC_MAIN_BUTTON_ALARM, OnBnClickedButtonAlarmSet)
	ON_BN_CLICKED(IDC_MAIN_BUTTON_ALARM_REC, OnBnClickedButtonAlarmRec)
	ON_BN_CLICKED(IDC_MAIN_BUTTON_TREND_CHART_REC, OnBnClickedButtonTrendChartRec)
	ON_BN_CLICKED(IDC_MAIN_BUTTON_TREND_TABLE_REC, OnBnClickedButtonTrendTableRec)
	ON_BN_CLICKED(IDC_MAIN_BUTTON_NIBP_REC, OnBnClickedButtonNIBPRec)
	ON_BN_CLICKED(IDC_MAIN_BUTTON_SYS_REC, OnBnClickedButtonSysRec)
	ON_BN_CLICKED(IDC_MAIN_BUTTON_PAT, OnBnClickedButtonPat)
	ON_BN_CLICKED(IDC_MAIN_BUTTON_MEDCAL, OnBnClickedButtonMedCal)
	ON_BN_CLICKED(IDC_MAIN_BUTTON_SYS, OnBnClickedButtonSys)
	ON_BN_CLICKED(IDC_MAIN_BUTTON_MENU, OnBnClickedButtonMenu)
	ON_BN_CLICKED(IDC_MAIN_BUTTON_SHUT, OnBnClickedButtonShut)
	
	ON_WM_CLOSE()
	ON_WM_PAINT()
	ON_WM_QUERYDRAGICON()
	ON_WM_TIMER()
	ON_CBN_SELCHANGE(IDC_COMBO_COM_SPO2, &CVerbpoDlg::OnCbnSelchangeComboComSpo2)
	ON_CBN_SELCHANGE(IDC_COMBO_COM_PR, &CVerbpoDlg::OnCbnSelchangeComboComPr)
	ON_BN_CLICKED(IDC_BUTTON_COM_SPO2_ALM_FIGNER, &CVerbpoDlg::OnBnClickedButtonComSpo2AlmFigner)
	ON_BN_CLICKED(IDC_BUTTON_COM_SPO2_PROBE, &CVerbpoDlg::OnBnClickedButtonComSpo2Probe)
	ON_CBN_SELCHANGE(IDC_COMBO_COM_TEMP, &CVerbpoDlg::OnCbnSelchangeComboComTemp)
	ON_BN_CLICKED(IDC_BUTTON_COM_TEMP_ALM, &CVerbpoDlg::OnBnClickedButtonComTempAlm)
	ON_CBN_SELCHANGE(IDC_COMBO_COM_HR, &CVerbpoDlg::OnCbnSelchangeComboComHr)
	ON_CBN_SELCHANGE(IDC_COMBO_COM_ST, &CVerbpoDlg::OnCbnSelchangeComboComSt)
	ON_CBN_SELCHANGE(IDC_COMBO_COM_RR, &CVerbpoDlg::OnCbnSelchangeComboComRr)
	ON_BN_CLICKED(IDC_BUTTON_COM_APNEA, &CVerbpoDlg::OnBnClickedButtonComApnea)
	ON_CBN_SELCHANGE(IDC_COMBO_COM_SBP, &CVerbpoDlg::OnCbnSelchangeComboComSbp)
	ON_CBN_SELCHANGE(IDC_COMBO_COM_DBP, &CVerbpoDlg::OnCbnSelchangeComboComDbp)
	ON_BN_CLICKED(IDC_BUTTON_COM_NIBP, &CVerbpoDlg::OnBnClickedButtonComNibp)
	ON_CBN_SELCHANGE(IDC_COMBO_COM_OXY, &CVerbpoDlg::OnCbnSelchangeComboComOxy)
	ON_BN_CLICKED(IDC_BUTTON_COM_OXY_ALM, &CVerbpoDlg::OnBnClickedButtonComOxyAlm)
	ON_CBN_SELCHANGE(IDC_COMBO_COM_LEAD, &CVerbpoDlg::OnCbnSelchangeComboComLead)
	ON_CBN_SELCHANGE(IDC_COMBO_COM_ARRA, &CVerbpoDlg::OnCbnSelchangeComboComArra)
	ON_CBN_SELCHANGE(IDC_COMBO_COM_FINGER, &CVerbpoDlg::OnCbnSelchangeComboComFinger)
	ON_CBN_SELCHANGE(IDC_COMBO_COM_PROBE, &CVerbpoDlg::OnCbnSelchangeComboComProbe)
	ON_CBN_SELCHANGE(IDC_COMBO_COM_TEMP_PROBE, &CVerbpoDlg::OnCbnSelchangeComboComTempProbe)
	ON_CBN_SELCHANGE(IDC_COMBO_COM_AIROXY_PROBE, &CVerbpoDlg::OnCbnSelchangeComboComAiroxyProbe)
	ON_CBN_SELCHANGE(IDC_COMBO_COM_APNEA, &CVerbpoDlg::OnCbnSelchangeComboComApnea)
END_MESSAGE_MAP()


// CVerbpoDlg 消息处理程序

BOOL CVerbpoDlg::OnInitDialog()
{
	int i = 0;
	CRect     rect;
//	CPatient a_CPatient;
	CDialogEx::OnInitDialog();

	// 设置此对话框的图标。  当应用程序主窗口不是对话框时，框架将自动
	//  执行此操作
	SetIcon(m_hIcon, TRUE);			// 设置大图标
	SetIcon(m_hIcon, FALSE);		// 设置小图标
	
	// TODO:  在此添加额外的初始化代码
	//this->SetBackgroundColor(RGB(100, 0, 0),0);
	
	//获取编译日期、时间
	CString aa(__DATE__); //"Sep 18 2010"
	CString bb( __TIME__);    //"10:59:19"

	theApp.m_csCompile.Format(_T("%s %s"), CString(__DATE__), CString(__TIME__));

	GetWindowRect(&rect);
	ClientToScreen(&rect);
	this->MoveWindow(0, 0, 1400, 800);
	
	m_i32X = rect.left, m_i32Y = rect.top, m_i32Width = rect.Width(), m_i32Height = rect.Height();
//	theApp.m_Data->Get_Pat(a_CPatient);
	m_i32AlmMute=0, m_i32AlmTime=0;
	m_i32AlmVolTypeLast = 0, m_i32AlmVolTimeLast = 0;
	m_i32Freeze = 0;

	for (i = 0; i < 7; i++)
	{
		m_stECGData.pECGData[i] = new UINT16[64];
	}
	m_stECGData.i32Length = 64;


	m_stRespData.pRespData = new UINT8[64];
	m_stRespData.i32Length = 64;

	m_stOXYData.pPlethData = new UINT8[64];
	m_stOXYData.i32Length = 64;

	m_CFont.CreatePointFont(100, _T("宋体"), NULL);

	//初始化 心律、血氧饱和度呼吸趋势共存图 绘制 线程
	theApp.m_pThrdDraw = AfxBeginThread(RUNTIME_CLASS(CThreadDraw));
	
	//初始化 串口通讯 线程
	theApp.m_pThrdUart = AfxBeginThread(RUNTIME_CLASS(UartDataThread));
	theApp.m_pThrdUart->ResumeThread();

	//初始化 数据、报警和记录实时保存与回顾 线程
	theApp.m_pThrdDataSave = AfxBeginThread(RUNTIME_CLASS(CThreadDataAlmRec));
	theApp.m_pThrdDataSave->ResumeThread();

	
	theApp.m_pThrdDraw->ResumeThread();
	
	((CThreadDataAlmRec *)(theApp.m_pThrdDataSave))->Add_Sys_PowerON();

	InitButton();
	InitNormalShow();
	InitTrendResult();

	InitComWidget();
	Init_ECG_Para_Set();
	Init_Resp_Para_Set();
	Init_Oxy_Para_Set();
	Init_Temp_Para_Set();
	Init_NIBP_Para_Set();
	Init_AirOxy_Para_Set();


	struct NIBP_DATA a_stNIBP_DATA;
	a_stNIBP_DATA.i16SBP=100;
	a_stNIBP_DATA.i16DBP = 80;
	a_stNIBP_DATA.i16MBP = 90;
	a_stNIBP_DATA.i16PR=80;
	//((CThreadDataAlmRec *)(theApp.m_pThrdDataSave))->Save_NIBP(&a_stNIBP_DATA);

	a_stNIBP_DATA.i16SBP = 101;
	a_stNIBP_DATA.i16DBP = 81;
	a_stNIBP_DATA.i16MBP = 91;
	a_stNIBP_DATA.i16PR = 81;
	//((CThreadDataAlmRec *)(theApp.m_pThrdDataSave))->Save_NIBP(&a_stNIBP_DATA);

	m_i32AlmVolTimeLast = GetTickCount();
	m_i321MinTimerStart = GetTickCount();
	m_i3230SecTimerStart = m_i321MinTimerStart;
	m_i321SecTimerStart2 += 200;
	DWORD dwError;
	CString mci_string;
	WCHAR song_name[50];

	VERIFY(m_sndSound1.Create(IDR_WAVE2));
	VERIFY(m_sndSoundAlmH.Create(IDR_WAVE_ALM_H));
	VERIFY(m_sndSoundAlmM.Create(IDR_WAVE_ALM_M));
	VERIFY(m_sndSoundAlmL.Create(IDR_WAVE_ALM_L));
	//Sleep(1000);
	//m_sndSound1.Play();

	//mci_string = _T("open test_tone.wav type MPEGVideo alias NOWMUSIC");
	//dwError = mciSendString(mci_string, song_name, 50, NULL);//命令"open 1.mp3  alias 设备1"也可以写成"open 1.mp3 type mpegvideo alias 设备1",不写的话系统会自己寻找对应设备。“alias 设备1”是另外起名为设备1，以后播放的时候直接用“设备1”即可。
	//if (dwError)
	//{
	//	
	//}
	//
	//mciSendString(_T("set 设备1 time format TMSF"), song_name, 50, NULL);//设置时间格式为分秒格
	//mci_string = _T("setaudio  NOWMUSIC volume to 10");
	//mciSendString(_T("play  NOWMUSIC"), song_name, 50, NULL);//如果要单首歌曲循环播放。"play 设备1 repeat"
	//dwError = mciSendString(mci_string, NULL, 0, NULL);
	//Sleep(3000);
	//dwError = mciSendString(_T("close  NOWMUSIC"), song_name, 50, NULL);

	////Sleep(3000);
	//mci_string = _T("open test_tone.wav type MPEGVideo alias NOWMUSIC");
	//dwError = mciSendString(mci_string, song_name, 50, NULL);//命令"open 1.mp3  alias 设备1"也可以写成"open 1.mp3 type mpegvideo alias 设备1",不写的话系统会自己寻找对应设备。“alias 设备1”是另外起名为设备1，以后播放的时候直接用“设备1”即可。
	//if (dwError)
	//{

	//}

	////mciSendString(_T("set 设备1 time format TMSF"), song_name, 50, NULL);//设置时间格式为分秒格
	//mci_string = _T("setaudio  NOWMUSIC volume to 100");
	//mciSendString(_T("play  NOWMUSIC"), song_name, 50, NULL);//如果要单首歌曲循环播放。"play 设备1 repeat"
	//dwError = mciSendString(mci_string, NULL, 0, NULL);
	//Sleep(3000);
	//dwError = mciSendString(_T("close  NOWMUSIC"), song_name, 50, NULL);
	//

	


	m_i32Timer = 0;
	SetTimer(1, 50, NULL);

	return TRUE;  // 除非将焦点设置到控件，否则返回 TRUE
}

//初始化 输入模拟数据 控件
void CVerbpoDlg::InitComWidget()
{
	m_ComboComHR.MoveWindow(CRect(1282, 10, 1380, 30));
	m_ComboComHR.AddString(CString(_T("30 rpm")));
	m_ComboComHR.AddString(CString(_T("60 rpm")));
	m_ComboComHR.AddString(CString(_T("90 rpm")));
	m_ComboComHR.AddString(CString(_T("120 rpm")));
	m_ComboComHR.AddString(CString(_T("180 rpm")));
	m_ComboComHR.AddString(CString(_T("250 rpm")));
	m_ComboComHR.AddString(CString(_T("300 rpm")));
	m_ComboComHR.SetCurSel(0);


	m_ComboComST.MoveWindow(CRect(1282, 40, 1380, 60));
	m_ComboComST.AddString(CString(_T("0")));
	m_ComboComST.AddString(CString(_T("0.2")));
	m_ComboComST.AddString(CString(_T("0.5")));
	m_ComboComST.AddString(CString(_T("1")));
	m_ComboComST.AddString(CString(_T("-0.2")));
	m_ComboComST.AddString(CString(_T("-0.5")));
	m_ComboComST.AddString(CString(_T("-1")));
	m_ComboComST.SetCurSel(0);


	m_CComboComARRA.MoveWindow(CRect(1282, 70, 1380, 90));
	m_CComboComARRA.AddString(CString(_T("无心律异常")));
	m_CComboComARRA.AddString(CString(_T("二联律")));
	m_CComboComARRA.AddString(CString(_T("三联律")));
	m_CComboComARRA.AddString(CString(_T("心动过缓")));
	m_CComboComARRA.AddString(CString(_T("心动过速")));
	m_CComboComARRA.AddString(CString(_T("室早")));
	m_CComboComARRA.AddString(CString(_T("室速")));
	m_CComboComARRA.AddString(CString(_T("室早成对")));
	m_CComboComARRA.AddString(CString(_T("停搏")));
	m_CComboComARRA.SetCurSel(0);

	m_CComboComLead.MoveWindow(CRect(1282, 100, 1380, 120));
	m_CComboComLead.AddString(CString(_T("无导联脱落")));
	m_CComboComLead.AddString(CString(_T("LA导联脱落")));
	m_CComboComLead.AddString(CString(_T("LL导联脱落")));
	m_CComboComLead.AddString(CString(_T("RA导联脱落")));
	m_CComboComLead.AddString(CString(_T("V导联脱落")));
	m_CComboComLead.SetCurSel(0);

	m_ComboComRR.MoveWindow(CRect(1282, 150, 1380, 170));
	m_ComboComRR.AddString(CString(_T("15")));
	m_ComboComRR.AddString(CString(_T("30")));
	m_ComboComRR.AddString(CString(_T("60")));
	m_ComboComRR.AddString(CString(_T("90")));
	m_ComboComRR.AddString(CString(_T("120")));
	m_ComboComRR.SetCurSel(0);


	//m_CButtonComAPNEA.MoveWindow(CRect(1282, 180, 1380, 200));
	m_CComboAPNEA.MoveWindow(CRect(1282, 180, 1380, 200));
	m_CComboAPNEA.AddString(CString(_T("无窒息")));
	m_CComboAPNEA.AddString(CString(_T("窒息")));
	m_CComboAPNEA.SetCurSel(0);

	m_ComboComSpo2.MoveWindow(CRect(1282, 230, 1380, 250));
	m_ComboComSpo2.AddString(CString(_T("100 %")));
	m_ComboComSpo2.AddString(CString(_T("95 %")));
	m_ComboComSpo2.AddString(CString(_T("90 %")));
	m_ComboComSpo2.AddString(CString(_T("80 %")));
	m_ComboComSpo2.AddString(CString(_T("70 %")));
	m_ComboComSpo2.SetCurSel(0);

	m_ComboComPR.MoveWindow(CRect(1282, 260, 1380, 280));
	m_ComboComPR.AddString(CString(_T("15 rpm")));
	m_ComboComPR.AddString(CString(_T("30 rpm")));
	m_ComboComPR.AddString(CString(_T("60 rpm")));
	m_ComboComPR.AddString(CString(_T("90 rpm")));
	m_ComboComPR.AddString(CString(_T("120 rpm")));
	m_ComboComPR.SetCurSel(0);

	m_CComboFinger.MoveWindow(CRect(1282, 290, 1380, 310));
	m_CComboFinger.AddString(CString(_T("无手指脱落")));
	m_CComboFinger.AddString(CString(_T("手指脱落")));
	m_CComboFinger.SetCurSel(0);

	m_CComboProbe.MoveWindow(CRect(1282, 320, 1380, 340));
	m_CComboProbe.AddString(CString(_T("无探头脱落")));
	m_CComboProbe.AddString(CString(_T("探头脱落")));
	m_CComboProbe.SetCurSel(0);


	//m_CButtonComFinger.MoveWindow(CRect(1282, 270, 1380, 290));

	//m_CButtonComProbe.MoveWindow(CRect(1282, 300, 1380, 320));

	m_ComboComTemp.MoveWindow(CRect(1282, 370, 1380, 390));
	m_ComboComTemp.AddString(CString(_T("37.1")));
	m_ComboComTemp.AddString(CString(_T("39.0")));
	m_ComboComTemp.AddString(CString(_T("40.0")));
	m_ComboComTemp.AddString(CString(_T("36.0")));
	m_ComboComTemp.AddString(CString(_T("35.0")));
	m_ComboComTemp.SetCurSel(0);

	//m_CButtonComTempProbe.MoveWindow(CRect(1282, 360, 1380, 380));

	m_CComboTempProbe.MoveWindow(CRect(1282, 400, 1380, 420));
	m_CComboTempProbe.AddString(CString(_T("无探头脱落")));
	m_CComboTempProbe.AddString(CString(_T("探头脱落")));
	m_CComboTempProbe.SetCurSel(0);

	m_ComboComSBP.MoveWindow(CRect(1282, 450, 1380, 470));
	m_ComboComSBP.AddString(CString(_T("60")));
	m_ComboComSBP.AddString(CString(_T("80")));
	m_ComboComSBP.AddString(CString(_T("100")));
	m_ComboComSBP.AddString(CString(_T("120")));
	m_ComboComSBP.SetCurSel(0);


	m_ComboComDBP.MoveWindow(CRect(1282, 480, 1380, 500));
	m_ComboComDBP.AddString(CString(_T("30")));
	m_ComboComDBP.AddString(CString(_T("50")));
	m_ComboComDBP.AddString(CString(_T("70")));
	m_ComboComDBP.AddString(CString(_T("80")));
	m_ComboComDBP.SetCurSel(0);


	m_ButtonComNIBP.MoveWindow(CRect(1282, 510, 1380, 530));

	m_ComboComOXY.MoveWindow(CRect(1282, 560, 1380, 580));
	m_ComboComOXY.AddString(CString(_T("30 %")));
	m_ComboComOXY.AddString(CString(_T("50 %")));
	m_ComboComOXY.AddString(CString(_T("70 %")));
	m_ComboComOXY.AddString(CString(_T("80 %")));
	m_ComboComOXY.AddString(CString(_T("100 %")));
	m_ComboComOXY.SetCurSel(0);

	m_CComboAirOxyProbe.MoveWindow(CRect(1282, 590, 1380, 610));
	m_CComboAirOxyProbe.AddString(CString(_T("无探头脱落")));
	m_CComboAirOxyProbe.AddString(CString(_T("探头脱落")));
	m_CComboAirOxyProbe.SetCurSel(0);
	//m_ButtonComOXYAlm.MoveWindow(CRect(1282, 510, 1380, 530));
}

//初始化 下方的功能按钮
void CVerbpoDlg::InitButton()
{
	MainButtonShow = new CButtonST();
	MainButtonShow->Create(_T("切换"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
		CRect(0, 745, 100, 800), this, IDC_MAIN_BUTTON_SHOW);
	MainButtonShow->SetColor(CButtonST::BTNST_COLOR_BK_OUT, RGB(0, 0, 0));
	MainButtonShow->SetColor(CButtonST::BTNST_COLOR_BK_FOCUS, RGB(0, 0, 0));
	MainButtonShow->SetColor(CButtonST::BTNST_COLOR_FG_OUT, RGB(208, 8, 208));
	MainButtonShow->SetColor(CButtonST::BTNST_COLOR_FG_IN, RGB(8, 208, 208));


	MainButtonLeft = new CButtonST();
	MainButtonLeft->Create(_T("左移"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
		CRect(100, 745, 190, 800), this, IDC_MAIN_BUTTON_LEFT);
	MainButtonLeft->SetColor(CButtonST::BTNST_COLOR_BK_OUT, RGB(0, 0, 0));
	MainButtonLeft->SetColor(CButtonST::BTNST_COLOR_BK_FOCUS, RGB(0, 0, 0));
	MainButtonLeft->SetColor(CButtonST::BTNST_COLOR_FG_OUT, RGB(208, 8, 208));
	MainButtonLeft->SetColor(CButtonST::BTNST_COLOR_FG_IN, RGB(8, 208, 208));

	MainButtonRight = new CButtonST();
	MainButtonRight->Create(_T("右移"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
		CRect(190, 745, 280, 800), this, IDC_MAIN_BUTTON_RIGHT);
	MainButtonRight->SetColor(CButtonST::BTNST_COLOR_BK_OUT, RGB(0, 0, 0));
	MainButtonRight->SetColor(CButtonST::BTNST_COLOR_BK_FOCUS, RGB(0, 0, 0));
	MainButtonRight->SetColor(CButtonST::BTNST_COLOR_FG_OUT, RGB(208, 8, 208));
	MainButtonRight->SetColor(CButtonST::BTNST_COLOR_FG_IN, RGB(8, 208, 208));

	MainButtonMute = new CButtonST();
	MainButtonMute->Create(_T("静音"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
		CRect(280, 745, 380, 800), this, IDC_MAIN_BUTTON_MUTE);
	MainButtonMute->SetColor(CButtonST::BTNST_COLOR_BK_OUT, RGB(0, 0, 0));
	MainButtonMute->SetColor(CButtonST::BTNST_COLOR_BK_FOCUS, RGB(0, 0, 0));
	MainButtonMute->SetColor(CButtonST::BTNST_COLOR_FG_OUT, RGB(208, 8, 208));
	MainButtonMute->SetColor(CButtonST::BTNST_COLOR_FG_IN, RGB(8, 208, 208));

	MainButtonPrint = new CButtonST();
	MainButtonPrint->Create(_T("记录"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
		CRect(380, 745, 480, 800), this, IDC_MAIN_BUTTON_PRINT);
	MainButtonPrint->SetColor(CButtonST::BTNST_COLOR_BK_OUT, RGB(0, 0, 0));
	MainButtonPrint->SetColor(CButtonST::BTNST_COLOR_BK_FOCUS, RGB(0, 0, 0));
	MainButtonPrint->SetColor(CButtonST::BTNST_COLOR_FG_OUT, RGB(208, 8, 208));
	MainButtonPrint->SetColor(CButtonST::BTNST_COLOR_FG_IN, RGB(8, 208, 208));

	MainButtonDataRec = new CButtonST();
	MainButtonDataRec->Create(_T("数据回顾"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
		CRect(480, 745, 580, 800), this, IDC_MAIN_BUTTON_DATA_REC);
	MainButtonDataRec->SetColor(CButtonST::BTNST_COLOR_BK_OUT, RGB(0, 0, 0));
	MainButtonDataRec->SetColor(CButtonST::BTNST_COLOR_BK_FOCUS, RGB(0, 0, 0));
	MainButtonDataRec->SetColor(CButtonST::BTNST_COLOR_FG_OUT, RGB(208, 8, 208));
	MainButtonDataRec->SetColor(CButtonST::BTNST_COLOR_FG_IN, RGB(8, 208, 208));


	MainButtonBP = new CButtonST();
	MainButtonBP->Create(_T("血压"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
		CRect(580, 745, 680, 800), this, IDC_MAIN_BUTTON_BP);
	MainButtonBP->SetColor(CButtonST::BTNST_COLOR_BK_OUT, RGB(0, 0, 0));
	MainButtonBP->SetColor(CButtonST::BTNST_COLOR_BK_FOCUS, RGB(0, 0, 0));
	MainButtonBP->SetColor(CButtonST::BTNST_COLOR_FG_OUT, RGB(208, 8, 208));
	MainButtonBP->SetColor(CButtonST::BTNST_COLOR_FG_IN, RGB(8, 208, 208));

	MainButtonFreeze = new CButtonST();
	MainButtonFreeze->Create(_T("冻结"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
		CRect(680, 745, 780, 800), this, IDC_MAIN_BUTTON_FREEZE);
	MainButtonFreeze->SetColor(CButtonST::BTNST_COLOR_BK_OUT, RGB(0, 0, 0));
	MainButtonFreeze->SetColor(CButtonST::BTNST_COLOR_BK_FOCUS, RGB(0, 0, 0));
	MainButtonFreeze->SetColor(CButtonST::BTNST_COLOR_FG_OUT, RGB(208, 8, 208));
	MainButtonFreeze->SetColor(CButtonST::BTNST_COLOR_FG_IN, RGB(8, 208, 208));

	
	MainButtonAlarmSet = new CButtonST();
	MainButtonAlarmSet->Create(_T("报警设置"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
		CRect(780, 745, 880, 800), this, IDC_MAIN_BUTTON_ALARM);
	MainButtonAlarmSet->SetColor(CButtonST::BTNST_COLOR_BK_OUT, RGB(0, 0, 0));
	MainButtonAlarmSet->SetColor(CButtonST::BTNST_COLOR_BK_FOCUS, RGB(0, 0, 0));
	MainButtonAlarmSet->SetColor(CButtonST::BTNST_COLOR_FG_OUT, RGB(208, 8, 208));
	MainButtonAlarmSet->SetColor(CButtonST::BTNST_COLOR_FG_IN, RGB(8, 208, 208));

	
	MainButtonAlarmRec = new CButtonST();
	MainButtonAlarmRec->Create(_T("报警回顾"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
		CRect(880, 745, 980, 800), this, IDC_MAIN_BUTTON_ALARM_REC);
	MainButtonAlarmRec->SetColor(CButtonST::BTNST_COLOR_BK_OUT, RGB(0, 0, 0));
	MainButtonAlarmRec->SetColor(CButtonST::BTNST_COLOR_BK_FOCUS, RGB(0, 0, 0));
	MainButtonAlarmRec->SetColor(CButtonST::BTNST_COLOR_FG_OUT, RGB(208, 8, 208));
	MainButtonAlarmRec->SetColor(CButtonST::BTNST_COLOR_FG_IN, RGB(8, 208, 208));

	MainButtonTrendChartRec = new CButtonST();
	MainButtonTrendChartRec->Create(_T("趋势图"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
		CRect(980, 745, 1080, 800), this, IDC_MAIN_BUTTON_TREND_CHART_REC);
	MainButtonTrendChartRec->SetColor(CButtonST::BTNST_COLOR_BK_OUT, RGB(0, 0, 0));
	MainButtonTrendChartRec->SetColor(CButtonST::BTNST_COLOR_BK_FOCUS, RGB(0, 0, 0));
	MainButtonTrendChartRec->SetColor(CButtonST::BTNST_COLOR_FG_OUT, RGB(208, 8, 208));
	MainButtonTrendChartRec->SetColor(CButtonST::BTNST_COLOR_FG_IN, RGB(8, 208, 208));


	MainButtonTrendTableRec = new CButtonST();
	MainButtonTrendTableRec->Create(_T("趋势表"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
		CRect(1080, 745, 1180, 800), this, IDC_MAIN_BUTTON_TREND_TABLE_REC);
	MainButtonTrendTableRec->SetColor(CButtonST::BTNST_COLOR_BK_OUT, RGB(0, 0, 0));
	MainButtonTrendTableRec->SetColor(CButtonST::BTNST_COLOR_BK_FOCUS, RGB(0, 0, 0));
	MainButtonTrendTableRec->SetColor(CButtonST::BTNST_COLOR_FG_OUT, RGB(208, 8, 208));
	MainButtonTrendTableRec->SetColor(CButtonST::BTNST_COLOR_FG_IN, RGB(8, 208, 208));


	MainButtonTrendNIBPRec = new CButtonST();
	MainButtonTrendNIBPRec->Create(_T("血压回顾"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
		CRect(1180, 745, 1280, 800), this, IDC_MAIN_BUTTON_NIBP_REC);
	MainButtonTrendNIBPRec->SetColor(CButtonST::BTNST_COLOR_BK_OUT, RGB(0, 0, 0));
	MainButtonTrendNIBPRec->SetColor(CButtonST::BTNST_COLOR_BK_FOCUS, RGB(0, 0, 0));
	MainButtonTrendNIBPRec->SetColor(CButtonST::BTNST_COLOR_FG_OUT, RGB(208, 8, 208));
	MainButtonTrendNIBPRec->SetColor(CButtonST::BTNST_COLOR_FG_IN, RGB(8, 208, 208));

	MainButtonSysRec = new CButtonST();
	MainButtonSysRec->Create(_T("系统回顾"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
		CRect(1080, 745, 1180, 800), this, IDC_MAIN_BUTTON_SYS_REC);
	MainButtonSysRec->SetColor(CButtonST::BTNST_COLOR_BK_OUT, RGB(0, 0, 0));
	MainButtonSysRec->SetColor(CButtonST::BTNST_COLOR_BK_FOCUS, RGB(0, 0, 0));
	MainButtonSysRec->SetColor(CButtonST::BTNST_COLOR_FG_OUT, RGB(208, 8, 208));
	MainButtonSysRec->SetColor(CButtonST::BTNST_COLOR_FG_IN, RGB(8, 208, 208));
	MainButtonSysRec->ShowWindow(SW_HIDE);

	MainButtonPat = new CButtonST();
	MainButtonPat->Create(_T("病人"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
		CRect(1180, 745, 1280, 800), this, IDC_MAIN_BUTTON_PAT);
	MainButtonPat->SetColor(CButtonST::BTNST_COLOR_BK_OUT, RGB(0, 0, 0));
	MainButtonPat->SetColor(CButtonST::BTNST_COLOR_BK_FOCUS, RGB(0, 0, 0));
	MainButtonPat->SetColor(CButtonST::BTNST_COLOR_FG_OUT, RGB(208, 8, 208));
	MainButtonPat->SetColor(CButtonST::BTNST_COLOR_FG_IN, RGB(8, 208, 208));
	MainButtonPat->ShowWindow(SW_HIDE);

	MainButtonMedCal = new CButtonST();
	MainButtonMedCal->Create(_T("药物计算"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
		CRect(315, 745, 420, 800), this, IDC_MAIN_BUTTON_MEDCAL);
	MainButtonMedCal->SetColor(CButtonST::BTNST_COLOR_BK_OUT, RGB(0, 0, 0));
	MainButtonMedCal->SetColor(CButtonST::BTNST_COLOR_BK_FOCUS, RGB(0, 0, 0));
	MainButtonMedCal->SetColor(CButtonST::BTNST_COLOR_FG_OUT, RGB(208, 8, 208));
	MainButtonMedCal->SetColor(CButtonST::BTNST_COLOR_FG_IN, RGB(8, 208, 208));
	MainButtonMedCal->ShowWindow(SW_HIDE);

	MainButtonSys = new CButtonST();
	MainButtonSys->Create(_T("系统"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
		CRect(840, 745, 945, 800), this, IDC_MAIN_BUTTON_SYS);
	MainButtonSys->SetColor(CButtonST::BTNST_COLOR_BK_OUT, RGB(0, 0, 0));
	MainButtonSys->SetColor(CButtonST::BTNST_COLOR_BK_FOCUS, RGB(0, 0, 0));
	MainButtonSys->SetColor(CButtonST::BTNST_COLOR_FG_OUT, RGB(208, 8, 208));
	MainButtonSys->SetColor(CButtonST::BTNST_COLOR_FG_IN, RGB(8, 208, 208));
	MainButtonSys->ShowWindow(SW_HIDE);

	MainButtonMenu = new CButtonST();
	MainButtonMenu->Create(_T("菜单"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
		CRect(735, 745, 840, 800), this, IDC_MAIN_BUTTON_MENU);
	MainButtonMenu->SetColor(CButtonST::BTNST_COLOR_BK_OUT, RGB(0, 0, 0));
	MainButtonMenu->SetColor(CButtonST::BTNST_COLOR_BK_FOCUS, RGB(0, 0, 0));
	MainButtonMenu->SetColor(CButtonST::BTNST_COLOR_FG_OUT, RGB(208, 8, 208));
	MainButtonMenu->SetColor(CButtonST::BTNST_COLOR_FG_IN, RGB(8, 208, 208));
	MainButtonMenu->ShowWindow(SW_HIDE);

	MainButtonShut = new CButtonST();
	MainButtonShut->Create(_T("关机"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
		CRect(210, 745, 315, 800), this, IDC_MAIN_BUTTON_SHUT);
	MainButtonShut->SetColor(CButtonST::BTNST_COLOR_BK_OUT, RGB(0, 0, 0));
	MainButtonShut->SetColor(CButtonST::BTNST_COLOR_BK_FOCUS, RGB(0, 0, 0));
	MainButtonShut->SetColor(CButtonST::BTNST_COLOR_FG_OUT, RGB(208, 8, 208));
	MainButtonShut->SetColor(CButtonST::BTNST_COLOR_FG_IN, RGB(8, 208, 208));
	MainButtonShut->ShowWindow(SW_HIDE);
	
}

//初始化 结果显示区域和波形显示区域
void CVerbpoDlg::InitNormalShow()
{
	CPatient a_CPatient;
	theApp.m_Data->Get_Pat(a_CPatient);

	//状态报警显示区域初始化
	m_DisplayField = new CDisplayField();
	m_DisplayField->Create(NULL, WS_CHILD | WS_VISIBLE | SS_NOTIFY,
		CRect(IDC_DISPLAY_X, IDC_DISPLAY_Y, IDC_DISPLAY_X + IDC_DISPLAY_WIDTH, IDC_DISPLAY_Y + IDC_DISPLAY_HEIGHT),
		this, 123);
	/*m_DisplayField->set_ID(CString(_T("ID:AVC23456789")));
	m_DisplayField->set_Name(CString(_T("姓名:姓名姓名姓名")));
	m_DisplayField->set_PatSex(CString(_T("男")));
	m_DisplayField->set_PatType(CString(_T("新生儿")));*/
	m_DisplayField->Update_Pat_Info(a_CPatient);
	//	m_DisplayField->set_Battery(100);
	m_DisplayField->Show_Time();
	m_DisplayField->Show_Alm();
	m_DisplayField->ShowWindow(SW_SHOW);
	m_DisplayField->Invalidate(TRUE);

	//心电结果显示区域初始化
	m_ECGValueNormal = new CStaticValueECGNormal();
	m_ECGValueNormal->Create(NULL, WS_CHILD | WS_VISIBLE | SS_NOTIFY, CRect(CVerbpoDlg::m_i32Normal_ECG_X, CVerbpoDlg::m_i32Normal_ECG_Y, CVerbpoDlg::m_i32Normal_ECG_X + CStaticValueECGNormal::m_i32BigWidth, CVerbpoDlg::m_i32Normal_ECG_Y + CStaticValueECGNormal::m_i32BigHeight), this, 123);
	m_ECGValueNormal->set_HR(CData::m_i16HRInvalidValue, 1);
	// 设置ST1的值
	m_ECGValueNormal->set_ST1(CData::m_i16STInvalidValue, 1);
	// 设置ST2的值
	m_ECGValueNormal->set_ST2(CData::m_i16STInvalidValue,1);
	// 设置心律报警上限
	m_ECGValueNormal->set_HR_Alm_H(theApp.m_Data->m_i32ParaECGHR_ALM_H, 1);
	// 设置心律报警下限
	m_ECGValueNormal->set_HR_Alm_L(theApp.m_Data->m_i32ParaECGHR_ALM_L, 1);
	m_ECGValueNormal->set_pace(theApp.m_Data->m_i32ParaECGPACE_SW, 1);
	// 心搏标识
	m_ECGValueNormal->set_beat(0, 1);
	// 心律来源
	m_ECGValueNormal->set_HR_from(theApp.m_Data->m_i32ParaECGHR_FORM, 1);
	//设置、绘制报警开关标识
	m_ECGValueNormal->Set_AlmFlag(theApp.m_Data->m_i32ParaECGALM_SW, 1);
	// 设置PVCs值
	m_ECGValueNormal->set_PVCs(0, 1);
	m_ECGValueNormal->ShowWindow(SW_SHOW);
	m_ECGValueNormal->Invalidate(TRUE);


	//血压结果显示区域初始化
	m_BPValueNormal = new CStaticBPValueNormal();
	m_BPValueNormal->Create(NULL, WS_CHILD | WS_VISIBLE | SS_NOTIFY, 
		CRect(CStaticBPValueNormal::m_i32NormalX, CStaticBPValueNormal::m_i32NormalY, CStaticBPValueNormal::m_i32NormalX + CStaticBPValueNormal::m_i32NormalWidth, CStaticBPValueNormal::m_i32NormalY + CStaticBPValueNormal::m_i32NormalHeight),
		this, 123);
	m_BPValueNormal->set_time(0, 0, 0, 1);
	// 设置血压结果
	m_BPValueNormal->set_result(300, 120, 1);
	// 设置报警上限
	m_BPValueNormal->set_alm_H(theApp.m_Data->m_i32ParaBPSBP_ALM_H, theApp.m_Data->m_i32ParaBPDBP_ALM_H, 1);
	// 设置报警下限
	m_BPValueNormal->set_alm_L(theApp.m_Data->m_i32ParaBPSBP_ALM_L, theApp.m_Data->m_i32ParaBPDBP_ALM_L, 1);
	// 设置静压
	m_BPValueNormal->set_press(0, 1);
	//设置、绘制报警开关标识
	m_BPValueNormal->Set_AlmFlag(theApp.m_Data->m_i32ParaBPALM_SW, 1);

	m_BPValueNormal->Add_Result(120, 80, 90, 80, 0);
	m_BPValueNormal->Add_Result(121, 80, 90, 80, 0);
	m_BPValueNormal->Add_Result(122, 80, 90, 80, 0);
	m_BPValueNormal->Add_Result(123, 80, 90, 80, 0);
	m_BPValueNormal->Add_Result(124, 80, 90, 80, 0);
	m_BPValueNormal->Add_Result(125, 80, 90, 80, 0);
	m_BPValueNormal->Add_Result(125, 80, 90, 80, 1);
	m_BPValueNormal->Add_Result(126, 80, 90, 80, 0);
	m_BPValueNormal->Add_Result(127, 80, 90, 80, 0);
	m_BPValueNormal->ShowWindow(SW_SHOW);
	m_BPValueNormal->Invalidate(TRUE);
	
	//体温结果显示区域初始化
	m_TempValueNormal = new CStaticValueTempNormal();
	m_TempValueNormal->Create(NULL, WS_CHILD | WS_VISIBLE | SS_NOTIFY, 
		CRect(CStaticValueTempNormal::m_i32NormalX, CStaticValueTempNormal::m_i32NormalY, CStaticValueTempNormal::m_i32NormalX + CStaticValueTempNormal::m_i32NormalWidth, CStaticValueTempNormal::m_i32NormalY + CStaticValueTempNormal::m_i32NormalHeight),
		this, 123);
	m_TempValueNormal->set_temp(CData::m_i16TempInvalidValue, 1);
	// 设置体温结果
	m_TempValueNormal->set_temp_alm_H(theApp.m_Data->m_i32ParaTempTEMP_ALM_H, 1);
	// 设置报警上限
	m_TempValueNormal->set_temp_alm_L(theApp.m_Data->m_i32ParaTempTEMP_ALM_L, 1);
	// 设置报警下限
	m_TempValueNormal->set_temp_unit(0, 1);
	//设置、绘制报警开关标识
	m_TempValueNormal->Set_AlmFlag(theApp.m_Data->m_i32ParaTempALM_SW, 1);

	//血氧结果显示区域初始化
	m_SPO2ValueNormal = new CStaticValueSPO2Normal();
	m_SPO2ValueNormal->Create(NULL, WS_CHILD | WS_VISIBLE | SS_NOTIFY,
		CRect(CStaticValueSPO2Normal::m_i32NormalX, CStaticValueSPO2Normal::m_i32NormalY, CStaticValueSPO2Normal::m_i32NormalX + CStaticValueSPO2Normal::m_i32NormalWidth, CStaticValueSPO2Normal::m_i32NormalY + CStaticValueSPO2Normal::m_i32NormalHeight),
		this, 123);
	m_SPO2ValueNormal->set_spo2(CData::m_i16Spo2InvalidValue, 1);
	// 设置血氧饱和度上限
	m_SPO2ValueNormal->set_spo2_alm_H(theApp.m_Data->m_i32ParaOxyOXY_ALM_H, 1);
	// 设置血氧饱和度下限
	m_SPO2ValueNormal->set_spo2_alm_L(theApp.m_Data->m_i32ParaOxyOXY_ALM_L, 1);
	m_SPO2ValueNormal->set_PR(CData::m_i16PRInvalidValue, 1);
	m_SPO2ValueNormal->set_PR_alm_H(theApp.m_Data->m_i32ParaOxyOXY_PR_ALM_H, 1);
	m_SPO2ValueNormal->set_PR_alm_L(theApp.m_Data->m_i32ParaOxyOXY_PR_ALM_L, 1);
	//设置、绘制报警开关标识
	m_SPO2ValueNormal->Set_AlmFlag(theApp.m_Data->m_i32ParaOxyALM_SW, 1);

	//呼吸结果显示区域初始化
	m_RespValueNormal = new CStaticValueRespNormal();
	m_RespValueNormal->Create(NULL, WS_CHILD | WS_VISIBLE | SS_NOTIFY,
		CRect(CStaticValueRespNormal::m_i32NormalX, CStaticValueRespNormal::m_i32NormalY, CStaticValueRespNormal::m_i32NormalX + CStaticValueRespNormal::m_i32NormalWidth, CStaticValueRespNormal::m_i32NormalY + CStaticValueRespNormal::m_i32NormalHeight),
		this, 123);
	m_RespValueNormal->set_RR(CData::m_i16RRInvalidValue, 1);
	// 设置呼吸率上限
	m_RespValueNormal->set_resp_alm_H(theApp.m_Data->m_i32ParaRespRR_ALM_H, 1);
	// 设置呼吸率下限
	m_RespValueNormal->set_resp_alm_L(theApp.m_Data->m_i32ParaRespRR_ALM_L, 1);
	//设置、绘制报警开关标识
	m_RespValueNormal->Set_AlmFlag(theApp.m_Data->m_i32ParaRespALM_SW, 1);
	
	//氧浓度结果显示区域初始化
	m_FAValueNormal = new CStaticValueFANormal();
	m_FAValueNormal->Create(NULL, WS_CHILD | WS_VISIBLE | SS_NOTIFY,
		CRect(CStaticValueFANormal::m_i32NormalX, CStaticValueFANormal::m_i32NormalY, CStaticValueFANormal::m_i32NormalX + CStaticValueFANormal::m_i32NormalWidth, CStaticValueFANormal::m_i32NormalY + CStaticValueFANormal::m_i32NormalHeight),
		this, 123);
	m_FAValueNormal->set_FiO(CData::m_i16AirOxyInvalidValue, 1);
	m_FAValueNormal->set_AirOxy_alm_H(theApp.m_Data->m_i32ParaAirOxy_ALM_H, 1);
	m_FAValueNormal->set_AirOxy_alm_L(theApp.m_Data->m_i32ParaAirOxy_ALM_L, 1);
	//设置、绘制报警开关标识
	m_FAValueNormal->Set_AlmFlag(theApp.m_Data->m_i32ParaAirOxyALM_SW, 1);

	//心律、血氧饱和度呼吸趋势共存显示区 初始化
	m_pCECGRespSpo2Trend = new CECGRespSpo2Trend();
	m_pCECGRespSpo2Trend->Create(NULL, WS_CHILD | WS_VISIBLE | SS_NOTIFY,
		CRect(CECGRespSpo2Trend::m_i32X, CECGRespSpo2Trend::m_i32Y, CECGRespSpo2Trend::m_i32X + CECGRespSpo2Trend::m_i32Width, CECGRespSpo2Trend::m_i32Y + CECGRespSpo2Trend::m_i32Height),
		this, 123);
	m_pCECGRespSpo2Trend->ShowWindow(SW_HIDE);

	
	NormalLabelECG1 = new CColorText_Static();
	NormalLabelECG1->Create(_T("ECG"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
		CRect(10, 60, 50, 80), this, IDC_NORMAL_LABEL);
	NormalLabelECG1->Set_TextColor(RGB(0, 0xE1, 0));
	NormalLabelECG1->Set_BackColor(RGB(0, 0, 0));
	NormalLabelECG1->SetFont(160, _T("宋体"));

	NormalLabelECG2 = new CColorText_Static();
	NormalLabelECG2->Create(_T("ECG"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
		CRect(10, 260, 50, 280), this, IDC_NORMAL_LABEL);
	NormalLabelECG2->Set_TextColor(RGB(0, 0xE1, 0));
	NormalLabelECG2->Set_BackColor(RGB(0, 0, 0));
	NormalLabelECG2->SetFont(160, _T("宋体"));


	//心电 导通1 的 显示导联 选择 下拉框 初始化
	NormalComboECG1Lead=new CComboBox();
	NormalComboECG1Lead->Create(WS_CHILD | WS_VISIBLE |  CBS_DROPDOWNLIST,
		CRect(60, 60, 110, 78), this, IDC_NORMAL_COMBO_LEAD1);
	NormalComboECG1Lead->SetFont(&m_CFont);
	NormalComboECG1Lead->AddString(_T("I"));
	NormalComboECG1Lead->AddString(_T("II"));
	NormalComboECG1Lead->AddString(_T("III"));
	NormalComboECG1Lead->AddString(_T("avR"));
	NormalComboECG1Lead->AddString(_T("avL"));
	NormalComboECG1Lead->AddString(_T("avF"));
	NormalComboECG1Lead->AddString(_T("V"));
	//NormalComboECG1Lead->SetCurSel(theApp.m_Data->m_i32ShowNormalECGChannel1Type);
	NormalComboECG1Lead->ShowWindow(SW_SHOW);


	//心电 导通2 的 显示导联 选择 下拉框 初始化
	NormalComboECG2Lead = new CComboBox();
	NormalComboECG2Lead->Create(WS_CHILD | WS_VISIBLE |  CBS_DROPDOWNLIST,
		CRect(60, 260, 110, 278), this, IDC_NORMAL_COMBO_LEAD2);
	NormalComboECG2Lead->SetFont(&m_CFont);
	NormalComboECG2Lead->AddString(_T("I"));
	NormalComboECG2Lead->AddString(_T("II"));
	NormalComboECG2Lead->AddString(_T("III"));
	NormalComboECG2Lead->AddString(_T("avR"));
	NormalComboECG2Lead->AddString(_T("avL"));
	NormalComboECG2Lead->AddString(_T("avF"));
	NormalComboECG2Lead->AddString(_T("V"));
	//NormalComboECG2Lead->SetCurSel(theApp.m_Data->m_i32ShowNormalECGChannel2Type);
	NormalComboECG2Lead->ShowWindow(SW_SHOW);

	//心电 滤波模式 选择 下拉框 初始化
	NormalComboECGFilter = new CComboBox();
	NormalComboECGFilter->Create(WS_CHILD | WS_VISIBLE | CBS_SIMPLE | CBS_DROPDOWNLIST,
		CRect(120, 60, 180, 78), this, IDC_NORMAL_COMBO_FILTER);
	NormalComboECGFilter->SetFont(&m_CFont);
	NormalComboECGFilter->AddString(_T("诊断"));
	NormalComboECGFilter->AddString(_T("监护"));
	NormalComboECGFilter->AddString(_T("手术"));
	//NormalComboECGFilter->SetCurSel(theApp.m_Data->m_i32ParaECGWAVE_Filter);
	NormalComboECGFilter->ShowWindow(SW_SHOW);

	//心电 走纸速度 选择 下拉框 初始化
	NormalComboECGSpeed = new CComboBox();
	NormalComboECGSpeed->Create(WS_CHILD | WS_VISIBLE | CBS_SIMPLE | CBS_DROPDOWNLIST,
		CRect(190, 60, 260, 78), this, IDC_NORMAL_COMBO_SPEED);
	NormalComboECGSpeed->SetFont(&m_CFont);
	NormalComboECGSpeed->AddString(_T("25mm/s"));
	NormalComboECGSpeed->AddString(_T("50mm/s"));
	//NormalComboECGSpeed->SetCurSel(theApp.m_Data->m_i32ParaECGWAVE_SPEED);
	NormalComboECGSpeed->ShowWindow(SW_SHOW);

	//心电 波形增益 选择 下拉框 初始化
	NormalComboECGGain = new CComboBox();
	NormalComboECGGain->Create(WS_CHILD | WS_VISIBLE | CBS_SIMPLE | CBS_DROPDOWNLIST,
		CRect(270, 60, 340, 78), this, IDC_NORMAL_COMBO_GAIN);
	NormalComboECGGain->SetFont(&m_CFont);
	NormalComboECGGain->AddString(_T("5mm/mv"));
	NormalComboECGGain->AddString(_T("10mm/mv"));
	NormalComboECGGain->AddString(_T("20mm/mv"));
	//NormalComboECGGain->SetCurSel(theApp.m_Data->m_i32ParaECGWAVE_GAIN);
	NormalComboECGGain->ShowWindow(SW_SHOW);
	

	NormalLabelPleth = new CColorText_Static();
	NormalLabelPleth->Create(_T("PLETH"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
		CRect(10, 460, 70, 480), this, IDC_NORMAL_LABEL);
	NormalLabelPleth->Set_TextColor(RGB(0x80, 0xCD, 0xFF));
	NormalLabelPleth->Set_BackColor(RGB(0, 0, 0));
	NormalLabelPleth->SetFont(160, _T("宋体"));

	
	//血氧 走纸速度 选择 下拉框 初始化
	NormalComboPlethSpeed = new CComboBox();
	NormalComboPlethSpeed->Create(WS_CHILD | WS_VISIBLE | CBS_SIMPLE | CBS_DROPDOWNLIST,
		CRect(80, 460, 160, 478), this, IDC_NORMAL_COMBO_PLETH_SPEED);
	NormalComboPlethSpeed->SetFont(&m_CFont);
	NormalComboPlethSpeed->AddString(_T("12.5mm/s"));
	NormalComboPlethSpeed->AddString(_T("25mm/s"));
	//NormalComboPlethSpeed->SetCurSel(theApp.m_Data->m_i32PlethSpeed);
	NormalComboPlethSpeed->ShowWindow(SW_SHOW);


	NormalLabelResp = new CColorText_Static();
	NormalLabelResp->Create(_T("RESP"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
		CRect(10, 600, 70, 620), this, IDC_NORMAL_LABEL);
	NormalLabelResp->Set_TextColor(RGB(0xEE, 0xEE, 0x62));
	NormalLabelResp->Set_BackColor(RGB(0, 0, 0));
	NormalLabelResp->SetFont(160, _T("宋体"));
	
	//呼吸 走纸速度 选择 下拉框 初始化
	NormalComboRespSpeed = new CComboBox();
	NormalComboRespSpeed->Create(WS_CHILD | WS_VISIBLE | CBS_SIMPLE | CBS_DROPDOWNLIST,
		CRect(80, 600, 160, 618), this, IDC_NORMAL_COMBO_RESP_SPEED);
	NormalComboRespSpeed->SetFont(&m_CFont);
	NormalComboRespSpeed->AddString(_T("12.5mm/s"));
	NormalComboRespSpeed->AddString(_T("25mm/s"));
	//NormalComboRespSpeed->SetCurSel(theApp.m_Data->m_i32ParaRespSpeed);
	NormalComboRespSpeed->ShowWindow(SW_SHOW);
	

	//呼吸 波形增益 选择 下拉框 初始化
	NormalComboRespGain = new CComboBox();
	NormalComboRespGain->Create(WS_CHILD | WS_VISIBLE | CBS_SIMPLE | CBS_DROPDOWNLIST,
		CRect(170, 600, 240, 618), this, IDC_NORMAL_COMBO_RESP_GAIN);
	NormalComboRespGain->SetFont(&m_CFont);
	NormalComboRespGain->AddString(_T("1/2"));
	NormalComboRespGain->AddString(_T("1"));
	NormalComboRespGain->AddString(_T("2"));
	//NormalComboRespGain->SetCurSel(theApp.m_Data->m_i32ParaRespGain);
	NormalComboRespGain->ShowWindow(SW_SHOW);

	
	//心电波通道1 显示区域初始化
	m_pCECGWaveN[0] = new  CECGWave(CECGWave::m_i32NormalWidth, CECGWave::m_i32NormalHeight, ECG_COLOR_GREEN | ECG_NO_GRID | ECG_II_LEAD);
	m_pCECGWaveN[0]->Set_UnitLength_Pixel(30);
	m_pCECGWaveN[0]->Set_UnitLength_Value(820);
	//波形 走纸速度
	m_pCECGWaveN[0]->Set_Speed(theApp.m_Data->m_i32ParaECGWAVE_SPEED);
	//波形增益
	m_pCECGWaveN[0]->Set_Gain(theApp.m_Data->m_i32ParaECGWAVE_GAIN);
	m_pCECGWaveN[0]->Create(NULL, WS_CHILD | WS_VISIBLE | SS_NOTIFY, CRect(0, 80, 0 + CECGWave::m_i32NormalWidth, 80 + CECGWave::m_i32NormalHeight), this, 123);
	m_pCECGWaveN[0]->ShowWindow(SW_SHOW);
	m_pCECGWaveN[0]->Invalidate(TRUE);

	//心电波通道2 显示区域初始化
	m_pCECGWaveN[1] = new  CECGWave(CECGWave::m_i32NormalWidth, CECGWave::m_i32NormalHeight, ECG_COLOR_GREEN | ECG_NO_GRID | ECG_I_LEAD);
	m_pCECGWaveN[1]->Set_UnitLength_Pixel(30);
	m_pCECGWaveN[1]->Set_UnitLength_Value(820);
	//波形 走纸速度
	m_pCECGWaveN[1]->Set_Speed(theApp.m_Data->m_i32ParaECGWAVE_SPEED);
	//波形增益
	m_pCECGWaveN[1]->Set_Gain(theApp.m_Data->m_i32ParaECGWAVE_GAIN);
	m_pCECGWaveN[1]->Create(NULL, WS_CHILD | WS_VISIBLE | SS_NOTIFY, CRect(0, 280, 0 + CECGWave::m_i32NormalWidth, 280 + CECGWave::m_i32NormalHeight), this, 123);
	m_pCECGWaveN[1]->ShowWindow(SW_SHOW);
	m_pCECGWaveN[1]->Invalidate(TRUE);


	//心电波通道3 显示区域初始化
	m_pCECGWaveN[2] = new  CECGWave(CECGWave::m_i32NormalWidth, CECGWave::m_i32NormalHeight, ECG_COLOR_GREEN | ECG_NO_GRID | ECG_III_LEAD);
	m_pCECGWaveN[2]->Set_UnitLength_Pixel(25);
	m_pCECGWaveN[2]->Set_UnitLength_Value(820);
	//波形 走纸速度
	m_pCECGWaveN[2]->Set_Speed(theApp.m_Data->m_i32ParaECGWAVE_SPEED);
	//波形增益
	m_pCECGWaveN[2]->Set_Gain(theApp.m_Data->m_i32ParaECGWAVE_GAIN);
	m_pCECGWaveN[2]->Create(NULL, WS_CHILD | WS_VISIBLE | SS_NOTIFY, CRect(0, 270, 0 + CECGWave::m_i32NormalWidth, 270 + CECGWave::m_i32NormalHeight), this, 123);
	m_pCECGWaveN[2]->ShowWindow(SW_HIDE);
	m_pCECGWaveN[2]->Invalidate(TRUE);


	//心电波通道4 显示区域初始化
	m_pCECGWaveN[3] = new  CECGWave(CECGWave::m_i32NormalWidth, CECGWave::m_i32NormalHeight, ECG_COLOR_GREEN | ECG_NO_GRID | ECG_AVF_LEAD);
	m_pCECGWaveN[3]->Set_UnitLength_Pixel(25);
	m_pCECGWaveN[3]->Set_UnitLength_Value(820);
	//波形 走纸速度
	m_pCECGWaveN[3]->Set_Speed(theApp.m_Data->m_i32ParaECGWAVE_SPEED);
	//波形增益
	m_pCECGWaveN[3]->Set_Gain(theApp.m_Data->m_i32ParaECGWAVE_GAIN);
	m_pCECGWaveN[3]->Create(NULL, WS_CHILD | WS_VISIBLE | SS_NOTIFY, CRect(0, 365, 0 + CECGWave::m_i32NormalWidth, 365 + CECGWave::m_i32NormalHeight), this, 123);
	m_pCECGWaveN[3]->ShowWindow(SW_HIDE);
	m_pCECGWaveN[3]->Invalidate(TRUE);


	//心电波通道5 显示区域初始化
	m_pCECGWaveN[4] = new  CECGWave(CECGWave::m_i32NormalWidth, CECGWave::m_i32NormalHeight, ECG_COLOR_GREEN | ECG_NO_GRID | ECG_AVL_LEAD);
	m_pCECGWaveN[4]->Set_UnitLength_Pixel(25);
	m_pCECGWaveN[4]->Set_UnitLength_Value(820);
	//波形 走纸速度
	m_pCECGWaveN[4]->Set_Speed(theApp.m_Data->m_i32ParaECGWAVE_SPEED);
	//波形增益
	m_pCECGWaveN[4]->Set_Gain(theApp.m_Data->m_i32ParaECGWAVE_GAIN);
	m_pCECGWaveN[4]->Create(NULL, WS_CHILD | WS_VISIBLE | SS_NOTIFY, CRect(0, 460, 0 + CECGWave::m_i32NormalWidth, 460 + CECGWave::m_i32NormalHeight), this, 123);
	m_pCECGWaveN[4]->ShowWindow(SW_HIDE);
	m_pCECGWaveN[4]->Invalidate(TRUE);


	//心电波通道6 显示区域初始化
	m_pCECGWaveN[5] = new  CECGWave(CECGWave::m_i32NormalWidth, CECGWave::m_i32NormalHeight, ECG_COLOR_GREEN | ECG_NO_GRID | ECG_AVL_LEAD);
	m_pCECGWaveN[5]->Set_UnitLength_Pixel(25);
	m_pCECGWaveN[5]->Set_UnitLength_Value(820);
	//波形 走纸速度
	m_pCECGWaveN[5]->Set_Speed(theApp.m_Data->m_i32ParaECGWAVE_SPEED);
	//波形增益
	m_pCECGWaveN[5]->Set_Gain(theApp.m_Data->m_i32ParaECGWAVE_GAIN);
	m_pCECGWaveN[5]->Create(NULL, WS_CHILD | WS_VISIBLE | SS_NOTIFY, CRect(0, 555, 0 + CECGWave::m_i32NormalWidth, 555 + CECGWave::m_i32NormalHeight), this, 123);
	m_pCECGWaveN[5]->ShowWindow(SW_HIDE);
	m_pCECGWaveN[5]->Invalidate(TRUE);


	//心电波通道7 显示区域初始化
	m_pCECGWaveN[6] = new  CECGWave(CECGWave::m_i32NormalWidth, CECGWave::m_i32NormalHeight, ECG_COLOR_GREEN | ECG_NO_GRID | ECG_AVL_LEAD);
	m_pCECGWaveN[6]->Set_UnitLength_Pixel(25);
	m_pCECGWaveN[6]->Set_UnitLength_Value(820);
	//波形 走纸速度
	m_pCECGWaveN[6]->Set_Speed(theApp.m_Data->m_i32ParaECGWAVE_SPEED);
	//波形增益
	m_pCECGWaveN[6]->Set_Gain(theApp.m_Data->m_i32ParaECGWAVE_GAIN);
	m_pCECGWaveN[6]->Create(NULL, WS_CHILD | WS_VISIBLE | SS_NOTIFY, CRect(0, 650, 0 + CECGWave::m_i32NormalWidth, 650 + CECGWave::m_i32NormalHeight), this, 123);
	m_pCECGWaveN[6]->ShowWindow(SW_HIDE);
	m_pCECGWaveN[6]->Invalidate(TRUE);
	

	//血氧波 显示区域初始化
	m_pCPlethWave = new  CPlethWave(CPlethWave::m_i32NormalWidth, CPlethWave::m_i32NormalHeight, 0);
	m_pCPlethWave->Set_UnitLength_Pixel(CPlethWave::m_i32NormalHeight - 15);
	m_pCPlethWave->Set_UnitLength_Value(CPlethWave::m_i32NormalHeight);
	//波形 走纸速度
	m_pCECGWaveN[1]->Set_Speed(theApp.m_Data->m_i32PlethSpeed);
	//波形增益
	m_pCPlethWave->Set_Gain(1);
	m_pCPlethWave->Create(NULL, WS_CHILD | WS_VISIBLE | SS_NOTIFY, CRect(0, 480, 0 + CPlethWave::m_i32NormalWidth, 480 + CPlethWave::m_i32NormalHeight), this, 123);
	m_pCPlethWave->ShowWindow(SW_SHOW);
	m_pCPlethWave->Invalidate(TRUE);


	//呼吸波 显示区域初始化
	m_pCRespWave = new  CRespWave(CRespWave::m_i32NormalWidth, CRespWave::m_i32NormalHeight, 0);
	m_pCRespWave->Set_UnitLength_Pixel(CRespWave::m_i32NormalHeight - 15);
	m_pCRespWave->Set_UnitLength_Value(256);
	//波形 走纸速度
	m_pCECGWaveN[1]->Set_Speed(theApp.m_Data->m_i32ParaRespSpeed);
	//波形增益
	m_pCRespWave->Set_Gain(theApp.m_Data->m_i32ParaRespGain);
	m_pCRespWave->Create(NULL, WS_CHILD | WS_VISIBLE | SS_NOTIFY, CRect(0, 620, 0 + CRespWave::m_i32NormalWidth, 620 + CRespWave::m_i32NormalHeight), this, 123);
	m_pCRespWave->ShowWindow(SW_SHOW);
	m_pCRespWave->Invalidate(TRUE);
}

//初始化话 趋势界面的结果趋势图
void CVerbpoDlg::InitTrendResult()
{
	struct TREND_RESULT_TYPE a_stTREND_RESULT_TYPE;

	
	m_ECGTrendResult = new  CTrendResult(CStaticValueECGNormal::m_rgbText);
	a_stTREND_RESULT_TYPE.i16Type = RESULT_TYPE_HR;
	a_stTREND_RESULT_TYPE.i16Flag = 0;
	a_stTREND_RESULT_TYPE.i16H = 300;
	a_stTREND_RESULT_TYPE.i16L = 0;
	
	wcscpy_s(a_stTREND_RESULT_TYPE.cTypeName, 8, _T("心律"));
	m_ECGTrendResult->Add_TrendResultType(&a_stTREND_RESULT_TYPE);

	a_stTREND_RESULT_TYPE.i16Type = RESULT_TYPE_PVCs;
	a_stTREND_RESULT_TYPE.i16Flag = 2;
	a_stTREND_RESULT_TYPE.i16H = 100;
	a_stTREND_RESULT_TYPE.i16L = -100;
	wcscpy_s(a_stTREND_RESULT_TYPE.cTypeName, 8, _T("ST"));
	m_ECGTrendResult->Add_TrendResultType(&a_stTREND_RESULT_TYPE);

	a_stTREND_RESULT_TYPE.i16Type = RESULT_TYPE_PVCs;
	a_stTREND_RESULT_TYPE.i16Flag = 0;
	a_stTREND_RESULT_TYPE.i16H = 20;
	a_stTREND_RESULT_TYPE.i16L = 0;
	wcscpy_s(a_stTREND_RESULT_TYPE.cTypeName, 8, _T("PVC"));
	m_ECGTrendResult->Add_TrendResultType(&a_stTREND_RESULT_TYPE);
	m_ECGTrendResult->Create(NULL, WS_CHILD | WS_VISIBLE | SS_NOTIFY, CRect(775, 60, 775 + CTrendResult::m_i32Width, 60 + CTrendResult::m_i32Height), this, 123);
	m_ECGTrendResult->ShowWindow(SW_HIDE);
	m_ECGTrendResult->Draw_Info();
	m_ECGTrendResult->Invalidate(TRUE);


	m_NIBPTrendResult = new  CTrendResult(CStaticBPValueNormal::m_rgbText);
	a_stTREND_RESULT_TYPE.i16Type = RESULT_TYPE_SBP;
	a_stTREND_RESULT_TYPE.i16Flag = 0;
	a_stTREND_RESULT_TYPE.i16H = 300;
	a_stTREND_RESULT_TYPE.i16L = 0;
	wcscpy_s(a_stTREND_RESULT_TYPE.cTypeName, 8, _T("收缩压"));
	m_NIBPTrendResult->Add_TrendResultType(&a_stTREND_RESULT_TYPE);

	a_stTREND_RESULT_TYPE.i16Type = RESULT_TYPE_DBP;
	a_stTREND_RESULT_TYPE.i16Flag = 0;
	a_stTREND_RESULT_TYPE.i16H = 300;
	a_stTREND_RESULT_TYPE.i16L = 0;
	wcscpy_s(a_stTREND_RESULT_TYPE.cTypeName, 8, _T("舒张压"));
	m_NIBPTrendResult->Add_TrendResultType(&a_stTREND_RESULT_TYPE);

	m_NIBPTrendResult->Create(NULL, WS_CHILD | WS_VISIBLE | SS_NOTIFY, CRect(775, 174, 775 + CTrendResult::m_i32Width, 174 + CTrendResult::m_i32Height), this, 123);
	m_NIBPTrendResult->ShowWindow(SW_HIDE);
	m_NIBPTrendResult->Invalidate(TRUE);


	m_TempTrendResult = new  CTrendResult(CStaticValueTempNormal::m_rgbText);
	a_stTREND_RESULT_TYPE.i16Type = RESULT_TYPE_TEMP;
	a_stTREND_RESULT_TYPE.i16Flag = 1;
	a_stTREND_RESULT_TYPE.i16H = 420;
	a_stTREND_RESULT_TYPE.i16L = 340;
	wcscpy_s(a_stTREND_RESULT_TYPE.cTypeName, 8, _T("体温"));
	m_TempTrendResult->Add_TrendResultType(&a_stTREND_RESULT_TYPE);
	m_TempTrendResult->Create(NULL, WS_CHILD | WS_VISIBLE | SS_NOTIFY, CRect(775, 288, 775 + CTrendResult::m_i32Width, 288 + CTrendResult::m_i32Height), this, 123);
	m_TempTrendResult->ShowWindow(SW_HIDE);
	m_TempTrendResult->Invalidate(TRUE);



	m_Spo2TrendResult = new  CTrendResult(CStaticValueSPO2Normal::m_rgbText);
	a_stTREND_RESULT_TYPE.i16Type = RESULT_TYPE_SPO2;
	a_stTREND_RESULT_TYPE.i16Flag = 0;
	a_stTREND_RESULT_TYPE.i16H = 100;
	a_stTREND_RESULT_TYPE.i16L = 0;
	wcscpy_s(a_stTREND_RESULT_TYPE.cTypeName, 8, _T("饱和度"));
	m_Spo2TrendResult->Add_TrendResultType(&a_stTREND_RESULT_TYPE);

	a_stTREND_RESULT_TYPE.i16Type = RESULT_TYPE_PR;
	a_stTREND_RESULT_TYPE.i16Flag = 0;
	a_stTREND_RESULT_TYPE.i16H = 300;
	a_stTREND_RESULT_TYPE.i16L = 0;
	wcscpy_s(a_stTREND_RESULT_TYPE.cTypeName, 8, _T("脉率"));
	m_Spo2TrendResult->Add_TrendResultType(&a_stTREND_RESULT_TYPE);

	m_Spo2TrendResult->Create(NULL, WS_CHILD | WS_VISIBLE | SS_NOTIFY, CRect(775, 402, 775 + CTrendResult::m_i32Width, 402 + CTrendResult::m_i32Height), this, 123);
	m_Spo2TrendResult->ShowWindow(SW_HIDE);
	m_Spo2TrendResult->Invalidate(TRUE);



	m_RespTrendResult = new  CTrendResult(CStaticValueRespNormal::m_rgbText);
	a_stTREND_RESULT_TYPE.i16Type = RESULT_TYPE_RR;
	a_stTREND_RESULT_TYPE.i16Flag = 0;
	a_stTREND_RESULT_TYPE.i16H = 120;
	a_stTREND_RESULT_TYPE.i16L = 0;
	wcscpy_s(a_stTREND_RESULT_TYPE.cTypeName, 8, _T("呼吸率"));
	m_RespTrendResult->Add_TrendResultType(&a_stTREND_RESULT_TYPE);
	m_RespTrendResult->Create(NULL, WS_CHILD | WS_VISIBLE | SS_NOTIFY, CRect(775, 516, 775 + CTrendResult::m_i32Width, 516 + CTrendResult::m_i32Height), this, 123);
	m_RespTrendResult->ShowWindow(SW_HIDE);
	m_RespTrendResult->Invalidate(TRUE);


	m_AirOxyTrendResult = new  CTrendResult(CStaticValueFANormal::m_rgbText);
	a_stTREND_RESULT_TYPE.i16Type = RESULT_TYPE_AIROXY;
	a_stTREND_RESULT_TYPE.i16Flag = 0;
	a_stTREND_RESULT_TYPE.i16H = 100;
	a_stTREND_RESULT_TYPE.i16L = 0;
	wcscpy_s(a_stTREND_RESULT_TYPE.cTypeName, 8, _T("氧浓度"));
	m_AirOxyTrendResult->Add_TrendResultType(&a_stTREND_RESULT_TYPE);
	m_AirOxyTrendResult->Create(NULL, WS_CHILD | WS_VISIBLE | SS_NOTIFY, CRect(775, 630, 775 + CTrendResult::m_i32Width, 630 + CTrendResult::m_i32Height), this, 123);
	m_AirOxyTrendResult->ShowWindow(SW_HIDE);
	m_AirOxyTrendResult->Invalidate(TRUE);
}

//按照心电设置的参数，初始化控件，并且向下位机发送相关命令
void CVerbpoDlg::Init_ECG_Para_Set()
{
	INT j = 0;

	//心律来源
	//向下位机发送 导联模式 命令
	((UartDataThread *)theApp.m_pThrdUart)->Send_CMD_LeadSystem(theApp.m_Data->m_i32ParaECGLEAD_MODE);

	//向下位机发送 心律计算导联 命令
	((UartDataThread *)theApp.m_pThrdUart)->Send_CMD_ECGChannel(theApp.m_Data->m_i32ParaECGHR_LEAD);

	//向下位机发送 滤波模式 命令
	((UartDataThread *)theApp.m_pThrdUart)->Send_CMD_FilterMode(theApp.m_Data->m_i32ParaECGWAVE_Filter);

	//向下位机发送 工频陷波 命令
	((UartDataThread *)theApp.m_pThrdUart)->Send_CMD_ECGTrap(theApp.m_Data->m_i32ParaECGECG_TRAP);

	//向下位机发送 心电增益 命令
	((UartDataThread *)theApp.m_pThrdUart)->Send_CMD_ECGGain(theApp.m_Data->m_i32ParaECGWAVE_GAIN);

	//向下位机发送 起搏 命令
	((UartDataThread *)theApp.m_pThrdUart)->Send_CMD_ECGPace(theApp.m_Data->m_i32ParaECGPACE_SW);

	if (theApp.m_Data->m_i32ParaECGLEAD_MODE==1)
	{
		NormalComboECG1Lead->DeleteString(6);
		NormalComboECG2Lead->DeleteString(6);
		if (theApp.m_Data->m_i32ShowNormalECGChannel1Type == ECG_WAVE_V1)
		{
			for (j = ECG_WAVE_I; j <= ECG_WAVE_V1; j++)
			{
				if (j != theApp.m_Data->m_i32ShowNormalECGChannel2Type)
				{
					break;
				}
			}
			NormalComboECG1Lead->SetCurSel(j);
			theApp.m_Data->m_i32ShowNormalECGChannel1Type = j;
		}
		if (theApp.m_Data->m_i32ShowNormalECGChannel2Type == ECG_WAVE_V1)
		{
			for (j = ECG_WAVE_I; j <= ECG_WAVE_V1; j++)
			{
				if (j != theApp.m_Data->m_i32ShowNormalECGChannel1Type)
				{
					break;
				}
			}
			NormalComboECG2Lead->SetCurSel(j);
			theApp.m_Data->m_i32ShowNormalECGChannel2Type = j;
		}
	}
	else
	{
		NormalComboECG1Lead->SetCurSel(theApp.m_Data->m_i32ShowNormalECGChannel1Type);
		NormalComboECG2Lead->SetCurSel(theApp.m_Data->m_i32ShowNormalECGChannel2Type);
	}
	
	NormalComboECGFilter->SetCurSel(theApp.m_Data->m_i32ParaECGWAVE_Filter);
	NormalComboECGSpeed->SetCurSel(theApp.m_Data->m_i32ParaECGWAVE_SPEED);
	NormalComboECGGain->SetCurSel(theApp.m_Data->m_i32ParaECGWAVE_GAIN);
}

//按照呼吸设置的参数，初始化控件，并且向下位机发送相关命令
void CVerbpoDlg::Init_Resp_Para_Set()
{
	//向下位机发送 呼吸波增益 命令
	((UartDataThread *)theApp.m_pThrdUart)->Send_CMD_RESPGain(theApp.m_Data->m_i32ParaRespGain);

	//向下位机发送 窒息时间 命令
	((UartDataThread *)theApp.m_pThrdUart)->Send_CMD_APNEAAlm(theApp.m_Data->m_i32ParaRespAPNEA_TIME);

	NormalComboRespGain->SetCurSel(theApp.m_Data->m_i32ParaRespGain);
	NormalComboRespSpeed->SetCurSel(theApp.m_Data->m_i32ParaRespSpeed);
}

//按照血氧设置的参数，初始化控件，并且向下位机发送相关命令
void CVerbpoDlg::Init_Oxy_Para_Set()
{

	NormalComboPlethSpeed->SetCurSel(theApp.m_Data->m_i32PlethSpeed);
}

//按照体温设置的参数，初始化控件，并且向下位机发送相关命令
void CVerbpoDlg::Init_Temp_Para_Set()
{
	
}

//按照血压设置的参数，初始化控件，并且向下位机发送相关命令
void CVerbpoDlg::Init_NIBP_Para_Set()
{
	//向下位机发送 血压复位 命令
	((UartDataThread *)theApp.m_pThrdUart)->Send_CMD_NBPReset();

	//向下位机发送 NBP 测量周期 设置血压自动测量的周期 命令
	((UartDataThread *)theApp.m_pThrdUart)->Send_CMD_NBPPeriod(0);
}

//按照氧浓度设置的参数，初始化控件，并且向下位机发送相关命令
void CVerbpoDlg::Init_AirOxy_Para_Set()
{

}


// 如果向对话框添加最小化按钮，则需要下面的代码
//  来绘制该图标。  对于使用文档/视图模型的 MFC 应用程序，
//  这将由框架自动完成。

void CVerbpoDlg::OnPaint()
{
	if (IsIconic())
	{
		CPaintDC dc(this); // 用于绘制的设备上下文

		SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
		CRect   rect;
		
		GetClientRect(rect);
		dc.FillSolidRect(rect, RGB(0, 0, 0));
		// 使图标在工作区矩形中居中
		int cxIcon = GetSystemMetrics(SM_CXICON);
		int cyIcon = GetSystemMetrics(SM_CYICON);
		//CRect rect;
		//GetClientRect(&rect);
		int x = (rect.Width() - cxIcon + 1) / 2;
		int y = (rect.Height() - cyIcon + 1) / 2;

		// 绘制图标
		dc.DrawIcon(x, y, m_hIcon);
	}
	else
	{
		CPaintDC dc(this); // 用于绘制的设备上下文
		CRect   rect;

		GetClientRect(rect);
		dc.FillSolidRect(rect, RGB(0, 0, 0));
		CDialogEx::OnPaint();
	}
}

//当用户拖动最小化窗口时系统调用此函数取得光标
//显示。
HCURSOR CVerbpoDlg::OnQueryDragIcon()
{
	return static_cast<HCURSOR>(m_hIcon);
}

// 当用户关闭 UI 时，如果控制器仍保持着它的某个
//  对象，则自动化服务器不应退出。  这些
//  消息处理程序确保如下情形: 如果代理仍在使用，
//  则将隐藏 UI；但是在关闭对话框时，
//  对话框仍然会保留在那里。

void CVerbpoDlg::OnClose()
{
	if (CanExit())
		CDialogEx::OnClose();
}

void CVerbpoDlg::OnOK()
{
	if (CanExit())
		CDialogEx::OnOK();
}

void CVerbpoDlg::OnCancel()
{
	if (CanExit())
		CDialogEx::OnCancel();
}

BOOL CVerbpoDlg::CanExit()
{
	// 如果代理对象仍保留在那里，则自动化
	//  控制器仍会保持此应用程序。
	//  使对话框保留在那里，但将其 UI 隐藏起来。
	if (m_pAutoProxy != NULL)
	{
		ShowWindow(SW_HIDE);
		return FALSE;
	}

	return TRUE;
}


//界面切换按钮 回调函数
void  CVerbpoDlg::OnBnClickedButtonShow()
{
	INT i = 0;

	m_i32Style = (m_i32Style + 1)% 5;

	//正常界面 全导联 趋势 趋势共存 界面时，各个参数结果显示区域为正常大小
	if ((m_i32Style == 0) || (m_i32Style == 2) || (m_i32Style == 3) || (m_i32Style == 4))
	{
		m_ECGValueNormal->MoveWindow(CRect(CStaticValueECGNormal::m_i32NormalX, CStaticValueECGNormal::m_i32NormalY, CStaticValueECGNormal::m_i32NormalX + CStaticValueECGNormal::m_i32NormalWidth, CStaticValueECGNormal::m_i32NormalY + CStaticValueECGNormal::m_i32NormalHeight));
		m_ECGValueNormal->Set_Style(0);

		m_TempValueNormal->MoveWindow(CRect(CStaticValueTempNormal::m_i32NormalX, CStaticValueTempNormal::m_i32NormalY, CStaticValueTempNormal::m_i32NormalX + CStaticValueTempNormal::m_i32NormalWidth, CStaticValueTempNormal::m_i32NormalY + CStaticValueTempNormal::m_i32NormalHeight));
		m_TempValueNormal->Set_Style(0);

		m_SPO2ValueNormal->MoveWindow(CRect(CStaticValueSPO2Normal::m_i32NormalX, CStaticValueSPO2Normal::m_i32NormalY, CStaticValueSPO2Normal::m_i32NormalX + CStaticValueSPO2Normal::m_i32NormalWidth, CStaticValueSPO2Normal::m_i32NormalY + CStaticValueSPO2Normal::m_i32NormalHeight));
		m_SPO2ValueNormal->Set_Style(0);

		m_RespValueNormal->MoveWindow(CRect(CStaticValueRespNormal::m_i32NormalX, CStaticValueRespNormal::m_i32NormalY, CStaticValueRespNormal::m_i32NormalX + CStaticValueRespNormal::m_i32NormalWidth, CStaticValueRespNormal::m_i32NormalY + CStaticValueRespNormal::m_i32NormalHeight));
		m_RespValueNormal->Set_Style(0);

		m_FAValueNormal->MoveWindow(CRect(CStaticValueFANormal::m_i32NormalX, CStaticValueFANormal::m_i32NormalY, CStaticValueFANormal::m_i32NormalX + CStaticValueFANormal::m_i32NormalWidth, CStaticValueFANormal::m_i32NormalY + CStaticValueFANormal::m_i32NormalHeight));
		m_FAValueNormal->Set_Style(0);

		m_BPValueNormal->MoveWindow(CRect(CStaticBPValueNormal::m_i32NormalX, CStaticBPValueNormal::m_i32NormalY, CStaticBPValueNormal::m_i32NormalX + CStaticBPValueNormal::m_i32NormalWidth, CStaticBPValueNormal::m_i32NormalY + CStaticBPValueNormal::m_i32NormalHeight));
		m_BPValueNormal->Set_Style(0);
	}
	//大字体界面，各个参数结果显示区域变大
	else if (m_i32Style == 1)
	{
		m_ECGValueNormal->MoveWindow(CRect(CStaticValueECGNormal::m_i32BigX, CStaticValueECGNormal::m_i32BigY, CStaticValueECGNormal::m_i32BigX + CStaticValueECGNormal::m_i32BigWidth, CStaticValueECGNormal::m_i32BigY + CStaticValueECGNormal::m_i32BigHeight));
		m_ECGValueNormal->Set_Style(m_i32Style);

		m_TempValueNormal->MoveWindow(CRect(CStaticValueTempNormal::m_i32BigX, CStaticValueTempNormal::m_i32BigY, CStaticValueTempNormal::m_i32BigX + CStaticValueTempNormal::m_i32BigWidth, CStaticValueTempNormal::m_i32BigY + CStaticValueTempNormal::m_i32BigHeight));
		m_TempValueNormal->Set_Style(m_i32Style);

		m_SPO2ValueNormal->MoveWindow(CRect(CStaticValueSPO2Normal::m_i32BigX, CStaticValueSPO2Normal::m_i32BigY, CStaticValueSPO2Normal::m_i32BigX + CStaticValueSPO2Normal::m_i32BigWidth, CStaticValueSPO2Normal::m_i32BigY + CStaticValueSPO2Normal::m_i32BigHeight));
		m_SPO2ValueNormal->Set_Style(m_i32Style);

		m_RespValueNormal->MoveWindow(CRect(CStaticValueRespNormal::m_i32BigX, CStaticValueRespNormal::m_i32BigY, CStaticValueRespNormal::m_i32BigX + CStaticValueRespNormal::m_i32BigWidth, CStaticValueRespNormal::m_i32BigY + CStaticValueRespNormal::m_i32BigHeight));
		m_RespValueNormal->Set_Style(m_i32Style);

		m_FAValueNormal->MoveWindow(CRect(CStaticValueFANormal::m_i32BigX, CStaticValueFANormal::m_i32BigY, CStaticValueFANormal::m_i32BigX + CStaticValueFANormal::m_i32BigWidth, CStaticValueFANormal::m_i32BigY + CStaticValueFANormal::m_i32BigHeight));
		m_FAValueNormal->Set_Style(m_i32Style);

		m_BPValueNormal->MoveWindow(CRect(CStaticBPValueNormal::m_i32BigX, CStaticBPValueNormal::m_i32BigY, CStaticBPValueNormal::m_i32BigX + CStaticBPValueNormal::m_i32BigWidth, CStaticBPValueNormal::m_i32BigY + CStaticBPValueNormal::m_i32BigHeight));
		m_BPValueNormal->Set_Style(m_i32Style);
	}

	//如果波形已经冻结 全部解冻
	if (m_i32Freeze)
	{
		m_i32Freeze = 0;
		for (i = 0; i < 7; i++)
		{
			m_pCECGWaveN[i]->Set_Freeze(0);
		}
		
		m_pCRespWave->Set_Freeze(0);
		m_pCPlethWave->Set_Freeze(0);
	}

	//正常界面
	if (m_i32Style == 0)
	{
		//普通模式
		//显示两道心电，呼吸，血氧

		m_ECGTrendResult->ShowWindow(SW_HIDE);
		m_NIBPTrendResult->ShowWindow(SW_HIDE);
		m_TempTrendResult->ShowWindow(SW_HIDE);
		m_Spo2TrendResult->ShowWindow(SW_HIDE);
		m_RespTrendResult->ShowWindow(SW_HIDE);
		m_AirOxyTrendResult->ShowWindow(SW_HIDE);
		m_pCECGRespSpo2Trend->ShowWindow(SW_HIDE);

		//显示 心电通道1、2的波形
		m_pCECGWaveN[0]->ShowWindow(SW_SHOW);
		m_pCECGWaveN[0]->MoveWindow(CRect(0, 80, 0 + CECGWave::m_i32NormalWidth, 80 + CECGWave::m_i32NormalHeight));
		m_pCECGWaveN[0]->Set_Style(m_i32Style);

		m_pCECGWaveN[1]->ShowWindow(SW_SHOW);
		m_pCECGWaveN[1]->MoveWindow(CRect(0, 280, 0 + CECGWave::m_i32NormalWidth, 280 + CECGWave::m_i32NormalHeight));
		m_pCECGWaveN[1]->Set_Style(m_i32Style);

		//2-6道心电隐藏
		m_pCECGWaveN[2]->ShowWindow(SW_HIDE);
		m_pCECGWaveN[3]->ShowWindow(SW_HIDE);
		m_pCECGWaveN[4]->ShowWindow(SW_HIDE);
		m_pCECGWaveN[5]->ShowWindow(SW_HIDE);
		m_pCECGWaveN[6]->ShowWindow(SW_HIDE);

		//显示血氧
		m_pCPlethWave->ShowWindow(SW_SHOW);
		m_pCPlethWave->MoveWindow(CRect(0, 480, 0 + CPlethWave::m_i32NormalWidth, 480 + CPlethWave::m_i32NormalHeight));
		m_pCPlethWave->Set_Style(m_i32Style);

		//显示呼吸
		m_pCRespWave->ShowWindow(SW_SHOW);
		m_pCRespWave->MoveWindow(CRect(0, 620, 0 + CPlethWave::m_i32NormalWidth, 620 + CPlethWave::m_i32NormalHeight));
		m_pCRespWave->Set_Style(m_i32Style);
	}
	//大字体界面
	else if (m_i32Style == 1)
	{
		//大字体模式
		//显示一道心电，血氧，呼吸

		//第二道心电波的标志和导联下拉框 隐藏
		m_pCECGRespSpo2Trend->ShowWindow(SW_HIDE);

		NormalLabelECG2->ShowWindow(SW_HIDE);
		NormalComboECG2Lead->ShowWindow(SW_HIDE);

		m_pCECGWaveN[0]->ShowWindow(SW_SHOW);
		m_pCECGWaveN[0]->MoveWindow(CRect(0, 80, 0 + CECGWave::m_i32NormalWidth, 80 + CECGWave::m_i32NormalHeight));
		m_pCECGWaveN[0]->Set_Style(m_i32Style);

		//1-6道心电隐藏
		m_pCECGWaveN[1]->ShowWindow(SW_HIDE);
		m_pCECGWaveN[2]->ShowWindow(SW_HIDE);
		m_pCECGWaveN[3]->ShowWindow(SW_HIDE);
		m_pCECGWaveN[4]->ShowWindow(SW_HIDE);
		m_pCECGWaveN[5]->ShowWindow(SW_HIDE);
		m_pCECGWaveN[6]->ShowWindow(SW_HIDE);

		//显示血氧
		NormalLabelPleth->ShowWindow(SW_SHOW);
		NormalLabelPleth->MoveWindow(CRect(10, 260, 70, 280));
		NormalComboPlethSpeed->ShowWindow(SW_SHOW);
		NormalComboPlethSpeed->MoveWindow(CRect(80, 260, 160, 278));
		m_pCPlethWave->ShowWindow(SW_SHOW);
		m_pCPlethWave->MoveWindow(CRect(0, 280, 0 + CPlethWave::m_i32NormalWidth, 280 + CPlethWave::m_i32NormalHeight));
		m_pCPlethWave->Set_Style(m_i32Style);

		//显示呼吸
		NormalLabelResp->ShowWindow(SW_SHOW);
		NormalLabelResp->MoveWindow(CRect(10, 400, 70, 420));
		NormalComboRespSpeed->ShowWindow(SW_SHOW);
		NormalComboRespSpeed->MoveWindow(CRect(80, 400, 160, 418));
		NormalComboRespGain->ShowWindow(SW_SHOW);
		NormalComboRespGain->MoveWindow(CRect(170, 400, 240, 418));
		m_pCRespWave->ShowWindow(SW_SHOW);
		m_pCRespWave->MoveWindow(CRect(0, 420, 0 + CRespWave::m_i32NormalWidth, 420 + CRespWave::m_i32NormalHeight));
		m_pCRespWave->Set_Style(m_i32Style);
	}
	//全导联界面
	else if (m_i32Style == 2)
	{
		//心电全导联模式
		//只显示 心电 7个导联
		m_pCECGRespSpo2Trend->ShowWindow(SW_HIDE);

		theApp.m_Data->m_i32ShowNormalECGChannel1TypeLast = theApp.m_Data->m_i32ShowNormalECGChannel1Type;
		theApp.m_Data->m_i32ShowNormalECGChannel2TypeLast = theApp.m_Data->m_i32ShowNormalECGChannel2Type;
		//隐藏血氧
		NormalLabelPleth->ShowWindow(SW_HIDE);
		NormalComboPlethSpeed->ShowWindow(SW_HIDE);
		m_pCPlethWave->ShowWindow(SW_HIDE);

		//隐藏呼吸
		NormalLabelResp->ShowWindow(SW_HIDE);
		NormalComboRespSpeed->ShowWindow(SW_HIDE);
		NormalComboRespGain->ShowWindow(SW_HIDE);
		m_pCRespWave->ShowWindow(SW_HIDE);

		NormalComboECG1Lead->ShowWindow(SW_HIDE);
		NormalLabelECG2->ShowWindow(SW_HIDE);
		NormalComboECG2Lead->ShowWindow(SW_HIDE);


		//显示 心电 7个导联
		m_pCECGWaveN[0]->ShowWindow(SW_SHOW);
		m_pCECGWaveN[0]->MoveWindow(CRect(0, 80, 0 + CECGWave::m_i32ECGWidth, 80 + CECGWave::m_i32ECGHeight));
		m_pCECGWaveN[0]->Set_Style(m_i32Style);

		m_pCECGWaveN[1]->ShowWindow(SW_SHOW);
		m_pCECGWaveN[1]->MoveWindow(CRect(0, 175, 0 + CECGWave::m_i32ECGWidth, 175 + CECGWave::m_i32ECGHeight));
		m_pCECGWaveN[1]->Set_Style(m_i32Style);

		m_pCECGWaveN[2]->ShowWindow(SW_SHOW);
		m_pCECGWaveN[2]->MoveWindow(CRect(0, 270, 0 + CECGWave::m_i32ECGWidth, 270 + CECGWave::m_i32ECGHeight));
		m_pCECGWaveN[2]->Set_Style(m_i32Style);

		m_pCECGWaveN[3]->ShowWindow(SW_SHOW);
		m_pCECGWaveN[3]->MoveWindow(CRect(0, 365, 0 + CECGWave::m_i32ECGWidth, 365 + CECGWave::m_i32ECGHeight));
		m_pCECGWaveN[3]->Set_Style(m_i32Style);

		m_pCECGWaveN[4]->ShowWindow(SW_SHOW);
		m_pCECGWaveN[4]->MoveWindow(CRect(0, 460, 0 + CECGWave::m_i32ECGWidth, 460 + CECGWave::m_i32ECGHeight));
		m_pCECGWaveN[4]->Set_Style(m_i32Style);

		m_pCECGWaveN[5]->ShowWindow(SW_SHOW);
		m_pCECGWaveN[5]->MoveWindow(CRect(0, 555, 0 + CECGWave::m_i32ECGWidth, 555 + CECGWave::m_i32ECGHeight));
		m_pCECGWaveN[5]->Set_Style(m_i32Style);

		m_pCECGWaveN[6]->ShowWindow(SW_SHOW);
		m_pCECGWaveN[6]->MoveWindow(CRect(0, 650, 0 + CECGWave::m_i32ECGWidth, 650 + CECGWave::m_i32ECGHeight));
		m_pCECGWaveN[6]->Set_Style(m_i32Style);
	}
	//趋势界面
	else if (m_i32Style == 3)
	{
		//趋势图
		////显示两道心电，呼吸，血氧
		m_pCECGRespSpo2Trend->ShowWindow(SW_HIDE);
		theApp.m_Data->m_i32ShowNormalECGChannel1Type = theApp.m_Data->m_i32ShowNormalECGChannel1TypeLast;
		theApp.m_Data->m_i32ShowNormalECGChannel2Type = theApp.m_Data->m_i32ShowNormalECGChannel2TypeLast;

		NormalLabelECG1->ShowWindow(SW_SHOW);
		NormalComboECG1Lead->ShowWindow(SW_SHOW);
		NormalLabelECG2->ShowWindow(SW_SHOW);
		NormalComboECG2Lead->ShowWindow(SW_SHOW);


		//显示心电 通道1、2的波形
		m_pCECGWaveN[0]->ShowWindow(SW_SHOW);
		m_pCECGWaveN[0]->MoveWindow(CRect(0, 80, 0 + CECGWave::m_i32TrendWidth, 80 + CECGWave::m_i32TrendHeight));
		m_pCECGWaveN[0]->Set_Style(m_i32Style);
		m_pCECGWaveN[1]->ShowWindow(SW_SHOW);
		m_pCECGWaveN[1]->MoveWindow(CRect(0, 280, 0 + CECGWave::m_i32TrendWidth, 280 + CECGWave::m_i32TrendHeight));
		m_pCECGWaveN[1]->Set_Style(m_i32Style);

		//2-6道心电隐藏
		m_pCECGWaveN[2]->ShowWindow(SW_HIDE);
		m_pCECGWaveN[3]->ShowWindow(SW_HIDE);
		m_pCECGWaveN[4]->ShowWindow(SW_HIDE);
		m_pCECGWaveN[5]->ShowWindow(SW_HIDE);
		m_pCECGWaveN[6]->ShowWindow(SW_HIDE);

		//显示血氧
		NormalLabelPleth->ShowWindow(SW_SHOW);
		NormalLabelPleth->MoveWindow(CRect(10, 480, 70, 480));
		NormalComboPlethSpeed->ShowWindow(SW_SHOW);
		NormalComboPlethSpeed->MoveWindow(CRect(80, 460, 160, 478));
		m_pCPlethWave->ShowWindow(SW_SHOW);
		m_pCPlethWave->MoveWindow(CRect(0, 480, 0 + CPlethWave::m_i32TrendWidth, 480 + CPlethWave::m_i32TrendHeight));
		m_pCPlethWave->Set_Style(m_i32Style);

		//显示呼吸
		NormalLabelResp->ShowWindow(SW_SHOW);
		NormalLabelResp->MoveWindow(CRect(10, 600, 70, 620));
		NormalComboRespSpeed->ShowWindow(SW_SHOW);
		NormalComboRespSpeed->MoveWindow(CRect(80, 600, 160, 618));
		NormalComboRespGain->ShowWindow(SW_SHOW);
		NormalComboRespGain->MoveWindow(CRect(170, 600, 240, 618));
		m_pCRespWave->ShowWindow(SW_SHOW);
		m_pCRespWave->MoveWindow(CRect(0, 620, 0 + CRespWave::m_i32TrendWidth, 620 + CRespWave::m_i32TrendHeight));
		m_pCRespWave->Set_Style(m_i32Style);

		m_ECGTrendResult->ShowWindow(SW_SHOW);
		m_NIBPTrendResult->ShowWindow(SW_SHOW);
		m_TempTrendResult->ShowWindow(SW_SHOW);
		m_Spo2TrendResult->ShowWindow(SW_SHOW);
		m_RespTrendResult->ShowWindow(SW_SHOW);
		m_AirOxyTrendResult->ShowWindow(SW_SHOW);
	}
	//趋势共存界面
	else
	{
		//心律 血氧 呼吸 趋势共存
		//显示两道心电
		//趋势共存界面
		m_ECGTrendResult->ShowWindow(SW_HIDE);
		m_NIBPTrendResult->ShowWindow(SW_HIDE);
		m_TempTrendResult->ShowWindow(SW_HIDE);
		m_Spo2TrendResult->ShowWindow(SW_HIDE);
		m_RespTrendResult->ShowWindow(SW_HIDE);
		m_AirOxyTrendResult->ShowWindow(SW_HIDE);

		NormalLabelResp->ShowWindow(SW_HIDE);
		NormalComboRespSpeed->ShowWindow(SW_HIDE);
		NormalComboRespGain->ShowWindow(SW_HIDE);
		NormalLabelPleth->ShowWindow(SW_HIDE);
		NormalComboPlethSpeed->ShowWindow(SW_HIDE);
		m_pCPlethWave->ShowWindow(SW_HIDE);

		//显示心电 通道1、2的波形
		m_pCECGWaveN[0]->ShowWindow(SW_SHOW);
		m_pCECGWaveN[0]->MoveWindow(CRect(0, 80, 0 + CECGWave::m_i32NormalWidth, 80 + CECGWave::m_i32NormalHeight));
		m_pCECGWaveN[0]->Set_Style(m_i32Style);

		m_pCECGWaveN[1]->ShowWindow(SW_SHOW);
		m_pCECGWaveN[1]->MoveWindow(CRect(0, 280, 0 + CECGWave::m_i32NormalWidth, 280 + CECGWave::m_i32NormalHeight));
		m_pCECGWaveN[1]->Set_Style(m_i32Style);

		//2-6道心电隐藏
		m_pCECGWaveN[2]->ShowWindow(SW_HIDE);
		m_pCECGWaveN[3]->ShowWindow(SW_HIDE);
		m_pCECGWaveN[4]->ShowWindow(SW_HIDE);
		m_pCECGWaveN[5]->ShowWindow(SW_HIDE);
		m_pCECGWaveN[6]->ShowWindow(SW_HIDE);

		//隐藏血氧
		m_pCPlethWave->ShowWindow(SW_HIDE);

		//隐藏呼吸
		m_pCRespWave->ShowWindow(SW_HIDE);

		m_pCECGRespSpo2Trend->ShowWindow(SW_SHOW);
		m_pCECGRespSpo2Trend->Invalidate();
	}

	Invalidate();
}

//按钮区域左移 回调函数
void  CVerbpoDlg::OnBnClickedButtonLeft()
{
	MainButtonShow->ShowWindow(SW_SHOW);
	
	MainButtonLeft->ShowWindow(SW_SHOW);
	
	MainButtonRight->ShowWindow(SW_SHOW);

	MainButtonMute->MoveWindow(CRect(280, 745, 380, 800));
	MainButtonMute->ShowWindow(SW_SHOW);

	MainButtonPrint->ShowWindow(SW_SHOW);
	MainButtonPrint->MoveWindow(CRect(380, 745, 480, 800));

	MainButtonDataRec->ShowWindow(SW_SHOW);
	MainButtonDataRec->MoveWindow(CRect(480, 745, 580, 800));

	MainButtonBP->ShowWindow(SW_SHOW);
	MainButtonBP->MoveWindow(CRect(580, 745, 680, 800));

	MainButtonFreeze->ShowWindow(SW_SHOW);
	MainButtonFreeze->MoveWindow(CRect(680, 745, 780, 800));

	MainButtonAlarmSet->ShowWindow(SW_SHOW);
	MainButtonAlarmSet->MoveWindow(CRect(780, 745, 880, 800));

	MainButtonAlarmRec->ShowWindow(SW_SHOW);
	MainButtonAlarmRec->MoveWindow(CRect(880, 745, 980, 800));

	MainButtonTrendChartRec->ShowWindow(SW_SHOW);
	MainButtonTrendChartRec->MoveWindow(CRect(980, 745, 1080, 800));

	MainButtonTrendTableRec->ShowWindow(SW_SHOW);
	MainButtonTrendTableRec->MoveWindow(CRect(1080, 745, 1180, 800));

	MainButtonTrendNIBPRec->ShowWindow(SW_SHOW);
	MainButtonTrendNIBPRec->MoveWindow(CRect(1180, 745, 1280, 800));

	MainButtonSysRec->ShowWindow(SW_HIDE);

	MainButtonPat->ShowWindow(SW_HIDE);

	MainButtonMedCal->ShowWindow(SW_HIDE);

	MainButtonSys->ShowWindow(SW_HIDE);

	MainButtonMenu->ShowWindow(SW_HIDE);

	MainButtonShut->ShowWindow(SW_HIDE);
}

//按钮区域右移 回调函数
void  CVerbpoDlg::OnBnClickedButtonRight()
{
	MainButtonShow->ShowWindow(SW_SHOW);

	MainButtonLeft->ShowWindow(SW_SHOW);

	MainButtonRight->ShowWindow(SW_SHOW);

	
	MainButtonMute->ShowWindow(SW_HIDE);

	MainButtonPrint->ShowWindow(SW_HIDE);

	MainButtonDataRec->ShowWindow(SW_HIDE);
	

	MainButtonBP->ShowWindow(SW_HIDE);
	

	MainButtonFreeze->ShowWindow(SW_HIDE);
	

	MainButtonAlarmSet->ShowWindow(SW_HIDE);
	

	MainButtonAlarmRec->ShowWindow(SW_SHOW);
	MainButtonAlarmRec->MoveWindow(CRect(280, 745, 380, 800));

	MainButtonTrendChartRec->ShowWindow(SW_SHOW);
	MainButtonTrendChartRec->MoveWindow(CRect(380, 745, 480, 800));

	MainButtonTrendTableRec->ShowWindow(SW_SHOW);
	MainButtonTrendTableRec->MoveWindow(CRect(480, 745, 580, 800));

	MainButtonTrendNIBPRec->ShowWindow(SW_SHOW);
	MainButtonTrendNIBPRec->MoveWindow(CRect(580, 745, 680, 800));

	MainButtonSysRec->ShowWindow(SW_SHOW);
	MainButtonSysRec->MoveWindow(CRect(680, 745, 780, 800));

	MainButtonPat->ShowWindow(SW_SHOW);
	MainButtonPat->MoveWindow(CRect(780, 745, 880, 800));

	MainButtonMedCal->ShowWindow(SW_SHOW);
	MainButtonMedCal->MoveWindow(CRect(880, 745, 980, 800));

	MainButtonSys->ShowWindow(SW_SHOW);
	MainButtonSys->MoveWindow(CRect(980, 745, 1080, 800));

	MainButtonMenu->ShowWindow(SW_SHOW);
	MainButtonMenu->MoveWindow(CRect(1080, 745, 1180, 800));

	MainButtonShut->ShowWindow(SW_SHOW);
	MainButtonShut->MoveWindow(CRect(1180, 745, 1280, 800));
}

//报警静音按钮 回调函数
void  CVerbpoDlg::OnBnClickedButtonMute()
{
	//没有处在报警静音状态
	if (m_i32AlmMute==0)
	{
		m_i32AlmMute = 1;
		m_i32AlmTime = theApp.m_Data->m_i32ParaAlmTime;
		m_DisplayField->start_alm_time(theApp.m_Data->m_i32ParaAlmTime);
	} 
	//处于报警静音状态
	else
	{
		m_i32AlmMute = 0;
		m_i32AlmTime = 0;
		m_DisplayField->stop_alm_time();
	}
}

//记录按钮 回调函数
void  CVerbpoDlg::OnBnClickedButtonPrint()
{

}

//数据回顾按钮 回调函数
void  CVerbpoDlg::OnBnClickedButtonDataRec()
{
	m_CDialogDataRec.DoModal();
}

//血压测量，停止测量按钮 回调函数
void  CVerbpoDlg::OnBnClickedButtonBP()
{

}

//波形冻结按钮 回调函数
void  CVerbpoDlg::OnBnClickedButtonFreeze()
{
	INT i = 0;

	//如果波形已经冻结 全部解冻
	if (m_i32Freeze)
	{
		m_i32Freeze = 0;
		for ( i = 0; i < 7; i++)
		{
			m_pCECGWaveN[i]->Erase();
			m_pCECGWaveN[i]->Reset_WaveDataBuff();
			m_pCECGWaveN[i]->Set_Freeze(0);
		}
		m_pCRespWave->Erase();
		m_pCRespWave->Reset_WaveDataBuff();
		m_pCRespWave->Set_Freeze(0);

		m_pCPlethWave->Erase();
		m_pCPlethWave->Reset_WaveDataBuff();
		m_pCPlethWave->Set_Freeze(0);
	}
	else
	{
		// 全部冻结
		m_i32Freeze = 1;
		for (i = 0; i < 7; i++)
		{
			m_pCECGWaveN[i]->Set_Freeze(1);
		}
		m_pCRespWave->Set_Freeze(1);
		m_pCPlethWave->Set_Freeze(1);
	}
}

//报警参数设置按钮 回调函数
void  CVerbpoDlg::OnBnClickedButtonAlarmSet()
{
	m_CDialogAlmSet.DoModal();
}

//报警回顾按钮 回调函数
void  CVerbpoDlg::OnBnClickedButtonAlarmRec()
{
	m_CDialogAlmSearch.DoModal();
}

//趋势图回顾按钮 回调函数
void  CVerbpoDlg::OnBnClickedButtonTrendChartRec()
{
	m_CDialogTrendChart.DoModal();
}

void  CVerbpoDlg::OnBnClickedButtonTrendTableRec()
{

}

//血压结果回顾按钮 回调函数
void  CVerbpoDlg::OnBnClickedButtonNIBPRec()
{
	m_CDialogNIBPRec.DoModal();
}

//系统时间回顾按钮 回调函数
void  CVerbpoDlg::OnBnClickedButtonSysRec()
{
	m_CDialogSysRec.DoModal();
}

//病人信息设置按钮 回调函数
void  CVerbpoDlg::OnBnClickedButtonPat()
{
	CPatient a_CPatient;
	
	m_CDialogPatInfo.DoModal();

	theApp.m_Data->Get_Pat(a_CPatient);
	m_DisplayField->Update_Pat_Info(a_CPatient);
}

//药物计算按钮 回调函数
void  CVerbpoDlg::OnBnClickedButtonMedCal()
{
	m_CDialogRec.DoModal();
}

//系统参数设置 回调函数
void  CVerbpoDlg::OnBnClickedButtonSys()
{
	m_CDialogSysParaSet.DoModal();
	
}

//系统菜单 回调函数
void  CVerbpoDlg::OnBnClickedButtonMenu()
{
	m_CDialogSysSet.DoModal();
}

//关机 回调函数
void  CVerbpoDlg::OnBnClickedButtonShut()
{
	if (MessageBox(_T("是否确定关闭"), _T("是否确定关闭"), MB_OKCANCEL) == IDOK)
	{
		if (CanExit())
			CDialogEx::OnCancel();
	}
}



void CVerbpoDlg::OnTimer(UINT_PTR nIDEvent)
{
	// TODO:  在此添加消息处理程序代码和/或调用默认值
	static UINT a_u32ShowAlmCount = 0;
	int i = 0,data=0,j=0;
	int a_i32Timer = 0;
	INT16 a_i16Temp = 0;
	INT a_i32ACFlag, a_i32BatteryFlag, a_i32BatteryLifePercent;
	INT a_i32AlmFlag = 0, a_i32AlmLevel = 0;;
	m_i32Timer++;
	INT8 a_i8AirOxy= 0;

	a_i32Timer = GetTickCount();
	
	theApp.m_Data->GetECGWave(&m_stECGData);
	theApp.m_Data->GetRespWave(&m_stRespData);
	theApp.m_Data->GetOxyWave(&m_stOXYData);
	theApp.m_Data->Get_Beat(&data);
	theApp.m_Data->Get_Temp(&a_i16Temp);
	
	theApp.m_Data->Get_AirOxy(&a_i8AirOxy);

	//开机后15秒，才开始进行实时数据保存
	//if (!(theApp.m_Data->m_u32Status&(1 << STATUS_TIME_DELAY)))
	{
		theApp.m_Data->SaveData();
	}

	//开机后15秒，才开始才显示实际数据
	if (theApp.m_Data->m_u32Status&(1 << STATUS_TIME_DELAY))
	{
		for (i = 0; i < m_stECGData.i32DataLength; i++)
		{
			m_stECGData.pECGData[ECG_I_LEAD][i] = 2048;
			m_stECGData.pECGData[ECG_II_LEAD][i] = 2048;
			m_stECGData.pECGData[ECG_III_LEAD][i] = 2048;
			m_stECGData.pECGData[ECG_AVF_LEAD][i] = 2048;
			m_stECGData.pECGData[ECG_AVL_LEAD][i] = 2048;
			m_stECGData.pECGData[ECG_AVR_LEAD][i] = 2048;
			m_stECGData.pECGData[ECG_V1_LEAD][i] = 2048;
		}
		m_stECGData.i16HR = CData::m_i16HRInvalidValue;
		m_stECGData.i16ST1 = CData::m_i16STInvalidValue;
		m_stECGData.i16ST2 = CData::m_i16STInvalidValue;
		m_stECGData.m_i16PVCs = CData::m_i16PVCsInvalidValue;
		m_stECGData.m_u8LeadOff = 0;
		m_stECGData.m_u8LeadOverLoad = 0;
		m_stECGData.m_u8Beat = 0;

		for (i = 0; i < m_stRespData.i32DataLength; i++)
		{
			m_stRespData.pRespData[i] = 45;
		}
		m_stRespData.i16RR = CData::m_i16PRInvalidValue;
		m_stRespData.u8APNEA = 0;

		for (i = 0; i < m_stOXYData.i32DataLength; i++)
		{
			m_stOXYData.pPlethData[i] = 0;
		}
		m_stOXYData.i16PR = CData::m_i16PRInvalidValue;
		m_stOXYData.i16Spo2 = CData::m_i16Spo2InvalidValue;
		m_stOXYData.u8Finger = 0;
		m_stOXYData.u8Probe = 0;

		a_i16Temp = CData::m_i16TempInvalidValue;

		a_i8AirOxy = CData::m_i16AirOxyInvalidValue;
	}
	else
	{
		
	}

	if (a_i32Timer - m_i3230SecTimerStart >= 500)
	{
		m_i3230SecTimerStart += 500;

		//开机后15秒，才开始才进行报警判断与保存
		if (!(theApp.m_Data->m_u32Status&(1 << STATUS_TIME_DELAY)))
		{
			theApp.m_Data->Get_Alm();
			theApp.m_Data->Save_Alm();

			if (theApp.m_Data->Get_ECG_ALL_Alm_Trigger())
			{
				//如果心电发生报警，则心电区域闪烁
				m_ECGValueNormal->Set_Blink(1);
				a_i32AlmFlag = 1;
			}
			else
			{
				//心电没有发生报警，则心电不闪烁
				m_ECGValueNormal->Set_Blink(0);
			}

			if (theApp.m_Data->Get_Resp_Alm_Trigger())
			{
				//如果呼吸发生报警，则呼吸区域闪烁
				m_RespValueNormal->Set_Blink(1);
				a_i32AlmFlag = 1;
			}
			else
			{
				//呼吸没有发生报警，则呼吸不闪烁
				m_RespValueNormal->Set_Blink(0);
			}

			if (theApp.m_Data->Get_Temp_Alm_Trigger())
			{
				//如果体温发生报警，则体温区域闪烁
				m_TempValueNormal->Set_Blink(1);
				a_i32AlmFlag = 1;
			}
			else
			{
				//体温没有发生报警，则体温不闪烁
				m_TempValueNormal->Set_Blink(0);
			}

			if (theApp.m_Data->Get_Oxy_Alm_Trigger())
			{
				//如果血氧发生报警，则血氧区域闪烁
				m_SPO2ValueNormal->Set_Blink(1);
				a_i32AlmFlag = 1;
			}
			else
			{
				//血氧没有发生报警，则血氧不闪烁
				m_SPO2ValueNormal->Set_Blink(0);
			}

			if (theApp.m_Data->Get_AirOxy_Alm_Trigger())
			{
				//如果氧浓度发生报警，则氧浓度区域闪烁
				m_FAValueNormal->Set_Blink(1);
				a_i32AlmFlag = 1;
			}
			else
			{
				//氧浓度没有发生报警，则氧浓度不闪烁
				m_FAValueNormal->Set_Blink(0);
			}

			if (theApp.m_Data->Get_NIBP_Alm_Trigger())
			{
				//如果血压发生报警，则血压区域闪烁
				m_BPValueNormal->Set_Blink(1);
				a_i32AlmFlag = 1;
			}
			else
			{
				//血压没有发生报警，则血压不闪烁
				m_BPValueNormal->Set_Blink(0);
			}

			if (theApp.m_Data->Get_New_Alm_Trigger())
			{
				m_i32AlmMute = 0;
				m_i32AlmTime = 0;
				m_DisplayField->stop_alm_time();
			}
		}

		m_ECGValueNormal->set_HR(m_stECGData.i16HR, 0);
		m_ECGValueNormal->set_ST1(m_stECGData.i16ST1, 0);
		m_ECGValueNormal->set_ST2(m_stECGData.i16ST2, 0);
		m_ECGValueNormal->Blink();
		//m_ECGValueNormal->Invalidate(TRUE);

		m_RespValueNormal->set_RR(m_stRespData.i16RR, 0);
		m_RespValueNormal->Blink();
		m_RespValueNormal->Redraw();

		m_SPO2ValueNormal->set_spo2(m_stOXYData.i16Spo2, 0);
		m_SPO2ValueNormal->set_PR(m_stOXYData.i16PR, 0);
		m_SPO2ValueNormal->Blink();
		m_SPO2ValueNormal->Redraw();

		m_TempValueNormal->set_temp(a_i16Temp, 0);
		m_TempValueNormal->Blink();
		m_TempValueNormal->Redraw();

		m_FAValueNormal->set_FiO(a_i8AirOxy, 0);
		m_FAValueNormal->Blink();
		m_FAValueNormal->Redraw();

		m_BPValueNormal->Blink();
		m_BPValueNormal->Redraw();

		if (++a_u32ShowAlmCount & 1)
		{
			m_DisplayField->Show_Alm();
		}

		m_DisplayField->Redraw();
	}

	if (a_i32Timer - m_i321SecTimerStart2 >= 1000)
	{
		m_i321SecTimerStart2 += 1000;
		theApp.Get_Battery();
		theApp.Get_Battery(&a_i32ACFlag, &a_i32BatteryFlag, &a_i32BatteryLifePercent);
		m_DisplayField->Show_Time();
		m_DisplayField->set_Battery(a_i32ACFlag, a_i32BatteryFlag, a_i32BatteryLifePercent);

		m_DisplayField->Invalidate(TRUE);

		((CThreadDraw *)theApp.m_pThrdDraw)->try_copy_dc(&(m_pCECGRespSpo2Trend->dcMem)); 
		m_pCECGRespSpo2Trend->Invalidate();
	}

	if (a_i32Timer-m_i321MinTimerStart>=1000)
	{
		m_i321MinTimerStart += 1000;
		
		if (m_i32AlmTime)
		{
			m_i32AlmTime--;
			m_DisplayField->update_alm_time();
		}
		else
		{
			m_DisplayField->stop_alm_time();
		}

		m_ECGTrendResult->Add_TrendResult(RESULT_TYPE_HR, m_stECGData.i16HR);
		//m_ECGTrendResult->draw_wave();

		m_ECGTrendResult->Add_TrendResult(RESULT_TYPE_ST, m_stECGData.i16ST1);
		m_ECGTrendResult->draw_wave();

		m_TempTrendResult->Add_TrendResult(RESULT_TYPE_TEMP, a_i16Temp);
		m_TempTrendResult->draw_wave();

		m_Spo2TrendResult->Add_TrendResult(RESULT_TYPE_SPO2, m_stOXYData.i16Spo2);
		m_Spo2TrendResult->Add_TrendResult(RESULT_TYPE_PR, m_stOXYData.i16PR);
		m_Spo2TrendResult->draw_wave();

		m_RespTrendResult->Add_TrendResult(RESULT_TYPE_RR, m_stRespData.i16RR);
		m_RespTrendResult->draw_wave();

		m_AirOxyTrendResult->Add_TrendResult(RESULT_TYPE_AIROXY, a_i8AirOxy);
		m_AirOxyTrendResult->draw_wave();

		
	}

	//与上次报警间隔时间是否大于8秒
	if (a_i32Timer - m_i32AlmVolTimeLast > 8 * 1000)
	{
		m_i32AlmVolTimeLast += 8 * 1000;	
		//判断是否有报警
		if ((a_i32AlmFlag == 1) && (m_i32AlmTime == 0))
		{		
			switch (theApp.m_Data->Get_All_Alm_LevelH())
			{
			//发出高报警级别的 报警音
			case 2:
				m_i32AlmVolTypeLast = 3;
				m_sndSoundAlmH.Set_Vol(theApp.m_Data->m_i32AlmVol);
				m_sndSoundAlmH.Play();
				break;

				//发出中报警级别的 报警音
			case 1:
				m_i32AlmVolTypeLast = 2;
				m_sndSoundAlmM.Set_Vol(theApp.m_Data->m_i32AlmVol);
				m_sndSoundAlmM.Play();
				break;

				//发出低报警级别的 报警音
			case 0:
				m_i32AlmVolTypeLast = 1;
				m_sndSoundAlmL.Set_Vol(theApp.m_Data->m_i32AlmVol);
				m_sndSoundAlmL.Play();
				break;
			default:
				break;
			}
		}
	}
	else
	{
		if (m_i32AlmVolTypeLast == 3)
		{	
			//高级别的报警音 结束后，才可以 心搏音
			if (a_i32Timer - m_i32AlmVolTimeLast > 4 * 1000)
			{
				m_i32AlmVolTypeLast = 0;
				if (data)
				{
					m_sndSound1.Stop();
					m_sndSound1.Set_Vol(theApp.m_Data->m_i32BeatVol);
					m_sndSound1.Play();
				}
			}
		}
		else if (m_i32AlmVolTypeLast == 2)
		{
			//中级别的报警音 结束后，才可以 心搏音
			if (a_i32Timer - m_i32AlmVolTimeLast > 1.7 * 1000)
			{
				m_i32AlmVolTypeLast = 0;
				if (data)
				{
					m_sndSound1.Stop();
					m_sndSound1.Set_Vol(theApp.m_Data->m_i32BeatVol);
					m_sndSound1.Play();
				}
			}
		}
		else if (m_i32AlmVolTypeLast == 1)
		{
			//低级别的报警音 结束后，才可以 心搏音
			if (a_i32Timer - m_i32AlmVolTimeLast > 1.4 * 1000)
			{
				m_i32AlmVolTypeLast = 0;
				if (data)
				{
					m_sndSound1.Stop();
					m_sndSound1.Set_Vol(theApp.m_Data->m_i32BeatVol);
					m_sndSound1.Play();
				}
			}
		}
		else
		{
			if (data)
			{
				m_sndSound1.Stop();
				m_sndSound1.Set_Vol(theApp.m_Data->m_i32BeatVol);
				m_sndSound1.Play();
			}
		}
	}
	
	
	if (theApp.m_i32Show == 0)
	{

		for (i = 0; i < m_stECGData.i32DataLength; i++)
		{
			m_pCECGWaveN[0]->Add_WaveDate(m_stECGData.pECGData[theApp.m_Data->m_i32ShowNormalECGChannel1Type][i]);
			m_pCECGWaveN[1]->Add_WaveDate(m_stECGData.pECGData[theApp.m_Data->m_i32ShowNormalECGChannel2Type][i]);

			m_pCECGWaveN[2]->Add_WaveDate(m_stECGData.pECGData[ECG_III_LEAD][i]);
			m_pCECGWaveN[3]->Add_WaveDate(m_stECGData.pECGData[ECG_AVF_LEAD][i]);
			m_pCECGWaveN[4]->Add_WaveDate(m_stECGData.pECGData[ECG_AVL_LEAD][i]);
			m_pCECGWaveN[5]->Add_WaveDate(m_stECGData.pECGData[ECG_AVR_LEAD][i]);
			if (theApp.m_Data->m_i32ParaECGLEAD_MODE)
			{
				//3导联时候不显示 V导联信号
				m_pCECGWaveN[6]->Add_WaveDate(2048);
			} 
			else
			{
				m_pCECGWaveN[6]->Add_WaveDate(m_stECGData.pECGData[ECG_V1_LEAD][i]);
			}
			
		}
		for (i = 0; i < 7;i++)
		{
			m_pCECGWaveN[i]->Draw_Wave();
		}
		
		m_ECGValueNormal->set_beat(data, 0);
		
		
		m_SPO2ValueNormal->Set_Bar(m_stOXYData.u8Bar,0);
		for (i = 0; i < m_stRespData.i32DataLength; i++)
		{
			m_pCRespWave->Add_WaveDate(m_stRespData.pRespData[i]);
		}
		m_pCRespWave->Draw_Wave();

		((CThreadDraw *)theApp.m_pThrdDraw)->add_data(m_stRespData.pRespData, m_stRespData.i32DataLength, m_stRespData.i16RR, m_stECGData.i16HR, m_stOXYData.i16Spo2);

		for (i = 0; i < m_stOXYData.i32DataLength; i++)
		{
			m_pCPlethWave->Add_WaveDate(m_stOXYData.pPlethData[i]);
		}
		m_pCPlethWave->Draw_Wave();
		m_ECGValueNormal->Redraw();
		m_SPO2ValueNormal->Redraw();
	}
	else if (theApp.m_i32Show == 1)
	{
	}
	
	

	CDialogEx::OnTimer(nIDEvent);
}

//双击 心电结果显示区域 回调函数
LRESULT CVerbpoDlg::OnStaticValueECGNormalDBLCLK(WPARAM wPara, LPARAM lPara)
{
	m_CDialogECGSet.DoModal();
	return 0;
}

//双击 血压结果显示区域 回调函数
LRESULT CVerbpoDlg::OnStaticValueBPNormalDBLCLK(WPARAM wPara, LPARAM lPara)
{
	m_CDialogBPSet.DoModal();
	return 0;
}

//双击 体温结果显示区域 回调函数
LRESULT CVerbpoDlg::OnStaticValueTEMPNormalDBLCLK(WPARAM wPara, LPARAM lPara)
{
	m_CDialogTempSet.DoModal();
	return 0;
}

//双击 血氧结果显示区域 回调函数
LRESULT CVerbpoDlg::OnStaticValueOXYNormalDBLCLK(WPARAM wPara, LPARAM lPara)
{
	m_CDialogOXYSet.DoModal();
	return 0;
}

//双击 呼吸结果显示区域 回调函数
LRESULT CVerbpoDlg::OnStaticValueRESPNormalDBLCLK(WPARAM wPara, LPARAM lPara)
{
	m_CDialogRespSet.DoModal();
	return 0;
}

//双击 氧浓度结果显示区域 回调函数
LRESULT CVerbpoDlg::OnStaticValueFANormalDBLCLK(WPARAM wPara, LPARAM lPara)
{
	m_CDialogAirOxySet.DoModal();
	return 0;
}

//选择第一通道导联 回调函数
void CVerbpoDlg::OnCbnSelchangeComboLead1()
{
	int i = 0,j=0;
	i = NormalComboECG1Lead->GetCurSel();
	if (i != theApp.m_Data->m_i32ShowNormalECGChannel2Type)
	{
		theApp.m_Data->m_i32ShowNormalECGChannel1Type = i;
	}
	else
	{
		//5导联模式
		if (theApp.m_Data->m_i32ParaECGLEAD_MODE == 0)
		{
			for (j = ECG_WAVE_I; j <= ECG_WAVE_V1;j++)
			{
				if (j != i)
				{
					break;
				}
			}
			NormalComboECG1Lead->SetCurSel(j);
			theApp.m_Data->m_i32ShowNormalECGChannel1Type = j;
			
		}
		else
		{
			for (j = ECG_WAVE_I; j < ECG_WAVE_V1; j++)
			{
				if (j != i)
				{
					break;
				}
			}
			NormalComboECG1Lead->SetCurSel(j);
			theApp.m_Data->m_i32ShowNormalECGChannel1Type = j;
		}
	}
	m_pCECGWaveN[0]->Erase();
	m_pCECGWaveN[1]->Erase();
	m_pCECGWaveN[0]->Reset_WaveDataBuff();
	m_pCECGWaveN[1]->Reset_WaveDataBuff();
	m_pCECGWaveN[0]->set_lead_type(theApp.m_Data->m_i32ShowNormalECGChannel1Type);
	m_pCECGWaveN[0]->Draw_LeadType();
	m_pCECGWaveN[1]->set_lead_type(theApp.m_Data->m_i32ShowNormalECGChannel2Type);
	m_pCECGWaveN[1]->Draw_LeadType();
}

//选择第二通道导联 回调函数
void CVerbpoDlg::OnCbnSelchangeComboLead2()
{
	int i = 0, j = 0;
	i = NormalComboECG2Lead->GetCurSel();
	if (i != theApp.m_Data->m_i32ShowNormalECGChannel1Type)
	{
		theApp.m_Data->m_i32ShowNormalECGChannel2Type = i;
	}
	else
	{
		//5导联模式
		if (theApp.m_Data->m_i32ParaECGLEAD_MODE == 0)
		{
			for (j = ECG_WAVE_I; j <= ECG_WAVE_V1; j++)
			{
				if (j != i)
				{
					break;
				}
			}
			NormalComboECG2Lead->SetCurSel(j);
			theApp.m_Data->m_i32ShowNormalECGChannel2Type = j;

		}
		else
		{
			for (j = ECG_WAVE_I; j < ECG_WAVE_V1; j++)
			{
				if (j != i)
				{
					break;
				}
			}
			NormalComboECG2Lead->SetCurSel(j);
			theApp.m_Data->m_i32ShowNormalECGChannel2Type = j;
		}
	}
	m_pCECGWaveN[0]->Erase();
	m_pCECGWaveN[1]->Erase();
	m_pCECGWaveN[0]->Reset_WaveDataBuff();
	m_pCECGWaveN[1]->Reset_WaveDataBuff();
	m_pCECGWaveN[0]->set_lead_type(theApp.m_Data->m_i32ShowNormalECGChannel1Type);
	m_pCECGWaveN[0]->Draw_LeadType();
	m_pCECGWaveN[1]->set_lead_type(theApp.m_Data->m_i32ShowNormalECGChannel2Type);
	m_pCECGWaveN[1]->Draw_LeadType();
}

//选择心电电滤波模式 回调函数
void CVerbpoDlg::OnCbnSelchangeComboECGFilter()
{
	int i = 0,j=0;
	i = NormalComboECGFilter->GetCurSel();
	if (i != theApp.m_Data->m_i32ParaECGWAVE_Filter)
	{
		theApp.m_Data->m_i32ParaECGWAVE_Filter = i;
		//复位 心电7个通道的波形
		for (j = 0; j < 7; j++)
		{
			m_pCECGWaveN[j]->Erase();
			m_pCECGWaveN[j]->Reset_WaveDataBuff();
		}
		theApp.m_Data->m_i32ParaECGWAVE_Filter = i;
		theApp.m_Data->m_CParameterSet.set_ECGWaveFilter(i);
	}
}

//选择心电走纸速度 回调函数
void CVerbpoDlg::OnCbnSelchangeComboECGSpeed()
{
	int i = 0;
	i = NormalComboECGSpeed->GetCurSel();
	if (i != theApp.m_Data->m_i32ParaECGWAVE_SPEED)
	{
		theApp.m_Data->m_i32ParaECGWAVE_SPEED = i;
		m_pCECGWaveN[0]->Erase();
		m_pCECGWaveN[1]->Erase();
		m_pCECGWaveN[0]->Reset_WaveDataBuff();
		m_pCECGWaveN[1]->Reset_WaveDataBuff();
		m_pCECGWaveN[0]->Set_Speed(i);
		m_pCECGWaveN[1]->Set_Speed(i);
		
	}
}

//选择心电增益 回调函数
void CVerbpoDlg::OnCbnSelchangeComboECGGain()
{
	int i = 0;
	i = NormalComboECGGain->GetCurSel();
	if (i != theApp.m_Data->m_i32ParaECGWAVE_GAIN)
	{
		theApp.m_Data->m_i32ParaECGWAVE_GAIN = i;
		m_pCECGWaveN[0]->Erase();
		m_pCECGWaveN[1]->Erase();
		m_pCECGWaveN[0]->Reset_WaveDataBuff();
		m_pCECGWaveN[1]->Reset_WaveDataBuff();
		m_pCECGWaveN[0]->Set_Gain(i);
		m_pCECGWaveN[1]->Set_Gain(i);

	}

	//向下位机发送 窒息时间 命令
	//((UartDataThread *)theApp.m_pThrdUart)->Send_CMD_APNEAAlm(theApp.m_Data->m_i32ParaRespAPNEA_TIME);
}

//选择血氧走纸速度 回调函数
void CVerbpoDlg::OnCbnSelchangeComboPlethSpeed()
{
	int i = 0;
	i = NormalComboPlethSpeed->GetCurSel();
	if (i != theApp.m_Data->m_i32PlethSpeed)
	{
		theApp.m_Data->m_i32PlethSpeed = i;
		m_pCPlethWave->Erase();	
		m_pCPlethWave->Reset_WaveDataBuff();
		m_pCPlethWave->Set_Speed(i);
	}
}

//选择呼吸走纸速度 回调函数
void CVerbpoDlg::OnCbnSelchangeComboRespSpeed()
{
	int i = 0;
	i = NormalComboRespSpeed->GetCurSel();
	if (i != theApp.m_Data->m_i32ParaRespSpeed)
	{
		theApp.m_Data->m_i32ParaRespSpeed = i;
		m_pCRespWave->Erase();
		m_pCRespWave->Reset_WaveDataBuff();
		m_pCRespWave->Set_Speed(i);

	}
}

//选择呼吸增益 回调函数
void CVerbpoDlg::OnCbnSelchangeComboRespGain()
{
	int i = 0;
	i = NormalComboRespGain->GetCurSel();
	if (i != theApp.m_Data->m_i32ParaRespGain)
	{
		theApp.m_Data->m_i32ParaRespGain = i;
		m_pCRespWave->Erase();
		m_pCRespWave->Reset_WaveDataBuff();
		m_pCRespWave->Set_Gain(i);

	}

	//向下位机发送 呼吸增益 命令
	((UartDataThread *)theApp.m_pThrdUart)->Send_CMD_RESPGain(i);
}

//销毁窗口 回调函数
BOOL CVerbpoDlg::DestroyWindow()
{
	DWORD code;
	INT i;
	// TODO:  在此添加专用代码和/或调用基类
	m_ECGValueNormal->DestroyWindow();
	m_RespValueNormal->DestroyWindow();
	m_SPO2ValueNormal->DestroyWindow();
	m_TempValueNormal->DestroyWindow();
	m_BPValueNormal->DestroyWindow();
	m_FAValueNormal->DestroyWindow();

	MainButtonShow->DestroyWindow();//0
	MainButtonLeft->DestroyWindow();
	MainButtonRight->DestroyWindow();
	MainButtonMute->DestroyWindow();//1
	MainButtonPrint->DestroyWindow();//2
	MainButtonDataRec->DestroyWindow();//3
	MainButtonBP->DestroyWindow();//4
	MainButtonFreeze->DestroyWindow();//5
	MainButtonAlarmSet->DestroyWindow();//6
	MainButtonAlarmRec->DestroyWindow();
	MainButtonTrendChartRec->DestroyWindow();//7
	MainButtonTrendTableRec->DestroyWindow();//8
	MainButtonTrendNIBPRec->DestroyWindow();//9
	MainButtonSysRec->DestroyWindow();
	MainButtonPat->DestroyWindow();//10
	MainButtonMedCal->DestroyWindow();//11
	MainButtonSys->DestroyWindow();//11
	MainButtonMenu->DestroyWindow();//12
	MainButtonShut->DestroyWindow();//13

	m_ECGTrendResult->DestroyWindow();
	m_NIBPTrendResult->DestroyWindow();
	m_TempTrendResult->DestroyWindow();
	m_Spo2TrendResult->DestroyWindow();
	m_RespTrendResult->DestroyWindow();
	m_AirOxyTrendResult->DestroyWindow();

	for (i = 0; i < 7; i++)
	{
		m_pCECGWaveN[i]->DestroyWindow();
	}
	m_DisplayField->DestroyWindow();
	NormalComboECG1Lead->DestroyWindow();
	NormalComboECG2Lead->DestroyWindow();
	NormalComboECGFilter->DestroyWindow();
	NormalComboECGSpeed->DestroyWindow();
	NormalComboECGGain->DestroyWindow();
	NormalComboRespSpeed->DestroyWindow();
	NormalComboRespGain->DestroyWindow();
	NormalComboPlethSpeed->DestroyWindow();
	
	((UartDataThread *)theApp.m_pThrdUart)->m_i32Exit = 1;
	//((UartDataThread *)theApp.m_pThrd)->m_i32Exit = 1;
	BOOL res = GetExitCodeThread(theApp.m_pThrdUart->m_hThread, &code);
	while (GetExitCodeThread(theApp.m_pThrdUart->m_hThread, &code));
	/*res = GetExitCodeThread(theApp.m_pThrd->m_hThread, &code);
	while (GetExitCodeThread(theApp.m_pThrd->m_hThread, &code));*/

	((CThreadDataAlmRec *)theApp.m_pThrdDataSave)->m_i32Exit = 1;
	//((UartDataThread *)theApp.m_pThrd)->m_i32Exit = 1;
	res = GetExitCodeThread(theApp.m_pThrdDataSave->m_hThread, &code);
	while (GetExitCodeThread(theApp.m_pThrdDataSave->m_hThread, &code));

	((CThreadDraw *)theApp.m_pThrdDraw)->m_i32Exit = 1;
	//((UartDataThread *)theApp.m_pThrd)->m_i32Exit = 1;
	res = GetExitCodeThread(theApp.m_pThrdDraw->m_hThread, &code);
	while (GetExitCodeThread(theApp.m_pThrdDraw->m_hThread, &code));

	return CDialogEx::DestroyWindow();
}


void CVerbpoDlg::OnCbnSelchangeComboComSpo2()
{
	// TODO:  在此添加控件通知处理程序代码
	INT a_i32Data = 0;
	switch (m_ComboComSpo2.GetCurSel())
	{
	case 0:
		a_i32Data = 100;
		break;

	case 1:
		a_i32Data = 95;
		break;

	case 2:
		a_i32Data = 90;
		break;

	case 3:
		a_i32Data = 80;
		break;

	case 4:
		a_i32Data = 70;
		break;
	}
	theApp.m_CSCom.Lock();
	theApp.m_i32SPO2 = a_i32Data;
	theApp.m_CSCom.Unlock();

}


void CVerbpoDlg::OnCbnSelchangeComboComPr()
{
	// TODO:  在此添加控件通知处理程序代码
	INT a_i32Data = 0;
	switch (m_ComboComPR.GetCurSel())
	{
	case 0:
		a_i32Data = 15;
		break;

	case 1:
		a_i32Data = 30;
		break;

	case 2:
		a_i32Data = 60;
		break;

	case 3:
		a_i32Data = 90;
		break;

	case 4:
		a_i32Data = 120;
		break;
	}
	theApp.m_CSCom.Lock();
	theApp.m_i32PR = a_i32Data;
	theApp.m_CSCom.Unlock();
}


void CVerbpoDlg::OnBnClickedButtonComSpo2AlmFigner()
{
	// TODO:  在此添加控件通知处理程序代码
}


void CVerbpoDlg::OnBnClickedButtonComSpo2Probe()
{
	// TODO:  在此添加控件通知处理程序代码
}


void CVerbpoDlg::OnCbnSelchangeComboComTemp()
{
	// TODO:  在此添加控件通知处理程序代码
	INT a_i32Data = 0;
	switch (m_ComboComTemp.GetCurSel())
	{
	case 0:
		a_i32Data = 371;
		break;

	case 1:
		a_i32Data = 390;
		break;

	case 2:
		a_i32Data = 400;
		break;

	case 3:
		a_i32Data = 360;
		break;

	case 4:
		a_i32Data = 350;
		break;
	}

	theApp.m_CSCom.Lock();
	theApp.m_i16Temp = a_i32Data;
	theApp.m_CSCom.Unlock();
}


void CVerbpoDlg::OnBnClickedButtonComTempAlm()
{
	// TODO:  在此添加控件通知处理程序代码
}


void CVerbpoDlg::OnCbnSelchangeComboComHr()
{
	// TODO:  在此添加控件通知处理程序代码
	INT a_i32Data = 0;
	switch (m_ComboComHR.GetCurSel())
	{
	case 0:
		a_i32Data = 30;
		break;

	case 1:
		a_i32Data = 60;
		break;

	case 2:
		a_i32Data = 90;
		break;

	case 3:
		a_i32Data = 120;
		break;

	case 4:
		a_i32Data = 180;
		break;

	case 5:
		a_i32Data = 250;
		break;

	case 6:
		a_i32Data = 300;
		break;
	}
	theApp.m_CSCom.Lock();
	theApp.m_i32HR = a_i32Data;
	theApp.m_CSCom.Unlock();
}


void CVerbpoDlg::OnCbnSelchangeComboComSt()
{
	// TODO:  在此添加控件通知处理程序代码
	INT a_i32Data = 0;
	switch (m_ComboComST.GetCurSel())
	{
	case 0:
		a_i32Data = 0;
		break;

	case 1:
		a_i32Data = 20;
		break;

	case 2:
		a_i32Data = 50;
		break;

	case 3:
		a_i32Data = 100;
		break;

	case 4:
		a_i32Data = -20;
		break;

	case 5:
		a_i32Data = -50;
		break;

	case 6:
		a_i32Data = -100;
		break;
	}
	theApp.m_CSCom.Lock();
	theApp.m_i32ST1 = a_i32Data;
	theApp.m_i32ST2 = a_i32Data;
	theApp.m_CSCom.Unlock();
}


void CVerbpoDlg::OnCbnSelchangeComboComRr()
{
	// TODO:  在此添加控件通知处理程序代码
	INT a_i32Data = 0;
	switch (m_ComboComRR.GetCurSel())
	{
	case 0:
		a_i32Data = 15;
		break;

	case 1:
		a_i32Data = 30;
		break;

	case 2:
		a_i32Data = 60;
		break;

	case 3:
		a_i32Data = 90;
		break;

	case 4:
		a_i32Data = 120;
		break;

	
	}
	theApp.m_CSCom.Lock();
	theApp.m_i16RR = a_i32Data;
	theApp.m_CSCom.Unlock();
}


void CVerbpoDlg::OnBnClickedButtonComApnea()
{
	// TODO:  在此添加控件通知处理程序代码
}


void CVerbpoDlg::OnCbnSelchangeComboComSbp()
{
	// TODO:  在此添加控件通知处理程序代码
	INT a_i32Data = 0;
	switch (m_ComboComSBP.GetCurSel())
	{
	case 0:
		a_i32Data = 30;
		break;

	case 1:
		a_i32Data = 50;
		break;

	case 2:
		a_i32Data = 70;
		break;

	case 3:
		a_i32Data = 80;
		break;
	}
	theApp.m_CSCom.Lock();
	theApp.m_i32SBP = a_i32Data;
	theApp.m_CSCom.Unlock();
}


void CVerbpoDlg::OnCbnSelchangeComboComDbp()
{
	// TODO:  在此添加控件通知处理程序代码
	INT a_i32Data = 0;
	switch (m_ComboComSBP.GetCurSel())
	{
	case 0:
		a_i32Data = 60;
		break;

	case 1:
		a_i32Data = 80;
		break;

	case 2:
		a_i32Data = 100;
		break;

	case 3:
		a_i32Data = 120;
		break;
	}
	theApp.m_CSCom.Lock();
	theApp.m_i32DBP = a_i32Data;
	theApp.m_CSCom.Unlock();
}


void CVerbpoDlg::OnBnClickedButtonComNibp()
{
	// TODO:  在此添加控件通知处理程序代码
}


void CVerbpoDlg::OnCbnSelchangeComboComOxy()
{
	// TODO:  在此添加控件通知处理程序代码
	INT8 a_i8Data = 0;
	switch (m_ComboComOXY.GetCurSel())
	{
	case 0:
		a_i8Data = 30;
		break;

	case 1:
		a_i8Data = 50;
		break;

	case 2:
		a_i8Data = 70;
		break;

	case 3:
		a_i8Data = 80;
		break;

	case 4:
		a_i8Data = 100;
		break;
	}
	theApp.m_CSCom.Lock();
	theApp.m_i8AirOxy = a_i8Data;
	theApp.m_CSCom.Unlock();
}


void CVerbpoDlg::OnBnClickedButtonComOxyAlm()
{
	// TODO:  在此添加控件通知处理程序代码
}


void CVerbpoDlg::OnCbnSelchangeComboComLead()
{
	// TODO:  在此添加控件通知处理程序代码
	INT i = m_CComboComLead.GetCurSel();
	theApp.m_CSCom.Lock();
	theApp.m_u8LeadOff = 0;
	theApp.m_u8LeadOff = (1<<(i-1));
	theApp.m_CSCom.Unlock();
}


void CVerbpoDlg::OnCbnSelchangeComboComArra()
{
	// TODO:  在此添加控件通知处理程序代码

	INT i = m_CComboComARRA.GetCurSel();
	theApp.m_CSCom.Lock();
	theApp.m_u8ARRA = i;
	theApp.m_CSCom.Unlock();
}


void CVerbpoDlg::OnCbnSelchangeComboComFinger()
{
	// TODO:  在此添加控件通知处理程序代码
	INT i = m_CComboFinger.GetCurSel();
	theApp.m_CSCom.Lock();
	if (i)
	{
		theApp.m_u8SPO2Alm |= 0x80;
	}
	else
	{
		theApp.m_u8SPO2Alm &= (~0x80);
	}

	theApp.m_CSCom.Unlock();
}


void CVerbpoDlg::OnCbnSelchangeComboComProbe()
{
	// TODO:  在此添加控件通知处理程序代码
	INT i = m_CComboProbe.GetCurSel();
	theApp.m_CSCom.Lock();
	if (i)
	{
		theApp.m_u8SPO2Alm |= 0x10;
	} 
	else
	{
		theApp.m_u8SPO2Alm &= (~0x10);
	}
	
	theApp.m_CSCom.Unlock();
}


void CVerbpoDlg::OnCbnSelchangeComboComTempProbe()
{
	// TODO:  在此添加控件通知处理程序代码
	INT i = m_CComboTempProbe.GetCurSel();
	theApp.m_CSCom.Lock();
	theApp.m_u8TempAlm = i;
	theApp.m_CSCom.Unlock();
}


void CVerbpoDlg::OnCbnSelchangeComboComAiroxyProbe()
{
	// TODO:  在此添加控件通知处理程序代码
	INT i = m_CComboAirOxyProbe.GetCurSel();
	theApp.m_CSCom.Lock();
	theApp.m_i8AirOxyAlm = i;
	theApp.m_CSCom.Unlock();
}


void CVerbpoDlg::OnCbnSelchangeComboComApnea()
{
	// TODO:  在此添加控件通知处理程序代码
	INT i = m_CComboAPNEA.GetCurSel();
	theApp.m_CSCom.Lock();
	theApp.m_u8APNEA = i;
	theApp.m_CSCom.Unlock();
}
