Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
170 changes: 170 additions & 0 deletions Dump20191209.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
-- MySQL dump 10.13 Distrib 8.0.18, for Win64 (x86_64)
--
-- Host: 127.0.0.1 Database: efkadb
-- ------------------------------------------------------
-- Server version 8.0.18

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!50503 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `appointment`
--

DROP TABLE IF EXISTS `appointment`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `appointment` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`citizen_id` int(10) unsigned NOT NULL,
`doctor_id` int(10) unsigned NOT NULL,
`datetime` datetime NOT NULL,
`description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
`notes` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
PRIMARY KEY (`id`),
KEY `cit_app_idx` (`citizen_id`),
KEY `doc_app_idx` (`doctor_id`),
CONSTRAINT `cit_app` FOREIGN KEY (`citizen_id`) REFERENCES `citizen` (`id`),
CONSTRAINT `doc_app` FOREIGN KEY (`doctor_id`) REFERENCES `doctor` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `appointment`
--

LOCK TABLES `appointment` WRITE;
/*!40000 ALTER TABLE `appointment` DISABLE KEYS */;
/*!40000 ALTER TABLE `appointment` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `citizen`
--

DROP TABLE IF EXISTS `citizen`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `citizen` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`user_id` int(10) unsigned NOT NULL,
`AMKA` int(11) unsigned NOT NULL,
`first_name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`last_name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`email` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`phone_number` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `AMKA_UNIQUE` (`AMKA`),
UNIQUE KEY `user_id_UNIQUE` (`user_id`),
CONSTRAINT `cit_user` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `citizen`
--

LOCK TABLES `citizen` WRITE;
/*!40000 ALTER TABLE `citizen` DISABLE KEYS */;
/*!40000 ALTER TABLE `citizen` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `doctor`
--

DROP TABLE IF EXISTS `doctor`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `doctor` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`user_id` int(10) unsigned NOT NULL,
`first_name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`last_name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`specialty_id` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `user_id_UNIQUE` (`user_id`),
KEY `fk_spec_idx` (`specialty_id`),
CONSTRAINT `doc_user` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`),
CONSTRAINT `fk_spec` FOREIGN KEY (`specialty_id`) REFERENCES `specialty` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `doctor`
--

LOCK TABLES `doctor` WRITE;
/*!40000 ALTER TABLE `doctor` DISABLE KEYS */;
/*!40000 ALTER TABLE `doctor` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `specialty`
--

DROP TABLE IF EXISTS `specialty`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `specialty` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`specialty` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `specialty`
--

LOCK TABLES `specialty` WRITE;
/*!40000 ALTER TABLE `specialty` DISABLE KEYS */;
INSERT INTO `specialty` VALUES (7,'Ksematiasma'),(8,'Ksematiasma'),(9,'Ksematiasma'),(10,'Ksematiasma'),(11,'Ksematiasma'),(12,'Ksematiasma'),(13,'Ksematiasma'),(14,'Ksematiasma'),(15,'Ksematiasma');
/*!40000 ALTER TABLE `specialty` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `user`
--

DROP TABLE IF EXISTS `user`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `user` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`type` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
`username` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`pwd` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `username_UNIQUE` (`username`)
) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `user`
--

LOCK TABLES `user` WRITE;
/*!40000 ALTER TABLE `user` DISABLE KEYS */;
INSERT INTO `user` VALUES (14,'d','username23j','password'),(16,'d','usernamess23j','password'),(17,'d','usernamess423j','password'),(18,'d','usernamwsess423j','password'),(19,'d','usernamwsejjss423j','password'),(21,'d','usernsedededmwsejjss423j','password'),(22,'d','usdedmwsejjss423j','password'),(24,'d','usdess423j','password'),(26,'d','usdesfdffs423j','password');
/*!40000 ALTER TABLE `user` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2019-12-09 18:39:33
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,33 @@

@Entity
public class Appointment {
@Id
@Column(name = "id", nullable = false)
private int id;

@Column(name = "citizen_id", nullable = false, insertable = false, updatable = false)
private int citizenId;

@Column(name = "doctor_id", nullable = false, insertable = false, updatable = false)
private int doctorId;
private Timestamp appointmentDatetime;

@Column(name = "datetime", nullable = false)
private Timestamp datetime;

@Column(name = "description", nullable = true, columnDefinition = "TEXT")
private String description;

@Column(name = "notes", nullable = true, columnDefinition = "TEXT")
private String notes;
private Citizen citizenByCitizenId;
private Doctor doctorByDoctorId;

@Id
@Column(name = "id", nullable = false)
@ManyToOne
@JoinColumn(name = "citizen_id", referencedColumnName = "id", nullable = false)
private Citizen citizen;

@ManyToOne
@JoinColumn(name = "doctor_id", referencedColumnName = "id", nullable = false)
private Doctor doctor;

public int getId() {
return id;
}
Expand All @@ -25,8 +41,6 @@ public void setId(int id) {
this.id = id;
}

@Basic
@Column(name = "citizen_id", nullable = false, insertable = false, updatable = false)
public int getCitizenId() {
return citizenId;
}
Expand All @@ -35,8 +49,6 @@ public void setCitizenId(int citizenId) {
this.citizenId = citizenId;
}

@Basic
@Column(name = "doctor_id", nullable = false, insertable = false, updatable = false)
public int getDoctorId() {
return doctorId;
}
Expand All @@ -45,18 +57,14 @@ public void setDoctorId(int doctorId) {
this.doctorId = doctorId;
}

@Basic
@Column(name = "appointment_datetime", nullable = false)
public Timestamp getAppointmentDatetime() {
return appointmentDatetime;
public Timestamp getDatetime() {
return datetime;
}

public void setAppointmentDatetime(Timestamp appointmentDatetime) {
this.appointmentDatetime = appointmentDatetime;
public void setDatetime(Timestamp datetime) {
this.datetime = datetime;
}

@Basic
@Column(name = "description", nullable = true)
public String getDescription() {
return description;
}
Expand All @@ -65,8 +73,6 @@ public void setDescription(String description) {
this.description = description;
}

@Basic
@Column(name = "notes", nullable = true)
public String getNotes() {
return notes;
}
Expand All @@ -83,33 +89,29 @@ public boolean equals(Object o) {
return id == that.id &&
citizenId == that.citizenId &&
doctorId == that.doctorId &&
Objects.equals(appointmentDatetime, that.appointmentDatetime) &&
Objects.equals(datetime, that.datetime) &&
Objects.equals(description, that.description) &&
Objects.equals(notes, that.notes);
}

@Override
public int hashCode() {
return Objects.hash(id, citizenId, doctorId, appointmentDatetime, description, notes);
return Objects.hash(id, citizenId, doctorId, datetime, description, notes);
}

@ManyToOne
@JoinColumn(name = "citizen_id", referencedColumnName = "id", nullable = false)
public Citizen getCitizenByCitizenId() {
return citizenByCitizenId;
public Citizen getCitizen() {
return citizen;
}

public void setCitizenByCitizenId(Citizen citizenByCitizenId) {
this.citizenByCitizenId = citizenByCitizenId;
public void setCitizenByCitizenId(Citizen citizen) {
this.citizen = citizen;
}

@ManyToOne
@JoinColumn(name = "doctor_id", referencedColumnName = "id", nullable = false)
public Doctor getDoctorByDoctorId() {
return doctorByDoctorId;
return doctor;
}

public void setDoctorByDoctorId(Doctor doctorByDoctorId) {
this.doctorByDoctorId = doctorByDoctorId;
public void setDoctorByDoctorId(Doctor doctor) {
this.doctor = doctor;
}
}
Loading