zhengwei 6 éve
szülő
commit
09ed434cb4

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

@ -0,0 +1,89 @@
package com.yihu.quota.controller;
import com.yihu.ehr.constants.ApiVersion;
import com.yihu.ehr.constants.ServiceApi;
import com.yihu.ehr.util.rest.Envelop;
import com.yihu.quota.service.medicalInsurance.MedicalInsuranceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
 * @Author: zhengwei
 * @Date: 2018/9/18 09:30
 * @Description:
 */
@RestController
@RequestMapping(ApiVersion.Version1_0)
@Api(description = "医保相关数据信息接口")
public class MedicalInsuranceController extends BaseController {
    @Autowired
    private MedicalInsuranceService medicalInsuranceService;
    @RequestMapping(value = ServiceApi.TJ.GetOftenIllList, method = RequestMethod.GET)
    @ApiOperation(value = "频繁就医")
    public Envelop oftenIll(
            @ApiParam(name = "size", value = "分页大小", defaultValue = "15")
            @RequestParam(value = "size", required = false) int size,
            @ApiParam(name = "page", value = "页码", defaultValue = "1")
            @RequestParam(value = "page", required = false) int page) throws Exception{
        Envelop envelop = new Envelop();
        return envelop;
    }
    @RequestMapping(value = ServiceApi.TJ.GetHighCostList, method = RequestMethod.GET)
    @ApiOperation(value = "超高费用")
    public Envelop highCost(
            @ApiParam(name = "month", value = "月份", required = true)
            @RequestParam(value = "month" , required = true) String month,
            @ApiParam(name = "eventType", value = "就诊类型")
            @RequestParam(value = "eventType", required = true) String eventType,
            @ApiParam(name = "hosLevel", value = "医院等级")
            @RequestParam(value = "hosLevel", required = false) String hosLevel,
            @ApiParam(name = "hosHierarchy", value = "医院等次")
            @RequestParam(value = "hosHierarchy", required = false) String hosHierarchy,
            @ApiParam(name = "size", value = "分页大小", defaultValue = "15")
            @RequestParam(value = "size", required = false) int size,
            @ApiParam(name = "page", value = "页码", defaultValue = "1")
            @RequestParam(value = "page", required = false) int page) throws Exception{
        Envelop envelop = medicalInsuranceService.highCost(month,eventType,hosLevel,hosHierarchy,size,page);
        return envelop;
    }
    @RequestMapping(value = ServiceApi.TJ.GetRepeateInspectList, method = RequestMethod.GET)
    @ApiOperation(value = "重复检查")
    public Envelop repeateInspect(
            @ApiParam(name = "inspect", value = "检查类型", required = true)
            @RequestParam(value = "inspect" , required = true) String inspect,
            @ApiParam(name = "size", value = "分页大小", defaultValue = "15")
            @RequestParam(value = "size", required = false) int size,
            @ApiParam(name = "page", value = "页码", defaultValue = "1")
            @RequestParam(value = "page", required = false) int page) throws Exception{
        Envelop envelop = new Envelop();
        return envelop;
    }
    @RequestMapping(value = ServiceApi.TJ.DrugAnalysis, method = RequestMethod.GET)
    @ApiOperation(value = "用药分析")
    public Envelop drugAnalysis(
            @ApiParam(name = "start", value = "开始时间", required = true)
            @RequestParam(value = "start" , required = true) String start,
            @ApiParam(name = "end", value = "结束时间", required = true)
            @RequestParam(value = "end" , required = true) String end,
            @ApiParam(name = "drugCode", value = "药品代码")
            @RequestParam(value = "drugCode", required = false) String drugCode,
            @ApiParam(name = "eventType", value = "就诊类型")
            @RequestParam(value = "eventType", required = true) String eventType,
            @ApiParam(name = "size", value = "分页大小", defaultValue = "15")
            @RequestParam(value = "size", required = false) int size,
            @ApiParam(name = "page", value = "页码", defaultValue = "1")
            @RequestParam(value = "page", required = false) int page) throws Exception{
        Envelop envelop = new Envelop();
        return envelop;
    }
}

+ 79 - 0
src/main/java/com/yihu/quota/service/medicalInsurance/MedicalInsuranceService.java

@ -0,0 +1,79 @@
package com.yihu.quota.service.medicalInsurance;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.ehr.profile.core.ResourceCore;
import com.yihu.ehr.solr.SolrUtil;
import com.yihu.ehr.util.datetime.DateUtil;
import com.yihu.ehr.util.rest.Envelop;
import io.swagger.annotations.ApiParam;
import org.apache.solr.common.SolrDocument;
import org.apache.solr.common.SolrDocumentList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;
/**
 * @Author: zhengwei
 * @Date: 2018/9/19 20:35
 * @Description:医保相关
 */
@Service
public class MedicalInsuranceService {
    @Autowired
    private SolrUtil solrUtil;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private ObjectMapper objectMapper;
    /**
     * 超高费用
     * @param month
     * @param eventType
     * @param hosLevel
     * @param hosHierarchy
     * @param size
     * @param page
     * @return
     * @throws Exception
     */
    public Envelop highCost(String month,String eventType,String hosLevel, String hosHierarchy,int size, int page) throws Exception{
        Envelop result = new Envelop();
        double fee = 0.0;
        String q = "event_type:" + eventType;
        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";
        if("0".equals(eventType)){
            fee=3000;
            sb.append("EHR_000045:[").append(fee).append(" TO *]").append(" AND event_date:[")
                    .append(start).append(" TO ").append(end).append("]");
        }else{
            fee=20000;
            sb.append("EHR_000175:[").append(fee).append(" TO *]").append(" AND event_date:[")
                    .append(start).append(" TO ").append(end).append("]");
        }
        SolrDocumentList sublist = solrUtil.query(ResourceCore.SubTable,q,sb.toString(),null,(page-1)*size,size);
        if(sublist!=null && sublist.getNumFound()>0){
            for (SolrDocument doc : sublist){
                String q1="rowkey:"+doc.getFieldValue("profile_id");
                SolrDocumentList list = solrUtil.query(ResourceCore.MasterTable,q1,null,null,0,1);
                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;
    }
}