Kaynağa Gözat

签约文案

trick9191 7 yıl önce
ebeveyn
işleme
a719eba01a
43 değiştirilmiş dosya ile 1311 ekleme ve 705 silme
  1. 7 7
      patient-co/patient-co-statistics/pom.xml
  2. 58 58
      patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/config/RedisConfig.java
  3. 6 6
      patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/config/war/ServletInitializer.java
  4. 36 36
      patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/controller/KeyExpiredListener.java
  5. 1 1
      patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/CurrentDayAllQuotaJob.java
  6. 1 1
      patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/message/HealthMessageJob.java
  7. 5 0
      patient-co/patient-co-wlyy/pom.xml
  8. 3 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/config/MvcConfig.java
  9. 11 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/message/Message.java
  10. 9 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionDispensaryCode.java
  11. 9 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionExpressage.java
  12. 105 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionExpressageLog.java
  13. 14 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionLog.java
  14. 5 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/DoctorInterceptor.java
  15. 6 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/PatientInterceptor.java
  16. 6 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/consult/ConsultTeamDao.java
  17. 7 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/message/MessageDao.java
  18. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionDispensaryCodeDao.java
  19. 120 26
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java
  20. 17 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/message/MessageService.java
  21. 30 17
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionDiagnosisService.java
  22. 11 8
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionDispensaryCodeService.java
  23. 24 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionExpressageService.java
  24. 3 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statistics/StatisticsService.java
  25. 33 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/JwSmjkService.java
  26. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/wxpay/common/Configure.java
  27. 18 15
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/wxpay/service/OnePayService.java
  28. 2 8
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/task/PushMsgTask.java
  29. 26 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/ImUtill.java
  30. 334 312
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/RSAUtils.java
  31. 8 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/im/imController.java
  32. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/util/WlyySerivceController.java
  33. 61 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/consult/DoctorConsultController.java
  34. 1 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/message/DoctorMessageController.java
  35. 105 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionCodeController.java
  36. 175 123
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/consult/ConsultController.java
  37. 20 11
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionController.java
  38. 3 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/sign/PatientSignController.java
  39. 12 9
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/BookingController.java
  40. 2 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/wx/OnePayController.java
  41. 3 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/wechat/process/WeiXinEventProcess.java
  42. 9 15
      patient-co/patient-co-wlyy/src/main/resources/application.yml
  43. 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 - 58
patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/config/RedisConfig.java

@ -1,58 +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;
//    }
//}
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;
    }
}

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

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

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

