This commit is contained in:
Roberto Orden Erena
2019-12-15 20:53:51 +01:00
parent 91f6bc396b
commit fbe7b34a32
6 changed files with 113 additions and 259 deletions

View File

@@ -1,69 +0,0 @@
package jpa;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import TO.PatientTO;
import TO.SpecialistDoctorTO;
/**
*
* @author Marcos García Núñez (mgarcianun@uoc.edu)
*
*/
@Entity
@Table(name = "MyHealth.Question")
public class ImageJPA implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private int id;
private String response;
@ManyToOne
@JoinColumn (name="QuestionId")
private PatientTO question;
public ImageJPA() {
}
public ImageJPA(int id, String response, PatientTO question) {
this.id = id;
this.response = response;
this.question = question;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getResponse() {
return response;
}
public void setResponse(String response) {
this.response = response;
}
public PatientTO getQuestion() {
return question;
}
public void setQuestion(PatientTO question) {
this.question = question;
}
}

View File

@@ -3,6 +3,7 @@ package jpa;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
@@ -11,16 +12,19 @@ import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import TO.PatientTO;
import TO.SpecialistDoctorTO;
/**
* Los nombres de los decortadores relacionados con la BBDD pueden estar
* en camelCase, snakeCase o como se quiera, puesto que en persistence.xml
* se tiene dicho que se convierta a minúsculas.
*
* @author Marcos García Núñez (mgarcianun@uoc.edu)
* Lo uso en minúsculas para mejorar la trazabilidad de los campos.
*
* @author Roberto Orden Erena <rorden@uoc.edu>
*
*/
@Entity
@Table(name = "MyHealth.MedicalTest")
@Table(name = "myhealth.medicaltest")
public class MedicalTestJPA implements Serializable {
private static final long serialVersionUID = 1L;
@@ -32,22 +36,23 @@ public class MedicalTestJPA implements Serializable {
private long time;
private String observations;
private String highresimage;
@Column(name = "type") // Con esto podríamos cambiar los nombres de las propiedades de la clase y mantener la relación con la BBDD a través de JPA
private int type;
@ManyToOne
@JoinColumn (name="PatientId")
private PatientTO patient;
@JoinColumn (name="patientid")
private PatientJPA patient;
@ManyToOne
@JoinColumn (name="SpecialistDoctorId")
private SpecialistDoctorTO specialistDoctor;
@JoinColumn (name="specialistdoctorid")
private SpecialistDoctorJPA specialistDoctor;
public MedicalTestJPA() {
super();
}
public MedicalTestJPA(int id, Date date, long time, String observations, String highresimage, int type,
PatientTO patient, SpecialistDoctorTO specialistDoctor) {
PatientJPA patient, SpecialistDoctorJPA specialistDoctor) {
this.id = id;
this.date = date;
this.time = time;
@@ -106,19 +111,19 @@ public class MedicalTestJPA implements Serializable {
this.type = type;
}
public PatientTO getPatient() {
public PatientJPA getPatient() {
return patient;
}
public void setPatient(PatientTO patient) {
public void setPatient(PatientJPA patient) {
this.patient = patient;
}
public SpecialistDoctorTO getSpecialistDoctor() {
public SpecialistDoctorJPA getSpecialistDoctor() {
return specialistDoctor;
}
public void setSpecialistDoctor(SpecialistDoctorTO specialistDoctor) {
public void setSpecialistDoctor(SpecialistDoctorJPA specialistDoctor) {
this.specialistDoctor = specialistDoctor;
}

View File

@@ -10,13 +10,12 @@ import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import TO.FamilyDoctorTO;
import TO.PatientTO;
import common.QuestionStatus;
/**
*
* @author Marcos García Núñez (mgarcianun@uoc.edu)
* @author Roberto Orden Erena <rorden@uoc.edu>
*
*/
@Entity
@@ -34,23 +33,24 @@ public class QuestionJPA implements Serializable {
private String response;
@ManyToOne
@JoinColumn(name = "PatientId")
private PatientTO patient;
@JoinColumn(name = "patientid")
private PatientJPA patient;
@ManyToOne
@JoinColumn(name = "FamilyDoctorId")
private FamilyDoctorTO doctor;
@JoinColumn(name = "familydoctorid")
private FamilyDoctorJPA familydoctor;
public QuestionJPA() {
}
public QuestionJPA(int id, String title, String message, QuestionStatus status, PatientTO patient,
FamilyDoctorTO doctor, String response) {
public QuestionJPA(int id, String title, String message, QuestionStatus status, PatientJPA patient,
FamilyDoctorJPA familydoctor, String response) {
this.id = id;
this.title = title;
this.message = message;
this.status = status;
this.patient = patient;
this.doctor = doctor;
this.familydoctor = familydoctor;
this.response = response;
}
@@ -78,11 +78,11 @@ public class QuestionJPA implements Serializable {
this.message = message;
}
public PatientTO getPatient() {
public PatientJPA getPatient() {
return patient;
}
public void setPatient(PatientTO patient) {
public void setPatient(PatientJPA patient) {
this.patient = patient;
}
@@ -94,12 +94,12 @@ public class QuestionJPA implements Serializable {
this.status = status;
}
public FamilyDoctorTO getDoctor() {
return doctor;
public FamilyDoctorJPA getDoctor() {
return familydoctor;
}
public void setDoctor(FamilyDoctorTO doctor) {
this.doctor = doctor;
public void setDoctor(FamilyDoctorJPA familydoctor) {
this.familydoctor = familydoctor;
}
public String getResponse() {

View File

@@ -1,69 +0,0 @@
package jpa;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import TO.PatientTO;
import TO.SpecialistDoctorTO;
/**
*
* @author Marcos García Núñez (mgarcianun@uoc.edu)
*
*/
@Entity
@Table(name = "MyHealth.Question")
public class ResponseJPA implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private int id;
private String response;
@ManyToOne
@JoinColumn (name="QuestionId")
private PatientTO question;
public ResponseJPA() {
}
public ResponseJPA(int id, String response, PatientTO question) {
this.id = id;
this.response = response;
this.question = question;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getResponse() {
return response;
}
public void setResponse(String response) {
this.response = response;
}
public PatientTO getQuestion() {
return question;
}
public void setQuestion(PatientTO question) {
this.question = question;
}
}