亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb

首頁 > 編程 > C > 正文

C語言實現病例管理系統

2020-01-26 13:33:03
字體:
來源:轉載
供稿:網友

本文實例為大家分享了C語言實現病例管理系統的具體代碼,供大家參考,具體內容如下

通過十字交叉鏈表實現一個病例管理系統,可以查找、刪除、更新信息。

#include"stdio.h"#include"stdlib.h"#include"string.h"typedef struct hospital_info{ char dise_num[10];  /*病歷編號*/ char ke[10];    /*門診科別*/ char date[11];   /*門診時間*/ char symptom[60];  /*癥狀*/ char diagnosis[60];  /*診斷*/ char treatment[60];  /*治療意見*/ char doctor[10];   /*醫師姓名*/ struct hospital_info *next;}hospitals;typedef struct disease_info{ char dise_num[10];   /*病歷編號*/ char employee[10];   /*姓名*/ char sex;     /*性別*/ char unit[30];    /*工作單位*/ char date[11];    /*出生日期*/ char drug_allergy[30];  /*藥物過敏史*/  char phone[12];    /*聯系電話*/ char addr[30];    /*住址*/ hospitals *head_hosp; struct disease_info *next;}diseases;typedef struct unit_info{  char unit_num[10];    /*單位編號*/ char unit[30];     /*單位名稱*/ char manager[20];    /*負責人*/ char phone[12];    /*聯系電話*/ int total; diseases *head_disease; struct unit_info *next;}units;void create_cross_list(units**head);void save_cross_list(units*head);void traverse_cross_list(units*head); void load_cross_list(units **head);void Revise_unit(units *head);void Revise_dise(units *head);void Revise_hosp(units *head);void Insert_unit(units *head);void Insert_dise(units *head);void Insert_hosp(units *head);void Delete_unit(units *head);void Delete_dise(units *head);void Delete_hosp(units *head);void Search_unit(units *head);void Search_dise(units *head);void Search_hosp(units *head);void Display_no_hosp(units *head);void Sortmonth(units *head);void SortTotal(units *head);void Sortpeople(units *head);void main(void){ units *head=NULL; short choice; printf("-----the unit information manage system!------/n"); printf("<  1----------create the cross list   >/n"); printf("<  2----------save the cross list   >/n"); printf("<  3----------traverse the cross list  >/n"); printf("<  4----------load the cross list   >/n"); printf("<  5-----------Revise information   >/n"); printf("<  6-----------Insert information   >/n"); printf("<  7-----------Delete information   >/n"); printf("<  8-----------Search information   >/n"); printf("<  9--------------- tong ji     >/n"); printf("<  10---------------退出     >/n"); printf("--------------------------------------------->/n");f: while(1){ printf("請選擇要進行的操作:(1-10)");  scanf("%hd",&choice); getchar();   /*用于吸收換行符*/  switch(choice) { case 1:create_cross_list(&head);   break; case 2:save_cross_list(head);break;  case 3:traverse_cross_list(head);   break; case 4:load_cross_list(&head);break; case 5: { printf(" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<</n"); printf("  ---------修改函數菜單-----------/n");    printf("  1----------------Revise_unit/n");    printf("  2----------------Revise_dise/n");    printf("  3----------------Revise_hosp/n"); printf(" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<</n");    while(1){  printf("**請選擇子菜單操作:(1-4)");     scanf("%hd",&choice);    getchar();   /*用于吸收換行符*/     switch(choice)  {     case 1:Revise_unit(head);break;    case 2:Revise_dise(head);break;    case 3:Revise_hosp(head);break;    case 4:goto f;  } } } case 6: {    printf(" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<</n"); printf("  ---------插入函數菜單-----------/n");     printf("  1----------------Insert_unit/n");    printf("  2----------------Insert_dise/n");    printf("  3----------------Insert_hosp/n");    printf(" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<</n");    while(1){  printf("**請選擇子菜單操作:(1-4)");     scanf("%hd",&choice);    getchar();   /*用于吸收換行符*/     switch(choice)  {     case 1:Insert_unit(head);break;     case 2:Insert_dise(head);break;     case 3:Insert_hosp(head);break;     case 4:goto f;  } } }  case 7: { printf(" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<</n"); printf("  ---------刪除函數菜單-----------/n");     printf("  1---------------Delete_unit/n");    printf("  2---------------Delete_dise/n");    printf("  3---------------Delete_hosp/n"); printf(" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<</n");    while(1){  printf("**請選擇子菜單操作(1-4):");     scanf("%hd",&choice);    getchar();   /*用于吸收換行符*/     switch(choice)  {     case 1:Delete_unit(head);break;     case 2:Delete_dise(head);break;    case 3:Delete_hosp(head);break;     case 4:goto f;  } } }  case 8: { printf("  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<</n"); printf("  ---------查詢函數菜單-----------/n");     printf("  1---------------Search_unit/n");    printf("  2---------------Search_dise/n");    printf("  3---------------Search_hosp/n"); printf("  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<</n");    while(1){  printf("**請選擇子菜單操作(1-4):");     scanf("%hd",&choice);    getchar();   /*用于吸收換行符*/     switch(choice)  {     case 1:Search_unit(head);break;     case 2:Search_dise(head);break;     case 3:Search_hosp(head);break;    case 4:goto f;  } } } case 9: { printf("  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<</n"); printf("  ---------統計函數菜單-----------/n");     printf("  1---------------Display_no_hosp/n");    printf("  2---------------Sortmonth/n");    printf("  3---------------SortTotal/n");    printf("  4---------------Sortpeople/n"); printf("  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<</n");    while(1){  printf("**請選擇子菜單操作(1-5):");     scanf("%hd",&choice);    getchar();   /*用于吸收換行符*/     switch(choice)  {     case 1:Display_no_hosp(head);break;                   case 2:Sortmonth(head);break;    case 3:SortTotal(head);break;    case 4:Sortpeople(head);break;     case 5:goto f;  } } }  case 10:goto down; } } down: ;}   /*創建十字交叉鏈表,并錄入信息*/void create_cross_list(units **head){ units *hp=NULL,*p; diseases *pcrs; hospitals *phs; char ch;loop: p=(units *)malloc(sizeof(units)); /*創建單位信息結點*/ printf("請輸入單位的編號:"); scanf("%s",p->unit_num); printf("請輸入單位名稱:"); scanf("%s",p->unit); printf("請輸入負責人:"); scanf("%s",p->manager); printf("請輸入聯系電話:"); scanf("%s",p->phone);/*輸入各項數據*/ getchar();    /*用于讀scanf輸入中的換行符*/ p->head_disease=NULL;       p->next=hp;       hp=p; printf("繼續輸入%s下單位的病例基本信息(Y/N)?/n",p->unit); scanf("%c",&ch);    getchar(); while(ch=='y'||ch=='Y') {      pcrs=(diseases *)malloc(sizeof(diseases));  printf("請輸入病例編號:"); gets(pcrs->dise_num); printf("請輸入病人姓名:"); gets(pcrs->employee); printf("請輸入性別:"); scanf("%s",&pcrs->sex);  getchar(); printf("請輸入出生日期:"); gets(pcrs->date); printf("請輸入藥物過敏史:"); gets(pcrs->drug_allergy);   printf("請輸入聯系電話:"); gets(pcrs->phone);   printf("請輸入住址:"); gets(pcrs->addr);   /*輸入各項數據*/ strcpy(pcrs->unit,p->unit);      pcrs->head_hosp=NULL;       pcrs->next=p->head_disease;     /*頭指針值賦給新結點的指針域*/ p->head_disease=pcrs;      /*頭指針指向新結點*/  printf("繼續輸入%s的門診信息(Y/N)?/n",pcrs->employee);  ch=getchar(); getchar();    while(ch=='y'||ch=='Y') {   /*是,循環創建信息鏈*/  phs=(hospitals *)malloc(sizeof(hospitals));   printf("請輸入門診科別:");  scanf("%s",phs->ke); printf("請輸入門診時間:"); scanf("%s",phs->date); printf("請輸入癥狀:"); scanf("%s",phs->symptom);   printf("請輸入診斷:"); scanf("%s",phs->diagnosis);   printf("請輸入治療意見:"); scanf("%s",phs->treatment);   printf("請輸入醫師姓名:"); scanf("%s",phs->doctor);   /*輸入各項數據*/ getchar(); strcpy(phs->dise_num,pcrs->dise_num);      phs->next=pcrs->head_hosp;    /*頭指針值賦給新結點的指針域*/  pcrs->head_hosp=phs;      /*頭指針指向新結點*/  printf("繼續輸入%s的下一條病例信息(Y/N)?/n",pcrs->employee);  ch=getchar(); getchar(); /*是否繼續創建下一個基本信息結點*/ } printf("繼續輸入下一個病例的基本信息(Y/N)?/n");  ch=getchar(); getchar();  /*是否繼續創建下一個基本信息結點*/ } printf("繼續輸入下一個單位的信息(Y/N)?/n"); ch=getchar(); getchar();    if(ch=='y'||ch=='Y') goto loop;     (*head)=hp;    p=(*head);     }/*保存十字交叉鏈表數據到磁盤文件*/void save_cross_list(units *head){ FILE *out1,*out2,*out3; units *p=head; diseases *pcrs; hospitals *phs; if((out1=fopen("c://unit.dat","wb+"))==NULL)   /*以只寫方式將單位基本信息文件創建在c盤下的unit.text文本文件,并使out1指向它*/ exit(-1); if((out2=fopen("c://disease.dat","wb+"))==NULL) /*打開病歷信息文件*/ exit(-1); if((out3=fopen("c://hospital.dat","wb+"))==NULL) /*打開門診信息文件*/ exit(-1); while(p!=NULL) { fwrite(p,sizeof(units),1,out1);/*寫單位基本信息記錄*/ pcrs=p->head_disease;     /*病歷遍歷指針指向病歷鏈鏈頭*/ while(pcrs!=NULL) {      /*遍歷病歷信息鏈*/ fwrite(pcrs,sizeof(diseases),1,out2); /*寫病歷記錄*/ phs=pcrs->head_hosp;      /*門診遍歷指針指向門診鏈鏈頭*/ while(phs!=NULL) { fwrite(phs,sizeof(hospitals),1,out3);  /*寫門診鏈*/ phs=phs->next; } pcrs=pcrs->next;       /*指向下一個病歷鏈*/ } p=p->next;   /*指向下一個單位基本信息結點*/ } fclose(out1);   /*關閉基本信息文件*/ fclose(out2);   /*關閉病歷信息文件*/ fclose(out3);   /*關閉門診信息文件*/ printf("記錄已被保存./n");}/*遍歷十字交叉鏈表,輸出各項基本信息*/void traverse_cross_list(units *head){ units *p=head; diseases *pcrs; hospitals *phs; printf("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<</n"); while(p!=NULL) {   /*遍歷單位基本信息鏈*/ printf("%s/t%s/t%s/t%s/n",p->unit_num,p->unit,p->manager,p->phone);  pcrs=p->head_disease; while(pcrs!=NULL) {   /*遍歷病歷基本信息鏈與門診信息鏈*/  printf("%s/t%s/t%c/t%s/t%s/t%s/t%s/t%s/n",pcrs->dise_num,pcrs->employee,/   pcrs->sex,pcrs->unit,pcrs->date,pcrs->drug_allergy,pcrs->phone,pcrs->addr);  phs=pcrs->head_hosp;  while(phs!=NULL)  {  printf("%s/t%s/t%s/t%s/t%s/t%s/t%s/n",phs->dise_num,phs->ke,phs->date,/  phs->symptom,phs->diagnosis,phs->treatment,phs->doctor);  phs=phs->next;  }  pcrs=pcrs->next; } p=p->next; } printf("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<</n");}/*從磁盤文件中讀取*/void load_cross_list(units **head)        { FILE *in1,*in2,*in3; units *hp=NULL,*p; diseases *pcrs; hospitals *phs; if((in1=fopen("c://unit.dat","rb"))==NULL)         exit(-1); if((in2=fopen("c://disease.dat","rb"))==NULL) exit(-1); if((in3=fopen("c://hospital.dat","rb"))==NULL) exit(-1); while(!feof(in1)) {  p=(units *)malloc(sizeof(units)); fread(p,sizeof(units),1,in1); if(!feof(in1)) {            p->head_disease=NULL; p->next=hp; hp=p; } } (*head)=hp; while(!feof(in2)) {  pcrs=(diseases *)malloc(sizeof(diseases)); fread(pcrs,sizeof(diseases),1,in2);  if(!feof(in2)) {              p=(*head);   pcrs->head_hosp=NULL; while(p!=NULL) { if(!strcmp(p->unit,pcrs->unit)) {  pcrs->next=p->head_disease;  p->head_disease=pcrs;  break; } else p=p->next; } } } (*head)=hp; while(!feof(in3)) {  phs=(hospitals *)malloc(sizeof(hospitals)); fread(phs,sizeof(hospitals),1,in3);  if(!feof(in3)) { p=(*head); while(p!=NULL) {              pcrs=p->head_disease; while(pcrs!=NULL) {  if(!strcmp(phs->dise_num,pcrs->dise_num))  {  phs->next=pcrs->head_hosp;  pcrs->head_hosp=phs;  break;  }  else pcrs=pcrs->next; } p=p->next; } } } fclose(in1); fclose(in2); fclose(in3);}//修改一個單位基本信息             void Revise_unit(units *head){ units *p,*q; char num[10]; char choice; char update[30]; p=q=head; printf("please input 要修改的單位編號:"); scanf("%s",num); getchar(); while(strcmp(num,p->unit_num)!=0&&p->next!=0) /*查找需要修改信息的單位編號*/ { q=p; p=p->next; } if(strcmp(num,p->unit_num)==0) {  printf("  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<</n");  printf("  ***a---------to revise unit_num/n");   printf("  ***b---------to revise unit_name/n");   printf("  ***c---------to revise unit_manager/n");   printf("  ***d---------to revise unit_phone/n");   printf("  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<</n");loop: printf("please input要選擇的操作:(a-d)");   choice=getchar();  getchar();    printf("please input更新后的信息:");   switch(choice) {   case 'a':    scanf("%s",update);    strncpy(p->unit_num,update,strlen(update)+1);    goto loop;   case 'b':    scanf("%s",update);    strncpy(p->unit,update,strlen(update)+1);    goto loop;   case 'c':    scanf("%s",update);    strncpy(p->manager,update,strlen(update)+1);    goto loop;   case 'd':    scanf("%s",update);    strncpy(p->phone,update,strlen(update)+1); goto loop;   default:break; }  printf("修改成功!/n"); } else printf("not find!/n");}//修改一個病歷基本信息void Revise_dise(units *head){ units *p; diseases *pcrs; char num[10]; char update[30]; char choice; p=head; printf("please input 要修改信息的員工編號:"); scanf("%s",num); getchar(); pcrs=p->head_disease; while(p!=NULL) {   while(pcrs!=NULL)   {    if(strcmp(pcrs->dise_num,num)==0)     goto loop1;    pcrs=pcrs->next;   }   p=p->next;   pcrs=p->head_disease->next;   }  if(p==NULL) {   printf("not find the unit"); goto end; } loop1:  printf("  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<</n");  printf("  ***a--------to revise the dise num/n");  printf("  ***b--------to revise the employee/n");  printf("  ***c--------to revise the sex/n");  printf("  ***d--------to revise the unit/n");  printf("  ***e--------to revise the date/n");  printf("  ***f---------to revise the drug_allergy/n");  printf("  ***g---------to revise the phone/n");  printf("  ***h---------to revise the addr/n");  printf("  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<</n");loop2: printf("please input要選擇的操作:(a-h)");  choice=getchar();  getchar();  printf("請輸入修改后的信息:");  switch (choice)  {  case 'a':   scanf("%s",update);   strncpy(pcrs->dise_num,update,sizeof(update)+1);   goto loop2;  case 'b':   scanf("%s",update);   strncpy(pcrs->employee,update,sizeof(update)+1);   goto loop2;  case 'c':   scanf("%c",&pcrs->sex);   goto loop2;  case 'd':   scanf("%s",update);   strncpy(pcrs->unit,update,strlen(update)+1);   goto loop2;  case 'e':   scanf("%s",update);   strncpy(pcrs->date,update,strlen(update)+1);   goto loop2;  case 'f':   scanf("%s",update);   strncpy(pcrs->drug_allergy,update,strlen(update)+1);   goto loop2;  case 'g':   scanf("%s",update);   strncpy(pcrs->phone,update,strlen(update)+1);   goto loop2;  case 'h':   scanf("%s",update);   strncpy(pcrs->addr,update,strlen(update)+1);   goto loop2;  default:break;  } printf("修改成功!/n");end: ;}/*修改一個門診基本信息*/void Revise_hosp(units *head){ units *p; diseases *pcrs; hospitals *phs; char num[10],date[11]; char choice; char update[30]; p=head; printf("please input 要修改信息的病歷編號:"); scanf("%s",num); pcrs=p->head_disease; while(p!= NULL) {  while(pcrs!= NULL)  {   if(strcmp(pcrs->dise_num,num)==0)    goto loop1;   pcrs=pcrs->next;  }  p=p->next;  pcrs=p->head_disease->next;  } if(p==NULL) {  printf("not find the unit"); goto end; }loop1: printf("please input 要修改信息的門診時間:"); scanf("%s",date); phs=pcrs->head_hosp; while(phs!= NULL) {  if(strcmp(phs->date,date)==0)   goto loop2;  phs=phs->next; }  if(phs==NULL) {  printf("not find "); goto end; }loop2:  printf("  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<</n");  printf("  ***a---------revise the dise_num/n");  printf("  ***b--------revise the ke/n");  printf("  ***c--------revise the date/n");  printf("  ***d--------revise the symptom/n");  printf("  ***e--------revise the diagnosis/n");  printf("  ***f--------revise the treatment/n");  printf("  ***g--------revise the doctor/n");  printf("  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<</n");loop3: printf("please input要進行的操作:");  choice=getchar();  getchar();  printf("please input the update information:");  scanf("%s",update);  switch(choice)  {  case 'a':   strncpy(phs->dise_num,update,strlen(update)+1);   goto loop3;  case 'b':   strncpy(phs->ke,update,strlen(update)+1);   goto loop3;  case 'c':   strncpy(phs->date,update,strlen(update)+1);   goto loop3;  case 'd':   strncpy(phs->symptom,update,strlen(update)+1);   goto loop3;  case 'e':   strncpy(phs->diagnosis,update,strlen(update)+1);   goto loop3;  case 'f':   strncpy(phs->treatment,update,strlen(update)+1);   goto loop3;  case 'g':   strncpy(phs->doctor,update,strlen(update)+1);   goto loop3;  default:break;  } printf("修改成功!/n");end: ;}//按單位編號由小到大在鏈表中插入一個單位新結點         void Insert_unit(units *head) {                    units *p1,*p2;  int state;loop:   p1=head;  p2=malloc(sizeof(units));  p2->next=NULL;  p2->head_disease=malloc(sizeof(diseases));  p2->head_disease->next=NULL;  printf("請輸入單位編號:");  scanf("%s",p2->unit_num); a: while(p1->next!=NULL)  {   p1=p1->next;   if(strcmp(p1->unit_num,p2->unit_num)==0)   {    state = 1;    break;   }   else   {    state=0;    break;   }  }  switch(state)  {   case 0:if(strcmp(p1->unit_num,p2->unit_num)>0)   {    if(p1==head->next)    {     head->next=p2;     p2->next=p1;    }    else    {     p1->next=p2;     p2->next=p1->next;    } break;   }   else    goto a;   case 1:printf("the unit num already exit,pleae input another one/n");     goto loop;  }   printf("請輸入單位名稱:");  scanf("%s",p2->unit);  printf("請輸入負責人:");  scanf("%s",p2->manager);  printf("請輸入聯系電話:");  scanf("%s",p2->phone); printf("插入成功!/n");}//按病歷編號由小到大插入一個員工病歷信息結點void Insert_dise(units *head){ units *p; diseases *pcrs1,*pcrs2; int state;   char name[30]; printf("請輸入單位名稱:"); scanf("%s",name); p=head; while(p->next!= NULL) {   p=p->next;   if (strcmp(p->unit,name)==0)    break; } if(p==NULL) {  printf("not find the unit!"); goto end; }  pcrs1=p->head_disease; pcrs2=malloc(sizeof(diseases)); pcrs2->next = NULL; pcrs2->head_hosp= malloc(sizeof(hospitals)); pcrs2->head_hosp->next=NULL; strcpy(pcrs2->unit,name);loop:   printf("請輸入病例編號:");  scanf("%s",pcrs2->dise_num);  if (pcrs1==NULL)   p->head_disease->next = pcrs2;  else  {a:  while (pcrs1 ->next != NULL)   {    pcrs1= pcrs1->next;    if (strcmp(pcrs1->dise_num,pcrs2->dise_num)==0)    {     state = 1;     break;    }    else    {     state=0;     break;    }   }   switch(state)   {    case 0:if(strcmp(pcrs1->dise_num,pcrs2->dise_num)>0)    {     if(pcrs1=p->head_disease->next)    {      p->head_disease->next=pcrs2;      pcrs2->next=pcrs1;    }     else    {      pcrs1->next=pcrs2;      pcrs2->next=pcrs1->next;    }  break; }    else     goto a;    case 1:printf("the disease number already exit,please input another one/n");      goto loop;   }  }  printf("請輸入姓名:");  scanf("%s",pcrs2->employee);  printf("請輸入性別:");  scanf("%c",pcrs2->sex);  printf("請輸入出生日期");  scanf("%s",pcrs2->date);  printf("請輸入藥物過敏史:"); scanf("%s",pcrs2->drug_allergy); printf("請輸入聯系電話:");  scanf("%s",pcrs2->phone);  printf("請輸入住址:");  scanf("%s",pcrs2->addr); printf("插入成功!/n");end: ;}                   //按門診時間由小到大插入一個員工門診信息結點void Insert_hosp(units *head){ units *p; diseases *pcrs; hospitals *phs1,*phs2; char number[10]; printf("請輸入單位編號:"); scanf("%s",number); p=head; while(p->next!= NULL) {   p=p->next;   if(strcmp(p->unit_num,number)==0)    break; } if(p==NULL) {  printf("not find the unit/n"); goto end; } pcrs=p->head_disease; printf("請輸入病例編號:"); scanf("%s",number); while(pcrs->next!=NULL) {  pcrs=pcrs->next;  if (strcmp(pcrs->dise_num,number)==0)   break; } if (pcrs==NULL) {  printf("not find the question /n"); goto end; } phs1=pcrs->head_hosp->next; phs2=malloc(sizeof(hospitals)); phs2->next=NULL; if(phs1==NULL)  pcrs->head_hosp->next =phs2; else {   while(phs1->next!=NULL)    phs1=phs1->next;   phs1->next=phs2; }  strncpy(phs2->dise_num,number,strlen(number)+1);  printf("請輸入科別:");  scanf("%s",phs2->ke);  printf("請輸入診斷時間:");  scanf("%s",phs2->date);  printf("請輸入主訴:");  scanf("%s",phs2->symptom);  printf("請輸入初步診斷:");  scanf("%s",phs2->diagnosis);  printf("請輸入治療意見:");  scanf("%s",phs2->treatment);  printf("請輸入醫師姓名:");  scanf("%s",phs2->doctor);  printf("插入成功!/n");end: ;}/*刪除一條單位信息記錄*/                   void Delete_unit(units *head){ units *p,*q; char name[30]; printf("please input 要刪除的單位名稱:"); scanf("%s",name);getchar(); p=q=head; while(strcmp(name,p->unit)!=0&&p->next!=0)/*p指的不是要找的結點,并且后面還有結點*/ { q=p; p=p->next; }  /*p后移一個結點*/ if(strcmp(name,p->unit)==0) { /*找要刪除位置*/ if(p==head) head=p->next; /*若p指向的是首結點,把第二個結點地址賦予head*/ else q->next=p->next; /*否則將下一個結點地址賦給前一結點地址*/ free(p);  printf("刪除成功!/n"); } else printf("%s not been found!/n",name); /*找不到該結點*/}/*刪除一條病歷信息記錄*/void Delete_dise(units *head){ units *p,*q; diseases *pcrs,*t; char name[10],employee[30]; printf("please input 要刪除信息的單位名稱:"); scanf("%s",name); getchar(); p=q=head; while(strcmp(name,p->unit)!=0&&p->next!=0) /*p指的不是要找的結點,并且后面還有結點*/ { q=p; p=p->next; }  /*p后移一個結點*/ if(strcmp(name,p->unit)==0) {           printf("please input 要刪除信息的員工姓名:");  scanf("%s",employee); getchar(); pcrs=t=p->head_disease;  while(strcmp(employee,pcrs->employee)!=0&&pcrs->next!=0) { t=pcrs; pcrs=pcrs->next; }  /*pcrs后移一個結點*/  if(strcmp(employee,pcrs->employee)==0) { if(pcrs==p->head_disease) p->head_disease=pcrs->next; /*若pcrs指向的是首結點,把第二個結點地址賦予head*/  else t->next=pcrs->next; /*否則將下一個結點地址賦給前一結點地址*/  free(pcrs);   printf("刪除成功!/n"); } }                    else printf("%s not been found!/n",employee);}//刪除一條門診信息記錄void Delete_hosp(units *head){ units *p,*q; diseases *pcrs,*t1;  hospitals *phs,*t2; char name[30],employee[10],date[11]; printf("please input 要刪除信息的單位名稱:"); scanf("%s",name); getchar(); p=q=head; while(strcmp(name,p->unit)!=0&&p->next!=0)/*p指的不是要找的結點,并且后面還有結點*/ { q=p; p=p->next; }  /*p后移一個結點*/ if(strcmp(name,p->unit)==0) { printf("please input 要刪除信息的員工姓名:");  scanf("%s",employee); getchar(); pcrs=t1=p->head_disease;  while(strcmp(employee,pcrs->employee)!=0&&pcrs->next!=0) { t1=pcrs; pcrs=pcrs->next; }  /*pcrs后移一個結點*/  if(strcmp(employee,pcrs->employee)==0) { printf("please input 要刪除信息的病歷時間:");   scanf("%s",date); getchar();  phs=t2=pcrs->head_hosp;   while(strcmp(date,phs->date)!=0&&phs->next!=0) { t2=phs; phs=phs->next; }    if(strcmp(date,phs->date)==0) {          if(phs==pcrs->head_hosp) pcrs->head_hosp=phs->next;    else t2->next=phs->next;    free(phs);    printf("刪除成功!/n"); } } }  else printf("%s not been found!/n",date);}/*查詢一條單位信息記錄并輸出信息*/              void Search_unit(units *head){ units *p,*q; char num[10]; p=q=head; printf("please input 要查詢的單位編號:"); scanf("%s",num); getchar(); while(strcmp(num,p->unit_num)!=0&&p->next!=0)/*p指的不是要查詢的結點并且后面還有結點*/ { q=p; p=p->next; } /*p后移一個結點*/ if(strcmp(num,p->unit_num)==0) {/*找要查詢的結點,輸出各項基本信息*/ printf("單位編號:%s/n",p->unit_num); printf("單位名稱:%s/n",p->unit); printf("負責人:%s/n",p->manager); printf("聯系電話:%s/n",p->phone); } else printf("%s not been found!/n",num); /*找不到要查詢的結點*/}//查詢一條病歷信息鏈并輸出信息void Search_dise(units *head){ units *p,*q; diseases *pcrs,*t; char name[10],num[10]; p=q=head; printf("please input 要查詢的單位名稱:"); scanf("%s",name); getchar(); while(strcmp(name,p->unit)!=0&&p->next!=0) { q=p; p=p->next; } /*p后移一個結點*/ if(strcmp(name,p->unit)==0) /*找要查詢的結點*/ {    pcrs=t=p->head_disease;  printf("please input 要查詢的病歷編號:");  scanf("%s",num); getchar();  while(strcmp(num,pcrs->dise_num)!=0&&pcrs->next!=0) { t=pcrs; pcrs=pcrs->next; } /*p后移一個結點*/ if(strcmp(num,pcrs->dise_num)==0)  {/*找要查詢的結點*/ printf("病歷編號:%s/n",pcrs->dise_num);   printf("姓名:%s/n",pcrs->employee);   printf("性別:%c/n",pcrs->sex);   printf("工作單位:%s/n",pcrs->unit); printf("出生日期:%s/n",pcrs->date); printf("藥物過敏史:%s/n",pcrs->drug_allergy); printf("聯系電話:%s/n",pcrs->phone); printf("住址:%s/n",pcrs->addr); } } else printf("not been found!/n"); /*找不到要查詢的結點*/}                     //查詢一條門診信息鏈并輸出信息void Search_hosp(units *head){ units *p,*q; diseases *pcrs,*t1; hospitals *phs,*t2; char name[10],num[10],date[11]; p=q=head; printf("please input 要查詢的單位名稱:"); scanf("%s",name); getchar(); while(strcmp(name,p->unit)!=0&&p->next!=0) { q=p; p=p->next; } /*p后移一個結點*/ if(strcmp(name,p->unit)==0) /*找要查詢的結點*/ {    pcrs=t1=p->head_disease;  printf("please input 要查詢的病歷編號:");  scanf("%s",num); getchar();  while(strcmp(num,pcrs->dise_num)!=0&&pcrs->next!=0) { t1=pcrs; pcrs=pcrs->next; } /*p后移一個結點*/ if(strcmp(num,pcrs->dise_num)==0) /*找要查詢的結點*/  {   phs=t2=pcrs->head_hosp;   printf("please input 要查詢的門診時間:");   scanf("%s",date); getchar();   while(strcmp(date,phs->date)!=0&&phs->next!=0) { t2=phs; phs=phs->next; } /*p后移一個結點*/  if(strcmp(date,phs->date)==0) { printf("病歷編號:%s/n",phs->dise_num);    printf("診斷科別:%s/n",phs->ke); printf("門診時間:%s/n",phs->date); printf("主訴:%s/n",phs->symptom); printf("初步診斷:%s/n",phs->diagnosis);    printf("治療意見:%s/n",phs->treatment); printf("醫師姓名:%s/n",phs->doctor); } } } else printf("not been found!/n"); /*找不到要查詢的結點*/}/*列出從未門診的員工信息(單位.姓名.住址.電話)*/void Display_no_hosp(units *head)            { units *p=head; diseases *pcrs; hospitals *phs; while(p!=NULL) { printf("%s/n",p->unit);  //輸出各個單位名稱  printf("員工姓名/t電話/t住址/n");  pcrs=p->head_disease; while(pcrs!=NULL) { phs=pcrs->head_hosp; //如果phs是空鏈,則該員工從未門診過 if(phs==NULL) printf("%s/t%s/t%s/n",pcrs->employee,pcrs->phone,pcrs->addr); else ; //否則門診過,執行空語句 pcrs=pcrs->next; } p=p->next; }}/*統計一年中各月的門診量并按降序排列后輸出*/        void Sortmonth(units *head){ units *p=head; diseases *pcrs; hospitals *phs; int s[12],i,j,t,count; char year[10],month[10]; for(i=0;i<12;i++) s[i]=0; printf("--請輸入要統計的年份:"); //手動輸入要統計的年份 scanf("%s",year); getchar(); printf("--請輸入要統計的月份:"); for(i=0;i<12;i++) { count=0;  //統計一年中各月的門診量   scanf("%s",month);  while(p!=NULL) { pcrs=p->head_disease;   while(pcrs!=NULL) { phs=pcrs->head_hosp;    while(phs!=NULL) {  j=0;    while(phs->date[j]==year[j]&&(j<4))   j++;//判斷是否為要統計的年份    if(j==4)   //是,比較是否為在該月的門診     if(phs->date[j+1]==month[0]&&phs->date[j+2]==month[1])    count++;    else ; //不是,執行空語句    phs=phs->next; }    pcrs=pcrs->next; }   p=p->next; }  s[i]=count; } for(i=0;i<12;i++)   //輸出各月的總門診量 printf("%d/t",s[i]); printf("/n"); for(i=0;i<11;i++)   //降序排序 for(j=0;j<11-i;j++) if(s[j]<s[j+1]) t=s[j],s[j]=s[j+1];s[j+1]=t; printf("請輸出按降序排列后的統計量:/n"); for(i=0;i<12;i++)   //輸出排列后的各月總門診量 printf("%d/t",s[i]); printf("/n");}/*統計各單位員工的總門診量并按降序排列后輸出*/        void SortTotal(units *head){ units *p=head,*q; diseases *pcrs; hospitals *phs; int count,i,j,t,len=0; while(p!=NULL) {  //計算各單位員工的總門診量 p->total=0; count=0; pcrs=p->head_disease; while(pcrs!=NULL) { phs=pcrs->head_hosp; while(phs!=NULL) { count++; phs=phs->next; } pcrs=pcrs->next; } p->total=count;               printf("%s/t",p->unit);  //輸出各個單位名稱 p=p->next; } printf("/n"); p=head;    //遍歷指針p指向頭指針 while(p!=NULL) {   //輸出統計數 printf("%d/t",p->total); p=p->next; } printf("/n"); p=head; while(p!=NULL) {   //計算單位信息鏈表長度 len++; p=p->next; } for(i=0,p=head;i<len-1;i++,p=p->next) //對統計量降序排序      for(j=i+1,q=p->next;j<len;j++,q=q->next) if(p->total<q->total) { t=p->total; p->total=q->total; q->total=t; } p=head; printf("請輸出按降序排列后的統計量:/n"); while(p!=NULL) {   //輸出排序后的統計量 printf("%d/t",p->total); p=p->next; } printf("/n");}//統計各單位員工總人數并輸出         void Sortpeople(units *head){ units *p=head; diseases *pcrs; int count; while(p!=NULL) { p->total=0; count=0; pcrs=p->head_disease; while(pcrs!=NULL) { count++; pcrs=pcrs->next; } p->total=count; p=p->next; } p=head; while(p!=NULL) { printf("輸出單位名稱:%s",p->unit); printf("統計單位總人數:%d/n",p->total); p=p->next; }}

