/** * gets patients pediatrics who have adult who stage * * @param session * @return patientsPediatricsWhoHaveAdultWhoStage */ public List<Patient> getPatientsPediatricsWhoHaveAdultWhoStage() { List<Patient> patientsInHIVProgram = new ArrayList<Patient>(); List<Patient> patientsPediatricsInHIVProgram = new ArrayList<Patient>(); List<Patient> patientsPediatricsWhoHaveAdultWhoStage = new ArrayList<Patient>(); List<Patient> patientsWhoHaveAdultWhoStage = new ArrayList<Patient>(); // List<Person> persons = new ArrayList<Person>(); // List<Obs> observers = new ArrayList<Obs>(); ProgramWorkflowService programService = Context.getProgramWorkflowService(); Program program = programService.getProgram(2); patientsInHIVProgram = getPatientsCurrentlyInHIVProgram(program); for (Patient patient : patientsInHIVProgram) { if (patient.getAge() < 15) { patientsPediatricsInHIVProgram.add(patient); } } DataQualityService dqs = ((DataQualityService) Context.getService(DataQualityService.class)); List<Integer> patientIds = dqs.getPatientsWhoHaveAdultWhoStage(); for (Integer patientId : patientIds) { patientsWhoHaveAdultWhoStage.add(getPatientById(patientId)); } for (Patient patient : patientsWhoHaveAdultWhoStage) { if (patientsPediatricsInHIVProgram.contains(patient)) { patientsPediatricsWhoHaveAdultWhoStage.add(patient); } } return patientsPediatricsWhoHaveAdultWhoStage; }
/** * gets patients with no programs enrollment dates * * @return */ public List<Patient> getPatientsWithNoProgramsEnrollmentDates() { List<Patient> patientsWithNoProgramsEnrollmentDates = new ArrayList<Patient>(); DataQualityService dqs = ((DataQualityService) Context.getService(DataQualityService.class)); List<Integer> patientIds = dqs.getPatientsWithNoProgramsEnrollmentDates(); for (Integer patientId : patientIds) { patientsWithNoProgramsEnrollmentDates.add(getPatientById(patientId)); } return patientsWithNoProgramsEnrollmentDates; }
/** * gets patients without start date * * @return */ public List<Patient> getPatientsWithoutStartDate() { List<Patient> patientsWithoutStartDate = new ArrayList<Patient>(); DataQualityService dqs = ((DataQualityService) Context.getService(DataQualityService.class)); List<Integer> patientIds = dqs.getPatientsWithoutStartDate(); for (Integer patientId : patientIds) { patientsWithoutStartDate.add(getPatientById(patientId)); } return patientsWithoutStartDate; }
/** * gets patients without a given identifier type TODO use: select patient.patient_id from patient * left join patient_identifier on patient.patient_id = patient_identifier.patient_id where * patient_identifier.patient_id is null; * * @param PatientIdentifierId * @return patients */ public List<Patient> getPatientWithNoGivenIdentifier(int identifierTypeId) { PatientService patientService = Context.getPatientService(); ArrayList<Patient> patientList = new ArrayList<Patient>(); DataQualityService dqs = ((DataQualityService) Context.getService(DataQualityService.class)); List<Integer> patientIds = dqs.getPatientsWithoutIdentifiers(identifierTypeId); for (Integer patientId : patientIds) { patientList.add(patientService.getPatient(patientId)); } return patientList; }
/** * gets patients without a given Concept * * @param concept * @return allpatients */ public List<Patient> getPatientWithoutAdmitionModeConcept(Concept concept) { DataQualityService dqs = ((DataQualityService) Context.getService(DataQualityService.class)); List<Patient> patients = new ArrayList<Patient>(); List<Patient> patientList = dqs.getPatientsWithoutAnObsAdmissionMode(concept); for (Patient patient : patientList) { if (!(patient.isUser())) { patients.add(patient); } } return patients; }
/** * gets patients Without any Program * * @param session * @return patients */ public List<Patient> getPatientWithoutProgram() { DataQualityService dqs = ((DataQualityService) Context.getService(DataQualityService.class)); List<Patient> patientList = new ArrayList<Patient>(); try { patientList = dqs.getPatientsWithNoProgram(); } catch (UnexpectedRollbackException unre) { unre.printStackTrace(); } return patientList; }
/** * gets patients by checking Type of abnormal datas * * @param programIdKey * @param session * @param valueRangeType * @return */ public List<Patient> checkTypeController(String programIdKey, String valueRangeType) throws Exception { // log.info("@@@@@@@@@@@@@@@@@@@@@ programIdKey "+programIdKey); List<Patient> patients = new ArrayList<Patient>(); List<Patient> activePatients = new ArrayList<Patient>(); List<Patient> patientsInHIVProgram = new ArrayList<Patient>(); if (programIdKey.equals("PatientsWithNoProgramsEnrollmentDates")) { patients = getPatientsWithNoProgramsEnrollmentDates(); DataqualityFormController.setMsgToDisplay("Patients with no programs enrollment dates"); } else if (programIdKey.equals("PatientsDrugsWithDiscontinuedDateWithoutStartDate")) { patients = getPatientsDrugsWithDiscontinuedDateWithoutStartDate(); DataqualityFormController.setMsgToDisplay( "Patients Drugs with discontinued date without start date"); } else if (programIdKey.equals("DrugsWithDiscontinuedDateHigherThanDrugStartDate")) { patients = getPatientsWithDiscontinuedDateHigherThanDrugStartDate(); DataqualityFormController.setMsgToDisplay(""); } else if (programIdKey.equals("DrugsWithoutStartDate")) { patients = getPatientsWithoutStartDate(); DataqualityFormController.setMsgToDisplay("Patients with Drugs without start date"); } else if (programIdKey.equals("patientrsWithoutNames")) { patients = getPatientsWithoutNames(); DataqualityFormController.setMsgToDisplay("Patientrs without names"); } else if (programIdKey.equals("patientInAnyHivProgramWithoutAdmitionMode")) { // log.info("top patientInAnyHivProgramWithoutAdmitionMode"); patientsInHIVProgram = new ArrayList<Patient>(); List<Patient> patientsWithNoAdmitionMode = new ArrayList<Patient>(); // getting programs ProgramWorkflowService programService = Context.getProgramWorkflowService(); Program hivProgram = programService.getProgram(getGlobalProperty("HIVProgramId")); patientsInHIVProgram = getPatientsCurrentlyInHIVProgram(hivProgram); patientsWithNoAdmitionMode = getPatientWithoutAdmitionModeConcept( getConcept(getGlobalProperty("concept.methodOfEnrollement"))); for (Patient patient : patientsWithNoAdmitionMode) { if (patientsInHIVProgram.contains(patient)) { patients.add(patient); } } DataqualityFormController.setMsgToDisplay( "tracdataquality.indicator.patientInAnyHivProgramWithoutAdmitionMode"); log.info("bottom patientInAnyHivProgramWithoutAdmitionMode"); } else if (programIdKey.equals("patientsWithoutProgram")) { log.info("top patientsWithoutProgram"); patients = getPatientWithoutProgram(); DataqualityFormController.setMsgToDisplay("tracdataquality.indicator.patientsWithoutProgram"); log.info("bottom patientsWithoutProgram"); } else if (programIdKey.equals("patientsWithnoWeight")) { log.info("top patientsWithnoWeight"); Concept concept = getConcept(getGlobalProperty("concept.weight")); patients = getPatientWithoutAgivenConcept(concept); DataqualityFormController.setMsgToDisplay("tracdataquality.indicator.patientsWithnoWeight"); log.info("bottom patientsWithnoWeight"); } else if (programIdKey.equals("patientsWithNoHeight")) { log.info("top patientsWithNoHeight"); Concept concept = getConcept(getGlobalProperty("concept.height")); patients = getPatientWithoutAgivenConcept(concept); DataqualityFormController.setMsgToDisplay("tracdataquality.indicator.patientsWithNoHeight"); log.info("bottom patientsWithNoHeight"); } else if (programIdKey.equals("patientWithNoHIVViralLoad")) { log.info("top patientWithNoHIVViralLoad"); List<Patient> patientsWithNoViralLoad = new ArrayList<Patient>(); Concept viralLoadConcept = getConcept(getGlobalProperty("concept.viralLoad")); ProgramWorkflowService programService = Context.getProgramWorkflowService(); Program hivProgram = programService.getProgram(getGlobalProperty("HIVProgramId")); patientsWithNoViralLoad = getPatientWithoutAgivenConcept(viralLoadConcept); patientsInHIVProgram = getPatientsCurrentlyInHIVProgram(hivProgram); for (Patient patient : patientsInHIVProgram) { if (patientsWithNoViralLoad.contains(patient)) { patients.add(patient); } } DataqualityFormController.setMsgToDisplay( "tracdataquality.indicator.patientWithNoHIVViralLoad"); log.info("bottom patientWithNoHIVViralLoad"); } else if (programIdKey.equals("patientWithHIVPositiveAndNoCD4")) { log.info("top patientWithHIVPositiveAndNoCD4"); List<Patient> patientsWithNoCD4 = new ArrayList<Patient>(); patientsInHIVProgram = new ArrayList<Patient>(); Concept cd4 = getConcept(getGlobalProperty("concept.cd4_count")); ProgramWorkflowService programService = Context.getProgramWorkflowService(); Program hivProgram = programService.getProgram(getGlobalProperty("HIVProgramId")); patientsWithNoCD4 = getPatientWithoutAgivenConcept(cd4); patientsInHIVProgram = getPatientsCurrentlyInHIVProgram(hivProgram); for (Patient patient : patientsInHIVProgram) { if (patientsWithNoCD4.contains(patient)) { patients.add(patient); } } DataqualityFormController.setMsgToDisplay( "tracdataquality.indicator.patientWithHIVPositiveAndNoCD4"); log.info("bottom patientWithHIVPositiveAndNoCD4"); } else if (programIdKey.equals("patientWithNoWhoStage")) { log.info("top patientWithNoWhoStage"); Concept concept = getConcept(getGlobalProperty("concept.whoStage")); patients = getPatientWithoutAgivenConcept(concept); DataqualityFormController.setMsgToDisplay("tracdataquality.indicator.patientWithNoWhoStage"); log.info("bottom patientWithNoWhoStage"); } else if (programIdKey.equals("patientWithMoreKgs")) { log.info("top patientWithMoreKgs"); // log.info("!!!!!!!!!!!!!!!!!!!!!!!! am getting in if statment"); Concept concept = getConcept(getGlobalProperty("concept.weight")); // log.info(" !!!@@@@###$$%%^^&&**(())__++++++++++++++++ "+concept); double valueRange = Double.parseDouble(valueRangeType); // log.info("!!!!!!!!!!!!!!!!!!!!!!! !!!@@@@###$$%%^^&&**(())__++++++++++++++++ // "+valueRange); patients = getPatientsWithMoreValueOnConcept(concept, valueRange); DataqualityFormController.setMsgToDisplay( "Patients with more than " + valueRange + " Weight"); log.info("bottom patientWithMoreKgs"); } else if (programIdKey.equals("patientsWithMoreHeight")) { log.info("top patientsWithMoreHeight"); Concept concept = getConcept(getGlobalProperty("concept.height")); double valueRange = Double.parseDouble(valueRangeType); patients = getPatientsWithMoreValueOnConcept(concept, valueRange); DataqualityFormController.setMsgToDisplay( "Patients with more than " + valueRange + " height"); log.info("bottom patientsWithMoreHeight"); } else if (programIdKey.equals("patientsWithMoreBMI")) { log.info("top patientsWithMoreBMI"); Concept concept = getConcept(getGlobalProperty("concept.BMI")); double valueRange = Double.parseDouble(valueRangeType); patients = getPatientsWithMoreValueOnConcept(concept, valueRange); DataqualityFormController.setMsgToDisplay( "Patients with more than " + valueRange + " BMI"); log.info("bottom patientsWithMoreBMI"); } else if (programIdKey.equals("patientsWithMoreBLOODOXYGENSATURATION")) { log.info("top patientsWithMoreBLOODOXYGENSATURATION"); double valueRange = Double.parseDouble(valueRangeType); patients = getPatientsWithMoreValueOnConcept( getConcept(getGlobalProperty("concept.bloodOxygenSaturation")), valueRange); DataqualityFormController.setMsgToDisplay( "Patients with more than " + valueRange + " BLOODOXYGENSATURATION"); log.info("bottom patientsWithMoreBLOODOXYGENSATURATION"); } else if (programIdKey.equals("patientsWithMoreDIASTOLICBLOODPRESSURE")) { log.info("top patientsWithMoreDIASTOLICBLOODPRESSURE"); double valueRange = Double.parseDouble(valueRangeType); patients = getPatientsWithMoreValueOnConcept( getConcept(getGlobalProperty("concept.diastolicBloodPressure")), valueRange); DataqualityFormController.setMsgToDisplay( "Patients with more than " + valueRange + " of DIASTOLICBLOODPRESSURE"); log.info("bottom patientsWithMoreDIASTOLICBLOODPRESSURE"); } else if (programIdKey.equals("patientsWithMoreHEADCIRCUMFERENCE")) { log.info("top patientsWithMoreHEADCIRCUMFERENCE"); double valueRange = Double.parseDouble(valueRangeType); patients = getPatientsWithMoreValueOnConcept( getConcept(getGlobalProperty("concept.headCircumference")), valueRange); DataqualityFormController.setMsgToDisplay( "Patients with more than " + valueRange + " HEADCIRCUMFERENCE"); log.info("bottom patientsWithMoreHEADCIRCUMFERENCE"); } else if (programIdKey.equals("patientsWithMoreKARNOFSKYPERFORMANCESCORE")) { log.info("top patientsWithMoreKARNOFSKYPERFORMANCESCORE"); double valueRange = Double.parseDouble(valueRangeType); patients = getPatientsWithMoreValueOnConcept( getConcept(getGlobalProperty("concept.karnofskyPerformanceScore")), valueRange); DataqualityFormController.setMsgToDisplay( "Patients with more than " + valueRange + " of KARNOFSKYPERFORMANCESCORE"); log.info("bottom patientsWithMoreKARNOFSKYPERFORMANCESCORE"); } else if (programIdKey.equals("patientsWithMorePULSE")) { log.info("top patientsWithMorePULSE"); double valueRange = Double.parseDouble(valueRangeType); patients = getPatientsWithMoreValueOnConcept( getConcept(getGlobalProperty("concept.pulse")), valueRange); DataqualityFormController.setMsgToDisplay( "Patients with more than " + valueRange + " PULSE"); log.info("bottom patientsWithMorePULSE"); } else if (programIdKey.equals("patientsWithMoreRESPIRATORYRATE")) { log.info("top patientsWithMoreRESPIRATORYRATE"); double valueRange = Double.parseDouble(valueRangeType); patients = getPatientsWithMoreValueOnConcept( getConcept(getGlobalProperty("concept.respiratoryRate")), valueRange); DataqualityFormController.setMsgToDisplay( "Patients with more than " + valueRange + " RESPIRATORYRATE"); log.info("bottom patientsWithMoreRESPIRATORYRATE"); } else if (programIdKey.equals("patientsWithMoreSYSTOLICBLOODPRESSURE")) { log.info("top patientsWithMoreSYSTOLICBLOODPRESSURE"); double valueRange = Double.parseDouble(valueRangeType); patients = getPatientsWithMoreValueOnConcept( getConcept(getGlobalProperty("concept.systolicBloodPressure")), valueRange); DataqualityFormController.setMsgToDisplay( "Patients with more than " + valueRange + " SYSTOLICBLOODPRESSURE"); log.info("bottom patientsWithMoreSYSTOLICBLOODPRESSURE"); } else if (programIdKey.equals("patientsWithMoreTEMPERATURE")) { log.info("top patientsWithMoreTEMPERATURE"); double valueRange = Double.parseDouble(valueRangeType); patients = getPatientsWithMoreValueOnConcept( getConcept(getGlobalProperty("concept.temperature")), valueRange); DataqualityFormController.setMsgToDisplay( "Patients.With.More.Than" + valueRange + " TEMPERATURE"); log.info("bottom patientsWithMoreTEMPERATURE"); } else if (programIdKey.equals("patientWithNoContactInformation")) { log.info("top patientWithNoContactInformation"); List<Patient> patientsWithoutPhoneNumber = new ArrayList<Patient>(); List<Patient> patientsWithoutAlternativePhoneNumber = new ArrayList<Patient>(); patientsWithoutPhoneNumber = getPatientWithoutAgivenConcept( getConcept(getGlobalProperty("concept.contactPhoneNumber"))); patientsWithoutAlternativePhoneNumber = getPatientWithoutAgivenConcept(getConcept(getGlobalProperty("concept.phoneNumber"))); for (Patient patient : patientsWithoutPhoneNumber) { if (patientsWithoutAlternativePhoneNumber.contains(patient)) { patients.add(patient); } } DataqualityFormController.setMsgToDisplay( "tracdataquality.indicator.patientWithNoContactInformation"); log.info("bottom patientWithNoContactInformation"); } else if (programIdKey.equals("patientWithNoTRACnet")) { log.info("top patientWithNoTRACnet"); // log.info("$$$$$$$$$$$$$$$$$$$$$$$$$ this is the tracnet // type"+getGlobalProperty("patientIdentifierType.TRACnetID")); patients = getPatientWithNoGivenIdentifier(getGlobalProperty("patientIdentifierType.TRACnetID")); DataqualityFormController.setMsgToDisplay( "tracdataquality.indicator.PatientsWithoutTRACnetID"); log.info("bottom patientWithNoTRACnet"); } else if (programIdKey.equals("patientWithNoNID")) { log.info("top patientWithNoNID"); patients = getPatientWithNoGivenIdentifier(getGlobalProperty("patientIdentifierType.NID")); DataqualityFormController.setMsgToDisplay("tracdataquality.indicator.PatientsWithoutNID"); log.info("bottom patientWithNoNID"); } else if (programIdKey.equals("exitedPatientWithProgram")) { log.info("top exitedPatientWithProgram"); List<Patient> patientsExitedFromCare = new ArrayList<Patient>(); List<Patient> patientWithoutProgram = new ArrayList<Patient>(); patientsExitedFromCare = getPatientWithAgivenConcept(getConcept(getGlobalProperty("concept.reasonExitedCare"))); patientWithoutProgram = getPatientWithoutProgram(); for (Patient patient : patientsExitedFromCare) { if (!patientWithoutProgram.contains(patient)) { patients.add(patient); } } DataqualityFormController.setMsgToDisplay( "tracdataquality.indicator.exitedPatientWithProgram"); log.info("bottom exitedPatientWithProgram"); } else if (programIdKey.equals("patientInAnyHIVProgramWithNoHIVTestDate")) { log.info("top patientInAnyHIVProgramWithNoHIVTestDate"); // List<Patient> patientsHIVProgram = new ArrayList<Patient>(); List<Patient> patientsWithoutHIVTestDate = new ArrayList<Patient>(); // ProgramWorkflowService programService = Context.getProgramWorkflowService(); patientsWithoutHIVTestDate = getPatientWithoutAdmitionModeConcept( getConcept(getGlobalProperty("concept.HIVTestDate"))); log.info("number of patients with no hiv test date : " + patientsWithoutHIVTestDate.size()); patients.addAll(patientsWithoutHIVTestDate); DataqualityFormController.setMsgToDisplay( "tracdataquality.indicator.patientInAnyHIVProgramWithNoHIVTestDate"); log.info("bottom patientInAnyHIVProgramWithNoHIVTestDate"); } else if (programIdKey.equals("PatientsWhoStoppedRegimenAndReasonIsNotRecorded")) { log.info("top PatientsWhoStoppedRegimenAndReasonIsNotRecorded"); List<Integer> patientIds = new ArrayList<Integer>(); DataQualityService serviceQualityCheck = ((DataQualityService) Context.getService(DataQualityService.class)); patientIds = serviceQualityCheck.getPatientsWhoStoppedDrugWithoutDiscontinuedReason(); for (Integer integer : patientIds) { Patient patient = getPatientById(integer); patients.add(patient); } DataqualityFormController.setMsgToDisplay( "tracdataquality.indicator.PatientsWhoStoppedRegimenAndReasonIsNotRecorded"); log.info("bottom PatientsWhoStoppedRegimenAndReasonIsNotRecorded"); } else if (programIdKey.equals("PatientsPediatricsWhoHaveAdultWhoStage")) { log.info("top PatientsPediatricsWhoHaveAdultWhoStage"); patients = getPatientsPediatricsWhoHaveAdultWhoStage(); DataqualityFormController.setMsgToDisplay( "tracdataquality.indicator.PatientsPediatricWhoHaveAdultWhoStage"); /*log.info("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@bottom PatientsPediatricsWhoHaveAdultWhoStage" + patients);*/ } else if (programIdKey.equals("PatientsAdultWhoHaveChildWhoStage")) { log.info("top PatientsAdultWhoHaveChildWhoStage"); patients = getPatientsAdultWhoHavePedsWhoStage(); DataqualityFormController.setMsgToDisplay( "tracdataquality.indicator.PatientsAdultWhoHaveChildWhoStage"); log.info("bottom PatientsAdultWhoHaveChildWhoStage"); } else if (programIdKey.equals("PatientsWhoAreInPMTCTWithNoCPNId")) { log.info("top PatientsWhoAreInPMTCTWithNoCPNId"); patients = getPatientsWhoAreInPMTCTWithNoCPNId(); DataqualityFormController.setMsgToDisplay( "tracdataquality.indicator.PatientsInPMTCTWithNoCPNid"); log.info("bottom PatientsWhoAreInPMTCTWithNoCPNId"); } else if (programIdKey.equals("PatientsWithNoReturnVisitDate")) { log.info("top PatientsWithNoReturnVisitDate"); patients = getPatientWithoutAgivenConcept(getConcept(getGlobalProperty("concept.returnVisitDate"))); DataqualityFormController.setMsgToDisplay( "tracdataquality.indicator.PatientsWithNoReturnVisitDate"); log.info("bottom PatientsWithNoReturnVisitDate"); } DataQualityService serviceQualityCheck = ((DataQualityService) Context.getService(DataQualityService.class)); List<Integer> exitedPatient = serviceQualityCheck.getPatientsExitedFromCare(); // log.info("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"+exitedPatient); // List<Integer> patientsExited = getPatientsExitedFromCare(); for (Patient patient : patients) { // && !patientsExited.contains(patient.getPatientId()) // = getPatientsExitedFromCare(); if (!patient.isVoided() && !exitedPatient.contains(patient.getPatientId())) { activePatients.add(patient); } } Collections.sort(activePatients, new PatientSortByName()); return activePatients; }
/** * gets patients with a given Concept * * @param concept * @return patients */ public List<Patient> getPatientWithAgivenConcept(Concept concept) { DataQualityService dqs = ((DataQualityService) Context.getService(DataQualityService.class)); List<Patient> patientList = dqs.getPatientsWithObs(concept); return patientList; }
/** * gets patients who are currently in a program * * @param session * @return patientsWhoHaveProgram */ public List<Patient> getPatientWhoHaveProgram() { DataQualityService dqs = ((DataQualityService) Context.getService(DataQualityService.class)); return dqs.getPatientWhoHaveProgram(); }
/** * gets patients by program * * @param program * @return patients */ public List<Patient> getPatientsByProgram(Program program) { DataQualityService serviceQualityCheck = ((DataQualityService) Context.getService(DataQualityService.class)); return serviceQualityCheck.getPatientsByProgram(program); }