📄 nursedoc.cpp
字号:
// NurseDoc.cpp : implementation of the CNurseDoc class
//
#include "stdafx.h"
#include "Nurse.h"
#include "NurseDoc.h"
#include "NurseView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//***************包含需要的头文件*************************
#include "InputDlg.h"
#include "SerchDlg.h"
#include "ShowDlg.h"
#include "WarnDlg.h"
extern CListItem *g_pChild;
/////////////////////////////////////////////////////////////////////////////
// CNurseDoc
IMPLEMENT_DYNCREATE(CNurseDoc, CDocument)
BEGIN_MESSAGE_MAP(CNurseDoc, CDocument)
//{{AFX_MSG_MAP(CNurseDoc)
ON_COMMAND(ID_OPERATION_ADD, OnOperationAdd)
ON_COMMAND(ID_OPERATION_MODIFY, OnOperationModify)
ON_COMMAND(ID_OPERATION_REMOVE_ALL, OnOperationRemoveAll)
ON_COMMAND(ID_SEARCH_OPERATION, OnSearchOperation)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CNurseDoc construction/destruction
CNurseDoc::CNurseDoc()
{
// TODO: add one-time construction code here
}
CNurseDoc::~CNurseDoc()
{
}
BOOL CNurseDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// TODO: add reinitialization code here
// (SDI documents will reuse this document)
staffInfo.m_staffList.remove_all(); // 建立新的文档时,清除以前的纪录
return TRUE;
}
BOOL CNurseDoc::OnOpenDocument(LPCTSTR lpszPathName)
{
if (!CDocument::OnOpenDocument(lpszPathName))
return FALSE;
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CNurseDoc serialization
void CNurseDoc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
// TODO: add storing code here
}
else
{
// TODO: add loading code here
//打开新的文档时,清除以前的纪录
staffInfo.m_staffList.remove_all();
}
//************************调用重载的Serialize()函数*************
staffInfo.Serialize(ar);
}
/////////////////////////////////////////////////////////////////////////////
// CNurseDoc diagnostics
#ifdef _DEBUG
void CNurseDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CNurseDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CNurseDoc commands
void CNurseDoc::OnOperationAdd()
{
// TODO: Add your command handler code here
// 测试使用
CInputDlg inputDlg;
/*
inputDlg.m_ID = "0000001";
inputDlg.m_name = "Jhon";
inputDlg.m_sYear = "1978";
inputDlg.m_sMonth = "09";
inputDlg.m_sDay = "26";
inputDlg.m_sTechnical = "Ⅳ级";
inputDlg.m_sSchool = "本科";
*/
if(inputDlg.DoModal() == IDOK)
{
// 建立一个护理信息
// 定义变量存储护理信息
CString id; // 获得护士编号
id = inputDlg.m_ID;
CString name; // 获得护士姓名
name = inputDlg.m_name;
// 获得护士性别
CString sSex;
sSex = inputDlg.m_sSex;
// 获得护士出生年月
CString sYear = inputDlg.m_sYear;
CString sMonth = inputDlg.m_sMonth;
CString sDay = inputDlg.m_sDay;
CString sDate = sYear + sMonth + sDay;
// 获得护士职称
CString sTechnical;
sTechnical = inputDlg.m_sTechnical;
// 获得护士最高学历
CString sSchool;
sSchool = inputDlg.m_sSchool;
// 获得护士婚姻状况
CString marriage;
marriage = inputDlg.m_sMarriage;
CString caozuo;
caozuo=inputDlg.m_caozuo;// 护士操作考核
CString lilun;
lilun=inputDlg.m_lilun;// 护士理论考核
CString skeshi;
skeshi=inputDlg.m_keshi;// 护士科室
// 护士前往该科室时间
CString sdate2;
CString syear2 = inputDlg.m_syear2;
CString smonth2 = inputDlg.m_smonth2;
CString sday2 = inputDlg.m_sday2;
sdate2 = syear2 + smonth2 + sday2;
CString bingjia;
bingjia=inputDlg.m_bingjia;// 护士病假
CString shijia;
shijia=inputDlg.m_shijia;// 护士事假
CString beizhu;
beizhu=inputDlg.m_beizhu; //备注
// 添加信息到护士链表
CListItem *pCurrent = new CListItem(id,name,sSex,sDate,
sTechnical,sSchool,marriage,caozuo,lilun,skeshi,sdate2,bingjia,shijia,beizhu);
staffInfo.m_staffList.insert_end(pCurrent);
// 更新视图
UpdateAllViews(NULL);
}
}
void CNurseDoc::OnOperationModify()
{
// TODO: Add your command handler code here
}
void CNurseDoc::OnOperationRemoveAll()
{
// TODO: Add your command handler code here
CWarnDlg warnDlg;
warnDlg.m_sWarnText = "你真的要删除全部信息吗?";
if(warnDlg.DoModal() == IDOK)
{
staffInfo.m_staffList.remove_all();
UpdateAllViews(NULL);
}
}
void CNurseDoc::OnSearchOperation()
{
// TODO: Add your command handler code here
CSerchDlg searchDlg;
if(searchDlg.DoModal() == IDOK)
{
// 建立一组临时链表用于输出
CList tmpList1;
CList tmpList2;
CList tmpList3;
CList tmpList4;
tmpList1.m_pHead = staffInfo.m_staffList.m_pHead;
if(searchDlg.m_afterDateCheck == TRUE)
{
// 取得年月条件
CString date = searchDlg.m_sYear1 + searchDlg.m_sMoth1
+ searchDlg.m_sDay1;
tmpList1.findAfterDate(staffInfo.m_staffList.m_pHead,date);
if(!tmpList1.m_pTail)
{
tmpList1.m_pHead = 0;
}
}
tmpList2.m_pHead = tmpList1.m_pHead;
if(searchDlg.m_beforeDateChecked == TRUE)
{
// 取得年月条件
CString date = searchDlg.m_sYear2 + searchDlg.m_sMonth2
+ searchDlg.m_sDay2;
tmpList2.findBeforeDate(tmpList1.m_pHead,date);
if(!tmpList2.m_pTail)
{
tmpList2.m_pHead = 0;
}
}
tmpList3.m_pHead = tmpList2.m_pHead;
if(searchDlg.m_technicalCheck == TRUE)
{
tmpList3.findByTechnical(tmpList2.m_pHead,searchDlg.m_sTechnical);
if(!tmpList3.m_pTail)
{
tmpList3.m_pHead = 0;
}
}
tmpList4.m_pHead = tmpList3.m_pHead;
if(searchDlg.m_marriageCheck == TRUE)
{
tmpList4.findByMarriage(tmpList3.m_pHead,searchDlg.m_sMarriage);
if(!tmpList4.m_pTail)
{
tmpList4.m_pHead = 0;
}
}
g_pChild = tmpList4.m_pHead;
CShowDlg showDlg;
if(g_pChild)
showDlg.m_sInfoStatic = "以下是查询的结果!";
else
showDlg.m_sInfoStatic = "没有你所想要的护理信息!";
if(showDlg.DoModal() == IDOK)
{
UpdateAllViews(NULL);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -