#pragma once

#include "Patient.h"
#include "includes.h"

#define  ECG_FILE_DATA_LENGTH	(250*10)
#define ECG_FILE_LENGTH_LIMIT (ECG_FILE_DATA_LENGTH*2*12+640)
struct ECG_FILE_HEAD
{
	TCHAR cVersion[8];
	TCHAR cNo[8];
	TCHAR cVersion2[8];
	TCHAR cNo2[8];


	TCHAR cID[32];
	TCHAR cName[32];
	TCHAR cAge[8];
	TCHAR cSex[8];
	TCHAR cWeight[8];
	TCHAR cHeight[8];
	TCHAR cPressSys[8];
	TCHAR cPressDia[8];
	TCHAR cTime[32];
	int i32HR;
	int i32ST1, i32ST2;
	int i32ECGType;
	int i32FileLength;
};

struct ECG_FILE_DATA_INFO
{
	int i32ECGLead;
	int i32ECGSampleRate;
	int i32ECGSampleTime;
	int i32DataLength;
	int i32Offset;
};
class CECGFile
{
public:
	CECGFile();
	~CECGFile();

	struct ECG_FILE_HEAD *m_pstECGFileHead;
	struct ECG_FILE_DATA_INFO *m_pstECGFileDataInfo[12];
	UINT8 *m_pFileBuf;
	int m_i32FileLength;
	//输出的还是输入的
	int m_i32FileType;
	CFile m_OpenFile;
	struct GET_ECG_DATA m_stInputECGData;
	int make_file(CPatient *pat, struct GET_ECG_DATA *st);
	int output_file();

	int rec_make_file(struct GET_ECG_DATA *st);
	int rec_output_file(int flag);

	int input_file(CString file_name);

};