@ -1,36 +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()) + "");
//        }
//    }
//}
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)) {

+ 1 - 1
patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/message/HealthMessageJob.java

@ -95,7 +95,7 @@ public class HealthMessageJob implements Job {
                String teamLeader=jdbcTemplate.queryForObject(sql,String.class,entry.getKey());
                Message message=new Message();
                message.setType(3);
                message.setRead(0);
                message.setRead(1);
                message.setOver("0");
                message.setDel("1");
                message.setSender("system");

+ 5 - 0
patient-co/patient-co-wlyy/pom.xml

@ -213,6 +213,11 @@
        </dependency>
        <!-- aspectjrt end -->
        <dependency>
            <groupId>net.sf.json-lib</groupId>
            <artifactId>json-lib</artifactId>
            <version>2.4</version>
        </dependency>
        <!-- jdbc driver -->
        <dependency>

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

@ -31,9 +31,9 @@ public class MvcConfig extends WebMvcConfigurerAdapter {
        // 多个拦截器组成一个拦截器链
        // addPathPatterns 用于添加拦截规则
        // excludePathPatterns 用户排除拦截
        registry.addInterceptor(doctorInterceptor).addPathPatterns("/doctor/**","/statistics/province/**","/statistics/**");
        registry.addInterceptor(patientInterceptor).addPathPatterns("/patient/**");
        registry.addInterceptor(userInterceptor).addPathPatterns("/user/**");
//        registry.addInterceptor(doctorInterceptor).addPathPatterns("/doctor/**","/statistics/province/**","/statistics/**");
//        registry.addInterceptor(patientInterceptor).addPathPatterns("/patient/**");
//        registry.addInterceptor(userInterceptor).addPathPatterns("/user/**");
        super.addInterceptors(registry);
    }

Dosya farkı çok büyük olduğundan ihmal edildi
+ 11 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/message/Message.java


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

@ -21,6 +21,7 @@ public class PrescriptionDispensaryCode extends IdEntity{
    private Date createTime;               //创建时间
    private Integer type;                   //编码类型:1 居民取药码 2 配送员(健管师)取药码
    private String imgUrl;                  //图片存在FastFDS的路径
    private Integer isUse;//是否使用 1是 0否
    @Column(name = "code", unique = true , nullable=false)
    public String getCode() {
@ -65,4 +66,12 @@ public class PrescriptionDispensaryCode extends IdEntity{
    public void setImgUrl(String imgUrl) {
        this.imgUrl = imgUrl;
    }
    public Integer getIsUse() {
        return isUse;
    }
    public void setIsUse(Integer isUse) {
        this.isUse = isUse;
    }
}

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

@ -33,6 +33,7 @@ public class PrescriptionExpressage extends IdEntity{
    private String hospitalName;            //如果配送方式是健管师那么这个字段存服务站名称,如果是快递配送那么是快递公司名称
    private Double price;                    //快递的配送费用
    private Date createTime;                //创建的时间
    private Integer oneselfPickupFlg;//是否自取 1是 0否
    @Column(name = "code", unique = true , nullable=false)
    public String getCode() {
@ -171,4 +172,12 @@ public class PrescriptionExpressage extends IdEntity{
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Integer getOneselfPickupFlg() {
        return oneselfPickupFlg;
    }
    public void setOneselfPickupFlg(Integer oneselfPickupFlg) {
        this.oneselfPickupFlg = oneselfPickupFlg;
    }
}

+ 105 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionExpressageLog.java

@ -0,0 +1,105 @@
package com.yihu.wlyy.entity.patient.prescription;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by Administrator on 2017/7/21.
 * 处方配送
 */
@Entity
@Table(name = "wlyy_prescription_expressage_log")
public class PrescriptionExpressageLog extends IdEntity{
    private String code;                    //业务code
    private String prescriptionCode;      //处方code  关联表wlyy_prescription code
    private String expressageCode;//配送code 关联wlyy_prescription_expressage code
    private Date createTime;                //创建的时间
    private String remark;//备注
    private String acceptAddress;//路由节点发生的城市
    private Date acceptTime;// 路由节点产生的时间,格式:YYYY-MM-DD HH24:MM:SS,示例:2012-7-30 09:30:00。
    private String opCode;//路由节点操作码
    private String acceptRemark;//路由节点具体描述
    @Column(name = "code", unique = true , nullable=false)
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getPrescriptionCode() {
        return prescriptionCode;
    }
    public void setPrescriptionCode(String prescriptionCode) {
        this.prescriptionCode = prescriptionCode;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getExpressageCode() {
        return expressageCode;
    }
    public void setExpressageCode(String expressageCode) {
        this.expressageCode = expressageCode;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    public String getAcceptAddress() {
        return acceptAddress;
    }
    public void setAcceptAddress(String acceptAddress) {
        this.acceptAddress = acceptAddress;
    }
    public Date getAcceptTime() {
        return acceptTime;
    }
    public void setAcceptTime(Date acceptTime) {
        this.acceptTime = acceptTime;
    }
    public String getOpCode() {
        return opCode;
    }
    public void setOpCode(String opCode) {
        this.opCode = opCode;
    }
    public String getAcceptRemark() {
        return acceptRemark;
    }
    public void setAcceptRemark(String acceptRemark) {
        this.acceptRemark = acceptRemark;
    }
}

+ 14 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionLog.java

@ -24,12 +24,24 @@ public class PrescriptionLog extends IdEntity {
        static public Integer expressage = 6;   //配送
        static public Integer finish = 7;   //已完成
    }
    public final static class PrescriptionLogStatus {
        static public Integer no_reviewed =-1; //审核不通过
        static public Integer revieweding = 0;  //审核中
        static public Integer reviewed_success = 10;   //审核通过/待支付
        static public Integer pay_success = 20;  //支付成功/配药中
        static public Integer pay_error  = 21;    //21支付失败
        static public Integer wait_expressage = 30;   //配药成功/等待领药
        static public Integer expressageing = 31;   //配送中
        static public Integer expressageing_error = 32;   //配送失败
        static public Integer finish = 100;   //结束
    }
    private String code;                    //业务流程
    private String prescriptionCode;      //处方code 关联表wlyy_prescription code
    private Date createTime;               //处方创建时间
    private Integer status;                  //状态 (-1 审核不通过 , 0 审核中, 10 审核通过/待支付 ,21支付失败  20 配药中/支付成功, 21 等待领药 ,30 配送中 ,100配送成功/已完成)
    private Integer type;                //类型: 1智业对接 2易联众对接  3创建处方 4 审核  5付款 6 配送 7完成
    private Integer status;                  //状态 (-1 审核不通过 , 0 审核中, 10 审核通过/待支付 ,20 配药中/支付成功  , 21支付失败  , 30 配药成功/等待领药 ,31 配送中 32 配送失败,100配送成功/已完成)
    private Integer type;                   //类型: 1智业对接 2易联众对接  3创建处方 4 审核  5付款 6 配送 7完成
    private String userCode;                  //医生或者患者code
    private String userName;                  //医生或者患者name
    private Integer userType;                 //1 患者 2医生

+ 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;
			}

+ 6 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/consult/ConsultTeamDao.java

@ -25,7 +25,7 @@ public interface ConsultTeamDao extends PagingAndSortingRepository<ConsultTeam,
	@Query("select a from ConsultTeam a where a.patient = ?1 and a.del = '1' and a.status = 0")
	List<ConsultTeam> findUnfinishedConsult(String patient);
	@Query("select a from ConsultTeam a,ConsultTeamDoctor b where a.consult = b.consult and a.patient = ?1 and b.to = ?2 and a.del = '1' and a.status = 0")
	@Query("select a from ConsultTeam a,ConsultTeamDoctor b where a.consult = b.consult and a.patient = ?1 and b.to = ?2 and a.del = '1' and a.type<>8 and a.status = 0")
	List<ConsultTeam> findUnfinishedConsultType(String patient,String doctor);
	// 统计未完成的数量
@ -101,21 +101,21 @@ public interface ConsultTeamDao extends PagingAndSortingRepository<ConsultTeam,
	@Query("select a from ConsultTeam a where a.patient = ?1 and a.status=0 and del = '1'")
	Page<ConsultTeam> findNotFinishedBypatient(String patient, Pageable pageRequest);
	@Query("select a from ConsultTeam a where a.patient = ?1 and a.id < ?2 and a.status=0 and del = '1'")
	@Query("select a from ConsultTeam a where a.patient = ?1 and a.id < ?2 and a.status=0 and del = '1' and a.type<>8")
	Page<ConsultTeam> findNotFinishedBypatient(String patient, long id, Pageable pageRequest);
	// 患者咨询列表(已结束)
	@Query("select a from ConsultTeam a where a.patient=?1 and a.status=1 and del = '1'")
	@Query("select a from ConsultTeam a where a.patient=?1 and a.status=1 and del = '1' and a.type<>8")
	Page<ConsultTeam> findFinishedBypatient(String patient, Pageable pageRequest);
	@Query("select a from ConsultTeam a where a.patient=?1 and a.id < ?2 and a.status=1 and del = '1'")
	@Query("select a from ConsultTeam a where a.patient=?1 and a.id < ?2 and a.status=1 and del = '1' and a.type<>8")
	Page<ConsultTeam> findFinishedBypatient(String patient, long id, Pageable pageRequest);
	// 患者咨询列表(已取消)
	@Query("select a from ConsultTeam a where a.patient=?1 and a.status=-1 and del = '1'")
	@Query("select a from ConsultTeam a where a.patient=?1 and a.status=-1 and del = '1' and a.type<>8")
	Page<ConsultTeam> findCancelBypatient(String patient, Pageable pageRequest);
	@Query("select a from ConsultTeam a where a.patient=?1 and a.id < ?2 and a.status=-1 and del = '1'")
	@Query("select a from ConsultTeam a where a.patient=?1 and a.id < ?2 and a.status=-1 and del = '1' and a.type<>8")
	Page<ConsultTeam> findCancelBypatient(String patient, long id, Pageable pageRequest);
	// 医生未读数量+1

+ 7 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/message/MessageDao.java

@ -6,6 +6,7 @@
package com.yihu.wlyy.repository.message;
import com.yihu.wlyy.entity.message.Message;
import io.swagger.models.auth.In;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
@ -51,10 +52,13 @@ public interface MessageDao extends PagingAndSortingRepository<Message, Long>, J
    @Query("update Message a set a.read = 0 where a.receiver = ?1 and a.sender=?2 and a.tzType=?3")
    int updateHealthIndexMessageByPatient(String doctor,String patient,String type);
    @Query("select a from Message a where a.read= 1 and a.receiver = ?1 and a.type not in (1,2) order by a.czrq desc")
    @Query("select a from Message a where a.read= 1 and a.receiver = ?1 and a.type not in (1,2,6) order by a.czrq desc")
    List<Message> getSystemMessageUnread(String doctor);
    @Query("select a from Message a where a.receiver = ?1 and a.type not in (1,2)")
    @Query("select a from Message a where a.receiver = ?1 and a.read=?2 and a.type=?3 order by a.createTime desc")
    List<Message> getSysTemMessageByTypeAndRead(String doctor, Integer read, Integer type);
    @Query("select a from Message a where a.receiver = ?1 and a.type not in (1,2,6)")
    List<Message> getSystemMessage(String doctor,Pageable pageRequest);
@ -66,7 +70,7 @@ public interface MessageDao extends PagingAndSortingRepository<Message, Long>, J
    @Modifying
    int setMessageReaded(String doctor,Integer type);
    @Query("update Message a set a.read = 0,a.over = '0' where a.receiver = ?1 and a.type not in (1,2)")
    @Query("update Message a set a.read = 0,a.over = '0' where a.receiver = ?1 and a.type not in (1,2,6)")
    @Modifying
    int setSysMessageReaded(String doctor);

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionDispensaryCodeDao.java

@ -21,7 +21,7 @@ public interface PrescriptionDispensaryCodeDao extends PagingAndSortingRepositor
//    @Query("select  count(1) from wlyy_prescription_dispensary_code p1 \n" +
//            "LEFT JOIN wlyy_prescription p2 on p1.prescription_Code = p2.code where p2.status in(21,20,100) and p2.patient =?1 ")
//    int dispensaryCodeCount(String patientCode);
    @Query("select count(1) from PrescriptionDispensaryCode a ,Prescription b where a.prescriptionCode =b.code and a.code= ?1 and b.status != 100")
    @Query("select count(1) from PrescriptionDispensaryCode a where a.code= ?1 and a.isUse =0")
    Integer getResidentQRCodeCount(String code);
//    @Query("select p1 from PrescriptionInfo p1 left join Prescription p2 on p1.prescriptionCode=p2.code where p1.prescriptionCode = ?1")

+ 120 - 26
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java

@ -10,10 +10,13 @@ import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.team.sign.DoctorTeam;
import com.yihu.wlyy.entity.doctor.team.sign.DoctorTeamMember;
import com.yihu.wlyy.entity.education.HealthEduArticle;
import com.yihu.wlyy.entity.message.Message;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.PatientFamilyMember;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionDiagnosis;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionInfo;
import com.yihu.wlyy.repository.consult.ConsultTeamDao;
import com.yihu.wlyy.repository.consult.ConsultTeamDoctorDao;
import com.yihu.wlyy.repository.consult.ConsultTeamLogDao;
@ -25,6 +28,8 @@ import com.yihu.wlyy.repository.patient.PatientDeviceDao;
import com.yihu.wlyy.repository.patient.PatientFamilyMemberDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
import com.yihu.wlyy.repository.prescription.PrescriptionDiagnosisDao;
import com.yihu.wlyy.repository.prescription.PrescriptionInfoDao;
import com.yihu.wlyy.service.app.health.HealthEduArticleService;
import com.yihu.wlyy.service.app.health.PatientHealthGuidanceService;
import com.yihu.wlyy.service.app.prescription.PrescriptionLogService;
@ -109,6 +114,10 @@ public class ConsultTeamService extends ConsultService {
    @Autowired
    private PrescriptionLogService prescriptionLogService;
    @Autowired
    private PrescriptionInfoDao prescriptionInfoDao;
    @Autowired
    private PrescriptionDiagnosisDao prescriptionDiagnosisDao;
    @Autowired
    private ImUtill ImUtill;
    @Autowired
    private HttpClientUtil HttpClientUtil;
@ -872,34 +881,22 @@ public class ConsultTeamService extends ConsultService {
            //获取基位处方详情
            Prescription prescription = new Prescription();
            prescription.setCode(getCode());
            prescription.setHospitalName(doctor.getHospitalName());
            prescription.setHospital(doctor.getHospital());
            prescription.setAdminTeamId(ct.getAdminTeamId());
            prescription.setCreateTime(new Date());
            prescription.setDept(doctor.getDept());
            prescription.setDeptName(doctor.getDeptName());
            prescription.setDoctor(doctor.getCode());
            prescription.setDoctorName(doctor.getName());
            prescription.setJwCode(jwCode);
            prescription.setPatient(p.getCode());
            prescription.setPatientName(p.getName());
            prescription.setReason(reason);
            prescription.setType(2);
            prescription.setStatus(0);
            String symptoms = p.getName()+"申请续方\n体征信息:";
            savePrescription(prescription,jwCode,doctor,p,ct,reason);
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("title",p.getName()+"申请续方");
            //获取体征记录
            Iterable<PatientDevice> devices = patientDeviceDao.findByUser(patient);
            if(devices!=null||devices.iterator().hasNext()){
                int count = messageDao.findTzMessage(patient);
                symptoms +="最近七天有"+count+"条异常记录";
                jsonObject.put("tzMsg","最近七天有"+count+"条异常记录");
            }else{
                symptoms +="居民未绑定体征设备";
                jsonObject.put("tzMsg","居民未绑定体征设备");
            }
            //获取上次续方时间:与平安的“智慧医保的审方系统”对接,判断居民上次续方时间,点击跳转上次续方记录。(此功能需与第三方系统对接,如果本次版本无法实现,则消息中不显示此条信息)
            jsonObject.put("lastTime","");
            String symptoms = jsonObject.toString();
            //创建咨询
            JSONObject users = new JSONObject();//咨询参与者
@ -962,21 +959,101 @@ public class ConsultTeamService extends ConsultService {
            cd.setTo(doctorCode);
            consultTeamDoctorDao.save(cd);
            //3、保存续方记录
            prescription.setConsult(ct.getConsult());
            prescriptionDao.save(prescription);
            //发送系统消息提示团队长有未审核的消息
            addCheckMessage(prescription,p);
            // 保存医生咨询信息
            // 添加咨询转发记录
            // 添加医生咨询日志
            String content = addLogs(ct);
            prescriptionLogService.addLog(prescription,3,1,1);
            return 1;
        }
    }
    /**
     * 保存审核提醒消息
     * @param prescription
     * @param patient
     */
    public void addCheckMessage(Prescription prescription,Patient patient){
        Message message = new Message();
        message.setCzrq(new Date());
        message.setCreateTime(new Date());
        message.setRead(1);//设置未读
        message.setOver("1");
        message.setReceiver(prescription.getDoctor());
        message.setSender(prescription.getPatient());
        message.setCode(getCode());
        message.setSex(patient.getSex());
        message.setSenderName(patient.getName());
        message.setSenderPhoto(patient.getPhoto());
        message.setTitle("续方申请");
        message.setContent("您有一条新的续方申请待处理!");
        message.setType(6);//续方咨询待审核提醒
        message.setReadonly(1);//是否只读消息
        message.setDel("1");
        message.setRelationCode(prescription.getConsult());
        messageDao.save(message);
    }
    /**
     * 保存续方信息
     * @param prescription
     * @param jwCode
     * @param doctor
     * @param p
     * @param ct
     * @param reason
     * @return
     */
    public Prescription savePrescription(Prescription prescription,String jwCode,Doctor doctor,Patient p,ConsultTeam ct,String reason){
        prescription.setCode(getCode());
        prescription.setParentCode(jwCode);
        prescription.setHospitalName(doctor.getHospitalName());
        prescription.setHospital(doctor.getHospital());
        prescription.setAdminTeamId(ct.getAdminTeamId());
        prescription.setCreateTime(new Date());
        prescription.setDept(doctor.getDept());
        prescription.setDeptName(doctor.getDeptName());
        prescription.setDoctor(doctor.getCode());
        prescription.setDoctorName(doctor.getName());
        prescription.setJwCode(jwCode);
        prescription.setPatient(p.getCode());
        prescription.setPatientName(p.getName());
        prescription.setReason(reason);
        prescription.setType(2);
        prescription.setStatus(0);
        prescription.setConsult(ct.getConsult());
        prescriptionDao.save(prescription);
        //保存续方疾病类型和药品(处方)信息
        PrescriptionInfo prescriptionInfo = new PrescriptionInfo();
        prescriptionInfo.setPrescriptionCode(prescription.getCode());
        prescriptionInfo.setCode(getCode());
        prescriptionInfo.setDel(1);
        prescriptionInfo.setDirection("口服");//药品用法
        prescriptionInfo.setDrugCode("药品code");//药品code
        prescriptionInfo.setDrugName("药品名称");//药品名称
        prescriptionInfo.setDrugRate("每次1.25mg    q.d.");//吃药频率
        prescriptionInfo.setDrugFormat("2.5mg*80片/盒");//药品规格
        prescriptionInfo.setNum(10);//药品数目
        prescriptionInfo.setIsRefrigerate(0);//是否冷藏 1是 0否
        prescriptionInfoDao.save(prescriptionInfo);
        PrescriptionDiagnosis diagnosis = new PrescriptionDiagnosis();
        diagnosis.setCode("1");
        diagnosis.setPrescriptionCode(prescription.getCode());
        diagnosis.setCreateTime(new Date());
        diagnosis.setName("高血压");
        diagnosis.setUpdateTime(new Date());
        prescriptionDiagnosisDao.save(diagnosis);
        prescriptionLogService.addLog(prescription,3,1,1);
        return prescription;
    }
    /**
     * 发送消息给IM
     *
@ -1244,7 +1321,7 @@ public class ConsultTeamService extends ConsultService {
    }
    /**
     * 医生关闭三师咨询
     * 医生关闭三师咨询(续方咨询)
     *
     * @param consult 三师咨询标识
     * @return
@ -1252,6 +1329,15 @@ public class ConsultTeamService extends ConsultService {
    public int finish(String consult, String endOperator, int endType) throws Exception {
        ConsultTeam consultTeam = consultTeamDao.findByConsult(consult);
        //新增续方咨询结束判断 (续方未审核时不可由医生或居民关闭)
        if(consultTeam.getType()==8){
            Prescription prescription = prescriptionDao.findByCode(consultTeam.getRelationCode());
            if(prescription.getStatus()==0){
                return -2;
            }
        }
        String name = "";
        String returnJson = "";
        //推送给IM文字消息
@ -1944,6 +2030,14 @@ public class ConsultTeamService extends ConsultService {
            return -1;
        }
        //新增续方咨询结束判断 (续方未审核时不可由医生或居民关闭)
        if(consultTeam.getType()==8){
            Prescription prescription = prescriptionDao.findByCode(consultTeam.getRelationCode());
            if(prescription.getStatus()==0){
                return -2;
            }
        }
        String endName = "";
        String endId = "";
        //推送给IM文字消息

+ 17 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/message/MessageService.java

@ -11,7 +11,6 @@ import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.util.SystemConf;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
@ -152,11 +151,28 @@ public class MessageService extends BaseService {
            systemJson.put("amount", 0);
        }
        //获取续方消息
        List<Message> prescriptionMessage = messageDao.getSysTemMessageByTypeAndRead(doctor,1,6);
        JSONObject prescriptionJson = new JSONObject();
        if (prescriptionMessage != null && prescriptionMessage.size() > 0) {
            prescriptionJson.put("amount", prescriptionMessage.size());
            JSONObject msgJson = new JSONObject();
            msgJson.put("title", systemMessage.get(0).getTitle());
            msgJson.put("type", systemMessage.get(0).getType());
            msgJson.put("msg", systemMessage.get(0).getContent());
            msgJson.put("msgTime", DateUtil.dateToStrLong(systemMessage.get(0).getCreateTime()));
            prescriptionJson.put("lastMessage", msgJson);
        } else {
            prescriptionJson.put("amount", 0);
        }
        JSONObject json = new JSONObject();
        json.put("imMsgCount", getImMsgAmount(doctor));//IM消息数量
        json.put("sign", signJson);//签约数
        json.put("healthIndex", indexJson);//健康指标
        json.put("system", systemJson);//系统消息
        json.put("prescription", prescriptionJson);//续方消息
        return json;
    }

+ 30 - 17
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionDiagnosisService.java

@ -5,8 +5,9 @@ import com.yihu.wlyy.entity.patient.prescription.PrescriptionInfo;
import com.yihu.wlyy.repository.prescription.PrescriptionDiagnosisDao;
import com.yihu.wlyy.repository.prescription.PrescriptionInfoDao;
import com.yihu.wlyy.service.BaseService;
import net.sf.json.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import net.sf.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
@ -34,8 +35,9 @@ public class PrescriptionDiagnosisService extends BaseService{
     * @param prescriptionCode
     * @return
     */
    public String getPrescriptionDiagnosis(String prescriptionCode){
    public JSONArray getPrescriptionDiagnosis(String prescriptionCode){
        String re = "";
        JSONArray jsonArray = new JSONArray();
        try {
            if(!StringUtils.isEmpty(prescriptionCode))
            {
@ -46,21 +48,25 @@ public class PrescriptionDiagnosisService extends BaseService{
                {
                    List<PrescriptionDiagnosis> list = prescriptionDiagnosisDao.findByPrescriptionCode(prescriptionCode);
                    if(list!=null&&list.size()>0){
                        re = new JSONArray(list).toString();
                        for (PrescriptionDiagnosis diagnosis:list){
                            JSONObject json = new JSONObject();
                            json.put("code",diagnosis.getCode());//疾病代码
                            json.put("name",diagnosis.getName());//疾病名称
                            jsonArray.add(json);
                        }
                        re = jsonArray.toString();
                        redisTemplate.opsForValue().set(key,re,2, TimeUnit.HOURS);
                    }
                }else {
                    jsonArray = JSONArray.fromObject(re);
                }
            }
        }
        catch (Exception ex) {
            ex.printStackTrace();
            return new JSONArray().toString();
        }
        if(StringUtils.isEmpty(re)){
           re = new JSONArray().toString();
        }
        return re;
        return jsonArray;
    }
    /**
@ -68,8 +74,9 @@ public class PrescriptionDiagnosisService extends BaseService{
     * @param prescriptionCode
     * @return
     */
    public String getPrescriptionInfo(String prescriptionCode){
    public JSONArray getPrescriptionInfo(String prescriptionCode){
        String re = "";
        JSONArray jsonArray = new JSONArray();
        try {
            if(!StringUtils.isEmpty(prescriptionCode))
            {
@ -80,21 +87,20 @@ public class PrescriptionDiagnosisService extends BaseService{
                {
                    List<PrescriptionInfo> list = prescriptionInfoDao.findByPrescriptionCode(prescriptionCode);
                    if(list!=null&&list.size()>0){
                        re = new JSONArray(list).toString();
                        jsonArray = JSONArray.fromObject(list);
                        re = jsonArray.toString();
                        redisTemplate.opsForValue().set(key,re,2, TimeUnit.HOURS);
                    }
                }else {
                    jsonArray = JSONArray.fromObject(re);
                }
            }
        }
        catch (Exception ex) {
            ex.printStackTrace();
            return new JSONArray().toString();
        }
        if(StringUtils.isEmpty(re)){
            re = new JSONArray().toString();
        }
        return re;
        return jsonArray;
    }
    /**
@ -110,7 +116,14 @@ public class PrescriptionDiagnosisService extends BaseService{
                String key = "prescription:"+prescriptionCode+":diseaseTypes";
                List<PrescriptionDiagnosis> list = prescriptionDiagnosisDao.findByPrescriptionCode(prescriptionCode);
                if(list!=null&&list.size()>0){
                    String re = new JSONArray(list).toString();
                    JSONArray jsonArray = new JSONArray();
                    for (PrescriptionDiagnosis diagnosis:list){
                        JSONObject json = new JSONObject();
                        json.put("code",diagnosis.getCode());//疾病代码
                        json.put("name",diagnosis.getName());//疾病名称
                        jsonArray.add(json);
                    }
                    String re = jsonArray.toString();
                    redisTemplate.opsForValue().set(key,re,2, TimeUnit.HOURS);
                }
            }
@ -135,7 +148,7 @@ public class PrescriptionDiagnosisService extends BaseService{
                String key = "prescription:"+prescriptionCode+":drugInfo";
                List<PrescriptionInfo> list = prescriptionInfoDao.findByPrescriptionCode(prescriptionCode);
                if(list!=null&&list.size()>0){
                    String re = new JSONArray(list).toString();
                    String re = JSONArray.fromObject(list).toString();
                    redisTemplate.opsForValue().set(key,re,2, TimeUnit.HOURS);
                }
            }

+ 11 - 8
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionDispensaryCodeService.java

@ -55,7 +55,7 @@ public class PrescriptionDispensaryCodeService extends BaseService {
    String fastdfs_file_url;
    //获取居民端取药码列表
    public  JSONArray findByStatusAndTime(Integer timeType, String patientCode, Integer status, Integer page, Integer pagesize) {
    public  JSONArray findByStatusAndTime(Integer timeType, String patientCode, Integer status, Integer page, Integer pagesize,Integer type) {
        // 分页信息
        long timeLimit = 0;
        if(timeType!=null){
@ -67,8 +67,9 @@ public class PrescriptionDispensaryCodeService extends BaseService {
            }
        }
        List<Object> params = new ArrayList<>();
        String precriptionSql = "select * from wlyy_prescription_dispensary_code p2 left join  wlyy_prescription p1 on p2.prescription_code=p1.code LEFT JOIN wlyy_prescription_expressage p3 on p1.code=p3.prescription_code where 1=1 ";
        String precriptionSql = "select p2.*,p1.diagnosis as diagnosis ,p3.address as address from wlyy_prescription_dispensary_code p2 left join  wlyy_prescription p1 on p2.prescription_code=p1.code LEFT JOIN wlyy_prescription_expressage p3 on p1.code=p3.prescription_code where p1.patient=? and p2.type=?  and p2.is_Use=0 ";
        params.add(patientCode);
        params.add(type);
        if(status!=null){
            precriptionSql += " and p1.status = ? ";
            params.add(status);
@ -76,14 +77,14 @@ public class PrescriptionDispensaryCodeService extends BaseService {
            precriptionSql += " and p1.status in (20,21,100)" ;
        }
        if(timeType!=null){
            precriptionSql +=  "and TIMESTAMPDIFF(SECOND, a.create_Time, CURRENT_TIME) > ? ORDER BY p1.status desc ,p2.create_Time desc ";
            precriptionSql +=  "and TIMESTAMPDIFF(SECOND, p2.create_Time, CURRENT_TIME) < ? ORDER BY p1.status desc ,p2.create_Time desc ";
            params.add(timeLimit);
        }
        precriptionSql += " limit "+(page-1)*pagesize+","+pagesize;
        List<Map<String, Object>> result = jdbcTemplate.queryForList(precriptionSql,params.toArray());
        List<Map<String, Object>> result2 = new ArrayList<>();
        for (Map<String, Object> m:result) {
            List<PrescriptionInfo> list = prescriptionInfoDao.findByPrescriptionCode(m.get("code").toString());
            List<PrescriptionInfo> list = prescriptionInfoDao.findByPrescriptionCode(m.get("prescription_code").toString());
            m.put("data",list);
            result2.add(m);
        }
@ -92,9 +93,9 @@ public class PrescriptionDispensaryCodeService extends BaseService {
    }
    //判断居民是否有(21等待领药、20配送中、100已完成)取药码
    public int dispensaryCodeCount(String patientCode){
        String sql = "select  count(1) from wlyy_prescription where status in(21,20,100) and patient =?";// where p2.status in(21,20,100)  and p2.patient =?1
        int count = jdbcTemplate.queryForObject(sql,Integer.class,patientCode);
    public int dispensaryCodeCount(String patientCode,Integer type){
        String sql = "select  count(1) from wlyy_prescription_dispensary_code p1 left join wlyy_prescription p2 on p1.prescription_code=p2.code where p1.is_use=0 and p1.type=? and p2.patient =? ";// where p2.status in(21,20,100)  and p2.patient =?1
        int count = jdbcTemplate.queryForObject(sql,Integer.class,type,patientCode);
        return  count;
    }
@ -108,6 +109,7 @@ public class PrescriptionDispensaryCodeService extends BaseService {
    }
    //生成居民端取药码
    @Transactional
    public PrescriptionDispensaryCode savePatientQRCode(String token,String prescriptionCode){
        //获取年月日8位数
        Calendar cal  = Calendar.getInstance();
@ -144,6 +146,7 @@ public class PrescriptionDispensaryCodeService extends BaseService {
    }
    //生成配送员(健管师)取药码
    @Transactional
    public PrescriptionDispensaryCode saveDoctorQRCode(String code,String token,String prescriptionCode){
        String jgsCode= "";
        synchronized (obj2){

+ 24 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionExpressageService.java

@ -58,25 +58,45 @@ public class PrescriptionExpressageService {
            prescriptionLog.setFlag(1);
            prescriptionLog.setUserCode(userCode);
            prescriptionLog.setUserType(2);
            prescriptionLog.setType(42);
            prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing_error);
            prescriptionLog.setRemark("配送失败,处方编码不存在");
            prescriptionLogDao.save(prescriptionLog);
            return -1;
        }
        //判断是否是取药码
        if (prescriptionDispensaryCode.getType() != 2) {
            //保存取药失败的日志
            PrescriptionLog prescriptionLog = new PrescriptionLog();
            prescriptionLog.setCode(UUID.randomUUID().toString());
            prescriptionLog.setPrescriptionCode(prescriptionDispensaryCode.getPrescriptionCode());
            prescriptionLog.setCreateTime(new Date());
            prescriptionLog.setType(PrescriptionLog.PrescriptionLogType.expressage);
            prescriptionLog.setFlag(1);
            prescriptionLog.setUserCode(userCode);
            prescriptionLog.setUserType(2);
            prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing_error);
            prescriptionLog.setRemark("配送失败,处方编码不是取药码");
            prescriptionLogDao.save(prescriptionLog);
            return -1;
        }
        //修改处方状态为完成
        prescriptionDao.updateStatus(prescriptionDispensaryCode.getPrescriptionCode(),100);
        prescriptionDao.updateStatus(prescriptionDispensaryCode.getPrescriptionCode(), 100);
        //保存配送成功的日志
        PrescriptionLog prescriptionLog = new PrescriptionLog();
        prescriptionLog.setPrescriptionCode(prescriptionDispensaryCode.getPrescriptionCode());
        prescriptionLog.setCode(UUID.randomUUID().toString());
        prescriptionLog.setType(PrescriptionLog.PrescriptionLogType.expressage);
        prescriptionLog.setType(PrescriptionLog.PrescriptionLogType.finish);
        prescriptionLog.setCreateTime(new Date());
        prescriptionLog.setFlag(1);
        prescriptionLog.setUserCode(userCode);
        prescriptionLog.setUserType(2);
        prescriptionLog.setType(100);
        prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.finish);
        prescriptionLogDao.save(prescriptionLog);
        //修改取药码code为已经使用
        prescriptionDispensaryCode.setIsUse(1);
        return 1;
    }
}

+ 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");

Dosya farkı çok büyük olduğundan ihmal edildi
+ 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";

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

@ -189,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 = "";
@ -231,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();
@ -289,12 +289,14 @@ public class OnePayService {
                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("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
@ -308,6 +310,7 @@ public class OnePayService {
                familyContent.put("moCollectOrgNo", sbCode); //扣费机构 签约机构
                familyContent.put("moCollectorNo", signFamily.getSignDoctorName());//扣费人 签约医生姓名
                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())); //登记时间 签约时间
@ -368,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);

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

@ -4,7 +4,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.entity.wechat.WechatTemplate;
import com.yihu.wlyy.entity.wechat.WechatTemplateData;
import com.yihu.wlyy.util.HttpUtil;
import io.swagger.annotations.Api;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
@ -12,12 +11,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Scope;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.PostConstruct;
import java.util.HashMap;
@ -302,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 + "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);

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

@ -105,6 +105,32 @@ public class ImUtill {
        return response;
    }
    /**
     * 咨询列表
     * @param user
     * @param status status = 10 已结束的咨询,status=0,reply = 1 已回复 ,status=0,reply=0未回复
     * @param reply
     * @param type 1、三师咨询,2、家庭医生咨询,6、患者名医咨询 7医生名医咨询 8续方咨询 10医生发起的求助
     * @param page
     * @param pagesize
     * @return
     */
    public String getConsultByStatusAndType(String user,Integer status,Integer reply,Integer type,int page,int pagesize){
        String imAddr = im_host + "api/v2/sessions/topicListByType";
        imAddr = imAddr + "?user="+user + "&page=" + page + "&pagesize=" + pagesize;
        if (status != null) {
            imAddr += ("&status=" + status);
        }
        if (reply != null) {
            imAddr += ("&reply=" + reply);
        }
        if (type != null) {
            imAddr += ("&type=" + type);
        }
        String response = HttpClientUtil.get(imAddr, "UTF-8");
        return response;
    }
    /**
     * 发送消息给IM
     *

+ 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();
        }
    }
}

+ 8 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/im/imController.java

@ -7,8 +7,8 @@ import com.yihu.wlyy.repository.consult.ConsultDao;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.util.ImUtill;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.models.auth.In;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
@ -17,9 +17,6 @@ import org.springframework.http.MediaType;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.*;
import com.yihu.wlyy.util.HttpUtil;
import com.yihu.wlyy.web.BaseController;
import java.text.SimpleDateFormat;
import java.util.*;
@ -135,13 +132,19 @@ public class imController extends BaseController {
            @RequestParam(required = false) String doctor,
            @RequestParam Integer status,
            @RequestParam(required = false) Integer reply,
            @RequestParam(required = false) Integer type,
            @RequestParam int page,
            @RequestParam int pagesize) {
        try {
            if (StringUtils.isEmpty(doctor)) {
                doctor = getUID();
            }
            String consult = ImUtill.getConsultByStatus(doctor, status, reply, page, pagesize);
            String consult = null;
            if(type==null){
                consult = ImUtill.getConsultByStatus(doctor, status, reply, page, pagesize);
            }else {
                consult = ImUtill.getConsultByStatusAndType(doctor, status, reply,type, page, pagesize);
            }
            JSONArray jsonArray = new JSONArray(consult);
            Iterator<Object> it = jsonArray.iterator();
            List list = new ArrayList();

+ 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,"获取转诊预约医生列表列表失败");

+ 61 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/consult/DoctorConsultController.java

@ -1,17 +1,24 @@
package com.yihu.wlyy.web.doctor.consult;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.consult.Consult;
import com.yihu.wlyy.entity.consult.ConsultTeam;
import com.yihu.wlyy.entity.consult.ConsultTeamLog;
import com.yihu.wlyy.entity.discussion.WlyyTalkGroup;
import com.yihu.wlyy.entity.discussion.WlyyTalkGroupMember;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamilyServer;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.repository.consult.ConsultDao;
import com.yihu.wlyy.repository.patient.SignFamilyServerDao;
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
import com.yihu.wlyy.service.app.account.DoctorInfoService;
import com.yihu.wlyy.service.app.account.PatientInfoService;
import com.yihu.wlyy.service.app.consult.ConsultService;
import com.yihu.wlyy.service.app.consult.ConsultTeamService;
import com.yihu.wlyy.service.app.health.PatientHealthGuidanceService;
import com.yihu.wlyy.service.app.prescription.PrescriptionDiagnosisService;
import com.yihu.wlyy.service.app.scheduling.DoctorWorkTimeService;
import com.yihu.wlyy.service.app.talk.TalkGroupService;
import com.yihu.wlyy.service.common.account.DoctorService;
@ -68,6 +75,14 @@ public class DoctorConsultController extends WeixinBaseController {
    private ImUtill ImUtill;
    @Autowired
    private PushMsgTask pushMsgTask;
    @Autowired
    private PrescriptionDao prescriptionDao;
    @Autowired
    private SignFamilyServerDao signFamilyServerDao;
    @Autowired
    private ConsultDao consultDao;
    @Autowired
    private PrescriptionDiagnosisService prescriptionDiagnosisService;
    /**
     * 三师咨询列表查询
@ -382,7 +397,9 @@ public class DoctorConsultController extends WeixinBaseController {
            int flag = consultTeamService.finish(consult, getUID(), 2);
            if (flag > 0) {
                return success("咨询已关闭");
            } else {
            }else if(flag==-2){
                return error(-1, "续方未审核,不能结束续方咨询!");
            }  else {
                return error(-1, "关闭失败!");
            }
        } catch (Exception e) {
@ -1013,7 +1030,9 @@ public class DoctorConsultController extends WeixinBaseController {
                return success("咨询已关闭");
            } else if(flag == -1) {
                return error(-1, "该咨询已经关闭,不需重复关闭!");
            } else {
            } else if(flag == -2) {
                return error(-1, "续方未审核,不能结束续方咨询!");
            }  else {
                return error(-1, "关闭失败!");
            }
        } catch (Exception e) {
@ -1045,4 +1064,44 @@ public class DoctorConsultController extends WeixinBaseController {
            return invalidUserException(e, -1, "查询失败!");
        }
    }
    /*********************************************续方咨询**************************************************************/
    @RequestMapping(value = "prescriptionDetail",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取续方信息")
    public String prescriptionDetail(@RequestParam(required = true) String consult){
        try {
            JSONObject json = new JSONObject();
            Consult consult1 = consultDao.findByCode(consult);
            String prescriptionCode = consult1.getRelationCode();
            Prescription prescription = prescriptionDao.findByCode(prescriptionCode);
            json.put("status",prescription.getStatus());//状态 (-1 审核不通过 , 0 审核中, 10 审核通过/待支付 ,21支付失败  20 配药中/支付成功, 21 等待领药 ,30 配送中 ,100配送成功/已完成)
            json.put("prescriptionDt",prescriptionDiagnosisService.getPrescriptionDiagnosis(prescriptionCode));//续方疾病类型
            json.put("prescriptionInfo",prescriptionDiagnosisService.getPrescriptionInfo(prescriptionCode));//续方药品信息
            //服务类型
            List<SignFamilyServer> list = signFamilyServerDao.findBySignCodeAndType(consult1.getSignCode());
            JSONArray jsonArray = new JSONArray();
            if(list!=null&&list.size()>0){
                for(SignFamilyServer server:list){
                    JSONObject jsonObject = new JSONObject();
                    jsonObject.put("serverType",server.getServerType());
                    jsonObject.put("serverTypeName",server.getServerTypeName());
                    jsonArray.put(jsonObject);
                }
            }
            json.put("signFamilyServer",jsonArray);
            return write(200, "查询成功!", "list", json);
        }catch (Exception e){
            error(e);
            return error(-1, "查询失败!");
        }
    }
}

+ 1 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/message/DoctorMessageController.java

@ -210,6 +210,7 @@ public class DoctorMessageController extends BaseController {
            return write(200, "获取超标指标消息成功", "data", list);
        } catch (Exception ex) {
            ex.printStackTrace();
            return invalidUserException(ex, -1, "查询失败");
        }
    }

+ 105 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionCodeController.java

@ -0,0 +1,105 @@
package com.yihu.wlyy.web.doctor.prescription;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.service.app.prescription.PrescriptionDispensaryCodeService;
import com.yihu.wlyy.service.app.prescription.PrescriptionExpressageService;
import com.yihu.wlyy.service.app.prescription.PrescriptionInfoService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
 * Created by Trick on 2017/7/25.
 */
@RestController
@RequestMapping(value = "/doctor/prescriptionCode")
@Api(description = "医生端-长处方接口")
public class PrescriptionCodeController extends BaseController{
    @Autowired
    private PrescriptionDispensaryCodeService prescriptionDispensaryCodeService;
    @Autowired
    private PrescriptionExpressageService prescriptionExpressageService;
    /**
     * 显示健管师(配送员)所有的取药码列表
     * @param status 处方状态
     * @param timeType 搜索时间类型
     * @param page 当前页
     * @param pagesize  每页总数
     *  type 1、居民端扫码列表 2、配送员(健管师)扫码列表
     * @return
     */
    @RequestMapping(value = "/list",method = RequestMethod.GET)
    @ResponseBody
    @ObserverRequired
    public String list(
            @RequestParam(value = "status",required = false) Integer status,
            @RequestParam(value = "timeType",required = false) Integer timeType,
            @RequestParam(value = "page",required = true) Integer page,
            @RequestParam(value = "pagesize",required = true) Integer pagesize) {
        //getUID()
        try{
            JSONArray result = prescriptionDispensaryCodeService.findByStatusAndTime(timeType,getUID(),status,page,pagesize,2);
            return result.toString();
        }catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
    /**
     * 判断医生端是否有待取的药的接口
     * @return
     */
    @RequestMapping(value = "/whetherHaveCode", method = RequestMethod.GET)
    @ResponseBody
    @ObserverRequired
    public String whetherHaveCode() {
        try{
            JSONObject json = new JSONObject();
//        String patientCode = getUID();
            int count = prescriptionDispensaryCodeService.dispensaryCodeCount(getUID(),2);
            if (count > 0) {
                json.put("data", true);
                return json.toString();
            }
            json.put("data", false);
            return json.toString();
        }catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
    /**
     * 确认配送 二维码方式
     * 根据处方code获取处方流程
     *
     * @param code wlyy_prescription_dispensary_code的code
     * @return
     */
    @RequestMapping(value = "/expressage", method = RequestMethod.POST)
    @ApiOperation(value = "确认配送")
    public String expressage(
            @RequestParam(required = true) @ApiParam(value = "wlyy_prescription_dispensary_code的code", name = "code") String code) {
        try {
            Integer status = prescriptionExpressageService.expressage(code, getUID());
            if (status == -1) {
                return error(-1, "编码不存在");
            }
            return write(200, "配送成功");
        } catch (Exception e) {
            return error(-1, "失败");
        }
    }
}

+ 175 - 123
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/consult/ConsultController.java

@ -1,14 +1,20 @@
package com.yihu.wlyy.web.patient.consult;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.consult.Consult;
import com.yihu.wlyy.entity.consult.ConsultTeam;
import com.yihu.wlyy.entity.consult.ConsultTeamLog;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.logs.BusinessLogs;
import com.yihu.wlyy.repository.consult.ConsultDao;
import com.yihu.wlyy.repository.consult.ConsultTeamDao;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
import com.yihu.wlyy.service.app.consult.ConsultTeamService;
import com.yihu.wlyy.service.app.consult.DoctorCommentService;
import com.yihu.wlyy.service.app.prescription.PrescriptionDiagnosisService;
@ -77,6 +83,12 @@ public class ConsultController extends WeixinBaseController {
    private HttpUtil httpUtil;
    @Autowired
    private PushMsgTask pushMsgTask;
    @Autowired
    private ConsultTeamDao consultTeamDao;
    @Autowired
    private PrescriptionDao prescriptionDao;
    @Autowired
    private ConsultDao consultDao;
    /**
     * 患者咨询记录查询
@ -134,52 +146,7 @@ public class ConsultController extends WeixinBaseController {
            return error(-1, "查询失败!");
        }
    }
    @RequestMapping(value = "getPreConsultList",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取续方咨询列表")
    public String getPreConsultList(@RequestParam(required = false) String title,
                                    @RequestParam(required = true) long id,@RequestParam(required = true) int pagesize){
        try {
            JSONArray array = new JSONArray();
//            Page<Object> data = consultTeamService.findConsultRecordByType("a663d0cf7f8c4d38a8327cedc921e65f", id, pagesize,8, title);//8表示续方咨询
            Page<Object> data = consultTeamService.findConsultRecordByType(getRepUID(), id, pagesize,8, title);//8表示续方咨询
            if (data != null) {
                for (Object consult : data.getContent()) {
                    if (consult == null) {
                        continue;
                    }
                    Object[] result = (Object[]) consult;
                    JSONObject json = new JSONObject();
                    json.put("id", result[0]);
                    // 设置咨询类型:1三师咨询,2视频咨询,3图文咨询,4公共咨询,5病友圈,8 续方咨询
                    json.put("type", result[1]);
                    // 设置咨询标识
                    json.put("code", result[2]);
                    // 设置显示标题
                    json.put("title", result[3]);
                    // 设置主诉
                    json.put("symptoms", result[4]);
                    // 咨询状态
                    json.put("status", result[6]);
                    // 设置咨询日期
                    json.put("czrq", DateUtil.dateToStrLong((Date) result[5]));
                    // 咨询状态
                    json.put("doctorCode", result[7]);
                    json.put("evaluate", result[8]);
                    String relationCode = result[9]==null?"":result[9].toString();
                    json.put("prescriptionCode",relationCode);//续方code
                    json.put("prescriptionDt",prescriptionDiagnosisService.getPrescriptionDiagnosis(relationCode));//续方疾病类型
                    json.put("prescriptionInfo",prescriptionDiagnosisService.getPrescriptionInfo(relationCode));//续方药品信息
                    array.put(json);
                }
            }
            return write(200, "查询成功!", "list", array);
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
    /**
     * 获取医生的排班时间
     *
@ -195,7 +162,7 @@ public class ConsultController extends WeixinBaseController {
            return write(200, "查询成功!", "data", result);
        } catch (Exception e) {
            e.printStackTrace();
            error(e);
            return error(-1, "查询失败!");
        }
    }
@ -214,7 +181,7 @@ public class ConsultController extends WeixinBaseController {
            return write(200, "查询成功!", "data", result);
        } catch (Exception e) {
            e.printStackTrace();
            error(e);
            return error(-1, "查询失败!");
        }
    }
@ -232,7 +199,7 @@ public class ConsultController extends WeixinBaseController {
            JSONObject result = doctorWorkTimeService.isDoctorWorking(doctor);
            return write(200, result.getString("msg"), "data", result.getString("status"));
        } catch (Exception e) {
            e.printStackTrace();
            error(e);
            return error(-1, "查询失败");
        }
    }
@ -250,7 +217,7 @@ public class ConsultController extends WeixinBaseController {
            JSONObject result = doctorWorkTimeService.isFamousDoctorWorking(doctor);
            return write(200, result.getString("msg"), "data", result.getString("status"));
        } catch (Exception e) {
            e.printStackTrace();
            error(e);
            return error(-1, "查询失败");
        }
    }
@ -268,7 +235,7 @@ public class ConsultController extends WeixinBaseController {
            int result = doctorWorkTimeService.getDoctorConsultTimesRemain(doctor);
            return write(200, "查询成功", "data", result);
        } catch (Exception e) {
            e.printStackTrace();
            error(e);
            return error(-1, "查询失败");
        }
    }
@ -287,7 +254,7 @@ public class ConsultController extends WeixinBaseController {
            JSONArray result = new JSONArray(unfinishedConsult);
            return write(200, "查询成功!", "data", result);
        } catch (Exception e) {
            e.printStackTrace();
            error(e);
            return error(-1, "查询失败!");
        }
    }
@ -311,78 +278,11 @@ public class ConsultController extends WeixinBaseController {
                return write(200, "查询成功", "data", "");
            }
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "查询失败");
        }
    }
    @RequestMapping(value = "isPrescriptionConsult",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("是否可以续方咨询")
    public String isPrescriptConsult(String patient){
        try{
            SignFamily signFamily = signFamilyDao.findByPatient(patient);
            if(signFamily==null){
                return error(-1,"您还未签约,不能发起续方咨询!");
            }
            //点击后判断,如果用户当前存在可申请续方的处方记录,则进入续方申请流程,若不存在可续方记录,alert“当前没有可以申请续方的处方记录”
            Doctor doctor = doctorDao.findByAdminTeamId(signFamily.getAdminTeamId());
            JSONObject json = new JSONObject();
            json.put("doctor",doctor.getCode());
            json.put("doctorName",doctor.getName());
            json.put("adminTeamId",signFamily.getAdminTeamId());
            json.put("hospital",doctor.getHospital());
            json.put("hospitalName",doctor.getHospitalName());
            return write(200, "查询成功!", "data", json);
        }catch (Exception e){
            error(e);
            return error(-1,"查询失败");
            return error(-1, "查询失败");
        }
    }
    @RequestMapping(value = "addPrescriptionConsult",method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("添加续方咨询")
    public String addPrescriptionConsult(@ApiParam(name = "jwCode", value = "基位处方code", defaultValue = "10")
                                         @RequestParam(value = "jwCode", required = true) String jwCode,
                                         @ApiParam(name = "doctor", value = "咨询医生(开方医生、审核医生)", defaultValue = "86225d1365e711e69f7c005056850d66")
                                         @RequestParam(value = "doctor", required = true) String doctor,
                                         @ApiParam(name = "adminTeamId", value = "签约行政团队id", defaultValue = "224")
                                         @RequestParam(value = "adminTeamId", required = true) Long adminTeamId,
                                         @ApiParam(name = "reason", value = "续方说明", defaultValue = "续方申请")
                                         @RequestParam(value = "reason", required = false) String reason){
        try{
            ConsultTeam consult = new ConsultTeam();
            consult.setType(8);//续方咨询
            consult.setAdminTeamId(adminTeamId);
            // 保存到数据库
//            int res = consultTeamService.addPrescriptionConsult(jwCode, "a663d0cf7f8c4d38a8327cedc921e65f","a663d0cf7f8c4d38a8327cedc921e65f",doctor,consult,reason);
            int res = consultTeamService.addPrescriptionConsult(jwCode, getRepUID(),getUID(),doctor,consult,reason);
            if (res == -1) {
                return error(-1, "该处方存在未审核的续方,无法进行续方咨询!");
            }
//            Doctor doctor = doctorService.findDoctorByCode(consult.getDoctor());
//            // 添加到统计队列
//            if (consult.getType() == 2) {
//                DoctorStatisticsTask.getInstance(doctorStatisticsService).put(consult.getDoctor(), 1, 1, 0);
//            }
            // 推送消息给医生
           pushMsgTask.put(doctor, MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.D_CT_01.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_FAMOUS_CONSULT_TEAM_PRESCRIPTION.续方咨询.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_FAMOUS_CONSULT_TEAM_PRESCRIPTION.您有新的续方咨询.name(), consult.getConsult());
            BusinessLogs.info(BusinessLogs.BusinessType.consult, getRepUID(), getUID(), new JSONObject(consult));
            return write(200, "提交成功", "data", consult);
        }catch (Exception e){
            error(e);
            return error(-1,"添加失败");
        }
    }
    /**
     * 三师咨询添加接口
@ -470,7 +370,7 @@ public class ConsultController extends WeixinBaseController {
            }
            // 推送消息给医生
           pushMsgTask.put(consult.getDoctor(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.D_CT_01.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.指定咨询.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.您有新的指定咨询.name(), consult.getConsult());
            pushMsgTask.put(consult.getDoctor(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.D_CT_01.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.指定咨询.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.您有新的指定咨询.name(), consult.getConsult());
            BusinessLogs.info(BusinessLogs.BusinessType.consult, getRepUID(), getUID(), new JSONObject(consult));
            return write(200, "提交成功", "data", consult);
        } catch (Exception ex) {
@ -564,7 +464,7 @@ public class ConsultController extends WeixinBaseController {
            //名医咨询次数减一
            doctorWorkTimeService.setDoctorCurrentConsultTimesRemain(doctorCode);
            // 推送消息给医生
           pushMsgTask.put(consult.getDoctor(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_FAMOUS_CONSULT_TEAM.D_CT_03.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_FAMOUS_CONSULT_TEAM.名医咨询.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_FAMOUS_CONSULT_TEAM.您有新的名医咨询.name(), consult.getConsult());
            pushMsgTask.put(consult.getDoctor(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_FAMOUS_CONSULT_TEAM.D_CT_03.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_FAMOUS_CONSULT_TEAM.名医咨询.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_FAMOUS_CONSULT_TEAM.您有新的名医咨询.name(), consult.getConsult());
            BusinessLogs.info(BusinessLogs.BusinessType.consult, getRepUID(), getUID(), new JSONObject(consult));
            return write(200, "提交成功", "data", resultConsult);
        } catch (Exception ex) {
@ -739,7 +639,9 @@ public class ConsultController extends WeixinBaseController {
            int row = consultTeamService.finishConsult(code, getRepUID(), 1);
            if (row > 0) {
                return success("操作成功!");
            } else {
            }else if(row == -2) {
                return error(-1, "续方未审核,不能结束续方咨询!");
            }  else {
                return error(-1, "操作失败!");
            }
        } catch (Exception e) {
@ -989,7 +891,12 @@ public class ConsultController extends WeixinBaseController {
            JSONArray array = doctorCommentService.consultComment(getRepUID(), consult, content, star, 2);
            // 添加到统计队列
            if (array != null) {
                DoctorStatisticsTask.getInstance(doctorStatisticsService).put(array);
                //新增判断 续方咨询暂不统计
                ConsultTeam consultTeam = consultTeamDao.findByConsult(consult);
                if(consultTeam.getType()!=8){
                    DoctorStatisticsTask.getInstance(doctorStatisticsService).put(array);
                }
//                DoctorStatisticsTask.getInstance(doctorStatisticsService).put(array);
            }
            // 添加评价记录
            ConsultTeamLog log = new ConsultTeamLog();
@ -1013,6 +920,7 @@ public class ConsultController extends WeixinBaseController {
        try{
            return success(ImUtill.getTopic(consult).get("data").toString());
        }catch (Exception e){
            error(e);
            return error(-1,e.getMessage());
        }
    }
@ -1023,7 +931,151 @@ public class ConsultController extends WeixinBaseController {
            ConsultTeam consultTeam = consultTeamService.findByConsultCode(consult);
            return write(200, "查询成功", "data", consultTeam);
        }catch (Exception e){
            error(e);
            return error(-1,e.getMessage());
        }
    }
    /*===========================================续方咨询==============================================================*/
    @RequestMapping(value = "isPrescriptionConsult",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("是否可以续方咨询")
    public String isPrescriptConsult(@ApiParam(name = "patient", value = "居民code") @RequestParam(value = "patient", required = true)String patient){
        try{
            SignFamily signFamily = signFamilyDao.findByPatient(patient);
            if(signFamily==null){
                return error(-1,"您还未签约,不能发起续方咨询!");
            }
            //点击后判断,如果用户当前存在可申请续方的处方记录,则进入续方申请流程,若不存在可续方记录,alert“当前没有可以申请续方的处方记录”
            Doctor doctor = doctorDao.findByAdminTeamId(signFamily.getAdminTeamId());
            JSONObject json = new JSONObject();
            json.put("doctor",doctor.getCode());
            json.put("doctorName",doctor.getName());
            json.put("adminTeamId",signFamily.getAdminTeamId());
            json.put("hospital",doctor.getHospital());
            json.put("hospitalName",doctor.getHospitalName());
            return write(200, "查询成功!", "data", json);
        }catch (Exception e){
            error(e);
            return error(-1,"查询失败");
        }
    }
    @RequestMapping(value = "addPrescriptionConsult",method = RequestMethod.POST)
    @ResponseBody
    @ObserverRequired
    @ApiOperation("添加续方咨询")
    public String addPrescriptionConsult(@ApiParam(name = "jwCode", value = "基位处方code", defaultValue = "10")
                                         @RequestParam(value = "jwCode", required = true) String jwCode,
                                         @ApiParam(name = "doctor", value = "咨询医生(开方医生、审核医生)", defaultValue = "86225d1365e711e69f7c005056850d66")
                                         @RequestParam(value = "doctor", required = true) String doctor,
                                         @ApiParam(name = "adminTeamId", value = "签约行政团队id", defaultValue = "224")
                                         @RequestParam(value = "adminTeamId", required = true) Long adminTeamId,
                                         @ApiParam(name = "reason", value = "续方说明", defaultValue = "续方申请")
                                         @RequestParam(value = "reason", required = false) String reason){
        try{
            ConsultTeam consult = new ConsultTeam();
            consult.setType(8);//续方咨询
            consult.setAdminTeamId(adminTeamId);
            // 保存到数据库
//            int res = consultTeamService.addPrescriptionConsult(jwCode, "a663d0cf7f8c4d38a8327cedc921e65f","a663d0cf7f8c4d38a8327cedc921e65f",doctor,consult,reason);
            int res = consultTeamService.addPrescriptionConsult(jwCode, getRepUID(),getUID(),doctor,consult,reason);
            if (res == -1) {
                return error(-1, "该处方存在未审核的续方,无法进行续方咨询!");
            }
//            Doctor doctor = doctorService.findDoctorByCode(consult.getDoctor());
//            // 添加到统计队列
//            if (consult.getType() == 2) {
//                DoctorStatisticsTask.getInstance(doctorStatisticsService).put(consult.getDoctor(), 1, 1, 0);
//            }
            // 推送消息给医生
            pushMsgTask.put(doctor, MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.D_CT_01.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_FAMOUS_CONSULT_TEAM_PRESCRIPTION.续方咨询.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_FAMOUS_CONSULT_TEAM_PRESCRIPTION.您有新的续方咨询.name(), consult.getConsult());
            BusinessLogs.info(BusinessLogs.BusinessType.consult, getRepUID(), getUID(), new JSONObject(consult));
            return write(200, "提交成功", "data", consult);
        }catch (Exception e){
            error(e);
            return error(-1,"添加失败");
        }
    }
    @RequestMapping(value = "getPreConsultList",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取续方咨询列表")
    public String getPreConsultList(@ApiParam(name = "title", value = "咨询标题") @RequestParam(required = false) String title,
                                    @ApiParam(name = "id", value = "第几页") @RequestParam(required = true) long id,
                                    @ApiParam(name = "pagesize", value = "页面大小") @RequestParam(required = true) int pagesize){
        try {
            JSONArray array = new JSONArray();
//            Page<Object> data = consultTeamService.findConsultRecordByType("a663d0cf7f8c4d38a8327cedc921e65f", id, pagesize,8, title);//8表示续方咨询
            Page<Object> data = consultTeamService.findConsultRecordByType(getRepUID(), id, pagesize,8, title);//8表示续方咨询
            if (data != null) {
                for (Object consult : data.getContent()) {
                    if (consult == null) {
                        continue;
                    }
                    Object[] result = (Object[]) consult;
                    JSONObject json = new JSONObject();
                    json.put("id", result[0]);
                    // 设置咨询类型:1三师咨询,2视频咨询,3图文咨询,4公共咨询,5病友圈,8 续方咨询
                    json.put("type", result[1]);
                    // 设置咨询标识
                    json.put("code", result[2]);
                    // 设置显示标题
                    json.put("title", result[3]);
                    // 设置主诉
                    json.put("symptoms", result[4]);
                    // 咨询状态
                    json.put("status", result[6]);
                    // 设置咨询日期
                    json.put("czrq", DateUtil.dateToStrLong((Date) result[5]));
                    // 咨询状态
                    json.put("doctorCode", result[7]);
                    json.put("evaluate", result[8]);
                    String relationCode = result[9]==null?"":result[9].toString();
                    json.put("prescriptionCode",relationCode);//续方code
                    json.put("prescriptionDt",prescriptionDiagnosisService.getPrescriptionDiagnosis(relationCode));//续方疾病类型
                    json.put("prescriptionInfo",prescriptionDiagnosisService.getPrescriptionInfo(relationCode));//续方药品信息
                    array.put(json);
                }
            }
            return write(200, "查询成功!", "list", array);
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
    @RequestMapping(value = "prescriptionDetail",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取续方信息")
    public String prescriptionDetail(@ApiParam(name = "consult", value = "咨询code") @RequestParam(required = true) String consult){
        try {
            JSONObject json = new JSONObject();
            Consult consult1 = consultDao.findByCode(consult);
            String prescriptionCode = consult1.getRelationCode();
            Prescription prescription = prescriptionDao.findByCode(prescriptionCode);
            json.put("status",prescription.getStatus());//状态 (-1 审核不通过 , 0 审核中, 10 审核通过/待支付 ,21支付失败  20 配药中/支付成功, 21 等待领药 ,30 配送中 ,100配送成功/已完成)
            json.put("prescriptionDt",prescriptionDiagnosisService.getPrescriptionDiagnosis(prescriptionCode));//续方疾病类型
            json.put("prescriptionInfo",prescriptionDiagnosisService.getPrescriptionInfo(prescriptionCode));//续方药品信息
            return write(200, "查询成功!", "list", json);
        }catch (Exception e){
            error(e);
            return error(-1, "查询失败!");
        }
    }
}

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

@ -99,21 +99,25 @@ public class PatientPrescriptionController extends WeixinBaseController {
     * @param timeType
     * @param page
     * @param pagesize
     * type 1、居民端扫码列表 2、配送员(健管师)扫码列表
     * @return
     */
    @RequestMapping(value = "/dispensaryCode/list",method = RequestMethod.GET)
    @ResponseBody
    //@ObserverRequired
    public String list(
            //@RequestParam(value = "patientCode",required = true) String patientCode,
            @RequestParam(value = "status",required = false) Integer status,
            @RequestParam(value = "timeType",required = false) Integer timeType,
            @RequestParam(value = "page",required = true) Integer page,
            @RequestParam(value = "pagesize",required = true) Integer pagesize) {
        //getUID()
        JSONArray result = prescriptionDispensaryCodeService.findByStatusAndTime(timeType,getUID(),status,page,pagesize);
        System.out.println(result.toString());
        return result.toString();
        //getUID()"a663d0cf7f8c4d38a8327cedc921e65f"
        try {
            JSONArray result = prescriptionDispensaryCodeService.findByStatusAndTime(timeType,getUID(),status,page,pagesize,1);
            return result.toString();
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
    /**
@ -124,15 +128,20 @@ public class PatientPrescriptionController extends WeixinBaseController {
    @ResponseBody
    //@ObserverRequired
    public String whetherHaveCode() {
        JSONObject json = new JSONObject();
        try {
            JSONObject json = new JSONObject();
//        String patientCode = getUID();
        int count = prescriptionDispensaryCodeService.dispensaryCodeCount(getUID());
        if (count > 0) {
            json.put("data", true);
            int count = prescriptionDispensaryCodeService.dispensaryCodeCount(getUID(),1);
            if (count > 0) {
                json.put("data", true);
                return json.toString();
            }
            json.put("data", false);
            return json.toString();
        }catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
        json.put("data", false);
        return json.toString();
    }
    /**

+ 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

@ -136,7 +136,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")
@ -160,7 +160,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 = "")
@ -183,7 +183,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")
@ -210,7 +210,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")
@ -230,7 +230,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")
@ -250,7 +250,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")
@ -259,8 +259,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());
        }
@ -270,7 +273,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 = "厦门大学附属第一医院")

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

@ -122,8 +122,8 @@ 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();

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

@ -243,10 +243,10 @@ public class WeiXinEventProcess {
        // 图文消息图片URL
        String prescription_pic = systemConf.getProperty("patient_prescription_pic");
        // URL设置服务器URL、AppId
        prescription = prescription.replace("{server}", systemConf.getProperty("wechat_base_url"))
                .replace("{appId}", systemConf.getProperty("appId"));
        prescription = prescription.replace("{server}",wechat_base_url)
                .replace("{appId}",appId);
        //图片地址
        prescription_pic = prescription_pic.replace("{server}", systemConf.getProperty("server_url"));
        prescription_pic = prescription_pic.replace("{server}",serverUrl);
        articlePrescription.put("Url", prescription);
        articlePrescription.put("Title", "处方记录");

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

@ -101,8 +101,6 @@ server:
im:
  im_list_get: http://172.19.103.88:3000/
  group_server: http://172.19.103.88:3000/api/v1/chats/gm
  msg_push_server: http://172.19.103.88:3000/api/v1/chats/sm
  data_base_name: im_new
wechat:
@ -166,17 +164,19 @@ 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
#      username: wlyy
#      password: jkzlehr@321465
      username: jkzl_root
      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:
@ -185,9 +185,7 @@ server:
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
@ -269,8 +267,6 @@ server:
im:
  im_list_get: http://172.19.103.88:3000/
  group_server: http://172.19.103.29:3000/api/v1/chats/gm
  msg_push_server: http://172.19.103.29:3000/api/v1/chats/sm
  data_base_name: ichat
wechat:
@ -356,8 +352,6 @@ server:
im:
  im_list_get: http://172.19.103.88:3000/
  group_server: http://172.19.103.88:3000/api/v1/chats/gm
  msg_push_server: http://172.19.103.88:3000/api/v1/chats/sm
  data_base_name: im_new
wechat:

+ 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