Просмотр исходного кода

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

wujunjie 8 лет назад
Родитель
Сommit
3572079c67

+ 4 - 9
patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/job/business/CurrentMysqlToEsQuotaJob.java

@ -108,7 +108,7 @@ public class CurrentMysqlToEsQuotaJob implements Job {
        this.endTime = DateUtil.getStringDate("yyyy-MM-dd HH:mm:ss");
        //初始化统计年份
        this.year = getNowYearByDate(endTime);
        this.year = getNowYearByDate();
        //初始化开始时间
        if ("2".equals(timeLevel)) {
@ -116,11 +116,7 @@ public class CurrentMysqlToEsQuotaJob implements Job {
            startTime = this.year + "-06-30 17:00:00";
        }else{
            //增量
            if (StringUtils.isEmpty(startTime)) {
                this.startTime = new LocalDate(new DateTime().minusDays(1)).toString("yyyy-MM-dd") + " 17:00:00"; //2017-06-01 17:00:00
            } else {
                startTime = startTime + " 17:00:00";
            }
            this.startTime = new LocalDate(new DateTime().minusDays(1)).toString("yyyy-MM-dd") + " 17:00:00"; //2017-06-01 17:00:00
        }
        this.quotaDate = DateUtil.strToDate(endTime, "yyyy-MM-dd");
@ -137,7 +133,7 @@ public class CurrentMysqlToEsQuotaJob implements Job {
        List<QuartzJobConfig> list = quartzJobConfigDao.findByIds();
        list.stream().forEach(one -> {
            try {
                logger.info("========================quotaCode:" + one.getId() + ","+DateUtil.dateToStr(quotaDate, "yyyy-MM-dd")+" start========================");
                logger.info("========================quotaCode:" + one.getId() + ","+DateUtil.dateToStr(quotaDate, "yyyy-MM-dd")+",timeLevel:"+timeLevel+" start========================");
                QuartzJobLog tjQuotaLog = new QuartzJobLog();
                tjQuotaLog.setJobId(one.getId());
                tjQuotaLog.setJobStartTime(new Date());
@ -311,10 +307,9 @@ public class CurrentMysqlToEsQuotaJob implements Job {
    /**
     * 获取现在时间属于那个年度
     *
     * @param date
     * @return
     */
    public static String getNowYearByDate(String date) throws Exception {
    public static String getNowYearByDate() throws Exception {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        Date today = new Date();
        String todayString = simpleDateFormat.format(today);

+ 3 - 3
patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/job/business/MysqlToEsQuotaJob.java

@ -135,7 +135,7 @@ public class MysqlToEsQuotaJob implements Job {
     */
    private void computequota() {
        try {
            logger.info("========================quotaCode:" + wlyyJobConfigVO.getId() + ","+DateUtil.dateToStr(quotaDate, "yyyy-MM-dd")+" start========================");
            logger.info("========================quotaCode:" + wlyyJobConfigVO.getId() + ","+DateUtil.dateToStr(quotaDate, "yyyy-MM-dd")+",timeLevel:"+timeLevel+" start========================");
            QuartzJobLog tjQuotaLog = new QuartzJobLog();
            tjQuotaLog.setJobId(wlyyJobConfigVO.getId());
            tjQuotaLog.setJobStartTime(new Date());
@ -303,11 +303,11 @@ public class MysqlToEsQuotaJob implements Job {
     */
    public static String getNowYearByDate(String date) throws Exception {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        Date today = new Date();
        Date today = simpleDateFormat.parse(date);
        String todayString = simpleDateFormat.format(today);
        String startDateString = (1900 + today.getYear()) + "-07-01";
        String startDateString = (1900 + today.getYear()) + "-06-30";
        Date startDate = simpleDateFormat.parse(startDateString);
        if (simpleDateFormat.parse(todayString).after(startDate)) {
            return (1900 + today.getYear()) + "";

+ 9 - 5
patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/util/IdCardUtil.java

@ -10,7 +10,7 @@ import java.util.Date;
 */
public class IdCardUtil {
//    /**
    //    /**
//     * 根据身份证的号码算出当前身份证持有者的年龄
//     *
//     * @param
@ -49,6 +49,10 @@ public class IdCardUtil {
//        }
//        return age;
//    }
    public static void main(String[] args) throws Exception{
        System.out.println(getSexForIdcard("350206199109092048"));
    }
    /**
     * 根据身份证的号码算出当前身份证持有者的性别
     * 1 女 2 男 3未知
@ -63,22 +67,22 @@ public class IdCardUtil {
            if (Integer.parseInt(CardCode.substring(16).substring(0, 1)) % 2 == 0) {// 判断性别
                // modifid by lyr 2016-09-29
                // sex =  Constant.level_sex_2;
                sex ="1";
                sex = "2";
                // modifid by lyr 2016-09-29
            } else {
                // modifid by lyr 2016-09-29
                // sex =  Constant.level_sex_1;
                sex ="2";
                sex = "1";
                // modifid by lyr 2016-09-29
            }
        } else if (CardCode.length() == 15) {
            String usex = CardCode.substring(14, 15);// 用户的性别
            if (Integer.parseInt(usex) % 2 == 0) {
                // sex =  Constant.level_sex_2;
                sex = "1";
                sex = "2";
            } else {
                // sex =  Constant.level_sex_1;
                sex = "2";
                sex = "1";
            }
        }
        return sex;

+ 7 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/consult/EvaluateDao.java

@ -3,6 +3,7 @@ package com.yihu.wlyy.repository.consult;
import com.yihu.wlyy.entity.consult.Evaluate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
@ -33,4 +34,10 @@ public interface EvaluateDao extends PagingAndSortingRepository<Evaluate, Long>,
     */
    List<Evaluate> findByDoctorAndType(String doctor,int type);
    /**
     * 查找所有分数为零的接口
     */
    @Query("select a from Evaluate a where a.score =0")
    List<Evaluate> findByScoreZero();
}

+ 1 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/consult/EvaluateScoreDao.java

@ -22,4 +22,5 @@ public interface EvaluateScoreDao extends PagingAndSortingRepository<EvaluateSco
     */
    List<EvaluateScore> findByConsult(String consult);
    List<EvaluateScore> findByConsultAndDoctor(String consult,String doctor);
}

+ 27 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statistics/StatisticsAllService.java

@ -1,6 +1,8 @@
package com.yihu.wlyy.service.app.statistics;
import com.yihu.wlyy.entity.address.Town;
import com.yihu.wlyy.entity.consult.Evaluate;
import com.yihu.wlyy.entity.consult.EvaluateScore;
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
import com.yihu.wlyy.entity.organization.Hospital;
import com.yihu.wlyy.entity.statistics.PopulationBase;
@ -8,6 +10,8 @@ import com.yihu.wlyy.entity.statistics.WlyyQuotaResult;
import com.yihu.wlyy.job.Constant;
import com.yihu.wlyy.repository.address.CityDao;
import com.yihu.wlyy.repository.address.TownDao;
import com.yihu.wlyy.repository.consult.EvaluateDao;
import com.yihu.wlyy.repository.consult.EvaluateScoreDao;
import com.yihu.wlyy.repository.doctor.DoctorAdminTeamDao;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.organization.HospitalDao;
@ -23,6 +27,7 @@ import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import java.text.DecimalFormat;
@ -55,6 +60,10 @@ public class StatisticsAllService extends BaseService {
    private WlyyQuotaResultDao wlyyQuotaResultDao;
    @Autowired
    private SystemDictService systemDictService;
    @Autowired
    private EvaluateDao evaluateDao;
    @Autowired
    private EvaluateScoreDao evaluateScoreDao;
    /**
     * 获取时间戳
@ -2822,4 +2831,22 @@ public class StatisticsAllService extends BaseService {
        List<PopulationBase> peopleNum = jdbcTemplate.query(sql, new BeanPropertyRowMapper(PopulationBase.class), code, year);
        return peopleNum.get(0);
    }
    @Transactional
    public int cleanDoctorScore(){
        List<Evaluate> evaluates = evaluateDao.findByScoreZero();
        if(evaluates!=null&&evaluates.size()>0){
            for(Evaluate eva : evaluates){
                List<EvaluateScore> scores =  evaluateScoreDao.findByConsultAndDoctor(eva.getConsult(),eva.getDoctor());
                if(scores!=null&&scores.size()>0){
                    EvaluateScore score = scores.get(0);
                    if(score!=null){
                        eva.setScore(score.getScore().intValue());
                        evaluateDao.save(eva);
                    }
                }
            }
        }
        return 1;
    }
}

+ 12 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/StatisticsController.java

@ -1540,4 +1540,16 @@ public class StatisticsController extends BaseController {
            return error(-1, "查询失败");
        }
    }
    @RequestMapping("/cleanDoctorScore")
    @ResponseBody
    public String cleanDoctorScore(){
        try{
            return write(200, "清洗完成", "data", statisticsAllService.cleanDoctorScore());
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
         }
    }
}