更多學習資料請關注專題《管理系統開發》。

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持武林網。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb
久久久久久久久91| 国产精品一区二区久久精品| www高清在线视频日韩欧美| 日本成人黄色片| 久久九九亚洲综合| 国产亚洲一级高清| 欧美激情免费看| 人妖精品videosex性欧美| 亚洲精品动漫久久久久| 欧美激情一区二区三区在线视频观看| 亚洲国产日韩一区| 亚洲女同精品视频| 日韩精品免费在线视频观看| 性色av一区二区三区| 中文字幕精品在线视频| 国产成人精品a视频一区www| 国产精品免费一区二区三区都可以| 成人网址在线观看| 国内精品久久久久伊人av| 亚洲护士老师的毛茸茸最新章节| 国内精品模特av私拍在线观看| 亚洲精品美女在线| 日韩成人在线观看| 精品网站999www| 韩国福利视频一区| 国产精品亚洲第一区| 精品人伦一区二区三区蜜桃免费| 日韩av电影在线网| 国产精品在线看| 亚洲va久久久噜噜噜| 91最新在线免费观看| 狠狠躁天天躁日日躁欧美| 久久香蕉精品香蕉| 国产精品xxxxx| 国产精品久久久久高潮| 亚洲色图国产精品| 成人有码在线视频| 欧美黑人巨大xxx极品| 91久久久久久久久| 亲子乱一区二区三区电影| 日韩高清电影免费观看完整| 国产日韩在线一区| 欧美在线视频免费播放| 欧美色videos| 国产91色在线播放| 欧美高清视频在线观看| 国产69精品久久久| 亚洲精品福利在线观看| 色综合视频网站| 一本色道久久88综合日韩精品| 国产丝袜精品第一页| 国产福利视频一区| 国产成人精品久久久| 国产亚洲精品久久久久动| 91久久国产精品91久久性色| 国产自摸综合网| 日韩精品福利在线| 久久免费视频在线观看| 欧美一级在线播放| 国产精品成人av在线| 亚洲综合中文字幕68页| 成人黄在线观看| 亚洲free性xxxx护士hd| 国产第一区电影| 亚洲高清色综合| 成人高清视频观看www| 亚洲男女自偷自拍图片另类| 国产欧美一区二区三区在线看| 欧美国产日韩一区二区三区| 98视频在线噜噜噜国产| 97视频在线观看免费高清完整版在线观看| 日韩av大片免费看| 亚洲变态欧美另类捆绑| 伊人男人综合视频网| 欧美成人激情视频免费观看| 久久久久久久久久久成人| 欧美成年人网站| 欧美成人午夜剧场免费观看| 欧美一级bbbbb性bbbb喷潮片| 精品成人国产在线观看男人呻吟| 2019中文字幕免费视频| 九九热这里只有在线精品视| 久久亚洲春色中文字幕| 亚洲国产欧美一区二区三区同亚洲| 欧美激情精品久久久久久大尺度| 欧美电影第一页| 在线亚洲男人天堂| 青青久久av北条麻妃海外网| 日韩精品视频免费专区在线播放| 午夜精品美女自拍福到在线| 亚洲国产日韩一区| 国产成人拍精品视频午夜网站| 日本高清+成人网在线观看| 色阁综合伊人av| 国产成人精品免高潮在线观看| 欧美激情国产精品| 最近中文字幕日韩精品| 国产丝袜一区二区| 久久国产精品久久精品| 日本一区二三区好的精华液| 国产91精品在线播放| 亚洲第一精品夜夜躁人人躁| 久久成人精品电影| 日本韩国欧美精品大片卡二| 一本色道久久综合狠狠躁篇怎么玩| 欧美日韩久久久久| 久久久久久午夜| 欧美特黄级在线| 久久精品91久久久久久再现| 国产美女直播视频一区| 亚洲一区制服诱惑| 26uuu另类亚洲欧美日本一| 久久的精品视频| 91精品综合久久久久久五月天| 欧美一级淫片aaaaaaa视频| 2019中文字幕在线免费观看| 黑人欧美xxxx| 国产亚洲欧美另类中文| 久久综合伊人77777蜜臀| 国产精品青青在线观看爽香蕉| 久久视频在线观看免费| 一个人www欧美| 美女福利视频一区| 日韩中文字幕在线看| 欧美一级淫片aaaaaaa视频| 伊人久久久久久久久久| 91国自产精品中文字幕亚洲| 欧美日韩亚洲国产一区| 欧美日韩中文在线观看| 午夜精品福利在线观看| 亚洲国产古装精品网站| 欧美日韩亚洲系列| www.日韩视频| 亚洲一区中文字幕在线观看| 秋霞午夜一区二区| 91中文字幕在线| 欧美又大粗又爽又黄大片视频| 亚洲无限av看| 日韩欧美中文免费| 夜夜嗨av色一区二区不卡| 日韩视频永久免费观看| 国产午夜精品一区二区三区| 国内外成人免费激情在线视频| 国模私拍视频一区| 91色精品视频在线| 欧美一级片一区| 日本三级久久久| 亚洲国产精品人久久电影| 日韩中文理论片| 国产在线拍偷自揄拍精品| 欧美精品18videos性欧| 国产亚洲欧美另类中文| 久久久久久久久爱| 福利视频一区二区| 亚洲国产成人一区| 亚洲精品乱码久久久久久金桔影视| 久久69精品久久久久久国产越南| 亚洲国产欧美一区| 中文字幕亚洲激情| 欧美在线www| 一区二区三区四区精品| 91a在线视频| 亚洲国产精品久久久| 国产精品r级在线|