醫(yī)院候診管理系統(tǒng)C_第1頁(yè)
醫(yī)院候診管理系統(tǒng)C_第2頁(yè)
醫(yī)院候診管理系統(tǒng)C_第3頁(yè)
醫(yī)院候診管理系統(tǒng)C_第4頁(yè)
醫(yī)院候診管理系統(tǒng)C_第5頁(yè)
已閱讀5頁(yè),還剩37頁(yè)未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、【附錄一】源代碼 HOSPITAL.CPP#includehospital.h#define Max 1000000 /最多支持的掛號(hào)的人數(shù)long renshu5= 0,0,0,0,0; /存放各科室人數(shù)long I=0; /數(shù)組下標(biāo)long L=0;long Ghsr=0; /用于存放掛號(hào)的收入!using namespace std;struct Patient /定義患者結(jié)構(gòu)體 char num6; /患者編號(hào) char time8 = ; /掛號(hào)日期,初始化0 int sex = 0; /性別 1為男,2為女 int age = 0; /年齡 char room = 0; /所掛號(hào)的

2、科室 char jz4 = 否; /是否是急診,默認(rèn)值否 char zp; /專家門(mén)診還是普通門(mén)診 PMax,QMax; /最多存放1000000個(gè)struct Age /年齡段結(jié)構(gòu)體 int e = 0; /兒童 enfant 1-14 int y = 0; /青年 young people 15-25 int m = 0; /中年 wrinkly 26-55 int o = 0; /老年 old folks 55以上;struct ghfl int drrs = 0; /當(dāng)日號(hào)人數(shù) int yyrs = 0; /預(yù)約人數(shù) int jzrs = 0; /急診人數(shù) G;struct Paixu

3、 /定義各科室就診人數(shù)排序結(jié)構(gòu)體 char name6; /科室名稱 int money; /本科收入 struct Age a ; /Age 結(jié)構(gòu)體類型的成元 J5; /一共5個(gè)科室void clear() system(cls); /清屏 system(date/t); /顯示日期/-分科室函數(shù)-void hospital:room(char room) clear(); switch(room) case 1: renshu0+; couttnt請(qǐng)到第5就診室!nnt您的前面還有 renshu0-1 人nnt; break; case 2: renshu1+; couttnt請(qǐng)到第4就診

4、室!nnt您的前面還有 renshu1-1 人nnt; break; case 3: renshu2+; couttnt請(qǐng)到第3就診室!nnt您的前面還有 renshu2-1 人nnt; break; case 4: renshu3+; couttnt請(qǐng)到第2就診室!nnt您的前面還有 renshu3-1 人nnt; break; case 5: renshu4+; couttnt請(qǐng)到第1就診室!nnt您的前面還有 renshu4-1 人nnt; break; /-掛當(dāng)日號(hào)函數(shù)-int hospital:gdrh() char temp1000 = ; /為了避免輸入多個(gè)字符時(shí)會(huì)產(chǎn)生的錯(cuò)誤 i

5、f(input() = -1) return 1; /如果在input里面選擇了返回則返回 /tj(); /調(diào)用統(tǒng)計(jì)計(jì)算前面有幾人 room(PI-1.room); /分科室 G.drrs+; /掛當(dāng)日號(hào)人數(shù)+1 system(pause); /暫停 return 1;/-查看掛號(hào)人數(shù)函數(shù)-int hospital:ghrs() char temp100=; clear(); coutnnnttt各類掛號(hào)情況一覽表n; cout t=n; cout nnt t掛當(dāng)日號(hào)的人數(shù)為- G.drrs; cout nnt t掛預(yù)約號(hào)的人數(shù)為- G.yyrs; cout nnt t掛急診號(hào)的人數(shù)為- G.

