소스 검색

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

yeshijie 7 년 전
부모
커밋
2953b6e66f
38개의 변경된 파일1051개의 추가작업 그리고 460개의 파일을 삭제
  1. 7 7
      patient-co/patient-co-statistics/pom.xml
  2. 58 0
      patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/config/RedisConfig.java
  3. 1 1
      patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/config/WebSecurityConfig.java
  4. 68 30
      patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/controller/JobController.java
  5. 36 0
      patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/controller/KeyExpiredListener.java
  6. 1 1
      patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/CurrentDayAllQuotaJob.java
  7. 3 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/config/SwaggerConfig.java
  8. 9 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/doctor/profile/Doctor.java
  9. 22 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/Patient.java
  10. 9 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/prescription/Prescription.java
  11. 12 9
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/event/ApplicationEvent.java
  12. 4 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/BaseInterceptor.java
  13. 5 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/DoctorInterceptor.java
  14. 6 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/PatientInterceptor.java
  15. 4 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/DoctorDao.java
  16. 3 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/SignFamilyDao.java
  17. 17 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/DoctorInfoService.java
  18. 60 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PatientPrescriptionPayService.java
  19. 62 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java
  20. 11 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java
  21. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignWebService.java
  22. 3 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statistics/StatisticsService.java
  23. 33 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/JwSmjkService.java
  24. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/wxpay/common/Configure.java
  25. 44 31
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/wxpay/service/OnePayService.java
  26. 2 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/task/PushMsgTask.java
  27. 334 312
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/RSAUtils.java
  28. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/util/WlyySerivceController.java
  29. 55 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/account/DoctorController.java
  30. 33 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionInfoController.java
  31. 3 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionController.java
  32. 103 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionPayController.java
  33. 3 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/sign/PatientSignController.java
  34. 12 9
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/BookingController.java
  35. 11 9
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/wx/OnePayController.java
  36. 6 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/wechat/process/WeiXinEventProcess.java
  37. 6 6
      patient-co/patient-co-wlyy/src/main/resources/application.yml
  38. 2 2
      patient-co/patient-co-wlyy/src/main/resources/config/fdfs_client.conf

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

@ -12,7 +12,7 @@
    <version>1.0.0</version>
    <modelVersion>4.0.0</modelVersion>
    <!--打成war包需要的配置-->
    <packaging>jar</packaging>
    <packaging>war</packaging>
    <!--<packaging>jar</packaging>-->
    <name>patient-co-statistics</name>
@ -418,12 +418,12 @@
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <!--<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>

+ 58 - 0
patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/config/RedisConfig.java

@ -0,0 +1,58 @@
//package com.yihu.wlyy.statistics.config;
//
//import com.yihu.wlyy.statistics.controller.KeyExpiredListener;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.boot.context.properties.ConfigurationProperties;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.data.redis.connection.RedisConnectionFactory;
//import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
//import org.springframework.data.redis.core.StringRedisTemplate;
//import org.springframework.data.redis.listener.PatternTopic;
//import org.springframework.data.redis.listener.RedisMessageListenerContainer;
//import org.springframework.data.redis.listener.adapter.MessageListenerAdapter;
//import redis.clients.jedis.Jedis;
//import redis.clients.jedis.JedisPool;
//import redis.clients.jedis.JedisPoolConfig;
//
//import javax.annotation.PostConstruct;
//
///**
// * Created by chenweida on 2017/7/31.
// */
//@Configuration
//public class RedisConfig {
//    @Value("${spring.redis.host}")
//    private String host;
//    @Value("${spring.redis.port}")
//    private Integer port;
//    @Value("${spring.redis.password}")
//    private String password;
//    @Bean
//    @ConfigurationProperties(prefix = "spring.redis.pool")
//    JedisPoolConfig jedisPoolConfig() {
//        return new JedisPoolConfig();
//    }
//
//    @Bean
//    JedisConnectionFactory jedisConnectionFactory(JedisPoolConfig jedisPoolConfig) {
//        System.out.println(jedisPoolConfig);
//        JedisConnectionFactory jedisConnectionFactory = new JedisConnectionFactory();
//        jedisConnectionFactory.setPoolConfig(jedisPoolConfig);
//        jedisConnectionFactory.setPort(port);
//        jedisConnectionFactory.setHostName(host);
//        jedisConnectionFactory.setPassword(password);
//        return jedisConnectionFactory;
//    }
//
//    @Bean
//    RedisMessageListenerContainer container(RedisConnectionFactory connectionFactory) {
//        RedisMessageListenerContainer container = new RedisMessageListenerContainer();
//        container.setConnectionFactory(connectionFactory);
//        //监听redis过期的生命周期
//        //过期监听的管道默认是__keyevent@0__:expired,艾特后面的0表示第几个是数据库,redis默认的数据库是0~15一共16个数据库。所以如果你存入的数据库是2,那么数据接收的管道就是__keyevent@2__:expired
//        container.addMessageListener(new KeyExpiredListener(connectionFactory), new PatternTopic("__key*__:*"));
//        return container;
//    }
//}

+ 1 - 1
patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/config/WebSecurityConfig.java

