Przeglądaj źródła

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

trick9191 7 lat temu
rodzic
commit
781cf398de
23 zmienionych plików z 1070 dodań i 52 usunięć
  1. 48 0
      Jolokia-admin-server/pom.xml
  2. 18 0
      Jolokia-admin-server/src/main/java/com/yihu/wlyy/jolokia/JolokiaApplication.java
  3. 48 0
      Jolokia-admin-server/src/main/java/com/yihu/wlyy/jolokia/config/counter/RestCounter.java
  4. 22 0
      Jolokia-admin-server/src/main/resources/application.yml
  5. 5 0
      patient-co-statistics-es/pom.xml
  6. 14 0
      patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/config/WebSecurityConfig.java
  7. 6 4
      patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/service/JobService.java
  8. 16 4
      patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/util/QuartzHelper.java
  9. 8 0
      patient-co-statistics-es/src/main/resources/application.yml
  10. 4 0
      patient-co-statistics-es/src/main/resources/logback.xml
  11. 1 1
      patient-co-statistics-es/src/main/resources/quartz.properties
  12. 335 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/prescription/Prescription.java
  13. 61 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionDispensaryCode.java
  14. 59 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionInfo.java
  15. 110 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionLog.java
  16. 17 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionDispensaryCodeDao.java
  17. 72 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionDispensaryCodeService.java
  18. 85 42
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/survey/ManagerQuestionnaireService.java
  19. 0 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/survey/ManagerQuestionnaireController.java
  20. 118 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionController.java
  21. 19 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/wechat/process/WeiXinEventProcess.java
  22. 4 0
      patient-co-wlyy/src/main/resources/system.properties
  23. BIN
      patient-co-wlyy/src/main/webapp/images/prescriptionRecords.png

+ 48 - 0
Jolokia-admin-server/pom.xml

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <artifactId>jolokia-admin-server</artifactId>
    <groupId>com.yihu</groupId>
    <version>1.0.0</version>
    <modelVersion>4.0.0</modelVersion>
    <properties>
        <version.spring-framework>4.2.5.RELEASE</version.spring-framework>
        <version.spring-boot>1.3.5.RELEASE</version.spring-boot>
    </properties>
    <dependencies>
        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-server</artifactId>
            <version>1.3.5</version>
        </dependency>
        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-server-ui</artifactId>
            <version>1.3.5</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-actuator-docs</artifactId>
            <version>${version.spring-boot}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
            <version>${version.spring-boot}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${version.spring-framework}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-aop</artifactId>
            <version>${version.spring-boot}</version>
        </dependency>
    </dependencies>
</project>

+ 18 - 0
Jolokia-admin-server/src/main/java/com/yihu/wlyy/jolokia/JolokiaApplication.java

@ -0,0 +1,18 @@
package com.yihu.wlyy.jolokia;
import de.codecentric.boot.admin.config.EnableAdminServer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.Configuration;
/**
 * Created by chenweida on 2017/7/25.
 */
@Configuration
@EnableAutoConfiguration
@EnableAdminServer
public class JolokiaApplication {
    public static void main(String[] args) {
        SpringApplication.run(JolokiaApplication.class, args);
    }
}

+ 48 - 0
Jolokia-admin-server/src/main/java/com/yihu/wlyy/jolokia/config/counter/RestCounter.java

@ -0,0 +1,48 @@
package com.yihu.wlyy.jolokia.config.counter;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.metrics.CounterService;
import org.springframework.boot.actuate.metrics.GaugeService;
import org.springframework.stereotype.Component;
/**
 * Created by chenweida on 2017/7/25.
 * 访问的接口计数器
 */
@Aspect
@Component
public class RestCounter {
    @Autowired
    private CounterService counterService;
    @Autowired
    private GaugeService gaugeService;
    /**
     * 统计访问接口的次数
     * @param joinPoint
     */
    @Before("execution(* com.test.bookpub.controller.*.*(..))")
    public void countServiceInvoke(JoinPoint joinPoint) {
        counterService.increment(joinPoint.getSignature() + "");
    }
    /**
     * 计算访问接口的耗时数
     * @param pjp
     * @throws Throwable
     */
    @Around("execution(* com.test.bookpub.controller.*.*(..))")
    public void latencyService(ProceedingJoinPoint pjp) throws Throwable {
        long start = System.currentTimeMillis();
        pjp.proceed();
        long end = System.currentTimeMillis();
        gaugeService.submit(pjp.getSignature().toString(), end - start);
    }
}

+ 22 - 0
Jolokia-admin-server/src/main/resources/application.yml

@ -0,0 +1,22 @@
server:
  port: 8082
spring:
  boot:
    admin:
      url: http://localhost:${server.port}
  jackson:
    serialization:
      indent_output: true
  aop:
    auto: true
endpoints:
    enabled: true
    jmx:
        enabled: true
    jolokia:
        enabled: true
#management:
#    security:
#        enabled: false

+ 5 - 0
patient-co-statistics-es/pom.xml

@ -381,6 +381,11 @@
            <artifactId>spring-boot-starter-mail</artifactId>
            <version>${version.spring-boot}</version>
        </dependency>
        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-starter-client</artifactId>
            <version>1.3.5</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>

+ 14 - 0
patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/config/WebSecurityConfig.java