6、jzrs; cout nnnt=nt; system(pause); return(1);/-掛急診號(hào)函數(shù)-int hospital:gjzh() if(-1 = input() return 1; /返回 clear(); /清屏 switch(PI-1.room) case 1: renshu0+; couttnt請(qǐng)到第1急診室!nnt; break; case 2: renshu1+; couttnt請(qǐng)到第2急診室!nnt; break; case 3: renshu2+; couttnt請(qǐng)到第3急診室!nnt; break; case 4: renshu3+; couttnt請(qǐng)到第4急

7、診室!nnt; break; case 5: renshu4+; couttnt請(qǐng)到第5急診室!nnt; break; G.jzrs+; /急診號(hào)人數(shù)+1 strcpy( PI-1.jz,是); system(pause); return 1;/-查看掛號(hào)收入函數(shù)-int hospital:ghsr() int i=0; char temp100=; char temp1=/; clear(); coutnnnttt掛號(hào)情況一覽表n; cout t=n; coutt今天的掛號(hào)費(fèi)收入為: Ghsr 元; cout nt=n; for(i=0; i5; i+) coutnntJ的收入為

8、: Ji.money ; cout nt=nt; system(pause); return(1);/-查看年齡比函數(shù)-int hospital:nlb() long sum5; int i; char temp100=; clear(); coutnnttt 各科室患者年齡層人數(shù)nn; couttt兒 童t 青 年t 中 年t 老 年t 總 和nn; couttt(1-14)t(15-25)t(26-55)t(56以上)(1-100)n; cout =nn; for(i=0; i5; i+) /求出各科室就診的總?cè)藬?shù) sumi=Ji.a.e+Ji.a.y+Ji.a.m+Ji.a.o ; fo

9、r(i=0; i5; i+) cout tJtJi.a.et Ji.a.yt Ji.a.mt Ji.a.ot sumi; coutnn; cout =nt; system(pause); return(1);/-查看各科就診比例-int hospital:jzrs() int i=0; char temp100=; clear(); coutnnnttt各科就診人數(shù)一覽表n; cout t=; for(i=0; i5; i+) coutnnti+1. J的就診人數(shù)為: renshui ; cout nt=nt; system(pause); return(1);/-掛號(hào)

10、向?qū)Ш瘮?shù)-int hospital:ghxd() clear(); /清屏 char gn, temp1000=; /為了避免輸入多個(gè)字符時(shí)會(huì)產(chǎn)生的錯(cuò)誤 cout nnttt=掛號(hào)向?qū)?nn; cout tt以下僅供參考,如疑問(wèn)請(qǐng)咨詢醫(yī)護(hù)人員!nn; cout t=科室=包含內(nèi)容=nn ; cout t 內(nèi)科tt呼吸,消化,泌尿,心臟,免疫,血液,內(nèi)分泌,神經(jīng),腎,等nn; cout t 外科tt感染,心胸,肝膽,外傷,微創(chuàng),普外,肛腸,整形,等nn; cout t 骨科tt骨折,骨質(zhì)增生,風(fēng)濕,關(guān)節(jié),四肢,骨神經(jīng),等nn; cout t 口腔科t牙齒,牙齦,頜面,舌,淋巴,口腔潰瘍,等nn;

