#pragma once
#include <list>
using namespace std;
#include "ECGFile.h"
#include "includes.h"
#include "ParameterSet.h"
#include "Patient.h"


#define SHOW_BUFF_LENGTH		(1024*48)
#define CAPTURE_BUFF_LENGTH		(250*10)

#define ECG_LEAD_OFF_V			(1<<3)
#define ECG_LEAD_OFF_RA			(1<<2)
#define ECG_LEAD_OFF_LA			(1<<1)
#define ECG_LEAD_OFF_LL			(1<<0)

#define	STATUS_SLAVER_ERR		1
#define	STATUS_TIME_DELAY		2

enum _ALM_ECG_TYPE_
{
	ALM_ECG_HR_L=1,
	ALM_ECG_HR_H,
	//LL导联脱落
	ALM_ECG_LL_LEAD_OFF,
	//LA导联脱落
	ALM_ECG_LA_LEAD_OFF,
	//RA导联脱落
	ALM_ECG_RA_LEAD_OFF,
	//V导联脱落
	ALM_ECG_V_LEAD_OFF,
	//导联脱落
	ALM_ECG_OFF,
};

enum _ALM_ST_TYPE_
{
	ALM_ECG_ST1_L=1,
	ALM_ECG_ST1_H,
	ALM_ECG_ST2_L,
	ALM_ECG_ST2_H,
};


enum _ALM_ARRA_TYPE_
{
	ALM_ECG_BIGEMINY=1,
	ALM_ECG_TRIGEMINY,
	//过缓
	ALM_ECG_SLOW,
	//过速
	ALM_ECG_FAST,
	//室早
	ALM_ECG_RONT,
	//室速
	ALM_ECG_RVONT,
	//室早成对
	ALM_ECG_PAIR,
	//停搏
	ALM_ECG_ASYSTOLE,
};

enum _ALM_RESP_TYPE_
{
	ALM_RESP_RR_L = 1,
	ALM_RESP_RR_H,
	ALM_RESP_APNEA,
};


enum _ALM_OXY_TYPE_
{
	ALM_OXY_OXY_L = 1,
	ALM_OXY_OXY_H,
	ALM_OXY_PR_L ,
	ALM_OXY_PR_H,
	ALM_OXY_FINGER,
	ALM_OXY_PROBE,
};

enum _ALM_TEMP_TYPE_
{
	ALM_TEMP_L = 1,
	ALM_TEMP_H,
	ALM_TEMP_PROBE,
};

enum _ALM_NIBP_TYPE_
{
	ALM_NIBP_SBP_L = 1,
	ALM_NIBP_SBP_H,
	ALM_NIBP_DBP_L ,
	ALM_NIBP_DBP_H,
	
};

enum _ALM_AIROXY_TYPE_
{
	ALM_AIROXY_OXY_L = 1,
	ALM_AIROXY_OXY_H,
	ALM_AIROXY_OXY_PROBE,
};

enum _ALM_TYPE_
{
	ALM_TYPE_ECG=1,
	ALM_TYPE_RESP,
	ALM_TYPE_OXY,
	ALM_TYPE_TEMP,
	ALM_TYPE_NIBP,
	ALM_TYPE_AIROXY,
	ALM_TYPE_ST,
	ALM_TYPE_ARRA,
};

enum _ALM_DEL_TYPE_
{
	DEL_ALL = 1,
	DEL_NOT_TRIGGER,
};


struct SHOW_ALM
{
	//报警类型 心电 呼吸 
	UINT8 u8Type;
	//报警子类型
	UINT8	u8SubType;
	//报警级别
	UINT8 u8Level;
	//是否触发，栓锁使用
	UINT8 u8Trigger;
	//是否显示时间
	UINT8 u8ShowTime;
	//报警信息
	TCHAR cAlm[16];
	//报警发送的时间
	TCHAR	cTime[20];
	//报警阈值
	INT16	i16AlmThrd;
	//触发报警的测量值
	INT16	i16Result;
};




struct ALM_SAVE_DATA_PTR
{
	struct ALM_SAVE_HEAD *pHead;
	struct ALM_SAVE_DATA *pData;
};


