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

#include "stdafx.h"
#include "Verbpo.h"
#include "DialogAlmSet.h"
#include "afxdialogex.h"
#include "VerbpoDlg.h"

// CDialogAlmSet 对话框

IMPLEMENT_DYNAMIC(CDialogAlmSet, CDialogEx)

CDialogAlmSet::CDialogAlmSet(CWnd* pParent /*=NULL*/)
	: CDialogEx(CDialogAlmSet::IDD, pParent)
{

}

CDialogAlmSet::~CDialogAlmSet()
{
}

void CDialogAlmSet::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_EDIT_ALM_SET_HR_ALM_H, m_CEditHRH);
	DDX_Control(pDX, IDC_EDIT_ALM_SET_ECG_HR_L, m_CEditHRL);
	DDX_Control(pDX, IDC_EDIT_ALM_SET_ST_ALM_H, m_CEditSTH);
	DDX_Control(pDX, IDC_EDIT_ALM_SET_ST_ALM_L, m_CEditSTL);
	DDX_Control(pDX, IDC_EDIT_ALM_SET_PVCS_H, m_CEditPVCsH);
	DDX_Control(pDX, IDC_EDIT_ALM_SET_SBP_H, m_CEditSBPH);
	DDX_Control(pDX, IDC_EDIT_ALM_SET_SBP_L, m_CEditSBPL);
	DDX_Control(pDX, IDC_EDIT_ALM_SET_DBP_H, m_CEditDBPH);
	DDX_Control(pDX, IDC_EDIT_ALM_SET_DBP_L, m_CEditDBPL);
	DDX_Control(pDX, IDC_EDIT_ALM_SET_RR_ALM_H, m_CEditRRH);
	DDX_Control(pDX, IDC_EDIT_ALM_SET_RR_ALM_L, m_CEditRRL);
	DDX_Control(pDX, IDC_EDIT_ALM_SET_OXY_ALM_L, m_CEditSpo2L);
	DDX_Control(pDX, IDC_EDIT_ALM_SET_OXY_ALM_H, m_CEditSpo2H);
	DDX_Control(pDX, IDC_EDIT_ALM_SET_PR_ALM_H, m_CEditPRH);
	DDX_Control(pDX, IDC_EDIT_ALM_SET_PR_ALM_L, m_CEditPRL);
	DDX_Control(pDX, IDC_EDIT_ALM_SET_TEMP_ALM_H, m_CEditTempH);
	DDX_Control(pDX, IDC_EDIT_ALM_SET_TEMP_ALM_L, m_CEditTempL);
	DDX_Control(pDX, IDC_EDIT_ALM_SET_AIROXY_ALM_H, m_CEditAirOxyH);
	DDX_Control(pDX, IDC_EDIT_ALM_SET_AIROXY_ALM_L, m_CEditAirOxyL);
	DDX_Control(pDX, IDC_COMBO_ALM_SET_ECG_ALM_SW, m_CComboBoxHRAlmSw);
	DDX_Control(pDX, IDC_COMBO_ALM_SET_ST_ALM_SW, m_CComboBoxSTAlmSw);
	DDX_Control(pDX, IDC_COMBO_ALM_SET_BP_ALM_SW, m_CComboBoxBPAlmSw);
	DDX_Control(pDX, IDC_COMBO_RESP_SET_ALM_SW, m_CComboBoxRespAlmSw);
	DDX_Control(pDX, IDC_COMBO_OXY_SET_ALM_SW, m_CComboBoxSpo2AlmSw);
	DDX_Control(pDX, IDC_COMBO_ALM_SET_TEMP_ALM_SW, m_CComboBoxTempAlmSw);
	DDX_Control(pDX, IDC_COMBO_ALM_SET_AIROXY_ALM_SW, m_CComboBoxAirOxyAlmSw);
	DDX_Control(pDX, IDC_COMBO_ALM_SET_ECG_ALM_LEVEL, m_CComboBoxHRAlmLevel);
	DDX_Control(pDX, IDC_COMBO_ALM_SET_ST_ALM_LEVEL, m_CComboBoxSTAlmLevel);
	DDX_Control(pDX, IDC_COMBO_ALM_SET_BP_ALM_LEVEL, m_CComboBoxBPAlmLevel);
	DDX_Control(pDX, IDC_COMBO_RESP_SET_ALM_LEVEL, m_CComboBoxRespAlmLevel);
	DDX_Control(pDX, IDC_COMBO_OXY_SET_ALM_LEVEL, m_CComboBoxSpo2AlmLevel);
	DDX_Control(pDX, IDC_COMBO_ALM_SET_TEMP_ALM_LEVEL, m_CComboBoxTempAlmLevel);
	DDX_Control(pDX, IDC_COMBO_ALM_SET_AIROXY_ALM_LEVEL, m_CComboBoxAirOxyAlmLevel);
}


