门诊预约系统(四)

本文将介绍医生模块,医生主要病人预约信息进行查看以及诊断病情。

目录

医生主页面

drScreen.h

drScreen.c

 效果图

医生查询预约表界面

drSearchBook.h

 drSearchBook.c

效果图 

医生诊断页面

diagnosis.h

diagnosis.c

效果图


门诊预约系统(一) 

门诊预约系统(二)

门诊预约系统(三)

门诊预约系统(五)

医生主页面

drScreen.h

#pragma once
#include "screenBase.h"
#include "Label.h"
#include "Cedit.h"
#include "Cbuttun.h"
class doctorScreen:public screenBase
{
public:
	doctorScreen(int x = 0, int y = 0, int w = 0, int h = 0);
	~doctorScreen();
	int doaction();
protected:
	Label* title;
	Cbuttun* search, * back, * diagnosis;
};

drScreen.c

#include "doctorScreen.h"
doctorScreen::doctorScreen(int x, int y, int w, int h):screenBase(x, y, w, h)
{
	this->title = new Label(35, 8, 6, 3, "医者仁心");
	this->search = new Cbuttun(33, 12, 8, 3, "查询预约信息");
	this->diagnosis = new Cbuttun(35, 16, 6, 3, "诊断病人");
	this->back = new Cbuttun(35, 20, 6, 3, "返回");
	this->Screen.push_back(this->title);
	this->Screen.push_back(this->search);
	this->Screen.push_back(this->diagnosis);
	this->Screen.push_back(this->back);
}
doctorScreen::~doctorScreen()
{
	for (int i = 0; i < this->Screen.size(); i++)
	{
		delete this->Screen[i];
	}
}
int doctorScreen::doaction()
{
	if (this->index == 1)
	{
		//查询预约表
		return 11;
	}
	else if (this->index == 2)
	{
		//诊断病人
		return 12;
	}
	else if (this->index == 3)
	{
		return -1;
	}
}

 效果图

医生查询预约表界面

drSearchBook.h

#pragma once
#include "screenBase.h"
#include "Label.h"
#include "Cbuttun.h"
class drSearchBook:public screenBase
{
public:
    drSearchBook(int x = 0, int y = 0, int w = 0, int h = 0);
    ~drSearchBook();
    int doaction();
protected:
    Label* title;
    Cbuttun* back, * search;
};

 drSearchBook.c

#define _CRT_SECURE_NO_WARNINGS
#include "drSearchBook.h"
#include <iomanip>
#include "Cmydata.h"
drSearchBook::drSearchBook(int x, int y, int w, int h):screenBase(x, y, w, h)
{
	this->title = new Label(35, 6, 6, 3, "查询预约信息");
	this->back = new Cbuttun(42, 22, 6, 3, "返回");
	this->search = new Cbuttun(22, 22, 6, 3, "查询");
	this->Screen.push_back(this->title);
	this->Screen.push_back(this->search);
	this->Screen.push_back(this->back);
}
drSearchBook::~drSearchBook()
{
	for (int i = 0; i < this->Screen.size(); i++)
	{
		delete this->Screen[i];
	}
}
int drSearchBook::doaction()
{
	if (this->index == 2)
	{
		return 10;
	}
	else if (this->index == 1)
	{
		//显示预约表
		Ctool::gotoxy(0, 29);
		Cmydata* data = Cmydata::Getmydata();
		char sql[256] = { 0 };
		char** qres = nullptr;
		int row = 0, col = 0;
		sprintf(sql, "select * from bookInfo");
		int res = data->getres_exec(sql, qres, row, col);
		if (res == 0)
		{
			if (row == 0)
			{
				Ctool::gotoxy(18, 15);
				cout << "没有找到" << endl;
				return 10;
			}
			else
			{
				Ctool::gotoxy(18, 8);
				for (int i = 0; i < row + 1; i++)
				{
					for (int j = 0; j < col; j++)
					{
						Ctool::gotoxy(18 + j * 10, 8 + i * 2);
						cout << "|" << setw(12) << left << qres[i * col + j] << " ";
					}
					cout << "|" << endl;
				}
				return 11;
			}
		}
	}
}

效果图 

医生诊断页面

diagnosis.h

#pragma once
#include "screenBase.h"
#include "Label.h"
#include "Cbuttun.h"
#include "Cedit.h"
class Cdiagnosis:public screenBase
{
public:
    Cdiagnosis(int x = 0, int y = 0, int w = 0, int h = 0);
    ~Cdiagnosis();
    int doaction();
protected:
    Label* lab_name, * lab_predescription, * lab_description, * lab_doctor;
    Cedit* ed_name, * ed_predescription, * ed_description, * ed_doctor;
    Cbuttun *but_ok, *but_cancel;
};

