Browse Source

医保相关

zhengwei 6 years ago
parent
commit
cdad815493

+ 2 - 2
src/main/java/com/yihu/quota/controller/MedicalInsuranceController.java

@ -62,7 +62,7 @@ public class MedicalInsuranceController extends BaseController {
    public Envelop repeateInspect(
            @ApiParam(name = "month", value = "月份", required = true)
            @RequestParam(value = "month" , required = true) String month,
            @ApiParam(name = "inspect", value = "检查类型", required = true)
            @ApiParam(name = "inspect", value = "检查类型", required = false)
            @RequestParam(value = "inspect" , required = true) String inspect,
            @ApiParam(name = "size", value = "分页大小", defaultValue = "15")
            @RequestParam(value = "size", required = false) int size,
@ -82,7 +82,7 @@ public class MedicalInsuranceController extends BaseController {
            @ApiParam(name = "drugName", value = "药品名称")
            @RequestParam(value = "drugName", required = false) String drugName,
            @ApiParam(name = "eventType", value = "就诊类型")
            @RequestParam(value = "eventType") String eventType,
            @RequestParam(value = "eventType", required = false) String eventType,
            @ApiParam(name = "size", value = "分页大小", defaultValue = "15")
            @RequestParam(value = "size", required = false) int size,
            @ApiParam(name = "page", value = "页码", defaultValue = "1")

+ 59 - 15
src/main/java/com/yihu/quota/service/medicalInsurance/MedicalInsuranceService.java

@ -59,7 +59,8 @@ public class MedicalInsuranceService {
        StringBuffer sb = new StringBuffer();
        String start = month+"-01T00:00:00Z";
        String end = DateUtil.getLastDate(month+"-01","yyyy-MM-dd","yyyy-MM-dd")+"T23:59:59Z";
        String[] subfields = new String[3];
        String[] subfields1 = new String[2];
        String[] subfields2 = new String[2];
        String endDate = DateUtil.getLastDateOfLashMonth(month+"-01","yyyy-MM-dd","yyyy-MM-dd");
        String lastmonth=endDate.substring(0,7);//上月
        String startDate=lastmonth+"-01";
@ -75,9 +76,10 @@ public class MedicalInsuranceService {
            }
            sb.append("EHR_000045:[").append(fee).append(" TO *]").append(" AND event_date:[")
                    .append(start).append(" TO ").append(end).append("]");
            subfields[0]="EHR_000045";
            subfields[1]="EHR_000109_VALUE";
            subfields[2]="profile_id";
            subfields1[0]="EHR_000045";
            subfields1[1]="profile_id";
            subfields2[0]="EHR_000109";
            subfields2[1]="EHR_000109_VALUE";
        }else{//住院
            //获取住院次均费用
            List<Map<String, Object>> ls= quotaReportController.getQuotaReportTwoDimensionalTable("HC_07_1002",filters,"month","");
@ -89,24 +91,36 @@ public class MedicalInsuranceService {
            }
            sb.append("EHR_000175:[").append(fee).append(" TO *]").append(" AND event_date:[")
                    .append(start).append(" TO ").append(end).append("]");
            subfields[0]="EHR_000175";
            subfields[1]="EHR_000293_VALUE";
            subfields[2]="profile_id";
            subfields1[0]="EHR_000175";
            subfields1[1]="profile_id";
            subfields2[0]="EHR_000293";
            subfields2[1]="EHR_000293_VALUE";
        }
        if(StringUtils.isNotEmpty(hosLevel)||StringUtils.isNotEmpty(hosHierarchy)){
            String orgCode=getOrgCode(hosLevel,hosHierarchy);
            sb.append(" AND org_code:(").append(StringUtils.isEmpty(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);
        SolrDocumentList sublist = solrUtil.query(ResourceCore.SubTable,q,sb.toString(),null,(page-1)*size,size,subfields1);
        if(sublist!=null && sublist.getNumFound()>0){
            for (SolrDocument doc : sublist){
                String fq="profile_id:"+doc.getFieldValue("profile_id");
                if("0".equals(eventType)){
                    doc.put("fee",doc.getFieldValue("EHR_000045"));//门诊费用
                    doc.put("diagnosis",doc.getFieldValue("EHR_000109_VALUE"));//门诊诊断
                    SolrDocumentList ls = solrUtil.query(ResourceCore.SubTable,"EHR_000109:*",fq,null,0,1,subfields2);
                    if(ls!=null&&ls.size()>0){
                        doc.put("diagnosis",ls.get(0).getFieldValue("EHR_000109_VALUE")+"("+ls.get(0).getFieldValue("EHR_000109")+")");//门诊诊断
                    }else{
                        doc.put("diagnosis","");
                    }
                }else{
                    doc.put("fee",doc.getFieldValue("EHR_000175"));
                    doc.put("diagnosis",doc.getFieldValue("EHR_000293_VALUE"));
                    SolrDocumentList ls = solrUtil.query(ResourceCore.SubTable,"EHR_000293:*",fq,null,0,1,subfields2);
                    if(ls!=null&&ls.size()>0){
                        doc.put("diagnosis",ls.get(0).getFieldValue("EHR_000293_VALUE")+"("+ls.get(0).getFieldValue("EHR_000293")+")");
                    }else{
                        doc.put("diagnosis","");
                    }
                }
                String q1="rowkey:"+doc.getFieldValue("profile_id");
                SolrDocumentList list = solrUtil.query(ResourceCore.MasterTable,q1,null,null,0,1,fields);
@ -452,15 +466,45 @@ public class MedicalInsuranceService {
                    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")+
                doc.put("HDSD00_04_027",map.get("EHR_000136")+" 每次"+ map.get("EHR_000101")+
                        map.get("EHR_000133")+" "+map.get("EHR_000134"));//用法
                doc.put("HDSD00_04_028",map.get("EHR_000104"));//总量
                String[] subfields1 = new String[1];
                String[] subfields2 = new String[2];
                String fq="profile_id:"+doc.getFieldValue("profile_id");
                if("0".equals(map.get("event_type"))){
                    doc.put("fee",doc.getFieldValue("EHR_000045"));//门诊费用
                    doc.put("diagnosis",doc.getFieldValue("EHR_000109_VALUE"));//门诊诊断
                    subfields1[0]="EHR_000045";
                    subfields2[0]="EHR_000109";
                    subfields2[1]="EHR_000109_VALUE";
                    SolrDocumentList ls1 = solrUtil.query(ResourceCore.SubTable,"EHR_000109:*",fq,null,0,1,subfields2);
                    SolrDocumentList ls2 = solrUtil.query(ResourceCore.SubTable,"EHR_000045:*",fq,null,0,1,subfields1);
                    if(ls1!=null&&ls1.size()>0){
                        doc.put("diagnosis",ls1.get(0).getFieldValue("EHR_000109_VALUE")+"("+ls1.get(0).getFieldValue("EHR_000109")+")");
                    }else{
                        doc.put("diagnosis","");
                    }
                    if(ls2!=null&&ls2.size()>0){
                        doc.put("fee",ls2.get(0).getFieldValue("EHR_000045"));//门诊费用
                    }else{
                        doc.put("fee","");
                    }
                }else if("1".equals(map.get("event_type"))){
                    doc.put("fee",doc.getFieldValue("EHR_000175"));
                    doc.put("diagnosis",doc.getFieldValue("EHR_000293_VALUE"));
                    subfields1[0]="EHR_000175";
                    subfields2[0]="EHR_000293";
                    subfields2[1]="EHR_000293_VALUE";
                    SolrDocumentList ls1 = solrUtil.query(ResourceCore.SubTable,"EHR_000293:*",fq,null,0,1,subfields2);
                    SolrDocumentList ls2 = solrUtil.query(ResourceCore.SubTable,"EHR_000175:*",fq,null,0,1,subfields1);
                    if(ls1!=null&&ls1.size()>0){
                        doc.put("diagnosis",ls1.get(0).getFieldValue("EHR_000293_VALUE")+"("+ls1.get(0).getFieldValue("EHR_000293")+")");
                    }else{
                        doc.put("diagnosis","");
                    }
                    if(ls2!=null&&ls2.size()>0){
                        doc.put("fee",ls2.get(0).getFieldValue("EHR_000175"));//门诊费用
                    }else{
                        doc.put("fee","");
                    }
                }
                String q1="rowkey:"+doc.getFieldValue("profile_id");
                SolrDocumentList list = solrUtil.query(ResourceCore.MasterTable,q1,null,null,0,1,fi1elds);