BOOL CDialogAlmSet::OnInitDialog()
{
	float f;
	CString a_cs;
	CDialogEx::OnInitDialog();

	//// TODO:  在此添加额外的初始化
	m_CComboBoxHRAlmSw.AddString(CString(_T("关")));
	m_CComboBoxHRAlmSw.AddString(CString(_T("开")));
	m_CComboBoxHRAlmSw.SetCurSel(theApp.m_Data->m_i32ParaECGALM_SW);

	m_CComboBoxHRAlmLevel.AddString(CString(_T("低")));
	m_CComboBoxHRAlmLevel.AddString(CString(_T("中")));
	m_CComboBoxHRAlmLevel.AddString(CString(_T("高")));
	m_CComboBoxHRAlmLevel.SetCurSel(theApp.m_Data->m_i32ParaECGALM_LEVEL);

	a_cs.Format(_T("%d"), theApp.m_Data->m_i32ParaECGHR_ALM_H);
	m_CEditHRH.SetWindowTextW(a_cs);

	a_cs.Format(_T("%d"), theApp.m_Data->m_i32ParaECGHR_ALM_L);
	m_CEditHRL.SetWindowTextW(a_cs);



	// TODO:  在此添加额外的初始化
	m_CComboBoxSTAlmSw.AddString(CString(_T("关")));
	m_CComboBoxSTAlmSw.AddString(CString(_T("开")));
	m_CComboBoxSTAlmSw.SetCurSel(theApp.m_Data->m_i32ParaECGST_ALM_SW);


	m_CComboBoxSTAlmLevel.AddString(CString(_T("低")));
	m_CComboBoxSTAlmLevel.AddString(CString(_T("中")));
	m_CComboBoxSTAlmLevel.AddString(CString(_T("高")));
	m_CComboBoxSTAlmLevel.SetCurSel(theApp.m_Data->m_i32ParaECGST_ALM_LEVEL);


	f = theApp.m_Data->m_i32ParaECGST_ALM_H;
	f /= 100.f;
	a_cs.Format(_T("%2.1f"), f);
	m_CEditSTH.SetWindowTextW(a_cs);

	f = theApp.m_Data->m_i32ParaECGST_ALM_L;
	f /= 100.f;
	a_cs.Format(_T("%2.1f"), f);
	m_CEditSTL.SetWindowTextW(a_cs);


	a_cs.Format(_T("%d"), theApp.m_Data->m_i32ParaECGARRA_PVCS_ALM_H);
	m_CEditPVCsH.SetWindowTextW(a_cs);


	m_CComboBoxBPAlmSw.AddString(CString(_T("关")));
	m_CComboBoxBPAlmSw.AddString(CString(_T("开")));
	m_CComboBoxBPAlmSw.SetCurSel(theApp.m_Data->m_i32ParaBPALM_SW);

	m_CComboBoxBPAlmLevel.AddString(CString(_T("低")));
	m_CComboBoxBPAlmLevel.AddString(CString(_T("中")));
	m_CComboBoxBPAlmLevel.AddString(CString(_T("高")));
	m_CComboBoxBPAlmLevel.SetCurSel(theApp.m_Data->m_i32ParaBPALM_LEVEL);

	a_cs.Format(_T("%d"), theApp.m_Data->m_i32ParaBPSBP_ALM_H);
	m_CEditSBPH.SetWindowTextW(a_cs);

	a_cs.Format(_T("%d"), theApp.m_Data->m_i32ParaBPSBP_ALM_L);
	m_CEditSBPL.SetWindowTextW(a_cs);

	a_cs.Format(_T("%d"), theApp.m_Data->m_i32ParaBPDBP_ALM_H);
	m_CEditDBPH.SetWindowTextW(a_cs);

	a_cs.Format(_T("%d"), theApp.m_Data->m_i32ParaBPDBP_ALM_L);
	m_CEditDBPL.SetWindowTextW(a_cs);


	m_CComboBoxRespAlmSw.AddString(CString(_T("关")));
	m_CComboBoxRespAlmSw.AddString(CString(_T("开")));
	m_CComboBoxRespAlmSw.SetCurSel(theApp.m_Data->m_i32ParaRespALM_SW);

	m_CComboBoxRespAlmLevel.AddString(CString(_T("低")));
	m_CComboBoxRespAlmLevel.AddString(CString(_T("中")));
	m_CComboBoxRespAlmLevel.AddString(CString(_T("高")));
	m_CComboBoxRespAlmLevel.SetCurSel(theApp.m_Data->m_i32ParaRespALM_LEVEL);


	a_cs.Format(_T("%d"), theApp.m_Data->m_i32ParaRespRR_ALM_H);
	m_CEditRRH.SetWindowTextW(a_cs);

	a_cs.Format(_T("%d"), theApp.m_Data->m_i32ParaRespRR_ALM_L);
	m_CEditRRL.SetWindowTextW(a_cs);

	m_CComboBoxSpo2AlmSw.AddString(CString(_T("关")));
	m_CComboBoxSpo2AlmSw.AddString(CString(_T("开")));
	m_CComboBoxSpo2AlmSw.SetCurSel(theApp.m_Data->m_i32ParaOxyALM_SW);

	m_CComboBoxSpo2AlmLevel.AddString(CString(_T("低")));
	m_CComboBoxSpo2AlmLevel.AddString(CString(_T("中")));
	m_CComboBoxSpo2AlmLevel.AddString(CString(_T("高")));
	m_CComboBoxSpo2AlmLevel.SetCurSel(theApp.m_Data->m_i32ParaOxyALM_LEVEL);


	a_cs.Format(_T("%d"), theApp.m_Data->m_i32ParaOxyOXY_ALM_H);
	m_CEditSpo2H.SetWindowTextW(a_cs);

	a_cs.Format(_T("%d"), theApp.m_Data->m_i32ParaOxyOXY_ALM_L);
	m_CEditSpo2L.SetWindowTextW(a_cs);

	a_cs.Format(_T("%d"), theApp.m_Data->m_i32ParaOxyOXY_PR_ALM_H);
	m_CEditPRH.SetWindowTextW(a_cs);

	a_cs.Format(_T("%d"), theApp.m_Data->m_i32ParaOxyOXY_PR_ALM_L);
	m_CEditPRL.SetWindowTextW(a_cs);


	m_CComboBoxTempAlmSw.AddString(CString(_T("关")));
	m_CComboBoxTempAlmSw.AddString(CString(_T("开")));
	m_CComboBoxTempAlmSw.SetCurSel(theApp.m_Data->m_i32ParaTempALM_SW);

	m_CComboBoxTempAlmLevel.AddString(CString(_T("低")));
	m_CComboBoxTempAlmLevel.AddString(CString(_T("中")));
	m_CComboBoxTempAlmLevel.AddString(CString(_T("高")));
	m_CComboBoxTempAlmLevel.SetCurSel(theApp.m_Data->m_i32ParaTempALM_LEVEL);


	f = theApp.m_Data->m_i32ParaTempTEMP_ALM_H;
	f /= 10.0f;
	a_cs.Format(_T("%2.1f"), f);
	m_CEditTempH.SetWindowTextW(a_cs);

	f = theApp.m_Data->m_i32ParaTempTEMP_ALM_L;
	f /= 10.0f;
	a_cs.Format(_T("%2.1f"), f);
	m_CEditTempL.SetWindowTextW(a_cs);
	
	m_CComboBoxAirOxyAlmSw.AddString(CString(_T("关")));
	m_CComboBoxAirOxyAlmSw.AddString(CString(_T("开")));
	m_CComboBoxAirOxyAlmSw.SetCurSel(theApp.m_Data->m_i32ParaAirOxyALM_SW);

	m_CComboBoxAirOxyAlmLevel.AddString(CString(_T("低")));
	m_CComboBoxAirOxyAlmLevel.AddString(CString(_T("中")));
	m_CComboBoxAirOxyAlmLevel.AddString(CString(_T("高")));
	m_CComboBoxAirOxyAlmLevel.SetCurSel(theApp.m_Data->m_i32ParaAirOxyALM_LEVEL);


	a_cs.Format(_T("%d"), theApp.m_Data->m_i32ParaAirOxy_ALM_H);
	m_CEditAirOxyH.SetWindowTextW(a_cs);

	a_cs.Format(_T("%d"), theApp.m_Data->m_i32ParaAirOxy_ALM_L);
	m_CEditAirOxyL.SetWindowTextW(a_cs);

	return TRUE;  // return TRUE unless you set the focus to a control
	// 异常:  OCX 属性页应返回 FALSE
}