struct ALM_SEARCH_PARA
{
	TCHAR	cTimeFirst[20];
	TCHAR	cTimeLast[20];
	UINT8 u8SearchType;
	//报警类型
	UINT8 u8AlmType;
	INT16 i16Step;
	INT16 i16Threshold;
	INT16 i16Result;
};



struct ECG_PATTERN
{
	UINT8 num;
	UINT8 data[5];
};




struct SAVE_DATA_PARA
{
	INT16 i16HR;
	INT16 i16ST1;
	INT16 i16ST2;
	INT16 i16PVCs;
	INT16 i16RR;
	INT16 i16Spo2;
	INT16 i16PR;
	INT16 i16SBP;
	INT16 i16DBP;
	INT16 i16MBP;
	INT16 i16Temp;
	INT8 i8AirOxy;
	//INT16  i16ECGType[2];
	TCHAR	cTime[20];
	TCHAR	cName[9];
};


struct SAVE_DATA
{
	struct SAVE_DATA_PARA stPara;
	CWnd *wnd;
	INT i32dir;
	INT i32time;
	INT i32Flag;
	UINT16 *pECGData[3];
	UINT8 *pRespData;
	UINT8 *pPlethData;
};


struct NIBP_DATA
{
	INT16 i16SBP;
	INT16 i16DBP;
	INT16 i16MBP;
	INT16 i16PR;
	TCHAR	cTime[20];
	TCHAR	cName[9];
};


struct SYS_DATA
{
	TCHAR	cInfo[20];
	TCHAR	cTime[20];
};



struct SAVE_ALM_FILE_INFO
{
	TCHAR cTime[20];
	UINT8 u8Flag;
	UINT8 u8Type;
	UINT8 u8SubType;
	UINT16 u16FileW;
	INT16 i16Threshold;
	INT16 i16Result;
};

struct SAVE_ALM
{
	struct SAVE_ALM_FILE_INFO stInfo;
	struct SAVE_DATA_PARA stPara;
	CWnd *wnd;
	INT i32dir;
	INT i32time;
	INT i32Flag;
	UINT16 *pECGData[3];
	UINT8 *pRespData;
	UINT8 *pPlethData;
};


struct SAVE_RESULT_PARA
{	
	INT16 i16TimeType;
	INT16 i16HR;
	INT16 i16ST1;
	INT16 i16ST2;
	INT16 i16PVCs;
	INT16 i16RR;
	INT16 i16Spo2;
	INT16 i16PR;
	INT16 i16Temp;
	INT8 i8AirOxy;
	TCHAR	cTime[20];
};

struct SELECT_RESULT_PARA
{
	UINT8 u8Type;
	UINT16 u16Step;
	UINT u32Length;
	CWnd *wnd;
	TCHAR	cTime[20];

};

class CData
{
private:

	//检查设置参数 是否正确，如果错误，更改
	INT Check_Set_Para();
	//检查心电设置参数 是否正确，如果错误，更改
	INT Check_ECG_Set_Para();
	//检查呼吸设置参数 是否正确，如果错误，更改
	INT Check_Resp_Set_Para();
	//检查血氧设置参数 是否正确，如果错误，更改
	INT Check_Spo2_Set_Para();
	//检查体温设置参数 是否正确，如果错误，更改
	INT Check_Temp_Set_Para();
	//检查血压设置参数 是否正确，如果错误，更改
	INT Check_NIBP_Set_Para();
	//检查空氧设置参数 是否正确，如果错误，更改
	INT Check_AirOxy_Set_Para();
	//检查系统设置参数 是否正确，如果错误，更改
	INT Check_Sys_Set_Para();

	int Get_ECG_Alm_Next(struct SHOW_ALM *alm);
	int Del_ECG_Alm(INT num);
	int Del_ECG_Alm(INT	i32Type, INT	i32SubType);

	int Get_Resp_Temp_Alm_Next(struct SHOW_ALM *alm);
	int Del_Resp_Temp_Alm(INT num);
	int Del_Resp_Temp_Alm(INT	i32Type, INT	i32SubType);


