#pragma once
#include "Patient.h"

// CDisplayField


#define IDC_DISPLAY_X			0
#define IDC_DISPLAY_Y			0
#define IDC_DISPLAY_WIDTH		1280
#define IDC_DISPLAY_HEIGHT		60

#define IDC_DISPLAY_ID_X		(IDC_DISPLAY_X+0)
#define IDC_DISPLAY_ID_Y		(IDC_DISPLAY_Y+0)
#define IDC_DISPLAY_ID_WIDTH		100
#define IDC_DISPLAY_ID_HEIGHT		30

#define IDC_DISPLAY_NAME_X		(IDC_DISPLAY_X+0)
#define IDC_DISPLAY_NAME_Y		(IDC_DISPLAY_Y+30)
#define IDC_DISPLAY_NAME_WIDTH		100
#define IDC_DISPLAY_NAME_HEIGHT		30

#define IDC_DISPLAY_SEX_X		(IDC_DISPLAY_X+120)
#define IDC_DISPLAY_SEX_Y		(IDC_DISPLAY_Y+0)
#define IDC_DISPLAY_SEX_WIDTH		30
#define IDC_DISPLAY_SEX_HEIGHT		30

#define IDC_DISPLAY_ECG_ALM_X		(IDC_DISPLAY_SEX_X+IDC_DISPLAY_SEX_WIDTH+40)
#define IDC_DISPLAY_ECG_ALM_Y		(IDC_DISPLAY_Y+0)
#define IDC_DISPLAY_ECG_ALM_WIDTH		280
#define IDC_DISPLAY_ECG_ALM_HEIGHT		30

#define IDC_DISPLAY_RESP_TEMP_ALM_X		(IDC_DISPLAY_ECG_ALM_X+IDC_DISPLAY_ECG_ALM_WIDTH)
#define IDC_DISPLAY_RESP_TEMP_ALM_Y		(IDC_DISPLAY_Y+0)
#define IDC_DISPLAY_RESP_TEMP_ALM_WIDTH		280
#define IDC_DISPLAY_RESP_TEMP_ALM_HEIGHT		30


#define IDC_DISPLAY_OXY_NIBP_ALM_X		(IDC_DISPLAY_SEX_X+IDC_DISPLAY_SEX_WIDTH+40)
#define IDC_DISPLAY_OXY_NIBP_ALM_Y		(IDC_DISPLAY_ECG_ALM_Y+IDC_DISPLAY_ECG_ALM_HEIGHT-1)
#define IDC_DISPLAY_OXY_NIBP_ALM_WIDTH		280
#define IDC_DISPLAY_OXY_NIBP_ALM_HEIGHT		30

#define IDC_DISPLAY_AIROXY_ALM_X		(IDC_DISPLAY_ECG_ALM_X+IDC_DISPLAY_ECG_ALM_WIDTH)
#define IDC_DISPLAY_AIROXY_ALM_Y		(IDC_DISPLAY_ECG_ALM_Y+IDC_DISPLAY_ECG_ALM_HEIGHT-1)
#define IDC_DISPLAY_AIROXY_ALM_WIDTH		280
#define IDC_DISPLAY_AIROXY_ALM_HEIGHT		30

#define IDC_DISPLAY_ALM_TIME_X		(IDC_DISPLAY_AIROXY_ALM_X+IDC_DISPLAY_AIROXY_ALM_WIDTH)
#define IDC_DISPLAY_ALM_TIME_Y		(IDC_DISPLAY_Y+0)
#define IDC_DISPLAY_ALM_TIME_WIDTH		130
#define IDC_DISPLAY_ALM_TIME_HEIGHT		60


#define IDC_DISPLAY_TYPE_X		(IDC_DISPLAY_X+120)
#define IDC_DISPLAY_TYPE_Y		(IDC_DISPLAY_Y+30)
#define IDC_DISPLAY_TYPE_WIDTH		30
#define IDC_DISPLAY_TYPE_HEIGHT		30

#define IDC_DISPLAY_BATTERY_X		(IDC_DISPLAY_X+1110)
#define IDC_DISPLAY_BATTERY_Y		(IDC_DISPLAY_Y+0)
#define IDC_DISPLAY_BATTERY_WIDTH		60
#define IDC_DISPLAY_BATTERY_HEIGHT		30

#define IDC_DISPLAY_TIME_X		(IDC_DISPLAY_X+1175)
#define IDC_DISPLAY_TIME_Y		(IDC_DISPLAY_Y+0)
#define IDC_DISPLAY_TIME_WIDTH		105
#define IDC_DISPLAY_TIME_HEIGHT		60

class CDisplayField : public CStatic
{
	DECLARE_DYNAMIC(CDisplayField)

public:
	CDisplayField();
	virtual ~CDisplayField();

	//显示报警
	void Show_Alm();
	//显示时间
	void Show_Time();
	// 设置病人ID
	int set_ID(CString& cs);
	// 设置病人名称
	int set_Name(CString& cs);
	// 设置病人类型
	int set_PatType(CString& cs);
	int set_PatSex(CString& cs);
	//更新病人信息
	void Update_Pat_Info(CPatient & pat);
	// 设置电池电量
	int set_Battery(INT ACFlag, INT BatteryFlag, INT BatteryLifePercent);
	//开始显示 报警静音 倒计时
	void start_alm_time(INT a);
	//停止 显示 报警静音 倒计时
	void stop_alm_time();
	//更新报警静音 倒计时 调用一次，减少1秒
	void update_alm_time();
	// 重画
	void Redraw();
protected:
	afx_msg void OnPaint();
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
	DECLARE_MESSAGE_MAP()

private:
	INT m_i32ACFlag, m_i32BatteryFlag, m_i32BatteryLifePercent;
	CString m_csID, m_csName, m_csType, m_csSex;
	CRect m_rectCtrl;			// 控件区域
	CRect m_rectValue;			// 显示数值区域
	CDC dcMem; //用于缓冲作图的内存DC 
	CBitmap bmp; //内存中承载临时图象的位图
	CBitmap m_BitmapPower;
	CDC m_dcMemPower;
	int m_i32ReDraw;
	CFont font;
	
	CFont fontAlarm;
	CFont fontAlarmTime;
	CFont fontBattery;
	CPen *pen1;
	CPen *pen2, *pen3, *pen4;

	INT m_i32AlmTime;
	int m_i32BatQ;
public:
	
};