diagnosis.c

#define _CRT_SECURE_NO_WARNINGS
#include "Cdiagnosis.h"
#include "Cmydata.h"
Cdiagnosis::Cdiagnosis(int x, int y, int w, int h):screenBase(x, y, w, h)
{
	this->lab_name = new Label(19, 8, 6, 3, "患者姓名");
	this->lab_predescription = new Label(19, 16, 6, 3, "预约描述");
	this->lab_description = new Label(19, 20, 6, 3, "诊断描述");
	this->lab_doctor = new Label(19, 12, 6, 3, "医生姓名");
	this->ed_name = new Cedit(30, 8, 12, 3, "", 3, 15, 0);
	this->ed_doctor = new Cedit(30, 12, 12, 3, "", 3, 15, 0);
	this->ed_predescription = new Cedit(30, 16, 12, 3, "", 3, 30, 0);
	this->ed_description = new Cedit(30, 20, 12, 3, "", 3, 30, 0);
	this->but_ok = new Cbuttun(25, 23, 6, 3, "确定");
	this->but_cancel = new Cbuttun(40, 23, 6, 3, "取消");
	this->Screen.push_back(this->lab_name);
	this->Screen.push_back(this->lab_predescription);
	this->Screen.push_back(this->lab_description);
	this->Screen.push_back(this->lab_doctor);
	this->Screen.push_back(this->ed_name);
	this->Screen.push_back(this->ed_doctor);
	this->Screen.push_back(this->ed_predescription);
	this->Screen.push_back(this->ed_description);
	this->Screen.push_back(this->but_ok);
	this->Screen.push_back(this->but_cancel);
}
Cdiagnosis::~Cdiagnosis()
{
	for (int i = 0; i < this->Screen.size(); i++)
	{
		delete this->Screen[i];
	}
}
int Cdiagnosis::doaction()
{
	if (this->index == 8)
	{
		//业务
		Ctool::gotoxy(0, 29);
		//获取输入内容
		this->ed_name->getContent();
		this->ed_doctor->getContent();
		this->ed_predescription->getContent();
		this->ed_description->getContent();
		//添加前检查
		if (strlen(this->ed_name->getContent()) == 0 || strlen(this->ed_doctor->getContent()) == 0 || strlen(this->ed_predescription->getContent()) == 0 || strlen(this->ed_description->getContent()) == 0)
		{
			Ctool::gotoxy(0, 29);
			cout << "输入不能为空" << endl;
			return 12;
		}
		else
		{
			//插入数据库
			Cmydata* data = Cmydata::Getmydata();
			char sql[256] = { 0 };
			char** qres = nullptr;
			int row = 0, col = 0;
			//检查预约表中是否已经预约
			sprintf(sql, "select * from bookInfo where name = '%s'", this->ed_name->getContent());
			int res = data->getres_exec(sql, qres, row, col);
			if (res == -1)
			{
				Ctool::gotoxy(0, 29);
				cout << "该患者未预约" << endl;
				this->ed_name->clear();
				this->ed_doctor->clear();
				this->ed_predescription->clear();
				this->ed_description->clear();
				return 12;
			}
			else
			{
				//判断就诊时是否是预约表中的医生
				if (strcmp(this->ed_doctor->getContent(), qres[6]) != 0)
				{
					Ctool::gotoxy(0, 29);
					cout << "该患者预约的不是该医生" << endl;
					this->ed_name->clear();
					this->ed_doctor->clear();
					this->ed_predescription->clear();
					this->ed_description->clear();
					return 12;
				}
				sprintf(sql, "insert into diaInfo(ID, name, doctorname, predescription, description) values(null, '%s' , '%s' , '%s', '%s')", this->ed_name->getContent(), this->ed_doctor->getContent(), this->ed_predescription->getContent(), this->ed_description->getContent());
				res = data->getres_exec(sql, qres, row, col);
				//插入成功将预约表的状态改为已就诊
				if (res == 0)
				{
					sprintf(sql, "update bookInfo set status = '已就诊' where name = '%s'", this->ed_name->getContent());
					data->getres_exec(sql, qres, row, col);
				}
			}
			this->ed_name->clear();
			this->ed_doctor->clear();
			this->ed_predescription->clear();
			this->ed_description->clear();
		}
		return 12;
	}
	else if (this->index == 9)
	{
		this->ed_name->clear();
		this->ed_doctor->clear();
		this->ed_predescription->clear();
		this->ed_description->clear();
		return 10;
	}
}

效果图

代码问题---->

https://ad.pdb2.com/l/CPCeKnK8DHfjEiN

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值