	int Get_Oxy_NIBP_Alm_Next(struct SHOW_ALM *alm);
	int Del_Oxy_NIBP_Alm(INT num);
	int Del_Oxy_NIBP_Alm(INT	i32Type, INT	i32SubType);


	int Get_AirOxy_Alm_Next(struct SHOW_ALM *alm);
	int Del_AirOxy_Alm(INT num);
	int Del_AirOxy_Alm(INT	i32Type, INT	i32SubType);

	//获得报警类型 0位生物报警 1位技术报警
	INT Get_Alm_Type(struct SHOW_ALM *alm);
	//获得要保存的数据
	INT Get_Alm_Data(struct SAVE_ALM *st);
	CPatient m_CPat;
	CCriticalSection g_CSPat;

public:
	CData();
	~CData();

	void Set_Pat(CPatient & pat);
	void Get_Pat(CPatient & pat);

	INT AddECGWave(UINT16 *data);
	INT GetECGWave(struct ECG_DATA *st);

	INT AddRespWave(UINT8 * data);
	INT GetRespWave(struct RESP_DATA *st);

	INT AddOxyWave(UINT8 *data);
	INT GetOxyWave(struct OXY_DATA *st);


	int AddPrintData(struct GET_ECG_DATA *st);
	INT AddECGWaveSaveData(UINT16 *data);
	INT AddRespWaveSaveData(UINT8 *data);
	INT AddPlethWaveSaveData(UINT8 *data);
	INT SaveData();

	int GetShowData(struct GET_ECG_DATA *st);
	

	int AddData2PrintBuf(struct GET_ECG_DATA *st);

	int GetRespShowData(struct GET_RESP_DATA *st);
	int AddData2RespShowBuf(struct GET_RESP_DATA *st);

	int GetOXYShowData(struct GET_OXY_DATA *st);
	int Add_PlethWave(UINT8 data);

	void copy_print_data(struct GET_ECG_DATA *st, int length);
	int ResetShowBuff();
	int ResetSaveBuff();
	int ResetPrintBuff();

	//心电导联连接和信号信息
	int Add_Lead_STS(UINT8 leadoff,UINT8 overload);
	int Get_Lead_STS(UINT8 *leadoff, UINT8 *overload);
	//心律
	int Add_HR(INT16 hr);
	int Get_HR(INT16 *hr);
	//心律
	int Add_Beat(int b);
	int Get_Beat(int *b);
	//PVCs
	int Add_PVCs(UINT8 pvcs);
	int Get_PVCs(UINT8 *pvcs);
	//PVCs
	int Add_ARRA(UINT8 arra);
	int Get_ARRA(UINT8 *arra);
	//ST值
	int Add_ST(INT16 st1, INT16 st2);
	int Get_ST(INT16 *st1, INT16 *st2);
	//ST 模板波形
	int Add_Pattern(struct ECG_PATTERN *st);
	

	//呼吸率
	int Add_RR(INT16 hr);
	int Add_APNEA(UINT8 apnea);
	//血氧饱和度
	int Add_Spo2(INT16 hr);
	//脉率
	int Add_PR(INT16 pr);
	INT Add_OxyBar(UINT8 data);
	INT Add_OxyAlm(UINT8 data);


	//体温
	int Add_Temp(INT16 t);
	int Add_TempAlm(INT16 t);
	int Get_Temp(INT16 *t);

	//氧浓度
	int Add_AirOxy(INT8 t);
	int Add_AirOxyAlm(INT16 t);
	int Get_AirOxy(INT8 *t);
	int Get_AirOxyAlm(UINT8 *t);

	//将心电报警项，添加到报警队列中
	int Add_ECG_Alm(INT	i32Type, INT	i32SubType, TCHAR * cTime, INT16 i16AlmThrd, INT16	i16Result);
	int Get_ECG_Alm(struct SHOW_ALM *alm, INT num);
	//获得下一个要显示的报警项数据
	//如果报警队列为空，返回1
	int Get_ECG_Alm_Show_Next(struct SHOW_ALM *alm);
	//按照删除报警的要求，删除 心电报警队列 所有报警或者删除未触发的报警
	int Del_ECG_Alm_ALL(INT alm_type, INT del_type);

