|
@ -6,6 +6,7 @@ import com.yihu.wlyy.statistics.etl.model.CacheModel;
|
|
|
import com.yihu.wlyy.statistics.job.business.Constant;
|
|
|
import com.yihu.wlyy.statistics.model.label.SignPatientLabelInfo;
|
|
|
import com.yihu.wlyy.statistics.model.signfamily.SignFamily;
|
|
|
import com.yihu.wlyy.statistics.model.signfamily.SignFamilyServer;
|
|
|
import com.yihu.wlyy.statistics.util.SpringUtil;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
@ -21,87 +22,95 @@ import java.util.Map;
|
|
|
*/
|
|
|
@Component
|
|
|
public class CachePool {
|
|
|
private static List<String> keys=new ArrayList<>();
|
|
|
private static List<String> keys = new ArrayList<>();
|
|
|
|
|
|
/**
|
|
|
* 到达量的缓存 key 是时间yyyy-MM-dd
|
|
|
*/
|
|
|
private static Map<String,CacheModel> arriveSignFamilyExpenseStatus1Map=new HashMap<String,CacheModel>();
|
|
|
private static Map<String, CacheModel> arriveSignFamilyExpenseStatus1Map = new HashMap<String, CacheModel>();
|
|
|
|
|
|
/**
|
|
|
* 分组标签的缓存 key 是患者code
|
|
|
*/
|
|
|
private static Map<String,String> patientGroup=new HashMap<String,String>();
|
|
|
private static Map<String, String> patientGroup = new HashMap<String, String>();
|
|
|
/**
|
|
|
* 签约服务分组
|
|
|
*/
|
|
|
private static Map<String, List<String>> serverGroup = new HashMap<String, List<String>>();
|
|
|
/**
|
|
|
* 健康标签的缓存 key 是患者code
|
|
|
*/
|
|
|
private static Map<String,String> healthGroup=new HashMap<String,String>();
|
|
|
private static Map<String, String> healthGroup = new HashMap<String, String>();
|
|
|
/**
|
|
|
* 疾病标签的缓存 key 是患者code
|
|
|
*/
|
|
|
private static Map<String,List<String>> diseaseGroup=new HashMap<String,List<String>>();
|
|
|
private static Map<String, List<String>> diseaseGroup = new HashMap<String, List<String>>();
|
|
|
|
|
|
/**
|
|
|
* 某天的签约的已扣费的到达量
|
|
|
*
|
|
|
* @param date
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public synchronized CacheModel getSignFamilysWithExpenseStatus1ByDate(String date) throws Exception{
|
|
|
CacheModel model= arriveSignFamilyExpenseStatus1Map.get(date);
|
|
|
if(model==null){
|
|
|
model=new CacheModel();
|
|
|
String sql=" select id,code,idcard,hospital,admin_team_code,expenses_status,patient,server_type from wlyy_sign_family a " +
|
|
|
public synchronized CacheModel getSignFamilysWithExpenseStatus1ByDate(String date) throws Exception {
|
|
|
CacheModel model = arriveSignFamilyExpenseStatus1Map.get(date);
|
|
|
if (model == null) {
|
|
|
model = new CacheModel();
|
|
|
String sql = " select id,code,idcard,hospital,admin_team_code,expenses_status,patient,server_type from wlyy_sign_family a " +
|
|
|
" where " +
|
|
|
" status in(1,2) " +
|
|
|
" and a.type =2 " +
|
|
|
" and expenses_status=1 " +
|
|
|
" and a.expenses_time< '"+date+ Constant.quota_date_last+"' " +
|
|
|
" and a.sign_year ='"+Constant.getNowYearByDateYeaterday(date)+"' " ;
|
|
|
String sqlCount="select count(id) from wlyy_sign_family a " +
|
|
|
" and a.expenses_time< '" + date + Constant.quota_date_last + "' " +
|
|
|
" and a.sign_year ='" + Constant.getNowYearByDateYeaterday(date) + "' ";
|
|
|
String sqlCount = "select count(id) from wlyy_sign_family a " +
|
|
|
" where " +
|
|
|
" status in(1,2) " +
|
|
|
" and a.type =2 " +
|
|
|
" and expenses_status=1 " +
|
|
|
" and a.expenses_time< '"+date+ Constant.quota_date_last+"' " +
|
|
|
" and a.sign_year ='"+Constant.getNowYearByDateYeaterday(date)+"' " ;
|
|
|
" and a.expenses_time< '" + date + Constant.quota_date_last + "' " +
|
|
|
" and a.sign_year ='" + Constant.getNowYearByDateYeaterday(date) + "' ";
|
|
|
//抽取數據 分页抽取
|
|
|
List<SignFamily> signFamiliesTemp= SpringUtil.getBean(DBExtract.class).extractByPage(SignFamily.class,sql,sqlCount,true);
|
|
|
List<SignFamily> signFamiliesTemp = SpringUtil.getBean(DBExtract.class).extractByPage(SignFamily.class, sql, sqlCount, true);
|
|
|
model.setSql(sql);
|
|
|
model.setSignFamilies(signFamiliesTemp);
|
|
|
arriveSignFamilyExpenseStatus1Map.put(date,model);
|
|
|
arriveSignFamilyExpenseStatus1Map.put(date, model);
|
|
|
return model;
|
|
|
}else{
|
|
|
} else {
|
|
|
return model;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询某人的分组标签
|
|
|
*
|
|
|
* @param patientCode
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String getPatientGroup(String patientCode){
|
|
|
String code=null;
|
|
|
try{
|
|
|
if(patientGroup.size()==0){
|
|
|
public String getPatientGroup(String patientCode) {
|
|
|
String code = null;
|
|
|
try {
|
|
|
if (patientGroup.size() == 0) {
|
|
|
initPatientGroup();
|
|
|
}
|
|
|
code= patientGroup.get(patientCode);
|
|
|
if(StringUtils.isEmpty(code)){
|
|
|
code="0";
|
|
|
code = patientGroup.get(patientCode);
|
|
|
if (StringUtils.isEmpty(code)) {
|
|
|
code = "0";
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return code;
|
|
|
}
|
|
|
return code;
|
|
|
}
|
|
|
|
|
|
private synchronized void initPatientGroup() throws Exception{
|
|
|
if(patientGroup.size()==0) {
|
|
|
String sql="select patient,label from wlyy_sign_patient_label_info where label_type='1' and status=1";
|
|
|
String countSql="select count(id) from wlyy_sign_patient_label_info where label_type='1' and status=1";
|
|
|
List<SignPatientLabelInfo> signPatientLabelInfoList = SpringUtil.getBean(DBExtract.class).extractByPage(SignPatientLabelInfo.class,sql,countSql,true);
|
|
|
private synchronized void initPatientGroup() throws Exception {
|
|
|
if (patientGroup.size() == 0) {
|
|
|
String sql = "select patient,label from wlyy_sign_patient_label_info where label_type='1' and status=1";
|
|
|
String countSql = "select count(id) from wlyy_sign_patient_label_info where label_type='1' and status=1";
|
|
|
List<SignPatientLabelInfo> signPatientLabelInfoList = SpringUtil.getBean(DBExtract.class).extractByPage(SignPatientLabelInfo.class, sql, countSql, true);
|
|
|
for (SignPatientLabelInfo signPatientLabelInfo : signPatientLabelInfoList) {
|
|
|
patientGroup.put(signPatientLabelInfo.getPatient(), signPatientLabelInfo.getLabel());
|
|
|
}
|
|
@ -110,70 +119,72 @@ public class CachePool {
|
|
|
|
|
|
/**
|
|
|
* 查询某人的健康标签
|
|
|
*
|
|
|
* @param patientCode
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String getHealthGroup(String patientCode){
|
|
|
public String getHealthGroup(String patientCode) {
|
|
|
String code;
|
|
|
try{
|
|
|
if(healthGroup.size()==0){
|
|
|
try {
|
|
|
if (healthGroup.size() == 0) {
|
|
|
initHealthGroup();
|
|
|
}
|
|
|
code= healthGroup.get(patientCode);
|
|
|
}catch (Exception e){
|
|
|
code = healthGroup.get(patientCode);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return "0";
|
|
|
}
|
|
|
if(StringUtils.isEmpty(code)){
|
|
|
code="0";
|
|
|
if (StringUtils.isEmpty(code)) {
|
|
|
code = "0";
|
|
|
}
|
|
|
return code;
|
|
|
}
|
|
|
|
|
|
private synchronized void initHealthGroup() throws Exception{
|
|
|
if(healthGroup.size()==0){
|
|
|
String sql="select patient,label from wlyy_sign_patient_label_info where label_type='2' and status=1";
|
|
|
String countSql="select count(id) from wlyy_sign_patient_label_info where label_type='2' and status=1";
|
|
|
List<SignPatientLabelInfo> signPatientLabelInfoList = SpringUtil.getBean(DBExtract.class).extractByPage(SignPatientLabelInfo.class,sql,countSql,true);
|
|
|
for(SignPatientLabelInfo signPatientLabelInfo:signPatientLabelInfoList){
|
|
|
healthGroup.put(signPatientLabelInfo.getPatient(),signPatientLabelInfo.getLabel());
|
|
|
private synchronized void initHealthGroup() throws Exception {
|
|
|
if (healthGroup.size() == 0) {
|
|
|
String sql = "select patient,label from wlyy_sign_patient_label_info where label_type='2' and status=1";
|
|
|
String countSql = "select count(id) from wlyy_sign_patient_label_info where label_type='2' and status=1";
|
|
|
List<SignPatientLabelInfo> signPatientLabelInfoList = SpringUtil.getBean(DBExtract.class).extractByPage(SignPatientLabelInfo.class, sql, countSql, true);
|
|
|
for (SignPatientLabelInfo signPatientLabelInfo : signPatientLabelInfoList) {
|
|
|
healthGroup.put(signPatientLabelInfo.getPatient(), signPatientLabelInfo.getLabel());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询某人的疾病标签
|
|
|
*
|
|
|
* @param patientCode
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public List<String> getDiseaseGroup(String patientCode) {
|
|
|
try{
|
|
|
if(diseaseGroup.size()==0){
|
|
|
public List<String> getDiseaseGroup(String patientCode) {
|
|
|
try {
|
|
|
if (diseaseGroup.size() == 0) {
|
|
|
initDiseaseGroup();
|
|
|
}
|
|
|
List<String> code= diseaseGroup.get(patientCode);
|
|
|
List<String> code = diseaseGroup.get(patientCode);
|
|
|
return code;
|
|
|
}catch (Exception e){
|
|
|
} catch (Exception e) {
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private synchronized void initDiseaseGroup() throws Exception{
|
|
|
if(diseaseGroup.size()==0){
|
|
|
String sql="select patient,label from wlyy_sign_patient_label_info where label_type='3' and status=1";
|
|
|
String countSql="select count(id) from wlyy_sign_patient_label_info where label_type='3' and status=1";
|
|
|
List<SignPatientLabelInfo> signPatientLabelInfoList = SpringUtil.getBean(DBExtract.class).extractByPage(SignPatientLabelInfo.class,sql,countSql,true);
|
|
|
for(SignPatientLabelInfo signPatientLabelInfo:signPatientLabelInfoList){
|
|
|
if(diseaseGroup.containsKey(signPatientLabelInfo.getPatient())){
|
|
|
List<String> code= diseaseGroup.get(signPatientLabelInfo.getPatient());
|
|
|
private synchronized void initDiseaseGroup() throws Exception {
|
|
|
if (diseaseGroup.size() == 0) {
|
|
|
String sql = "select patient,label from wlyy_sign_patient_label_info where label_type='3' and status=1";
|
|
|
String countSql = "select count(id) from wlyy_sign_patient_label_info where label_type='3' and status=1";
|
|
|
List<SignPatientLabelInfo> signPatientLabelInfoList = SpringUtil.getBean(DBExtract.class).extractByPage(SignPatientLabelInfo.class, sql, countSql, true);
|
|
|
for (SignPatientLabelInfo signPatientLabelInfo : signPatientLabelInfoList) {
|
|
|
if (diseaseGroup.containsKey(signPatientLabelInfo.getPatient())) {
|
|
|
List<String> code = diseaseGroup.get(signPatientLabelInfo.getPatient());
|
|
|
code.add(signPatientLabelInfo.getLabel());
|
|
|
diseaseGroup.put(signPatientLabelInfo.getPatient(),code);
|
|
|
}else{
|
|
|
List<String> code=new ArrayList<>();
|
|
|
diseaseGroup.put(signPatientLabelInfo.getPatient(), code);
|
|
|
} else {
|
|
|
List<String> code = new ArrayList<>();
|
|
|
code.add(signPatientLabelInfo.getLabel());
|
|
|
diseaseGroup.put(signPatientLabelInfo.getPatient(),code);
|
|
|
diseaseGroup.put(signPatientLabelInfo.getPatient(), code);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@ -184,6 +195,7 @@ public class CachePool {
|
|
|
patientGroup.clear();
|
|
|
diseaseGroup.clear();
|
|
|
healthGroup.clear();
|
|
|
serverGroup.clear();
|
|
|
}
|
|
|
|
|
|
public static Map<String, CacheModel> getArriveSignFamilyExpenseStatus1Map() {
|
|
@ -194,9 +206,11 @@ public class CachePool {
|
|
|
keys.clear();
|
|
|
keys.addAll(keyTemp);
|
|
|
}
|
|
|
|
|
|
public static List<String> getKeys() {
|
|
|
return keys;
|
|
|
}
|
|
|
|
|
|
public static Map<String, String> getPatientGroup() {
|
|
|
return patientGroup;
|
|
|
}
|
|
@ -208,4 +222,38 @@ public class CachePool {
|
|
|
public static Map<String, List<String>> getDiseaseGroup() {
|
|
|
return diseaseGroup;
|
|
|
}
|
|
|
|
|
|
|
|
|
public static List<String> getServerType(String signCode) {
|
|
|
try {
|
|
|
if (serverGroup.size() == 0) {
|
|
|
initServerGroup();
|
|
|
}
|
|
|
List<String> code = serverGroup.get(signCode);
|
|
|
return code;
|
|
|
} catch (Exception e) {
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private static void initServerGroup() {
|
|
|
try {
|
|
|
String sql = "select sign_code,server_type from wlyy_sign_family_server ";
|
|
|
String countSql = "select count(id) from wlyy_sign_family_server ";
|
|
|
List<SignFamilyServer> signPatientLabelInfoList = null;
|
|
|
signPatientLabelInfoList = SpringUtil.getBean(DBExtract.class).extractByPage(SignFamilyServer.class, sql, countSql, true);
|
|
|
for (SignFamilyServer signFamilyServer : signPatientLabelInfoList) {
|
|
|
if (diseaseGroup.containsKey(signFamilyServer.getSignCode())) {
|
|
|
List<String> code = diseaseGroup.get(signFamilyServer.getSignCode());
|
|
|
code.add(signFamilyServer.getServerType());
|
|
|
} else {
|
|
|
List<String> code = new ArrayList<>();
|
|
|
code.add(signFamilyServer.getServerType());
|
|
|
diseaseGroup.put(signFamilyServer.getServerType(), code);
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
}
|