trick9191 7 лет назад
Родитель
Сommit
8a3956ecfc

+ 9 - 9
patient-co-statistics/pom.xml

@ -8,8 +8,8 @@
    <modelVersion>4.0.0</modelVersion>
    <!--打成war包需要的配置-->
    <packaging>war</packaging>
    <!--<packaging>jar</packaging>-->
    <!--<packaging>war</packaging>-->
    <packaging>jar</packaging>
    <name>patient-co-statistics</name>
    <properties>
@ -376,7 +376,7 @@
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <version>${version.spring-boot}</version>
            <scope>provided</scope>
            <!--<scope>provided</scope>-->
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
@ -404,12 +404,12 @@
    <build>
        <plugins>
            <!--打成war包需要的配置-->
            <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <configuration>
            <failOnMissingWebXml>false</failOnMissingWebXml>
            </configuration>
            </plugin>
            <!--<plugin>-->
            <!--<artifactId>maven-war-plugin</artifactId>-->
            <!--<configuration>-->
            <!--<failOnMissingWebXml>false</failOnMissingWebXml>-->
            <!--</configuration>-->
            <!--</plugin>-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>

+ 6 - 6
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/config/war/ServletInitializer.java

@ -7,9 +7,9 @@ import org.springframework.boot.context.web.SpringBootServletInitializer;
/**
 * Created by Administrator on 2016.10.14.
 */
public class ServletInitializer extends SpringBootServletInitializer {
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(Application.class);
    }
}
//public class ServletInitializer extends SpringBootServletInitializer {
//    @Override
//    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
//        return application.sources(Application.class);
//    }
//}

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

@ -388,4 +388,5 @@ public interface SignFamilyDao extends PagingAndSortingRepository<SignFamily, Lo
    //根据医生和居民判断是否存在签约关系(全科及健管)
    @Query("select count(1) from SignFamily f where f.status > 0 and f.patient = ?1 and ( f.doctor = ?2 or doctorHealth = ?2  )")
    int findByPatientAndDoctor(String patient, String doctor);
}

+ 2 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/SignFamilyRenewDao.java

@ -51,4 +51,6 @@ public interface SignFamilyRenewDao extends PagingAndSortingRepository<SignFamil
    @Query("select a from SignFamilyRenew a where a.teamCode = ?1 and a.type = 2 and a.code = ?2")
    List<SignFamilyRenew> findByTeamCodeIsValid(String teamCode,String code);
    SignFamilyRenew findByCode(String code);
}

+ 68 - 36
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignWebService.java

