Summary Table
Categories |
Total Count |
PII |
0 |
URL |
0 |
DNS |
0 |
EKL |
0 |
IP |
0 |
PORT |
0 |
VsID |
0 |
CF |
0 |
AI |
0 |
VPD |
0 |
PL |
0 |
Other |
0 |
File Content
package gov.va.med.pbm.ampl.asset.mock;
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.Collection;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import gov.va.med.pbm.ampl.constant.MockDataConstants;
import gov.va.med.pbm.ampl.controller.EnvironmentInternalController;
import gov.va.med.pbm.ampl.model.Appointment;
import gov.va.med.pbm.ampl.model.Location;
import gov.va.med.pbm.ampl.utility.CollectionUtility;
import gov.va.med.pbm.ampl.utility.DateUtility;
import gov.va.med.pbm.ampl.utility.NumberUtility;
/**
* This class generates mock data for the {@link EnvironmentInternalController} end points.
*
* @author Ian Meinert
* @author Pavani Mukthipudi
*
* @since 1.0
*/
public class AppointmentData {
private String patientId;
/**
* The application logger.
*/
static final Logger LOGGER = LoggerFactory.getLogger(ProblemData.class);
/**
* Single parameter constructor.
*
* @param patientId {@link Long}
*/
public AppointmentData(String patientId) {
this.patientId = patientId;
}
/**
* Generates a {@link Problem} {@link Collection} used in mock cases.
*
* @param c the count of {@link Problem} objects to create
* @return a {@link Collection} of {@link Problem} with mock data
*/
public Collection<Appointment> testAppointmentsForPatient(int c) {
Collection<Appointment> appts = new ArrayList<Appointment>();
for (int i = 1; i <= c; i++) {
String s = Appointment.class.getSimpleName().toUpperCase() + i;
OffsetDateTime dt = DateUtility.randomOffsetDateTime(MockDataConstants.TWO_K_SIXTEEN,
MockDataConstants.TWO_K_TWENTY);
Appointment appointment = new Appointment();
appointment.setPatientId(this.patientId);
appointment.setAppointmentId("" + NumberUtility.randomBetween(10000, 99999));
appointment.setAppointmentDate(dt);
appointment.setStatus((String) CollectionUtility
.getRandom(new String[] { "proposed", "pending", "booked", "arrived", "fulfilled", "cancelled", "noshow" }));
appointment.setLocation(this.getTestLocationForPatient(i));
appointment.setProvider("Provider_" + s);
appts.add(appointment);
}
return appts;
}
/**
* Generates a {@link Location} used in mock cases.
*
* @param i the count of {@link Facility} objects to create
* @return a {@link Collection} of {@link Problem} with mock data
*/
private Location getTestLocationForPatient(int i) {
Location location = new Location();
FacilityData facilityData = new FacilityData();
location.setName("Clinic_" + i);
location.setPhysicalType(
(String) CollectionUtility.getRandom(new String[] { "Building", "Wing", "Level", "Corridor", "Room", "Bed" }) + "_"
+ i);
location.setSpecialty("Specialty_" + i);
location.setFacility(facilityData.testFacilityForPatient(i));
return location;
}
}