	//将呼吸、体温报警项，添加到报警队列中
	int Add_Resp_Temp_Alm(INT	i32Type, INT	i32SubType, TCHAR * cTime, INT16 i16AlmThrd, INT16	i16Result);
	int Get_Resp_Temp_Alm(struct SHOW_ALM *alm, INT num);
	//获得呼吸、体温下一个要显示的报警项数据
	//如果报警队列为空，返回1
	int Get_Resp_Temp_Alm_Show_Next(struct SHOW_ALM *alm);
	//按照删除报警的要求，删除 呼吸、体温报警队列 所有报警或者删除未触发的报警
	int Del_Resp_Temp_Alm_ALL(INT alm_type, INT del_type);

	//将血氧、血压报警项，添加到报警队列中
	int Add_Oxy_NIBP_Alm(INT	i32Type, INT	i32SubType, TCHAR * cTime, INT16 i16AlmThrd, INT16	i16Result);
	int Get_Oxy_NIBP_Alm(struct SHOW_ALM *alm, INT num);
	//获得血氧、血压下一个要显示的报警项数据
	//如果报警队列为空，返回1
	int Get_Oxy_NIBP_Alm_Show_Next(struct SHOW_ALM *alm);
	//按照删除报警的要求，删除 血氧、血压报警队列 所有报警或者删除未触发的报警
	int Del_Oxy_NIBP_Alm_ALL(INT alm_type, INT del_type);

	//将氧浓度报警项，添加到报警队列中
	int Add_AirOxy_Alm(INT	i32Type, INT	i32SubType, TCHAR * cTime, INT16 i16AlmThrd, INT16	i16Result);
	int Get_AirOxy_Alm(struct SHOW_ALM *alm, INT num);
	//获得氧浓度下一个要显示的报警项数据
	//如果报警队列为空，返回1
	int Get_AirOxy_Alm_Show_Next(struct SHOW_ALM *alm);
	//按照删除报警的要求，删除 氧浓度报警队列 所有报警或者删除未触发的报警
	int Del_AirOxy_Alm_ALL(INT alm_type, INT del_type);

	void Get_Alm();
	//判断是否有新报警发生，
	INT Get_New_Alm_Trigger();
	//获得心电所有类型 当前是否发生报警
	INT Get_ECG_ALL_Alm_Trigger();
	//获得心电 当前是否发生报警
	INT Get_ECG_Alm_Trigger();
	//获得ST 当前是否发生报警
	INT Get_ST_Alm_Trigger();
	//获得ARRA 当前是否发生报警
	INT Get_ARRA_Alm_Trigger();
	//获得呼吸 当前是否发生报警
	INT Get_Resp_Alm_Trigger();
	//获得血氧 当前是否发生报警
	INT Get_Oxy_Alm_Trigger();
	//获得体温 当前是否发生报警
	INT Get_Temp_Alm_Trigger();
	//获得血压 当前是否发生报警
	INT Get_NIBP_Alm_Trigger();
	//获得空氧 当前是否发生报警
	INT Get_AirOxy_Alm_Trigger();
	


	//获得当前所有报警的最高级别
	INT Get_All_Alm_LevelH();
	//保存报警记录、
	INT Save_Alm();


	

	static INT m_i32SaveDataECGWaveL, m_i32SaveDataRespWaveL, m_i32SaveDataPlethWaveL;
	struct SAVE_DATA m_stSaveData;

	
	//各个检测结果的 无效值 定义
	static INT16 m_i16HRInvalidValue;
	static INT16 m_i16STInvalidValue;
	static INT16 m_i16PVCsInvalidValue;
	static INT16 m_i16RRInvalidValue;
	static INT16 m_i16TempInvalidValue;
	static INT16 m_i16Spo2InvalidValue;
	static INT16 m_i16PRInvalidValue;
	static INT16 m_i16SBPInvalidValue;
	static INT16 m_i16DBPInvalidValue;
	static INT16 m_i16AirOxyInvalidValue;

