Revisión de código y limpieza
This commit is contained in:
@@ -43,7 +43,6 @@
|
|||||||
|
|
||||||
<div class="ui-g-4 ui-md-4"></div>
|
<div class="ui-g-4 ui-md-4"></div>
|
||||||
<div class="ui-g-8 ui-md-8">
|
<div class="ui-g-8 ui-md-8">
|
||||||
|
|
||||||
<p:dataList value="#{sspec.listDoctors}" var="dd" type="ordered" emptyMessage="Ningún especialista para la especialidad seleccionada">
|
<p:dataList value="#{sspec.listDoctors}" var="dd" type="ordered" emptyMessage="Ningún especialista para la especialidad seleccionada">
|
||||||
#{dd.name} #{dd.surname} <#{dd.email}>
|
#{dd.name} #{dd.surname} <#{dd.email}>
|
||||||
</p:dataList>
|
</p:dataList>
|
||||||
|
|||||||
@@ -126,44 +126,24 @@ public class MedicalTestFacadeBean implements MedicalTestFacadeRemote {
|
|||||||
return pendingQuestions;
|
return pendingQuestions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getPendingQuestionsCount(int familyDoctorId) {
|
|
||||||
TypedQuery<Long> query = entman.createQuery(
|
|
||||||
"SELECT count(1) from QuestionJPA q where q.status=:status and q.familyDoctor.id=:docId", Long.class);
|
|
||||||
query.setParameter("status", QuestionStatus.PENDING);
|
|
||||||
query.setParameter("docId", familyDoctorId);
|
|
||||||
|
|
||||||
return query.getSingleResult();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<QuestionTO> listPendingQuestionsPaged(int familyDoctorId, int pageNumber, int pageSize) {
|
|
||||||
TypedQuery<QuestionJPA> query = entman.createQuery(
|
|
||||||
"SELECT q from QuestionJPA q where q.status=:status and q.familyDoctor.id=:docId order by q.title",
|
|
||||||
QuestionJPA.class);
|
|
||||||
query.setParameter("status", QuestionStatus.PENDING);
|
|
||||||
query.setParameter("docId", familyDoctorId);
|
|
||||||
|
|
||||||
if (pageSize > 0) {
|
|
||||||
query.setFirstResult(pageNumber * pageSize);
|
|
||||||
query.setMaxResults(pageSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<QuestionJPA> allJPA = query.getResultList();
|
|
||||||
List<QuestionTO> pendingQuestions = new ArrayList<QuestionTO>();
|
|
||||||
|
|
||||||
for (QuestionJPA item : allJPA) {
|
|
||||||
pendingQuestions.add(commonServices.getPOJOforQuestionJPA(item, 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
return pendingQuestions;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recuperar una pregunta por su String
|
* Recuperar una pregunta por su identificador
|
||||||
*
|
*
|
||||||
* @param question
|
* @param question
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void getQuestion(String question) {
|
public QuestionTO getQuestion(int idQuestion) {
|
||||||
|
QuestionTO resp = new QuestionTO();
|
||||||
|
|
||||||
|
TypedQuery<QuestionJPA> query = entman.createQuery(
|
||||||
|
"SELECT q from QuestionJPA q where q.id=:idquestion",
|
||||||
|
QuestionJPA.class);
|
||||||
|
|
||||||
|
query.setParameter("idquestion", idQuestion);
|
||||||
|
|
||||||
|
resp = commonServices.getPOJOforQuestionJPA(query.getSingleResult(),1);
|
||||||
|
|
||||||
|
return resp;
|
||||||
}
|
}
|
||||||
|
|
||||||
// *********************************************************************
|
// *********************************************************************
|
||||||
|
|||||||
@@ -53,17 +53,13 @@ public interface MedicalTestFacadeRemote {
|
|||||||
* Recuperar las preguntas hechas por un paciente
|
* Recuperar las preguntas hechas por un paciente
|
||||||
*/
|
*/
|
||||||
public List<QuestionTO> listAllMyQuestions(int userId);
|
public List<QuestionTO> listAllMyQuestions(int userId);
|
||||||
|
|
||||||
public Long getPendingQuestionsCount(int familyDoctorId);
|
|
||||||
|
|
||||||
public List<QuestionTO> listPendingQuestionsPaged(int familyDoctorId, int pageNumber, int pageSize);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recuperar una pregunta por su String
|
* Recuperar una pregunta por su String
|
||||||
*
|
*
|
||||||
* @param question
|
* @param question
|
||||||
*/
|
*/
|
||||||
public void getQuestion(String question);
|
public QuestionTO getQuestion(int idQuestion);
|
||||||
|
|
||||||
// ********************************************************************* MEDICAL
|
// ********************************************************************* MEDICAL
|
||||||
// TEST
|
// TEST
|
||||||
|
|||||||
Reference in New Issue
Block a user