@ -21,7 +21,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
    String password;
    protected void configure(HttpSecurity http) throws Exception {
        http.authorizeRequests()
        http.csrf().disable().authorizeRequests()
                .anyRequest().authenticated()
                .and()
                .formLogin().defaultSuccessUrl("/swagger-ui.html").failureUrl("/login") //登录成功之后的跳转

+ 68 - 30
patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/controller/JobController.java

@ -6,12 +6,16 @@ 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.data.redis.core.StringRedisTemplate;
import org.springframework.http.MediaType;
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;
import java.util.Random;
import java.util.concurrent.TimeUnit;
/**
 * 任务启动
@ -23,9 +27,9 @@ import org.springframework.web.bind.annotation.RestController;
@Api(description = "后台-任务控制")
public class JobController extends BaseController {
    @Autowired
    private  JobService jobService;
    private JobService jobService;
    @Autowired
    private StringRedisTemplate redisTemplate;
    /**
     * 启动任务
@ -36,7 +40,7 @@ public class JobController extends BaseController {
    @ApiOperation(value = "根据ID立即单个任务")
    @RequestMapping(value = "startNowById", method = RequestMethod.GET)
    public String startNowById(
            @ApiParam(name = "id", value = "任务ID", required = true)@RequestParam(value = "id", required = true) String id) {
            @ApiParam(name = "id", value = "任务ID", required = true) @RequestParam(value = "id", required = true) String id) {
        try {
            jobService.cleanCache();
            jobService.startNowById(id);
@ -55,7 +59,7 @@ public class JobController extends BaseController {
     */
    @ApiOperation(value = "生成过去几天的数据")
    @RequestMapping(value = "productDataByDay", method = RequestMethod.GET)
    public String productDataByDay(  @ApiParam(name = "day", value = "距离今天的天数(如果是要生成昨天的数据,day=1)")@RequestParam(value = "day", required = true) int day) {
    public String productDataByDay(@ApiParam(name = "day", value = "距离今天的天数(如果是要生成昨天的数据,day=1)") @RequestParam(value = "day", required = true) int day) {
        try {
            jobService.cleanCache();
            jobService.productDataByDay(day);
@ -74,7 +78,7 @@ public class JobController extends BaseController {
     */
    @ApiOperation(value = "生成过去某一天的全部的数据")
    @RequestMapping(value = "productDataByOneDay", method = RequestMethod.GET)
    public String productDataByOneDay( @ApiParam(name = "day", value = "yyyy-MM-dd")@RequestParam(value = "day", required = true)String day) {
    public String productDataByOneDay(@ApiParam(name = "day", value = "yyyy-MM-dd") @RequestParam(value = "day", required = true) String day) {
        try {
            jobService.cleanCache();
            jobService.productDataByOneDay(day);
@ -84,6 +88,7 @@ public class JobController extends BaseController {
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
    /**
     * 生成过去某一天到某一天的全部的数据
     *
@ -93,17 +98,18 @@ public class JobController extends BaseController {
     */
    @ApiOperation(value = "生成过去某一天到某一天的全部的数据(包含头尾)")
    @RequestMapping(value = "productDataByDayToDay", method = RequestMethod.GET)
    public String productDataByDayToDay( @ApiParam(name = "start", value = "yyyy-MM-dd", required = true)@RequestParam(value = "start", required = true)String start,
                                         @ApiParam(name = "end", value = "yyyy-MM-dd", required = true)@RequestParam(value = "end", required = true)String end) {
    public String productDataByDayToDay(@ApiParam(name = "start", value = "yyyy-MM-dd", required = true) @RequestParam(value = "start", required = true) String start,
                                        @ApiParam(name = "end", value = "yyyy-MM-dd", required = true) @RequestParam(value = "end", required = true) String end) {
        try {
            jobService.cleanCache();
            jobService.productDataByDayToDay(start,end);
            jobService.productDataByDayToDay(start, end);
            return success("启动成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
    /**
     * 生成过去某一天到某一天的某个指标的数据
     *
@ -113,18 +119,19 @@ public class JobController extends BaseController {
     */
    @ApiOperation(value = "生成过去某一天到某一天的某个指标的数据(包含头尾)")
    @RequestMapping(value = "productDataByDayToDayAndId", method = RequestMethod.GET)
    public String productDataByDayToDayAndId( @ApiParam(name = "start", value = "yyyy-MM-dd")@RequestParam(value = "start", required = true)String start,
                                         @ApiParam(name = "end", value = "yyyy-MM-dd")@RequestParam(value = "end", required = true)String end,
                                              @ApiParam(name = "id", value = "任务id")@RequestParam(value = "id", required = true)String id) {
    public String productDataByDayToDayAndId(@ApiParam(name = "start", value = "yyyy-MM-dd") @RequestParam(value = "start", required = true) String start,
                                             @ApiParam(name = "end", value = "yyyy-MM-dd") @RequestParam(value = "end", required = true) String end,
                                             @ApiParam(name = "id", value = "任务id") @RequestParam(value = "id", required = true) String id) {
        try {
            jobService.cleanCache();
            jobService.productDataByDayToDayAndId(start,end,id);
            jobService.productDataByDayToDayAndId(start, end, id);
            return success("启动成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
    /**
     * 生成过去某一天的某一个指标的数据
     *
@ -134,8 +141,8 @@ public class JobController extends BaseController {
    @ApiOperation(value = "生成过去某一天的全部的数据")
    @RequestMapping(value = "productDataByOneDayWithId", method = RequestMethod.GET)
    public String productDataByOneDayWithId(
            @ApiParam(name = "day", value = "yyyy-MM-dd")@RequestParam(value = "day", required = true)String day,
            @ApiParam(name = "id", value = "任务id")@RequestParam(value = "id", required = true)String id) {
            @ApiParam(name = "day", value = "yyyy-MM-dd") @RequestParam(value = "day", required = true) String day,
            @ApiParam(name = "id", value = "任务id") @RequestParam(value = "id", required = true) String id) {
        try {
            jobService.cleanCache();
            jobService.productDataByOneDayWithId(day, id);
@ -145,6 +152,7 @@ public class JobController extends BaseController {
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
    /**
     * 生成过去到现在的全部的数据
     *
@ -154,8 +162,8 @@ public class JobController extends BaseController {
    @ApiOperation(value = "生成过去到现在的全部的数据")
    @RequestMapping(value = "productDataByDayAndId", method = RequestMethod.GET)
    public String productDataByDayAndId(
            @ApiParam(name = "day", value = "距离今天的天数(如果是要生成昨天的数据,day=1)")@RequestParam(value = "day", required = true) int day,
            @ApiParam(name="id",required=true)@RequestParam(value = "id", required = true) String id) {
            @ApiParam(name = "day", value = "距离今天的天数(如果是要生成昨天的数据,day=1)") @RequestParam(value = "day", required = true) int day,
            @ApiParam(name = "id", required = true) @RequestParam(value = "id", required = true) String id) {
        try {
            jobService.cleanCache();
            jobService.productDataByDayAndId(day, id);
@ -171,11 +179,11 @@ public class JobController extends BaseController {
     *
     * @param id id
     * @return
    */
     */
    @ApiOperation(value = "启动单个任务")
    @RequestMapping(value = "startById", method = RequestMethod.GET)
    public String startById(
            @ApiParam(name="id",value="任务id",required=true)@RequestParam(value = "id", required = true) String id) {
            @ApiParam(name = "id", value = "任务id", required = true) @RequestParam(value = "id", required = true) String id) {
        try {
            jobService.startById(id);
            return success("启动成功!");
@ -193,7 +201,7 @@ public class JobController extends BaseController {
     */
    @ApiOperation(value = "停止单个任务")
    @RequestMapping(value = "stopById", method = RequestMethod.GET)
    public String stopById(@ApiParam(name="id",value="任务id",required=true)@RequestParam(value = "id", required = true)String id) {
    public String stopById(@ApiParam(name = "id", value = "任务id", required = true) @RequestParam(value = "id", required = true) String id) {
        try {
            jobService.stopById(id);
            return success("停止成功!");
@ -219,6 +227,7 @@ public class JobController extends BaseController {
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
    /**
     * 启动判断的任务
     *
@ -235,6 +244,7 @@ public class JobController extends BaseController {
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
    /**
     * 停止判断的任务
     *
@ -251,6 +261,7 @@ public class JobController extends BaseController {
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
    /**
     * 启动判断的任务
     *
@ -267,6 +278,7 @@ public class JobController extends BaseController {
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
    /**
     * 停止判断的任务
     *
@ -283,6 +295,7 @@ public class JobController extends BaseController {
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
    /**
     * 启动所有任务
     *
@ -299,6 +312,7 @@ public class JobController extends BaseController {
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
    @ApiOperation(value = "清除緩存")
    @RequestMapping(value = "cleanCache", method = RequestMethod.GET)
    public String cleanCache() {
@ -310,17 +324,19 @@ public class JobController extends BaseController {
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
    @ApiOperation(value = "查看緩存情况")
    @RequestMapping(value = "seeCache", method = RequestMethod.GET)
    public String seeCache() {
        try {
            String message=jobService.seeCache();
            return write(200,message);
            String message = jobService.seeCache();
            return write(200, message);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
    /**
     * 启动健康信息生成的任务
     *
@ -337,6 +353,7 @@ public class JobController extends BaseController {
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
    @ApiOperation(value = "立即启动健康信息生成的任务")
    @RequestMapping(value = "startHealthMessageJobNow", method = RequestMethod.GET)
    public String startHealthMessageJobNow() {
@ -348,6 +365,7 @@ public class JobController extends BaseController {
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
    /**
     * 停止判断的任务
     *
@ -365,7 +383,7 @@ public class JobController extends BaseController {
        }
    }
  //@RequestMapping(value = "startaaaa", method = RequestMethod.GET)
    //@RequestMapping(value = "startaaaa", method = RequestMethod.GET)
    public String startaaaa() {
        try {
            jobService.startaaaa();
@ -375,6 +393,7 @@ public class JobController extends BaseController {
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
    /**
     * 生成过去某一天的健康消息
     *
@ -383,8 +402,8 @@ public class JobController extends BaseController {
     */
    @ApiOperation(value = "生成过去某一天的健康消息")
    @RequestMapping(value = "productHealthDataByOneDay", method = RequestMethod.GET)
    public String productHealthDataByOneDay( @ApiParam(name = "day", value = "yyyy-MM-dd")
                                           @RequestParam(value = "day", required = true)String day) {
    public String productHealthDataByOneDay(@ApiParam(name = "day", value = "yyyy-MM-dd")
                                            @RequestParam(value = "day", required = true) String day) {
        try {
            jobService.productHealthDataByOneDay(day);
            return success("启动成功!");
@ -393,6 +412,7 @@ public class JobController extends BaseController {
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
    /**
     * 生成过去某一天到某一天的某个指标的数据
     *
@ -402,11 +422,11 @@ public class JobController extends BaseController {
     */
    @ApiOperation(value = "生成过去某一天到某一天的健康消息(包含头尾)")
    @RequestMapping(value = "productHealthDataByDayToDay", method = RequestMethod.GET)
    public String productHealthDataByDayToDay( @ApiParam(name = "start", value = "yyyy-MM-dd")@RequestParam(value = "start", required = true)String start,
                                              @ApiParam(name = "end", value = "yyyy-MM-dd")@RequestParam(value = "end", required = true)String end
                                             ) {
    public String productHealthDataByDayToDay(@ApiParam(name = "start", value = "yyyy-MM-dd") @RequestParam(value = "start", required = true) String start,
                                              @ApiParam(name = "end", value = "yyyy-MM-dd") @RequestParam(value = "end", required = true) String end
    ) {
        try {
            jobService.productHealthDataByDayToDay(start,end);
            jobService.productHealthDataByDayToDay(start, end);
            return success("启动成功!");
        } catch (Exception e) {
            error(e);
@ -430,6 +450,7 @@ public class JobController extends BaseController {
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
    /**
     * 停止每天的统计报表任务
     *
@ -446,6 +467,7 @@ public class JobController extends BaseController {
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
    /**
     * 启动通知任务
     *
@ -462,6 +484,7 @@ public class JobController extends BaseController {
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
    /**
     * 启动通知任务
     *
@ -478,6 +501,7 @@ public class JobController extends BaseController {
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
    /**
     * 启动通知任务
     *
@ -495,7 +519,9 @@ public class JobController extends BaseController {
        }
    }
    /******************************** 随访计划消息 ****************************************************/
    /********************************
     * 随访计划消息
     ****************************************************/
    @ApiOperation(value = "启动随访计划消息任务")
    @RequestMapping(value = "startFollowupPlantJob", method = RequestMethod.GET)
@ -520,4 +546,16 @@ public class JobController extends BaseController {
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
    @RequestMapping(value = "addRedisKey", method = RequestMethod.POST)
    public void addRedisKey() {
        try {
            String key="cwd:"+new Random().toString();
            redisTemplate.opsForValue().set(key,"123");
            redisTemplate.expire(key,10, TimeUnit.SECONDS);
        } catch (Exception e) {
            error(e);
        }
    }
}

+ 36 - 0
patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/controller/KeyExpiredListener.java

@ -0,0 +1,36 @@
//package com.yihu.wlyy.statistics.controller;
//
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.data.redis.connection.Message;
//import org.springframework.data.redis.connection.MessageListener;
//import org.springframework.data.redis.connection.RedisConnectionFactory;
//import org.springframework.data.redis.core.StringRedisTemplate;
//import org.springframework.stereotype.Component;
//import redis.clients.jedis.JedisPubSub;
//
//import java.util.concurrent.CountDownLatch;
//
///**
// * Created by chenweida on 2017/7/31.
// */
//public class KeyExpiredListener implements MessageListener {
//
//    private static final Logger LOGGER = LoggerFactory.getLogger(KeyExpiredListener.class);
//    private StringRedisTemplate redisTemplate;
//
//    public KeyExpiredListener(RedisConnectionFactory connectionFactory) {
//        redisTemplate = new StringRedisTemplate();
//        redisTemplate.setConnectionFactory(connectionFactory);
//        redisTemplate.afterPropertiesSet();
//    }
//
//    public void onMessage(Message message, byte[] pattern) {
//        String key = message.toString();
//        if (key.contains("cwd")) {
//            LOGGER.info("Received <" + message + ">");
//            LOGGER.info(redisTemplate.getExpire(message.toString()) + "");
//        }
//    }
//}

+ 1 - 1
patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/CurrentDayAllQuotaJob.java

@ -1702,7 +1702,7 @@ public class CurrentDayAllQuotaJob implements Job {
                    "  t.admin_team_code, " +
                    "  LEFT (d.hospital, 8) " +
                    " ) ss ON ss.admin_team_code = tm.id " +
                    " ORDER BY " +
                    " where tm.available=1 ORDER BY " +
                    " avgCount DESC";
            return team_SQL;
        } else if ("All_hos_SQL".equals(code)) {

+ 3 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/config/SwaggerConfig.java

@ -99,7 +99,9 @@ public class SwaggerConfig {
                        regex("/wx/.*"),
                        regex("/area/.*"),
                        regex("/login/.*"),
                        regex("/qrcode/.*")
                        regex("/qrcode/.*"),
                        regex("/onepay/.*"),
                        regex("/wlyy_service/.*")
                ))
                .build()
                .apiInfo(otherApiInfo());

+ 9 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/doctor/profile/Doctor.java

@ -66,6 +66,7 @@ public class Doctor extends IdEntity {
    private Double evaluateScore;//评分
    private String checkPassword;   //审方密码
    private String checkSalt;       //审方密码的盐
    public Double getEvaluateScore() {
        return evaluateScore;
@ -405,4 +406,12 @@ public class Doctor extends IdEntity {
    public void setCheckPassword(String checkPassword) {
        this.checkPassword = checkPassword;
    }
    public String getCheckSalt() {
        return checkSalt;
    }
    public void setCheckSalt(String checkSalt) {
        this.checkSalt = checkSalt;
    }
}

+ 22 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/Patient.java

@ -3,6 +3,7 @@ package com.yihu.wlyy.entity.patient;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.wlyy.entity.IdEntity;
import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabelInfo;
import com.yihu.wlyy.logs.InterfaceCallLogs;
import org.apache.commons.lang3.builder.ToStringBuilder;
import javax.persistence.Column;
@ -89,6 +90,27 @@ public class Patient extends IdEntity implements Serializable {
	private String sickVillage;
	// 居委会字段名称
	private String sickVillageName;
//	是否绑定电子社保卡
	private Integer sicardStatus;
//	绑定电子社保卡时间
	private Date sicardTime;
	public Integer getSicardStatus() {
		return sicardStatus;
	}
	public void setSicardStatus(Integer sicardStatus) {
		this.sicardStatus = sicardStatus;
	}
	public Date getSicardTime() {
		return sicardTime;
	}
	public void setSicardTime(Date sicardTime) {
		this.sicardTime = sicardTime;
	}
	private List<SignPatientLabelInfo> labelInfos=new ArrayList<>();//患者的疾病标签list

+ 9 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/prescription/Prescription.java

@ -48,6 +48,7 @@ public class Prescription extends IdEntity {
    private String caMessage;                   //ca指纹信息
    private String remark;                     //处方备注
    private String reason;                      //续方原因
    private String reviewedReason; //审核不通过的原因
//    private Double ybCost;                      //医保费用
//    private Double myCost;                      //自己付费
@ -307,4 +308,12 @@ public class Prescription extends IdEntity {
    public void setCaCertData(String caCertData) {
        this.caCertData = caCertData;
    }
    public String getReviewedReason() {
        return reviewedReason;
    }
    public void setReviewedReason(String reviewedReason) {
        this.reviewedReason = reviewedReason;
    }
}

+ 12 - 9
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/event/ApplicationEvent.java

@ -5,6 +5,8 @@ import com.yihu.wlyy.job.SignAgainJob;
import com.yihu.wlyy.job.SignEndJob;
import com.yihu.wlyy.job.consult.EvaluateScoreJob;
import com.yihu.wlyy.util.SystemConf;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
@ -18,6 +20,7 @@ import java.util.HashMap;
@Service
public class ApplicationEvent implements ApplicationListener<ContextRefreshedEvent> {
    private Logger logger= LoggerFactory.getLogger(ApplicationEvent.class);
    @Autowired
    QuartzHelper quartzHelper;
@ -28,36 +31,36 @@ public class ApplicationEvent implements ApplicationListener<ContextRefreshedEve
            if (!quartzHelper.isExistJob("sign_end_job")) {
                String trigger = SystemConf.getInstance().getSystemProperties().getProperty("sign_end_job_trigger");
                quartzHelper.addJob(SignEndJob.class, trigger, "sign_end_job", new HashMap<String, Object>());
                System.out.println("sign end job start success");
                logger.info("sign end job start success");
            } else {
                System.out.println("sign end job exist");
                logger.info("sign end job exist");
            }
            if (!quartzHelper.isExistJob("evaluate_score_job")) {
                String trigger = SystemConf.getInstance().getSystemProperties().getProperty("evaluate_score_job");
                quartzHelper.addJob(EvaluateScoreJob.class, trigger, "evaluate_score_job", new HashMap<String, Object>());
                System.out.println("evaluate_score_job start success");
                logger.info("evaluate_score_job start success");
            } else {
                System.out.println("evaluate_score_job exist");
                logger.info("evaluate_score_job exist");
            }
             //启动群发续签图文消息
            if (!quartzHelper.isExistJob("sign_again_job")) {
                String trigger = SystemConf.getInstance().getSystemProperties().getProperty("sign_again_job_trigger");
                quartzHelper.addJob(SignAgainJob.class, trigger, "sign_again_job", new HashMap<String, Object>());
                System.out.println("sign_again_job start success");
                logger.info("sign_again_job start success");
            } else {
                System.out.println("sign_again_job exist");
                logger.info("sign_again_job exist");
            }
            //启动发送产检提醒模板消息
//            if (!quartzHelper.isExistJob("prenatal_inspector_job")) {
//                String trigger = SystemConf.getInstance().getSystemProperties().getProperty("prenatal_inspector_job_trigger");
//                quartzHelper.addJob(PrenatalInspectorJob.class, trigger, "prenatal_inspector_job", new HashMap<String, Object>());
//                System.out.println("prenatal_inspector_job start success");
//                logger.info("prenatal_inspector_job start success");
//            } else {
//                System.out.println("prenatal_inspector_job exist");
//                logger.info("prenatal_inspector_job exist");
//            }
        } catch (Exception e) {
            System.out.println("sign end job start failed");
            logger.info("sign end job start failed");
        }
    }
}

+ 4 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/BaseInterceptor.java

@ -5,6 +5,8 @@ import javax.servlet.http.HttpServletRequest;
import com.yihu.wlyy.repository.url.CudUrlDao;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.HandlerInterceptor;
@ -12,6 +14,7 @@ import com.yihu.wlyy.repository.security.TokenDao;
abstract public class BaseInterceptor implements HandlerInterceptor {
	private Logger logger= LoggerFactory.getLogger(BaseInterceptor.class);
	@Autowired
	public TokenDao tokenDao;
	@Autowired
@ -23,7 +26,7 @@ abstract public class BaseInterceptor implements HandlerInterceptor {
			if (StringUtils.isEmpty(userAgent)) {
				userAgent = request.getHeader("User-Agent");
			}
			System.out.println("userAgent:" + userAgent);
			logger.info("userAgent:" + userAgent);
			return new JSONObject(userAgent);
		} catch (Exception e) {
			return null;

+ 5 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/DoctorInterceptor.java

@ -59,11 +59,11 @@ public class DoctorInterceptor extends BaseInterceptor {
            String imei = json.has("imei") ? json.getString("imei") : "";
            String observer = json.has("observer") ? json.getString("observer") : "";
            Integer platform = json.has("platform") ? json.getInt("platform") : 2;
            logger.info("tokenStr:"+tokenStr);
            logger.info("uid:"+uid);
            logger.info("imei:"+imei);
            logger.info("observer:"+observer);
            logger.info("platform:"+platform);
            logger.debug("tokenStr:"+tokenStr);
            logger.debug("uid:"+uid);
            logger.debug("imei:"+imei);
            logger.debug("observer:"+observer);
            logger.debug("platform:"+platform);
            //如果是观察者直接返回true
            if (!org.springframework.util.StringUtils.isEmpty(observer) && observer.equals("1")) {

+ 6 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/PatientInterceptor.java

@ -39,7 +39,7 @@ public class PatientInterceptor extends BaseInterceptor {
			}
			response.setCharacterEncoding("UTF-8");
			JSONObject json = getAgent(request);
			logger.info("userAgent:"+json);
			logger.debug("userAgent:"+json);
			if (json == null) {
				// 未登录
				response.getOutputStream().write(error(SystemConf.NOT_LOGIN, "请登录后再操作!").getBytes());
@ -50,11 +50,11 @@ public class PatientInterceptor extends BaseInterceptor {
			String imei = json.has("imei") ? json.getString("imei") : "";
			String openid = json.has("openid") ? json.getString("openid") : "";
			int platform = json.has("platform") ? json.getInt("platform") : 1;
			logger.info("tokenStr:"+tokenStr);
			logger.info("uid:"+user);
			logger.info("imei:"+imei);
			logger.info("openid:"+openid);
			logger.info("platform:"+platform);
			logger.debug("tokenStr:"+tokenStr);
			logger.debug("uid:"+user);
			logger.debug("imei:"+imei);
			logger.debug("openid:"+openid);
			logger.debug("platform:"+platform);
			if (StringUtils.isEmpty(imei)) {
				imei = openid;
			}

+ 4 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/DoctorDao.java

@ -154,4 +154,8 @@ public interface DoctorDao extends PagingAndSortingRepository<Doctor, Long>, Jpa
    @Query(value = "SELECT d.* from wlyy_admin_team a,wlyy_doctor d WHERE a.id = ?1 and a.leader_code = d.`code` ORDER BY d.id LIMIT 1",nativeQuery = true)
    Doctor findByAdminTeamId(Long adminTeamId);
    @Modifying
    @Query("update Doctor set checkPassword = ?2 ,checkSalt = ?3  where code = ?1")
    int updateCheckPassword(String code, String checkPassword, String checkSalt);
}

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

@ -35,6 +35,9 @@ public interface SignFamilyDao extends PagingAndSortingRepository<SignFamily, Lo
    @Query("select a from SignFamily a where a.patient = ?1 and status = ?2 and a.type = 2")
    SignFamily findByPatientCodeStatus(String patient, int status);
    @Query("select a from SignFamily a where a.patient = ?1 and status >= ?2 and a.type = 2")
    SignFamily findByPatientCodeStatus2(String patient, int status);
    @Query("select a from SignFamily a where a.patient = ?1 and a.type = ?2 and a.status >= 1")
    SignFamily findByPatientAndType(String patient, int type);

+ 17 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/DoctorInfoService.java

@ -47,9 +47,12 @@ import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestParam;
import org.springside.modules.persistence.DynamicSpecifications;
import org.springside.modules.persistence.SearchFilter;
import org.springside.modules.persistence.SearchFilter.Operator;
import org.springside.modules.security.utils.Digests;
import org.springside.modules.utils.Encodes;
import java.util.*;
@ -1264,4 +1267,18 @@ public class DoctorInfoService extends BaseService {
            }
        }
    }
    /**
     * 审方密码设置
     * @param passwoed
     * @return
     */
    @Transactional
    public void setCheckPassword(Doctor doctor,String passwoed){
        byte[] salt = Digests.generateSalt(8);
        doctor.setCheckSalt(Encodes.encodeHex(salt));
        byte[] hashPassword = Digests.sha1(passwoed.getBytes(), salt, 1024);
        doctor.setCheckPassword(Encodes.encodeHex(hashPassword));
    }
}

+ 60 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PatientPrescriptionPayService.java

@ -0,0 +1,60 @@
package com.yihu.wlyy.service.app.prescription;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.service.BaseService;
import org.springframework.stereotype.Service;
/**
 * Created by Reece on 2017/7/28/028.
 * 患者支付
 *
 */
@Service
public class PatientPrescriptionPayService extends BaseService {
    /**
     * 患者支付接口
     *
     * @param payInfo
     * @return
     */
    public JSONObject charge()throws Exception{
        JSONObject jsonObject = new JSONObject();
        return jsonObject;
    }
    /**
     * 患者支付结果查询接口
     *
     * @param outChargeNo
     * @return
     */
    public JSONObject chargeQuery(String outChargeNo)throws Exception{
        JSONObject jsonObject = new JSONObject();
        return jsonObject;
    }
    /**
     * 支付成功前端页面回调接口
     *
     * @param json
     * @return
     */
    public JSONObject returnUrl()throws Exception{
        JSONObject jsonObject = new JSONObject();
        return jsonObject;
    }
    /**
     * 对接方异步回调接口
     *
     * @return
     */
    public JSONObject receiveNotify() throws Exception{
        JSONObject jsonObject = new JSONObject();
        return jsonObject;
    }
//基卫接口
//    第三方快递接口
}

+ 62 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java

@ -3,6 +3,7 @@ package com.yihu.wlyy.service.app.prescription;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.entity.dict.SystemDict;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionInfo;
@ -167,8 +168,7 @@ public class PrescriptionInfoService extends BaseService {
    }
    public JSONArray getDoctorPrescription(String doctor,String state,String diseases,String startDate,String endDate ){
    public JSONArray getDoctorPrescription(Integer teamCode,String state,String diseases,String startDate,String endDate ){
        StringBuffer pre_sql = new StringBuffer("SELECT " +
                " p.`name`, " +
                " TIMESTAMPDIFF(YEAR,p.birthday,SYSDATE()) age, " +
@ -186,14 +186,14 @@ public class PrescriptionInfoService extends BaseService {
            //疾病类型不为空,关联查询疾病类型表
            pre_sql.append(" ,wlyy_prescription_diagnosis s " +
                    " WHERE s.prescription_code = pr.code " +
                    " AND pr.doctor =? AND s.code = ?");
            params.add(doctor);
                    " AND pr.admin_team_id =? AND s.code = ?");
            params.add(teamCode);
            params.add(diseases);
            setSQL(pre_sql,params,state,startDate,endDate);
        }else{
            //查询所有疾病类型表
            pre_sql.append(" WHERE pr.doctor =?");
            params.add(doctor);
            pre_sql.append(" WHERE pr.admin_team_id =?");
            params.add(teamCode);
            setSQL(pre_sql,params,state,startDate,endDate);
        }
        List<Map<String,Object>> rs = jdbcTemplate.queryForList(pre_sql.toString(),params.toArray());
@ -215,4 +215,60 @@ public class PrescriptionInfoService extends BaseService {
        }
        pre_sql.append(" ORDER BY pr.create_time DESC");
    }
    /**
     * 获取续方信息
     * @param code
     * @return
     */
    public JSONObject getContinuedPrescriptionAsDoctor(String code){
        Prescription prescription = prescriptionDao.findByCode(code);
        List<PrescriptionInfo> prescriptionInfos = prescriptionInfoDao.findByPrescriptionCode(code);
        JSONObject rs = new JSONObject();
        rs.put("prescription",prescription);
        rs.put("prescriptionInfos",prescriptionInfos);
        if(prescription!=null&&StringUtils.isNotBlank(prescription.getDoctor())){
            rs.put("doctor",doctorDao.findByCode(prescription.getDoctor()));
        }else{
            rs.put("doctor","");
        }
        return rs;
    }
    public int reviewPrescription(String code ,String reason,String state){
        if(StringUtils.isNotBlank(state)){
            Prescription p = prescriptionDao.findByCode(code);
            if("1".equals(state)){
                //审核通过
                p.setStatus(10);
            }else{
                //审核不通过
                p.setStatus(-1);
                p.setReviewedReason(reason);
            }
            prescriptionDao.save(p);
            //患者操作日志
            PrescriptionLog log = new PrescriptionLog();
            log.setCode(getCode());
            log.setStatus(p.getStatus());
            log.setType(4);
            log.setCreateTime(new Date());
            log.setPrescriptionCode(p.getCode());
            log.setUserCode(p.getDoctor());
            log.setUserName(p.getDoctorName());
            log.setHospitalName(p.getHospitalName());
            log.setHospital(p.getHospital());
            log.setUserType(2);
            log.setFlag(1);
            log.setRemark("医生审核");
            prescriptionLogDao.save(log);
            //同步智业接口
            upLoadPrescriotionState();
            return 1;
        }
        return 0;
    }
}

+ 11 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java

@ -1107,7 +1107,7 @@ public class FamilyContractService extends BaseService {
            Hospital hos = hospitalDao.findByCode(doc.getHospital());
            String content = sf.getName() + ",您好!祝贺您,成功签约" + sf.getDoctorName() + "医生团队,您已可以享受家庭医生所带来的无微不至的健康保健服务。" +
                    "为了给您提供更好的服务,请尽快完成缴费。您可登录签约居民的微信账号,进入签约管理,选择待缴费的签约记录进行缴费操作,如需线下缴费,请尽快到" + (hos != null ? hos.getName() : "") + "社区(地址:" +
                    "为了给您提供更好的服务,请尽快完成缴费。您可点击此条消息,跳转缴费页面完成缴费,或进入签约管理,选择待缴费的签约记录进行缴费操作,如需线下缴费,请尽快到" + (hos != null ? hos.getName() : "") + "社区(地址:" +
                    (hos != null ? hos.getAddress() : "") + ")缴费。";
            JSONObject json = new JSONObject();
            json.put("first", "签约成功通知");
@ -1148,6 +1148,12 @@ public class FamilyContractService extends BaseService {
                    data.remove("agent");
                    data.put("toUser", member.getCode());
                    data.put("agent", "1");
                    String ms = sf.getName() + ",您好!祝贺您,成功签约" + sf.getDoctorName() + "医生团队,您已可以享受家庭医生所带来的无微不至的健康保健服务。" +
                            "为了给您提供更好的服务,请尽快完成缴费。您可登录签约居民的微信账号,进入签约管理,选择待缴费的签约记录进行缴费操作,如需线下缴费,请尽快到" + (hos != null ? hos.getName() : "") + "社区(地址:" +
                            (hos != null ? hos.getAddress() : "") + ")缴费。";
                    data.put("content", ms);
                    //String first = (String) json.get("first");
                    data.remove("first");
                    data.put("first", weiXinOpenIdUtils.getTitleMes(patient, j.getInt("relation"), patient.getName()));
@ -1488,6 +1494,10 @@ public class FamilyContractService extends BaseService {
                    data.remove("agent");
                    data.put("toUser", member.getCode());
                    data.put("agent", "1");
                    String ms = sf.getName() + ",您好!祝贺您,成功签约" + doc.getName() + "医生团队,您已可以享受家庭医生所带来的无微不至的健康保健服务。" +
                            "为了给您提供更好的服务,请尽快完成缴费。您可登录签约居民的微信账号,进入签约管理,选择待缴费的签约记录进行缴费操作,如需线下缴费,请尽快到" + (hos != null ? hos.getName() : "") + "社区(地址:" +
                            (hos != null ? hos.getAddress() : "") + ")缴费。";
                    data.put("content",ms);
                    //String first = (String) json.get("first");
                    data.remove("first");
                    data.put("first", weiXinOpenIdUtils.getTitleMes(p, j.getInt("relation"), p.getName()));

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

@ -2459,7 +2459,7 @@ public class SignWebService extends BaseService {
        patient.setSickVillage(countryCode);
        patient.setSickVillageName(country.getName());
        patientService.save(patient);
        SignFamily signFamily = signFamilyDao.findByPatientCodeStatus(patientCode,0);
        SignFamily signFamily = signFamilyDao.findByPatientCodeStatus2(patientCode,0);
        if(signFamily!=null){
            signFamily.setSickVillage(countryCode);
            signFamily.setSickVillageName(country.getName());

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

@ -1568,6 +1568,9 @@ public class StatisticsService extends BaseService {
            JSONObject relyRs = (JSONObject) relyMap.get(key);
            JSONObject totalRs = (JSONObject) totalMap.get(key);
            JSONObject onRelyRs = (JSONObject) onRelyMap.get(key);
            if(relyRs==null||totalRs==null||onRelyRs==null){
                continue;
            }
            //合并结果集
            Long totalNm = totalRs.getLong("num");
            Long relyNm = relyRs.getLong("num");

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 33 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/JwSmjkService.java


+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/wxpay/common/Configure.java

@ -14,7 +14,7 @@ public class Configure {
//	private String onepayAppId = "1BGKM1UHM03P7B2CA8C000005626EB0E";
//	private String onepayAppSecret = "1BGKM1UHM03I7B2CA8C00000AB682E9A";
//			开发环境应用信息
	private String onepayApi = "https://xmhealth.ylzpay.com:8080/";
	private String onepayApi = "https://xmhealth.ylzpay.com:8070/";
	private String onepayAppId = "1BLF5SEGN00087165F0A000027362BE5";
	private String onepayAppSecret = "1BLF5SCBO01V3E78A8C00000F3A0FFE7";

+ 44 - 31
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/wxpay/service/OnePayService.java

@ -82,6 +82,12 @@ public class OnePayService {
            Patient p = patientDao.findByCode(patient);
            p.setOpenid(openid);
            p.setSsc(card.getAttachCardNo());
//            增加绑定电子社保卡信息
            p.setSicardStatus(1);
            if (p.getSicardTime() == null) {
                p.setSicardTime(new Date());
            }
            ;
            if (card.getAttachIdType() == "01")      //身份证
            {
                p.setIdcard(card.getAttachIdNo());
@ -141,7 +147,6 @@ public class OnePayService {
            requestParams.setEncryptType(encryptType);
            // 请求报文体参数,详见接口文档各接口——请求参数定义
            // 如医保绑卡信息请求参数
            JSONObject params = new JSONObject();
@ -184,22 +189,22 @@ public class OnePayService {
    /**
     * 家庭医生签约支付
     */
    public String charge(String orgCode, String chargeType, String chargeRelation, Integer totalAmount, String patient, String openid,String accessToken) throws Exception {
    public String charge(String orgCode, String chargeType, String chargeRelation, String totalAmount, String patient, String openid, String accessToken) throws Exception {
        //获取机构映射
        HospitalMapping hos = hospitalMappingDao.findByCode(orgCode);
        if (hos == null) {
            throw new Exception("no hospital mapping!");
        }
//        return charge(orgCode, hos.getName(), hos.getAppId(), hos.getAppSecret(),hos.getSbCode(), chargeType, chargeRelation, totalAmount,patient, openid,accessToken);
        return charge(orgCode, hos.getName(), hos.getAppId(), hos.getAppSecret(),hos.getSbCode(), chargeType, chargeRelation, totalAmount,patient, openid,accessToken);
//        对应机构的APPID和appsecret
//        return charge(orgCode, hos.getName(), "54BBAF5148521AC9E053F000660AC502", "54BBAF5148531AC9E053F000660AC502",hos.getSbCode(), chargeType, chargeRelation, totalAmount,patient, openid,accessToken);
        return charge(orgCode, hos.getName(), "54BBAF5148521AC9E053F000660AC502", "54BBAF5148531AC9E053F000660AC502","0380", chargeType, chargeRelation, totalAmount,patient, openid,accessToken);
//        return charge(orgCode, hos.getName(), "54BBAF5148521AC9E053F000660AC502", "54BBAF5148531AC9E053F000660AC502", "0380", chargeType, chargeRelation, totalAmount, patient, openid, accessToken);
    }
    /**
     * 家庭医生签约支付,成功则返回支付路径
     */
    private String charge(String orgCode, String orgName, String appId, String appSecret,String sbCode, String chargeType, String chargeRelation, Integer totalAmount,String patient, String openid,String accessToken) throws Exception {
    private String charge(String orgCode, String orgName, String appId, String appSecret, String sbCode, String chargeType, String chargeRelation, String totalAmount, String patient, String openid, String accessToken) throws Exception {
        Boolean isSuccess = true;
        String msgBody = "";
        String response = "";
@ -226,7 +231,7 @@ public class OnePayService {
            charge.setChannel(channel);
            charge.setMerchName(orgName);
            charge.setSubject(subject);
            charge.setTotalAmount(totalAmount);  //  交易总金额
            charge.setTotalAmount(Integer.parseInt(totalAmount));  //  交易总金额
            BindCard card = ownerCard(openid);
            String name = card.getAttachName();
@ -266,31 +271,33 @@ public class OnePayService {
            Properties systemConf = SystemConf.getInstance().getSystemProperties();
            String returnUrl = systemConf.getProperty("return_url");
            returnUrl = returnUrl.replace("{server}", serverUrl);
            params.put("returnUrl",returnUrl);   //页面跳转地址
            params.put("returnUrl", returnUrl);   //页面跳转地址
            params.put("channel", channel);  //微信医保支付
            params.put("merchName", orgName);  //收款单位名称
            params.put("subject", subject);  //订单名称
            params.put("wxToken",accessToken);
            params.put("wxToken", accessToken);
            //extendParams 扩展入参
            //家庭医生签约信息
            //      根据签约code查询签约信息
            SignFamily signFamily = signFamilyDao.findByCode(chargeRelation);
            if (signFamily!=null){
            if (signFamily != null) {
//                //签约人Code
                String signDoctorCode = signFamily.getSignDoctorCode();
                String people = signFamily.getPatient();
                Doctor doctor = doctorDao.findByCode(signDoctorCode);
                Patient user = patientDao.findByCode(people);
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
                Map<String, String> familyContent = new HashMap<>();
                familyContent.put("moRegNo", "1481497932");//医院签约号限长20
//                familyContent.put("moRegName",signFamily.getName()); //签约人姓名
                familyContent.put("moRegName","林逸祥"); //签约人姓名
                familyContent.put("moRegAddr",user.getAddress() ); //签约人地址
//                familyContent.put("moRegNo", chargeRelation);//医院签约号限长20  signFamily code
                String moregNo = sdf.format(new Date())+ uuid.substring(0,6);
                familyContent.put("moRegNo", moregNo);//医院签约号限长20  signFamily code
                familyContent.put("moRegName",signFamily.getName()); //签约人姓名
//                familyContent.put("moRegName", "沈在鑫"); //签约人姓名
                familyContent.put("moRegAddr", user.getAddress()); //签约人地址
                familyContent.put("moRegTelephone", signFamily.getMobile());//签约人联系电话
                familyContent.put("moRegOrgNo", sbCode); //签约机构 限长4
                familyContent.put("moRegDocNo", doctor.getIdcard());//签约医生编号 限长18 身份证号
@ -302,7 +309,8 @@ public class OnePayService {
                familyContent.put("moRegSource", signFamily.getSignSource()); //签约来源
                familyContent.put("moCollectOrgNo", sbCode); //扣费机构 签约机构
                familyContent.put("moCollectorNo", signFamily.getSignDoctorName());//扣费人 签约医生姓名
                familyContent.put("benefitType", signFamily.getExpensesType() ); //补贴类型
                familyContent.put("benefitType", signFamily.getExpensesType()); //补贴类型
//                familyContent.put("benefitType", "01"); //补贴类型
                familyContent.put("moBookOrgNo", sbCode);//登记机构 签约机构
                familyContent.put("moBookerNo", signFamily.getSignDoctorName()); //登记人 签约医生姓名
                familyContent.put("moBookTime", sdf.format(signFamily.getBegin())); //登记时间 签约时间
@ -353,7 +361,7 @@ public class OnePayService {
    /**
     * 家庭医生签约支付查询
     */
    public Charge chargeQuery(String code,String accessToken) throws Exception {
    public Charge chargeQuery(String code, String accessToken) throws Exception {
        Boolean isSuccess = true;
        String msgBody = "";
        String response = "";
@ -363,18 +371,18 @@ public class OnePayService {
//        String appId = config.getOnepayAppId();
//        String appSecret = config.getOnepayAppSecret();
//        OnepayDefaultClient onepayClient = new OnepayDefaultClient(config.getOnepayApi(), appId, appSecret, signType, encryptType);
//        WlyyCharge charge = chargeDao.findByCode(code);
//        HospitalMapping hospitalMapping = hospitalMappingDao.findByCode(charge.getHospital());
//        OnepayDefaultClient onepayClient = new OnepayDefaultClient(config.getOnepayApi(), hospitalMapping.getAppId(), hospitalMapping.getAppSecret(), signType, encryptType);
        OnepayDefaultClient onepayClient = new OnepayDefaultClient(config.getOnepayApi(), "54BBAF5148521AC9E053F000660AC501", "54BBAF5148531AC9E053F000660AC501", signType, encryptType);
        WlyyCharge charge = chargeDao.findByCode(code);
        HospitalMapping hospitalMapping = hospitalMappingDao.findByCode(charge.getHospital());
        OnepayDefaultClient onepayClient = new OnepayDefaultClient(config.getOnepayApi(), hospitalMapping.getAppId(), hospitalMapping.getAppSecret(), signType, encryptType);
//        OnepayDefaultClient onepayClient = new OnepayDefaultClient(config.getOnepayApi(), "54BBAF5148521AC9E053F000660AC501", "54BBAF5148531AC9E053F000660AC501", signType, encryptType);
        try {
            RequestParams requestParams = new RequestParams();
//            requestParams.setVersion();
//            requestParams.setSign();
//            requestParams.setEncryptData();
//            requestParams.setAppId(appId);
//            requestParams.setAppId(hospitalMapping.getAppId());
            requestParams.setAppId("54BBAF5148521AC9E053F000660AC501");
            requestParams.setAppId(hospitalMapping.getAppId());
//            requestParams.setAppId("54BBAF5148521AC9E053F000660AC501");
            requestParams.setTimestamp(DateUtil.getCurrentDateTime());
            requestParams.setSignType(signType);
            requestParams.setEncryptType(encryptType);
@ -460,6 +468,11 @@ public class OnePayService {
                result = String.valueOf(json.get("sicardUrl"));      //电子社保卡连接
                //保存到患者表
                Patient p = patientDao.findByCode(patient);
                p.setOpenid(openid);
//            增加绑定电子社保卡信息
                p.setSicardTime(new Date());
                patientDao.save(p);
            } else {
                isSuccess = false;
                error = "请求失败,返回结果:" + res.getRespCode() + "," + res.getRespMsg();
@ -486,12 +499,12 @@ public class OnePayService {
    /**
     * 更新所有记录的交易状态
     */
    private List<WlyyCharge> updateTradeStatus(List<WlyyCharge> list,String accessToken) {
    private List<WlyyCharge> updateTradeStatus(List<WlyyCharge> list, String accessToken) {
        //更新交易状态
        if (list != null && list.size() > 0) {
            for (WlyyCharge item : list) {
                try {
                    Charge charge = chargeQuery(item.getCode(),accessToken);
                    Charge charge = chargeQuery(item.getCode(), accessToken);
                    if (charge != null) {
                        item.setTradeStatus(charge.getTradeStatus());            //  交易状态0 成功 1 失败 2 已退款
                        item.setChargeNo(charge.getChargeNo());       //  流水号
@ -515,32 +528,32 @@ public class OnePayService {
    /**
     * 通过交易关联代码获取交易列表
     */
    public List<WlyyCharge> chargeList(String chargeType, String chargeRelation,String accessToken) throws Exception {
    public List<WlyyCharge> chargeList(String chargeType, String chargeRelation, String accessToken) throws Exception {
        List<WlyyCharge> list = chargeDao.findByChargeTypeAndChargeRelation(chargeType, chargeRelation);
        return updateTradeStatus(list,accessToken);
        return updateTradeStatus(list, accessToken);
    }
    /**
     * 通过患者代码获取交易列表
     */
    public List<WlyyCharge> chargeListByPatient(String patient, String accessToken,Integer page, Integer size) throws Exception {
    public List<WlyyCharge> chargeListByPatient(String patient, String accessToken, Integer page, Integer size) throws Exception {
        PageRequest pageRequest = new PageRequest(page - 1, size);
        List<WlyyCharge> list = chargeDao.findByPatient(patient, pageRequest);
        return updateTradeStatus(list,accessToken);
        return updateTradeStatus(list, accessToken);
    }
    /**
     * 更改数据 wlyy_sign_family wlyy_charge
     */
    public void updateData(String chargeCode,String chargeNo,String chargeTime,String totalAmount,String insuranceAmount,String selfPayAmount,String billNo,String miRegisterNo) throws Exception {
    public void updateData(String chargeCode, String chargeNo, String chargeTime, String totalAmount, String insuranceAmount, String selfPayAmount, String billNo, String miRegisterNo) throws Exception {
        SimpleDateFormat sdf = new SimpleDateFormat();
        Date chargeSuccess = sdf.parse(chargeTime);
        Date updateTime = new Date();
        chargeDao.updateByChargeCode(chargeCode,chargeTime,updateTime,Integer.parseInt(totalAmount),Integer.parseInt(insuranceAmount),Integer.parseInt(selfPayAmount),
                billNo,miRegisterNo,"0");
        chargeDao.updateByChargeCode(chargeCode, chargeTime, updateTime, Integer.parseInt(totalAmount), Integer.parseInt(insuranceAmount), Integer.parseInt(selfPayAmount),
                billNo, miRegisterNo, "0");
//        根据wlyy_charge的code 去查找关联代码signCode在更新签约表
        WlyyCharge charge = chargeDao.findByCode(chargeCode);
        signFamilyDao.updatePatientBegin(charge.getChargeRelation(), chargeSuccess, chargeNo, "1");

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/task/PushMsgTask.java

@ -296,10 +296,10 @@ public class PushMsgTask {
                } else {
                    if (json.has("agent") && ("1".equals(json.getString("agent")))) {
//                        发送给授权代理人
                        temp.setUrl(url + "ssgg/html/doctor-homepage-new.html?openid=" + openid + "&state=" + json.getString("doctor") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&isRenew=" + isRenew + "&signState=" + signState + "&represented=" + json.getString("represented") + "&signCode" + json.getString("signCode"));
                        temp.setUrl(url + "ssgg/html/doctor-homepage-new.html?openid=" + openid + "&state=" + json.getString("doctor") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&isRenew=" + isRenew + "&signState=" + signState + "&represented=" + json.getString("represented") + "&signCode=" + json.getString("signCode"));
                    } else if (json.has("agent") && ("0".equals(json.getString("agent")))) {
//                        发送给自己
                        temp.setUrl(url + "html/qygl/html/pay_flow.html?openid=" + openid + "&state=" + json.getString("doctor") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&isRenew=" + isRenew + "&signState=" + signState + "&represented=" + json.getString("represented") + "&signCode" + json.getString("signCode"));
                        temp.setUrl(url + "qygl/html/pay_flow.html?openid=" + openid + "&state=" + json.getString("doctor") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&isRenew=" + isRenew + "&signState=" + signState + "&represented=" + json.getString("represented") + "&signCode=" + json.getString("signCode"));
                    }
                }
                temp.setTouser(openid);

+ 334 - 312
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/RSAUtils.java

@ -20,8 +20,10 @@ import java.security.spec.RSAPrivateKeySpec;
import java.security.spec.RSAPublicKeySpec;
import java.util.Date;
import javax.annotation.PostConstruct;
import javax.crypto.Cipher;
import com.yihu.wlyy.repository.security.RSADao;
import org.apache.commons.codec.binary.Hex;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
@ -36,322 +38,342 @@ import org.springframework.stereotype.Component;
/**
 * RSA算法加密/解密工具类。
 * 
 *
 * @author fuchun
 * @version 1.0.0, 2010-05-05
 */
@Component
public class RSAUtils {
	@Autowired
	private CommonUtil CommonUtil;
	private BaseService baseService;
	private static final Logger LOGGER = LoggerFactory.getLogger(RSAUtils.class);
	/** 算法名称 */
	private static final String ALGORITHOM = "RSA";
	/** 密钥大小 */
	private static final int KEY_SIZE = 1024;
	/** 默认的安全服务提供者 */
	private static final Provider DEFAULT_PROVIDER = new BouncyCastleProvider();
	private static KeyPairGenerator keyPairGen = null;
	private static KeyFactory keyFactory = null;
	/** 缓存的密钥对。 */
	private KeyPair oneKeyPair = null;
	private static RSAUtils rsaUtils = null;
	static {
		try {
			keyPairGen = KeyPairGenerator.getInstance(ALGORITHOM, DEFAULT_PROVIDER);
			keyFactory = KeyFactory.getInstance(ALGORITHOM, DEFAULT_PROVIDER);
		} catch (NoSuchAlgorithmException ex) {
			LOGGER.error(ex.getMessage());
		}
	}
	public synchronized static RSAUtils getInstance(BaseService baseService) {
		if (rsaUtils == null) {
			rsaUtils = new RSAUtils();
			rsaUtils.baseService = baseService;
		}
		return rsaUtils;
	}
	public KeyPair getKeyPair() {
		if (oneKeyPair == null) {
			// 从数据库加载
			RSA rsa = baseService.loadRSA();
			if (rsa == null) {
				// 生成密钥
				generateKeyPair();
			} else {
				// 由数据库取出来
				Object obj = CommonUtil.toObject(rsa.getData());
				oneKeyPair = (KeyPair) obj;
			}
		}
		return oneKeyPair;
	}
	/**
	 * 生成并返回RSA密钥对。
	 */
	private synchronized KeyPair generateKeyPair() {
		try {
			keyPairGen.initialize(KEY_SIZE, new SecureRandom(DateFormatUtils.format(new Date(), DateUtil.YYYYMMDD).getBytes()));
			oneKeyPair = keyPairGen.generateKeyPair();
			// 保存到数据库
			baseService.saveRSA(oneKeyPair);
			return oneKeyPair;
		} catch (InvalidParameterException ex) {
			LOGGER.error("KeyPairGenerator does not support a key length of " + KEY_SIZE + ".", ex);
		} catch (NullPointerException ex) {
			LOGGER.error("RSAUtils#KEY_PAIR_GEN is null, can not generate KeyPairGenerator instance.", ex);
		}
		return null;
	}
	/**
	 * 根据给定的系数和专用指数构造一个RSA专用的公钥对象。
	 * 
	 * @param modulus 系数。
	 * @param publicExponent 专用指数。
	 * @return RSA专用公钥对象。
	 */
	public RSAPublicKey generateRSAPublicKey(byte[] modulus, byte[] publicExponent) {
		RSAPublicKeySpec publicKeySpec = new RSAPublicKeySpec(new BigInteger(modulus), new BigInteger(publicExponent));
		try {
			return (RSAPublicKey) keyFactory.generatePublic(publicKeySpec);
		} catch (InvalidKeySpecException ex) {
			LOGGER.error("RSAPublicKeySpec is unavailable.", ex);
		} catch (NullPointerException ex) {
			LOGGER.error("RSAUtils#KEY_FACTORY is null, can not generate KeyFactory instance.", ex);
		}
		return null;
	}
	/**
	 * 根据给定的系数和专用指数构造一个RSA专用的私钥对象。
	 * 
	 * @param modulus 系数。
	 * @param privateExponent 专用指数。
	 * @return RSA专用私钥对象。
	 */
	public RSAPrivateKey generateRSAPrivateKey(byte[] modulus, byte[] privateExponent) {
		RSAPrivateKeySpec privateKeySpec = new RSAPrivateKeySpec(new BigInteger(modulus), new BigInteger(privateExponent));
		try {
			return (RSAPrivateKey) keyFactory.generatePrivate(privateKeySpec);
		} catch (InvalidKeySpecException ex) {
			LOGGER.error("RSAPrivateKeySpec is unavailable.", ex);
		} catch (NullPointerException ex) {
			LOGGER.error("RSAUtils#KEY_FACTORY is null, can not generate KeyFactory instance.", ex);
		}
		return null;
	}
	/**
	 * 使用指定的公钥加密数据。
	 * 
	 * @param publicKey 给定的公钥。
	 * @param data 要加密的数据。
	 * @return 加密后的数据。
	 */
	public byte[] encrypt(PublicKey publicKey, byte[] data) throws Exception {
		Cipher ci = Cipher.getInstance(ALGORITHOM, DEFAULT_PROVIDER);
		ci.init(Cipher.ENCRYPT_MODE, publicKey);
		return ci.doFinal(data);
	}
	/**
	 * 使用指定的私钥解密数据。
	 * 
	 * @param privateKey 给定的私钥。
	 * @param data 要解密的数据。
	 * @return 原数据。
	 */
	public byte[] decrypt(PrivateKey privateKey, byte[] data) throws Exception {
		Cipher ci = Cipher.getInstance(ALGORITHOM, DEFAULT_PROVIDER);
		ci.init(Cipher.DECRYPT_MODE, privateKey);
		return ci.doFinal(data);
	}
	/**
	 * 使用给定的公钥加密给定的字符串。
	 * <p />
	 * 若 {@code publicKey} 为 {@code null},或者 {@code plaintext} 为 {@code null} 则返回 {@code
	 * null}。
	 * 
	 * @param publicKey 给定的公钥。
	 * @param plaintext 字符串。
	 * @return 给定字符串的密文。
	 */
	public String encryptString(PublicKey publicKey, String plaintext) {
		if (publicKey == null || plaintext == null) {
			return null;
		}
		byte[] data = plaintext.getBytes();
		try {
			byte[] en_data = encrypt(publicKey, data);
			return new String(Hex.encodeHex(en_data));
		} catch (Exception ex) {
			LOGGER.error(ex.getCause().getMessage());
		}
		return null;
	}
	/**
	 * 使用默认的公钥加密给定的字符串。
	 * <p />
	 * 若{@code plaintext} 为 {@code null} 则返回 {@code null}。
	 * 
	 * @param plaintext 字符串。
	 * @return 给定字符串的密文。
	 */
	public String encryptString(String plaintext) {
		if (plaintext == null) {
			return null;
		}
		byte[] data = plaintext.getBytes();
		try {
			byte[] en_data = encrypt((RSAPublicKey) getKeyPair().getPublic(), data);
			return new String(Hex.encodeHex(en_data));
		} catch (NullPointerException ex) {
			LOGGER.error("keyPair cannot be null.");
		} catch (Exception ex) {
			LOGGER.error(ex.getCause().getMessage());
		}
		return null;
	}
	/**
	 * 使用给定的私钥解密给定的字符串。
	 * <p />
	 * 若私钥为 {@code null},或者 {@code encrypttext} 为 {@code null}或空字符串则返回 {@code null}。
	 * 私钥不匹配时,返回 {@code null}。
	 * 
	 * @param privateKey 给定的私钥。
	 * @param encrypttext 密文。
	 * @return 原文字符串。
	 */
	public String decryptString(PrivateKey privateKey, String encrypttext) {
		if (privateKey == null || StringUtils.isBlank(encrypttext)) {
			return null;
		}
		try {
			byte[] en_data = Hex.decodeHex(encrypttext.toCharArray());
			byte[] data = decrypt(privateKey, en_data);
			return new String(data);
		} catch (Exception ex) {
			LOGGER.error(String.format("\"%s\" Decryption failed. Cause: %s", encrypttext, ex.getCause().getMessage()));
		}
		return null;
	}
	/**
	 * 使用默认的私钥解密给定的字符串。
	 * <p />
	 * 若{@code encrypttext} 为 {@code null}或空字符串则返回 {@code null}。
	 * 私钥不匹配时,返回 {@code null}。
	 * 
	 * @param encrypttext 密文。
	 * @return 原文字符串。
	 */
	public String decryptString(String encrypttext) {
		if (StringUtils.isBlank(encrypttext)) {
			return null;
		}
		try {
			byte[] en_data = Hex.decodeHex(encrypttext.toCharArray());
			byte[] data = decrypt((RSAPrivateKey) getKeyPair().getPrivate(), en_data);
			return new String(data) ;
		} catch (NullPointerException ex) {
			LOGGER.error("keyPair cannot be null.");
		} catch (Exception ex) {
			LOGGER.error(String.format("\"%s\" Decryption failed. Cause: %s", encrypttext, ex.getMessage()));
		}
		return null;
	}
	/**
	 * 使用默认的私钥解密由JS加密(使用此类提供的公钥加密)的字符串。
	 * 
	 * @param encrypttext 密文。
	 * @return {@code encrypttext} 的原文字符串。
	 */
	public String decryptStringByJs(String encrypttext) {
		String text = decryptString(encrypttext);
		if (text == null) {
			return null;
		}
		return StringUtils.reverse(text);
	}
	/** 返回已初始化的默认的公钥。*/
	public RSAPublicKey getDefaultPublicKey() {
		KeyPair keyPair = getKeyPair();
		if (keyPair != null) {
			return (RSAPublicKey) keyPair.getPublic();
		}
		return null;
	}
	/** 返回已初始化的默认的私钥。*/
	public RSAPrivateKey getDefaultPrivateKey() {
		KeyPair keyPair = getKeyPair();
		if (keyPair != null) {
			return (RSAPrivateKey) keyPair.getPrivate();
		}
		return null;
	}
	public String getModulus() {
		return new String(Hex.encodeHex(getDefaultPublicKey().getModulus().toByteArray()));
	}
	public String getExponent() {
		return new String(Hex.encodeHex(getDefaultPublicKey().getPublicExponent().toByteArray()));
	}
	public static byte[] getPublicGovKey2() throws IOException {
		byte[] buffer = null;
		InputStream fis = null;
		ByteArrayOutputStream bos = null;
		try {
			fis = RSAUtils.class.getClassLoader().getResourceAsStream("PublicGov.key");
			bos = new ByteArrayOutputStream(1000);
			byte[] b = new byte[1000];
			int n;
			while ((n = fis.read(b)) != -1) {
				bos.write(b, 0, n);
			}
			buffer = bos.toByteArray();
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			if (fis != null)
				fis.close();
			if (bos != null)
				bos.close();
		}
		return buffer;
	}
	public static byte[] getPublicGovKey() {
		return sehrCrypto.sehrCrypto.ReadFileBytes(RSAUtils.class.getClassLoader().getResource("PublicGov.key").getPath());
	}
	public static void main(String[] args) {
		try {
			byte[] t1 = getPublicGovKey2();
			byte[] t2 = getPublicGovKey();
			System.out.println(t1);
			System.out.println(t2);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
    @Autowired
    private CommonUtil CommonUtil;
    @Autowired
    private RSADao rsaDao;
    private BaseService baseService;
    @PostConstruct
    public void cleanRSA() {
        // 情况缓存表
        rsaDao.deleteAll();
    }
    private static final Logger LOGGER = LoggerFactory.getLogger(RSAUtils.class);
    /**
     * 算法名称
     */
    private static final String ALGORITHOM = "RSA";
    /**
     * 密钥大小
     */
    private static final int KEY_SIZE = 1024;
    /**
     * 默认的安全服务提供者
     */
    private static final Provider DEFAULT_PROVIDER = new BouncyCastleProvider();
    private static KeyPairGenerator keyPairGen = null;
    private static KeyFactory keyFactory = null;
    /**
     * 缓存的密钥对。
     */
    private KeyPair oneKeyPair = null;
    private static RSAUtils rsaUtils = null;
    static {
        try {
            keyPairGen = KeyPairGenerator.getInstance(ALGORITHOM, DEFAULT_PROVIDER);
            keyFactory = KeyFactory.getInstance(ALGORITHOM, DEFAULT_PROVIDER);
        } catch (NoSuchAlgorithmException ex) {
            LOGGER.error(ex.getMessage());
        }
    }
    public synchronized static RSAUtils getInstance(BaseService baseService) {
        if (rsaUtils == null) {
            rsaUtils = new RSAUtils();
            rsaUtils.baseService = baseService;
        }
        return rsaUtils;
    }
    public KeyPair getKeyPair() {
        if (oneKeyPair == null) {
            // 从数据库加载
            RSA rsa = baseService.loadRSA();
            if (rsa == null) {
                // 生成密钥
                generateKeyPair();
            } else {
                // 由数据库取出来
                Object obj = CommonUtil.toObject(rsa.getData());
                oneKeyPair = (KeyPair) obj;
            }
        }
        return oneKeyPair;
    }
    /**
     * 生成并返回RSA密钥对。
     */
    private synchronized KeyPair generateKeyPair() {
        try {
            keyPairGen.initialize(KEY_SIZE, new SecureRandom(DateFormatUtils.format(new Date(), DateUtil.YYYYMMDD).getBytes()));
            oneKeyPair = keyPairGen.generateKeyPair();
            // 保存到数据库
            baseService.saveRSA(oneKeyPair);
            return oneKeyPair;
        } catch (InvalidParameterException ex) {
            LOGGER.error("KeyPairGenerator does not support a key length of " + KEY_SIZE + ".", ex);
        } catch (NullPointerException ex) {
            LOGGER.error("RSAUtils#KEY_PAIR_GEN is null, can not generate KeyPairGenerator instance.", ex);
        }
        return null;
    }
    /**
     * 根据给定的系数和专用指数构造一个RSA专用的公钥对象。
     *
     * @param modulus        系数。
     * @param publicExponent 专用指数。
     * @return RSA专用公钥对象。
     */
    public RSAPublicKey generateRSAPublicKey(byte[] modulus, byte[] publicExponent) {
        RSAPublicKeySpec publicKeySpec = new RSAPublicKeySpec(new BigInteger(modulus), new BigInteger(publicExponent));
        try {
            return (RSAPublicKey) keyFactory.generatePublic(publicKeySpec);
        } catch (InvalidKeySpecException ex) {
            LOGGER.error("RSAPublicKeySpec is unavailable.", ex);
        } catch (NullPointerException ex) {
            LOGGER.error("RSAUtils#KEY_FACTORY is null, can not generate KeyFactory instance.", ex);
        }
        return null;
    }
    /**
     * 根据给定的系数和专用指数构造一个RSA专用的私钥对象。
     *
     * @param modulus         系数。
     * @param privateExponent 专用指数。
     * @return RSA专用私钥对象。
     */
    public RSAPrivateKey generateRSAPrivateKey(byte[] modulus, byte[] privateExponent) {
        RSAPrivateKeySpec privateKeySpec = new RSAPrivateKeySpec(new BigInteger(modulus), new BigInteger(privateExponent));
        try {
            return (RSAPrivateKey) keyFactory.generatePrivate(privateKeySpec);
        } catch (InvalidKeySpecException ex) {
            LOGGER.error("RSAPrivateKeySpec is unavailable.", ex);
        } catch (NullPointerException ex) {
            LOGGER.error("RSAUtils#KEY_FACTORY is null, can not generate KeyFactory instance.", ex);
        }
        return null;
    }
    /**
     * 使用指定的公钥加密数据。
     *
     * @param publicKey 给定的公钥。
     * @param data      要加密的数据。
     * @return 加密后的数据。
     */
    public byte[] encrypt(PublicKey publicKey, byte[] data) throws Exception {
        Cipher ci = Cipher.getInstance(ALGORITHOM, DEFAULT_PROVIDER);
        ci.init(Cipher.ENCRYPT_MODE, publicKey);
        return ci.doFinal(data);
    }
    /**
     * 使用指定的私钥解密数据。
     *
     * @param privateKey 给定的私钥。
     * @param data       要解密的数据。
     * @return 原数据。
     */
    public byte[] decrypt(PrivateKey privateKey, byte[] data) throws Exception {
        Cipher ci = Cipher.getInstance(ALGORITHOM, DEFAULT_PROVIDER);
        ci.init(Cipher.DECRYPT_MODE, privateKey);
        return ci.doFinal(data);
    }
    /**
     * 使用给定的公钥加密给定的字符串。
     * <p>
     * 若 {@code publicKey} 为 {@code null},或者 {@code plaintext} 为 {@code null} 则返回 {@code
     * null}。
     *
     * @param publicKey 给定的公钥。
     * @param plaintext 字符串。
     * @return 给定字符串的密文。
     */
    public String encryptString(PublicKey publicKey, String plaintext) {
        if (publicKey == null || plaintext == null) {
            return null;
        }
        byte[] data = plaintext.getBytes();
        try {
            byte[] en_data = encrypt(publicKey, data);
            return new String(Hex.encodeHex(en_data));
        } catch (Exception ex) {
            LOGGER.error(ex.getCause().getMessage());
        }
        return null;
    }
    /**
     * 使用默认的公钥加密给定的字符串。
     * <p>
     * 若{@code plaintext} 为 {@code null} 则返回 {@code null}。
     *
     * @param plaintext 字符串。
     * @return 给定字符串的密文。
     */
    public String encryptString(String plaintext) {
        if (plaintext == null) {
            return null;
        }
        byte[] data = plaintext.getBytes();
        try {
            byte[] en_data = encrypt((RSAPublicKey) getKeyPair().getPublic(), data);
            return new String(Hex.encodeHex(en_data));
        } catch (NullPointerException ex) {
            LOGGER.error("keyPair cannot be null.");
        } catch (Exception ex) {
            LOGGER.error(ex.getCause().getMessage());
        }
        return null;
    }
    /**
     * 使用给定的私钥解密给定的字符串。
     * <p>
     * 若私钥为 {@code null},或者 {@code encrypttext} 为 {@code null}或空字符串则返回 {@code null}。
     * 私钥不匹配时,返回 {@code null}。
     *
     * @param privateKey  给定的私钥。
     * @param encrypttext 密文。
     * @return 原文字符串。
     */
    public String decryptString(PrivateKey privateKey, String encrypttext) {
        if (privateKey == null || StringUtils.isBlank(encrypttext)) {
            return null;
        }
        try {
            byte[] en_data = Hex.decodeHex(encrypttext.toCharArray());
            byte[] data = decrypt(privateKey, en_data);
            return new String(data);
        } catch (Exception ex) {
            LOGGER.error(String.format("\"%s\" Decryption failed. Cause: %s", encrypttext, ex.getCause().getMessage()));
        }
        return null;
    }
    /**
     * 使用默认的私钥解密给定的字符串。
     * <p>
     * 若{@code encrypttext} 为 {@code null}或空字符串则返回 {@code null}。
     * 私钥不匹配时,返回 {@code null}。
     *
     * @param encrypttext 密文。
     * @return 原文字符串。
     */
    public String decryptString(String encrypttext) {
        if (StringUtils.isBlank(encrypttext)) {
            return null;
        }
        try {
            byte[] en_data = Hex.decodeHex(encrypttext.toCharArray());
            byte[] data = decrypt((RSAPrivateKey) getKeyPair().getPrivate(), en_data);
            return new String(data);
        } catch (NullPointerException ex) {
            LOGGER.error("keyPair cannot be null.");
        } catch (Exception ex) {
            LOGGER.error(String.format("\"%s\" Decryption failed. Cause: %s", encrypttext, ex.getMessage()));
        }
        return null;
    }
    /**
     * 使用默认的私钥解密由JS加密(使用此类提供的公钥加密)的字符串。
     *
     * @param encrypttext 密文。
     * @return {@code encrypttext} 的原文字符串。
     */
    public String decryptStringByJs(String encrypttext) {
        String text = decryptString(encrypttext);
        if (text == null) {
            return null;
        }
        return StringUtils.reverse(text);
    }
    /**
     * 返回已初始化的默认的公钥。
     */
    public RSAPublicKey getDefaultPublicKey() {
        KeyPair keyPair = getKeyPair();
        if (keyPair != null) {
            return (RSAPublicKey) keyPair.getPublic();
        }
        return null;
    }
    /**
     * 返回已初始化的默认的私钥。
     */
    public RSAPrivateKey getDefaultPrivateKey() {
        KeyPair keyPair = getKeyPair();
        if (keyPair != null) {
            return (RSAPrivateKey) keyPair.getPrivate();
        }
        return null;
    }
    public String getModulus() {
        return new String(Hex.encodeHex(getDefaultPublicKey().getModulus().toByteArray()));
    }
    public String getExponent() {
        return new String(Hex.encodeHex(getDefaultPublicKey().getPublicExponent().toByteArray()));
    }
    public static byte[] getPublicGovKey2() throws IOException {
        byte[] buffer = null;
        InputStream fis = null;
        ByteArrayOutputStream bos = null;
        try {
            fis = RSAUtils.class.getClassLoader().getResourceAsStream("PublicGov.key");
            bos = new ByteArrayOutputStream(1000);
            byte[] b = new byte[1000];
            int n;
            while ((n = fis.read(b)) != -1) {
                bos.write(b, 0, n);
            }
            buffer = bos.toByteArray();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (fis != null)
                fis.close();
            if (bos != null)
                bos.close();
        }
        return buffer;
    }
    public static byte[] getPublicGovKey() {
        return sehrCrypto.sehrCrypto.ReadFileBytes(RSAUtils.class.getClassLoader().getResource("PublicGov.key").getPath());
    }
    public static void main(String[] args) {
        try {
            byte[] t1 = getPublicGovKey2();
            byte[] t2 = getPublicGovKey();
            System.out.println(t1);
            System.out.println(t2);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/util/WlyySerivceController.java

@ -252,7 +252,7 @@ public class WlyySerivceController extends BaseController{
            //7天排班的医生列表
            String list = jwSmjkService.GetDoctorList(hospitalId,hosDeptId);
            return write(200, "获取转诊预约医生列表成功!", "data", list);
            return list;
        } catch (Exception ex) {
            ex.printStackTrace();
            return error(-1,"获取转诊预约医生列表列表失败");

+ 55 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/account/DoctorController.java

@ -37,6 +37,7 @@ 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.ResponseBody;
import org.springside.modules.security.utils.Digests;
import org.springside.modules.utils.Encodes;
import com.yihu.wlyy.service.app.account.DoctorInfoService;
@ -1886,5 +1887,59 @@ public class DoctorController extends BaseController {
            return invalidUserException(e, -1, "查询失败");
        }
    }
    /**
     * 设置审方密码
     * @param password
     * @return
     */
    @RequestMapping(value = "/setCheckPassword", method = RequestMethod.POST)
    @ResponseBody
    @ObserverRequired
    public String setCheckPassword(@RequestParam String password){
        try {
            Doctor doctor = doctorInfoService.findDoctorByCode(getUID());
            if (doctor == null) {
                return error(-1, "密码设置失败!");
            }
            doctorInfoService.setCheckPassword(doctor,password);
            return write(200, "密码设置成功");
        }catch (Exception e){
            error(e);
            return invalidUserException(e, -1, "密码设置失败");
        }
    }
    /**
     * 修改审方密码
     * @param oldPassword
     * @param newPassword
     * @return
     */
    @ObserverRequired
    @ResponseBody
    @RequestMapping(value = "/updateCheckPassword", method = RequestMethod.POST)
    public String updateCheckPassword(@RequestParam String oldPassword,@RequestParam String newPassword){
        try {
            Doctor doctor = doctorInfoService.findDoctorByCode(getUID());
            if (doctor == null) {
                return error(-1, "修改审方密码失败!");
            } else {
                String encodePWD = EncodesUtil.entryptPassword(Encodes.decodeHex(doctor.getCheckSalt()), oldPassword);
                if (StringUtils.equals(doctor.getCheckPassword(), encodePWD)) {
                    doctorInfoService.setCheckPassword(doctor,newPassword);
                    return write(200, "密码设置成功");
                } else {
                    return error(-1, "修改失败:审方旧密码错误!");
                }
            }
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "修改失败!");
        }
    }
}

+ 33 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionInfoController.java

@ -59,18 +59,45 @@ public class PrescriptionInfoController extends BaseController{
    @RequestMapping(value = "/getDoctorPrescription", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "获取全科医生续方列表")
    public String getDoctorPrescription(@RequestParam(required = true) @ApiParam(value = "续方状态", name = "state") String state,
                                        @RequestParam(required = true) @ApiParam(value = "所有诊断:1 糖尿病 2高血压", name = "dispensary") String diseases,
                                        @RequestParam(required = true)@ApiParam(name="startDate",value="开始时间")String startDate,
                                        @RequestParam(required = true)@ApiParam(name="endDate",value="结束时间")String endDate){
    @ApiOperation(value = "获取全科医生/建管师续方列表")
    public String getDoctorPrescription(@RequestParam(required = false)@ApiParam(value = "团队code", name = "teamCode") Integer teamCode,
                                        @RequestParam(required = false)@ApiParam(value = "续方状态", name = "state") String state,
                                        @RequestParam(required = false)@ApiParam(value = "所有诊断:1 糖尿病 2高血压", name = "dispensary") String diseases,
                                        @RequestParam(required = false)@ApiParam(name="startDate",value="开始时间")String startDate,
                                        @RequestParam(required = false)@ApiParam(name="endDate",value="结束时间")String endDate){
        try {
            return write(200, "查询成功!", "data",prescriptionInfoService.getDoctorPrescription(getUID(),state,diseases,startDate,endDate));
            return write(200, "查询成功!", "data",prescriptionInfoService.getDoctorPrescription(teamCode,state,diseases,startDate,endDate));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
    @RequestMapping(value = "/getContinuedPrescriptionAsDoctor", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "续方详情")
    public String getContinuedPrescriptionAsDoctor(@RequestParam(required = true)@ApiParam(value = "续方CODE", name = "code") String code,
                                                   @RequestParam(required = true)@ApiParam(value = "团队长标识:1:是;2否", name = "type") String type){
        try {
            return write(200, "查询成功!", "data",prescriptionInfoService.getContinuedPrescriptionAsDoctor(code));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
    @RequestMapping(value = "/reviewPrescription", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "续方详情")
    public String reviewPrescription(@RequestParam(required = true)@ApiParam(value = "续方CODE", name = "code") String code,
                                     @RequestParam(required = false)@ApiParam(value = "不同意原因", name = "reason") String reason,
                                     @RequestParam(required = false)@ApiParam(value = "1同意,2不同意", name = "state") String state){
        try {
            return write(200, "查询成功!", "data",prescriptionInfoService.reviewPrescription(code,reason,state));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
}

+ 3 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionController.java

@ -111,7 +111,7 @@ public class PatientPrescriptionController extends WeixinBaseController {
            @RequestParam(value = "page",required = true) Integer page,
            @RequestParam(value = "pagesize",required = true) Integer pagesize) {
        //getUID()
        JSONArray result = prescriptionDispensaryCodeService.findByStatusAndTime(timeType,"915cc456-5b1d-11e6-8344-fa163e8aee56",status,page,pagesize);
        JSONArray result = prescriptionDispensaryCodeService.findByStatusAndTime(timeType,getUID(),status,page,pagesize);
        System.out.println(result.toString());
        return result.toString();
    }
@ -125,8 +125,8 @@ public class PatientPrescriptionController extends WeixinBaseController {
    //@ObserverRequired
    public String whetherHaveCode() {
        JSONObject json = new JSONObject();
        String patientCode = getRepUID();
        int count = prescriptionDispensaryCodeService.dispensaryCodeCount(patientCode);
//        String patientCode = getUID();
        int count = prescriptionDispensaryCodeService.dispensaryCodeCount(getUID());
        if (count > 0) {
            json.put("data", true);
            return json.toString();

+ 103 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionPayController.java

@ -0,0 +1,103 @@
package com.yihu.wlyy.web.patient.prescription;
import com.yihu.wlyy.service.app.prescription.PatientPrescriptionPayService;
import com.yihu.wlyy.web.WeixinBaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
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;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
 * Created by Reece on 2017/7/28.
 */
@RestController("patientPrescriptionPayController")
@RequestMapping(value = "/patient/prescription/pay", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "患者端-长处方支付接口")
public class PatientPrescriptionPayController extends WeixinBaseController {
    @Autowired
    private PatientPrescriptionPayService payService;
    /**
     * 患者支付接口
     *
     * @param payInfo
     * @return
     */
    @RequestMapping(value = "/charge", method = RequestMethod.POST)
    @ApiOperation(value = "患者支付接口")
    public String charge(@RequestParam(required = true) @ApiParam(value = "支付数据", name = "payInfo") String payInfo) throws  Exception{
        try {
            JSONObject json = new JSONObject(payInfo);
            JSONObject patientInfo = json.getJSONObject("patientInfo");
            JSONObject expressageInfo = json.getJSONObject("expressageInfo");
            JSONObject prescriptionInfo = json.getJSONObject("prescriptionInfo");
            JSONObject totalAmount = json.getJSONObject("totalAmount");
            payService.charge();
                return error(-1, "获取失败");
        } catch (Exception e) {
            return error(-1, "获取失败");
        }
    }
    /**
     * 患者支付结果查询接口
     *
     * @param outChargeNo
     * @return
     */
    @RequestMapping(value = "/chargeQuery", method = RequestMethod.GET)
    @ApiOperation(value = "患者支付结果查询接口")
    public String chargeQuery(@RequestParam(required = true) @ApiParam(value = "支付应用流水号", name = "outChargeNo") String outChargeNo) throws  Exception{
        try {
            payService.chargeQuery(outChargeNo);
            return error(-1, "获取失败");
        } catch (Exception e) {
            return error(-1, "获取失败");
        }
    }
    /**
     * 支付成功前端页面回调接口
     *
     * @param json
     * @return
     */
    @RequestMapping(value = "/returnUrl", method = RequestMethod.GET)
    @ApiOperation(value = "支付成功前端页面回调接口")
    public String returnUrl(String json) throws Exception{
        try {
            payService.returnUrl();
            return error(-1, "获取失败");
        } catch (Exception e) {
            return error(-1, "获取失败");
        }
    }
    /**
     * 对接方异步回调接口
     *
     * @return
     */
    @RequestMapping(value = "/receiveNotify", method = RequestMethod.GET)
    @ApiOperation(value = "对接方异步回调接口")
    public String receiveNotify(HttpServletRequest request, HttpServletResponse response) throws Exception{
        try {
            payService.receiveNotify();
            return error(-1, "获取失败");
        } catch (Exception e) {
            return error(-1, "获取失败");
        }
    }
}

+ 3 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/sign/PatientSignController.java

@ -310,13 +310,13 @@ public class PatientSignController extends BaseController {
    /**
     * 根据签约code查询签约详情
     * @param signCode
     * @param
     * @return
     */
    @RequestMapping(value = "/signInfo",method = RequestMethod.GET)
    public String getSignInfo(@RequestParam String signCode) {
    public String getSignInfo(@RequestParam String code) {
        try {
            List<JSONObject> jsonArray = signWebService.getSignInfo(signCode);
            List<JSONObject> jsonArray = signWebService.getSignInfo(code);
            return write(200, "查询成功!", "data", new JSONArray(jsonArray));
        } catch (Exception ex) {
            error(ex);

+ 12 - 9
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/BookingController.java

@ -134,7 +134,7 @@ public class BookingController extends WeixinBaseController {
    @ResponseBody
    @ApiOperation("获取机构列表")
    public String GetOrgList(@ApiParam(name = "city", value = "城市编码", defaultValue = "350200")
                             @RequestParam(value = "city", required = true) String city,
                             @RequestParam(value = "city", required = false) String city,
                             @ApiParam(name = "filter", value = "过滤条件", defaultValue = "")
                             @RequestParam(value = "filter", required = false) String filter,
                             @ApiParam(name = "type", value = "类型", defaultValue = "1")
@ -158,7 +158,7 @@ public class BookingController extends WeixinBaseController {
    @ResponseBody
    @ApiOperation("获取科室接口")
    public String GetOrgDepList(@ApiParam(name = "city", value = "城市编码", defaultValue = "350200")
                                @RequestParam(value = "city", required = true) String city,
                                @RequestParam(value = "city", required = false) String city,
                                @ApiParam(name = "hospitalId", value = "医院ID", defaultValue = "350211A1001")
                                @RequestParam(value = "hospitalId", required = true) String hospitalId,
                                @ApiParam(name = "filter", value = "过滤条件", defaultValue = "")
@ -181,7 +181,7 @@ public class BookingController extends WeixinBaseController {
    @ResponseBody
    @ApiOperation("获取医生接口")
    public String GetDoctorList(@ApiParam(name = "city", value = "城市编码", defaultValue = "350200")
                                @RequestParam(value = "city", required = true) String city,
                                @RequestParam(value = "city", required = false) String city,
                                @ApiParam(name = "hospitalId", value = "医院ID", defaultValue = "350211A1001")
                                @RequestParam(value = "hospitalId", required = true) String hospitalId,
                                @ApiParam(name = "hosDeptId", value = "科室ID", defaultValue = "1040610")
@ -208,7 +208,7 @@ public class BookingController extends WeixinBaseController {
    @ResponseBody
    @ApiOperation("获取医生排班接口(包含排班详细)")
    public String GetDoctorArrange(@ApiParam(name = "city", value = "城市编码", defaultValue = "350200")
                                   @RequestParam(value = "city", required = true) String city,
                                   @RequestParam(value = "city", required = false) String city,
                                   @ApiParam(name = "hospitalId", value = "医院ID", defaultValue = "350211G1102")
                                   @RequestParam(value = "hospitalId", required = true) String hospitalId,
                                   @ApiParam(name = "hosDeptId", value = "科室ID", defaultValue = "3020001")
@ -228,7 +228,7 @@ public class BookingController extends WeixinBaseController {
    @ResponseBody
    @ApiOperation("获取医生排班接口(一级)")
    public String GetDoctorArrangeSimple(@ApiParam(name = "city", value = "城市编码", defaultValue = "350200")
                                         @RequestParam(value = "city", required = true) String city,
                                         @RequestParam(value = "city", required = false) String city,
                                         @ApiParam(name = "hospitalId", value = "医院ID", defaultValue = "350211A1001")
                                         @RequestParam(value = "hospitalId", required = true) String hospitalId,
                                         @ApiParam(name = "hosDeptId", value = "科室ID", defaultValue = "1010210")
@ -248,7 +248,7 @@ public class BookingController extends WeixinBaseController {
    @ResponseBody
    @ApiOperation("根据医生编码获取医生详细信息")
    public String GetDoctorInfo(@ApiParam(name = "city", value = "城市编码", defaultValue = "350200")
                                @RequestParam(value = "city", required = true) String city,
                                @RequestParam(value = "city", required = false) String city,
                                @ApiParam(name = "doctorId", value = "医生id", defaultValue = "07101")
                                @RequestParam(value = "doctorId", required = true) String doctorId,
                                @ApiParam(name = "hospitalId", value = "医院id", defaultValue = "350211A1001")
@ -257,8 +257,11 @@ public class BookingController extends WeixinBaseController {
                                @RequestParam(value = "hosDeptId", required = true) String hosDeptId) {
        try {
//            GuahaoDoctor doctor = getService(city).GetDoctorInfo(doctorId, hospitalId, hosDeptId);
            String doctor = jwSmjkService.GetDoctorInfo(hospitalId,hosDeptId,doctorId);
            return doctor;
//            String doctor = jwSmjkService.GetDoctorInfo(hospitalId,hosDeptId,doctorId);
            //---2017.07.31----黄文杰---获取医生详细信息时从10天号源的医生
            JSONObject result  = jwSmjkService.GetDoctorInfoTen(hospitalId,hosDeptId,doctorId);
            return write(200, "获取医生详细信息成功!","data",result);
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
@ -268,7 +271,7 @@ public class BookingController extends WeixinBaseController {
    @ResponseBody
    @ApiOperation("创建挂号单")
    public String CreateOrder(@ApiParam(name = "city", value = "城市编码", defaultValue = "350200")
                              @RequestParam(value = "city", required = true) String city,
                              @RequestParam(value = "city", required = false) String city,
                              @ApiParam(name = "hospitalId", value = "医院ID", defaultValue = "350211A1001")
                              @RequestParam(value = "hospitalId", required = true) String hospitalId,
                              @ApiParam(name = "hospitalName", value = "医院名称", defaultValue = "厦门大学附属第一医院")

+ 11 - 9
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/wx/OnePayController.java

@ -2,8 +2,6 @@ package com.yihu.wlyy.web.wx;
import com.alibaba.fastjson.JSON;
import com.yihu.wlyy.entity.charge.WlyyCharge;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.repository.charge.ChargeDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
@ -12,7 +10,6 @@ import com.yihu.wlyy.service.weixin.wxpay.common.Configure;
import com.yihu.wlyy.service.weixin.wxpay.model.BindCard;
import com.yihu.wlyy.service.weixin.wxpay.model.Charge;
import com.yihu.wlyy.service.weixin.wxpay.service.OnePayService;
import com.yihu.wlyy.util.SystemConf;
import com.yihu.wlyy.web.WeixinBaseController;
import com.ylzinfo.onepay.sdk.OnepayDefaultClient;
import com.ylzinfo.onepay.sdk.domain.RequestParams;
@ -43,11 +40,9 @@ import java.io.PrintWriter;
import java.io.StringWriter;
import java.net.URLDecoder;
import java.nio.charset.Charset;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
/**
 * Created by hzp on 2017/05/23.
@ -92,8 +87,12 @@ public class OnePayController extends WeixinBaseController {
        try {
//            String patient = getUID();
//            String openid = getOpenid();
//            逸祥
//            String patient = "0cc6e4562de2437ab2dbbf51a9fc3b49";
//            String openid = "oULM4xAj9sOsHJ95ttKYd_Fjh6Hc";
//            在鑫
            String patient = "0cc6e4562de2437ab2dbbf51a9fc3b49";
            String openid = "oULM4xAj9sOsHJ95ttKYd_Fjh6Hc";
            String openid = "o7NFZw7FlRW-Hlp0VjM71FR_1otw";
            BindCard bindCard = pay.bindCard(patient, openid);//getUID(), getOpenid());      oULM4xAj9sOsHJ95ttKYd_Fjh6Hc
            String sicardUrl = pay.createSicard(patient, openid);//getUID(), getOpenid());
            if (bindCard != null) {
@ -123,14 +122,17 @@ public class OnePayController extends WeixinBaseController {
            @RequestParam String chargeType,
            @ApiParam(name = "chargeRelation", value = "支付关联代码签约code", defaultValue = "044701ea-5b23-11e6-8344-fa163e8aee56")
            @RequestParam String chargeRelation,
            @ApiParam(name = "totalAmount", value = "交易总金额(分)", defaultValue = "1")
            @RequestParam Integer totalAmount) throws Exception {
            @ApiParam(name = "totalAmount", value = "交易总金额(分)", defaultValue = "12000")
            @RequestParam String totalAmount) throws Exception {
        try {
            //            获取居民个人信息
//            String patient = getUID();
//            String openId = getOpenid();
//            String patient = "0cc6e4562de2437ab2dbbf51a9fc3b49";
//            String openId = "oULM4xAj9sOsHJ95ttKYd_Fjh6Hc";
//            在鑫
            String patient = "0cc6e4562de2437ab2dbbf51a9fc3b49";
            String openId = "oULM4xAj9sOsHJ95ttKYd_Fjh6Hc";
            String openId = "o7NFZw7FlRW-Hlp0VjM71FR_1otw";
            if (StringUtils.isNotEmpty(openId)) {
                String settleNo = pay.charge(orgCode, chargeType, chargeRelation, totalAmount, patient, openId,getAccessToken());  //ohNH9sh4uwuJCxIwcLJtGTX-BaSk    getUID(),getOpenid()
                return write(200, "家庭医生签约支付成功!", "data", settleNo);

+ 6 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/wechat/process/WeiXinEventProcess.java

@ -243,15 +243,15 @@ public class WeiXinEventProcess {
        // 图文消息图片URL
        String prescription_pic = systemConf.getProperty("patient_prescription_pic");
        // URL设置服务器URL、AppId
        examination = examination.replace("{server}", wechat_base_url)
        prescription = prescription.replace("{server}",wechat_base_url)
                .replace("{appId}",appId);
        //图片地址
        prescription_pic = examination_pic.replace("{server}",serverUrl);
        prescription_pic = prescription_pic.replace("{server}",serverUrl);
        articleExamination.put("Url", prescription);
        articleExamination.put("Title", "处方记录");
        articleExamination.put("Description", "处方记录");
        articleExamination.put("PicUrl", prescription_pic);
        articlePrescription.put("Url", prescription);
        articlePrescription.put("Title", "处方记录");
        articlePrescription.put("Description", "处方记录");
        articlePrescription.put("PicUrl", prescription_pic);
        articles.add(articlePrescription);
        // 构建回复消息XML

+ 6 - 6
patient-co/patient-co-wlyy/src/main/resources/application.yml

@ -166,17 +166,17 @@ spring:
  datasource:
    wlyy:
      url: jdbc:mysql:/59.61.92.94:3306/wlyy?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: wlyy
      password: jkzlehr@123
      url: jdbc:mysql://59.61.92.94:3306/wlyy?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: jkzl_root
      password: jkzlehr@321465
    health:
      url: jdbc:mysql://59.61.92.94:3306/device?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: wlyy
      password: jkzlehr@123
      password: jkzlehr@321465
  redis:
    host: 120.41.253.95 # Redis server host.
    port: 6379 # Redis server port.
    port: 6380 # Redis server port.
    password: jkzl_ehr
server:
@ -187,7 +187,7 @@ im:
  im_list_get: http://120.41.253.95:3000/
  group_server: http://120.41.253.95:3000/api/v1/chats/gm
  msg_push_server: http://120.41.253.95:3000/api/v1/chats/sm
  data_base_name: ichat
  data_base_name: im
wechat:
  appId: wxad04e9c4c5255acf

+ 2 - 2
patient-co/patient-co-wlyy/src/main/resources/config/fdfs_client.conf

@ -9,7 +9,7 @@ http.secret_key = FastDFS1234567890
#tracker_server = 172.19.103.54:22122
#-------------测试环境---------------#
tracker_server = 172.19.103.54:22122
#tracker_server = 172.19.103.54:22122
#-------------正式环境---------------#
#tracker_server = 192.168.0.239:22122
tracker_server = 192.168.0.239:22122