	//心电、呼吸、血氧波形的颜色定义
	static COLORREF m_rgbECGWave ;
	static COLORREF m_rgbRespWave;
	static COLORREF m_rgbPlethWave;

	//报警开关、级别、记录 常量 定义
	static int m_i32AlmSWOn;
	static int m_i32AlmSWOff;
	static int m_i32AlmLevelH;
	static int m_i32AlmLevelM;
	static int m_i32AlmLevelL;
	static int m_i32AlmRecOn;
	static int m_i32AlmRecOff;

	//心律高 报警 阈值 上下限 的定义
	static INT16 m_i16HRAlmHMin, m_i16HRAlmHMax;
	//心律低 报警 阈值 上下限 的定义
	static INT16 m_i16HRAlmLMin, m_i16HRAlmLMax;
	//心律来源 的定义
	static INT m_i32HRFromECG, m_i32HRFromPR;
	//心律计算导联 的定义
	static INT m_i32ECGHRLeadI, m_i32ECGHRLeadII;
	//心电3、5导联模式 的定义
	static INT m_i32ECGLeadMode5, m_i32ECGLeadMode3;
	//工频陷波 开关 的定义
	static INT m_i32ECGTrapOn, m_i32ECGTrapOff;
	//起搏开关 的定义
	static INT m_i32ECGPaceOn, m_i32ECGPaceOff;
	//心电波走纸速度 的定义
	static INT16 m_i16ECGSpeed25, m_i16ECGSpeed50;
	//心电波增益 的定义
	static INT16 m_i16ECGGain1_2, m_i16ECGGain1_1, m_i16ECGGain2_1;
	//心搏音 的定义
	static INT m_i32BeatVol0, m_i32BeatVol1, m_i32BeatVol2, m_i32BeatVol3;

	//ST功能开关的定义
	static INT m_i32STOn, m_i32STOff;
	//ST位置值  上下限 的定义
	static INT m_i32STMin, m_i32STMax;
	//ISO位置值  上下限 的定义
	static INT m_i32ISOMin, m_i32ISOMax;
	//ST高 报警 阈值 上下限 的定义
	static INT16 m_i16STAlmHMin, m_i16STAlmHMax;
	//ST低 报警 阈值 上下限 的定义
	static INT16 m_i16STAlmLMin, m_i16STAlmLMax;

	//PVCs高 报警 阈值 上下限 的定义
	static INT16 m_i16PVCsAlmHMin, m_i16PVCsAlmHMax;


	//血氧饱和度高 报警 阈值 上下限 的定义
	static INT16 m_i16Spo2AlmHMin, m_i16Spo2AlmHMax;
	//血氧饱和度低 报警 阈值 上下限 的定义
	static INT16 m_i16Spo2AlmLMin, m_i16Spo2AlmLMax;
	//脉率度高 报警 阈值 上下限 的定义
	static INT16 m_i16PRAlmHMin, m_i16PRAlmHMax;
	//脉率低 报警 阈值 上下限 的定义
	static INT16 m_i16PRAlmLMin, m_i16PRAlmLMax;
	//血氧波走纸速度 的定义
	static INT16 m_i16PlethSpeed12, m_i16PlethSpeed25;

	//呼吸率高 报警 阈值 上下限 的定义
	static INT16 m_i16RRAlmHMin, m_i16RRAlmHMax;
	//呼吸率低 报警 阈值 上下限 的定义
	static INT16 m_i16RRAlmLMin, m_i16RRAlmLMax;
	//窒息报警时间 阈值 定义
	static INT16 m_i16APNEATime0Sec, m_i16APNEATime10Sec, m_i16APNEATime20Sec, m_i16APNEATime30Sec;
	//呼吸波走纸速度 的定义
	static INT16 m_i16RespSpeed12, m_i16RespSpeed25;
	//呼吸波增益 的定义
	static INT16 m_i16RespGain1_4, m_i16RespGain1_2, m_i16RespGain1_1, m_i16RespGain2_1, m_i16RespGain4_1;

