Skip to content

Commit

Permalink
fix merge conflicts from development
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Zurek committed Jan 31, 2015
2 parents 3a6b668 + 53d9364 commit 704e9c4
Show file tree
Hide file tree
Showing 243 changed files with 13,619 additions and 1,640 deletions.
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#Installation and Configuration using IntelliJ IDEA

### Required downloads
1. [MySQL](http://www.mysql.com/)
2. [Play Framework](http://downloads.typesafe.com/typesafe-activator/1.2.10/typesafe-activator-1.2.10.zip)
3. [Java JDK](http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html)
4. [IntelliJ IDEA](http://www.jetbrains.com/idea/)
1. [MySQL 5.6](http://www.mysql.com/)
2. [Play Framework 2.3.7](http://downloads.typesafe.com/typesafe-activator/1.2.10/typesafe-activator-1.2.10.zip)
3. [Java JDK 1.7](http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html)
4. [IntelliJ IDEA 13](http://www.jetbrains.com/idea/)
5. [Git](http://git-scm.com/)

### Configuration
Expand Down
5 changes: 4 additions & 1 deletion CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@ These people have contributed to fEMR's design and implementation:
* [Priyesh Pandya](https://github.com/priyeshp)
* [Danny Reinheimer](https://github.com/codeitandloadit)
* [Cohen Carlisle](https://github.com/Cohen-Carlisle)
* [Brandon Dane](https://github.com/b6025)
* [Brandon Dane](https://github.com/b6025)
* [Ken Dunlap](https://github.com/kdunlap)
* [Arslan Gondal](https://github.com/unfixed)
* [Khoa Le](https://github.com/khoal)
211 changes: 198 additions & 13 deletions app/femr/business/helpers/DomainMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,17 @@

import com.avaje.ebean.Ebean;
import com.google.inject.Inject;

import javax.inject.Provider;

import femr.common.models.*;
import femr.data.models.*;
import femr.ui.models.research.FilterViewModel;
import femr.data.models.core.*;
import femr.util.calculations.dateUtils;
import femr.util.stringhelpers.StringUtils;
import org.joda.time.DateTime;

import java.util.Date;
import java.util.List;

/**
Expand All @@ -39,14 +44,17 @@ public class DomainMapper {
private final Provider<IMedicationActiveDrug> medicationActiveDrugProvider;
private final Provider<IMedicationMeasurementUnit> medicationMeasurementUnitProvider;
private final Provider<IMedicationForm> medicationFormProvider;
private final Provider<IMissionCity> missionCityProvider;
private final Provider<IMissionCountry> missionCountryProvider;
private final Provider<IMissionTeam> missionTeamProvider;
private final Provider<IMissionTrip> missionTripProvider;
private final Provider<IPatient> patientProvider;
private final Provider<IPatientAgeClassification> patientAgeClassificationProvider;
private final Provider<IPatientEncounterPhoto> patientEncounterPhotoProvider;
private final Provider<IPatientEncounter> patientEncounterProvider;
private final Provider<IPatientEncounterTabField> patientEncounterTabFieldProvider;
private final Provider<IPatientEncounterVital> patientEncounterVitalProvider;
private final Provider<IPatientPrescription> patientPrescriptionProvider;

private final Provider<IPhoto> photoProvider;
private final Provider<IRole> roleProvider;
private final Provider<ITabField> tabFieldProvider;
Expand All @@ -63,6 +71,10 @@ public DomainMapper(Provider<IChiefComplaint> chiefComplaintProvider,
Provider<IMedicationForm> medicationFormProvider,
Provider<IMedicationActiveDrug> medicationActiveDrugProvider,
Provider<IMedicationMeasurementUnit> medicationMeasurementUnitProvider,
Provider<IMissionCity> missionCityProvider,
Provider<IMissionCountry> missionCountryProvider,
Provider<IMissionTeam> missionTeamProvider,
Provider<IMissionTrip> missionTripProvider,
Provider<IPatient> patientProvider,
Provider<IPatientAgeClassification> patientAgeClassificationProvider,
Provider<IPatientEncounterPhoto> patientEncounterPhotoProvider,
Expand All @@ -84,7 +96,11 @@ public DomainMapper(Provider<IChiefComplaint> chiefComplaintProvider,
this.medicationActiveDrugNameProvider = medicationActiveDrugNameProvider;
this.medicationFormProvider = medicationFormProvider;
this.medicationActiveDrugProvider = medicationActiveDrugProvider;
this.medicationMeasurementUnitProvider = medicationMeasurementUnitProvider;
this.medicationMeasurementUnitProvider = medicationMeasurementUnitProvider;
this.missionCityProvider = missionCityProvider;
this.missionCountryProvider = missionCountryProvider;
this.missionTeamProvider = missionTeamProvider;
this.missionTripProvider = missionTripProvider;
this.patientProvider = patientProvider;
this.patientAgeClassificationProvider = patientAgeClassificationProvider;
this.patientEncounterPhotoProvider = patientEncounterPhotoProvider;
Expand Down Expand Up @@ -175,6 +191,107 @@ public ITabField createTabField(TabFieldItem tabFieldItem, Boolean isDeleted, IT
return tabField;
}

/**
* Creates a trip item
*
* @param teamName name of the team
* @param tripCity city of the trip
* @param tripCountry country of the trip
* @param startDate when the trip starts
* @param endDate when the trip ends
* @return
*/
public static TripItem createTripItem(String teamName, String tripCity, String tripCountry, Date startDate, Date endDate) {
if (StringUtils.isNullOrWhiteSpace(teamName)||
StringUtils.isNullOrWhiteSpace(tripCity) ||
StringUtils.isNullOrWhiteSpace(tripCountry) ||
startDate == null){
return null;
}

TripItem tripItem = new TripItem();
tripItem.setTeamName(teamName);
tripItem.setTripCity(tripCity);
tripItem.setTripCountry(tripCountry);
tripItem.setTripStartDate(startDate);
tripItem.setTripEndDate(endDate);
return tripItem;
}

public static TeamItem createTeamItem(String name, String location, String description){
if (StringUtils.isNullOrWhiteSpace(name)){
return null;
}
TeamItem teamItem = new TeamItem();
teamItem.setName(name);
teamItem.setLocation(location);
teamItem.setDescription(description);
return teamItem;
}

public static CityItem createCityItem(String cityName, String countryName){
if (StringUtils.isNullOrWhiteSpace(cityName) || StringUtils.isNullOrWhiteSpace(countryName))
return null;

CityItem cityItem = new CityItem();
cityItem.setCityName(cityName);
cityItem.setCountryName(countryName);
return cityItem;
}

/**
* Create a new mission trip
*
* @param startDate start date of the trip
* @param endDate end date of the trip
* @param isCurrent is this the current trip?
* @param missionCity the city where the trip is taking place
* @param missionTeam the country where the trip is taking place
* @return a brand spankin' new freakin' mission trip
*/
public IMissionTrip createMissionTrip(Date startDate, Date endDate, boolean isCurrent, IMissionCity missionCity, IMissionTeam missionTeam) {
if (startDate == null || endDate == null || missionCity == null || missionTeam == null) {
return null;
}
IMissionTrip missionTrip = missionTripProvider.get();
missionTrip.setCurrent(isCurrent);
missionTrip.setStartDate(startDate);
missionTrip.setEndDate(endDate);
missionTrip.setMissionCity(missionCity);
missionTrip.setMissionTeam(missionTeam);
return missionTrip;
}

public IMissionCountry createMissionCountry(String name) {
if (StringUtils.isNullOrWhiteSpace(name)) {
return null;
}
IMissionCountry missionCountry = missionCountryProvider.get();
missionCountry.setName(name);
return missionCountry;
}

public IMissionCity createMissionCity(String name, IMissionCountry missionCountry) {
if (StringUtils.isNullOrWhiteSpace(name) || missionCountry == null) {
return null;
}
IMissionCity missionCity = missionCityProvider.get();
missionCity.setMissionCountry(missionCountry);
missionCity.setName(name);
return missionCity;
}

public IMissionTeam createMissionTeam(String name, String location, String description) {
if (StringUtils.isNullOrWhiteSpace(name)) {
return null;
}
IMissionTeam missionTeam = missionTeamProvider.get();
missionTeam.setName(name);
missionTeam.setLocation(location);
missionTeam.setDescription(description);
return missionTeam;
}

/**
* Create a new TabItem (DTO)
*
Expand Down Expand Up @@ -286,7 +403,7 @@ public static MedicationItem createMedicationItem(IMedication medication) {
}

String fullActiveDrugName = "";
for(IMedicationActiveDrug medicationActiveDrug : medication.getMedicationActiveDrugs()){
for (IMedicationActiveDrug medicationActiveDrug : medication.getMedicationActiveDrugs()) {
medicationItem.addActiveIngredient(medicationActiveDrug.getMedicationActiveDrugName().getName(),
medicationActiveDrug.getMedicationMeasurementUnit().getName(),
medicationActiveDrug.getValue(),
Expand Down Expand Up @@ -325,7 +442,7 @@ public IMedication createMedication(MedicationItem medicationItem, List<IMedicat
return medication;
}

public IMedicationForm createMedicationForm(String name){
public IMedicationForm createMedicationForm(String name) {
IMedicationForm medicationForm = medicationFormProvider.get();
medicationForm.setName(name);
medicationForm.setIsDeleted(false);
Expand All @@ -335,13 +452,13 @@ public IMedicationForm createMedicationForm(String name){
/**
* Creates a new active drug
*
* @param value strength of the drug
* @param isDenominator is the drug a denominator
* @param activeDrugUnitId id of the unit for measurement of the drug
* @param value strength of the drug
* @param isDenominator is the drug a denominator
* @param activeDrugUnitId id of the unit for measurement of the drug
* @param medicationActiveDrugName the drug name
* @return new active drug
*/
public IMedicationActiveDrug createMedicationActiveDrug(int value, boolean isDenominator, int activeDrugUnitId, IMedicationActiveDrugName medicationActiveDrugName){
public IMedicationActiveDrug createMedicationActiveDrug(int value, boolean isDenominator, int activeDrugUnitId, IMedicationActiveDrugName medicationActiveDrugName) {
IMedicationActiveDrug medicationActiveDrug = medicationActiveDrugProvider.get();
medicationActiveDrug.setValue(value);
medicationActiveDrug.setDenominator(isDenominator);
Expand All @@ -350,12 +467,25 @@ public IMedicationActiveDrug createMedicationActiveDrug(int value, boolean isDen
return medicationActiveDrug;
}

public IMedicationActiveDrugName createMedicationActiveDrugName(String name){
public IMedicationActiveDrugName createMedicationActiveDrugName(String name) {
IMedicationActiveDrugName medicationActiveDrugName = medicationActiveDrugNameProvider.get();
medicationActiveDrugName.setName(name);
return medicationActiveDrugName;
}

public IPatientEncounterVital createPatientEncounterVital(int encounterId, int userId, String time, IVital vital, float vitalKey) {
if (vital == null || encounterId < 1 || userId < 1) {
return null;
}
IPatientEncounterVital patientEncounterVital = patientEncounterVitalProvider.get();
patientEncounterVital.setPatientEncounterId(encounterId);
patientEncounterVital.setUserId(userId);
patientEncounterVital.setDateTaken(time);
patientEncounterVital.setVital(vital);
patientEncounterVital.setVitalValue(vitalKey);
return patientEncounterVital;
}

/**
* Creates an IMedication
* TODO: this should be a prescription, not a medication
Expand Down Expand Up @@ -409,7 +539,7 @@ public static PatientEncounterItem createPatientEncounterItem(IPatientEncounter
* @param userId id of the user creating the encounter
* @return a new PatientEncounter
*/
public IPatientEncounter createPatientEncounter(PatientEncounterItem patientEncounterItem, int userId, Integer patientAgeClassificationId) {
public IPatientEncounter createPatientEncounter(PatientEncounterItem patientEncounterItem, int userId, Integer patientAgeClassificationId, Integer tripId) {
if (patientEncounterItem == null || userId < 1) {
return null;
}
Expand All @@ -421,6 +551,8 @@ public IPatientEncounter createPatientEncounter(PatientEncounterItem patientEnco
patientEncounter.setWeeksPregnant(patientEncounterItem.getWeeksPregnant());
if (patientAgeClassificationId != null)
patientEncounter.setPatientAgeClassification(Ebean.getReference(patientAgeClassificationProvider.get().getClass(), patientAgeClassificationId));
if (tripId != null)
patientEncounter.setMissionTrip(Ebean.getReference(missionTripProvider.get().getClass(), tripId));
return patientEncounter;
}

Expand All @@ -434,6 +566,26 @@ public IChiefComplaint createChiefComplaint(String value, int patientEncounterId
return chiefComplaint;
}

public static MissionItem createMissionItem(IMissionTeam missionTeam) {

MissionItem missionItem = new MissionItem();
missionItem.setTeamName(missionTeam.getName());
missionItem.setTeamLocation(missionTeam.getLocation());
missionItem.setTeamDescription(missionTeam.getDescription());

for (IMissionTrip mt : missionTeam.getMissionTrips()) {
missionItem.addMissionTrip(mt.getId(),
mt.getMissionCity().getName(),
mt.getMissionCity().getMissionCountry().getName(),
mt.getStartDate(),
dateUtils.getFriendlyDate(mt.getStartDate()),
mt.getEndDate(),
dateUtils.getFriendlyDate(mt.getEndDate()),
mt.isCurrent());
}
return missionItem;
}

public PrescriptionItem createPrescriptionItem(IPatientPrescription patientPrescription) {
if (patientPrescription == null) {
return null;
Expand Down Expand Up @@ -469,7 +621,7 @@ public static PatientItem createPatientItem(IPatient patient, Integer weeksPregn
}
PatientItem patientItem = new PatientItem();
patientItem.setAddress(patient.getAddress());
if (patient.getAge() != null){
if (patient.getAge() != null) {
patientItem.setAge(dateUtils.getAge(patient.getAge()));//age (int)
patientItem.setBirth(patient.getAge());//date of birth(date)
patientItem.setFriendlyDateOfBirth(dateUtils.getFriendlyDate(patient.getAge()));
Expand Down Expand Up @@ -576,7 +728,7 @@ public IPatientEncounterTabField createPatientEncounterTabField(ITabField tabFie
* @param userId id of the user creating the prescription
* @param encounterId encounter id of the prescription
* @param replacementId id of the prescription being replaced OR null
* @param isDispensed is the patient prescription dispensed to the patient yet
* @param isDispensed is the patient prescription dispensed to the patient yet
* @return a new IPatientPrescription
*/
public IPatientPrescription createPatientPrescription(int amount, IMedication medication, int userId, int encounterId, Integer replacementId, boolean isDispensed, boolean isCounseled) {
Expand Down Expand Up @@ -641,5 +793,38 @@ public IPhoto createPhoto(String description, String filePath) {
return photo;
}

/**
* Create research filter
*
* @param filterViewModel
* @return ResearchFilterItem
*/
public static ResearchFilterItem createResearchFilterItem(FilterViewModel filterViewModel) {

ResearchFilterItem filterItem = new ResearchFilterItem();

filterItem.setPrimaryDataset(filterViewModel.getPrimaryDataset());
filterItem.setSecondaryDataset(filterViewModel.getSecondaryDataset());
filterItem.setGraphType(filterViewModel.getGraphType());
filterItem.setStartDate(filterViewModel.getStartDate());
filterItem.setEndDate(filterViewModel.getEndDate());

Integer groupFactor = filterViewModel.getGroupFactor();
filterItem.setGroupFactor(groupFactor);
if (groupFactor != null && groupFactor > 0) {

filterItem.setGroupPrimary(filterViewModel.isGroupPrimary());
} else {

filterItem.setGroupPrimary(false);
}

filterItem.setRangeStart(filterViewModel.getRangeStart());
filterItem.setRangeEnd(filterViewModel.getRangeEnd());

filterItem.setMedicationId(filterViewModel.getMedicationId());

return filterItem;
}

}
2 changes: 1 addition & 1 deletion app/femr/business/helpers/LogicDoer.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
package femr.business.helpers;

import com.typesafe.config.ConfigFactory;
import femr.data.models.IPatientEncounter;
import femr.data.models.core.IPatientEncounter;
import femr.util.calculations.dateUtils;
import org.joda.time.DateTime;

Expand Down
5 changes: 2 additions & 3 deletions app/femr/business/helpers/QueryHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@
package femr.business.helpers;

import com.avaje.ebean.Query;
import femr.common.models.VitalItem;
import femr.data.daos.IRepository;
import femr.data.models.IPatientEncounterVital;
import femr.data.models.PatientEncounterVital;
import femr.data.models.core.IPatientEncounterVital;
import femr.data.models.mysql.PatientEncounterVital;

import java.util.List;

Expand Down
Loading

0 comments on commit 704e9c4

Please sign in to comment.