Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mariam testing #46

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,9 @@ omod/.classpath
omod/.gitignore
omod/.project
omod/.settings/
api/target/
omod/target/
*.iml
.idea/
.idea/libraries/*.*

2 changes: 1 addition & 1 deletion api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.openmrs.module</groupId>
<artifactId>mohbilling</artifactId>
<version>0.0.3.1-SNAPSHOT</version>
<version>0.0.3.3-SNAPSHOT</version>
</parent>
<artifactId>mohbilling-api</artifactId>
<packaging>jar</packaging>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/**
*
*/
package org.openmrs.module.mohbilling;

import org.openmrs.api.context.Context;
import org.openmrs.module.mohbilling.businesslogic.HopServiceUtil;
import org.openmrs.module.mohbilling.model.Department;
import org.openmrs.module.mohbilling.model.HopService;

import java.util.*;

/**
* @author emr
*
*/
public class GlobalPropertyConfig {


public static String getListOfHopServicesByDepartment1(Department department){
return Context.getAdministrationService().getGlobalProperty("mohbilling."+department.getName()+"");
}

/**
* gets a list of Hop Services by a matching department
* @param department
* @return Set<HopService> services
*/
public static Set<String> getListOfHopServicesByDepartment(Department department){

Set<String> services = new HashSet<String>();
StringTokenizer tokenizer = null;
if(getListOfHopServicesByDepartment1(department)!=null){
tokenizer = new StringTokenizer(getListOfHopServicesByDepartment1(department),",");
while (tokenizer.hasMoreTokens()) {
Integer ServiceId = Integer.parseInt(tokenizer.nextToken());
String hopServiceName= HopServiceUtil.getHopServiceById(ServiceId).getName();
services.add(hopServiceName);
}
}
return services;
}

/**
* Gets a List of services from global properties matching with a given parameter
* @param revenueCateg parameters name configured in Global property
* @return List<HopService>
*/
public static List<HopService> getHospitalServiceByCategory(String categ){
List<HopService> services = new ArrayList<HopService>();
try {
StringTokenizer tokenizer = new StringTokenizer(getHospitalServiceByCateg(categ),",");
while (tokenizer.hasMoreTokens()) {
Integer serviceId = Integer.parseInt(tokenizer.nextToken());
HopService service = HopServiceUtil.getHopServiceById(serviceId);
services.add(service);
System.out.println("rrrrrrrrrrrrrrrrrrrrrrrrrrrrruuuuuuuuuuuuuuuuuuuuuuuuuouyt "+service.getName().toString());
}
} catch (Exception e) {
// TODO: handle exception
}
return services;
}
/**
* gets a revenues matching revenueCateg
* @param category
* @return String object
*/
public static String getHospitalServiceByCateg(String categ){
return Context.getAdministrationService().getGlobalProperty(categ);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
/**
*
*/
package org.openmrs.module.mohbilling;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
* @author emr
*
*/
public class ParametersConversion {

/**
* The meth
* @param request
* @param name
* @return
*/
public static Date getStartDate(String startDateStr,String startHourStr,String startMinute){
DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
DateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");

String startTimeStr = startHourStr + ":" + startMinute + ":00";

Date startDate=null;
try {
if(!startHourStr.equals("") && startMinute!=null)
startDate = sdf.parse(startDateStr.split("/")[2] + "-"
+ startDateStr.split("/")[1] + "-"
+ startDateStr.split("/")[0] + " " + startTimeStr);
else{
startTimeStr="";
startDate = sdf1.parse(startDateStr.split("/")[2] + "-"
+ startDateStr.split("/")[1] + "-"
+ startDateStr.split("/")[0]
+startTimeStr
);
}
} catch (ParseException e) {

e.printStackTrace();
}
return startDate;

}
public static Date getEndDate(String endDateStr,String endHourStr,String endMinuteStr){

DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
DateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");

//String endTimeStr = endHourStr + ":" + endMinuteStr + ":59";
String endTimeStr = "23:59:59";


Date endDate =null;
try {
endDate = sdf.parse(endDateStr.split("/")[2] + "-" + endDateStr.split("/")[1] + "-" + endDateStr.split("/")[0] + " " + endTimeStr);
}catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

/*try {
if(!endHourStr.equals("") && endMinuteStr!=null){
endDate = sdf.parse(endDateStr.split("/")[2] + "-"
+ endDateStr.split("/")[1] + "-" + endDateStr.split("/")[0]
+ " " + endTimeStr);
}
else{
endTimeStr = "";
endDate = sdf1.parse(endDateStr.split("/")[2] + "-"
+ endDateStr.split("/")[1] + "-" + endDateStr.split("/")[0]
+" "+endTimeStr);
}
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
*/
return endDate;

}
public static Date getConvertStringToDate(String dateStr){
DateFormat df = new SimpleDateFormat(dateStr);
Date date = null;
if (dateStr != null && dateStr.length() != 0) {
try {
date = df.parse(dateStr);
} catch (ParseException e) {
e.printStackTrace();
}
}
return date;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,20 @@
*/
package org.openmrs.module.mohbilling.advice;

import java.lang.reflect.Method;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.directwebremoting.guice.RequestScoped;
import org.openmrs.Encounter;
import org.openmrs.Obs;
import org.openmrs.Patient;
import org.openmrs.api.context.Context;
import org.openmrs.module.mohbilling.businesslogic.BillingConstants;
import org.openmrs.module.mohbilling.businesslogic.InsurancePolicyUtil;
import org.openmrs.module.mohbilling.businesslogic.InsuranceUtil;
import org.openmrs.module.mohbilling.model.InsurancePolicy;
import org.springframework.aop.AfterReturningAdvice;

import java.lang.reflect.Method;

/**
* @author Kamonyo
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package org.openmrs.module.mohbilling.advice;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.TreeSet;

public class MohBillingUsageStatsUtils {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,13 @@
*/
package org.openmrs.module.mohbilling.advice;

import java.lang.reflect.Method;
import java.util.Date;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.directwebremoting.guice.RequestScoped;
import org.openmrs.Patient;
import org.openmrs.PatientIdentifier;
import org.openmrs.api.context.Context;
import org.openmrs.module.mohbilling.businesslogic.BillingConstants;
import org.openmrs.module.mohbilling.businesslogic.InsurancePolicyUtil;
import org.openmrs.module.mohbilling.businesslogic.InsuranceUtil;
import org.openmrs.module.mohbilling.model.Beneficiary;
import org.openmrs.module.mohbilling.model.Insurance;
import org.openmrs.module.mohbilling.model.InsurancePolicy;
import org.openmrs.module.mohbilling.service.BillingService;
import org.springframework.aop.AfterReturningAdvice;

import java.lang.reflect.Method;

/**
* @author Kamonyo
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/**
*
*/
package org.openmrs.module.mohbilling.businesslogic;

import org.openmrs.api.context.Context;
import org.openmrs.module.mohbilling.model.Admission;
import org.openmrs.module.mohbilling.model.InsurancePolicy;
import org.openmrs.module.mohbilling.service.BillingService;

import java.util.List;

/**
* @author emr
*
*/
public class AdmissionUtil {

/**
* Offers the BillingService to be use to talk to the DB
*
* @return the BillingService
*/
private static BillingService getService() {

return Context.getService(BillingService.class);
}


/**
* save the patient admission to DB
* @param admission patient admission to be saved
* @return the admission saved
*/
public static Admission savePatientAdmission(Admission admission){

return getService().saveAdmission(admission);

}
public static List<Admission> getPatientAdmissionsByInsurancePolicy(InsurancePolicy ip){

return getService().getAdmissionsListByInsurancePolicy(ip);


}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/**
*
*/
package org.openmrs.module.mohbilling.businesslogic;

import org.openmrs.User;
import org.openmrs.module.mohbilling.model.ServiceRevenue;

import java.math.BigDecimal;
import java.util.List;

/**
* @author emr
*
*/
public class AllServiceRevenue {
private List<ServiceRevenue> revenues;
private BigDecimal allDueAmounts;
private BigDecimal allpaidAmount;
private String reportingPeriod;
private User collector;
/**
* @return the revenues
*/
public List<ServiceRevenue> getRevenues() {
return revenues;
}
/**
* @param revenues the revenues to set
*/
public void setRevenues(List<ServiceRevenue> revenues) {
this.revenues = revenues;
}
/**
* @return the allDueAmounts
*/
public BigDecimal getAllDueAmounts() {
return allDueAmounts;
}
/**
* @param allDueAmounts the allDueAmounts to set
*/
public void setAllDueAmounts(BigDecimal allDueAmounts) {
this.allDueAmounts = allDueAmounts;
}
/**
* @return the allpaidAmount
*/
public BigDecimal getAllpaidAmount() {
return allpaidAmount;
}
/**
* @param allpaidAmount the allpaidAmount to set
*/
public void setAllpaidAmount(BigDecimal allpaidAmount) {
this.allpaidAmount = allpaidAmount;
}
/**
* @return the reportingPeriod
*/
public String getReportingPeriod() {
return reportingPeriod;
}
/**
* @param reportingPeriod the reportingPeriod to set
*/
public void setReportingPeriod(String reportingPeriod) {
this.reportingPeriod = reportingPeriod;
}
/**
* @return the collector
*/
public User getCollector() {
return collector;
}
/**
* @param collector the collector to set
*/
public void setCollector(User collector) {
this.collector = collector;
}


}
Loading