@ -22,8 +22,22 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
    protected void configure(HttpSecurity http) throws Exception {
        http.authorizeRequests()
                .antMatchers("/metrics/**").permitAll()
                .antMatchers("/health/**").permitAll()
                .antMatchers("/env/**").permitAll()
                .antMatchers("/dump/**").permitAll()
                .antMatchers("/trace/**").permitAll()
                .antMatchers("/mappings/**").permitAll()
                .antMatchers("/actuator/**").permitAll()
                .antMatchers("/beans/**").permitAll()
                .antMatchers("/configprops/**").permitAll()
                .antMatchers("/docs/**").permitAll()
                .antMatchers("/info/**").permitAll()
                .antMatchers("/configuration/**").permitAll()
                .antMatchers("/jolokia/**").permitAll()
                .anyRequest().authenticated()
                .and()
                .csrf().disable()
                .formLogin().defaultSuccessUrl("/swagger-ui.html").failureUrl("/login") //登录成功之后的跳转
                .permitAll()
                .and()

+ 6 - 4
patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/service/JobService.java

@ -27,6 +27,8 @@ import java.util.*;
 */
@Service
public class JobService {
    private Long sleepTime = 10000L;
    @Autowired
    private QuartzHelper quartzHelper;
@ -147,7 +149,7 @@ public class JobService {
                    params.put("endTime", getYesterday(0 - i));
                    if (!StringUtils.isEmpty(quartzJobConfig.getJobClass())) {
                        quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId() + UUID.randomUUID().toString().replace("-", ""), params);
                       Thread.sleep(6000L);
                        Thread.sleep(sleepTime);
                    }
                }
            }
@ -189,7 +191,7 @@ public class JobService {
                params.put("timeLevel", j + "");
                if (!StringUtils.isEmpty(quartzJobConfig.getJobClass())) {
                    quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId() + UUID.randomUUID().toString().replace("-", ""), params);
                    Thread.sleep(6000L);
                    Thread.sleep(sleepTime);
                }
            }
@ -235,7 +237,7 @@ public class JobService {
            params.put("timeLevel", j + "");
            if (!StringUtils.isEmpty(quartzJobConfig.getJobClass())) {
                quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId() + UUID.randomUUID().toString().replace("-", ""), params);
                Thread.sleep(6000L);
                Thread.sleep(sleepTime);
            }
        }
    }
@ -264,7 +266,7 @@ public class JobService {
                params.put("timeLevel", j + "");
                if (!StringUtils.isEmpty(quartzJobConfig.getJobClass())) {
                    quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId() + UUID.randomUUID().toString().replace("-", ""), params);
                    Thread.sleep(6000L);
                    Thread.sleep(sleepTime);
                }
            }
        }

+ 16 - 4
patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/util/QuartzHelper.java

