Список использованных источников
Range1→querySubObject («Text» ," ФИпациента: «+Pname+» «+Psurname+». Полиспациента:" +Ppolis); Единая система программной документации. — М.: СТАНДАРТИНФОРМ, 2005. QStringkabinet, Pname, Psurname, Dname, Ppolis, Dday, Dtime;//глобальныепеременныедляпечати. If (ui→lineEdit8→text ().isEmpty ()&&ui→lineEdit9→text ().isEmpty ()&&ui→lineEdit10→text ().isEmpty ()). QAxObject* WordApplication=new… Читать ещё >
Список использованных источников (реферат, курсовая, диплом, контрольная)
Стандарты.
- 1. ГОСТ 7.32. — 2001. Система стандартов по информации, библиотечному и издательскому делу. Отчет о научно-исследовательской работе. Структура и правила оформления. — М.: ИПК Издательство стандартов, 2001. — 21с.
- 2. ГОСТ 7.82 -2001. Библиографическая запись. Библиографическое описание электронных ресурсов. Общее требования и правила составления — М.: ИПК Издательство стандартов, 2001. — 21 с.
- 3. Единая система программной документации. — М.: СТАНДАРТИНФОРМ, 2005.
- 4. Васильев А. Н. Самоучитель С++ с примерами и задачами. Книга + CD. СПб.: Наука и техника, 2010. — 480 с.
- 5. Шлее Макс. Qt 5.3.Профессиональное программирование на C++. Книга CD. — СПб.: БХВ-Петербург, 2015. — 928 с.
ПРИЛОЖЕНИЕ, А Модуль «kursach1.pro».
#————————————————————————;
#.
# Project created by QtCreator 2017;10−31T22:47:55.
#.
#————————————————————————;
QT += core gui.
QT += xml.
QT += axcontainer.
greaterThan (QT_MAJOR_VERSION, 4): QT += widgets.
TARGET = kursach1.
TEMPLATE = app.
SOURCES += main.cpp.
kurs1.cpp.
HEADERS += kurs1.h.
FORMS += kurs1.ui.
Модуль «kurs1.h».
#ifndef KURS1_H.
#define KURS1_H.
#include.
#include.
#include.
#include.
#include.
#include.
namespaceUi {.
class kurs1;
}.
class kurs1: public QMainWindow.
{.
Q_OBJECT.
public:
explicit kurs1(QWidget *parent = 0);
~kurs1();
QStringListElements (QDomElement root, QStringtagname, QString attribute);
private slots:
voidon_pushButton_clicked ();
void on_pushButton2_clicked ();
void on_pushButton9_clicked ();
voidon_tabWidget_tabBarClicked (int index, intIndexPatient);
void on_pushButton10_clicked ();
void on_pushButton13_clicked ();
void on_pushButton3_clicked ();
void on_pushButton6_clicked ();
void on_pushButton12_clicked ();
void on_pushButton14_clicked ();
void on_comboBox4_activated (int index);
void on_comboBox5_activated (int index);
void on_comboBox7_activated (int index);
void on_comboBox9_activated (int index);
void on_pushButton11_clicked ();
void on_pushButton16_clicked ();
voidon_checkBox_clicked (bool checked);
void on_checkBox4_clicked (bool checked);
void on_checkBox2_clicked (bool checked);
void on_checkBox3_clicked (bool checked);
void on_pushButton15_clicked ();
void on_pushButton4_clicked ();
void on_pushButton17_clicked ();
void on_pushButton7_clicked ();
private:
Ui:kurs1 *ui;
QString Filename, filedoctors;
voidWriteFile ();
voidAppFile ();
voidSearchValue ();
voidDeleteEnd ();
voidActived ();
void Print ();
};
#endif // KURS1_H.
Модуль «kurs1.cpp».
#include «kurs1.h» .
#include «ui_kurs1.h» .
#include.
#include.
#include.
#include.
#include.
#include.
#include.
#include.
#include.
kurs1:kurs1(QWidget *parent) :
QMainWindow (parent),.
ui (new Ui: kurs1).
{.
ui->setupUi (this);
Filename="C:Qtproekty7outt-workpatients.xml" ;
filedoctors="C:Qtproekty7outt-workdoctors.xml" ;
Actived ();
on_tabWidget_tabBarClicked (1,0);
}.
kurs1:~kurs1().
{.
deleteui;
}.
// индекспациента.
QVariantindexpat;
intnumberPatient=0,searchindex;
intnumm, chekchek=0, max;
QStringkabinet, Pname, Psurname, Dname, Ppolis, Dday, Dtime;//глобальныепеременныедляпечати.
void kurs1: on_pushButton_clicked ().
{.
ui->tabWidget->setCurrentIndex (1);// переходнадругуювкладку.
on_tabWidget_tabBarClicked (1,numberPatient);
}.
void kurs1: on_pushButton2_clicked ().
{.
ui->tabWidget->setCurrentIndex (3);
}.
void kurs1: on_tabWidget_tabBarClicked (intindex, intindexPatient).
{.
QStringfio, name, address, polis, bornStr;
QDateborn;
if (index==1) {// если открыта вторая вкладка.
QDomDocument document;
QFilefile (Filename);
if (!file.open (QIODevice:ReadOnly|QIODevice:Text)).
{.
qDebug ()<<" failed" ;
}.
else.
{.
if (!document.setContent (&file)).
{.
qDebug ()<<" failed to load" ;
}.
file.close ();
}.
QDomElement root=document.firstChildElement ();
QDomNodeList books=root.elementsByTagName («Patient»);
max=books.count ();
//ищем по тегу и получаем его значение.
QDomNodebooknode=books.at (numberPatient);// индекспацинта.
if (booknode.isElement ()).
{.
QDomElement book=booknode.toElement ();
fio=ListElements (book," fio" ," name");// забираемфио.
name=ListElements (book," name" ," name");
address=ListElements (book," address" ," value");
polis=ListElements (book," polis" ," value");
bornStr=ListElements (book," born" ," value");
}.
QDate born=QDate:fromString (bornStr," yyyy.MM.dd");//переобразование.
indexpat=numberPatient;//переобразуем индекс в вариант.
ui->dateEdit->setDate (born);
ui->lineEdit2->setText (indexpat.toString ()); // index.
ui->lineEdit3->setText (fio); // выводфио.
ui->lineEdit4->setText (name); // выводимя.
ui->lineEdit5->setText (address); // выводадреса.
ui->lineEdit6->setText (polis); // вывод polis.
}.
ui->lineEdit->setText (indexpat.toString ()); //выбранныйпациенткод.
ui->lineEdit7->setText (indexpat.toString ());
Pname=ui->lineEdit4->text ();
Psurname=ui->lineEdit3->text ();
Ppolis=ui->lineEdit6->text ();
}.
// находимзначениятега.
QString kurs1: ListElements (QDomElement root, QStringtagname, QString attribute).
{.
QDomNodeList items=root.elementsByTagName (tagname);
for (inti=0; i.
{.
QDomNodeitemnode= items. at (i);
if (itemnode.isElement ()).
{.
QDomElementitemele=itemnode.toElement ();
return itemele. attribute (attribute); //возрващаетатрибуттега.
}.
}.
}.
void kurs1: on_pushButton10_clicked ()//следующаязапись.
{ if (indexpat<(max-1)){.
numberPatient++;
on_tabWidget_tabBarClicked (1, numberPatient);
}.
}.
void kurs1: on_pushButton9_clicked ()//предудующаязапись.
{ if (indexpat>0){.
numberPatient—;
on_tabWidget_tabBarClicked (1, numberPatient);
}.
}.
//добавлеиеновойзаписи.
void kurs1: WriteFile ().
{.
QMessageBoxmsgBox;
msgBox.setWindowTitle («Внимание»);
numm++;// следующий код пациента.
QDomDocumentxml;
QDomElement root1=xml.createElement («Patient»);
root1.setAttribute («id», QString: number (numm));
xml.appendChild (root1);
QDomElement node=xml.createElement («name»);
node.setAttribute («name», ui->lineEdit12->text ());
root1.appendChild (node);
QDomElement node1=xml.createElement («fio»);
node1.setAttribute («name», ui->lineEdit13->text ());
root1.appendChild (node1);
QDomElement node12=xml.createElement («address»);
node12.setAttribute («value», ui->lineEdit14->text ());
root1.appendChild (node12);
QDomElement node13=xml.createElement («born»);
node13.setAttribute («value», ui->dateEdit2->date ().toString («yyyy.MM.dd»));
root1.appendChild (node13);
QDomElement node14=xml.createElement («polis»);
node14.setAttribute («value», ui->lineEdit15->text ());
root1.appendChild (node14);
QFilefile1(Filename);
if (!file1.open (QIODevice:Append|QIODevice:Text)).
{.
qDebug ()<<" failed" ;
}.
else.
{.
QTextStreamstream (&file1);
stream<
stream<<" «;
file1.close ();
}.
msgBox.setText («Пациентуспешнодобавлен! «);
msgBox.exec ();
}.
//поискпациента.
void kurs1: SearchValue ().
{.
QString polis, fio, name;
intchek=0;
QMessageBoxmsgBox;
msgBox.setWindowTitle («Внимание»);
QDomDocument document;
QFilefile (Filename);
if (!file.open (QIODevice:ReadOnly|QIODevice:Text)).
{.
qDebug ()<<" failed" ;
}.
else.
{.
if (!document.setContent (&file)).
{.
qDebug ()<<" failed to load" ;
}.
file.close ();
}.
QDomElement root=document.firstChildElement ();
QDomNodeList patients=root.elementsByTagName («Patient»);
if (ui->lineEdit8->text ().isEmpty ()&&ui->lineEdit9->text ().isEmpty ()&&ui->lineEdit10->text ().isEmpty ()).
{.
msgBox.setText («Поляпусты! «);
msgBox.exec ();
} else {.
// Ищемпополису.
if (!ui->lineEdit10->text ().isEmpty ()){.
for (inti=0; i.
QDomNodebooknode=patients.at (i);// индекспацинта.
if (booknode.isElement ()).
{.
QDomElement book=booknode.toElement ();
polis=ListElements (book," polis" ," value");
if (polis==ui->lineEdit10->text ()){.
chek=1;
searchindex=i;
break;}.
}.
} //ищемпоФИ.
} if (!ui->lineEdit8->text ().isEmpty ()&&!ui->lineEdit9->text ().isEmpty ()){.
for (inti=0; i.
QDomNodebooknode=patients.at (i);// индекспацинта.
if (booknode.isElement ()).
{.
QDomElement book=booknode.toElement ();
name=ListElements (book," name" ," name");
fio=ListElements (book," fio" ," name");
if (name==ui->lineEdit8->text ()&&fio==ui->lineEdit9->text ()){.
chek=1;
searchindex=i;
break;}.
}.
}.
}.
if (chek==1){ // еслинайденпациент.
numberPatient=searchindex;
msgBox.setWindowTitle («Картанайдена!»);
msgBox.setInformativeText («Ок — Посмотретькарту Cancel — остаться»);
msgBox.setStandardButtons (QMessageBox:Ok | QMessageBox: Cancel);
msgBox.setIcon (QMessageBox:Information);
msgBox.setDefaultButton (QMessageBox:Ok);
int res = msgBox. exec ();
if (res == QMessageBox: Ok) //нажатакнопка Ok.
{.
ui->tabWidget->setCurrentIndex (1);// переходнадругуювкладку.
on_tabWidget_tabBarClicked (1,searchindex);
}.
}.
else{.
msgBox.setText («Пациент не найден! «);
msgBox.exec ();
}.
}.
}.
//удаляем полседнюю строку.
void kurs1: DeleteEnd ().
{.
intsizef;
QDomDocument document;
QFilefile (Filename);
QByteArraydata; // Создаем объект класса QByteArray, куда мы будем считывать данные.
if (!file.open (QIODevice:ReadOnly)) // Проверяем, возможно ли открыть наш файл для чтения.
qDebug ()<<" ошибка чтения" ;
data = file. readAll (); //считываем все данные с файла в объект data.
file.close ();
document.setContent (&file);
sizef=data.size ();
data.replace (sizef-12,12," «);
//получаюкол-вопациентов.
QDomElement root=document.firstChildElement ();
QDomNodeList patients=root.elementsByTagName («Patient»);
numm= patients. count ()-1;
file.close ();
if (!file.open (QIODevice:WriteOnly)).
{.
qDebug ()<<" failed" ;
}.
else.
{.
QTextStreamstream (&file);
stream<
file.close ();
}.
}.
void kurs1: Actived ().
{.
ui->comboBox4->addItem («Понедельник»);
ui->comboBox4->addItem («Вторник»);
ui->comboBox4->addItem («Среда»);
ui->comboBox4->addItem («Четверг»);
ui->comboBox4->addItem («Пятница»);
ui->comboBox5->addItem («Понедельник»);
ui->comboBox5->addItem («Вторник»);
ui->comboBox5->addItem («Среда»);
ui->comboBox5->addItem («Четверг»);
ui->comboBox5->addItem («Пятница»);
ui->comboBox7->addItem («Понедельник»);
ui->comboBox7->addItem («Вторник»);
ui->comboBox7->addItem («Среда»);
ui->comboBox7->addItem («Четверг»);
ui->comboBox7->addItem («Пятница»);
ui->comboBox9->addItem («Понедельник»);
ui->comboBox9->addItem («Вторник»);
ui->comboBox9->addItem («Среда»);
ui->comboBox9->addItem («Четверг»);
ui->comboBox9->addItem («Пятница»);
}.
void kurs1: Print ().
{.
QAxObject* WordApplication=new QAxObject («Word.Application»); // Создаюинтерфейск MSWord.
QAxObject* WordDocuments = WordApplication->querySubObject («Documents ()»);
WordDocuments = WordDocuments->querySubObject («Add ()»); // Создаюновыйдокумент.
QAxObject* Range = WordDocuments->querySubObject («Range ()»);
Range->dynamicCall («SetRange (int, int)», 0,100);
Range->querySubObject («Text» ," Врач: «+Dname+» «+kabinet);
Range->dynamicCall («insertParagraphAfter ()»);// новыйабзац.
QAxObject* Range1 = WordDocuments->querySubObject («Range ()»);
Range1->dynamicCall («SetRange (int, int)», 101,200);
Range1->querySubObject («Text» ," ФИпациента: «+Pname+» «+Psurname+». Полиспациента:" +Ppolis);
Range->dynamicCall («insertParagraphAfter ()»);
QAxObject* Range2 = WordDocuments->querySubObject («Range ()»);
Range2->dynamicCall («SetRange (int, int)», 201,300);
Range2->querySubObject («Text» ," Датаприема: «+Dday+» «+Dtime+» :00″);
WordApplication->setProperty («Visible», true); // Делаем Word видимым.
}.
int time[5];
voidpartime (QString times){ //раскладываемвремя.
intbuf;
buf=times.toInt ();
time[0]=buf/100 000 000;
time[1]=(buf%100 000 000)/1 000 000;
time[2]=(buf%1 000 000)/10 000;
time[3]=(buf%10 000)/100;
time[4]=(buf%100);
}.
void kurs1: on_pushButton13_clicked () //поиск.
{.
SearchValue ();
}.
//переход к вкладке создания карты.
void kurs1: on_pushButton3_clicked ().
{.
ui->tabWidget->setCurrentIndex (4);
}.
void kurs1: on_pushButton6_clicked ().
{.
QMessageBoxmsgBox;
msgBox.setWindowTitle («Внимание!»);
if (ui->lineEdit12->text ().isEmpty ()||ui->lineEdit13->text ().isEmpty ()||ui->lineEdit14->text ().isEmpty ()||ui->lineEdit15->text ().isEmpty ()).
{.
msgBox.setText («Заполните все поля! «);
msgBox.exec ();
} else {.
msgBox.setInformativeText («Ок — Добавнить новую карту Cancel — отмена»);
msgBox.setStandardButtons (QMessageBox:Ok | QMessageBox: Cancel);
msgBox.setIcon (QMessageBox:Information);
msgBox.setDefaultButton (QMessageBox:Ok);
intres = msgBox. exec ();
if (res == QMessageBox: Ok) //нажатакнопкаOk.
{.
DeleteEnd ();
WriteFile ();
}.
}.
}.
void kurs1: on_pushButton12_clicked ().
{.
ui->lineEdit12->setText (««);
ui->lineEdit13->setText (««);
ui->lineEdit14->setText (««);
ui->lineEdit15->setText (««);
}.
void kurs1: on_pushButton14_clicked ().
{.
ui->lineEdit8->setText (««);
ui->lineEdit9->setText (««);
ui->lineEdit10->setText (««);
}.
void kurs1: on_comboBox4_activated (int index)// первыйдоктор
{.
chekchek=0;
QDomDocument document;
QFilefile (filedoctors);
if (!file.open (QIODevice:ReadOnly|QIODevice:Text)).
{.
qDebug ()<<" failed" ;
}.
else.
{.
if (!document.setContent (&file)).
{.
qDebug ()<<" failed to load" ;
}.
file.close ();
}.
QString day, name, surname;
QDomElement root=document.firstChildElement ();
QDomNodeList books=root.elementsByTagName («Doctor»);
QDomNodebooknode=books.at (0);// индексдоктора.
if (booknode.isElement ()).
{.
QDomElement book=booknode.toElement ();
day=ListElements (book," week" ," day" +QString:number (index+1));
name=ListElements (book," name" ," value");// забираемфио.
surname=ListElements (book," surname" ," value");// забираемфио.
}.
ui->label15->setText (name+" «+surname);
partime (day);
ui->comboBox3->clear ();
for (inti=0;i<5;i++).
{.
if (time[i]≠0).
ui->comboBox3->addItem (QString:number (time[i]));
time[i]=0;
}.
}.
void kurs1: on_comboBox5_activated (int index) //второйдоктор
{.
chekchek=0;
QDomDocument document;
QFilefile (filedoctors);
if (!file.open (QIODevice:ReadOnly|QIODevice:Text)).
{.
qDebug ()<<" failed" ;
}.
else.
{.
if (!document.setContent (&file)).
{.
qDebug ()<<" failed to load" ;
}.
file.close ();
}.
QString day, name, surname;
QDomElement root=document.firstChildElement ();
QDomNodeList books=root.elementsByTagName («Doctor»);
QDomNodebooknode=books.at (1);// индексдоктора.
if (booknode.isElement ()).
{.
QDomElement book=booknode.toElement ();
day=ListElements (book," week" ," day" +QString:number (index+1));
name=ListElements (book," name" ," value");// забираемфио.
surname=ListElements (book," surname" ," value");// забираемфио.
}.
ui->label23->setText (name+" «+surname);
partime (day);
ui->comboBox6->clear ();
for (inti=0;i<5;i++).
{.
if (time[i]≠0).
ui->comboBox6->addItem (QString:number (time[i]));</…