C++課程設計--醫院門診信息管理系統設計(MFC)

課設題目

醫院門診信息管理系統設計

課設要求

  1. 用戶管理
  2. 醫生基本信息的錄入、修改,刪除和文件導入
  3. 患者掛號信息的錄入、修改、刪除和文件導入
  4. 醫生填寫患者病歷
  5. 病歷信息刪除和查詢
  6. 按時間(天、 月、季度、年)、科室統計就診病人數量
  7. 醫生信息查詢
  8. 將各類記錄信息和統計報表導出到文件中

程序運行界面

在這裏插入圖片描述
在這裏插入圖片描述
在這裏插入圖片描述
在這裏插入圖片描述
在這裏插入圖片描述

核心代碼

// statistics.cpp : implementation file
//

#include "stdafx.h"
#include "醫院門診系統.h"
#include "statistics.h"

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

/////////////////////////////////////////////////////////////////////////////
// statistics dialog


statistics::statistics(CWnd* pParent /*=NULL*/)
	: CDialog(statistics::IDD, pParent)
{
	//{{AFX_DATA_INIT(statistics)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void statistics::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(statistics)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(statistics, CDialog)
	//{{AFX_MSG_MAP(statistics)
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
	ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
	ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
	ON_BN_CLICKED(IDC_BUTTON8, OnButton8)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// statistics message handlers

void statistics::OnButton1() 
{
	// TODO: Add your control notification handler code here
	CString str; //獲取系統時間
	CTime tm; tm=CTime::GetCurrentTime();
	str=tm.Format("%m")+"月";

	FILE *file=fopen("patient.txt","r");
	int a=0;
	char x0[20];
	char x1[20];
	char x2[20];
	char x3[20];
	char x4[20];
	char x5[20];
	float count=0;
	
	CString str1="收入";
	CString str2="支出";

	while(!feof(file))
	{
		fscanf(file,"%s%s%s%s%s",&x0,&x1,&x2,&x3,&x4);
		if(strcmp(x3,str)==0)
		{
		
			count++;		
		}
	}
	fclose(file);

	CString aaa;
	aaa.Format("當天人數爲:%f",count-1);

	MessageBox(aaa);

}

void statistics::OnButton2() 
{
	// TODO: Add your control notification handler code here
		// TODO: Add your control notification handler code here
	CString str; //獲取系統時間
	CTime tm; tm=CTime::GetCurrentTime();
	str=tm.Format("%m")+"月";

	FILE *file=fopen("patient.txt","r");
	int a=0;
	char x0[20];
	char x1[20];
	char x2[20];
	char x3[20];
	char x4[20];
	char x5[20];
	float count=0;
	
	while(!feof(file))
	{
		fscanf(file,"%s%s%s%s%s",&x0,&x1,&x2,&x3,&x4);
		if(strcmp(x3,str)==0)
		{
		
			count++;		
		}
	}
	fclose(file);

	CString aaa;
	aaa.Format("當月人數爲:%f",count-1);

	MessageBox(aaa);
}

void statistics::OnButton3() 
{
	// TODO: Add your control notification handler code here
	CString str; //獲取系統時間
	CTime tm; tm=CTime::GetCurrentTime();
	str=tm.Format("%m")+"月";

	FILE *file=fopen("patient.txt","r");
	int a=0;
	char x0[20];
	char x1[20];
	char x2[20];
	char x3[20];
	char x4[20];
	char x5[20];
	float count=0;
	


	while(!feof(file))
	{
		fscanf(file,"%s%s%s%s%s",&x0,&x1,&x2,&x3,&x4);
		if(strcmp(x3,str)==0)
		{
		
			count++;		
		}
	}
	fclose(file);

	CString aaa;
	aaa.Format("當季度人數爲:%f",count-1);

	MessageBox(aaa);	
}

void statistics::OnButton8() 
{
	// TODO: Add your control notification handler code here
		CString str; //獲取系統時間
	GetDlgItem(IDC_EDIT3)->GetWindowText(str);
if(str=="")
{

	MessageBox("請輸入科室名字!");
}
else
{
FILE *file=fopen("patient.txt","r");
	int a=0;
	char x0[20];
	char x1[20];
	char x2[20];
	char x3[20];
	char x4[20];
	char x5[20];
	float count=0;
	

	while(!feof(file))
	{
		fscanf(file,"%s%s%s%s%s",&x0,&x1,&x2,&x3,&x4);
		if(strcmp(x2,str)==0)
		{
		
			count++;		
		}
	}
	fclose(file);

	CString aaa;
	aaa.Format("該科室診斷人數爲:%f",count-1);

	MessageBox(aaa);

}
	
}

項目源碼

需要源碼的小夥伴請前往
微信公衆號:海轟Pro
回覆: 海轟
O(∩_∩)O哈哈~

發佈了162 篇原創文章 · 獲贊 112 · 訪問量 6萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章