@ -41,8 +41,15 @@ public class QuartzHelper {
            jobDataMap.putAll(params);
            CronTrigger trigger = TriggerBuilder
                    .newTrigger()
                    .withIdentity("trigger-name:" + jobKey,"trigger-group:" + jobKey)
                    .withSchedule(CronScheduleBuilder.cronSchedule(cronString))
                    .withIdentity("trigger-name:" + jobKey, "trigger-group:" + jobKey)
                    .withSchedule(
                            CronScheduleBuilder
                                    .cronSchedule(cronString)
                                    //——以错过的第一个频率时间立刻开始执行
                                    //——重做错过的所有频率周期后
                                    //——当下一次触发频率发生时间大于当前时间后,再按照正常的Cron频率依次执行
                                    .withMisfireHandlingInstructionIgnoreMisfires()
                    )
                    .build();
            scheduler.scheduleJob(job, trigger);
            scheduler.start();
@ -94,11 +101,16 @@ public class QuartzHelper {
                withIdentity("job-id:" + id, "job-group:" + id)
                .build();
        JobDataMap jobDataMap = job.getJobDataMap();
        if(null != params) jobDataMap.putAll(params);
        if (null != params) jobDataMap.putAll(params);
        SimpleTrigger trigger = TriggerBuilder.newTrigger().withIdentity("trigger-id:" + id, "trigger-group:" + id)
                .startAt(time)
                .withSchedule(simpleSchedule().withIntervalInSeconds(10).withRepeatCount(0).withMisfireHandlingInstructionFireNow())
                .withSchedule(
                        simpleSchedule()
                                .withIntervalInSeconds(10)
                                .withRepeatCount(0)
                                .withMisfireHandlingInstructionIgnoreMisfires()
                )
                .build();
        scheduler.scheduleJob(job, trigger);
        scheduler.start();

+ 8 - 0
patient-co-statistics-es/src/main/resources/application.yml

@ -2,6 +2,14 @@ server:
  port: 8081
spring:
  application:
    name: quota-es
  boot:
    admin:
      url: http://localhost:8082
      username: jkzl
      password: jkzlehr
  datasource:
    primaryReadWrite:
      driver-class-name: com.mysql.jdbc.Driver

+ 4 - 0
patient-co-statistics-es/src/main/resources/logback.xml

@ -0,0 +1,4 @@
<configuration>
    <include resource="org/springframework/boot/logging/logback/base.xml"/>
    <jmxConfigurator/>
</configuration>

+ 1 - 1
patient-co-statistics-es/src/main/resources/quartz.properties

@ -13,7 +13,7 @@ org.quartz.threadPool.threadCount: 20
org.quartz.threadPool.threadPriority: 5
org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread: true
 
org.quartz.jobStore.misfireThreshold: 60000
org.quartz.jobStore.misfireThreshold: 18000000
 
#============================================================================
# Configure JobStore

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

@ -0,0 +1,335 @@
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")
public class Prescription extends IdEntity{
    private String code;                    //业务主键
    private String parentCode;             //如果是续方 那就是处方的code
    private Date createTime;               //处方创建时间
    private Date reviewedTime;             //过期时间
    private Date payTime;                   //支付时间
    private Date dosageTime;                //配药完成时间
    private Date dispatchingTime;          //配送员领药时间
    private Date finishTime;                //配送员确认送达或居民确认取药的时间
    private String patient;                  //关联 wlyy_patient code
    private String patientName;             //患者名称
    private Integer type;                    //1 处方 2 续方
    private Integer status;                  //状态 (1 审核不通过 , 0 审核中, 10 待支付 , 20 配药中, 21 等待领药 ,30 配送中 ,100已完成)
    private String doctor;                   //开处方的医生code 关联 wlyy_doctor
    private String doctorName;               //医生名称
    private Integer adminTeamId;             //患者签约的行政团队
    private String hospital;                  //医院 关联 dm_hospital code
    private String hospitalName;              //医院 关联 dm_hospital name
    private String dept;                       //科室code
    private String deptName;                   //科室名称
    private String diagnosisCode;             //诊断的病种code
    private String diagnosis;                  //诊断名称
    private Double ybCost;                     //医保费用
    private Double myCost;                     //自己付费
    private String consult;                    //咨询id 1对1
    private String remark;                     //处方备注
    private String dispensary_code;           //取药编码  关联wlyy_prescription_dispensary_code  code
    private String dispensaryAddress;         //取药地址
    private Integer dispensaryType;            //取药类型:1 自取 2快递配送 3健管师配送
    private String expressNum;                  //快递单号
    private String expressCompanyName;         //快递公司名称
    private String caMessage;                   //ca指纹信息
    @Column(name = "code", unique = true , nullable=false)
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    @Column(name = "parent_code")
    public String getParentCode() {
        return parentCode;
    }
    public void setParentCode(String parentCode) {
        this.parentCode = parentCode;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "reviewed_time")
    public Date getReviewedTime() {
        return reviewedTime;
    }
    public void setReviewedTime(Date reviewedTime) {
        this.reviewedTime = reviewedTime;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "pay_time")
    public Date getPayTime() {
        return payTime;
    }
    public void setPayTime(Date payTime) {
        this.payTime = payTime;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "dosage_time")
    public Date getDosageTime() {
        return dosageTime;
    }
    public void setDosageTime(Date dosageTime) {
        this.dosageTime = dosageTime;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "dispatching_time")
    public Date getDispatchingTime() {
        return dispatchingTime;
    }
    public void setDispatchingTime(Date dispatchingTime) {
        this.dispatchingTime = dispatchingTime;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "finish_time")
    public Date getFinishTime() {
        return finishTime;
    }
    public void setFinishTime(Date finishTime) {
        this.finishTime = finishTime;
    }
    @Column(name = "patient")
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    @Column(name = "patient_name")
    public String getPatientName() {
        return patientName;
    }
    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }
    @Column(name = "type")
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
    @Column(name = "status")
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    @Column(name = "doctor")
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    @Column(name = "doctor_name")
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    @Column(name = "admin_team_id")
    public Integer getAdminTeamId() {
        return adminTeamId;
    }
    public void setAdminTeamId(Integer adminTeamId) {
        this.adminTeamId = adminTeamId;
    }
    @Column(name = "hospital")
    public String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
    @Column(name = "hospital_name")
    public String getHospitalName() {
        return hospitalName;
    }
    public void setHospitalName(String hospitalName) {
        this.hospitalName = hospitalName;
    }
    @Column(name = "dept")
    public String getDept() {
        return dept;
    }
    public void setDept(String dept) {
        this.dept = dept;
    }
    @Column(name = "dept_name")
    public String getDeptName() {
        return deptName;
    }
    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }
    @Column(name = "diagnosis_code")
    public String getDiagnosisCode() {
        return diagnosisCode;
    }
    public void setDiagnosisCode(String diagnosisCode) {
        this.diagnosisCode = diagnosisCode;
    }
    @Column(name = "diagnosis")
    public String getDiagnosis() {
        return diagnosis;
    }
    public void setDiagnosis(String diagnosis) {
        this.diagnosis = diagnosis;
    }
    @Column(name = "yb_cost")
    public Double getYbCost() {
        return ybCost;
    }
    public void setYbCost(Double ybCost) {
        this.ybCost = ybCost;
    }
    @Column(name = "my_cost")
    public Double getMyCost() {
        return myCost;
    }
    public void setMyCost(Double myCost) {
        this.myCost = myCost;
    }
    @Column(name = "consult")
    public String getConsult() {
        return consult;
    }
    public void setConsult(String consult) {
        this.consult = consult;
    }
    @Column(name = "remark")
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    @Column(name = "dispensary_code")
    public String getDispensary_code() {
        return dispensary_code;
    }
    public void setDispensary_code(String dispensary_code) {
        this.dispensary_code = dispensary_code;
    }
    @Column(name = "dispensary_address")
    public String getDispensaryAddress() {
        return dispensaryAddress;
    }
    public void setDispensaryAddress(String dispensaryAddress) {
        this.dispensaryAddress = dispensaryAddress;
    }
    @Column(name = "dispensary_type")
    public Integer getDispensaryType() {
        return dispensaryType;
    }
    public void setDispensaryType(Integer dispensaryType) {
        this.dispensaryType = dispensaryType;
    }
    @Column(name = "express_num")
    public String getExpressNum() {
        return expressNum;
    }
    public void setExpressNum(String expressNum) {
        this.expressNum = expressNum;
    }
    @Column(name = "express_company_name")
    public String getExpressCompanyName() {
        return expressCompanyName;
    }
    public void setExpressCompanyName(String expressCompanyName) {
        this.expressCompanyName = expressCompanyName;
    }
    @Column(name = "ca_message")
    public String getCaMessage() {
        return caMessage;
    }
    public void setCaMessage(String caMessage) {
        this.caMessage = caMessage;
    }
}

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

@ -0,0 +1,61 @@
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_dispensary_code")
public class PrescriptionDispensaryCode extends IdEntity{
    private String code;                    //年月日8位数字+6位随机数字
    private String prescriptionCode;      //处方code  关联表wlyy_prescription code
    private Date createTime;               //创建时间
    private Date outTime;                  //过期时间
    @Column(name = "code", unique = true , nullable=false)
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    @Column(name = "prescription_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")
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "out_time")
    public Date getOutTime() {
        return outTime;
    }
    public void setOutTime(Date outTime) {
        this.outTime = outTime;
    }
}

+ 59 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionInfo.java

@ -0,0 +1,59 @@
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_info")
public class PrescriptionInfo extends IdEntity{
    private String code;                    //业务主键
    private String prescriptionCode;      //处方code 关联表wlyy_prescription code
    private String drugCode;               //药品code
    private String drugName;               //药品名称
    @Column(name = "code",unique = true , nullable=false)
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    @Column(name = "prescription_code")
    public String getPrescriptionCode() {
        return prescriptionCode;
    }
    public void setPrescriptionCode(String prescriptionCode) {
        this.prescriptionCode = prescriptionCode;
    }
    @Column(name = "drug_code")
    public String getDrugCode() {
        return drugCode;
    }
    public void setDrugCode(String drugCode) {
        this.drugCode = drugCode;
    }
    @Column(name = "drug_name")
    public String getDrugName() {
        return drugName;
    }
    public void setDrugName(String drugName) {
        this.drugName = drugName;
    }
}

+ 110 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionLog.java

@ -0,0 +1,110 @@
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_log")
public class PrescriptionLog extends IdEntity{
    private String code;                    //业务流程
    private String prescriptionCode;      //处方code 关联表wlyy_prescription code
    private Date createTime;               //处方创建时间
    private Integer type;                    //-1与智业对接的日志   11 创建处方  12 审核成功 13 审核失败 20等待付款 21 付款成功 22付款失败  30等待配药 31配药成功 40开始配送 41配送员已领药 42配送员送达  100处方完成
    private String userCode;                  //医生或者患者code
    private String userName;                  //医生或者患者name
    private Integer userType;                 //1 患者 2医生
    private Integer flag;                      //操作是否成功 1成功 0失败
    private String remark;                     //备注信息
    @Column(name = "code")
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    @Column(name = "prescription_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")
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @Column(name = "type")
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
    @Column(name = "user_code")
    public String getUserCode() {
        return userCode;
    }
    public void setUserCode(String userCode) {
        this.userCode = userCode;
    }
    @Column(name = "user_name")
    public String getUserName() {
        return userName;
    }
    public void setUserName(String userName) {
        this.userName = userName;
    }
    @Column(name = "user_type")
    public Integer getUserType() {
        return userType;
    }
    public void setUserType(Integer userType) {
        this.userType = userType;
    }
    @Column(name = "flag")
    public Integer getFlag() {
        return flag;
    }
    public void setFlag(Integer flag) {
        this.flag = flag;
    }
    @Column(name = "remark")
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
}

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

@ -0,0 +1,17 @@
package com.yihu.wlyy.repository.prescription;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionDispensaryCode;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Administrator on 2017/7/21.
 * 处方取码
 */
public interface PrescriptionDispensaryCodeDao extends PagingAndSortingRepository<PrescriptionDispensaryCode, Long>, JpaSpecificationExecutor<PrescriptionDispensaryCode> {
//    @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);
}

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

@ -0,0 +1,72 @@
package com.yihu.wlyy.service.app.prescription;
import com.yihu.wlyy.repository.prescription.PrescriptionDispensaryCodeDao;
import com.yihu.wlyy.service.BaseService;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
 * Created by Administrator on 2017/7/21.
 *长处方取码
 */