11、 cout t 皮膚科t癬類,皰疹,皮炎,皮膚瘙癢,癍類,痘類,等nn; cout t=nt; system(pause); return 1;/-預(yù)約掛號(hào)功能函數(shù)-inthospital:yygh()charstr_15,str_25,str50,gn;/保存系統(tǒng)時(shí)間與預(yù)約不同天數(shù)及系統(tǒng)時(shí)間intm=1,n=0;if(-1=input()return1;structtm*mytime;time_tLocalTime;LocalTime=time(NULL);mytime=localtime(&LocalTime);strftime(str,sizeof(str),%c,mytime);/接收

12、系統(tǒng)當(dāng)前時(shí)間,格式09/04/15doclear();if(m-n=0)coutnnn請(qǐng)掛當(dāng)天號(hào).nn;system(pause);return1;elsechardate8;intflag=1;while(flag=1)clear();memset(str_1,0,sizeof(str_1);memset(str_2,0,sizeof(str_2);cout=n;coutnt注意:預(yù)約掛號(hào)只能預(yù)約七天以內(nèi)nnendl;coutdate;strcpy(PI.time,date);for(intj=0,r=0;j=0&(datej-0)=9)str_1r=strj;str_2r=datej;r+

13、;flag=0;elseflag=1;clear();cout7|m-n=0);coutnt請(qǐng)m-n天之后前來(lái)就診,謝謝!nnt;/不同天數(shù)相減G.yyrs+;/預(yù)約掛號(hào)人數(shù)+1switch(PI-1.room)case1:renshu0+;break;case2:renshu1+;break;case3:renshu2+;break;case4:renshu3+;break;case5:renshu4+;break;QL.zp=PI-1.zp;QL.age=PI-1.age;strcpy(QL.jz,PI-1.jz);strcpy(QL.num,PI-1.num);QL.room=PI-1.

14、room;QL.sex=PI-1.sex;strcpy(QL.time,PI-1.time);L+;system(pause);return1; /-統(tǒng)計(jì)功能函數(shù)-void hospital:tj() long i=0,m; struct Paixu t; m=I; strcpy(J0.name,內(nèi)科); /J結(jié)構(gòu)體數(shù)組賦初值 strcpy(J1.name,外科); strcpy(J2.name,骨科); strcpy(J3.name,皮膚科); strcpy(J4.name,口腔科); for(i=0; i5; i+) /各科室各年齡段人數(shù)初值為0 Ji.a.e=0; Ji.money =

15、0; Ji.a.y=0; Ji.a.m=0; Ji.a.o=0; Ghsr = 0; for(i=0; im; i+) if(Pi.zp=Y)Ghsr+=10,JPi.room-1.money+=10; /統(tǒng)計(jì)掛號(hào)收入:專家 else if(Pi.zp = N) Ghsr+=5,JPi.room-1.money+=5; /統(tǒng)計(jì)掛號(hào)收入:普通 if (Pi.age=14) /統(tǒng)計(jì)各科室各年齡段人數(shù) JPi.room-1.a.e+; else if (Pi.age =25) JPi.room-1.a.y+; else if(Pi.age =55) JPi.room-1.a.m+; else JPi

16、.room-1.a.o+; /-輸入功能函數(shù)-int hospital:input() char room2=/,cls1=0,zp2,sex2,qr; int age2=0,i=0; char room11000=; char zp11000=; char sex11000=; char age11000=; char cls1000=; char temp6=; char temp16=; while(IMax) /重復(fù)輸入記錄 strcpy(room1,); strcpy(zp1,); strcpy(sex1,); strcpy(age1,); strcpy(cls,); strcpy(

17、temp,); strcpy(temp1,); room2=/; sex2=/; zp2=/; cls1=0; age2=0; qr=/; while(room2 5) & room2!=r ) clear(); coutnntttt請(qǐng)選擇科室nn; cout nt=n; coutntt1.內(nèi)科; couttt2.外科; couttt3.骨科nn; couttt4.皮膚科; coutt5.口腔科; couttr.返回!; cout nnt=n; coutroom1; /輸入放在臨時(shí)變量temp中 if (strlen(room1)=1) room2=tolower(room10); if (r

18、oom2=r) return(-1); while(zp2!=Y&zp2!=N) /選擇專家門(mén)診嗎 clear(); coutzp1; if (strlen(zp1)=1) zp2=toupper(zp10); /變成大寫(xiě),以避免系統(tǒng)區(qū)分大小寫(xiě) while(sex2!=1&sex2!=2) /選擇性別1為男,2為女 clear(); coutsex1; if (strlen(sex1)=1) sex2=sex10; while(age2150) /輸入的年齡在1-150之間 clear(); coutage1; if (strlen(age1)=3) age2=atoi(age1); /將字符

19、型的age1轉(zhuǎn)換成整型賦給age2; ltoa(I+1,temp,10); /計(jì)算當(dāng)前患者編號(hào) if(strlen(temp)6) for(i=0; i6-strlen(temp); i+) strcat(temp1,0); strcat(temp1,temp); / 輸出患者信息以確認(rèn)輸入是否正確 while(cls1!=1&cls1!=2&cls1!=r) clear(); coutnnnttt您的輸入的信息如下,請(qǐng)確認(rèn)是否正確!nnnn; coutt編 號(hào)t 性 別t年 齡t所掛科室t專家門(mén)診t掛號(hào)費(fèi)nn; coutttemp1; /編號(hào) if (sex2=1) coutt 男; /性別

20、 else if(sex2 =2) coutt 女; couttage2; /年齡 switch(room2) /科室 case 1: coutt內(nèi) 科; break; case 2: coutt外 科; break; case 3: coutt骨 科; break; case 4: coutt皮膚科; break; case 5: coutt口腔科; break; if (zp2=Y) /是否為專家門(mén)診 couttt 是; else couttt不 是; if (zp2=Y) /掛號(hào)費(fèi)用 couttt10; else couttt5; coutnn=; coutnntt1.重新填寫(xiě)!tt2.

21、信息正確!; coutcls; if (strlen(cls)=1) cls1=tolower(cls0); /變?yōu)樾?xiě)字母 if (cls1=2) PI.age =age2; PI.room=room2; strcpy(PI.num,temp1); PI.sex=sex2-0; PI.zp=zp2; I+; return 0; /重復(fù)輸入記錄(完)/-掛號(hào)功能菜單函數(shù)-int hospital:gh_menu() int qu5,i,fh; /qu數(shù)組用于接收返回值 i數(shù)值下標(biāo) fh返回的開(kāi)關(guān) char gn, temp1000=; /為了避免輸入多個(gè)字符時(shí)會(huì)產(chǎn)生的錯(cuò)誤,例:123,-2等等