BOOL CDialogAlmSet::PreTranslateMessage(MSG* pMsg)
{
	CRect     rect;
	CString a_cs;
	INT i = 0;
	float f = 0.0f;
	// TODO:  在此添加专用代码和/或调用基类

	if (WM_LBUTTONDOWN == pMsg->message&& m_CEditHRH.GetSafeHwnd() == pMsg->hwnd)
	{
		m_CEditHRH.GetWindowTextW(a_cs);
		m_CEditHRH.GetWindowRect(&rect);       //获得文本框矩形,左上角坐标(0,0)   
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_type(NUM_INPUT_NO_DOT | NUM_INPUT_NO_SYMBOL);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_title(CString(_T("心律上限")));
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_result(a_cs);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_pos(rect.left, rect.top);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.DoModal();
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.get_result(a_cs);
		a_cs = input_HRAlmH_check(a_cs);
		theApp.m_Data->m_i32ParaECGHR_ALM_H = _ttoi(a_cs);
		theApp.m_Data->m_CParameterSet.set_ECGHRAlmH(_ttoi(a_cs));
		m_CEditHRH.SetWindowTextW(a_cs);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_ECGValueNormal->set_HR_Alm_H(theApp.m_Data->m_i32ParaECGHR_ALM_H, 0);

		return TRUE;
	}
	else if (WM_LBUTTONDOWN == pMsg->message&& m_CEditHRL.GetSafeHwnd() == pMsg->hwnd)
	{
		m_CEditHRL.GetWindowTextW(a_cs);
		m_CEditHRL.GetWindowRect(&rect);       //获得文本框矩形,左上角坐标(0,0)   
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_type(NUM_INPUT_NO_DOT | NUM_INPUT_NO_SYMBOL);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_title(CString(_T("心律下限")));
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_result(a_cs);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_pos(rect.left, rect.top);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.DoModal();
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.get_result(a_cs);
		a_cs = input_HRAlmL_check(a_cs);
		theApp.m_Data->m_i32ParaECGHR_ALM_L = _ttoi(a_cs);
		theApp.m_Data->m_CParameterSet.set_ECGHRAlmL(_ttoi(a_cs));
		m_CEditHRL.SetWindowTextW(a_cs);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_ECGValueNormal->set_HR_Alm_L(theApp.m_Data->m_i32ParaECGHR_ALM_L, 0);

		return TRUE;
	}
	else if (WM_LBUTTONDOWN == pMsg->message&& m_CEditSTH.GetSafeHwnd() == pMsg->hwnd)
	{
		m_CEditSTH.GetWindowTextW(a_cs);
		m_CEditSTH.GetWindowRect(&rect);       //获得文本框矩形,左上角坐标(0,0)   
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_type(NUM_INPUT_DOT | NUM_INPUT_SYMBOL);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_title(CString(_T("ST上限")));
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_result(a_cs);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_pos(rect.left, rect.top);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.DoModal();
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.get_result(a_cs);
		i = a_cs.Find('.');
		if (i != -1)
		{
			if (i == a_cs.GetLength() - 1)
				a_cs = a_cs.Mid(0, i);
			else
				a_cs = a_cs.Mid(0, i + 2);
		}
		a_cs = input_STAlmH_check(a_cs);
		f = _ttof(a_cs);
		i = (int)(f*10.0f);
		theApp.m_Data->m_i32ParaECGST_ALM_H = i;
		theApp.m_Data->m_CParameterSet.set_ECGSTAlmH(i);
		m_CEditSTH.SetWindowTextW(a_cs);
		return TRUE;
	}
	else if (WM_LBUTTONDOWN == pMsg->message&& m_CEditSTL.GetSafeHwnd() == pMsg->hwnd)
	{
		m_CEditSTL.GetWindowTextW(a_cs);
		m_CEditSTL.GetWindowRect(&rect);       //获得文本框矩形,左上角坐标(0,0)   
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_type(NUM_INPUT_DOT | NUM_INPUT_SYMBOL);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_title(CString(_T("ST下限")));
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_result(a_cs);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_pos(rect.left, rect.top);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.DoModal();
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.get_result(a_cs);
		//a_cs = input_HRAlmL_check(a_cs);
		i = a_cs.Find('.');
		if (i != -1)
		{
			if (i == a_cs.GetLength() - 1)
				a_cs = a_cs.Mid(0, i);
			else
				a_cs = a_cs.Mid(0, i + 2);
		}
		a_cs = input_STAlmL_check(a_cs);
		f = _ttof(a_cs);
		i = (int)(f*10.0f);
		theApp.m_Data->m_i32ParaECGST_ALM_L = i;
		theApp.m_Data->m_CParameterSet.set_ECGSTAlmL(i);
		m_CEditSTL.SetWindowTextW(a_cs);
		return TRUE;
	}
	else if (WM_LBUTTONDOWN == pMsg->message&& m_CEditPVCsH.GetSafeHwnd() == pMsg->hwnd)
	{
		m_CEditPVCsH.GetWindowTextW(a_cs);
		m_CEditPVCsH.GetWindowRect(&rect);       //获得文本框矩形,左上角坐标(0,0)   
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_type(NUM_INPUT_DOT | NUM_INPUT_SYMBOL);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_title(CString(_T("PVCs上限")));
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_result(a_cs);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_pos(rect.left, rect.top);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.DoModal();
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.get_result(a_cs);

		a_cs = input_PVCsAlmH_check(a_cs);
		i = _ttoi(a_cs);

		theApp.m_Data->m_i32ParaECGARRA_PVCS_ALM_H = i;
		theApp.m_Data->m_CParameterSet.set_ECGARRAPVCsH(i);
		m_CEditPVCsH.SetWindowTextW(a_cs);
		return TRUE;
	}
	else if (WM_LBUTTONDOWN == pMsg->message&& m_CEditSBPH.GetSafeHwnd() == pMsg->hwnd)
	{
		m_CEditSBPH.GetWindowTextW(a_cs);
		m_CEditSBPH.GetWindowRect(&rect);       //获得文本框矩形,左上角坐标(0,0)   
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_type(NUM_INPUT_NO_DOT | NUM_INPUT_NO_SYMBOL);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_title(CString(_T("收缩压上限")));
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_result(a_cs);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_pos(rect.left, rect.top);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.DoModal();
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.get_result(a_cs);
		a_cs = input_SBPAlmH_check(a_cs);
		theApp.m_Data->m_i32ParaBPSBP_ALM_H = _ttoi(a_cs);
		theApp.m_Data->m_CParameterSet.set_BPSBPAlmH(_ttoi(a_cs));
		m_CEditSBPH.SetWindowTextW(a_cs);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_BPValueNormal->set_alm_H(theApp.m_Data->m_i32ParaBPSBP_ALM_H, theApp.m_Data->m_i32ParaBPDBP_ALM_H, 0);
		
		return TRUE;
	}
	else if (WM_LBUTTONDOWN == pMsg->message&& m_CEditSBPL.GetSafeHwnd() == pMsg->hwnd)
	{
		m_CEditSBPL.GetWindowTextW(a_cs);
		m_CEditSBPL.GetWindowRect(&rect);       //获得文本框矩形,左上角坐标(0,0)   
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_type(NUM_INPUT_NO_DOT | NUM_INPUT_NO_SYMBOL);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_title(CString(_T("收缩压下限")));
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_result(a_cs);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_pos(rect.left, rect.top);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.DoModal();
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.get_result(a_cs);
		a_cs = input_SBPAlmL_check(a_cs);
		theApp.m_Data->m_i32ParaBPSBP_ALM_L = _ttoi(a_cs);
		theApp.m_Data->m_CParameterSet.set_BPSBPAlmL(_ttoi(a_cs));
		m_CEditSBPL.SetWindowTextW(a_cs);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_BPValueNormal->set_alm_L(theApp.m_Data->m_i32ParaBPSBP_ALM_L, theApp.m_Data->m_i32ParaBPDBP_ALM_L, 0);
		
		return TRUE;
	}
	else if (WM_LBUTTONDOWN == pMsg->message&& m_CEditDBPH.GetSafeHwnd() == pMsg->hwnd)
	{
		m_CEditDBPH.GetWindowTextW(a_cs);
		m_CEditDBPH.GetWindowRect(&rect);       //获得文本框矩形,左上角坐标(0,0)   
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_type(NUM_INPUT_NO_DOT | NUM_INPUT_NO_SYMBOL);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_title(CString(_T("舒张压上限")));
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_result(a_cs);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_pos(rect.left, rect.top);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.DoModal();
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.get_result(a_cs);
		a_cs = input_DBPAlmH_check(a_cs);
		theApp.m_Data->m_i32ParaBPDBP_ALM_H = _ttoi(a_cs);
		theApp.m_Data->m_CParameterSet.set_BPDBPAlmH(_ttoi(a_cs));
		m_CEditDBPH.SetWindowTextW(a_cs);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_BPValueNormal->set_alm_H(theApp.m_Data->m_i32ParaBPSBP_ALM_H, theApp.m_Data->m_i32ParaBPDBP_ALM_H, 0);
		
		return TRUE;
	}
	else if (WM_LBUTTONDOWN == pMsg->message&& m_CEditDBPL.GetSafeHwnd() == pMsg->hwnd)
	{
		m_CEditDBPL.GetWindowTextW(a_cs);
		m_CEditDBPL.GetWindowRect(&rect);       //获得文本框矩形,左上角坐标(0,0)   
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_type(NUM_INPUT_NO_DOT | NUM_INPUT_NO_SYMBOL);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_title(CString(_T("舒张压下限")));
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_result(a_cs);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_pos(rect.left, rect.top);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.DoModal();
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.get_result(a_cs);
		a_cs = input_DBPAlmL_check(a_cs);
		theApp.m_Data->m_i32ParaBPDBP_ALM_L = _ttoi(a_cs);
		theApp.m_Data->m_CParameterSet.set_BPDBPAlmL(_ttoi(a_cs));
		m_CEditDBPL.SetWindowTextW(a_cs);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_BPValueNormal->set_alm_L(theApp.m_Data->m_i32ParaBPSBP_ALM_L, theApp.m_Data->m_i32ParaBPDBP_ALM_L, 0);
		
		return TRUE;
	}
	else if (WM_LBUTTONDOWN == pMsg->message&& m_CEditRRH.GetSafeHwnd() == pMsg->hwnd)
	{
		m_CEditRRH.GetWindowTextW(a_cs);
		m_CEditRRH.GetWindowRect(&rect);       //获得文本框矩形,左上角坐标(0,0)   
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_type(NUM_INPUT_NO_DOT | NUM_INPUT_NO_SYMBOL);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_title(CString(_T("血氧饱和度上限")));
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_result(a_cs);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_pos(rect.left, rect.top);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.DoModal();
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.get_result(a_cs);
		a_cs = input_RRAlmH_check(a_cs);
		theApp.m_Data->m_i32ParaRespRR_ALM_H = _ttoi(a_cs);
		theApp.m_Data->m_CParameterSet.set_RespRRAlmH(_ttoi(a_cs));
		m_CEditRRH.SetWindowTextW(a_cs);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_RespValueNormal->set_resp_alm_H(theApp.m_Data->m_i32ParaRespRR_ALM_H, 0);
		
		return TRUE;
	}
	else if (WM_LBUTTONDOWN == pMsg->message&& m_CEditRRL.GetSafeHwnd() == pMsg->hwnd)
	{
		m_CEditRRL.GetWindowTextW(a_cs);
		m_CEditRRL.GetWindowRect(&rect);       //获得文本框矩形,左上角坐标(0,0)   
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_type(NUM_INPUT_NO_DOT | NUM_INPUT_NO_SYMBOL);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_title(CString(_T("血氧饱和度下限")));
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_result(a_cs);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_pos(rect.left, rect.top);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.DoModal();
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.get_result(a_cs);
		a_cs = input_RRAlmL_check(a_cs);
		theApp.m_Data->m_i32ParaRespRR_ALM_L = _ttoi(a_cs);
		theApp.m_Data->m_CParameterSet.set_RespRRAlmL(_ttoi(a_cs));
		m_CEditRRL.SetWindowTextW(a_cs);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_RespValueNormal->set_resp_alm_L(theApp.m_Data->m_i32ParaRespRR_ALM_L, 0);
		
		return TRUE;
	}
	else if (WM_LBUTTONDOWN == pMsg->message&& m_CEditSpo2H.GetSafeHwnd() == pMsg->hwnd)
	{
		//输入血氧饱和度的上限
		m_CEditSpo2H.GetWindowTextW(a_cs);
		m_CEditSpo2H.GetWindowRect(&rect);       //获得文本框矩形,左上角坐标(0,0)   
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_type(NUM_INPUT_NO_DOT | NUM_INPUT_NO_SYMBOL);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_title(CString(_T("血氧饱和度上限")));
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_result(a_cs);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_pos(rect.left, rect.top);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.DoModal();
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.get_result(a_cs);
		a_cs = input_OxyAlmH_check(a_cs);
		theApp.m_Data->m_i32ParaOxyOXY_ALM_H = _ttoi(a_cs);
		theApp.m_Data->m_CParameterSet.set_OxyAlmH(_ttoi(a_cs));
		m_CEditSpo2H.SetWindowTextW(a_cs);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_SPO2ValueNormal->set_spo2_alm_H(theApp.m_Data->m_i32ParaOxyOXY_ALM_H, 0);
		
		return TRUE;
	}
	else if (WM_LBUTTONDOWN == pMsg->message&& m_CEditSpo2L.GetSafeHwnd() == pMsg->hwnd)
	{
		//输入血氧饱和度的下限
		m_CEditSpo2L.GetWindowTextW(a_cs);
		m_CEditSpo2L.GetWindowRect(&rect);       //获得文本框矩形,左上角坐标(0,0)   
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_type(NUM_INPUT_NO_DOT | NUM_INPUT_NO_SYMBOL);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_title(CString(_T("血氧饱和度下限")));
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_result(a_cs);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_pos(rect.left, rect.top);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.DoModal();
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.get_result(a_cs);
		a_cs = input_OxyAlmL_check(a_cs);
		theApp.m_Data->m_i32ParaOxyOXY_ALM_L = _ttoi(a_cs);
		theApp.m_Data->m_CParameterSet.set_OxyAlmL(_ttoi(a_cs));
		m_CEditSpo2L.SetWindowTextW(a_cs);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_SPO2ValueNormal->set_spo2_alm_L(theApp.m_Data->m_i32ParaOxyOXY_ALM_L, 0);
		
		return TRUE;
	}
	else if (WM_LBUTTONDOWN == pMsg->message&& m_CEditPRH.GetSafeHwnd() == pMsg->hwnd)
	{
		m_CEditPRH.GetWindowTextW(a_cs);
		m_CEditPRH.GetWindowRect(&rect);       //获得文本框矩形,左上角坐标(0,0)   
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_type(NUM_INPUT_NO_DOT | NUM_INPUT_NO_SYMBOL);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_title(CString(_T("脉率上限")));
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_result(a_cs);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_pos(rect.left, rect.top);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.DoModal();
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.get_result(a_cs);
		a_cs = input_PRAlmH_check(a_cs);
		theApp.m_Data->m_i32ParaOxyOXY_PR_ALM_H = _ttoi(a_cs);
		theApp.m_Data->m_CParameterSet.set_OxyPRAlmH(_ttoi(a_cs));
		m_CEditPRH.SetWindowTextW(a_cs);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_SPO2ValueNormal->set_PR_alm_H(theApp.m_Data->m_i32ParaOxyOXY_PR_ALM_H, 0);
		
		return TRUE;
	}
	else if (WM_LBUTTONDOWN == pMsg->message&& m_CEditPRL.GetSafeHwnd() == pMsg->hwnd)
	{
		m_CEditPRL.GetWindowTextW(a_cs);
		m_CEditPRL.GetWindowRect(&rect);       //获得文本框矩形,左上角坐标(0,0)   
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_type(NUM_INPUT_NO_DOT | NUM_INPUT_NO_SYMBOL);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_title(CString(_T("脉率下限")));
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_result(a_cs);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_pos(rect.left, rect.top);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.DoModal();
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.get_result(a_cs);
		a_cs = input_PRAlmL_check(a_cs);
		theApp.m_Data->m_i32ParaOxyOXY_PR_ALM_L = _ttoi(a_cs);
		theApp.m_Data->m_CParameterSet.set_OxyPRAlmL(_ttoi(a_cs));
		m_CEditPRL.SetWindowTextW(a_cs);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_SPO2ValueNormal->set_PR_alm_L(theApp.m_Data->m_i32ParaOxyOXY_PR_ALM_L, 0);
		
		return TRUE;
	}
	else if (WM_LBUTTONDOWN == pMsg->message&& m_CEditTempH.GetSafeHwnd() == pMsg->hwnd)
	{
		m_CEditTempH.GetWindowTextW(a_cs);
		m_CEditTempH.GetWindowRect(&rect);       //获得文本框矩形,左上角坐标(0,0)   
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_type(NUM_INPUT_DOT | NUM_INPUT_SYMBOL);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_title(CString(_T("体温上限")));
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_result(a_cs);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_pos(rect.left, rect.top);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.DoModal();
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.get_result(a_cs);
		i = a_cs.Find('.');
		if (i != -1)
		{
			if (i == a_cs.GetLength() - 1)
				a_cs = a_cs.Mid(0, i);
			else
				a_cs = a_cs.Mid(0, i + 2);
		}
		a_cs = input_TempAlmH_check(a_cs);
		f = _ttof(a_cs);
		i = (int)(f*10.0f);
		theApp.m_Data->m_i32ParaTempTEMP_ALM_H = i;
		theApp.m_Data->m_CParameterSet.set_TempAlmH(i);
		m_CEditTempH.SetWindowTextW(a_cs);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_TempValueNormal->set_temp_alm_H(theApp.m_Data->m_i32ParaTempTEMP_ALM_H, 0);
		
		return TRUE;
	}
	else if (WM_LBUTTONDOWN == pMsg->message&& m_CEditTempL.GetSafeHwnd() == pMsg->hwnd)
	{
		m_CEditTempL.GetWindowTextW(a_cs);
		m_CEditTempL.GetWindowRect(&rect);       //获得文本框矩形,左上角坐标(0,0)   
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_type(NUM_INPUT_DOT | NUM_INPUT_SYMBOL);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_title(CString(_T("体温下限")));
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_result(a_cs);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_pos(rect.left, rect.top);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.DoModal();
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.get_result(a_cs);
		//a_cs = input_HRAlmL_check(a_cs);
		i = a_cs.Find('.');
		if (i != -1)
		{
			if (i == a_cs.GetLength() - 1)
				a_cs = a_cs.Mid(0, i);
			else
				a_cs = a_cs.Mid(0, i + 2);
		}
		a_cs = input_TempAlmL_check(a_cs);
		f = _ttof(a_cs);
		i = (int)(f*10.0f);
		theApp.m_Data->m_i32ParaTempTEMP_ALM_L = i;
		theApp.m_Data->m_CParameterSet.set_TempAlmL(i);
		m_CEditTempL.SetWindowTextW(a_cs);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_TempValueNormal->set_temp_alm_L(theApp.m_Data->m_i32ParaTempTEMP_ALM_L, 0);
	
		return TRUE;
	}
	else if (WM_LBUTTONDOWN == pMsg->message&& m_CEditAirOxyH.GetSafeHwnd() == pMsg->hwnd)
	{
		m_CEditAirOxyH.GetWindowTextW(a_cs);
		m_CEditAirOxyH.GetWindowRect(&rect);       //获得文本框矩形,左上角坐标(0,0)   
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_type(NUM_INPUT_NO_DOT | NUM_INPUT_NO_SYMBOL);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_title(CString(_T("血氧饱和度上限")));
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_result(a_cs);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_pos(rect.left, rect.top);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.DoModal();
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.get_result(a_cs);
		a_cs = input_AirOxy_AlmH_check(a_cs);
		theApp.m_Data->m_i32ParaAirOxy_ALM_H = _ttoi(a_cs);
		theApp.m_Data->m_CParameterSet.set_AirOxyAlmH(_ttoi(a_cs));
		m_CEditAirOxyH.SetWindowTextW(a_cs);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_FAValueNormal->set_AirOxy_alm_H(theApp.m_Data->m_i32ParaAirOxy_ALM_H, 0);
		
		return TRUE;
	}
	else if (WM_LBUTTONDOWN == pMsg->message&& m_CEditAirOxyL.GetSafeHwnd() == pMsg->hwnd)
	{
		m_CEditAirOxyL.GetWindowTextW(a_cs);
		m_CEditAirOxyL.GetWindowRect(&rect);       //获得文本框矩形,左上角坐标(0,0)   
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_type(NUM_INPUT_NO_DOT | NUM_INPUT_NO_SYMBOL);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_title(CString(_T("血氧饱和度下限")));
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_result(a_cs);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.set_pos(rect.left, rect.top);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.DoModal();
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_CDialogNumInput.get_result(a_cs);
		a_cs = input_AirOxy_AlmL_check(a_cs);
		theApp.m_Data->m_i32ParaAirOxy_ALM_L = _ttoi(a_cs);
		theApp.m_Data->m_CParameterSet.set_AirOxyAlmL(_ttoi(a_cs));
		m_CEditAirOxyL.SetWindowTextW(a_cs);
		((CVerbpoDlg *)theApp.m_pMainWnd)->m_FAValueNormal->set_AirOxy_alm_L(theApp.m_Data->m_i32ParaAirOxy_ALM_L, 0);
		
		return TRUE;
	}
	return CDialogEx::PreTranslateMessage(pMsg);
}