	//体温高 报警 阈值 上下限 的定义
	static INT16 m_i16TempAlmHMin, m_i16TempAlmHMax;
	//体温低 报警 阈值 上下限 的定义
	static INT16 m_i16TempAlmLMin, m_i16TempAlmLMax;

	//收缩压高 报警 阈值 上下限 的定义
	static INT16 m_i16SBPAlmHMin, m_i16SBPAlmHMax;
	//收缩压低 报警 阈值 上下限 的定义
	static INT16 m_i16SBPAlmLMin, m_i16SBPAlmLMax;

	//舒张压高 报警 阈值 上下限 的定义
	static INT16 m_i16DBPAlmHMin, m_i16DBPAlmHMax;
	//舒张压低 报警 阈值 上下限 的定义
	static INT16 m_i16DBPAlmLMin, m_i16DBPAlmLMax;

	//氧浓度高 报警 阈值 上下限 的定义
	static INT16 m_i16AirOxyAlmHMin, m_i16AirOxyAlmHMax;
	//氧浓度低 报警 阈值 上下限 的定义
	static INT16 m_i16AirOxyAlmLMin, m_i16AirOxyAlmLMax;


	//报警静音时间 的定义
	static INT m_i32AlmTime1, m_i32AlmTime2;
	//报警音 的定义
	static INT m_i32AlmVol1_5, m_i32AlmVol1_2, m_i32AlmVol4_5, m_i32AlmVol1_1;

	//心电 报警 触发 标记
	UINT8 m_u8ECGTrigger[16];
	//ST 报警 触发 标记
	UINT8 m_u8STTrigger[16];
	//心律异常分析 报警 触发 标记
	UINT8 m_u8ARRATrigger[16];
	//呼吸 报警 触发 标记
	UINT8 m_u8RespTrigger[16];
	//血氧 报警 触发 标记
	UINT8 m_u8OxyTrigger[16];
	//体温 报警 触发 标记
	UINT8 m_u8TempTrigger[16];
	//血压 报警 触发 标记
	UINT8 m_u8NIBPTrigger[16];
	//样浓度 报警 触发 标记
	UINT8 m_u8AirOxyTrigger[16];

	//心电 报警 状态 标记
	UINT8 m_u8ECGAlm[16];
	//ST 报警 状态 标记
	UINT8 m_u8STAlm[16];
	//心理异常 报警 状态 标记
	UINT8 m_u8ARRAAlm[16];
	//呼吸 报警 状态 标记
	UINT8 m_u8RespAlm[16];
	//血氧 报警 状态 标记
	UINT8 m_u8OxyAlm[16];
	//体温 报警 状态 标记
	UINT8 m_u8TempAlm[16];
	//血压 报警 状态 标记
	UINT8 m_u8NIBPAlm[16];
	//氧浓度 报警 状态 标记
	UINT8 m_u8AirOxyAlm[16];

	//心电报警 队列
	list<struct SHOW_ALM> m_ECGAlm;
	INT m_i32ECGAlmShowIndex;
	//呼吸、体温报警 队列
	list<struct SHOW_ALM> m_RespTempAlm;
	INT m_i32RespTempAlmShowIndex;
	//血氧、血压报警 队列
	list<struct SHOW_ALM> m_OxyNIBPAlm;
	INT m_i32OxyNIBPAlmShowIndex;
	//氧浓度报警 队列
	list<struct SHOW_ALM> m_AirOxyAlm;
	INT m_i32AirOxyAlmShowIndex;

	




