#pragma once
#include "includes.h"
#include "Patient.h"
#include "Data.h"
//#define SAVE_DATA_FILE_HEAD_1_ADD   (0)
//#define SAVE_DATA_FILE_HEAD_2_ADD   (1024*32)
//#define SAVE_DATA_FILE_DATA_ADD   (1024*32+SAVE_DATA_FILE_HEAD_2_ADD)
//#define SAVE_DATA_LENGTH			(3600/ECG_DATA_SAVE_TIME)
//#define SAVE_DATA_SEC_LENGTH		(ECG_DATA_SAVE_TIME*ECG_SAMPLE_RATE * 2*12)
//
//#define REC_FORWARD				1
//#define REC_BACKWARD			2




struct SAVE_DATA_FILE_HEAD
{
	TCHAR cID[32];
	TCHAR cName[32];
	TCHAR cAge[8];
	TCHAR cSex[8];
	TCHAR cTime[32];
	int i32HR;
	int i32ST1, i32ST2;
	int i32OXY,i32PR;
	int i32Temp;
	int i32SBP, i32DBP, i32Pmean;
};

class CECGDateSaveFile
{
public:
	CECGDateSaveFile();
	~CECGDateSaveFile();
	int make_save_data(CPatient &pat, struct GET_ECG_DATA *st);
	int do_save_data();
	int check_file_head();
	int get_rec_data(struct GET_ECG_DATA *st, int sec, int flag,CWnd *wnd);

	CWnd *wnd;


	

	int m_i32SaveFlag;
	int m_i32MakeFlag;
	CCriticalSection g_CSSave;

	int m_i32FileErr;
	UINT8 *m_pBuff;
	CFile m_FileECGDataSave;
	struct SAVE_DATA_FILE_HEAD stSaveDataFileHead1, stSaveDataFileHead2;
	UINT m_u32SecLength;
	int m_i32FileFlag;
	//存储数据文件的读写地址
	int m_u32ECGDataFileW, m_u32ECGDataFileR, m_u32ECGDataFileLength;
};

