Ver código fonte

Merge branch 'dev' of http://192.168.1.220:10080/Amoy/patient-co-management into dev

trick9191 7 anos atrás
pai
commit
6cada2dfdb

+ 3 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/organization/HospitalDao.java

@ -43,4 +43,7 @@ public interface HospitalDao extends PagingAndSortingRepository<Hospital, Long>,
	@Query("select p from Hospital p where p.city = ?1 and p.del='1' and p.level =2 and p.centerSite='00'")
	List<Hospital> findByCity(String city);
    @Query("select p from Hospital p where p.town =?1  and p.del='1' and p.level =2 and p.centerSite='00' AND LENGTH(p.code)=10")
    List<Hospital> findByTownCode10(String town);
}

+ 124 - 7
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java

@ -715,7 +715,7 @@ public class StatisticsESService {
    public JSONObject getGroupInfoOnline(String endDate, String lowCode, String area, int level, String year) throws Exception {
        List<SaveModel> list = elasticsearchUtil.findDateQuotaLevel1(endDate, endDate, area, level, "17", "2", lowCode, null, null);
        List<SaveModel> onlineList = elasticsearchUtil.findDateQuotaLevel1(endDate, endDate, area, level, "17", "2", lowCode, null, null);
        List<SaveModel> onlineList = elasticsearchUtil.findDateQuotaLevel1(endDate, endDate, area, level, "73", "2", lowCode, null, null);
        long total = 0;
        long onlineTotal = 0;
        if (list.size() > 0) {
@ -4516,22 +4516,22 @@ public class StatisticsESService {
        String timeKey = elasticsearchUtil.getQuotaTime();
        String low_level = String.valueOf(StringUtils.isEmpty(lowLevel) ? (level + 1) : lowLevel);
        String renewIndex = "";//续签指标
        if (level==3){//区
            if (StringUtils.isNotBlank(lowCode)){
        if (Integer.valueOf(low_level)==3){//区
            if (StringUtils.isBlank(lowCode)){
                renewIndex="44";
            }else{
                renewIndex="54";
            }
        }
        if (level==4){//社区
            if (StringUtils.isNotBlank(lowCode)){
        if (Integer.valueOf(low_level)==4){//社区
            if (StringUtils.isBlank(lowCode)){
                renewIndex="43";
            }else{
                renewIndex="53";
            }
        }
        if (level==5){//团队
            if (StringUtils.isNotBlank(lowCode)){
        if (Integer.valueOf(low_level)==5){//团队
            if (StringUtils.isBlank(lowCode)){
                renewIndex="42";
            }else{
                renewIndex="52";
@ -4776,4 +4776,121 @@ public class StatisticsESService {
            return new JSONArray();
        }
    }
    /**
     * 订单统计-点击柱状图获取详情
     * @param interval
     * @param date
     * @param disease
     * @param type
     * @return
     */
    public List<Map<String,Object>> getPrescriptionTotalDetailTime(int interval,String date,String disease,String type){
        //如果是日就是按一天,周就是从本周一到本周日,月就是本月第一天到本月最后一天
        String startTime = "";
        String endTime = "";
        if (interval==1){
            startTime = date+" 00:00:00";
            endTime = " 23:59:59";
        }else if (interval==2){
            startTime = DateUtil.getMondayOfThisDate(DateUtil.strToDate(date));
            endTime = DateUtil.getSundayOfThisDate(DateUtil.strToDate(date));
            startTime += " 00:00:00";
            endTime += "23:59:59";
        }else if (interval==3){
            startTime = DateUtil.getFristDayOfMonthThisDate(DateUtil.strToDate(date+"-01"));
            endTime = DateUtil.getLastDayOfMonthThisDate(DateUtil.strToDate(date+"-01"));
            startTime += " 00:00:00";
            endTime += " 23:59:59";
        }
        String sql = "SELECT * FROM wlyy_prescription p ";
        if(StringUtils.isNotBlank(disease)){
            sql += " JOIN wlyy_prescription_diagnosis d ON  d.prescription_code = p.code WHERE d.health_problem ='"+disease+"' ";
        }else{
            sql +=" WHERE 1=1 ";
        }
        if ("2".equals(type)){//已完成
            sql += " AND p.`status` = "+PrescriptionLog.PrescriptionLogStatus.finish.getValue() ;
        }else if ("3".equals(type)){//居民取消
            sql += " AND p.`status` = "+PrescriptionLog.PrescriptionLogStatus.patient_canel.getValue() ;
        }else if ("4".equals(type)){//审核不通过
            sql += " AND p.`status` = "+PrescriptionLog.PrescriptionLogStatus.no_reviewed.getValue() ;
        }else if ("5".equals(type)){//进行中
            sql += " AND  p.`status` < " + PrescriptionLog.PrescriptionLogStatus.finish.getValue() +
                    " AND p.`status`>= " + PrescriptionLog.PrescriptionLogStatus.revieweding.getValue() ;
        }else if ("6".equals(type)){//其他原因取消
            sql += " AND p.`status` <= "+PrescriptionLog.PrescriptionLogStatus.pay_outtime.getValue() ;
        }
        sql += " AND p.create_time <= ? " +
                " AND p.create_time >= ? ";
        List<Map<String,Object>> resultList = jdbcTemplate.queryForList(sql,new Object[]{endTime,startTime});
        return resultList;
    }
    /**
     * 长处方记录筛选
     * @param level
     * @param area
     * @param disease
     * @param status
     * @param type
     * @param startTime
     * @param endTime
     * @return
     */
    public List<Map<String,Object>> getPrescriptionByCondition(String keyWord, String level, String area, String disease, String status, String type, String startTime,String endTime){
        startTime += " 00:00:00";
        endTime += " 23:59:59";
        String sql = "SELECT * FROM wlyy_prescription p ";
        //判断疾病
        if(StringUtils.isNotBlank(disease)){
            sql += " JOIN wlyy_prescription_diagnosis d ON  d.prescription_code = p.code WHERE d.health_problem ='"+disease+"' ";
        }else{
            sql +=" WHERE 1=1 ";
        }
        //判断关键字
        if (StringUtils.isNotBlank(keyWord)){
            sql += " AND (p.patient_name like '%"+keyWord+"%' or p.doctor_name like '%"+keyWord+"%')";
        }
        //判断状态
        if ("2".equals(status)){//已完成
            sql += " AND p.`status` = "+PrescriptionLog.PrescriptionLogStatus.finish.getValue() ;
        }else if ("3".equals(status)){//居民取消
            sql += " AND p.`status` = "+PrescriptionLog.PrescriptionLogStatus.patient_canel.getValue() ;
        }else if ("4".equals(status)){//审核不通过
            sql += " AND p.`status` = "+PrescriptionLog.PrescriptionLogStatus.no_reviewed.getValue() ;
        }else if ("5".equals(status)){//进行中
            sql += " AND  p.`status` < " + PrescriptionLog.PrescriptionLogStatus.finish.getValue() +
                    " AND p.`status`>= " + PrescriptionLog.PrescriptionLogStatus.revieweding.getValue() ;
        }else if ("6".equals(status)){//其他原因取消
            sql += " AND p.`status` <= "+PrescriptionLog.PrescriptionLogStatus.pay_outtime.getValue() ;
        }
        //判断取药方式
        if (StringUtils.isNotBlank(type)){
            //类型1.自取,2.快递配送,3.健管师配送
            if("1".equals(type)){
                sql +=" AND p.dispensary_type ="+type;
            }else if("2".equals(type)){
                sql +=" AND p.dispensary_type ="+type;
            }else if("3".equals(type)){
                sql +=" AND p.dispensary_type ="+type;
            }
        }
        //市区
        if("4".equals(level)){
            //市区无过滤
            //区级
        }else if("3".equals(level)){
            sql += " AND LEFT(p.hospital, 6) = '"+area+"' ";
            //机构
        }else if("2".equals(level)){
            sql += "AND p.hospital = '"+area+"' ";
        }
        sql += " AND p.create_time <= ? " +
                " AND p.create_time >= ? ";
        List<Map<String,Object>> resultList = jdbcTemplate.queryForList(sql,new Object[]{endTime,startTime});
        return resultList;
    }
}

+ 8 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/area/AreaService.java

@ -1,7 +1,9 @@
package com.yihu.wlyy.service.common.area;
import com.yihu.wlyy.entity.address.Town;
import com.yihu.wlyy.entity.organization.Hospital;
import com.yihu.wlyy.repository.address.TownDao;
import com.yihu.wlyy.repository.organization.HospitalDao;
import com.yihu.wlyy.service.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@ -17,6 +19,8 @@ public class AreaService extends BaseService {
    @Autowired
    TownDao townDao;
    @Autowired
    HospitalDao hospitalDao;
    /**
     * 查询城市城镇
@ -27,4 +31,8 @@ public class AreaService extends BaseService {
    public List<Town> getCityTowns(String city){
        return townDao.findByCityCode(city);
    }
    public List<Hospital> getTownHospitals(String town){
     return hospitalDao.findByTownCode10(town);
    }
}

+ 26 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/DateUtil.java

@ -1163,4 +1163,30 @@ public class DateUtil {
		String dateString = formatter.format(date);
		return strToDate(dateString, YYYY_MM_DD);
	}
	/**
	 * 获取当月第一天
	 * @return
	 */
	public static String getFristDayOfMonthThisDate(Date date) {
		SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
		// 获取前月的第一天
		Calendar c = Calendar.getInstance();
		c.setTime(date);
		c.add(Calendar.MONTH, 0);
		c.set(Calendar.DAY_OF_MONTH,1);//设置为1号,当前日期既为本月第一天
		String first = format.format(c.getTime());
		return format.format(c.getTime());
	}
	/**
	 * 获取当月最后一天
	 */
	public static String getLastDayOfMonthThisDate(Date date){
		SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
		// 获取前月的第一天
		Calendar ca = Calendar.getInstance();
		ca.setTime(date);
		ca.set(Calendar.DAY_OF_MONTH, ca.getActualMaximum(Calendar.DAY_OF_MONTH));
		return format.format(ca.getTime());
	}
}

+ 18 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/area/AreaController.java

@ -1,14 +1,12 @@
package com.yihu.wlyy.web.common.area;
import com.yihu.wlyy.entity.address.Town;
import com.yihu.wlyy.entity.organization.Hospital;
import com.yihu.wlyy.service.common.area.AreaService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
@ -40,4 +38,20 @@ public class AreaController extends BaseController {
            return error(-1, "查询失败");
        }
    }
    /**
     * 根据区查询有效的社区机构
     * @param town
     * @return
     */
    @RequestMapping(value = "/getHospitals", method = RequestMethod.GET)
    public String getTownHospitals(@RequestParam(required = true)String town){
        try {
            List<Hospital> hospitals = areaService.getTownHospitals(town);
            return write(200, "查询成功", "data", hospitals == null ? new ArrayList<Hospital>() : hospitals);
        }catch (Exception e){
            error(e);
            return  error(-1,"查询失败");
        }
    }
}

+ 41 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/EsStatisticsController.java

@ -2066,7 +2066,7 @@ public class EsStatisticsController extends BaseController {
    }
    /**
     *
     *订单统计-点击柱状图获取详情
     * @param interval
     * @param date
     * @param disease
@ -2081,7 +2081,46 @@ public class EsStatisticsController extends BaseController {
            @RequestParam(required = true)String date,
            @ApiParam(name="disease", value="疾病类型") @RequestParam(required = false)String disease,
            @ApiParam(name="type", value="类型1.总量,2.已完成,3.居民取消,4.审核不通过,5.进行中,6.其他原因取消") @RequestParam(required = true)String type){
        return "";
        try{
            return write(200, "查询成功", "data", statisticsESService.getPrescriptionTotalDetailTime(interval,date,disease,type));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
        }
    }
    /**
     * 长处方记录筛选
     * @param level 地区级别
     * @param area 地区编号
     * @param disease 疾病
     * @param status 状态 1.总量,2.已完成,3.居民取消,4.审核不通过,5.进行中,6.其他原因取消(没有选择的情况传1)
     * @param type 取药方式 1.自取,2快递配送,3健管师配送
     * @param startTime 开始日期
     * @param endTime 结束日期
     * @return
     */
    @RequestMapping("/getPrescriptionByCondition")
    @ResponseBody
    public String getPrescriptionByCondition(
            @RequestParam(required = false)String keyWord,
            @RequestParam(required = true)String level,
            @RequestParam(required = true)String area,
            @RequestParam(required = false)String disease,
            @RequestParam(required = false,defaultValue = "1")String status,
            @RequestParam(required = false)String type,
            @RequestParam(required = false)String startTime,
            @RequestParam(required = false)String endTime){
        try{
            if (StringUtils.isNotBlank(startTime)){
            }
            return write(200, "查询成功", "data", statisticsESService.getPrescriptionByCondition(keyWord,level,area,disease,status,type,startTime,endTime));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
        }
    }
    /*==================================版本1.4.1统计优化结束 end=====================================*/
}