基于MYSQL的医院综合信息管理系统设计报告

CString temp; m_pRecordset=NULL; temp.Format(CString(\执行SQL语句错误信息:%s\ ::MessageBox(NULL,temp,CString(\提示信息\ } return m_pRecordset; }

// PrescriptionDlg.cpp : 实现文件 //处方:万淑妍

#include \#include \

#include \#include \#include \

// CPrescriptionDlg 对话框

IMPLEMENT_DYNAMIC(CPrescriptionDlg, CDialogEx)

CPrescriptionDlg::CPrescriptionDlg(CWnd* pParent /*=NULL*/) : CDialogEx(CPrescriptionDlg::IDD, pParent) { m_patientno = _T(\ m_amount = _T(\ m_name = _T(\ m_no = 0; }

CPrescriptionDlg::~CPrescriptionDlg() { }

void CPrescriptionDlg::DoDataExchange(CDataExchange* pDX) { CDialogEx::DoDataExchange(pDX); DDX_Control(pDX, IDC_LIST1, m_grid); DDX_Text(pDX, IDC_PATIENTNO, m_patientno); DDX_Text(pDX, IDC_AMOUNT, m_amount);

25

DDX_Text(pDX, IDC_DURGNAME, m_name); DDX_Control(pDX, IDC_DATETIMEPICKER1, m_time); }

BEGIN_MESSAGE_MAP(CPrescriptionDlg, CDialogEx) ON_BN_CLICKED(IDOK, &CPrescriptionDlg::OnBnClickedOk) ON_BN_CLICKED(IDC_CHANGE, &CPrescriptionDlg::OnBnClickedChange) ON_NOTIFY(NM_CLICK, IDC_LIST1, &CPrescriptionDlg::OnNMClickList1) ON_BN_CLICKED(IDC_DELETE, &CPrescriptionDlg::OnBnClickedDelete) ON_BN_CLICKED(IDC_CLEAR, &CPrescriptionDlg::OnBnClickedClear) END_MESSAGE_MAP()

// CPrescriptionDlg 消息处理程序

BOOL CPrescriptionDlg::OnInitDialog() { CDialogEx::OnInitDialog(); // TODO: 在此添加额外的初始化 flag=0; return TRUE; // return TRUE unless you set the focus to a control // 异常: OCX 属性页应返回 FALSE }

void CPrescriptionDlg::AddToGrid(CString str) { CADOConn m_AdoConn; m_AdoConn.OnInitADOConn(); CString sql; sql.Format(str); _RecordsetPtr m_pRecordset; m_pRecordset = m_AdoConn.GetRecordSet((_bstr_t)sql); while(m_AdoConn.m_pRecordset->adoEOF==0) { m_grid.InsertItem(0,CString(\ m_grid.SetItemText(0,0,(CString)(char*)(_bstr_t)m_pRecordset->GetCollect(\\ m_grid.SetItemText(0,1,(CString)(char*)(_bstr_t)m_pRecordset->GetCollect(\

26

m_grid.SetItemText(0,2,(CString)(char*)(_bstr_t)m_pRecordset->GetCollect(\ m_grid.SetItemText(0,3,(CString)(char*)(_bstr_t)m_pRecordset->GetCollect(\ m_grid.SetItemText(0,4,(CString)(char*)(_bstr_t)m_pRecordset->GetCollect(\ m_pRecordset->MoveNext(); } m_AdoConn.ExitConnect(); UpdateData(true); }

void CPrescriptionDlg::OnBnClickedOk() { // TODO: 在此添加控件通知处理程序代码 //CDialogEx::OnOK(); m_no=1; if(flag==0) { m_grid.SetExtendedStyle(LVS_EX_FLATSB |LVS_EX_FULLROWSELECT |LVS_EX_HEADERDRAGDROP |LVS_EX_ONECLICKACTIVATE |LVS_EX_GRIDLINES); m_grid.InsertColumn(0,CString(\处方编号\ m_grid.InsertColumn(1,CString(\病人编号\ m_grid.InsertColumn(2,CString(\药品名称\ m_grid.InsertColumn(3,CString(\使用数量\ m_grid.InsertColumn(4,CString(\用药时间\ flag= !flag; //自动编号 CADOConn m_AdoConn; m_AdoConn.OnInitADOConn(); _bstr_t sql; sql = \ _RecordsetPtr m_pRecordset; m_pRecordset = m_AdoConn.GetRecordSet((_bstr_t)sql); while(m_AdoConn.m_pRecordset->adoEOF==0) { if(m_no<(int)_ttoi((CString)(char*)(_bstr_t)m_pRecordset->GetCollect(\

27

m_no=(int)_ttoi((CString)(char*)(_bstr_t)m_pRecordset->GetCollect(\ m_pRecordset->MoveNext(); } m_AdoConn.ExitConnect(); m_no++; CString str,str1; GetDlgItem(IDC_PATIENTNO)->GetWindowText(str1); str=CString(\from prescription where patientno \ AddToGrid(str);// 遍历员工信息记录 } UpdateData(true); if(m_patientno.IsEmpty()) { MessageBox(CString(\病人编号不能为空!\ return; } if(m_name.IsEmpty()) { MessageBox(CString(\名称不能为空!\ return; } CADOConn m_AdoConn; m_AdoConn.OnInitADOConn(); _bstr_t sql; sql = \ _RecordsetPtr m_pRecordset;

m_pRecordset=m_AdoConn.GetRecordSet(sql); //获取工作时间 CTime time; m_time.GetTime(time); COleDateTime convert_time; convert_time.SetDate(time.GetYear(),time.GetMonth(),time.GetDay()); try { m_pRecordset->AddNew();//添加新行 m_pRecordset->PutCollect(\ m_pRecordset->PutCollect(\ m_pRecordset->PutCollect(\ m_pRecordset->PutCollect(\

like 28

联系客服:779662525#qq.com(#替换为@)