BEGIN_MESSAGE_MAP(CDialogAlmSet, CDialogEx)
	ON_BN_CLICKED(IDOK, &CDialogAlmSet::OnBnClickedOk)
	ON_CBN_SELCHANGE(IDC_COMBO_ALM_SET_ECG_ALM_SW, &CDialogAlmSet::OnCbnSelchangeComboAlmSetEcgAlmSw)
	ON_CBN_SELCHANGE(IDC_COMBO_ALM_SET_ECG_ALM_LEVEL, &CDialogAlmSet::OnCbnSelchangeComboAlmSetEcgAlmLevel)
	ON_CBN_SELCHANGE(IDC_COMBO_ALM_SET_ST_ALM_SW, &CDialogAlmSet::OnCbnSelchangeComboAlmSetStAlmSw)
	ON_CBN_SELCHANGE(IDC_COMBO_ALM_SET_ST_ALM_LEVEL, &CDialogAlmSet::OnCbnSelchangeComboAlmSetStAlmLevel)
	ON_CBN_SELCHANGE(IDC_COMBO_ALM_SET_BP_ALM_SW, &CDialogAlmSet::OnCbnSelchangeComboAlmSetBpAlmSw)
	ON_CBN_SELCHANGE(IDC_COMBO_ALM_SET_BP_ALM_LEVEL, &CDialogAlmSet::OnCbnSelchangeComboAlmSetBpAlmLevel)
	ON_CBN_SELCHANGE(IDC_COMBO_RESP_SET_ALM_SW, &CDialogAlmSet::OnCbnSelchangeComboRespSetAlmSw)
	ON_CBN_SELCHANGE(IDC_COMBO_RESP_SET_ALM_LEVEL, &CDialogAlmSet::OnCbnSelchangeComboRespSetAlmLevel)
	ON_CBN_SELCHANGE(IDC_COMBO_OXY_SET_ALM_SW, &CDialogAlmSet::OnCbnSelchangeComboOxySetAlmSw)
	ON_CBN_SELCHANGE(IDC_COMBO_OXY_SET_ALM_LEVEL, &CDialogAlmSet::OnCbnSelchangeComboOxySetAlmLevel)
	ON_CBN_SELCHANGE(IDC_COMBO_ALM_SET_TEMP_ALM_SW, &CDialogAlmSet::OnCbnSelchangeComboAlmSetTempAlmSw)
	ON_CBN_SELCHANGE(IDC_COMBO_ALM_SET_TEMP_ALM_LEVEL, &CDialogAlmSet::OnCbnSelchangeComboAlmSetTempAlmLevel)
	ON_CBN_SELCHANGE(IDC_COMBO_ALM_SET_AIROXY_ALM_SW, &CDialogAlmSet::OnCbnSelchangeComboAlmSetAiroxyAlmSw)
	ON_CBN_SELCHANGE(IDC_COMBO_ALM_SET_AIROXY_ALM_LEVEL, &CDialogAlmSet::OnCbnSelchangeComboAlmSetAiroxyAlmLevel)
END_MESSAGE_MAP()


// CDialogAlmSet 消息处理程序


void CDialogAlmSet::OnBnClickedOk()
{
	// TODO:  在此添加控件通知处理程序代码
	CDialogEx::OnOK();
}


CString CDialogAlmSet::input_HRAlmH_check(CString & cs)
{
	int a = 0;
	CString a_cs;

	a = _ttoi(cs);

	if (a>CData::m_i16HRAlmHMax)
	{
		a = CData::m_i16HRAlmHMax;
	}
	if (a<CData::m_i16HRAlmHMin)
	{
		a = CData::m_i16HRAlmHMin;
	}

	if (a <= theApp.m_Data->m_i32ParaECGHR_ALM_L)
	{
		a = theApp.m_Data->m_i32ParaECGHR_ALM_L + 3;
	}

	a_cs.Format(_T("%d"), a);

	return a_cs;
}

CString CDialogAlmSet::input_HRAlmL_check(CString & cs)
{
	int a = 0;
	CString a_cs;

	a = _ttoi(cs);

	if (a>CData::m_i16HRAlmLMax)
	{
		a = CData::m_i16HRAlmLMax;
	}
	if (a<CData::m_i16HRAlmLMin)
	{
		a = CData::m_i16HRAlmLMin;
	}

	if (a >= theApp.m_Data->m_i32ParaECGHR_ALM_H)
	{
		a = theApp.m_Data->m_i32ParaECGHR_ALM_H - 3;
	}

	a_cs.Format(_T("%d"), a);

	return a_cs;
}