@ -975,16 +975,18 @@ public class SignWebService extends BaseService {
     * @return
     * @throws Exception
     */
    public int agreeRenew(String access_token, String dotorCode, String patientCode, String state, Long mesId, String signYear) throws Exception {
        List<SignFamilyRenew> renews = signFamilyRenewDao.findByDoctorAndPatientStatus0(dotorCode, patientCode, signYear);
        if (renews == null || renews.size() == 0) {
            renews = signFamilyRenewDao.findByDoctorHealthAndPatientStatus0(dotorCode, patientCode, signYear);
        }
        if (renews != null && renews.size() > 0) {
            for (SignFamilyRenew renew : renews) {
    public int agreeRenew(String access_token, String dotorCode, String patientCode, String state, Long mesId, String signYear,String code) throws Exception {
//        List<SignFamilyRenew> renews = signFamilyRenewDao.findByDoctorAndPatientStatus0(dotorCode, patientCode, signYear);
//
//        if (renews == null || renews.size() == 0) {
//            renews = signFamilyRenewDao.findByDoctorHealthAndPatientStatus0(dotorCode, patientCode, signYear);
//        }
        SignFamilyRenew renew = signFamilyRenewDao.findByCode(code);
        if (renew != null) {
            int status = renew.getStatus();
            if (status == 0) {
                if (StringUtils.isNotBlank(state)) {
                    if ("0".equals(state)) {
                        renew.setStatus(-2);
@ -995,13 +997,7 @@ public class SignWebService extends BaseService {
                renew.setApplyDate(new Date());
                signFamilyRenewDao.save(renew);
                if (mesId != null && mesId > 0) {
                    Message mes = messageDao.findOne(mesId);
                    mes.setRead(0);//设置已读
                    mes.setOver("0");//设置消息操作结束
                    mes.setCzrq(new Date());
                    messageDao.save(mes);
                }
                setMessState(mesId);
                //发送微信模板消息
                JSONObject data = new JSONObject();
@ -1047,10 +1043,32 @@ public class SignWebService extends BaseService {
                        }
                    }
                }
                //-1患者已取消,-2已拒绝,-3已解约,-4已到期,0待签约,1已签约,2患者申请取消签约,3医生申请取消签约
            }else if(status==1){
                //已经同意
                return 2;
            }else if(status==-1){
                //-1患者已取消
                return 3;
            }else if(status ==-2){
                //已拒绝
                return 4;
            }else if(status ==-3){
                //已解约
                return 5;
            }else if(status ==-4){
                //已到期
                return 6;
            }else{
                //已申请取消
                return 7;
            }
        } else {
        } else{
            //未找到签约关系
            return 0;
        }
        //成功
        return 1;
    }
@ -1063,16 +1081,18 @@ public class SignWebService extends BaseService {
     * @return
     * @throws Exception
     */
    public int agreeRenewOverDue(String access_token, String dotorCode, String patientCode, String state, Long mesId, String signYear) throws Exception {
        List<SignFamily> renews = signFamilyDao.findByDoctorAndPatientOverDue(dotorCode, patientCode, signYear);
        if (renews == null || renews.size() == 0) {
            renews = signFamilyDao.findByDoctorHealthAndPatient(dotorCode, patientCode, signYear);
        }
        if (renews != null && renews.size() > 0) {
            for (SignFamily renew : renews) {
    public int agreeRenewOverDue(String access_token, String dotorCode, String patientCode, String state, Long mesId, String signYear ,String signCode) throws Exception {
//        List<SignFamily> renews = signFamilyDao.findByDoctorAndPatientOverDue(dotorCode, patientCode, signYear);
//
//        if (renews == null || renews.size() == 0) {
//            renews = signFamilyDao.findByDoctorHealthAndPatient(dotorCode, patientCode, signYear);
//        }
        SignFamily renew = signFamilyDao.findByCode(signCode);
        if (renew != null) {
            int status = renew.getStatus();
            if (status == 0) {
                if (StringUtils.isNotBlank(state)) {
                    if ("0".equals(state)) {
                        renew.setStatus(-2);
@ -1082,14 +1102,8 @@ public class SignWebService extends BaseService {
                }
                renew.setApplyDate(new Date());
                signFamilyDao.save(renew);
                if (mesId != null && mesId > 0) {
                    Message mes = messageDao.findOne(mesId);
                    mes.setRead(0);//设置已读
                    mes.setOver("0");//设置消息操作结束
                    mes.setCzrq(new Date());
                    messageDao.save(mes);
                }
                //消息设为已读
                setMessState(mesId);
                //发送微信模板消息
                JSONObject data = new JSONObject();
@ -1135,6 +1149,24 @@ public class SignWebService extends BaseService {
                        }
                    }
                }
            }else if(status==1){
                //已经同意
                return 2;
            }else if(status==-1){
                //已拒绝
                return 3;
            }else if(status ==-2){
                //已拒绝
                return 4;
            }else if(status ==-3){
                //已解约
                return 5;
            }else if(status ==-4){
                //已到期
                return 6;
            }else{
                //已取消
                return 7;
            }
        } else {
            return 0;

+ 31 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statistics/StatisticsService.java

@ -1713,6 +1713,8 @@ public class StatisticsService extends BaseService {
     * @return
     */
    public JSONArray getStatTitleInfo(String doctor,String type){
        JSONArray rs = new JSONArray();
        AdminTeam admin =  adminTeamDao.findByLeaderCode(doctor);
        Long id = admin.getId();
        String startDate = "";
@ -1755,8 +1757,35 @@ public class StatisticsService extends BaseService {
        //计算签约表记录
        Map<String,Object> signCount = jdbcTemplate.queryForMap(sign_sql);
        //计算续签表记录
        Map<String,Object> renewCount = jdbcTemplate.queryForMap(sign_sql);
        return null;
        Map<String,Object> renewCount = jdbcTemplate.queryForMap(renew_sql);
        //计算签约总数
        Integer sc = (Integer)signCount.get("signCount");
        Integer rc = (Integer)renewCount.get("renewCount");
        JSONObject signTotal =new JSONObject();
        signTotal.put("signTotal",sc+rc);
        rs.put(signTotal);
        //获取待预约
        Map<String,Object> consultCout= jdbcTemplate.queryForMap(consult_sql);
        rs.put(consultCout);
        //获取待预约
        Map<String,Object> reservationCout= jdbcTemplate.queryForMap(reservation_sql);
        rs.put(reservationCout);
        //获取健康教育
        Map<String,Object> articleCout= jdbcTemplate.queryForMap(article_sql);
        rs.put(articleCout);
        //获取健康指导
        Map<String,Object> guidanceCout= jdbcTemplate.queryForMap(guidance_sql);
        rs.put(guidanceCout);
        //随访数目
        Map<String,Object> followupCout= jdbcTemplate.queryForMap(followup_sql);
        rs.put(followupCout);
        //平均满意度
        Map<String,Object> avgCout= jdbcTemplate.queryForMap(avg_sql);
        rs.put(avgCout);
        return rs;

+ 10 - 7
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorSignController.java

@ -445,9 +445,10 @@ public class DoctorSignController extends WeixinBaseController {
    @ApiOperation(value = "医生处理签约")
    public String agreeRenew(@RequestParam(required = true)String state,
                             @RequestParam(required = true)String patient,
                             @RequestParam(required = false) Long mesId ){
                             @RequestParam(required = false) Long mesId,
                             @RequestParam(required = false)String signCode){
        try{
            //判断是否存在下个年度续签
            int isNowYearSign = signWebService.checkNowYearSign(getUID(),patient);
            if(isNowYearSign==0){
                //设置代码为已读
@ -460,16 +461,18 @@ public class DoctorSignController extends WeixinBaseController {
            int month = cal.get(Calendar.MONTH)+1;
            int rs = 0;
            if(month<7){
                rs =signWebService.agreeRenew(getAccessToken(),getUID(),patient,state,mesId,year+"");
                rs =signWebService.agreeRenew(getAccessToken(),getUID(),patient,state,mesId,year+"",signCode);
//            int rs =signWebService.agreeRenew(getAccessToken(),"test00000000005",patient,state);
            }else{
                rs =signWebService.agreeRenew(getAccessToken(),getUID(),patient,state,mesId,year+"");
                rs =signWebService.agreeRenew(getAccessToken(),getUID(),patient,state,mesId,year+"",signCode);
                //如果没有续签记录,走签约记录
                if(rs==0){
                    rs =signWebService.agreeRenewOverDue(getAccessToken(),getUID(),patient,state,mesId,year+"");
                if(rs!=0){
                    rs =signWebService.agreeRenewOverDue(getAccessToken(),getUID(),patient,state,mesId,year+"",signCode);
                }
            }
            if(rs == 0){
            if(rs != 1){
                //设置代码为已读
                signWebService.setMessState(mesId);
                return  write(200, "未找到签约记录", "data", rs);
            }else{
                return write(200, "操作成功!", "data", rs);