医院挂号信息系统.docx

上传人:b****5 文档编号:28443153 上传时间:2023-07-13 格式:DOCX 页数:19 大小:18.84KB
下载 相关 举报
医院挂号信息系统.docx_第1页
第1页 / 共19页
医院挂号信息系统.docx_第2页
第2页 / 共19页
医院挂号信息系统.docx_第3页
第3页 / 共19页
医院挂号信息系统.docx_第4页
第4页 / 共19页
医院挂号信息系统.docx_第5页
第5页 / 共19页
点击查看更多>>
下载资源
资源描述

医院挂号信息系统.docx

《医院挂号信息系统.docx》由会员分享,可在线阅读,更多相关《医院挂号信息系统.docx(19页珍藏版)》请在冰豆网上搜索。

医院挂号信息系统.docx

医院挂号信息系统

医院挂号信息系统

实验代码如下:

//医院挂号系统.

#include"stdafx.h"

#include

#include

#include

#include

usingnamespacestd;

//********************医院挂号系统主菜单。

*****************//

voidCaidan1(){

cout<

cout<<"------------------欢迎使用医院挂号系统-----------------"<

cout<<"****"<

cout<<"**1:

挂号**"<

cout<<"**2:

查询挂号信息**"<

cout<<"**3:

修改挂号信息**"<

cout<<"**4:

查询总收入**"<

cout<<"**5:

清除当天所有挂号记录**"<

cout<<"**6:

退出系统.....**"<

cout<<"---------------------------------------------------------"<

cout<<"请选择功能项:

";

}

//********************科室菜单。

*****************//

voidCaidan2(){

cout<

cout<<"***********************************"<

cout<<"**科室菜单**"<

cout<<"**-------------------------------**"<

cout<<"**0内科**"<

cout<<"**1外科**"<

cout<<"**2骨科**"<

cout<<"**3五官科**"<

cout<<"***********************************"<

cout<<"请选择功能项:

";

}

//********************门诊类型菜单。

*****************//

voidCaidan3(){

cout<

cout<<"***********************************"<

cout<<"**门诊类型菜单**"<

cout<<"**-------------------------------**"<

cout<<"**0普通门诊**"<

cout<<"**1专家门诊**"<

cout<<"***********************************"<

cout<<"请选择功能项:

";

}

 

//********************结构体Guangli,用于暂时存储数据。

*****************//

structGuanli

{

stringname;

stringsex;

intyibao_no,Birth_date;

stringphone_no,Keshi,Outpatient_service_type;

};

//********************病人类。

*****************//

classBingren{

public:

Bingren();

voidit_record();

voidread_in();

voidguahao();

voidXinBinRen();

voidXuanzhe(intw);

voidquery();

voidalter();

voidcount_money();

voidclear();

private:

Guanligl[100];

intgl_len;

};

//********************用for循环对全部数组中的数据初始化。

*****************//

Bingren:

:

Bingren(){

for(inti=0;i<100;i++)

{

gl[i].phone_no=gl[i].Keshi=gl[i].Outpatient_service_type="##";

gl[i].yibao_no=gl[i].Birth_date=0;

gl[i].sex="##";

gl[i].name="##";

}

this->gl_len=0;

}

//********************初始化已有的病人纪录。

*****************//

voidBingren:

:

it_record(){

ifstreaminfile("list.txt");

if(!

infile){

cout<<"Cannotopenfile.\n"<

exit(0);

}

intyibao_no1,Birth_date1;

stringname1,sex1,phone_no1,Keshi1,Outpatient_service_type1;

intrecord_size=0;

while(!

infile.eof()){

infile>>yibao_no1>>name1>>sex1>>Birth_date1>>phone_no1>>Keshi1>>Outpatient_service_type1;

if(infile.eof())break;

if(yibao_no1!

=0||name1==""){gl[record_size].yibao_no=yibao_no1;

gl[record_size].name=name1;

gl[record_size].sex=sex1;

gl[record_size].Birth_date=Birth_date1;

gl[record_size].phone_no=phone_no1;

gl[record_size].Keshi=Keshi1;

gl[record_size].Outpatient_service_type=Outpatient_service_type1;

record_size++;}

}

record_size--;

infile.close();

}

//********************将结构体中的数据存入txt文件中并覆盖原有信息。

*****************//

voidBingren:

:

read_in(){

ofstreamoutfile;

outfile.open("list.txt");//,ios:

:

out|ios:

:

app

if(!

outfile)

{

cout<<"Cannotopenoutputfile!

n,";

}

{for(intk=0;k<100;k++)

if(gl[k].yibao_no!

=0)

outfile<

gl[k].Birth_date<<""<

}

outfile.close();}

 

//********************实现挂号功能。

*****************//

voidBingren:

:

guahao(){

//stringkeshi1="内科",keshi2="外科",keshi3="骨科",keshi4="五官科";

//stringOutpatient_service_type11="普通门诊",Outpatient_service_type22="专家门诊";

it_record();

intcount_b=0,count_b1=0,yibao_no;

cout<<"请输入医保编号:

";

cin>>yibao_no;

for(inti=0;i<100;i++){

if(yibao_no==gl[i].yibao_no)

{count_b=i;

count_b1=1;

break;}

}

if(count_b1==1)

{

intcount1=0;

for(inti=0;i<100;i++)

{

if(gl[i].yibao_no==0){

count1=i;

break;}

}

stringKeshi1,Outpatient_service_type1;

cout<<"***********************************"<

cout<<"患者基本信息:

医保编号、姓名、性别、出生年月、联系电话"<

cout<<"医保编号:

"<

cout<<"姓名:

"<

cout<<"性别:

"<

cout<<"出生年月:

"<

cout<<"联系电话:

"<

if(gl[count_b].Keshi=="##"&&gl[count_b].Outpatient_service_type=="##"){

cout<<"科室:

"<

cout<<"门诊类型:

"<

cout<<"该患者今天还未挂过号!

"<

if(gl[count_b].Keshi!

="##"||gl[count_b].Outpatient_service_type!

="##"){

cout<<"科室:

"<

cout<<"门诊类型:

"<

cout<<"该患者今天已挂过号!

"<

}

cout<<"是否要挂号:

1挂号0不挂号"<

cout<<"请选择功能项:

";

intm;

cin>>m;

while(m<0||m>1){

cout<<"输入错误:

请重新输入0-1的数字:

";

intn;

cin>>n;

m=n;}

if(m==1){

if(gl[count_b].Keshi!

="##"||gl[count_b].Outpatient_service_type!

="##"){

Xuanzhe(count1);

gl[count1].yibao_no=gl[count_b].yibao_no;

gl[count1].name=gl[count_b].name;

gl[count1].sex=gl[count_b].sex;

gl[count1].Birth_date=gl[count_b].Birth_date;

gl[count1].phone_no=gl[count_b].phone_no;

ofstreamoutfile;

outfile.open("list.txt",ios:

:

out|ios:

:

app);//,ios:

:

out|ios:

:

app

if(!

outfile)

{

cout<<"Cannotopenoutputfile!

n,";

}

outfile<

gl[count1].Birth_date<<""<

outfile.close();

}

if(gl[count_b].Keshi=="##"&&gl[count_b].Outpatient_service_type=="##"){

Caidan3();

gl[count1].yibao_no=gl[count_b].yibao_no;

gl[count1].name=gl[count_b].name;

gl[count1].sex=gl[count_b].sex;

gl[count1].Birth_date=gl[count_b].Birth_date;

gl[count1].phone_no=gl[count_b].phone_no;

voidread_in();

}

}

}

if(count_b1==0)

{cout<<"该医保编号不存在,请重新登记:

"<

XinBinRen();}

}

//********************//实现部分挂号功能,即实现guahao()函数中的部分功能。

*****************//

voidBingren:

:

XinBinRen()

{

intcount1=0;

for(inti=0;i<100;i++)

{

if(gl[i].yibao_no==0)

{count1=i;

break;}

}

intyibao_no1,Birth_date1;

stringname1,sex1,phone_no1,Keshi1,Outpatient_service_type1;

cout<<"***********************************"<

cout<<"请按顺序输入基本信息:

医保编号、姓名、性别、出生年月、联系电话"<

cin>>yibao_no1>>name1>>sex1>>Birth_date1>>phone_no1;

//KeShi_Caidan();

gl[count1].yibao_no=yibao_no1;

gl[count1].name=name1;

gl[count1].sex=sex1;

gl[count1].Birth_date=Birth_date1;

gl[count1].phone_no=phone_no1;

cout<<"是否要挂号:

1挂号0不挂号"<

cout<<"请选择功能项:

";

intm;

cin>>m;

while(m<0||m>1){

cout<<"输入错误:

请重新输入0-1的数字:

";

intn;

cin>>n;

m=n;}

if(m==1){

Xuanzhe(count1);

}

if(m==0){

gl[count1].Keshi=gl[count1].Outpatient_service_type="##";

}

ofstreamoutfile;

outfile.open("list.txt",ios:

:

out|ios:

:

app);

if(!

outfile)

{

cout<<"Cannotopenoutputfile!

n,";

}

{

outfile<

gl[count1].Birth_date<<""<

}

outfile.close();

}

 

//********************实现选择科室和门诊类型功能(作为挂号的部分功能)*****************//

voidBingren:

:

Xuanzhe(intw){

stringkeshi1="内科",keshi2="外科",keshi3="骨科",keshi4="五官科";

stringOutpatient_service_type11="普通门诊",Outpatient_service_type22="专家门诊";

Caidan2();

intm1;

cin>>m1;

while(m1<0||m1>3){

cout<<"输入错误:

请重新输入0-1的数字:

";

intn1;

cin>>n1;

m1=n1;}

switch(m1){

case0:

gl[w].Keshi=keshi1;break;

case1:

gl[w].Keshi=keshi2;break;

case2:

gl[w].Keshi=keshi3;break;

case3:

gl[w].Keshi=keshi4;break;

}

Caidan3();

intm2;

cin>>m2;

while(m2<0||m2>1){

cout<<"输入错误:

请重新输入0-1的数字:

";

intn2;

cin>>n2;

m2=n2;}

switch(m2){

case0:

gl[w].Outpatient_service_type=Outpatient_service_type11;

break;

case1:

gl[w].Outpatient_service_type=Outpatient_service_type22;

break;

}}

 

//********************查询患者挂号信息。

*****************//

voidBingren:

:

query(){

it_record();

cout<<"请输入要查询的患者医保编号:

"<

intx,y=0,z=1;

cin>>x;

for(inti=0;i<100;i++){

if(x==gl[i].yibao_no)

{

y=1;

break;

}

}

if(y==1){

cout<<"患者信息:

"<

for(inti=0;i<100;i++)

{

if(x==gl[i].yibao_no)

{

cout<

"<

"<

"<

"<

"<

cout<<"科室:

"<

"<

z++;

}

 

}

}

if(y==0)

{cout<<"医保编号输入错误!

"<

system("pause");

}

//********************修改患者挂号信息。

*****************//

voidBingren:

:

alter(){

it_record();

cout<<"请输入要查询的患者医保编号:

"<

intx,y=0,num[100],t=0,p=1;

cin>>x;

for(inti=0;i<100;i++){

if(x==gl[i].yibao_no)

{

y=1;

break;

}

}

if(y==1){

cout<<"患者信息:

"<

for(inti=0;i<100;i++){

if(x==gl[i].yibao_no)

{

cout<

"<

"<

"<

"<

"<

cout<<"科室:

"<

"<

num[t]=i;

p++;

t++;

}

}

stringzz;

cout<<"确定要修改?

"<

cout<<"是/y,否/n"<

cin>>zz;

if(zz=="y"||zz=="Y"){

intz;

cout<<"请选择修改哪一项:

";

cin>>z;

while(z<1||z>t){

cout<<"输入数字不在要求范围内!

请重新输入数字:

";

intq;

cin>>q;

z=q;}

intw=0;

w=num[z-1];

Xuanzhe(w);

}

}

if(y==0)

{cout<<"该医保编号不存在或输入错误!

"<

ofstreamoutfile;

outfile.open("list.txt");

if(!

outfile)

{

cout<<"Cannotopenoutputfile!

n,";

}

for(intj=0;j<100;j++){

if(gl[j].name!

="##"){

outfile<

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 高等教育 > 研究生入学考试

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1