CString CDialogAlmSet::input_STAlmH_check(CString & cs)
{
	int a = 0;
	float f = 0.0f;
	CString a_cs;
	f = _ttof(cs);
	a = (int)(f*100.0f);



	if (a>CData::m_i16STAlmHMax)
	{
		a = CData::m_i16STAlmHMax;
	}
	else if (a<CData::m_i16STAlmHMin)
	{
		a = CData::m_i16STAlmHMin;
	}


	if (a <= theApp.m_Data->m_i32ParaECGST_ALM_L)
	{
		a = theApp.m_Data->m_i32ParaECGST_ALM_L + 10;
	}


	f = a;
	f /= 100.0f;

	a_cs.Format(_T("%2.1f"), f);
	return a_cs;
}

CString CDialogAlmSet::input_STAlmL_check(CString & cs)
{
	int a = 0;
	float f = 0.0f;
	CString a_cs;
	f = _ttof(cs);
	a = (int)(f*100.0f);

	if (a>CData::m_i16STAlmLMax)
	{
		a = CData::m_i16STAlmLMax;
	}
	else if (a < CData::m_i16STAlmLMin)
	{
		a = CData::m_i16STAlmLMin;
	}


	if (a >= theApp.m_Data->m_i32ParaECGST_ALM_H)
	{
		a = theApp.m_Data->m_i32ParaECGST_ALM_H - 10;
	}


	f = a;
	f /= 100.0f;

	a_cs.Format(_T("%2.1f"), f);
	return a_cs;
}

CString CDialogAlmSet::input_PVCsAlmH_check(CString & cs)
{
	int a = 0;
	CString a_cs;

	a = _ttoi(cs);

	if (a > ECG_PVCS_ALM_H_MAX)
	{
		a = ECG_PVCS_ALM_H_MAX;
	}
	a_cs.Format(_T("%d"), a);

	return a_cs;
}


CString CDialogAlmSet::input_SBPAlmH_check(CString & cs)
{
	int a = 0;
	CString a_cs;
	a = _ttoi(cs);

	if (a>CData::m_i16SBPAlmHMax)
	{
		a = CData::m_i16SBPAlmHMax;
	}
	if (a<CData::m_i16SBPAlmHMin)
	{
		a = CData::m_i16SBPAlmHMin;
	}

	if (a <= theApp.m_Data->m_i32ParaBPSBP_ALM_L)
	{
		a = theApp.m_Data->m_i32ParaBPSBP_ALM_L + 3;
	}
	if (a <= theApp.m_Data->m_i32ParaBPDBP_ALM_H)
	{
		a = theApp.m_Data->m_i32ParaBPDBP_ALM_H + 3;
	}

	a_cs.Format(_T("%d"), a);

	return a_cs;
}

CString CDialogAlmSet::input_SBPAlmL_check(CString & cs)
{
	int a = 0;
	CString a_cs;
	a = _ttoi(cs);

	if (a>CData::m_i16SBPAlmLMax)
	{
		a = CData::m_i16SBPAlmLMax;
	}
	if (a<CData::m_i16SBPAlmLMin)
	{
		a = CData::m_i16SBPAlmLMin;
	}

	if (a <= theApp.m_Data->m_i32ParaBPDBP_ALM_H)
	{
		a = theApp.m_Data->m_i32ParaBPDBP_ALM_H + 3;
	}

	if (a >= theApp.m_Data->m_i32ParaBPSBP_ALM_H)
	{
		a = theApp.m_Data->m_i32ParaBPSBP_ALM_H - 3;
	}

	a_cs.Format(_T("%d"), a);

	return a_cs;
}

CString CDialogAlmSet::input_DBPAlmH_check(CString & cs)
{
	int a = 0;
	CString a_cs;

	a = _ttoi(cs);

	if (a>CData::m_i16DBPAlmHMax)
	{
		a = CData::m_i16DBPAlmHMax;
	}
	if (a<CData::m_i16DBPAlmHMin)
	{
		a = CData::m_i16DBPAlmHMin;
	}

	if (a <= theApp.m_Data->m_i32ParaBPDBP_ALM_L)
	{
		a = theApp.m_Data->m_i32ParaBPDBP_ALM_L + 3;
	}
	if (a >= theApp.m_Data->m_i32ParaBPSBP_ALM_L)
	{
		a = theApp.m_Data->m_i32ParaBPSBP_ALM_L - 3;
	}

	a_cs.Format(_T("%d"), a);

	return a_cs;
}

CString CDialogAlmSet::input_DBPAlmL_check(CString & cs)
{
	int a = 0;
	CString a_cs;

	a = _ttoi(cs);

	if (a>CData::m_i16DBPAlmLMax)
	{
		a = CData::m_i16DBPAlmLMax;
	}
	if (a<CData::m_i16DBPAlmLMin)
	{
		a = CData::m_i16DBPAlmLMin;
	}

	if (a >= theApp.m_Data->m_i32ParaBPSBP_ALM_L)
	{
		a = theApp.m_Data->m_i32ParaBPSBP_ALM_L - 3;
	}

	if (a >= theApp.m_Data->m_i32ParaBPDBP_ALM_H)
	{
		a = theApp.m_Data->m_i32ParaBPDBP_ALM_H - 3;
	}


	a_cs.Format(_T("%d"), a);


	return a_cs;
}


CString CDialogAlmSet::input_RRAlmH_check(CString & cs)
{
	int a = 0;
	CString a_cs;

	a = _ttoi(cs);

	if (a>CData::m_i16RRAlmHMax)
	{
		a = CData::m_i16RRAlmHMax;
	}
	if (a<CData::m_i16RRAlmHMin)
	{
		a = CData::m_i16RRAlmHMin;
	}
	if (a <= theApp.m_Data->m_i32ParaRespRR_ALM_L)
	{
		a = theApp.m_Data->m_i32ParaRespRR_ALM_L + 3;
	}

	a_cs.Format(_T("%d"), a);

	return a_cs;
}

CString CDialogAlmSet::input_RRAlmL_check(CString & cs)
{
	int a = 0;
	CString a_cs;

	a = _ttoi(cs);

	if (a<CData::m_i16RRAlmLMin)
	{
		a = CData::m_i16RRAlmLMin;
	}
	if (a > CData::m_i16RRAlmLMax)
	{
		a = CData::m_i16RRAlmLMax;
	}

	if (a >= theApp.m_Data->m_i32ParaRespRR_ALM_H)
	{
		a = theApp.m_Data->m_i32ParaRespRR_ALM_H - 3;
	}

	a_cs.Format(_T("%d"), a);

	return a_cs;
}


CString CDialogAlmSet::input_OxyAlmH_check(CString & cs)
{
	int a = 0;
	CString a_cs;

	a = _ttoi(cs);

	if (a>CData::m_i16Spo2AlmHMax)
	{
		a = CData::m_i16Spo2AlmHMax;
	}
	if (a<CData::m_i16Spo2AlmHMin)
	{
		a = CData::m_i16Spo2AlmHMin;
	}

	if (a <= theApp.m_Data->m_i32ParaOxyOXY_ALM_L)
	{
		a = theApp.m_Data->m_i32ParaOxyOXY_ALM_L + 3;
	}

	a_cs.Format(_T("%d"), a);

	return a_cs;
}

CString CDialogAlmSet::input_OxyAlmL_check(CString & cs)
{
	int a = 0;
	CString a_cs;

	a = _ttoi(cs);

	if (a>CData::m_i16Spo2AlmLMax)
	{
		a = CData::m_i16Spo2AlmLMax;
	}
	if (a<CData::m_i16Spo2AlmLMin)
	{
		a = CData::m_i16Spo2AlmLMin;
	}

	if (a >= theApp.m_Data->m_i32ParaOxyOXY_ALM_H)
	{
		a = theApp.m_Data->m_i32ParaOxyOXY_ALM_H - 3;
	}

	a_cs.Format(_T("%d"), a);

	return a_cs;
}

CString CDialogAlmSet::input_PRAlmH_check(CString & cs)
{
	int a = 0;
	CString a_cs;

	a = _ttoi(cs);

	if (a>CData::m_i16PRAlmHMax)
	{
		a = CData::m_i16PRAlmHMax;
	}
	if (a<CData::m_i16PRAlmHMin)
	{
		a = CData::m_i16PRAlmHMin;
	}

	if (a <= theApp.m_Data->m_i32ParaOxyOXY_PR_ALM_L)
	{
		a = theApp.m_Data->m_i32ParaOxyOXY_PR_ALM_L + 3;
	}

	a_cs.Format(_T("%d"), a);

	return a_cs;
}

CString CDialogAlmSet::input_PRAlmL_check(CString & cs)
{
	int a = 0;
	CString a_cs;

	a = _ttoi(cs);

	if (a>CData::m_i16PRAlmLMax)
	{
		a = CData::m_i16PRAlmLMax;
	}
	if (a<CData::m_i16PRAlmLMin)
	{
		a = CData::m_i16PRAlmLMin;
	}

	if (a >= theApp.m_Data->m_i32ParaOxyOXY_PR_ALM_H)
	{
		a = theApp.m_Data->m_i32ParaOxyOXY_PR_ALM_H - 1;
	}

	a_cs.Format(_T("%d"), a);

	return a_cs;
}


CString CDialogAlmSet::input_TempAlmH_check(CString & cs)
{
	int a = 0;
	float f = 0.0f;
	CString a_cs;

	f = _ttof(cs);
	a = (int)(f*10.0f);

	if (a>CData::m_i16TempAlmHMax)
	{
		a = CData::m_i16TempAlmHMax;
	}
	if (a<CData::m_i16TempAlmHMin)
	{
		a = CData::m_i16TempAlmHMin;
	}

	if (a <= theApp.m_Data->m_i32ParaTempTEMP_ALM_L)
	{
		a = theApp.m_Data->m_i32ParaTempTEMP_ALM_L + 5;
	}

	f = a;
	f /= 10.0f;

	a_cs.Format(_T("%2.1f"), f);

	return a_cs;
}

CString CDialogAlmSet::input_TempAlmL_check(CString & cs)
{
	int a = 0;
	float f = 0.0f;
	CString a_cs;

	f = _ttof(cs);
	a = (int)(f*10.0f);

	if (a < CData::m_i16TempAlmLMin)
	{
		a = CData::m_i16TempAlmLMin;
	}
	if (a > CData::m_i16TempAlmLMax)
	{
		a = CData::m_i16TempAlmLMax;
	}

	if (a >= theApp.m_Data->m_i32ParaTempTEMP_ALM_H)
	{
		a = theApp.m_Data->m_i32ParaTempTEMP_ALM_H - 5;
	}

	f = a;
	f /= 10.0f;

	a_cs.Format(_T("%2.1f"), f);

	return a_cs;
}


CString CDialogAlmSet::input_AirOxy_AlmH_check(CString & cs)
{
	int a = 0;
	CString a_cs;

	a = _ttoi(cs);

	if (a > CData::m_i16AirOxyAlmHMax)
	{
		a = CData::m_i16AirOxyAlmHMax;
	}
	if (a<CData::m_i16AirOxyAlmHMin)
	{
		a = CData::m_i16AirOxyAlmHMin;
	}
	if (a <= theApp.m_Data->m_i32ParaAirOxy_ALM_L)
	{
		a = theApp.m_Data->m_i32ParaAirOxy_ALM_L + 1;
	}

	a_cs.Format(_T("%d"), a);

	return a_cs;
}

CString CDialogAlmSet::input_AirOxy_AlmL_check(CString & cs)
{
	int a = 0;
	CString a_cs;

	a = _ttoi(cs);

	if (a > CData::m_i16AirOxyAlmLMax)
	{
		a = CData::m_i16AirOxyAlmLMax;
	}
	if (a<CData::m_i16AirOxyAlmLMin)
	{
		a = CData::m_i16AirOxyAlmLMin;
	}

	if (a >= theApp.m_Data->m_i32ParaAirOxy_ALM_H)
	{
		a = theApp.m_Data->m_i32ParaAirOxy_ALM_H - 1;
	}

	a_cs.Format(_T("%d"), a);

	return a_cs;
}


void CDialogAlmSet::OnCbnSelchangeComboAlmSetEcgAlmSw()
{
	// TODO:  在此添加控件通知处理程序代码
	theApp.m_Data->m_i32ParaECGALM_SW = m_CComboBoxHRAlmSw.GetCurSel();
	theApp.m_Data->m_CParameterSet.set_ECGAlmSw(theApp.m_Data->m_i32ParaECGALM_SW);

	if (theApp.m_Data->m_i32ParaECGALM_SW == 0)
	{
		//报警 从 开 到 关
		theApp.m_Data->Del_ECG_Alm_ALL(ALM_TYPE_ECG, DEL_ALL);
	}
	else
	{
	}
}