@Service
//@Transactional(rollbackFor = Exception.class)
public class PrescriptionDispensaryCodeService extends BaseService {
//    @Autowired
//    private PrescriptionDispensaryCodeDao prescriptionDispensaryCodeDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    public  JSONArray findByStatusAndTime(Integer timeType, String patientCode, Integer status, Integer page, Integer pagesize) {
        // 排序
        //Sort sort = new Sort(Sort.Direction.DESC, "status","createTime");
        // 分页信息
        long timeLimit = 0;
        if(timeType!=null){
            switch (timeType){
                case 1:timeLimit = 7*24*60*60;break;//近一周
                case 2:timeLimit = 7*24*60*60*31;break;//近一月
                case 3:timeLimit = 7*24*60*60*31*6;break;//近半年
                case 4:timeLimit = 7*24*60*60*31*12;break;//近一年
            }
        }
        //PageRequest pageRequest = new PageRequest(page, pagesize, sort);
        List<Object> params = new ArrayList<>();
        String sql = "select * from  wlyy_prescription_dispensary_code a LEFT JOIN wlyy_prescription b on a.prescription_Code=b.code where 1=1 " ;
        if(status!=null){
            sql += " and b.status = ? ";
            params.add(status);
        }else {
            sql += " and b.status in (20,21,100)" ;
        }
        if(timeType!=null){
            sql +=  "and TIMESTAMPDIFF(SECOND, a.create_Time, CURRENT_TIME) > ? ORDER BY b.status desc ,a.create_Time desc ";
            params.add(timeLimit);
        }
        sql += " limit "+(page-1)*pagesize+","+pagesize;
        List<Map<String, Object>> result = jdbcTemplate.queryForList(sql,params.toArray());
        JSONArray array = new JSONArray(result);
        return array;
        //return prescriptionDispensaryCodeDao.findByStatusAndTime(timeLimit,patientCode,status,pageRequest);
    }
    public int dispensaryCodeCount(String patientCode){
        String sql = "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 =?";// where p2.status in(21,20,100)  and p2.patient =?1
        int count = jdbcTemplate.queryForObject(sql,Integer.class,patientCode);
        return  count;
    }
}

+ 85 - 42
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/survey/ManagerQuestionnaireService.java

@ -23,6 +23,7 @@ import org.springframework.data.domain.Sort;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import springfox.documentation.spring.web.json.Json;
import java.text.SimpleDateFormat;
import java.util.*;
@ -101,28 +102,44 @@ public class ManagerQuestionnaireService extends BaseService {
//      获取调查对象
        JSONObject surveyTarget = jsonStr.getJSONObject("surveyTarget");
        //            0不限 1男 2女
        int sex = Integer.parseInt(surveyTarget.get("sex").toString());
//        int sex = Integer.parseInt(surveyTarget.get("sex").toString());
        JSONArray sex = surveyTarget.getJSONArray("sex");
        JSONArray disease = surveyTarget.getJSONArray("disease");
        JSONArray service = surveyTarget.getJSONArray("service");
        JSONArray healthCondition = surveyTarget.getJSONArray("healthCondition");
        if (sex != 0) {
            String dimensionCode = surveyDimensionDao.findByName("性别");
            String dimensionDetailCode = getCode();
            SurveyDimensionDetail surveyDimensionDetail = new SurveyDimensionDetail(dimensionDetailCode, dimensionCode, sex == 1 ? "男" : "女", sex, "性别", 1, surveyCode);
            surveyDimensionDetailDao.save(surveyDimensionDetail);
        int sexList = 0;
        for (Object se : sex) {
            JSONObject sexJson = new JSONObject(se.toString());
            int label = sexJson.getInt("label");
            sexList = label;
            if (label != 0) {
                String dimensionCode = surveyDimensionDao.findByName("性别");
                String dimensionDetailCode = getCode();
//            SurveyDimensionDetail surveyDimensionDetail = new SurveyDimensionDetail(dimensionDetailCode, dimensionCode, sex == 1 ? "男" : "女", sex, "性别", 1, surveyCode);
//            modify by wjj 2017.7.24 居民标签更改
                SurveyDimensionDetail surveyDimensionDetail = new SurveyDimensionDetail(dimensionDetailCode, dimensionCode, sexJson.getString("labelName"), label, "性别", 1, surveyCode);
                surveyDimensionDetailDao.save(surveyDimensionDetail);
//          保存到筛选表
            SurveyFilter surveyFilter = new SurveyFilter(getCode(), surveyCode, dimensionDetailCode);
            surveyFilterDao.save(surveyFilter);
                SurveyFilter surveyFilter = new SurveyFilter(getCode(), surveyCode, dimensionDetailCode);
                surveyFilterDao.save(surveyFilter);
            }
        }
        List servList = new ArrayList();
        for (Object serv : service) {
            if ("0".equals(serv.toString())) {
            JSONObject servJson = new JSONObject(serv.toString());
            int label = servJson.getInt("label");
            servList.add(label);
            if (label == 0) {
                break;
            } else {
//                       ===================================
                String dimensionCode = surveyDimensionDao.findByName("服务类型");
                String dimensionDetailCode = getCode();
                SurveyDimensionDetail surveyDimensionDetail = null;
                switch (Integer.parseInt(serv.toString())) {
                surveyDimensionDetail = new SurveyDimensionDetail(dimensionDetailCode, dimensionCode, servJson.getString("labelName"), label, "服务类型", 3, surveyCode);
               /* switch (Integer.parseInt(serv.toString())) {
//                1.普通人群 2.慢病人群 3.65岁以上人群
                    case 1:
                        surveyDimensionDetail = new SurveyDimensionDetail(dimensionDetailCode, dimensionCode, "普通人群", 1, "服务类型", 3, surveyCode);
@ -134,22 +151,29 @@ public class ManagerQuestionnaireService extends BaseService {
                        surveyDimensionDetail = new SurveyDimensionDetail(dimensionDetailCode, dimensionCode, "65岁以上人群", 3, "服务类型", 3, surveyCode);
                        break;
                }
*/
                surveyDimensionDetailDao.save(surveyDimensionDetail);
                SurveyFilter surveyFilter = new SurveyFilter(getCode(), surveyCode, dimensionDetailCode);
                surveyFilterDao.save(surveyFilter);
            }
        }
        List healthList = new ArrayList();
        for (Object health : healthCondition) {
            if ("0".equals(health.toString())) {
            JSONObject healthJson = new JSONObject(health.toString());
            int label = healthJson.getInt("label");
            healthList.add(label);
            if (label == 0) {
                break;
            } else {
                String dimensionCode = surveyDimensionDao.findByName("健康状况");
                String dimensionDetailCode = getCode();
                String surveyFilterCode = getCode();
                SurveyDimensionDetail surveyDimensionDetail = null;
                switch (Integer.parseInt(health.toString())) {
                surveyDimensionDetail = new SurveyDimensionDetail(dimensionDetailCode, dimensionCode, healthJson.getString("labelName"), label, "健康状况", 4, surveyCode);
                /*switch (Integer.parseInt(health.toString())) {
//                1.健康人群 2.患病人群 3.高危人群 4.恢复期人群
                    case 1:
                        surveyDimensionDetail = new SurveyDimensionDetail(dimensionDetailCode, dimensionCode, "健康人群", 1, "健康状况", 4, surveyCode);
@ -163,7 +187,7 @@ public class ManagerQuestionnaireService extends BaseService {
                    case 4:
                        surveyDimensionDetail = new SurveyDimensionDetail(dimensionDetailCode, dimensionCode, "恢复期人群", 4, "健康状况", 4, surveyCode);
                        break;
                }
                }*/
                surveyDimensionDetailDao.save(surveyDimensionDetail);
                SurveyFilter surveyFilter = new SurveyFilter(surveyFilterCode, surveyCode, dimensionDetailCode);
@ -171,15 +195,22 @@ public class ManagerQuestionnaireService extends BaseService {
            }
        }
        List diseaList = new ArrayList();
        for (Object disea : disease) {
            if ("0".equals(disea.toString())) {
            JSONObject diseaJson = new JSONObject(disea.toString());
            int label = diseaJson.getInt("label");
            diseaList.add(label);
            if (label == 0) {
//                dise += ",";
                break;
            } else {
                String dimensionCode = surveyDimensionDao.findByName("疾病类型");
                String dimensionDetailCode = getCode();
                SurveyDimensionDetail surveyDimensionDetail = null;
                switch (Integer.parseInt(disea.toString())) {
                surveyDimensionDetail = new SurveyDimensionDetail(dimensionDetailCode, dimensionCode, diseaJson.getString("labelName"), label, "疾病类型", 2, surveyCode);
                /*switch (Integer.parseInt(disea.toString())) {
//                  1.高血压 2糖尿病 3.高血压+糖尿病
                    case 1:
                        surveyDimensionDetail = new SurveyDimensionDetail(dimensionDetailCode, dimensionCode, "高血压", 1, "疾病类型", 2, surveyCode);
@ -187,14 +218,20 @@ public class ManagerQuestionnaireService extends BaseService {
                    case 2:
                        surveyDimensionDetail = new SurveyDimensionDetail(dimensionDetailCode, dimensionCode, "糖尿病", 2, "疾病类型", 2, surveyCode);
                        break;
                }
                }*/
                surveyDimensionDetailDao.save(surveyDimensionDetail);
                SurveyFilter surveyFilter = new SurveyFilter(getCode(), surveyCode, dimensionDetailCode);
                surveyFilterDao.save(surveyFilter);
            }
        }
        List<String> codes = getCount(surveyTarget.toString());
//        List<String> codes = getCount(surveyTarget.toString());
        JSONObject countJson = new JSONObject();
        countJson.put("sex", sexList);
        countJson.put("disease", diseaList);
        countJson.put("healthCondition", healthList);
        countJson.put("service", servList);
        List<String> codes = getCount(countJson.toString());
        int amount = codes.size();
        for (String code : codes) {
//            String code = patient.get("patient").toString();
@ -1441,20 +1478,20 @@ public class ManagerQuestionnaireService extends BaseService {
//        居民标签类型 2健康人群 3疾病类型
        int lableType = 0;
        Map<String, Object> map = new HashMap<>();
        String sql = " SELECT DISTINCT t.label_name ,t.label " +
                " from wlyy_sign_patient_label_info t " +
                " where t.label_type = ?";
        String sql = " SELECT DISTINCT t.label_name ,t.label_code " +
                " from wlyy_sign_patient_label t " +
                " where t.status = 1 and t.label_type = ? ORDER BY t.label_code ";
        List<Map<String, Object>> health = jdbcTemplate.queryForList(sql, 2);
        List<Map<String, Object>> disea = jdbcTemplate.queryForList(sql, 3);
        String querySql = " SELECT DISTINCT t.code,t.name from wlyy_sign_dict t " +
                " where t.type=1 and `year`='2017' ";
                " where `year`='2017' ORDER BY t.code  ";
        List<Map<String, Object>> servi = jdbcTemplate.queryForList(querySql);
        List healthCodition = new ArrayList();
        for (Map<String, Object> li : health) {
            Map<String, Object> map1 = new HashMap<>();
            String labelName = li.get("label_name").toString();
            int label = Integer.parseInt(li.get("label").toString());
            int label = Integer.parseInt(li.get("label_code").toString());
            map1.put("label", label);
            map1.put("labelName", labelName);
            healthCodition.add(map1);
@ -1463,7 +1500,7 @@ public class ManagerQuestionnaireService extends BaseService {
        for (Map<String, Object> li : disea) {
            Map<String, Object> map1 = new HashMap<>();
            String labelName = li.get("label_name").toString();
            int label = Integer.parseInt(li.get("label").toString());
            int label = Integer.parseInt(li.get("label_code").toString());
            map1.put("label", label);
            map1.put("labelName", labelName);
            disease.add(map1);
@ -1598,6 +1635,8 @@ public class ManagerQuestionnaireService extends BaseService {
    public List<String> getCount(String json) {
//        1.服务 2.健康 3疾病
        JSONObject jsonObject = new JSONObject(json);
        String sql = "";
        String sex = jsonObject.get("sex").toString();
        String str = "SELECT DISTINCT lb.patient FROM wlyy_sign_patient_label_info lb,(SELECT DISTINCT ff.patient FROM wlyy_sign_family_server s, " +
                " (SELECT f.`code`,f.patient FROM wlyy_sign_family f,wlyy_patient p WHERE p.CODE=f.patient ";
@ -1622,11 +1661,13 @@ public class ManagerQuestionnaireService extends BaseService {
            }
            ser += " OR ";
        }
        if (!StringUtils.isEmpty(ser)) {
        if (StringUtils.isNotEmpty(ser)) {
            str += " AND ( " + ser.substring(0, ser.lastIndexOf("OR")) + " ) ";
        }
        str += " )tt WHERE lb.patient=tt.patient ";
        JSONArray healthCondition = jsonObject.getJSONArray("healthCondition");
        String healSql = "";
        String heal = "";
        health:
        for (Object health : healthCondition) {
@ -1640,10 +1681,12 @@ public class ManagerQuestionnaireService extends BaseService {
            }
            heal += " OR ";
        }
        if (!StringUtils.isEmpty(heal)) {
            str += " AND ( (lb.label_type =2 AND ( " + heal.substring(0, heal.lastIndexOf("OR")) + " ) " + " ) ";
        if (StringUtils.isNotEmpty(heal)) {
            healSql = " (lb.label_type =2 AND ( " + heal.substring(0, heal.lastIndexOf("OR")) + " )  )";
        }
        JSONArray disease = jsonObject.getJSONArray("disease");
        String disSql = "";
        String dis = "";
        disea:
        for (Object disea : disease) {
@ -1652,27 +1695,27 @@ public class ManagerQuestionnaireService extends BaseService {
                case "0":
                    break disea;
                default:
                    dis += " lb.label= "+type;
                    dis += " lb.label= " + type;
                    break;
            }
            dis += " OR ";
        }
        if (StringUtils.isEmpty(heal)){
            if (!StringUtils.isEmpty(dis)) {
                str += " AND ( lb.label_type =3 AND ( " + dis.substring(0, dis.lastIndexOf("OR")) + " ) " + " )";
            }else {
                str += " )";
            }
        }else {
            if (!StringUtils.isEmpty(dis)) {
                str += " OR ( lb.label_type =3 AND ( " + dis.substring(0, dis.lastIndexOf("OR")) + " ) " + " ) )";
            }else {
                str += " )";
            }
        if (StringUtils.isNotEmpty(dis)) {
            disSql= " (lb.label_type =3 AND ( " + dis.substring(0, dis.lastIndexOf("OR")) + " )  )";
        }
        if (StringUtils.isEmpty(heal) && StringUtils.isEmpty(dis)) {
            sql = str;
        } else if (StringUtils.isEmpty(heal) && StringUtils.isNotEmpty(dis)) {
            sql = str + " AND " +disSql;
        } else if (StringUtils.isNotEmpty(heal) && StringUtils.isEmpty(dis)) {
            sql = str + " AND " +healSql;
        } else if (StringUtils.isNotEmpty(heal) && StringUtils.isNotEmpty(dis)) {
            sql = str + " AND ( " + disSql +" OR " +healSql +" ) ";
        }
        System.out.println("=====query sql =======>>>>" + str);
        List<String> patients = jdbcTemplate.queryForList(str, String.class);
        System.out.println("=====query sql =======>>>>" + sql);
        List<String> patients = jdbcTemplate.queryForList(sql, String.class);
        return patients;
    }

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

@ -541,7 +541,6 @@ public class ManagerQuestionnaireController extends WeixinBaseController {
            @ApiParam(value = "筛选条件")
            @RequestParam String json) {
        try {
            json = "{\"sex\":1,\"disease\":[1],\"healthCondition\":[1,2,3],\"service\":[1,2]}";
            int amount = managerQuestionnaireService.getAmount(json);
            return write(200, "查询成功!", "amount", amount);
        } catch (Exception e) {

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

@ -0,0 +1,118 @@
package com.yihu.wlyy.web.patient.prescription;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.service.app.medicines.MedicalRecordsService;
import com.yihu.wlyy.service.app.prescription.PrescriptionDispensaryCodeService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.Calendar;
import java.util.List;
import java.util.Map;
/**
 * Created by Administrator on 2017/7/21.
 *
 */
@Controller
@RequestMapping(value = "/patient/prescription", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "患者端-长处方接口")
public class PatientPrescriptionController extends BaseController {
    @Autowired
    private PrescriptionDispensaryCodeService prescriptionDispensaryCodeService;
    /**
     *居民取药码
     * @return
     */
    @RequestMapping(value = "/dispensaryCode/getResidentQRCode",method = RequestMethod.GET)
    @ResponseBody
    //@ObserverRequired
    public String getResidentQRCode(){
        Calendar cal = Calendar.getInstance();
        String year = String.valueOf(cal.get(Calendar.YEAR));
        int temp = cal.get(Calendar.MONTH)+1;
        String month = cal.get(Calendar.MONTH)+1<10?"0"+temp:""+temp;
        String day = ""+cal.get(Calendar.DAY_OF_MONTH);
        String ymd = year+month+day;
        int temp2 = (int)((Math.random()*9+1)*100000);
        String code = ymd +temp2;
        return ymd;
    }
    /**
     *配送员取药码
     * @return
     */
    @RequestMapping(value = "/dispensaryCode/getDiliveryQRCode",method = RequestMethod.GET)
    @ResponseBody
    //@ObserverRequired
    public String getDiliveryQRCode(){
        Calendar cal = Calendar.getInstance();
        String year = String.valueOf(cal.get(Calendar.YEAR));
        int temp = cal.get(Calendar.MONTH)+1;
        String month = cal.get(Calendar.MONTH)+1<10?"0"+temp:""+temp;
        String day = ""+cal.get(Calendar.DAY_OF_MONTH);
        String ymd = year+month+day;
        int temp2 = (int)((Math.random()*9+1)*100000);
        String code = ymd +temp2;
        return ymd;
    }
    /**
     * 显示居民所有的取药码列表
     * @param status
     * @param timeType
     * @param page
     * @param pagesize
     * @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) {
        //getRepUID()
        JSONArray result = prescriptionDispensaryCodeService.findByStatusAndTime(timeType,"915cc456-5b1d-11e6-8344-fa163e8aee56",status,page,pagesize);
        System.out.println(result.toString());
        return result.toString();
    }
    /**
     * 判断该居民是否有待取的药的接口
     * @return
     */
    @RequestMapping(value = "/dispensaryCode/whetherHaveCode",method = RequestMethod.GET)
    @ResponseBody
    //@ObserverRequired
    public String whetherHaveCode(){
        JSONObject json = new JSONObject();
        String patientCode=getRepUID();
        int count = prescriptionDispensaryCodeService.dispensaryCodeCount(patientCode);
        if(count>0){
            json.put("data",true);
            return json.toString();
        }
        json.put("data",false);
        return json.toString();
    }
}

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

@ -228,6 +228,25 @@ public class WeiXinEventProcess {
        articleExamination.put("Description", "社区体检");
        articleExamination.put("PicUrl", examination_pic);
        articles.add(articleExamination);
//        新增处方记录图文消息
        Map<String, String> articlePrescription = new HashMap<>();
        // 图文URL
        String prescription = systemConf.getProperty("patient_prescription_url");
        // 图文消息图片URL
        String prescription_pic = systemConf.getProperty("patient_prescription_pic");
        // URL设置服务器URL、AppId
        examination = examination.replace("{server}", systemConf.getProperty("wechat_base_url"))
                .replace("{appId}", systemConf.getProperty("appId"));
        //图片地址
        prescription_pic = examination_pic.replace("{server}", systemConf.getProperty("server_url"));
        articleExamination.put("Url", prescription);
        articleExamination.put("Title", "处方记录");
        articleExamination.put("Description", "处方记录");
        articleExamination.put("PicUrl", prescription_pic);
        articles.add(articlePrescription);
        // 构建回复消息XML
        result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"), message.get("ToUserName"), articles);

+ 4 - 0
patient-co-wlyy/src/main/resources/system.properties

@ -24,6 +24,8 @@ patient_visit_url = https://open.weixin.qq.com/connect/oauth2/authorize?appid={a
patient_inspect_url =https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri={server}%2fwx%2fhtml%2fjkda%2fhtml%2fjianchajianyan.html&amp;response_type=code&amp;scope=snsapi_base&amp;state=STATE#wechat_redirect
#社区体检
patient_examination_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri={server}%2fwx%2fhtml%2fjkda%2fhtml%2fjiankangtijian.html&amp;response_type=code&amp;scope=snsapi_base&amp;state=STATE#wechat_redirect
#处方记录
patient_prescription_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri={server}%2fwx%2fhtml%2fjkda%2fhtml%2fjiankangtijian.html&amp;response_type=code&amp;scope=snsapi_base&amp;state=STATE#wechat_redirect
#就诊记录
patient_visit_pic ={server}/images/visit.png
@ -31,6 +33,8 @@ patient_visit_pic ={server}/images/visit.png
patient_inspect_pic ={server}/images/inspect.png
#社区体检
patient_examination_pic={server}/images/examination.png
#处方记录
patient_prescription_pic={server}/images/prescriptionRecords.png
patient_operatinginstrutions_pic_url={server}/images/operatinginstructions.png
patient_booking_pic_url={server}/images/booking.png

BIN
patient-co-wlyy/src/main/webapp/images/prescriptionRecords.png