	CParameterSet m_CParameterSet;
	//心律报警 开关
	int m_i32ParaECGALM_SW;
	//心律报警 级别
	int m_i32ParaECGALM_LEVEL;
	//心律报警记录 开关
	int m_i32ParaECGALM_REC;
	//心律来源
	int m_i32ParaECGHR_FORM;
	//心律计算导联
	int m_i32ParaECGHR_LEAD;
	//导联模式
	int m_i32ParaECGLEAD_MODE;
	//心律过高报警 高限
	int m_i32ParaECGHR_ALM_H;
	//心律过低报警 低限
	int m_i32ParaECGHR_ALM_L;
	//心电波陷波器 开关
	int m_i32ParaECGECG_TRAP;
	//起搏检检测 开关
	int m_i32ParaECGPACE_SW;
	//心电波显示走纸速度
	int m_i32ParaECGWAVE_SPEED;
	//心电波 增益
	int m_i32ParaECGWAVE_GAIN;
	//心电波 滤波模式
	int m_i32ParaECGWAVE_Filter;
	//心搏的音量
	int m_i32ParaECGBEAT_VOL;
	//ST功能 开关
	int m_i32ParaECGST_SW;
	//ST报警 开关
	int m_i32ParaECGST_ALM_SW;
	//ST报警 级别
	int m_i32ParaECGST_ALM_LEVEL;
	//ST报警记录 开关
	int m_i32ParaECGST_ALM_REC;
	//ST过高报警 高限
	int m_i32ParaECGST_ALM_H;
	//ST过低报警 低限
	int m_i32ParaECGST_ALM_L;
	//ISO值
	int m_i32ParaECGISO;
	//ST值
	int m_i32ParaECGST;

	//心理异常分析 开关
	int m_i32ParaECGARRASW;
	//心律异常分析 报警 开关
	int m_i32ParaECGARRA_ALM_SW;
	//心律异常分析报警 级别
	int m_i32ParaECGARRA_ALM_LEVEL;
	//心律异常分析报警记录 开关
	int m_i32ParaECGARRA_ALM_REC;
	//PVCS过高报警 高限
	int m_i32ParaECGARRA_PVCS_ALM_H;

	int m_i32ShowNormalECGChannel1Type, m_i32ShowNormalECGChannel2Type;
	int m_i32ShowNormalECGChannel1TypeLast, m_i32ShowNormalECGChannel2TypeLast;


	//呼吸报警 开关	
	int m_i32ParaRespALM_SW;
	//呼吸报警 级别
	int m_i32ParaRespALM_LEVEL;
	//呼吸报警记录 开关
	int m_i32ParaRespALM_REC;
	//窒息报警 时间	
	int m_i32ParaRespAPNEA_TIME;
	//呼吸率过高报警 高限
	int m_i32ParaRespRR_ALM_H;
	//呼吸率过低报警 低限
	int m_i32ParaRespRR_ALM_L;
	//呼吸波 增益
	int m_i32ParaRespGain;
	//呼吸波 走纸速度
	int m_i32ParaRespSpeed;
	
	//体温报警 开关	
	int m_i32ParaTempALM_SW;
	//体温报警 级别
	int m_i32ParaTempALM_LEVEL;
	//体温报警记录 开关
	int m_i32ParaTempALM_REC;
	//体温过高报警 高限
	int m_i32ParaTempTEMP_ALM_H;
	//体温过低报警 低限
	int m_i32ParaTempTEMP_ALM_L;

	//血氧报警 开关	
	int m_i32ParaOxyALM_SW;
	//血氧报警 级别
	int m_i32ParaOxyALM_LEVEL;
	//血氧报警记录 开关
	int m_i32ParaOxyALM_REC;
	//血氧饱和度过高报警 高限
	int m_i32ParaOxyOXY_ALM_H;
	//血氧饱和度过低报警 低限
	int m_i32ParaOxyOXY_ALM_L;
	//脉率过高报警 高限
	int m_i32ParaOxyOXY_PR_ALM_H;
	//脉率过低报警 低限
	int m_i32ParaOxyOXY_PR_ALM_L;
	//血氧波 走纸速度
	int m_i32PlethSpeed;

	//血压报警 开关	
	int m_i32ParaBPALM_SW;
	//血压报警 级别
	int m_i32ParaBPALM_LEVEL;
	//血压报警记录 开关
	int m_i32ParaBPALM_REC;
	//收缩压过高报警 高限
	int m_i32ParaBPSBP_ALM_H;
	//收缩压过低报警 低限
	int m_i32ParaBPSBP_ALM_L;
	//舒张压过高报警 高限
	int m_i32ParaBPDBP_ALM_H;
	//舒张压过低报警 低限
	int m_i32ParaBPDBP_ALM_L;
	//预充气压力
	int m_i32ParaBPPress;

