|
@ -38,6 +38,7 @@ public class MedicalInsuranceService {
|
|
|
@Autowired
|
|
|
private HBaseDao hBaseDao;
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 超高费用
|
|
|
* @param month
|
|
@ -92,7 +93,7 @@ public class MedicalInsuranceService {
|
|
|
}
|
|
|
if(StringUtils.isNotEmpty(hosLevel)||StringUtils.isNotEmpty(hosHierarchy)){
|
|
|
String orgCode=getOrgCode(hosLevel,hosHierarchy);
|
|
|
sb.append(" AND org_code:(").append(orgCode).append(")");
|
|
|
sb.append(" AND org_code:(").append(StringUtils.isNotEmpty(orgCode)? "null":orgCode).append(")");
|
|
|
}
|
|
|
String[] fields = {"rowkey","patient_name","patient_age","patient_sex","demographic_id","EHR_001211","event_date"};
|
|
|
SolrDocumentList sublist = solrUtil.query(ResourceCore.SubTable,q,sb.toString(),null,(page-1)*size,size,subfields);
|
|
@ -243,4 +244,79 @@ public class MedicalInsuranceService {
|
|
|
return sex;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 用药分析
|
|
|
* @param start
|
|
|
* @param end
|
|
|
* @param eventType
|
|
|
* @param drugName
|
|
|
* @param size
|
|
|
* @param page
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public Envelop drugAnalysis(String start,String end,String eventType,String drugName,int size, int page) throws Exception{
|
|
|
Envelop result = new Envelop();
|
|
|
String q = "";
|
|
|
StringBuffer sb = new StringBuffer();
|
|
|
if(StringUtils.isNotEmpty(drugName)){
|
|
|
q = "EHR_000100:*"+drugName+"* OR EHR_000131:*"+drugName+"*";
|
|
|
}else{
|
|
|
q = "EHR_000100:* OR EHR_000131:*";
|
|
|
}
|
|
|
start = start+"T00:00:00Z";
|
|
|
end = end+"T00:00:00Z";
|
|
|
sb.append("event_date:[").append(start).append(" TO ").append(end).append("]");
|
|
|
if(StringUtils.isNotEmpty(eventType)){
|
|
|
sb.append(" AND event_type:"+eventType);
|
|
|
}
|
|
|
String[] subfields = new String[7];
|
|
|
subfields[0]="EHR_000045";
|
|
|
subfields[1]="EHR_000109_VALUE";
|
|
|
subfields[2]="profile_id";
|
|
|
subfields[3]="EHR_000175";
|
|
|
subfields[4]="EHR_000293_VALUE";
|
|
|
subfields[5]="event_type";
|
|
|
subfields[6]="rowkey";
|
|
|
String[] fi1elds = {"rowkey","patient_name","patient_age","patient_sex","demographic_id","EHR_001211","event_date"};
|
|
|
SolrDocumentList sublist = solrUtil.query(ResourceCore.SubTable,q,sb.toString(),null,(page-1)*size,size,subfields);
|
|
|
if(sublist!=null && sublist.getNumFound()>0){
|
|
|
for (SolrDocument doc : sublist){
|
|
|
String subRowkey = String.valueOf(doc.getFieldValue("rowkey"));
|
|
|
Map<String, Object> map = hBaseDao.getResultMap(ResourceCore.SubTable, subRowkey);
|
|
|
if(subRowkey.indexOf("HDSD00_84")!=-1){
|
|
|
doc.put("HDSD00_04_023",map.get("EHR_000100"));//西药名称
|
|
|
}else{
|
|
|
doc.put("HDSD00_04_023",map.get("EHR_000131"));//中药名称
|
|
|
}
|
|
|
doc.put("HDSD00_04_021",map.get("EHR_000129"));//规格
|
|
|
doc.put("HDSD00_04_027",map.get("HDSD00_04_027_VALUE")+" 每次"+ map.get("EHR_000101")+
|
|
|
map.get("EHR_000133")+" "+map.get("EHR_000134"));//用法
|
|
|
doc.put("HDSD00_04_028",map.get("EHR_000104"));//总量
|
|
|
if("0".equals(map.get("event_type"))){
|
|
|
doc.put("fee",doc.getFieldValue("EHR_000045"));//门诊费用
|
|
|
doc.put("diagnosis",doc.getFieldValue("EHR_000109_VALUE"));//门诊诊断
|
|
|
}else if("1".equals(map.get("event_type"))){
|
|
|
doc.put("fee",doc.getFieldValue("EHR_000175"));
|
|
|
doc.put("diagnosis",doc.getFieldValue("EHR_000293_VALUE"));
|
|
|
}
|
|
|
String q1="rowkey:"+doc.getFieldValue("profile_id");
|
|
|
SolrDocumentList list = solrUtil.query(ResourceCore.MasterTable,q1,null,null,0,1,fi1elds);
|
|
|
doc.putAll(list.get(0));
|
|
|
}
|
|
|
}
|
|
|
long count = solrUtil.count(ResourceCore.SubTable, q, sb.toString());
|
|
|
result.setSuccessFlg(true);
|
|
|
result.setDetailModelList(sublist);
|
|
|
result.setTotalCount((int)count);
|
|
|
result.setCurrPage(page);
|
|
|
result.setPageSize(size);
|
|
|
if (result.getTotalCount() % result.getPageSize() > 0) {
|
|
|
result.setTotalPage(result.getTotalCount() / result.getPageSize() + 1);
|
|
|
} else {
|
|
|
result.setTotalPage(result.getTotalCount() / result.getPageSize());
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
}
|