void CDialogAlmSet::OnCbnSelchangeComboAlmSetEcgAlmLevel()
{
	// TODO:  在此添加控件通知处理程序代码
	theApp.m_Data->m_i32ParaECGALM_LEVEL = m_CComboBoxHRAlmLevel.GetCurSel();
	theApp.m_Data->m_CParameterSet.set_ECGAlmLevel(theApp.m_Data->m_i32ParaECGALM_LEVEL);
}


void CDialogAlmSet::OnCbnSelchangeComboAlmSetStAlmSw()
{
	// TODO:  在此添加控件通知处理程序代码
	theApp.m_Data->m_i32ParaECGST_ALM_SW = m_CComboBoxSTAlmSw.GetCurSel();
	theApp.m_Data->m_CParameterSet.set_ECGSTAlmSw(theApp.m_Data->m_i32ParaECGST_ALM_SW);

	if (theApp.m_Data->m_i32ParaECGST_ALM_SW == 0)
	{
		//报警 从 开 到 关
		theApp.m_Data->Del_ECG_Alm_ALL(ALM_TYPE_ST, DEL_ALL);
	}
	else
	{
	}
}


void CDialogAlmSet::OnCbnSelchangeComboAlmSetStAlmLevel()
{
	// TODO:  在此添加控件通知处理程序代码
	theApp.m_Data->m_i32ParaECGST_ALM_LEVEL = m_CComboBoxSTAlmLevel.GetCurSel();
	theApp.m_Data->m_CParameterSet.set_ECGAlmLevel(theApp.m_Data->m_i32ParaECGST_ALM_LEVEL);
}


void CDialogAlmSet::OnCbnSelchangeComboAlmSetBpAlmSw()
{
	// TODO:  在此添加控件通知处理程序代码
	theApp.m_Data->m_i32ParaBPALM_SW = m_CComboBoxBPAlmSw.GetCurSel();
	theApp.m_Data->m_CParameterSet.set_BPAlmSw(theApp.m_Data->m_i32ParaBPALM_SW);

	if (theApp.m_Data->m_i32ParaBPALM_SW == 0)
	{
		//报警 从 开 到 关
		theApp.m_Data->Del_Oxy_NIBP_Alm_ALL(ALM_TYPE_NIBP, DEL_ALL);
	}
	else
	{
	}
}


void CDialogAlmSet::OnCbnSelchangeComboAlmSetBpAlmLevel()
{
	// TODO:  在此添加控件通知处理程序代码
	theApp.m_Data->m_i32ParaBPALM_LEVEL = m_CComboBoxBPAlmLevel.GetCurSel();
	theApp.m_Data->m_CParameterSet.set_BPAlmLevel(theApp.m_Data->m_i32ParaBPALM_LEVEL);
}


void CDialogAlmSet::OnCbnSelchangeComboRespSetAlmSw()
{
	// TODO:  在此添加控件通知处理程序代码
	theApp.m_Data->m_i32ParaRespALM_SW = m_CComboBoxRespAlmSw.GetCurSel();
	theApp.m_Data->m_CParameterSet.set_RespAlmSw(theApp.m_Data->m_i32ParaRespALM_SW);
	if (theApp.m_Data->m_i32ParaRespALM_SW == 0)
	{
		//报警 从 开 到 关
		theApp.m_Data->Del_Resp_Temp_Alm_ALL(ALM_TYPE_RESP, DEL_ALL);
	}
	else
	{
	}
}


void CDialogAlmSet::OnCbnSelchangeComboRespSetAlmLevel()
{
	// TODO:  在此添加控件通知处理程序代码
	theApp.m_Data->m_i32ParaRespALM_LEVEL = m_CComboBoxRespAlmLevel.GetCurSel();
	theApp.m_Data->m_CParameterSet.set_RespAlmLevel(theApp.m_Data->m_i32ParaRespALM_LEVEL);
}


void CDialogAlmSet::OnCbnSelchangeComboOxySetAlmSw()
{
	// TODO:  在此添加控件通知处理程序代码
	theApp.m_Data->m_i32ParaOxyALM_SW = m_CComboBoxSpo2AlmSw.GetCurSel();
	theApp.m_Data->m_CParameterSet.set_OxyAlmSw(theApp.m_Data->m_i32ParaOxyALM_SW);

	if (theApp.m_Data->m_i32ParaOxyALM_SW == 0)
	{
		//报警 从 开 到 关
		theApp.m_Data->Del_Oxy_NIBP_Alm_ALL(ALM_TYPE_OXY, DEL_ALL);
	}
	else
	{
	}
}


void CDialogAlmSet::OnCbnSelchangeComboOxySetAlmLevel()
{
	// TODO:  在此添加控件通知处理程序代码
	theApp.m_Data->m_i32ParaOxyALM_LEVEL = m_CComboBoxSpo2AlmLevel.GetCurSel();
	theApp.m_Data->m_CParameterSet.set_OxyAlmLevel(theApp.m_Data->m_i32ParaOxyALM_LEVEL);
}


void CDialogAlmSet::OnCbnSelchangeComboAlmSetTempAlmSw()
{
	// TODO:  在此添加控件通知处理程序代码
	theApp.m_Data->m_i32ParaTempALM_SW = m_CComboBoxTempAlmSw.GetCurSel();
	theApp.m_Data->m_CParameterSet.set_TempAlmSw(theApp.m_Data->m_i32ParaTempALM_SW);

	if (theApp.m_Data->m_i32ParaTempALM_SW == 0)
	{
		//报警 从 开 到 关
		theApp.m_Data->Del_Resp_Temp_Alm_ALL(ALM_TYPE_TEMP, DEL_ALL);
	}
	else
	{
	}
}


void CDialogAlmSet::OnCbnSelchangeComboAlmSetTempAlmLevel()
{
	// TODO:  在此添加控件通知处理程序代码
	theApp.m_Data->m_i32ParaTempALM_LEVEL = m_CComboBoxTempAlmLevel.GetCurSel();
	theApp.m_Data->m_CParameterSet.set_TempAlmLevel(theApp.m_Data->m_i32ParaTempALM_LEVEL);
}


void CDialogAlmSet::OnCbnSelchangeComboAlmSetAiroxyAlmSw()
{
	// TODO:  在此添加控件通知处理程序代码
	theApp.m_Data->m_i32ParaAirOxyALM_SW = m_CComboBoxAirOxyAlmSw.GetCurSel();
	theApp.m_Data->m_CParameterSet.set_AirOxyAlmSw(theApp.m_Data->m_i32ParaAirOxyALM_SW);

	if (theApp.m_Data->m_i32ParaAirOxyALM_SW == 0)
	{
		//报警 从 开 到 关
		theApp.m_Data->Del_AirOxy_Alm_ALL(ALM_TYPE_AIROXY, DEL_ALL);
	}
	else
	{
	}
}


void CDialogAlmSet::OnCbnSelchangeComboAlmSetAiroxyAlmLevel()
{
	// TODO:  在此添加控件通知处理程序代码
	theApp.m_Data->m_i32ParaAirOxyALM_LEVEL = m_CComboBoxAirOxyAlmLevel.GetCurSel();
	theApp.m_Data->m_CParameterSet.set_AirOxyAlmLevel(theApp.m_Data->m_i32ParaAirOxyALM_LEVEL);
}