	//氧浓度报警 开关	
	int m_i32ParaAirOxyALM_SW;
	//氧浓度报警 级别
	int m_i32ParaAirOxyALM_LEVEL;
	//氧浓度报警记录 开关
	int m_i32ParaAirOxyALM_REC;
	//氧浓度过高报警 高限
	int m_i32ParaAirOxy_ALM_H;
	//氧浓度过低报警 低限
	int m_i32ParaAirOxy_ALM_L;

	//报警暂停 时间
	int m_i32ParaAlmTime;
	//报警暂停 音量
	int m_i32ParaAlmVol;

	INT m_i32BeatVol;
	INT m_i32AlmVol;

	//每个通道显示数据

	CCriticalSection g_CSECGData;
	INT16 m_i16HR;
	INT16 m_i16ST1, m_i16ST2;
	int m_i32LeadOff, m_i32LeadOverLoad;
	INT16 m_i16PVCs;
	UINT8 m_u8ARRA;
	int m_i32Beat;
	//每个通道要保存的数据
	UINT16 *m_u16ECGData[7];
	int m_i32ECGDateW, m_i32ECGDateR, m_i32ECGDateLength;
	//每个通道要保存的数据
	UINT16 *m_u16ECGSaveData[7];
	int m_i32ECGSaveDateW, m_i32ECGSaveDateR, m_i32ECGSaveDateLength;
	CCriticalSection g_CSECGDataSave;

	INT16 m_i16RR;
	UINT8 m_u8APNEA;
	UINT8 *m_u8RespData;
	int m_i32RespDateW, m_i32RespDateR, m_i32RespDateLength;
	UINT8 *m_u8RespSaveData;
	int m_i32RespSaveDateW, m_i32RespSaveDateR, m_i32RespSaveDateLength;
	CCriticalSection g_CSRespData;


	INT16 m_i16Spo2;
	INT16 m_i16PR;
	UINT16 u16Finger;
	UINT16 u16Beat;
	UINT16 u16Search;
	UINT16 u16Probe;
	UINT8 u8Bar;
	UINT16 u16Signal;
	UINT8 *m_u8PlethData;
	int m_i32PlethDataW, m_i32PlethDateR, m_i32PlethDateLength;
	UINT8 *m_u8PlethSaveData;
	int m_i32PlethSaveDataW, m_i32PlethSaveDateR, m_i32PlethSaveDateLength;
	CCriticalSection g_CSOxyData;


	INT16 m_i16Temp;
	UINT8 m_u8TempProbe;
	CCriticalSection g_CSTempData;


	INT16 m_i16SBP;
	INT16 m_i16DBP, m_i16MBP;
	CCriticalSection g_CSNIBPData;

	INT8 m_i8AirOxy;
	UINT8 m_u8AirOxySTS;
	CCriticalSection g_CSAirOxyData;

	
	//心电报警
	list<struct ALM_SAVE_DATA_PTR> m_AlmSaveData;
	struct ALM_SAVE_FILE_HEAD *m_pstAlmSaveFileHead1, *m_pstAlmSaveFileHead2;
	//报警的记录的条数的读写长度
	UINT16 m_u16AlmRecL, m_u16AlmRecR, m_u16AlmRecW;
	UINT8 *m_u8pAlmSaveFileHeadBuf1, *m_u8pAlmSaveFileHeadBuf2;
	UINT8 *m_u8pAlmSaveHead;
	UINT8 *m_u8pAlmData;
	CFile m_AlmFile;
	CCriticalSection m_CSAlmRec;

	struct GET_ECG_DATA m_stGET_ECG_DATA;
	
	struct SAVE_ALM m_stSAVE_ALM;

	//每个通道要保存的打印的数据
	int *m_i32PrintData[12];
	int m_i32PrintDateW, m_i32PrintDateR, m_i32PrintDateLength;
	CCriticalSection g_CSECGDataPrint;

	UINT m_u32Status;
	//CCriticalSection g_CSECGDataPrint;
};

