⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pateditdlg.cpp

📁 医院管理系统在CV++条件下的完整性开发>>>
💻 CPP
字号:
// PatEditDlg.cpp : implementation file
//

#include "stdafx.h"
#include "HosptialMan.h"
#include "PatEditDlg.h"
#include "Patient.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CPatEditDlg dialog


CPatEditDlg::CPatEditDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CPatEditDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CPatEditDlg)
	m_Age = 0;
	m_IdNum = _T("");
	m_Name = _T("");
	//}}AFX_DATA_INIT
}


void CPatEditDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CPatEditDlg)
	DDX_Control(pDX, IDC_SEX_COMBO, m_Sex);
	DDX_Control(pDX, IDC_MARRY_COMBO, m_Marry);
	DDX_Text(pDX, IDC_AGE_EDIT, m_Age);
	DDX_Text(pDX, IDC_IDNUM_EDIT, m_IdNum);
	DDX_Text(pDX, IDC_NAME_EDIT, m_Name);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CPatEditDlg, CDialog)
	//{{AFX_MSG_MAP(CPatEditDlg)
	ON_BN_CLICKED(ID_SAVE_BUTTON, OnSaveButton)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPatEditDlg message handlers

BOOL CPatEditDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	if(cPId=="")
	{
		m_Sex.SetCurSel(0);
		m_Marry.SetCurSel(0);
	}
	else
	{
		if(cSex=="男")
			m_Sex.SetCurSel(0);
		else
			m_Sex.SetCurSel(1);
		if(cMarry=="未婚")
			m_Marry.SetCurSel(0);
		else
			m_Marry.SetCurSel(1);
	}
	UpdateData(FALSE);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CPatEditDlg::OnSaveButton() 
{
	// TODO: Add your control notification handler code here

	OnOK();	
}

void CPatEditDlg::OnOK() 
{
	UpdateData(TRUE);								//读取用户输入数据到成员变量
	CString cc,cm;
	if(m_Name == "")
	{
		MessageBox("请输入患者姓名!");
		return;
	}
	CPatient cPt;									//定义CPatient对象			
	cPt.SetName(m_Name);							//姓名
	cPt.SetIDNum(m_IdNum);							//身份证号
	cPt.SetAge(m_Age);								//年龄
	m_Sex.GetLBText(m_Sex.GetCurSel(),cc);			//性别
	cPt.SetSex(cc);								
	m_Marry.GetLBText(m_Marry.GetCurSel(),cm);		//婚姻状态
	cPt.SetMarry(cm);
	if(cPId == "")									//添加记录
	{
		int iMaxId;
		iMaxId = cPt.sql_Insert();					//插入记录
		// 用来在门诊登记录入患者时将新的信息保存到公共变量中
		PatientId.Format("%d", iMaxId);
		PatientName = m_Name;
		PatientIDNum = m_IdNum;
		PatientSex = cc;
		PatientAge.Format("%d",m_Age);
		PatientMarry = cm;
	}
	else
		cPt.sql_Update(cPId);	

	CDialog::OnOK();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -