联系我们 - 广告服务 - 联系电话:
您的当前位置: > 综合 > > 正文

当前快播:【C++项目实战】门诊预约系统项目界面功能实现

来源:CSDN 时间:2022-12-28 14:21:01

目录


(相关资料图)

效果展示

四:门诊预约系统项目界面功能实现

11.CMainWin.h .cpp【系统主界面】

12.CAdminmainWin.h .cpp【管理员主界面】

13.CAdminuserqueryWin.h .cpp【管理员查询用户界面】

14.CAdmindoctorWin.h .cpp【管理员管理医生界面】

15.CAdmindoctorqueryWin.h .cpp【管理员查询医生界面】

16.CAdmindoctoraddWin.h .cpp【管理员新增医生界面】

17.CAdmindoctormodifyWin.h .cpp【管理员修改医生信息界面】

18.CAdmindepartmentWin.h .cpp【管理员查询科室界面】

19.CDoctormainWin.h .cpp【医生主界面】

20.CDoctormedicalinfoWin.h .cpp【医生的就诊信息界面】

21.CDoctormedicalrecWin.h .cpp【医生的就诊信息的就诊记录界面】

效果展示

本次项目工程量较大,源码分四篇呈现,另外三篇如下

C++项目-门诊预约系统1

C++项目-门诊预约系统3

C++项目-门诊预约系统4

四:门诊预约系统项目界面功能实现

11.CMainWin.h .cpp【系统主界面】

#ifndef CMAINWIN_H#define CMAINWIN_H#include"CWinBase.h"//继承窗口基类#include"CButton.h"//按钮类#include "CLabel.h"//标签类#include"CEdit.h"//编辑框类 //系统主窗口 继承 窗口基类class CMainWin:public CWinBase{public:CMainWin();//默认构造~CMainWin();//析构CMainWin(int x,int y,int w,int h);//带参构造//纯虚函数 子类各不相同 需要子类各自实现方法int doAction();//按键响应执行protected:private:    CLabel *titlezhu,*titlehao;//标签CButton *btnzhuce ,*btndenglu,*btntuichu;//按钮}; #endif

#include"CMainWin.h"//系统主窗口#include"CTools.h"//工具类#includeusing namespace std; //系统主窗口 继承 窗口基类[默认构造]CMainWin::CMainWin():CWinBase(){}//析构CMainWin::~CMainWin(){} //系统主窗口 继承 窗口基类[带参构造]CMainWin::CMainWin(int x,int y,int w,int h):CWinBase(x,y,w,h){//控件创建//标签    this->titlezhu = new CLabel(17,7,10,2,"欢迎来到门诊预约管理系统",LABEL);//0this->titlehao = new CLabel(33,19,10,2,"CSDN博主:顾城沐心",LABEL);//1//按钮this->btnzhuce = new CButton(19,9,8,3,"注册",BUTTON);//2this->btndenglu = new CButton(19,12,8,3,"登录",BUTTON); //3this->btntuichu = new CButton(19,15,8,3,"退出",BUTTON);//4 //添加控件到窗口中this->addControl(this->titlezhu);   this->addControl(this->titlehao);this->addControl(this->btnzhuce);this->addControl(this->btndenglu);this->addControl(this->btntuichu); } //按键响应执行int CMainWin::doAction(){switch(this->focusIndex){case 2:   return 1;//到注册界面case 3:    return 2;//到登录界面default:break;}return 0;}

12.CAdminmainWin.h .cpp【管理员主界面】

#ifndef CADMINMAINWIN_H#define CADMINMAINWIN_H#include"CWinBase.h"//继承窗口基类#include"CButton.h"//按钮类#include "CLabel.h"//标签类#include"CEdit.h"//编辑框类 //管理员主界面 继承 窗口基类class CAdminmainWin:public CWinBase{public:CAdminmainWin();//默认构造~CAdminmainWin();//析构CAdminmainWin(int x,int y,int w,int h);//带参构造int doAction();//按键执行响应protected:private:    CLabel *titleguan,*titlehy,*titlerq;//标签CButton *btnyh ,*btnys,*btnks,*btnsj,*btntc;//按钮 }; #endif

#include"CAdminmainWin.h"//管理员主界面#include"CTools.h"//工具类#includeusing namespace std; //管理员主界面 继承 窗口基类[默认构造]CAdminmainWin::CAdminmainWin():CWinBase(){}//析构CAdminmainWin::~CAdminmainWin(){} //管理员主界面 继承 窗口基类[带参构造]CAdminmainWin::CAdminmainWin(int x,int y,int w,int h):CWinBase(x,y,w,h){//控件创建//标签    this->titleguan = new CLabel(21,7,10,2,"管理员主界面",LABEL);//0this->titlehy = new CLabel(8,10,10,2,"欢迎,1000管理员",LABEL);//1    this->titlerq = new CLabel(29,10,10,2,"日期",LABEL);//2//按钮this->btnyh = new CButton(10,11,8,3,"用户管理",BUTTON);//3this->btnys = new CButton(28,11,8,3,"医生管理",BUTTON); //4this->btnks = new CButton(10,14,8,3,"科室管理",BUTTON); //5this->btnsj = new CButton(28,14,8,3,"数据统计",BUTTON); //6this->btntc = new CButton(10,17,8,3,"退出",BUTTON); //7 //控件添加到窗口中this->addControl(this->titleguan);   this->addControl(this->titlehy);this->addControl(this->titlerq);this->addControl(this->btnyh);this->addControl(this->btnys);this->addControl(this->btnks); this->addControl(this->btnsj); this->addControl(this->btntc); } //管理员主界面  按键响应执行int CAdminmainWin::doAction(){switch(this->focusIndex){case 7:   return 2; //按角色登录界面 case 4:   return 15; //管理员管理医生界面 case 3:   return 17; //管理员查询用户界面case 5:   return 18; //管理员查询科室界面default:break;}return 3;//管理员主界面}

13.CAdminuserqueryWin.h .cpp【管理员查询用户界面】

#ifndef CADMINUSERQUERYWIN_H#define CADMINUSERQUERYWIN_H#include"CWinBase.h"//继承窗口基类#include"CButton.h"//按钮类#include "CLabel.h"//标签类#include"CEdit.h"//编辑框类#include"CTable.h"//表格类 //管理员查询用户窗口 继承 窗口基类class CAdminuserqueryWin:public CWinBase{public:CAdminuserqueryWin();//默认构造~CAdminuserqueryWin();//析构CAdminuserqueryWin(int x,int y,int w,int h);//带参构造 int doAction();//按键执行响应 void showWindow();//显示窗口 虚函数 虚virtual标识符在窗口基类写[其他地方不写] int WinRun();//窗口运行 虚函数 虚virtual标识符在窗口基类写[其他地方不写]protected:private:    CLabel *titlehyld,*titlehy,*titlerq,*titlesryhid,*titlefy;//标签 CButton *btnchaxun ,*btnfanhui;//按钮CEdit *editsryhid;//编辑框Table *table;//表格}; #endif

#pragma warning(disable :4786)#include"CAdminuserqueryWin.h"//管理员查询用户#include"CTools.h"//工具类#include"CData.h"//公共数据类#include"CTable.h"//表格类#include#include#include#includeusing namespace std;#include//管理员查询用户窗 继承 窗口基类[默认构造]CAdminuserqueryWin::CAdminuserqueryWin():CWinBase(){}//析构CAdminuserqueryWin::~CAdminuserqueryWin(){} //管理员查询用户窗 继承 窗口基类[带参构造]CAdminuserqueryWin::CAdminuserqueryWin(int x,int y,int w,int h):CWinBase(x,y,w,h){//创建控件//标签    this->titlehyld = new CLabel(25,7,34,4,"欢迎来到门诊预约管理系统",LABEL);//0this->titlehy = new CLabel(8,10,10,2,"欢迎,1000管理员",LABEL);//1    this->titlerq = new CLabel(39,10,10,2,"日期",LABEL);//2this->titlesryhid = new CLabel(9,13,10,2,"请输入用户账号:",LABEL);//3    this->titlefy = new CLabel(42,33,10,2,"按<- -="">翻页",LABEL);//4//编辑框this->editsryhid = new CEdit(26,12,10,3,"",11,2,1,EDIT);//5//按钮this->btnchaxun = new CButton(44,12,10,3,"查询",BUTTON); //6this->btnfanhui = new CButton(9,32,10,3,"返回",BUTTON); //7//表格表头设置vectorheader;    header.push_back("账号");header.push_back("身份信息");//添加控件this->addControl(this->titlehyld);   this->addControl(this->titlehy);this->addControl(this->titlerq);this->addControl(this->titlesryhid);this->addControl(this->titlefy);this->addControl(this->editsryhid);this->addControl(this->btnchaxun);this->addControl(this->btnfanhui);//创建 表格this->table=new Table(7,18,31,10,4,2,header);} //按键执行响应[可以操作表格;在表格中显示数据]int CAdminuserqueryWin::doAction(){    map::iterator it;switch(this->focusIndex){case 7: //返回return 3;  //管理员主界面case 6: //查询for(it=CData::userMap.begin();it!=CData::userMap.end();it++){if(strstr(it->second.getphoneNum().c_str(),this->editsryhid->getContent())!=NULL)//查询{  this->table->clearTable();//清空表格      this->table->show();//显示表格  CTools::gotoxy(9,22);      cout<second.getphoneNum().c_str()second.getphoneNum().c_str(),this->editsryhid->getContent())!=0)//查询{  CTools::gotoxy(10,15);      cout<<"没有找到该用户信息"clear();this->WinRun();return this->doAction();*/default:break;}return 17;//管理员查询用户界面} //显示窗口[虚函数]void CAdminuserqueryWin::showWindow(){//显示大框  显示每个控件CTools::paintWindow(this->startX,this->startY,this->width,this->height);for(int i=0;ictrlCount;i++){this->ctrlArr[i]->show();  //执行基类的show函数}char buf[15]={0};strcpy(buf,CTools::showTime());CTools::gotoxy(this->startX+this->width+6,10);coutshowData();} //窗口运行[虚函数][添加左右键 用于表格查看]int CAdminuserqueryWin::WinRun(){int i=0,key=0;int a,b;for(i=0;ictrlCount;i++){if(this->ctrlArr[i]->getType()==EDIT||this->ctrlArr[i]->getType()==BUTTON){CTools::gotoxy(this->ctrlArr[i]->getX()+2,this->ctrlArr[i]->getY()+1);break;}}while(1){key=CTools::getkey();switch(key){case KEY_DOWN://向下按键  查找下一个编辑框 按钮i++;//按键数组下标越界if(i==this->ctrlCount){i=0;//为了避免下标越界 从头开始对控件结构体数组找编辑框 按钮}for(;ictrlCount;i++){if(this->ctrlArr[i]->getType()==EDIT){CTools::gotoxy(this->ctrlArr[i]->getX()+2+strlen(this->ctrlArr[i]->getContent()),this->ctrlArr[i]->getY()+1);break;}else if(this->ctrlArr[i]->getType()==BUTTON){CTools::gotoxy(this->ctrlArr[i]->getX()+(this->ctrlArr[i]->getW()-strlen(this->ctrlArr[i]->getContent())/2),this->ctrlArr[i]->getY()+1);break;}}break;case KEY_UP:i--;if(i==-1)  //从后往前找 数组起始0 i--为-1 数组下标由大到小 (控件数组下标0位置){i=this->ctrlCount-1;  //控件个数(控件结构体数组下标最大)-1 (控件数组下标ctrlCount位置)}for(;i>0;i--){if(this->ctrlArr[i]->getType()==EDIT){CTools::gotoxy(this->ctrlArr[i]->getX()+2+strlen(this->ctrlArr[i]->getContent()),this->ctrlArr[i]->getY()+1);break;}else if(this->ctrlArr[i]->getType()==BUTTON){CTools::gotoxy(this->ctrlArr[i]->getX()+(this->ctrlArr[i]->getW()-strlen(this->ctrlArr[i]->getContent())/2),this->ctrlArr[i]->getY()+1);break;}if(i==0)  //第一个 若第一个不是编辑框 按钮{i=this->ctrlCount;  //就从最后一个往前查找 for循环中有i--,不用再-1}}break;case KEY_LEFT:a=this->table->getcurPage();b=this->table->getsumPage();if(a<=b&&a>1){a--;this->table->setCurpage(a);this->table->clearTable();this->table->show();this->table->showData();}break;case KEY_RIGHT:a=this->table->getcurPage();b=this->table->getsumPage();if(atable->setCurpage(a);this->table->clearTable();this->table->show();this->table->showData();}break;case KEY_ENTER:if(this->ctrlArr[i]->getType()==BUTTON){this->focusIndex=i;return doAction();//返回切换到的界面的下标//获取winRun中输入的编辑框的值}break;default:   //其他字符(不是按键)并且当前控件是编辑框if(this->ctrlArr[i]->getType()==EDIT){if(key==KEY_BACKSPACE)//执行回删{this->ctrlArr[i]->backSpace();}else{this->ctrlArr[i]->keyListen(key);}}break;}}}

14.CAdmindoctorWin.h .cpp【管理员管理医生界面】

#ifndef CADMINDOCTORWIN_H#define CADMINDOCTORWIN_H#include"CWinBase.h"//继承窗口基类#include"CButton.h"//按钮类#include "CLabel.h"//标签类#include"CEdit.h"//编辑框类 //管理员管理医生窗 继承 窗口基类class CAdmindoctorWin:public CWinBase{public:CAdmindoctorWin();//默认构造~CAdmindoctorWin();//析构CAdmindoctorWin(int x,int y,int w,int h);//带参构造int doAction();//按键执行响应protected:private:CLabel *titleysgl,*titlehy;//标签CButton *btnyscx ,*btnxzys,*btnysxxxg,*btnfanhui;//按钮};#endif

#include"CAdmindoctorWin.h"//管理员管理医生#include"CTools.h"//工具类#include"CData.h"//公共数据类#includeusing namespace std; //管理员管理医生窗 继承 窗口基类[默认构造]CAdmindoctorWin::CAdmindoctorWin():CWinBase(){}//析构CAdmindoctorWin::~CAdmindoctorWin(){} //管理员管理医生窗 继承 窗口基类[带参构造]CAdmindoctorWin::CAdmindoctorWin(int x,int y,int w,int h):CWinBase(x,y,w,h){//创建控件//按钮this->btnyscx = new CButton(8,15,10,3,"医生查询",BUTTON); //0this->btnxzys = new CButton(28,15,10,3,"新增医生",BUTTON); //1this->btnysxxxg = new CButton(8,18,10,3,"医生信息修改",BUTTON);//2this->btnfanhui = new CButton(18,23,10,3,"返回",BUTTON); //3    //标签this->titleysgl =  new CLabel(21,7,34,4,"医生管理界面",LABEL);//4this->titlehy = new CLabel(8,10,10,2,"欢迎,1000管理员",LABEL);//5//添加控件到窗口this->addControl(this->btnyscx); this->addControl(this->btnxzys);this->addControl(this->btnysxxxg); this->addControl(this->btnfanhui);this->addControl(this->titleysgl);this->addControl(this->titlehy); } //按键响应执行int CAdmindoctorWin::doAction(){switch(this->focusIndex){case 3: return 3;  //管理员主界面case 1: return 14;  //新增医生主界面case 0: return 16;  //医生查询主界面case 2: return 22;  //医生信息修改主界面default:break;}return 15;//管理员管医生界面}

15.CAdmindoctorqueryWin.h .cpp【管理员查询医生界面】

#ifndef CADMINDOCTORQUERYWIN_H#define CADMINDOCTORQUERYWIN_H#include"CWinBase.h"//继承窗口基类#include"CButton.h"//按钮#include "CLabel.h"//标签#include"CEdit.h"//编辑框#include"CTable.h"//表格 //管理员查询医生窗 继承 窗口基类class CAdmindoctorqueryWin:public CWinBase{public:CAdmindoctorqueryWin();//默认构造~CAdmindoctorqueryWin();//析构CAdmindoctorqueryWin(int x,int y,int w,int h);//带参构造 int doAction();//按键执行响应[纯虚函数] void showWindow();//窗口显示[虚函数] int WinRun();//窗口运行[虚函数]protected:private:    CLabel *titlehyld,*titlehy,*titlerq,*titlesrysid,*titlefy,*titlexzsj;//标签 CButton *btnchaxun ,*btnfanhui;//按钮CEdit *editsrysid;//编辑框Table *table;//表格}; #endif

#pragma warning(disable :4786)#include"CAdmindoctorqueryWin.h"//管理员查询医生#include"CTools.h"//工具类#include"CData.h"//公共数据类#include"CTable.h"//表格类#include#include#include#include#includeusing namespace std; //管理员查询医生 继承窗口基类[默认构造]CAdmindoctorqueryWin::CAdmindoctorqueryWin():CWinBase(){}//析构CAdmindoctorqueryWin::~CAdmindoctorqueryWin(){} //管理员查询医生 继承窗口基类[带参构造]CAdmindoctorqueryWin::CAdmindoctorqueryWin(int x,int y,int w,int h):CWinBase(x,y,w,h){//控件创建//标签    this->titlehyld = new CLabel(25,7,34,4,"欢迎来到门诊预约管理系统",LABEL);//0this->titlehy = new CLabel(8,10,10,2,"欢迎,1000管理员",LABEL);//1    this->titlerq = new CLabel(39,10,10,2,"日期",LABEL);//2this->titlesrysid = new CLabel(9,13,10,2,"请输入医生ID:",LABEL);//3    this->titlefy = new CLabel(42,33,10,2,"按<- -="">翻页",LABEL);//4    this->titlexzsj = new CLabel(42,35,10,2,"按上 下选择数据",LABEL);//5//编辑框this->editsrysid = new CEdit(24,12,10,3,"",11,2,1,EDIT);//6//按钮this->btnchaxun = new CButton(42,12,10,3,"查询",BUTTON); //7this->btnfanhui = new CButton(9,34,10,3,"返回",BUTTON); //8 //表格表头设置vectorheader;header.push_back("医生ID");header.push_back("医生姓名");header.push_back("职位");header.push_back("所属科室");header.push_back("所属医院");header.push_back("简介"); //添加控件到窗口this->addControl(this->titlehyld);   this->addControl(this->titlehy);this->addControl(this->titlerq);this->addControl(this->titlesrysid);this->addControl(this->titlefy);this->addControl(this->titlexzsj);this->addControl(this->editsrysid);this->addControl(this->btnchaxun);this->addControl(this->btnfanhui); //创建表格this->table = new Table(5,18,31,10,4,6,header);} //按键执行响应[可以操作表格;在表格中显示数据]int CAdmindoctorqueryWin::doAction(){char str[10]={0};map::iterator it;switch(this->focusIndex){case 8: //返回return 15;  //管理医生主界面case 7:for(it=CData::doctorMap.begin();it!=CData::doctorMap.end();it++){itoa(it->second.getID(),str,10);if(strstr(str,this->editsrysid->getContent())!=NULL){   this->table->clearTable();   this->table->show();   CTools::gotoxy(9,22);       cout<second.getID()<<ENDL; cout<second.getName().c_str()<<ENDL; cout<second.getPosition().c_str()<<ENDL; cout<second.getDepartment().c_str()<<ENDL; cout<second.getHospital().c_str()startX,this->startY,this->width,this->height);for(int i=0;ictrlCount;i++){this->ctrlArr[i]->show();//执行基类的show函数}//窗口中显示时间char buf[15]={0};strcpy(buf,CTools::showTime());CTools::gotoxy(this->startX+this->width+6,10);coutshowdoctorData();} //窗口运行 [虚函数] [左右按键操作表格]int CAdmindoctorqueryWin::WinRun(){int i=0,key=0;int a,b;for(i=0;ictrlCount;i++){if(this->ctrlArr[i]->getType()==EDIT||this->ctrlArr[i]->getType()==BUTTON){CTools::gotoxy(this->ctrlArr[i]->getX()+2,this->ctrlArr[i]->getY()+1);break;}}while(1){key=CTools::getkey();switch(key){case KEY_DOWN://向下按键  查找下一个编辑框 按钮i++;//按键数组下标越界if(i==this->ctrlCount){i=0;//为了避免下标越界 从头开始对控件结构体数组找编辑框 按钮}for(;ictrlCount;i++){if(this->ctrlArr[i]->getType()==EDIT){CTools::gotoxy(this->ctrlArr[i]->getX()+2+strlen(this->ctrlArr[i]->getContent()),this->ctrlArr[i]->getY()+1);break;}else if(this->ctrlArr[i]->getType()==BUTTON){CTools::gotoxy(this->ctrlArr[i]->getX()+(this->ctrlArr[i]->getW()-strlen(this->ctrlArr[i]->getContent())/2),this->ctrlArr[i]->getY()+1);break;}}break;case KEY_UP:i--;if(i==-1)  //从后往前找 数组起始0 i--为-1 数组下标由大到小 (控件数组下标0位置){i=this->ctrlCount-1;  //控件个数(控件结构体数组下标最大)-1 (控件数组下标ctrlCount位置)}for(;i>0;i--){if(this->ctrlArr[i]->getType()==EDIT){CTools::gotoxy(this->ctrlArr[i]->getX()+2+strlen(this->ctrlArr[i]->getContent()),this->ctrlArr[i]->getY()+1);break;}else if(this->ctrlArr[i]->getType()==BUTTON){CTools::gotoxy(this->ctrlArr[i]->getX()+(this->ctrlArr[i]->getW()-strlen(this->ctrlArr[i]->getContent())/2),this->ctrlArr[i]->getY()+1);break;}if(i==0)  //第一个 若第一个不是编辑框 按钮{i=this->ctrlCount;  //就从最后一个往前查找 for循环中有i--,不用再-1}}break;case KEY_LEFT:a=this->table->getcurPage();b=this->table->getsumPage();if(a<=b&&a>1){a--;this->table->setCurpage(a);this->table->clearTable();this->table->show();this->table->showdoctorData();}break;case KEY_RIGHT:a=this->table->getcurPage();b=this->table->getsumPage();if(atable->setCurpage(a);this->table->clearTable();this->table->show();this->table->showdoctorData();}break;case KEY_ENTER:if(this->ctrlArr[i]->getType()==BUTTON){this->focusIndex=i;return doAction();//返回切换到的界面的下标//获取winRun中输入的编辑框的值}break;default:   //其他字符(不是按键)并且当前控件是编辑框if(this->ctrlArr[i]->getType()==EDIT){if(key==KEY_BACKSPACE)//执行回删{this->ctrlArr[i]->backSpace();}else{this->ctrlArr[i]->keyListen(key);}}break;}}}

16.CAdmindoctoraddWin.h .cpp【管理员新增医生界面】

#ifndef CADMINDOCTORADDWIN_H#define CADMINDOCTORADDWIN_H#include"CWinBase.h"//继承窗口基类#include"CButton.h"//按钮#include "CLabel.h"//标签#include"CEdit.h"//编辑框 //管理员新增医生窗 继承 窗口基类class CAdmindoctoraddWin:public CWinBase{public:CAdmindoctoraddWin();//默认构造~CAdmindoctoraddWin();//析构CAdmindoctoraddWin(int x,int y,int w,int h);//带参构造 int doAction();//按键响应执行[纯虚函数] void showWindow();//显示窗口[虚函数]protected:private:    CLabel *titlehyld,*titlehy,*titlerq,*titleysid,*titleysxm,*titlessyy,*titlessks,*titleyszw ,*titlejianjie,*titleslyy,*titlets1,*titlets2,*titlets3;//标签CButton *btnqueding ,*btnfanhui;//按钮CEdit *editysxm,*editssyy,*editssks,*edityszw,*editjianjie;//编辑框}; #endif

#pragma warning(disable :4786)#include"CAdmindoctoraddWin.h"//管理员新增医生窗#include"CTools.h"//工具类#include"CData.h"//公共数据类#include"CDoctor.h"//医生类#includeusing namespace std; //管理员新增医生窗 继承 窗口基类[默认构造]CAdmindoctoraddWin::CAdmindoctoraddWin():CWinBase(){}//析构CAdmindoctoraddWin::~CAdmindoctoraddWin(){} //管理员新增医生窗 继承 窗口基类[带参构造]CAdmindoctoraddWin::CAdmindoctoraddWin(int x,int y,int w,int h):CWinBase(x,y,w,h){//创建控件//标签    this->titlehyld = new CLabel(15,7,34,4,"欢迎来到门诊预约管理系统",LABEL);//0this->titlehy = new CLabel(8,10,10,2,"欢迎,1000管理员",LABEL);//1    this->titlerq = new CLabel(39,10,10,2,"日期",LABEL);//2this->titleysid = new CLabel(9,15,10,2,"医生ID:",LABEL);//3    this->titleysxm = new CLabel(9,18,10,2,"医生姓名",LABEL);//4    this->titlessyy = new CLabel(9,21,10,2,"所属医院",LABEL);//5this->titlessks = new CLabel(9,24,10,2,"所属科室",LABEL);//6this->titleyszw = new CLabel(9,27,10,2,"医生职位",LABEL);//7this->titlejianjie = new CLabel(9,30,10,2,"简介",LABEL);//8//编辑框this->editysxm = new CEdit(21,17,10,3,"",11,3,1,EDIT);//9this->editssyy = new CEdit(21,20,10,3,"",11,2,1,EDIT);//10this->editssks = new CEdit(21,23,10,3,"",11,2,1,EDIT);//11this->edityszw = new CEdit(21,26,10,3,"",11,2,1,EDIT);//12this->editjianjie = new CEdit(21,29,20,4,"",11,3,1,EDIT);//13//按钮this->btnqueding = new CButton(8,33,10,3,"确定",BUTTON); //14this->btnfanhui = new CButton(28,33,10,3,"返回",BUTTON); //15//标签this->titleslyy = new CLabel(25,21,10,2,"省立医院",LABEL);//16this->titlets1 = new CLabel(42,26,10,2,"4:专家;5:主任医师",LABEL);//17this->titlets2 = new CLabel(42,28,10,2,"6:副主任;7:主治医师",LABEL);//18this->titlets3 = new CLabel(42,24,10,2,"8:内科;9:外科",LABEL);//添加控件到窗口中this->addControl(this->titlehyld);   this->addControl(this->titlehy);this->addControl(this->titlerq);this->addControl(this->titleysid);this->addControl(this->titleysxm);this->addControl(this->titlessyy);this->addControl(this->titlessks);this->addControl(this->titleyszw);this->addControl(this->titlejianjie); this->addControl(this->editysxm);this->addControl(this->editssyy);this->addControl(this->editssks);this->addControl(this->edityszw);this->addControl(this->editjianjie);this->addControl(this->btnqueding); this->addControl(this->btnfanhui); this->addControl(this->titleslyy);this->addControl(this->titlets1); this->addControl(this->titlets2);this->addControl(this->titlets3); } //按键响应执行 [纯虚函数]int CAdmindoctoraddWin::doAction(){map::iterator it;switch(this->focusIndex){case 15: return 15;  //管理医生主界面case 14: //首先输入医生姓名 所属科室 医生职位 简介内容不能为空if(strlen(this->editysxm->getContent())==0||strlen(this->editssks->getContent())==0||strlen(this->edityszw->getContent())==0||strlen(this->editjianjie->getContent())==0){CTools::gotoxy(10,12);cout<<"医生姓名或所属科室或医生职位或简介内容不能为空,请输入"clear();this->editssks->clear();this->edityszw->clear();this->editjianjie->clear();system("pause");return 14;}//要求医生姓名中文 长度2-10位if(strlen(this->editysxm->getContent())<4||strlen(this->editysxm->getContent())>20){cout<<"医生姓名长度要求为2-10位,请重新输入"clear();this->editssks->clear();this->edityszw->clear();this->editjianjie->clear();system("pause");return 14;}  //int ID,string name,string pwd,string jianjie,string hospital,//string position,string department,int roleCData::doctorMap.insert(make_pair(CData::Nowdoctor,Doctor(CData::Nowdoctor,this->editysxm->getContent(),"123456",this->editjianjie->getContent(),"省立医院",this->edityszw->getContent(),this->editssks->getContent(),DOCTOR))); CData::addDoctor(Doctor(CData::Nowdoctor,this->editysxm->getContent(),"123456",this->editjianjie->getContent(),"省立医院",this->edityszw->getContent(),this->editssks->getContent(),DOCTOR));CData::Nowdoctor++;CTools::gotoxy(10,25); cout<<"新增医生成功,请稍等"clear();this->editssks->clear();this->edityszw->clear();this->editjianjie->clear();system("pause");return 14;//用户添加医生界面default:break;}return 14;//管理员新增医生界面} //窗口显示[虚函数][显示时间&当前医生的ID]void CAdmindoctoraddWin::showWindow(){//显示大框  显示每个控件CTools::paintWindow(this->startX,this->startY,this->width,this->height);for(int i=0;ictrlCount;i++){//基类指针操作派生类成员函数//虚函数 让每一个子类的函数都能够去调用//通过基类指针 或 引用调用虚函数 触发动态绑定this->ctrlArr[i]->show();  //执行基类的show函数}//显示时间char buf[15]={0};strcpy(buf,CTools::showTime());CTools::gotoxy(this->startX+this->width+6,10);cout<<BUF<<ENDL; 显示当前医生的idctools::gotoxy(22,15);cout<<cdata::nowdoctor<<endl;="" }

17.CAdmindoctormodifyWin.h .cpp【管理员修改医生信息界面】

#ifndef CADMINDOCTORMODIFYWIN_H#define CADMINDOCTORMODIFYWIN_H#include"CWinBase.h"//继承窗口基类#include"CButton.h"//按钮#include "CLabel.h"//标签#include"CEdit.h"//编辑框 //管理员修改医生信息窗 继承 窗口基类class CAdmindoctormodifyWin:public CWinBase{public:CAdmindoctormodifyWin();//默认构造~CAdmindoctormodifyWin();//析构CAdmindoctormodifyWin(int x,int y,int w,int h);//带参构造int doAction();//按键执行响应[纯虚函数]void showWindow();//窗口显示[虚函数]protected:private:    CLabel *titlehyld,*titlehy,*titlerq,*titleysid,*titleyzw,*titlexzw,*titleqrzw,*titlets1,*titlets2;//标签CButton *btnqueding ,*btnfanhui;//按钮CEdit *edityzw,*editxzw,*editqrzw,*editysid;//编辑框}; #endif

#include"CAdmindoctormodifyWin.h"//管理员修改医生信息窗#include"CTools.h"//工具类#include"CData.h"//公共数据类#include"CDoctor.h"//医生类#includeusing namespace std;#include#include#include#include//管理员修改医生信息窗 继承窗口基类 [默认构造]CAdmindoctormodifyWin::CAdmindoctormodifyWin():CWinBase(){}//析构CAdmindoctormodifyWin::~CAdmindoctormodifyWin(){}//管理员修改医生信息窗 继承窗口基类 [带参构造]CAdmindoctormodifyWin::CAdmindoctormodifyWin(int x,int y,int w,int h):CWinBase(x,y,w,h){//创建控件//标签    this->titlehyld = new CLabel(15,7,34,4,"修改医生信息窗口",LABEL);//0this->titlehy = new CLabel(8,10,10,2,"欢迎,1000 管理员",LABEL);//1    this->titlerq = new CLabel(39,10,10,2,"日期",LABEL);//2this->titleysid = new CLabel(9,12,10,2,"医生ID",LABEL);//3    this->titleyzw = new CLabel(9,15,10,2,"原职位",LABEL);//4    this->titlexzw = new CLabel(9,18,10,2,"新职位",LABEL);//5this->titleqrzw = new CLabel(9,21,10,2,"确认职位",LABEL);//6//编辑框this->editysid = new CEdit(21,11,10,3,"",4,2,1,EDIT);//7this->edityzw = new CEdit(21,14,10,3,"",1,2,1,EDIT);//8this->editxzw = new CEdit(21,17,10,3,"",1,2,1,EDIT);//9this->editqrzw = new CEdit(21,20,10,3,"",1,2,1,EDIT);//10//按钮this->btnqueding = new CButton(8,23,10,3,"确定",BUTTON); //11this->btnfanhui = new CButton(28,23,10,3,"返回",BUTTON); //12//标签this->titlets1 = new CLabel(42,15,10,2,"4:专家;5:主任医师",LABEL);//13this->titlets2 = new CLabel(42,17,10,2,"6:副主任;7:主治医师",LABEL);//14//添加控件this->addControl(this->titlehyld);   this->addControl(this->titlehy);this->addControl(this->titlerq);this->addControl(this->titleysid);this->addControl(this->titleyzw);this->addControl(this->titlexzw);this->addControl(this->titleqrzw);this->addControl(this->editysid);this->addControl(this->edityzw); this->addControl(this->editxzw);this->addControl(this->editqrzw);this->addControl(this->btnqueding); this->addControl(this->btnfanhui);this->addControl(this->titlets1); this->addControl(this->titlets2);} //按键执行响应int CAdmindoctormodifyWin::doAction(){map::iterator it;switch(this->focusIndex){case 12: return 15;//管理员管理医生界面case 11://确认职位//判断输入编辑框内容是否为空if(strlen(this->editysid->getContent())==0||strlen(this->edityzw->getContent())==0||strlen(this->editxzw->getContent())==0||strlen(this->editqrzw->getContent())==0){cout<<"医生id或原职位或新职位或确认职位不能为空,请输入"clear();this->edityzw->clear();this->editxzw->clear();this->editqrzw->clear();system("pause");return 22;}//输入两次职位是否一致if(atoi(this->editxzw->getContent())!=atoi(this->editqrzw->getContent())){cout<<"输入的两次职位不一致,请重新输入"clear();this->edityzw->clear();this->editxzw->clear();this->editqrzw->clear();system("pause");return 22;}//找到输入医生id与数据医生id一致可以修改该医生的信息//if(strcmp(this->editysid->getContent(),it->first)==0)for(it=CData::doctorMap.begin();it!=CData::doctorMap.end();it++){if(atoi(this->editysid->getContent())==it->first){//更新医生map//set方法获取编辑框内容it->second.setPosition(this->editxzw->getContent());//重新文件CData::writeDoctor();CTools::gotoxy(10,25);cout<<"修改医生职位成功"clear();this->edityzw->clear();this->editxzw->clear();this->editqrzw->clear();system("pause");return 22;}} default:break;}return 22;//修改医生职位界面} //窗口显示[虚函数]  [显示时间]void CAdmindoctormodifyWin::showWindow(){//显示大框  显示每个控件CTools::paintWindow(this->startX,this->startY,this->width,this->height);for(int i=0;ictrlCount;i++){this->ctrlArr[i]->show();  //执行基类的show函数}//显示时间char buf[15]={0};strcpy(buf,CTools::showTime());CTools::gotoxy(this->startX+this->width+6,10);cout<<BUF<<ENDL; }

18.CAdmindepartmentWin.h .cpp【管理员查询科室界面】

#ifndef CADMINDEPARTMENTWIN_H#define CADMINDEPARTMENTWIN_H#include"CWinBase.h"//继承窗口基类#include"CButton.h"//按钮#include "CLabel.h"//标签#include"CEdit.h"//编辑框#include"CTable.h"//表格 //管理员查询科室窗 继承 窗口基类class CAdmindepartmentWin:public CWinBase{public:CAdmindepartmentWin();//默认构造~CAdmindepartmentWin();//析构CAdmindepartmentWin(int x,int y,int w,int h);//带参构造 int doAction();//按键响应执行[纯虚函数] void showWindow();//显示窗口[虚函数] int WinRun();//窗口运行[虚函数]protected:private:    CLabel *titlehyld,*titlehy,*titlerq,*titlesrksid,*titlefy;//标签 CButton *btnchaxun ,*btnfanhui,*btnxzks;//按钮CEdit *editsrksid;//编辑框Table *table;//表格}; #endif

#pragma warning(disable :4786)#include"CAdmindepartmentWin.h"//管理员查询科室窗#include"CTools.h"//工具类#include"CData.h"//公共数据类#include"CTable.h"//表格类#include#include#include#include#includeusing namespace std; //管理员查询科室窗 继承 窗口基类[默认构造]CAdmindepartmentWin::CAdmindepartmentWin():CWinBase(){}//析构CAdmindepartmentWin::~CAdmindepartmentWin(){} //管理员查询科室窗 继承 窗口基类[带参构造]CAdmindepartmentWin::CAdmindepartmentWin(int x,int y,int w,int h):CWinBase(x,y,w,h){//创建控件//标签    this->titlehyld = new CLabel(25,7,34,4,"欢迎来到门诊预约管理系统",LABEL);//0this->titlehy = new CLabel(8,10,10,2,"欢迎,1000管理员",LABEL);//1    this->titlerq = new CLabel(49,10,10,2,"日期",LABEL);//2this->titlesrksid = new CLabel(9,13,10,2,"请输入科室ID:",LABEL);//3    this->titlefy = new CLabel(42,33,10,2,"按<- -="">翻页",LABEL);//4//编辑框this->editsrksid = new CEdit(24,12,10,3,"",11,2,1,EDIT);//5//按钮this->btnchaxun = new CButton(42,12,10,3,"查询",BUTTON); //6this->btnxzks = new CButton(61,12,10,3,"新增科室",BUTTON); //7this->btnfanhui = new CButton(9,32,10,3,"返回",BUTTON); //8 //表格表头设计vectorheader;header.push_back("科室ID");header.push_back("科室名称");header.push_back("科室说明");//添加控件到窗口中this->addControl(this->titlehyld);   this->addControl(this->titlehy);this->addControl(this->titlerq);this->addControl(this->titlesrksid);this->addControl(this->titlefy);this->addControl(this->editsrksid);this->addControl(this->btnchaxun);this->addControl(this->btnxzks);this->addControl(this->btnfanhui);//表格创建 this->table = new Table(7,18,26,10,4,3,header);  } //按键执行响应int CAdmindepartmentWin::doAction(){map::iterator it;switch(this->focusIndex){case 8: //返回return 3;//管理员主界面case 6: //查询for(it=CData::departmentMap.begin();it!=CData::departmentMap.end();it++){if(strstr(it->second.getKsId().c_str(),this->editsrksid->getContent())!=NULL){this->table->clearTable();this->table->show();CTools::gotoxy(9,22);cout<second.getKsId().c_str()<<endl;ctools::gotoxy(26,22);cout<second.getKsName().c_str()startX,this->startY,this->width,this->height);for(int i=0;ictrlCount;i++){this->ctrlArr[i]->show();  //执行基类的show函数}//显示时间char buf[15]={0};strcpy(buf,CTools::showTime());CTools::gotoxy(this->startX+this->width+6,10);coutshowdepartmentData();} //窗口运行[虚函数][左右按键操作表格]int CAdmindepartmentWin::WinRun(){int i=0,key=0;int a,b;for(i=0;ictrlCount;i++){if(this->ctrlArr[i]->getType()==EDIT||this->ctrlArr[i]->getType()==BUTTON){CTools::gotoxy(this->ctrlArr[i]->getX()+2,this->ctrlArr[i]->getY()+1);break;}}while(1){key=CTools::getkey();switch(key){case KEY_DOWN://向下按键  查找下一个编辑框 按钮i++;//按键数组下标越界if(i==this->ctrlCount){i=0;//为了避免下标越界 从头开始对控件结构体数组找编辑框 按钮}for(;ictrlCount;i++){if(this->ctrlArr[i]->getType()==EDIT){CTools::gotoxy(this->ctrlArr[i]->getX()+2+strlen(this->ctrlArr[i]->getContent()),this->ctrlArr[i]->getY()+1);break;}else if(this->ctrlArr[i]->getType()==BUTTON){CTools::gotoxy(this->ctrlArr[i]->getX()+(this->ctrlArr[i]->getW()-strlen(this->ctrlArr[i]->getContent())/2),this->ctrlArr[i]->getY()+1);break;}}break;case KEY_UP:i--;if(i==-1)  //从后往前找 数组起始0 i--为-1 数组下标由大到小 (控件数组下标0位置){i=this->ctrlCount-1;  //控件个数(控件结构体数组下标最大)-1 (控件数组下标ctrlCount位置)}for(;i>0;i--){if(this->ctrlArr[i]->getType()==EDIT){CTools::gotoxy(this->ctrlArr[i]->getX()+2+strlen(this->ctrlArr[i]->getContent()),this->ctrlArr[i]->getY()+1);break;}else if(this->ctrlArr[i]->getType()==BUTTON){CTools::gotoxy(this->ctrlArr[i]->getX()+(this->ctrlArr[i]->getW()-strlen(this->ctrlArr[i]->getContent())/2),this->ctrlArr[i]->getY()+1);break;}if(i==0)  //第一个 若第一个不是编辑框 按钮{i=this->ctrlCount;  //就从最后一个往前查找 for循环中有i--,不用再-1}}break;case KEY_LEFT:a=this->table->getcurPage();b=this->table->getsumPage();if(a<=b&&a>1){a--;this->table->setCurpage(a);this->table->clearTable();this->table->show();this->table->showdepartmentData();}break;case KEY_RIGHT:a=this->table->getcurPage();b=this->table->getsumPage();if(atable->setCurpage(a);this->table->clearTable();this->table->show();this->table->showdepartmentData();}break;case KEY_ENTER:if(this->ctrlArr[i]->getType()==BUTTON){this->focusIndex=i;return doAction();//返回切换到的界面的下标//获取winRun中输入的编辑框的值}break;default:   //其他字符(不是按键)并且当前控件是编辑框if(this->ctrlArr[i]->getType()==EDIT){if(key==KEY_BACKSPACE)//执行回删{this->ctrlArr[i]->backSpace();}else{this->ctrlArr[i]->keyListen(key);}}break;}}}

19.CDoctormainWin.h .cpp【医生主界面】

#ifndef CDOCTORMAINWIN_H#define CDOCTORMAINWIN_H#include"CWinBase.h"//继承窗口基类#include"CButton.h"//按钮#include "CLabel.h"//标签#include"CEdit.h"//编辑框 //医生主界面窗 继承 窗口基类class CDoctormainWin:public CWinBase{public:CDoctormainWin();//默认构造~CDoctormainWin();//析构CDoctormainWin(int x,int y,int w,int h);//带参构造int doAction();//按键执行响应protected:private:    CLabel *titlehyld,*titlehy,*titlerq;//标签CButton *btngr ,*btnjz,*btntc;//按钮 }; #endif

#include"CDoctormainWin.h"//医生主界面窗#include"CTools.h"//工具类#includeusing namespace std; //医生主界面窗 继承 窗口基类[默认构造]CDoctormainWin::CDoctormainWin():CWinBase(){}//析构CDoctormainWin::~CDoctormainWin(){} //医生主界面窗 继承 窗口基类[带参构造]CDoctormainWin::CDoctormainWin(int x,int y,int w,int h):CWinBase(x,y,w,h){//创建控件//标签    this->titlehyld = new CLabel(15,7,34,4,"欢迎来到门诊预约管理系统",LABEL);//0this->titlehy = new CLabel(8,10,10,2,"欢迎,用户名,角色",LABEL);//1    this->titlerq = new CLabel(29,10,10,2,"日期",LABEL);//2//按钮this->btngr = new CButton(10,11,8,3,"个人中心",BUTTON);//3this->btnjz = new CButton(28,11,10,3,"就诊信息查询",BUTTON); //4this->btntc = new CButton(10,14,8,3,"退出",BUTTON); //5 //添加控件this->addControl(this->titlehyld);   this->addControl(this->titlehy);this->addControl(this->titlerq);this->addControl(this->btngr);this->addControl(this->btnjz);this->addControl(this->btntc); } //按键执行响应[纯虚函数]int CDoctormainWin::doAction(){switch(this->focusIndex){case 5:  return 2;//按角色登录界面    case 4:  return 20;//医生的就诊信息界面default:break;}return 5;//用户主界面}

20.CDoctormedicalinfoWin.h .cpp【医生的就诊信息界面】

#ifndef CDOCTORMEDICALINFOWIN_H#define CDOCTORMEDICALINFOWIN_H#include"CWinBase.h"//继承窗口基类#include"CButton.h"//按钮#include "CLabel.h"//标签#include"CEdit.h"//编辑框#include"CTable.h"//表格 //医生的就诊信息窗 继承 窗口基类class CDoctormedicalinfoWin:public CWinBase{public:CDoctormedicalinfoWin();//默认构造~CDoctormedicalinfoWin();//析构CDoctormedicalinfoWin(int x,int y,int w,int h);//带参构造int doAction();//按键执行响应void showWindow();//显示窗口int WinRun();//窗口运行protected:private:    CLabel *titlehyld,*titlehy,*titlerq,*titlefy,*titlexzsj;//标签CButton *btnfanhui,*btnjzjl;//按钮Table *table;//表格}; #endif

#pragma warning(disable :4786)#include"CDoctormedicalinfoWin.h"//医生的就诊信息窗口#include"CTools.h"//工具类#include"CData.h"//公共数据类#include"CTable.h"//表格类#include#include#include#include#includeusing namespace std; //医生的就诊信息窗 继承 窗口基类[默认构造]CDoctormedicalinfoWin::CDoctormedicalinfoWin():CWinBase(){}//析构CDoctormedicalinfoWin::~CDoctormedicalinfoWin(){}//医生的就诊信息窗 继承 窗口基类[带参构造]CDoctormedicalinfoWin::CDoctormedicalinfoWin(int x,int y,int w,int h):CWinBase(x,y,w,h){//创建控件//标签    this->titlehyld = new CLabel(25,7,34,4,"欢迎来到门诊预约管理系统",LABEL);//0this->titlehy = new CLabel(8,10,10,2,"欢迎,用户名,角色",LABEL);//1    this->titlerq = new CLabel(49,10,10,2,"日期",LABEL);//2    this->titlefy = new CLabel(50,30,10,2,"按<-- --="">翻页",LABEL);//3this->titlexzsj = new CLabel(50,33,10,2,"按下 上选择数据",LABEL);//4//按钮this->btnfanhui = new CButton(10,29,8,3,"返回",BUTTON); //5this->btnjzjl = new CButton(25,29,8,3,"医生就诊记录",BUTTON); //6 //表格表头设计vectorheader;header.push_back("编号");header.push_back("就诊用户ID");header.push_back("状态"); //添加控件到窗口中this->addControl(this->titlehyld);   this->addControl(this->titlehy);this->addControl(this->titlerq);this->addControl(this->titlefy);this->addControl(this->titlexzsj);this->addControl(this->btnfanhui);this->addControl(this->btnjzjl);//创建表格this->table = new Table(7,14,30,10,4,3,header);} //窗口执行响应[纯虚函数]int CDoctormedicalinfoWin::doAction(){switch(this->focusIndex){case 5:   return 4;//医生主界面case 6:   return 21;//医生的就诊信息的就诊记录default:break;}return 20;//医生的就诊信息界面} //窗口显示 [虚函数]void CDoctormedicalinfoWin::showWindow(){//显示大框  显示每个控件CTools::paintWindow(this->startX,this->startY,this->width,this->height);for(int i=0;ictrlCount;i++){this->ctrlArr[i]->show();  //执行基类的show函数}char buf[15]={0};strcpy(buf,CTools::showTime());CTools::gotoxy(this->startX+this->width+6,10);coutshowoutpatientdoctorData();} //窗口运行 [虚函数] [左右按键操作表格]int CDoctormedicalinfoWin::WinRun(){int i=0,key=0;int a,b;for(i=0;ictrlCount;i++){if(this->ctrlArr[i]->getType()==EDIT||this->ctrlArr[i]->getType()==BUTTON){CTools::gotoxy(this->ctrlArr[i]->getX()+2,this->ctrlArr[i]->getY()+1);break;}}while(1){key=CTools::getkey();switch(key){case KEY_DOWN://向下按键  查找下一个编辑框 按钮i++;//按键数组下标越界if(i==this->ctrlCount){i=0;//为了避免下标越界 从头开始对控件结构体数组找编辑框 按钮}for(;ictrlCount;i++){if(this->ctrlArr[i]->getType()==EDIT){CTools::gotoxy(this->ctrlArr[i]->getX()+2+strlen(this->ctrlArr[i]->getContent()),this->ctrlArr[i]->getY()+1);break;}else if(this->ctrlArr[i]->getType()==BUTTON){CTools::gotoxy(this->ctrlArr[i]->getX()+(this->ctrlArr[i]->getW()-strlen(this->ctrlArr[i]->getContent())/2),this->ctrlArr[i]->getY()+1);break;}}break;case KEY_UP:i--;if(i==-1)  //从后往前找 数组起始0 i--为-1 数组下标由大到小 (控件数组下标0位置){i=this->ctrlCount-1;  //控件个数(控件结构体数组下标最大)-1 (控件数组下标ctrlCount位置)}for(;i>0;i--){if(this->ctrlArr[i]->getType()==EDIT){CTools::gotoxy(this->ctrlArr[i]->getX()+2+strlen(this->ctrlArr[i]->getContent()),this->ctrlArr[i]->getY()+1);break;}else if(this->ctrlArr[i]->getType()==BUTTON){CTools::gotoxy(this->ctrlArr[i]->getX()+(this->ctrlArr[i]->getW()-strlen(this->ctrlArr[i]->getContent())/2),this->ctrlArr[i]->getY()+1);break;}if(i==0)  //第一个 若第一个不是编辑框 按钮{i=this->ctrlCount;  //就从最后一个往前查找 for循环中有i--,不用再-1}}break;case KEY_LEFT:a=this->table->getcurPage();b=this->table->getsumPage();if(a<=b&&a>1){a--;this->table->setCurpage(a);this->table->clearTable();this->table->show();this->table->showoutpatientdoctorData();}break;case KEY_RIGHT:a=this->table->getcurPage();b=this->table->getsumPage();if(atable->setCurpage(a);this->table->clearTable();this->table->show();this->table->showoutpatientdoctorData();}break;case KEY_ENTER:if(this->ctrlArr[i]->getType()==BUTTON){this->focusIndex=i;return doAction();//返回切换到的界面的下标//获取winRun中输入的编辑框的值}break;default:   //其他字符(不是按键)并且当前控件是编辑框if(this->ctrlArr[i]->getType()==EDIT){if(key==KEY_BACKSPACE)//执行回删{this->ctrlArr[i]->backSpace();}else{this->ctrlArr[i]->keyListen(key);}}break;}}}

21.CDoctormedicalrecWin.h .cpp【医生的就诊信息的就诊记录界面】

#ifndef CDOCTORMEDICALRECWIN_H#define CDOCTORMEDICALRECWIN_H#include"CWinBase.h"//继承窗口基类#include"CButton.h"//按钮#include "CLabel.h"//标签#include"CEdit.h"//编辑框#include//医生的就诊信息的就诊记录 继承 窗口基类class CDoctormedicalrecWin:public CWinBase{public:CDoctormedicalrecWin();//默认构造~CDoctormedicalrecWin();//析构CDoctormedicalrecWin(int x,int y,int w,int h);//带参构造int doAction();//按键执行响应[纯虚函数]void showWindow();//窗口显示[虚函数]protected:private:    CLabel *titlehyld,*titlehy,*titlerq,*titleyhid,*titleyyms,*titlejzms,*titlets;//标签CButton *btnqueding ,*btnfanhui;//按钮CEdit *edityyms,*editjzms,*edityhid;//编辑框}; #endif

#pragma warning(disable :4786)#include"CDoctormedicalrecWin.h"//医生的就诊信息的就诊记录窗#include"CTools.h"//工具类#include"CData.h"//公共数据类#include"COutpatient.h"//门诊类#includeusing namespace std;#include#include#include#include//医生的就诊信息的就诊记录窗 继承 窗口基类[默认构造]CDoctormedicalrecWin::CDoctormedicalrecWin():CWinBase(){}//析构CDoctormedicalrecWin::~CDoctormedicalrecWin(){}//医生的就诊信息的就诊记录窗 继承 窗口基类[带参构造]CDoctormedicalrecWin::CDoctormedicalrecWin(int x,int y,int w,int h):CWinBase(x,y,w,h){//创建控件//标签    this->titlehyld = new CLabel(15,7,34,4,"欢迎来到门诊预约管理系统",LABEL);//0this->titlehy = new CLabel(8,10,10,2,"欢迎,用户名,角色",LABEL);//1    this->titlerq = new CLabel(39,10,10,2,"日期",LABEL);//2this->titleyhid = new CLabel(9,14,10,2,"用户ID:",LABEL);//3    this->titleyyms = new CLabel(9,17,10,2,"预约描述:",LABEL);//4    this->titlejzms = new CLabel(9,20,10,2,"就诊描述:",LABEL);//5//编辑框this->edityhid = new CEdit(22,13,10,3,"",11,2,1,EDIT);//6this->edityyms = new CEdit(22,16,10,3,"",11,3,1,EDIT);//7this->editjzms = new CEdit(22,19,14,3,"",18,3,1,EDIT);//8//按钮this->btnqueding = new CButton(10,23,8,3,"确定",BUTTON);//9this->btnfanhui = new CButton(28,23,10,3,"返回",BUTTON); //10//标签    this->titlets = new CLabel(42,17,10,2,"请用中文填写预约描述以及就诊描述",LABEL);//11 //添加控件到窗口界面中this->addControl(this->titlehyld);   this->addControl(this->titlehy);this->addControl(this->titlerq);this->addControl(this->titleyhid);this->addControl(this->titleyyms);this->addControl(this->titlejzms);this->addControl(this->edityhid);this->addControl(this->edityyms); this->addControl(this->editjzms); this->addControl(this->btnqueding);this->addControl(this->btnfanhui);this->addControl(this->titlets); } //窗口执行响应[纯虚函数]int CDoctormedicalrecWin::doAction(){map::iterator it;switch(this->focusIndex){case 10: return 20;  //医生就诊信息界面case 9: //确定//判断编辑框内容是否为空if(strlen(this->edityhid->getContent())==0||strlen(this->edityyms->getContent())==0||strlen(this->editjzms->getContent())==0){CTools::gotoxy(10,25);cout<<"用户id或预约描述或就诊描述不能为空"clear();this->edityyms->clear();this->editjzms->clear();system("pause");return 21;}for(it=CData::outpatientMap.begin();it!=CData::outpatientMap.end();it++){if(strcmp(this->edityhid->getContent(),it->second.getPhoneNum().c_str())==0){it->second.setDescribeU(this->edityyms->getContent());it->second.setDescribeD(this->editjzms->getContent());CData::writeOutpatient();CTools::gotoxy(10,25);cout<<"预约描述,就诊描述已填入"clear();this->edityyms->clear();this->editjzms->clear();system("pause");return 21;}/*else{CTools::gotoxy(10,25);cout<<"电话不匹配请重新输入"clear();this->edityyms->clear();this->editjzms->clear();system("pause");return 21;}*/}default:break;}return 21;} //窗口显示 [虚函数]void CDoctormedicalrecWin::showWindow(){//显示大框  显示每个控件CTools::paintWindow(this->startX,this->startY,this->width,this->height);for(int i=0;ictrlCount;i++){this->ctrlArr[i]->show();  //执行基类的show函数}char buf[15]={0};strcpy(buf,CTools::showTime());CTools::gotoxy(this->startX+this->width+6,10);cout<<BUF<<ENDL; }

责任编辑:

标签:

相关推荐:

精彩放送:

新闻聚焦
Top