22、 /調(diào)用統(tǒng)計(jì)功能函數(shù)求出所需要的值 do /控制返回操作 for(i=0; i5; i+) qui=2; /返回時(shí)重新賦初值 fh=0; i=0; gn=0; strcpy(temp,); clear(); while(gn!=1&gn!=2&gn!=3&gn!=4&gn!=q&gn!=r) /只能輸入1、2或者3 clear(); coutnnnttt=請(qǐng)選擇您需要的功能=n; cout nt=n; coutnt1.掛當(dāng)日號(hào)t2.預(yù)約掛號(hào)t3.掛急診號(hào)t4.掛號(hào)向?qū); cout ntttr.返 回!tq.退 出!n; cout nt=n; couttemp; /輸入放在臨時(shí)變量temp中

23、if (strlen(temp)=1) gn=tolower(temp0);/輸入多個(gè)字符時(shí)跳過(guò) switch(gn) case 1: qu0=gdrh(); break; /掛當(dāng)日號(hào) case 2: qu1=yygh(); break; /預(yù)約掛號(hào) case 3: qu2=gjzh(); break; /掛急診號(hào) case 4: qu3=ghxd(); break; /掛號(hào)向?qū)?case r: return(1); /表示選擇了返回 case q: qu4=0; /正常退出程序 for(i=0; i5; i+) if (qui=0) /已經(jīng)選擇了退出 system(cls); couttem

24、p; if (tolower(temp0)=y) f_write(); /寫(xiě)文件 system(cls); coutnnnttt您已成功退出系統(tǒng)!nnnnnn; exit(0); else fh=1; break; else /選擇了返回 if (qui=1) fh=1; break; while(fh=1); return(-1);int hospital:show() char n, temp1000=; /為了避免輸入多個(gè)字符時(shí)會(huì)產(chǎn)生的錯(cuò)誤,例:123,-2等等 while(TRUE) n = 0; /每次循環(huán)初始化值 while(n!=1&n!=2&n!=3&n!=4&n!=5&n!=6&n!=7&n!=r) clear(); cout nt=nn; cout t1.所有名單t2.內(nèi)科名單t3.外科名單n; cout t4.骨科名單t5.皮膚科名單t6.口腔科名單n; cout

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論