Browse Source

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

Conflicts:
	patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java
zd_123 7 years ago
parent
commit
a51960058a
40 changed files with 711 additions and 168 deletions
  1. 17 0
      patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/dao/CountryDao.java
  2. 78 0
      patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/entity/Country.java
  3. 14 1
      patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/service/SignZYService.java
  4. 1 1
      patient-co/patient-co-statistics-es/doc/es/统计新增索引.txt
  5. 2 1
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/service/JobService.java
  6. 5 5
      patient-co/patient-co-statistics/pom.xml
  7. 40 40
      patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/config/WebSecurityConfig.java
  8. 1 1
      patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/dao/QuartzJobConfigDao.java
  9. 10 0
      patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/etl/mycache/CachePool.java
  10. 1 1
      patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/CurrentDayAllQuotaJob.java
  11. 12 5
      patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/service/JobService.java
  12. 11 11
      patient-co/patient-co-statistics/src/main/resources/application.yml
  13. 2 2
      patient-co/patient-co-statistics/src/main/resources/quartz.properties
  14. 2 1
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/redis/RedisThread.java
  15. 89 34
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/third/jw/JwPrescriptionService.java
  16. 1 1
      patient-co/patient-co-wlyy-job/src/main/resources/application-dev.yml
  17. 1 1
      patient-co/patient-co-wlyy-job/src/main/resources/application-devtest.yml
  18. 2 2
      patient-co/patient-co-wlyy-job/src/main/resources/system.properties
  19. 40 0
      patient-co/patient-co-wlyy/doc/技术文档/es/随访记录详情新增索引.txt
  20. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/EncodingFilter.java
  21. 4 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionAdressDao.java
  22. 3 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java
  23. 49 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/followup/FollowUpService.java
  24. 8 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PatientPrescriptionPayService.java
  25. 16 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionAdressService.java
  26. 1 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java
  27. 4 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java
  28. 30 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statistics/StatisticsService.java
  29. 79 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java
  30. 6 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/system/SystemDictService.java
  31. 84 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/wxpay/service/OnePayService.java
  32. 2 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/ElasticsearchUtil.java
  33. 21 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/followup/DoctorFollowUpController.java
  34. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionController.java
  35. 25 9
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionPayController.java
  36. 4 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/quota/vo/SaveModel.java
  37. 4 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/EsStatisticsController.java
  38. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/StatisticsController.java
  39. 35 7
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/wx/OnePayController.java
  40. 4 4
      patient-co/patient-co-wlyy/src/main/resources/application-prod.yml

+ 17 - 0
patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/dao/CountryDao.java

@ -0,0 +1,17 @@
package com.yihu.wlyy.sign.dao;
import com.yihu.wlyy.sign.entity.Country;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Trick on 2017/7/20.
 */
public interface CountryDao extends PagingAndSortingRepository<Country, Long> {
    @Query("from Country c where c.street=?1 AND (c.jwCode IS NOT NULL OR c.jwCode <> '')")
    List<Country> findByStreet(String street);
    Country findByCode(String code);
}

+ 78 - 0
patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/entity/Country.java

@ -0,0 +1,78 @@
package com.yihu.wlyy.sign.entity;
import com.yihu.wlyy.sign.common.model.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * 居委会
 * @author huangwenjie
 * @date 2017/10/26 12:55
 */
@Entity
@Table(name = "dm_country")
public class Country extends IdEntity {
	private String  province;
	private String  city;
	private String  town;
	private String  street ;
	private String  code;
	private String  name;
	private String  jwCode;
	
	public String getProvince() {
		return province;
	}
	
	public void setProvince(String province) {
		this.province = province;
	}
	
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public String getCity() {
		return city;
	}
	
	public void setCity(String city) {
		this.city = city;
	}
	
	public String getTown() {
		return town;
	}
	
	public void setTown(String town) {
		this.town = town;
	}
	
	public String getStreet() {
		return street;
	}
	
	public void setStreet(String street) {
		this.street = street;
	}
	
	public String getCode() {
		return code;
	}
	
	public void setCode(String code) {
		this.code = code;
	}
	
	public String getJwCode() {
		return jwCode;
	}
	
	public void setJwCode(String jwCode) {
		this.jwCode = jwCode;
	}
}

+ 14 - 1
patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/service/SignZYService.java

@ -5,6 +5,7 @@ import com.yihu.wlyy.sign.common.SystemConfig;
import com.yihu.wlyy.sign.common.util.*;
import com.yihu.wlyy.sign.dao.*;
import com.yihu.wlyy.sign.entity.*;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.data.domain.PageRequest;
@ -75,6 +76,9 @@ public class SignZYService {
    @Autowired
    private SignFamilyServerService signFamilyServerService;
    
    @Autowired
    private CountryDao countryDao;
    /**
     * 获取机构映射
@ -1406,7 +1410,16 @@ public class SignZYService {
                    params.put("SICK_PHONE", patient.getMobile() == null ? "" : patient.getMobile());   //联系电话
                    params.put("SICK_COUNTY", patient.getTown() == null ? "" : patient.getTown());    //行政区
                    params.put("SICK_COUNTRY", patient.getStreet() == null ? "" : patient.getStreet());    //街道
                    params.put("SICK_VILLAGE", patient.getSickVillage() == null ? "" : patient.getSickVillage());    //居委会
                    
                    if(StringUtils.isNoneBlank(patient.getSickVillage())){
                        //居委会需要转换成基卫的居委会CODE
                        Country country = countryDao.findByCode(patient.getSickVillage());
                        params.put("SICK_VILLAGE", country.getJwCode());    //居委会
                    }else{
                        params.put("SICK_VILLAGE", "");    //居委会
                    }
                    
                    
                    params.put("SICK_ADDRESS",  patient.getAddress() == null ? "" : patient.getAddress());    //地址
                } else {

+ 1 - 1
patient-co/patient-co-statistics-es/doc/es/统计新增索引.txt

@ -87,7 +87,7 @@ POST http://172.19.103.68:9200/wlyy_quota_test/wlyy_quota_test/_mapping
                    "type": "double"
                },
                "result2": {
                    "type": "integer"
                    "type": "double"
                },
                "quotaDate": {
                    "type": "date"

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

@ -106,9 +106,10 @@ public class JobService {
        BeanUtils.copyProperties(quartzJobConfig, wlyyJobConfigVO);
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("jobConfig", wlyyJobConfigVO);
        params.put("jobConfig", wlyyJobConfigVO.getId());
        if (!StringUtils.isEmpty(quartzJobConfig.getJobClass())) {
            for (int j = 1; j <= 2; j++) {
                params.put("timeLevel", j + "");
                //往quartz框架添加任务
                quartzHelper.addJob(getRightClass(quartzJobConfig), quartzJobConfig.getQuartzCron(), quartzJobConfig.getId() + "-" + j, params);
               wlyyJobConfigDao.updateStatus(quartzJobConfig.getId(),"1") ;//设置任务状态是启动 }

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

@ -351,11 +351,11 @@
            <artifactId>spring-boot-starter-jdbc</artifactId>
            <version>${version.spring-boot}</version>
        </dependency>
        <!--<dependency>-->
            <!--<groupId>org.springframework.boot</groupId>-->
            <!--<artifactId>spring-boot-starter-security</artifactId>-->
            <!--<version>${version.spring-boot}</version>-->
        <!--</dependency>-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
            <version>${version.spring-boot}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>

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

@ -1,40 +1,40 @@
//package com.yihu.wlyy.statistics.config;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
//import org.springframework.security.config.annotation.web.builders.HttpSecurity;
//import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
//import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
//
///**
// * Created by Administrator on 2016.10.17.
// */
//@Configuration
//@EnableWebSecurity
//public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
//
//    @Value("${security.basic.username}")
//    String username;
//    @Value("${security.basic.password}")
//    String password;
//
//    protected void configure(HttpSecurity http) throws Exception {
//        http.csrf().disable().authorizeRequests()
//                .anyRequest().authenticated()
//                .and()
//                .formLogin().defaultSuccessUrl("/swagger-ui.html").failureUrl("/login") //登录成功之后的跳转
//                .permitAll()
//                .and()
//                .logout().logoutSuccessUrl("/login")
//                .permitAll();
//    }
//
//    @Autowired
//    public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
//            auth.inMemoryAuthentication()
//                .withUser(username).password(password).roles("USER");
//    }
//
//}
package com.yihu.wlyy.statistics.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
/**
 * Created by Administrator on 2016.10.17.
 */
@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
    @Value("${security.basic.username}")
    String username;
    @Value("${security.basic.password}")
    String password;
    protected void configure(HttpSecurity http) throws Exception {
        http.csrf().disable().authorizeRequests()
                .anyRequest().authenticated()
                .and()
                .formLogin().defaultSuccessUrl("/swagger-ui.html").failureUrl("/login") //登录成功之后的跳转
                .permitAll()
                .and()
                .logout().logoutSuccessUrl("/login")
                .permitAll();
    }
    @Autowired
    public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
            auth.inMemoryAuthentication()
                .withUser(username).password(password).roles("USER");
    }
}

+ 1 - 1
patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/dao/QuartzJobConfigDao.java

@ -18,7 +18,7 @@ public interface QuartzJobConfigDao extends PagingAndSortingRepository<QuartzJob
    @Query(" FROM QuartzJobConfig a WHERE a.status=?1 and a.del='1'")
    List<QuartzJobConfig> findByAll(String s);
    @Query(" FROM QuartzJobConfig a WHERE  a.del='1' ")
    @Query(" FROM QuartzJobConfig a WHERE  a.del='1' and a.id != 11")
    List<QuartzJobConfig> findByIds();
    @Query(" FROM QuartzJobConfig a WHERE a.id=?1 and a.del='1'")

+ 10 - 0
patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/etl/mycache/CachePool.java

@ -262,6 +262,15 @@ public class CachePool {
        diseaseGroup.clear();
        healthGroup.clear();
        serverGroup.clear();
        arriveRenewSignOrgOutMap.clear();
        arriveRenewSignTeamOutMap.clear();
        arriveRenewSignTownOutMap.clear();
        arriveRenewTotalCityMap.clear();
        arriveRenewTotalOrgMap.clear();
        arriveRenewTotalTeamMap.clear();
        arriveRenewTotalTownMap.clear();
        renewDiseaseGroup.clear();;
    }
    public static Map<String, CacheModel> getArriveSignFamilyExpenseStatus1Map() {
@ -335,6 +344,7 @@ public class CachePool {
        if (model == null) {
            model = new RenewCacheModel();
            String sql=" select fr.sign_code code,fr.hospital ,fr.admin_team_id ,fr.patient " +
                    "   from wlyy_sign_family_renew_log fr " +
                    "   where " +

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

@ -337,7 +337,7 @@ public class CurrentDayAllQuotaJob implements Job {
        computequota_8(sql, signFamilies, null);//统计今天的签约患者年龄
        computequota_9();//统计今天的待签约
        computequota_10();//统计今天的改签
        computequota_12(sql, signFamilies, null);//统计今天的签约下按年龄分组后再
       // computequota_12(sql, signFamilies, null);//统计今天的签约下按年龄分组后再  无效
        computequota_13(sql, signFamilies, null);//统计今天的签约量
        computequota_16_1(sql, signFamilies, null);//统计今天的签约数的扣费钱
        computequota_15(sql, signFamilies, null);//统计今天的健康分布统计

+ 12 - 5
patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/service/JobService.java

@ -20,6 +20,8 @@ import com.yihu.wlyy.statistics.model.signfamily.SignFamily;
import com.yihu.wlyy.statistics.vo.WlyyJobConfigVO;
import com.yihu.wlyy.statistics.vo.WlyyQuotaVO;
import org.quartz.SchedulerException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@ -37,6 +39,8 @@ import java.util.*;
 */
@Service
public class JobService {
    private Logger logger= LoggerFactory.getLogger(JobService.class);
    @Autowired
    private QuartzHelper quartzHelper;
@ -54,6 +58,8 @@ public class JobService {
    @Autowired
    private CachePool cachePool;
    private Long sleepTime=60000L;
    @Transactional
    public void stopById(String id) throws Exception {
        QuartzJobConfig quartzJobConfig = wlyyJobConfigDao.findById(id, "1");
@ -164,7 +170,7 @@ public class JobService {
                params.put("yesterday", getYesterday(0 - i));
                if (!StringUtils.isEmpty(quartzJobConfig.getJobClass())) {
                    quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId() + UUID.randomUUID().toString().replace("-", ""), params);
                    Thread.sleep(60000L);
                    Thread.sleep(sleepTime);
                }
            }
        }
@ -206,7 +212,8 @@ public class JobService {
            params.put("yesterday", yesterday);
            if (!StringUtils.isEmpty(quartzJobConfig.getJobClass())) {
                quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId() + UUID.randomUUID().toString().replace("-", ""), params);
                Thread.sleep(60000L);
                logger.info(quartzJobConfig.getId());
                Thread.sleep(sleepTime);
            }
        }
@ -252,7 +259,7 @@ public class JobService {
        params.put("yesterday", yesterday);
        if (!StringUtils.isEmpty(quartzJobConfig.getJobClass())) {
            quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId() + UUID.randomUUID().toString().replace("-", ""), params);
            Thread.sleep(60000L);
            Thread.sleep(sleepTime);
        }
    }
@ -283,7 +290,7 @@ public class JobService {
            params.put("yesterday", getYesterday(0 - i));
            if (!StringUtils.isEmpty(quartzJobConfig.getJobClass())) {
                quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId() + UUID.randomUUID().toString().replace("-", ""), params);
                Thread.sleep(60000L);
                Thread.sleep(sleepTime);
            }
        }
    }
@ -418,7 +425,7 @@ public class JobService {
        params.put("now", yesterday);
        params.put("yesterday", day);
        quartzHelper.startNow(HealthMessageJob.class, HealthMessageJob.jobKey + UUID.randomUUID().toString().replace("-", ""), params);
        Thread.sleep(60000L);
        Thread.sleep(sleepTime);
    }
    public void productHealthDataByDayToDay(String start, String end) throws Exception {

+ 11 - 11
patient-co/patient-co-statistics/src/main/resources/application.yml

@ -167,17 +167,17 @@ spring:
  datasource:
    primaryReadWrite:
      url: jdbc:mysql://10.95.22.7:3306/wlyy?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: wlyy
      password: jkzlehr@123
    primaryRead:
      url: jdbc:mysql://10.95.22.7:3306/wlyy?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: wlyy
      password: jkzlehr@123
    im: #im库:
      url: jdbc:mysql://10.95.22.7:3306/im?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: im
      password: im!)123
       url: jdbc:mysql://59.61.92.90:8079/wlyy?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
       username: wlyy
       password: jkzlehr@123
     primaryRead:
       url: jdbc:mysql://59.61.92.90:8079/wlyy?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
       username: wlyy
       password: jkzlehr@123
     im: #im库:
       url: jdbc:mysql://59.61.92.90:8079/im?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
       username: im
       password: im!)123
  redis:
    host: 10.95.22.142 # Redis server host.

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

@ -9,11 +9,11 @@ org.quartz.scheduler.rmi.proxy: false
org.quartz.scheduler.wrapJobExecutionInUserTransaction: false
 
org.quartz.threadPool.class: org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount: 20
org.quartz.threadPool.threadCount: 50
org.quartz.threadPool.threadPriority: 5
org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread: true
 
org.quartz.jobStore.misfireThreshold: 60000
org.quartz.jobStore.misfireThreshold: 600000
 
#============================================================================
# Configure JobStore

+ 2 - 1
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/redis/RedisThread.java

@ -36,6 +36,7 @@ public class RedisThread implements Runnable {
    private PushMsgTask pushMsgTask;
    //redis链接池
    private JedisPool pool;
    private Jedis jedis;
    @Override
    public void run() {
@ -45,7 +46,6 @@ public class RedisThread implements Runnable {
        while (true){
            try {
                Jedis jedis = pool.getResource();
                String message = jedis.rpop(key);
                if(StringUtils.isEmpty(message)){
                    sleep(1000L);//如果没有读取到记录,等待1秒
@ -80,6 +80,7 @@ public class RedisThread implements Runnable {
        }else {
            pool = new JedisPool(poolConfig,host,port,100000);
        }
        jedis = pool.getResource();
    }
    public void redisMessage(String message){

+ 89 - 34
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/third/jw/JwPrescriptionService.java

@ -4,10 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.followup.Followup;
import com.yihu.wlyy.entity.followup.FollowupContent;
import com.yihu.wlyy.entity.followup.FollowupDrugs;
import com.yihu.wlyy.entity.followup.FollowupMapping;
import com.yihu.wlyy.entity.followup.*;
import com.yihu.wlyy.entity.oldpeople.OldPeoplePhysicalExaminationEntity;
import com.yihu.wlyy.entity.organization.HospitalMapping;
import com.yihu.wlyy.entity.patient.Patient;
@ -15,10 +12,7 @@ import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.doctor.DoctorMappingDao;
import com.yihu.wlyy.repository.followup.FollowUpDao;
import com.yihu.wlyy.repository.followup.FollowUpMappingDao;
import com.yihu.wlyy.repository.followup.FollowupContentDao;
import com.yihu.wlyy.repository.followup.FollowupDrugsDao;
import com.yihu.wlyy.repository.followup.*;
import com.yihu.wlyy.repository.oldpeople.OldPeoplePhysicalExaminationDao;
import com.yihu.wlyy.repository.organization.HospitalMappingDao;
import com.yihu.wlyy.repository.patient.PatientDao;
@ -644,7 +638,21 @@ public class JwPrescriptionService {
                    
                            //控制目标
                            followupContent7.put("CONTROL_DATE", json.getString("CONTROL_DATE"));//控制日期 V04
                            followupContent7.put("CONTROL_CONSTITUTOR", json.getString("CONTROL_CONSTITUTOR"));//制定者 V05
                            
                            String CONTROL_CONSTITUTOR = json.getString("CONTROL_CONSTITUTOR");
                            if(StringUtils.isNoneBlank(CONTROL_CONSTITUTOR) ){
                                if(jwdoctorCode.equals(CONTROL_CONSTITUTOR)){
                                    followupContent7.put("CONTROL_CONSTITUTOR", doctor.getName());//制定者姓名 V05
                                    followupContent7.put("CONTROL_CONSTITUTOR_DOCTORCODE", doctor.getCode());//制定者本地CODE V05
                                    followupContent7.put("CONTROL_CONSTITUTOR_JWDOCTORCODE", jwdoctorCode);//制定者本地CODE V05
                                }else{
                                    Doctor control_doctor = doctorDao.findMappingDoctor(CONTROL_CONSTITUTOR, jworgCode);
                                    followupContent7.put("CONTROL_CONSTITUTOR", control_doctor.getName());//制定者姓名 V05
                                    followupContent7.put("CONTROL_CONSTITUTOR_DOCTORCODE", control_doctor.getCode());//制定者本地CODE V05
                                    followupContent7.put("CONTROL_CONSTITUTOR_JWDOCTORCODE", CONTROL_CONSTITUTOR);//制定者本地CODE V05
                                }
                            }
                            
                            followupContent7.put("CONTROL_BP_U", json.getString("CONTROL_BP_U"));//血压收缩压 V06
                            followupContent7.put("CONTROL_BP_D", json.getString("CONTROL_BP_D"));//血压舒张压 V07
                            followupContent7.put("CONTROL_BS_FPG", json.getString("CONTROL_BS_FPG"));//空腹血糖 V08
@ -686,7 +694,7 @@ public class JwPrescriptionService {
                                followupContentDao.deleteByFollowupId(followup.getId());
                                //组装数据
                                List<FollowupContent> newList = new ArrayList<>();
                        
    
                                followupContent1.forEach((k, v) -> {
                                    FollowupContent item = new FollowupContent();
                                    item.setFollowupId(followupId);
@ -696,7 +704,7 @@ public class JwPrescriptionService {
                                    item.setCreateTime(new Date());
                                    newList.add(item);
                                });
                        
    
                                followupContent2.forEach((k, v) -> {
                                    FollowupContent item = new FollowupContent();
                                    item.setFollowupId(followupId);
@ -706,7 +714,7 @@ public class JwPrescriptionService {
                                    item.setCreateTime(new Date());
                                    newList.add(item);
                                });
                        
    
                                followupContent3.forEach((k, v) -> {
                                    FollowupContent item = new FollowupContent();
                                    item.setFollowupId(followupId);
@ -716,7 +724,7 @@ public class JwPrescriptionService {
                                    item.setCreateTime(new Date());
                                    newList.add(item);
                                });
                        
    
                                followupContent4.forEach((k, v) -> {
                                    FollowupContent item = new FollowupContent();
                                    item.setFollowupId(followupId);
@ -726,7 +734,7 @@ public class JwPrescriptionService {
                                    item.setCreateTime(new Date());
                                    newList.add(item);
                                });
                        
    
                                followupContent5.forEach((k, v) -> {
                                    FollowupContent item = new FollowupContent();
                                    item.setFollowupId(followupId);
@ -736,7 +744,7 @@ public class JwPrescriptionService {
                                    item.setCreateTime(new Date());
                                    newList.add(item);
                                });
                        
    
                                followupContent6.forEach((k, v) -> {
                                    FollowupContent item = new FollowupContent();
                                    item.setFollowupId(followupId);
@ -746,7 +754,7 @@ public class JwPrescriptionService {
                                    item.setCreateTime(new Date());
                                    newList.add(item);
                                });
                        
    
                                followupContent7.forEach((k, v) -> {
                                    FollowupContent item = new FollowupContent();
                                    item.setFollowupId(followupId);
@ -756,7 +764,7 @@ public class JwPrescriptionService {
                                    item.setCreateTime(new Date());
                                    newList.add(item);
                                });
                        
    
                                followupContent8.forEach((k, v) -> {
                                    FollowupContent item = new FollowupContent();
                                    item.setFollowupId(followupId);
@ -766,7 +774,7 @@ public class JwPrescriptionService {
                                    item.setCreateTime(new Date());
                                    newList.add(item);
                                });
                        
    
                                followupContent9.forEach((k, v) -> {
                                    FollowupContent item = new FollowupContent();
                                    item.setFollowupId(followupId);
@ -776,7 +784,7 @@ public class JwPrescriptionService {
                                    item.setCreateTime(new Date());
                                    newList.add(item);
                                });
                        
    
                                followupContent10.forEach((k, v) -> {
                                    FollowupContent item = new FollowupContent();
                                    item.setFollowupId(followupId);
@ -786,7 +794,7 @@ public class JwPrescriptionService {
                                    item.setCreateTime(new Date());
                                    newList.add(item);
                                });
                        
    
                                followupContentDao.save(newList);
                        
                                List<FollowupDrugs> DRUG_LIST = new ArrayList<>();//用药记录
@ -883,11 +891,14 @@ public class JwPrescriptionService {
                    }
                    followupResultMap.put("OPERATOR",OPERATOR);
                    
                    String FOLLOWUP_ID = followup.getFollowupNo();//家庭医生服务随访主表ID
                    if (StringUtils.isBlank(FOLLOWUP_ID)) {
                        FOLLOWUP_ID = "0";
                    String FOLLOWUP_NO = followup.getFollowupNo();//家庭医生服务随访主表ID
                    if (StringUtils.isBlank(FOLLOWUP_NO)) {
                        FOLLOWUP_NO = "0";
                    }else{
                    
                    }
                    followupResultMap.put("FOLLOWUP_ID",FOLLOWUP_ID);
                    followupResultMap.put("FOLLOWUP_ID",String.valueOf(followup.getId()));
                    followupResultMap.put("FOLLOWUP_NO",FOLLOWUP_NO);
                    
                    String FAMILY_FOLLOWUP_TYPE = "3";//随访类型,必传值3 【必填】
                    String ORG_CODE = followup.getOrgCode();//本地机构编码
@ -904,7 +915,7 @@ public class JwPrescriptionService {
                    } else if ("2".equals(FAMILY_FOLLOWUP_CLASS_NAMES)) {
                        FAMILY_FOLLOWUP_CLASS_NAMES = "糖尿病";
                    } else if ("1,2".equals(FAMILY_FOLLOWUP_CLASS_NAMES)) {
                        FAMILY_FOLLOWUP_CLASS_NAMES = "高血压,糖尿病";
                        FAMILY_FOLLOWUP_CLASS_NAMES = "高血压,糖尿病";
                    } else {}
    
                    followupResultMap.put("FAMILY_FOLLOWUP_TYPE",FAMILY_FOLLOWUP_TYPE);
@ -920,6 +931,7 @@ public class JwPrescriptionService {
    
                    followupResultMap.put("THIS_FOLLOWUP_VISIT_DATE",THIS_FOLLOWUP_VISIT_DATE);
                    followupResultMap.put("NEXT_FOLLOWUP_DATE",NEXT_FOLLOWUP_DATE);
                    followupResultMap.put("FOLLOWUP_VISIT_DOCTOR_NAME",followup.getJwdoctorCode());
                    followupResultMap.put("VISIT_WAY_CODE",VISIT_WAY_CODE);
                    
                    String ARCHIVE_ID = "";//档案ID
@ -932,6 +944,32 @@ public class JwPrescriptionService {
                        ARCHIVE_ID = this.getSickArchiveFlag(IDENTITY_CARD_NO);
                        followupResultMap.put("ARCHIVE_ID",ARCHIVE_ID);
                    }
                    
                    //控制目标操作者CODE
                    String CONTROL_CONSTITUTOR_DOCTORCODE = "";
                    
                    if(followupResultMap.containsKey("CONTROL_CONSTITUTOR_JWDOCTORCODE")){
                        followupResultMap.put("CONTROL_CONSTITUTOR",followupResultMap.get("CONTROL_CONSTITUTOR_JWDOCTORCODE"));//基卫控制目标操作者
                    }else{
                        //基卫控制目标操作者,判断是否有控制者名称或者控制者CODE
                        if(followupResultMap.containsKey("CONTROL_CONSTITUTOR") || followupResultMap.containsKey("CONTROL_CONSTITUTOR_DOCTORCODE")){
        
                            String CONTROL_CONSTITUTOR = "";
                            if(followupResultMap.containsKey("CONTROL_CONSTITUTOR_DOCTORCODE")){
            
                                CONTROL_CONSTITUTOR_DOCTORCODE = followupResultMap.get("CONTROL_CONSTITUTOR_DOCTORCODE");
                                CONTROL_CONSTITUTOR = doctorMappingDao.findByDocotrCodeAndJwDoctorHospital(CONTROL_CONSTITUTOR_DOCTORCODE, followup.getOrgCode());
            
                                followupResultMap.put("CONTROL_CONSTITUTOR",CONTROL_CONSTITUTOR);//基卫控制目标操作者
                            }
                            
                        }else{
                            logger.info("随访记录上传失败,控制目标操作者CODE为空: 操作者为" + followupResultMap.containsKey("CONTROL_CONSTITUTOR"));
                            continue;
                        }
                    }
                    List<FollowupDrugs> followupDrugs = followupDrugsDao.findByFollowupId(followup.getId());
                    List<FollowupDrugs> followupDrugsNormal = new ArrayList<>();//其他药品
@ -953,15 +991,26 @@ public class JwPrescriptionService {
                    DecimalFormat df = new DecimalFormat("######0.00");
    
                    //普通药品
                    if(!followupDrugsNormal.isEmpty()){
                        for (int i = 0; i < followupDrugsNormal.size(); i++) {
//                    if(!followupDrugsNormal.isEmpty()){
                        for (int i = 0; i <= 6; i++) {
                            int tag = i+1;
                            followupResultMap.put("PHYSIC_NAME"+tag,followupDrugsNormal.get(i).getDrugsName());
                            followupResultMap.put("FREQUENCY"+tag,followupDrugsNormal.get(i).getFrequency());
                            followupResultMap.put("PHYSIC_UNIT"+tag,followupDrugsNormal.get(i).getUnit());
                            followupResultMap.put("PHYSIC_DOSE"+tag,df.format(followupDrugsNormal.get(i).getDose()));
                            if( !followupDrugsNormal.isEmpty() && followupDrugsNormal.size() >0 && followupDrugsNormal.size() <= tag){
                                followupResultMap.put("PHYSIC_NAME"+tag,followupDrugsNormal.get(i).getDrugsName());
                                followupResultMap.put("FREQUENCY"+tag,followupDrugsNormal.get(i).getFrequency());
                                followupResultMap.put("PHYSIC_UNIT"+tag,followupDrugsNormal.get(i).getUnit());
                                if(followupDrugsNormal.get(i).getDose() !=null){
                                    followupResultMap.put("PHYSIC_DOSE"+tag,df.format(followupDrugsNormal.get(i).getDose()));
                                }else{
                                    followupResultMap.put("PHYSIC_DOSE"+tag,"");
                                }
                            }else{
                                followupResultMap.put("PHYSIC_NAME"+tag,"");
                                followupResultMap.put("FREQUENCY"+tag,"");
                                followupResultMap.put("PHYSIC_UNIT"+tag,"");
                                followupResultMap.put("PHYSIC_DOSE"+tag,"");
                            }
                        }
                    }
//                    }
    
                    //胰岛素类药品
                    if(!followupDrugsInsulin.isEmpty()){
@ -970,7 +1019,12 @@ public class JwPrescriptionService {
                            followupResultMap.put("INSULIN_NAME"+tag,followupDrugsInsulin.get(j).getDrugsName());
                            followupResultMap.put("INSULIN_FREQUENCY"+tag,followupDrugsInsulin.get(j).getFrequency());
                            followupResultMap.put("INSULIN_UNIT"+tag,followupDrugsInsulin.get(j).getUnit());
                            followupResultMap.put("INSULIN_DOSE"+tag,df.format(followupDrugsInsulin.get(j).getDose()));
                            if(followupDrugsInsulin.get(j).getDose() !=null){
                                followupResultMap.put("INSULIN_DOSE"+tag,df.format(followupDrugsInsulin.get(j).getDose()));
                            }else{
                                followupResultMap.put("INSULIN_DOSE","");
                            }
                            
                        }
                    }
    
@ -980,6 +1034,7 @@ public class JwPrescriptionService {
    
                    List<NameValuePair> params = new ArrayList<>();
                    params.add(new BasicNameValuePair("OPERATOR", OPERATOR));
                    params.add(new BasicNameValuePair("ORG_CODE", ORG_CODE));
                    params.add(new BasicNameValuePair("data", jsonObject.toString()));
                    String response = httpClientUtil.post(url, params, "UTF-8");
    
@ -1014,7 +1069,7 @@ public class JwPrescriptionService {
                            }
            
                        } else {
                            logger.info("随访记录上传失败,随访主表ID:" + followup.getId().toString()+",err:请求失败");
                            logger.info("随访记录上传失败,随访主表ID:" + followup.getId().toString()+",err:请求失败"+errmsg);
                            continue;
                        }
                    } else {

+ 1 - 1
patient-co/patient-co-wlyy-job/src/main/resources/application-dev.yml

@ -86,7 +86,7 @@ images:
  sign_path: /usr/local/apache-tomcat-8.0.26/webapps/wlyy/images/familycontract.png
sign:
  check_upload: http://172.19.103.87:8011/wlyy_service
  check_upload: http://172.19.103.88:8011/wlyy_service
quartz:

+ 1 - 1
patient-co/patient-co-wlyy-job/src/main/resources/application-devtest.yml

@ -82,7 +82,7 @@ images:
sign:
  check_upload: http://172.19.103.85:8011/wlyy_service
  check_upload: http://172.19.103.88:8011/wlyy_service
quartz:

+ 2 - 2
patient-co/patient-co-wlyy-job/src/main/resources/system.properties

@ -116,8 +116,8 @@ old_people_tijian_syb_job=0 0 1 * * ?
# 同步居民随访记录,每天凌晨3点执行一次
patient_followup_syb_job=0 0 3 * * ?
# 居民随访记录上传(上传到基卫),每天凌晨4点执行一次
patient_followup_upload_job=0 0 3 * * ?
# 居民随访记录上传(上传到基卫),10分钟执行一次
patient_followup_upload_job=0 0/10 * * * ?
# 老年人体检系统发送提醒记录,每天8点执行一次
patient_physical_examination_job=0 0 8 * * ?

+ 40 - 0
patient-co/patient-co-wlyy/doc/技术文档/es/随访记录详情新增索引.txt

@ -0,0 +1,40 @@
创建索引
POST  http://172.19.103.68:9200/wlyy_followup
查询索引
GET http://172.19.103.68:9200/wlyy_followup/
给索引加mapping
POST http://172.19.103.68:9200/wlyy_followup/wlyy_followup_content/_mapping
{
    "wlyy_followup_content": {
        "properties": {
            "followup_id": {
                "type": "string",
                "index": "not_analyzed"
            },
            "followup_project": {
                "type": "string",
                "index": "not_analyzed"
            },
            "followup_key": {
                "type": "string",
                "index": "not_analyzed"
            },
            "followup_value": {
                "type": "string",
                "index": "not_analyzed"
            },
            "create_time": {
                "type": "string",
                "index": "not_analyzed"
            }
        }
    }
}
增加索引搜索大小
PUT  http://172.19.103.68:9200/wlyy_followup/_settings
{
  "index": {
    "max_result_window": 500000
  }
}

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

@ -39,7 +39,7 @@ public class EncodingFilter implements Filter {
                newRequest.addParameter(key, URLDecoder.decode((value),"utf-8"));
            }
        }
        logger.info(" reqURL:"+request.getRequestURI());
        logger.debug(" reqURL:"+request.getRequestURI());
        chain.doFilter(newRequest, response);
    }

+ 4 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionAdressDao.java

@ -4,8 +4,12 @@ import com.yihu.wlyy.entity.patient.prescription.PrescriptionAdress;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Trick on 2017/10/20.
 */
public interface PrescriptionAdressDao extends PagingAndSortingRepository<PrescriptionAdress, Long>, JpaSpecificationExecutor<PrescriptionAdress> {
    List<PrescriptionAdress> findByPatient(String patient);
}

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

@ -969,8 +969,9 @@ public class ConsultTeamService extends ConsultService {
//            if("0".equals(checkPre)){//存在未结算的续方
//                return -3;
//            }
            Doctor doctor = doctorDao.findByCode(doctorCode);
            ct.setAdminTeamId(signFamily.getAdminTeamId());
            Doctor doctor = doctorDao.findByAdminTeamId(signFamily.getAdminTeamId());
            doctorCode = doctor.getCode();
            // 查询患者信息
            Patient p = patientDao.findByCode(patient);

+ 49 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/followup/FollowUpService.java

@ -21,7 +21,6 @@ import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.app.team.DrHealthTeamService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.service.system.SystemDictService;
import com.yihu.wlyy.task.FollowupUploadTask;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.DateUtil;
import org.apache.commons.lang3.StringUtils;
@ -128,7 +127,7 @@ public class FollowUpService extends BaseService {
        re.put("followupClass", followupClass);
    
        String followupClassName = systemDictService.getDictValue("FOLLOWUP_CLASS_DICT", followup.getFollowupClass());
        if(followupClass.contains(",")){
        if(StringUtils.isNoneBlank(followupClass) && followupClass.contains(",")){
            String[] followupClassArray = followupClass.split(",");
            followupClassName = "";
            for (int i = 0; i < followupClassArray.length; i++) {
@ -451,7 +450,7 @@ public class FollowUpService extends BaseService {
    /**
     * 新增临时随访记录(返回ID)
     */
    public String addFollowup(String doctorCode, String patientCode, String date, String followupType, String followupClass, String followupManagerStatus) throws Exception {
    public String addFollowup(String doctorCode, String patientCode, String date, String followupType, String followupClass, String followupManagerStatus,String plandate) throws Exception {
        String re = "";
        //获取医生信息
@ -495,6 +494,37 @@ public class FollowUpService extends BaseService {
        //保存质询code
        followup.setSignCode(patientService.getSignCodeByPatient(patientCode));
        //计划下次随访时间--ysj.2017.10.26
        if(StringUtils.isNoneBlank(plandate)){
            followup.setFollowupNextDate(DateUtil.strToDate(plandate));
            Followup nextFollowup = new Followup();
            nextFollowup.setDataFrom(followup.getDataFrom());
            nextFollowup.setStatus("2");
            nextFollowup.setFollowupType(followupType);
            nextFollowup.setFollowupNo(followup.getFollowupNo());
            nextFollowup.setFollowupDate(DateUtil.strToDate(plandate));
            nextFollowup.setFollowupPlanDate(DateUtil.strToDate(plandate));
            nextFollowup.setJwdoctorCode(followup.getJwdoctorCode());
            nextFollowup.setJworgCode(followup.getJworgCode());
            nextFollowup.setOrgCode(followup.getOrgCode());
            nextFollowup.setOrgName(followup.getOrgName());
            nextFollowup.setCreater(followup.getCreater());
            nextFollowup.setSignCode(followup.getSignCode());
            nextFollowup.setAdminTeamCode(followup.getAdminTeamCode());
            nextFollowup.setFollowupClass(followupClass);
            nextFollowup.setFollowupManagerStatus(followupManagerStatus);
            nextFollowup.setPatientName(followup.getPatientName());
            nextFollowup.setPatientCode(followup.getPatientCode());
            nextFollowup.setCreateTime(new Date());
            nextFollowup.setUpdateTime(new Date());
            nextFollowup.setDoctorCode(followup.getDoctorCode());
            nextFollowup.setDoctorName(followup.getDoctorName());
            nextFollowup.setIdcard(followup.getIdcard());
            nextFollowup.setSignType(followup.getSignType());
            followupDao.save(nextFollowup);
        }
        followupDao.save(followup);
        re = String.valueOf(followup.getId());
        return re;
@ -623,6 +653,22 @@ public class FollowUpService extends BaseService {
            followupContentDao.save(newList);
        }
    
        Followup followup = followupDao.findOne(Long.valueOf(id));
    
        //如果该随访是已完成的,则添加随访信息上传映射,上传到基卫
        if("1".equals(followup.getStatus())){
            FollowupMapping followupMapping = followUpMappingDao.findByFollowupId(Integer.parseInt(id));
            if(followupMapping == null){
                followupMapping = new FollowupMapping();
                followupMapping.setCode(UUID.randomUUID().toString());
                followupMapping.setFollowupId(Integer.parseInt(id));
                followupMapping.setUpdateTime(DateUtil.getNowTimestamp());
                followupMapping.setCreateTime(DateUtil.getNowTimestamp());
            }
            followupMapping.setNeedUpload(1);
            followUpMappingDao.save(followupMapping);
        }
    }

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

@ -117,6 +117,8 @@ public class PatientPrescriptionPayService extends BaseService {
    private PrescriptionInfoService infoService;
    @Autowired
    private PushMsgTask pushMsgTask;
    @Autowired
    private PrescriptionDispensaryCodeService codeService;
    /**
     * 长处方配送信息查询接口
@ -742,13 +744,13 @@ public class PatientPrescriptionPayService extends BaseService {
                            message.setCzrq(new Date());
                            messageDao.save(message);
                        }
                        //支付成功发起结算
                        //支付成功生成二维码
                        result = prescriptionCode;
//                        try {
//                            jwPrescriptionService.executeSickSettle(prescriptionCode);
//                        } catch (Exception e) {
//                            e.printStackTrace();
//                        }
                        try {
                            codeService.saveQRCode(prescriptionCode);
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    } else if ("1".equals(tradeStatus) || "FAIL".equals(tradeStatus)) {
                        prescriptionPay.setTradeStatus("0");//交易状态 成功1 失败0
                        prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.pay_error.getValue());////续费状态 30支付成功 21支付失败

+ 16 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionAdressService.java

@ -32,14 +32,28 @@ public class PrescriptionAdressService extends BaseService {
        List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
        return rs;
    }
    public Map<String,Object> getDefAdress(String patient){
        String sql = "SELECT ad.* FROM wlyy_prescription_adress ad WHERE ad.patient ='"+patient+"' AND ad.default_flag = 1";
        List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
        if(rs!=null&&rs.size()>0){
            return rs.get(0);
        }else{
            return null;
        }
    }
    //保存
    public String saveAdress(String adressJosn){
        JSONObject jsonObject = JSONObject.fromObject(adressJosn);
        PrescriptionAdress p = (PrescriptionAdress) net.sf.json.JSONObject.toBean(jsonObject,PrescriptionAdress.class);
        p.setCreateTime(new Date());
        if(p.getDefaultFlag()==1){
            String sql ="UPDATE wlyy_prescription_adress set defaultFlag = 0 WHERE patient ='"+p.getPatient()+"' ";
            jdbcTemplate.execute(sql);
            List<PrescriptionAdress> list =  prescriptionAdressDao.findByPatient(p.getPatient());
            if(list!=null&&list.size()>0){
                String sql ="UPDATE wlyy_prescription_adress set default_flag = 0 WHERE patient ='"+p.getPatient()+"' ";
                jdbcTemplate.execute(sql);
            }
        }
        prescriptionAdressDao.save(p);
        return "1";

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

@ -177,6 +177,7 @@ public class PrescriptionInfoService extends BaseService {
                for (int i = 0; i < pres.size(); i++) {
                    com.alibaba.fastjson.JSONObject r = (com.alibaba.fastjson.JSONObject) pres.get(i);
                    //判断是否在审核中
                    String rState = presCheckStateObj(r.getString("code"));
                    if ("1".equals(rState)) {
                        r.put("reviewedState", 1);

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

@ -1182,7 +1182,8 @@ public class FamilyContractService extends BaseService {
                participants.put(sf.getDoctor(), 0);
            } else {//全科和建管不同一个人
                participants.put(sf.getDoctorHealth(), 0);
                participants.put(sf.getDoctor(), 1);
//                participants.put(sf.getDoctor(), 1);
                participants.put(sf.getDoctor(), 0);//默认通知
            }
            //创建医生会话讨论组
            JSONObject sessionObj = ImUtill.createSession(participants, ImUtill.SESSION_TYPE_MUC, patient.getName(), patient.getCode() + "_" + sf.getTeamCode() + "_" + 2);
@ -1529,7 +1530,8 @@ public class FamilyContractService extends BaseService {
                participants.put(sf.getDoctor(), 0);
            } else {//全科和建管不同一个人
                participants.put(sf.getDoctorHealth(), 0);
                participants.put(sf.getDoctor(), 1);
//                participants.put(sf.getDoctor(), 1);默认接收
                participants.put(sf.getDoctor(), 0);
            }
            Patient patient = patientDao.findByCode(sf.getPatient());
            //创建医生会话讨论组

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

@ -4906,6 +4906,17 @@ public class StatisticsService extends BaseService {
                " AND p.`status` = ? " +
                " AND p.create_time <= ? " +
                " AND p.create_time >= ? ";
        String cancelSql = "SELECT " +
                " count(1) count" +
                " FROM " +
                " wlyy_prescription p " +
                " WHERE " +
                " p.admin_team_id = ? " +
                " AND p.`status` <= ? " +
                " AND p.create_time <= ? " +
                " AND p.create_time >= ? ";
        Map<String,Object> rs = new HashedMap();
        //总数
        List<Map<String,Object>> total = jdbcTemplate.queryForList(totalSql,new Object[]{adminTeamId,endDate,startDate});
@ -4943,7 +4954,7 @@ public class StatisticsService extends BaseService {
            rs.put("noReviewedCount",0);
        }
        //其他原因取消
        List<Map<String,Object>> payOuttimeCount = jdbcTemplate.queryForList(stateSql,new Object[]{adminTeamId,PrescriptionLog.PrescriptionLogStatus.pay_outtime.getValue(),endDate,startDate});
        List<Map<String,Object>> payOuttimeCount = jdbcTemplate.queryForList(cancelSql,new Object[]{adminTeamId,PrescriptionLog.PrescriptionLogStatus.pay_outtime.getValue(),endDate,startDate});
        if(total!=null&&total.size()>0){
            rs.put("payOuttimeCount",payOuttimeCount.get(0).get("count"));
        }else{
@ -4980,7 +4991,7 @@ public class StatisticsService extends BaseService {
        processingSql += " AND  p.`status` < " + PrescriptionLog.PrescriptionLogStatus.finish.getValue() +
                " AND p.`status`>= " + PrescriptionLog.PrescriptionLogStatus.revieweding.getValue() ;
        //已完成,已经取消,审核不通过,其他原因取消
        //已完成,已经取消,审核不通过
        String stateSql = "SELECT " +
                " count(1) count" +
                " FROM " +
@ -4992,6 +5003,18 @@ public class StatisticsService extends BaseService {
        }
        stateSql += " AND p.`status` = ? " ;
        //其他原因取消
        String cancelSql = "SELECT " +
                " count(1) count" +
                " FROM " +
                " wlyy_prescription p ";
        if(StringUtils.isNotBlank(disease)){
            cancelSql += " JOIN wlyy_prescription_diagnosis d ON  d.prescription_code = p.code WHERE d.health_problem ='"+disease+"' ";
        }else{
            cancelSql +=" WHERE 1=1 ";
        }
        cancelSql += " AND p.`status` <= ? " ;
        //市区
        if("4".equals(level)){
            //市区无过滤
@ -5000,11 +5023,13 @@ public class StatisticsService extends BaseService {
            totalSql += " AND LEFT(p.hospital, 6) = '"+area+"' ";
            processingSql += " AND LEFT(p.hospital, 6) = '"+area+"' ";
            stateSql += " AND LEFT(p.hospital, 6) = '"+area+"' ";
            cancelSql += " AND LEFT(p.hospital, 6) = '"+area+"' ";
        //机构
        }else if("2".equals(level)){
            totalSql += " AND p.hospital = '"+area+"' ";
            processingSql += " AND p.hospital = '"+area+"' ";
            stateSql += " AND p.hospital = '"+area+"' ";
            cancelSql += " AND p.hospital  = '"+area+"' ";
        }
        Map<String,Object> rs = new HashedMap();
@ -5044,7 +5069,7 @@ public class StatisticsService extends BaseService {
            rs.put("noReviewedCount",0);
        }
        //其他原因取消
        List<Map<String,Object>> payOuttimeCount = jdbcTemplate.queryForList(stateSql,new Object[]{PrescriptionLog.PrescriptionLogStatus.pay_outtime.getValue()});
        List<Map<String,Object>> payOuttimeCount = jdbcTemplate.queryForList(cancelSql,new Object[]{PrescriptionLog.PrescriptionLogStatus.pay_outtime.getValue()});
        if(total!=null&&total.size()>0){
            rs.put("payOuttimeCount",payOuttimeCount.get(0).get("count"));
        }else{
@ -5109,7 +5134,7 @@ public class StatisticsService extends BaseService {
            sql +=" AND p.`status` <'"+PrescriptionLog.PrescriptionLogStatus.finish.getValue()+"' " +
                  " AND p.`status`>='"+PrescriptionLog.PrescriptionLogStatus.revieweding+"'";
        }else if("6".equals(type)){
            sql +=" AND p.`status` ='"+PrescriptionLog.PrescriptionLogStatus.pay_outtime.getValue()+"'";
            sql +=" AND p.`status` <='"+PrescriptionLog.PrescriptionLogStatus.pay_outtime.getValue()+"'";
        }
        sql += " AND p.create_time >='"+DateUtil.dateToStr(dd.getTime(),"YYYY-MM-dd HH:mm:ss")+"' AND p.create_time <='"+ DateUtil.dateToStr(new Date(),"YYYY-MM-dd HH:mm:ss")+"'  GROUP BY LEFT(p.create_time,7) ";
@ -5301,7 +5326,7 @@ public class StatisticsService extends BaseService {
            sql +=" AND p.`status` <'"+PrescriptionLog.PrescriptionLogStatus.finish.getValue()+"' " +
                    " AND p.`status`>='"+PrescriptionLog.PrescriptionLogStatus.revieweding+"'";
        }else if("6".equals(type)){
            sql +=" AND p.`status` ='"+PrescriptionLog.PrescriptionLogStatus.pay_outtime.getValue()+"'";
            sql +=" AND p.`status` <='"+PrescriptionLog.PrescriptionLogStatus.pay_outtime.getValue()+"'";
        }
        return sql;

+ 79 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java

@ -20,7 +20,6 @@ import io.searchbox.client.JestClient;
import io.searchbox.core.Bulk;
import io.searchbox.core.BulkResult;
import io.searchbox.core.Index;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
@ -2302,6 +2301,85 @@ public class StatisticsESService {
        }
    }
    /**
     * 统计微信绑定率
     *
     * @return
     */
    public JSONObject getBindingRate() throws Exception{
        JSONObject result = new JSONObject();
//        Long bindCout = jdbcTemplate.queryForObject(getBindingCountSQL(), Long.class);
//        Long signCout = jdbcTemplate.queryForObject(getSignCountSQL(), Long.class);
        String quotaTime = elasticsearchUtil.getQuotaTime();
//        quotaTime = "2017-10-19";
        SaveModel saveModel1 = elasticsearchUtil.findOneDateQuotaLevel0(quotaTime,"350200",Integer.parseInt(SaveModel.cityLevel),"50","2");
        SaveModel saveModel2 = elasticsearchUtil.findOneDateQuotaLevel0(quotaTime,"350200",Integer.parseInt(SaveModel.cityLevel),"1","2");
        Integer bindCout = saveModel1.getResult2().intValue();
        Integer signCout = saveModel2.getResult2().intValue();
        if ((bindCout != null || bindCout != 0) && (signCout != null && signCout != 0)) {
            double rate = (double) bindCout / signCout * 100;
            DecimalFormat df = new DecimalFormat("###.00");
            result.put("bindRate", df.format(rate) + "%");
        } else {
            result.put("bindRate", "0.00%");
        }
        return result;
    }
    public JSONArray getAVGSocreByMonth(String level, String area, String startDate, String endDate) throws Exception {
        //每个月的评分数
        List<SaveModel> list = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate,endDate,area,Integer.parseInt(level),"28","2","3");
        //
        String sql = "SELECT count(1) as num FROM wlyy_doctor d WHERE d.czrq<= ? ";
        if (SaveModel.cityLevel.equals(level)) {
            sql += " and d.city = ? ";
            //区级
        } else if (SaveModel.townLevel.equals(level)) {
            sql += " and d.town = ? ";
            //机构
        } else if (SaveModel.OrgLevel.equals(level)) {
            sql += " and d.hospital = ? ";
        }
        Map<String, Object> rs = null;
        JSONArray jsRs = new JSONArray();
        DecimalFormat df = new DecimalFormat("0.00");
        for(SaveModel saveModel : list){
            JSONObject json = new JSONObject();
            rs = jdbcTemplate.queryForMap(sql, saveModel.getQuotaDate(), area);
            json.put("month", dateFormat.format(saveModel.getQuotaDate()));
            double rr = (double) saveModel.getResult1() / (Double.parseDouble(rs.get("num")+""));
            json.put("socre", df.format(rr));
            jsRs.put(json);
        }
        return jsRs;
    }
    /**
     * 统计当前团队,签约人数,服务次数,平均满意度
     *
     * @return
     */
    public JSONArray getStatTitleInfo(String doctor, String startDate, String endDate) throws Exception {
        AdminTeam admin = adminTeamDao.findByLeaderCode(doctor);
        if (admin == null) {
            throw new RuntimeException("未找到团队信息");
        }
        SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel0(startDate,endDate,admin.getId()+"",Integer.parseInt(SaveModel.teamLevel),"1","2");
        //计算签约总数
        Long sc = saveModel.getResult2().longValue();
        //查找续签表未转移的记录
        //3.平均满意度
        SaveModel saveModel2 = elasticsearchUtil.findOneDateQuotaLevel0(startDate,endDate,admin.getId()+"",Integer.parseInt(SaveModel.teamLevel),"1","2");
        String sql = "SELECT count(1) as num FROM wlyy_consult_team d WHERE d.czrq>= ? and d.czrq<=? and d.admin_team_code =? ";
        Map<String, Object> map = jdbcTemplate.queryForMap(sql, startDate, endDate,admin.getId());
        Double avgCout = saveModel2.getResult1()/(Integer)map.get("num");
        return null;
    }
    public Map<String,Object> getPrescriptionCount(int level,String area,String disease) throws Exception{
        String index ="58";
        Map<String,Object> rs = new HashedMap();

+ 6 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/system/SystemDictService.java

@ -45,6 +45,12 @@ public class SystemDictService {
                String exit = redisTemplate.opsForValue().get("systemDict:" + dictName);
                if (!StringUtils.isEmpty(exit)) {
                    re = redisTemplate.opsForValue().get("systemDict:" + dictName + ":" + code);
                    if(StringUtils.isEmpty(re)){
                        re = systemDictDao.findByDictNameAndCode(dictName,code);
//                        if (!StringUtils.isEmpty(re)) {
//                            redisTemplate.opsForValue().set("systemDict:" + dictName + ":" + code, re);
//                        }
                    }
                } else {
                    List<SystemDict> list = systemDictDao.findByDictName(dictName);
                    if (list != null && list.size() > 0) {

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

@ -227,11 +227,23 @@ public class OnePayService {
            OnepayDefaultClient onepayClient = new OnepayDefaultClient(config.getOnepayApi(), appId, appSecret, signType, encryptType);
            String uuid = format.format(new Date()) + UUID.randomUUID().toString().replaceAll("-", "").substring(0, 4);
            //      根据签约code查询签约信息
            SignFamily signFamily = signFamilyDao.findByCode(chargeRelation);
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            Date begin = signFamily.getBegin();
            Date end = signFamily.getEnd();
            if (begin != null && end != null) {
                totalAmount = getTotalAmount(sdf.format(begin), sdf.format(end), "yyyy-MM-dd");
            } else {
                return "-2";
            }
            charge.setChargeType(chargeType);   //交易类型
            charge.setChargeRelation(chargeRelation);  //交易关联代码 wlyy_sign_family字段code
            charge.setCode(uuid);  //  接入应用支付业务流水号
            Date now = new Date();
            charge.setCreateTime(now);
            charge.setUpdateTime(now);
            charge.setPatient(patient);     //  用户
            charge.setOpenid(openid);     //  用戶微信openid
@ -285,8 +297,6 @@ public class OnePayService {
            params.put("subject", subject);  //订单名称
            params.put("wxToken", accessToken);
            //      根据签约code查询签约信息
            SignFamily signFamily = signFamilyDao.findByCode(chargeRelation);
            if (signFamily != null) {
//                //签约人Code
                String signDoctorCode = signFamily.getSignDoctorCode();
@ -334,10 +344,10 @@ public class OnePayService {
                        principalCardNo = repSsc;
                    }
                }
                if (StringUtils.isNotEmpty(principalCardNo)){
                if (StringUtils.isNotEmpty(principalCardNo)) {
                    map.put("principalCardNo", principalCardNo); //实际签约卡号( 默认为绑卡主体卡号)
                    charge.setPrincipalSsc(principalCardNo);
                }else {
                } else {
                    return "-1";
                }
@ -453,7 +463,7 @@ public class OnePayService {
                WlyyCharge chargePay = chargeDao.findByCode(outChargeNo);
                if (request.containsKey("responseContent")){
                if (request.containsKey("responseContent")) {
                    JSONObject responseContents = request.getJSONObject("responseContent");//医保结构体
                    if (responseContents != null) {
                        String miRegisterNo = null;//医保挂号
@ -523,7 +533,7 @@ public class OnePayService {
                        chargePay.setAccountPay(accountPay);
                        chargePay.setSelfPay(selfPay);
                        chargePay.setCivilPay(civilPay);
                }
                    }
                }
@ -702,6 +712,8 @@ public class OnePayService {
     * 更改数据 wlyy_sign_family wlyy_charge
     */
    public void updateData(String chargeStatus, Date chargeTime, String chargeNo, WlyyCharge charge) throws Exception {
        charge.setUploadLog("1");
        charge.setUpdateTime(new Date());
        chargeDao.save(charge);
//        成功支付根据wlyy_charge的code 去查找关联代码signCode在更新签约表
        if ("0".equals(chargeStatus)) {
@ -709,4 +721,70 @@ public class OnePayService {
        }
    }
    /**
     * 按月缴费获取签约月数(算法已更改)
     *
     * @param fromStr
     * @param toStr
     * @param formatStr
     * @return
     */
    public static int monthBetweenBak(String fromStr, String toStr, String formatStr) {
        try {
            SimpleDateFormat format = new SimpleDateFormat(formatStr);
            Calendar bef = Calendar.getInstance();
            Calendar aft = Calendar.getInstance();
            bef.setTime(format.parse(fromStr));
            aft.setTime(format.parse(toStr));
            int result = aft.get(Calendar.MONTH) - bef.get(Calendar.MONTH);
            int month = (aft.get(Calendar.YEAR) - bef.get(Calendar.YEAR)) * 12;
            return Math.abs(month + result);
        } catch (Exception e) {
            e.printStackTrace();
            return -1;
        }
    }
    /**
     * 按月缴费获取签约月数
     *
     * @param fromStr
     * @param toStr
     * @param formatStr
     * @return
     */
    public static int monthBetween(String fromStr, String toStr, String formatStr) {
        SimpleDateFormat format = new SimpleDateFormat(formatStr);
        try {
            Calendar bef = Calendar.getInstance();
            Calendar aft = Calendar.getInstance();
            bef.setTime(format.parse(fromStr));
            aft.setTime(format.parse(toStr));
            int result = aft.get(Calendar.MONTH) - bef.get(Calendar.MONTH);
            int month = (aft.get(Calendar.YEAR) - bef.get(Calendar.YEAR)) * 12;
            return Math.abs(month + result) + 1;
        } catch (Exception e) {
            e.printStackTrace();
            return -1;
        }
    }
    /**
     * 按月缴费获取总金额
     *
     * @param fromStr
     * @param toStr
     * @param formatStr
     * @return
     */
    public static String getTotalAmount(String fromStr, String toStr, String formatStr) {
        try {
            Double amount = monthBetween(fromStr, toStr, formatStr) * 7.5;
            return "" + (int) (amount * 100);
        } catch (Exception e) {
            e.printStackTrace();
            return "0";
        }
    }
}

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/ElasticsearchUtil.java

@ -102,7 +102,7 @@ public class ElasticsearchUtil {
                        } else if (value instanceof Integer) {
                            clazz.getMethod(key, Integer.class).invoke(saveModel, value);
                        } else if (value instanceof Double) {
                            clazz.getMethod(key, Integer.class).invoke(saveModel, ((Double) value).intValue());
                            clazz.getMethod(key, Double.class).invoke(saveModel, value);
                        } else if (value instanceof java.util.Date) {
                            clazz.getMethod(key, java.util.Date.class).invoke(saveModel, value);
                        }
@ -202,7 +202,7 @@ public class ElasticsearchUtil {
                    } else if (value instanceof Integer) {
                        clazz.getMethod(key, Integer.class).invoke(saveModel, value);
                    } else if (value instanceof Double) {
                        clazz.getMethod(key, Integer.class).invoke(saveModel, ((Double) value).intValue());
                        clazz.getMethod(key, Double.class).invoke(saveModel, value);
                    } else if (value instanceof java.util.Date) {
                        clazz.getMethod(key, java.util.Date.class).invoke(saveModel, value);
                    }

+ 21 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/followup/DoctorFollowUpController.java

@ -48,6 +48,7 @@ public class DoctorFollowUpController extends BaseController {
            return write(200, "获取随访列表成功!", "data", result);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取随访列表失败!" + e.getMessage());
        }
    }
@ -81,7 +82,7 @@ public class DoctorFollowUpController extends BaseController {
            JSONArray result = followUpService.getListByPatientAndTeam(patient, teamCode, page, pagesize,type);
            return write(200, "查询成功", "data", result);
        } catch (Exception e) {
            e.printStackTrace();
            error(e);
            return error(-1, "查询失败");
        }
    }
@ -103,6 +104,7 @@ public class DoctorFollowUpController extends BaseController {
            return write(200, "获取随访列表成功!", "data", result);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取随访列表失败!" + e.getMessage());
        }
    }
@ -126,6 +128,7 @@ public class DoctorFollowUpController extends BaseController {
            return write(200, "新增随访计划成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "新增随访计划失败!" + e.getMessage());
        }
    }
@ -145,6 +148,7 @@ public class DoctorFollowUpController extends BaseController {
            return write(200, "编辑随访计划成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "编辑随访计划失败!" + e.getMessage());
        }
    }
@ -188,12 +192,15 @@ public class DoctorFollowUpController extends BaseController {
                              @ApiParam(name = "followupClass", value = "随访类别【1.高血压 2.糖尿病】", defaultValue = "1")
                              @RequestParam(value = "followupClass", required = true) String followupClass,
                              @ApiParam(name = "followupManagerStatus", value = "随访管理状态【字典FOLLOWUP_MANAGER_STATUS】", defaultValue = "1")
                              @RequestParam(value = "followupManagerStatus", required = false) String followupManagerStatus) {
                              @RequestParam(value = "followupManagerStatus", required = false) String followupManagerStatus,
                              @ApiParam(name = "plandate", value = "下次随访时间", defaultValue = "2016-12-14 20:00:00")
                              @RequestParam(value = "plandate", required = false) String plandate) {
        try {
            String response = followUpService.addFollowup(getUID(), patient, date, followupType, followupClass, followupManagerStatus);
            String response = followUpService.addFollowup(getUID(), patient, date, followupType, followupClass, followupManagerStatus,plandate);
            return write(200, "新增临时随访记录成功!", "data", response);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "新增临时随访记录失败!" + e.getMessage());
        }
    }
@ -209,6 +216,7 @@ public class DoctorFollowUpController extends BaseController {
            return write(200, "取消随访计划成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "取消随访计划失败!" + e.getMessage());
        }
    }
@ -224,6 +232,7 @@ public class DoctorFollowUpController extends BaseController {
            return write(200, "完成随访记录成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "完成随访记录失败!" + e.getMessage());
        }
    }
@ -239,6 +248,7 @@ public class DoctorFollowUpController extends BaseController {
            return write(200, "获取随访信息成功!", "data", response);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取随访信息失败!" + e.getMessage());
        }
    }
@ -253,6 +263,7 @@ public class DoctorFollowUpController extends BaseController {
            return write(200, "获取随访项目列表成功!", "data", list);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取随访项目列表失败!" + e.getMessage());
        }
    }
@ -269,6 +280,7 @@ public class DoctorFollowUpController extends BaseController {
            return write(200, "获取随访项目数据成功!", "data", response);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取随访项目数据失败!" + e.getMessage());
        }
    }
@ -288,6 +300,7 @@ public class DoctorFollowUpController extends BaseController {
            return write(200, "保存随访项目数据成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "保存随访项目数据失败!" + e.getMessage());
        }
    }
@ -304,6 +317,7 @@ public class DoctorFollowUpController extends BaseController {
            return write(200, "获取电话随访内容成功!", "data", response);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取电话随访内容失败!" + e.getMessage());
        }
    }
@ -320,6 +334,7 @@ public class DoctorFollowUpController extends BaseController {
            return write(200, "记录电话随访内容成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "记录电话随访内容失败!" + e.getMessage());
        }
    }
@ -337,6 +352,7 @@ public class DoctorFollowUpController extends BaseController {
            return write(200, "获取上次随访成功!", "data", response);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取上次随访失败!" + e.getMessage());
        }
    }
@ -353,6 +369,7 @@ public class DoctorFollowUpController extends BaseController {
            return write(200, "复制上次随访成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "复制上次随访失败!" + e.getMessage());
        }
    }
@ -367,6 +384,7 @@ public class DoctorFollowUpController extends BaseController {
            followUpService.sendMessage(date);
            return write(200, "发送随访计划消息成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "发送随访计划消息失败!" + e.getMessage());
        }
    }

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

@ -103,7 +103,7 @@ public class PatientPrescriptionController extends WeixinBaseController {
            @RequestParam(value = "code", required = true) String code) {
        try {
            PrescriptionDispensaryCode prescriptionDispensaryCode = prescriptionDispensaryCodeService.saveQRCode(code, prescriptionCode, 2);
            PrescriptionDispensaryCode prescriptionDispensaryCode = prescriptionDispensaryCodeService.saveQRCode(code,prescriptionCode, 2);
            if (prescriptionDispensaryCode == null) {
                return error(-1, "生成配送员取药码失败!");
            } else {

+ 25 - 9
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionPayController.java

@ -216,30 +216,42 @@ public class PatientPrescriptionPayController extends WeixinBaseController {
        }
    }
//===========================v1.3.9======================================================================
    @RequestMapping(value = "/getAdressList", method = RequestMethod.POST)
    @ApiOperation(value = "获取患者所有默认地址")
    @RequestMapping(value = "/getAddressList", method = RequestMethod.POST)
    @ApiOperation(value = "获取患者所有地址")
    public String getAdressList( @ApiParam(name = "patient", value = "居民code")
                                     @RequestParam(value = "patient", required = true)String patient){
        try {
            prescriptionAdressService.getAdressList(patient);
            return write(200, "发送成功!");
            return write(200, "获取成功!","data",prescriptionAdressService.getAdressList(patient));
        } catch (Exception e) {
            return error(-1, "获取失败!");
        }
    }
    @RequestMapping(value = "/getDefAddress", method = RequestMethod.POST)
    @ApiOperation(value = "获取患者默认地址")
    public String getDefAdress(String patient){
        try {
            return write(200, "获取成功!","data",prescriptionAdressService.getDefAdress(patient));
        } catch (Exception e) {
            error(e);
            return error(-1, "发送失败!");
        }
    }
    @RequestMapping(value = "/saveAdress", method = RequestMethod.POST)
    @RequestMapping(value = "/saveAddress", method = RequestMethod.POST)
    @ApiOperation(value = "保存地址")
    public String saveAdress(@ApiParam(name = "adressJosn", value = "实体json串")
                             @RequestParam(value = "adressJosn", required = true)String adressJosn){
    public String saveAdress(@ApiParam(name = "addressJson", value = "实体json串")
                             @RequestParam(value = "addressJson", required = true)String addressJson){
        try {
            return write(200, "获取成功!", "data", prescriptionAdressService.saveAdress(adressJosn));
            return write(200, "获取成功!", "data", prescriptionAdressService.saveAdress(addressJson));
        } catch (Exception e) {
            error(e);
            return error(-1, "获取失败!");
        }
    }
    @RequestMapping(value = "/delAdress", method = RequestMethod.POST)
    @RequestMapping(value = "/delAddress", method = RequestMethod.POST)
    @ApiOperation(value = "删除地址")
    public String delAdress(@ApiParam(name = "id", value = "主键")
                                @RequestParam(value = "id", required = true)Long id){
@ -247,6 +259,7 @@ public class PatientPrescriptionPayController extends WeixinBaseController {
            return write(200, "获取成功!", "data", prescriptionAdressService.delAdress(id));
        } catch (Exception e) {
            error(e);
            return error(-1, "获取失败!");
        }
    }
@ -258,6 +271,7 @@ public class PatientPrescriptionPayController extends WeixinBaseController {
            return write(200, "获取成功!", "data", prescriptionAdressService.getProvince());
        } catch (Exception e) {
            error(e);
            return error(-1, "获取失败!");
        }
    }
@ -270,6 +284,7 @@ public class PatientPrescriptionPayController extends WeixinBaseController {
            return write(200, "获取成功!", "data", prescriptionAdressService.getCityByProvince(province));
        } catch (Exception e) {
            error(e);
            return error(-1, "获取失败!");
        }
    }
@ -282,6 +297,7 @@ public class PatientPrescriptionPayController extends WeixinBaseController {
            return write(200, "获取成功!", "data", prescriptionAdressService.getTowmByCity(city));
        } catch (Exception e) {
            error(e);
            return error(-1, "获取失败!");
        }
    }

+ 4 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/quota/vo/SaveModel.java

@ -72,9 +72,9 @@ public class SaveModel {
    private String slaveKey4Name;
    private Double result1 = 0.0;//统计结果
    private Double result1 = 0.0;//统计结果(如:评分总合)
    private Integer result2 = 0;//统计结果
    private Double result2 = 0.0;//统计结果
    private String areaLevel;// 1 省 2 市 3 区县 4 机构 5团队
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyyMMdd'T'HHmmss.SSS'Z'")
@ -165,11 +165,11 @@ public class SaveModel {
        this.result1 = result1;
    }
    public Integer getResult2() {
    public Double getResult2() {
        return result2;
    }
    public void setResult2(Integer result2) {
    public void setResult2(Double result2) {
        this.result2 = result2;
    }

+ 4 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/EsStatisticsController.java

@ -776,7 +776,7 @@ public class EsStatisticsController extends BaseController {
    @ResponseBody
    public String getBindingRate() {
        try {
            return write(200, "查询成功", "data", statisticsService.getBindingRate());
            return write(200, "查询成功", "data", statisticsESService.getBindingRate());
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "查询失败");
@ -794,6 +794,7 @@ public class EsStatisticsController extends BaseController {
    @ResponseBody
    public String getAVGSocre(@RequestParam(required = true) String level, @RequestParam(required = true) String area) {
        try {
            level = elasticsearchUtil.changeLevel(Integer.parseInt(level))+"";
            return write(200, "查询成功", "data", statisticsService.getAVGSocre(level, area));
        } catch (Exception e) {
            e.printStackTrace();
@ -813,7 +814,8 @@ public class EsStatisticsController extends BaseController {
                                     @RequestParam(required = true) String statDate,
                                     @RequestParam(required = true) String endDate) {
        try {
            return write(200, "查询成功", "data", statisticsService.getAVGSocreByMonth(level, area, statDate, endDate));
            level = elasticsearchUtil.changeLevel(Integer.parseInt(level))+"";
            return write(200, "查询成功", "data", statisticsESService.getAVGSocreByMonth(level, area, statDate, endDate));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");

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

@ -1589,7 +1589,7 @@ public class StatisticsController extends BaseController {
     * @param sort     0:升序 1:降序
     * @param lowLevel 只有可能是 1,2,3,不传默认是level-1;
     * @param year     不管根据当前时间找年度
     * @param lowCode  如果是服务类型维度code(老年人3,高血压4,糖尿病5)
     * @param lowCode  如果是服务类型维度code(老年人3,高血压1,糖尿病2)
     * @return
     */
    @RequestMapping("/lowlevel_all_sign_renew")

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

@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.entity.charge.WlyyCharge;
import com.yihu.wlyy.entity.organization.HospitalMapping;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.ylz.PayConfigura;
import com.yihu.wlyy.repository.charge.ChargeDao;
import com.yihu.wlyy.repository.organization.HospitalMappingDao;
@ -119,14 +120,14 @@ public class OnePayController extends WeixinBaseController {
                    json.put("bindStatus", "000000");
                    json.put("sicardUrl", sicardUrl);
                    msg = "查询绑卡信息成功!";
                    return write(200, "", "data", json);
                    return write(200, msg, "data", json);
                } else {
                    json.put("sicardUrl", sicardUrl);
                    json.put("bindStatus", "030007");
                    msg = "生成电子社保卡成功!";
                }
            }
            if(bindCard.size()==0||bindCard==null){
            if (bindCard.size() == 0 || bindCard == null) {
                json.put("sicardUrl", sicardUrl);
                json.put("bindStatus", "030007");
                msg = "生成电子社保卡成功!";
@ -165,15 +166,16 @@ public class OnePayController extends WeixinBaseController {
            @RequestParam String totalAmount) throws Exception {
        try {
            //            获取居民个人信息
            totalAmount = "9000";
            String patient = getUID();
            String openId = getOpenid();
            String repUid = getRepUID();
            if (StringUtils.isNotEmpty(openId)) {
                String settleNo = pay.charge(orgCode, chargeType, chargeRelation, totalAmount, patient, repUid, openId, getAccessToken());
                if ("-1".equals(settleNo)){
                if ("-1".equals(settleNo)) {
                    return write(-1, "附属卡未绑定!");
                } else if ("-2".equals(settleNo)) {
                    return write(-1, "查询签约时间失败!");
                }
                return write(200, "家庭医生签约支付成功!", "data", settleNo);
            } else {
@ -345,6 +347,7 @@ public class OnePayController extends WeixinBaseController {
            charge.setIdType(idType);
            charge.setIdNo(idNo);
            charge.setTradeStatus(chargeStatus);
            charge.setUpdateTime(new Date());
            if (param.has("responseContent") && (param.getJSONObject("responseContent") != null)) {
                String requestParam = param.getString("responseContent");
@ -518,10 +521,12 @@ public class OnePayController extends WeixinBaseController {
                    charge.setIdType(idType);
                    charge.setIdNo(idNo);
                    charge.setTradeStatus(chargeStatus);
                    charge.setUpdateTime(new Date());
                    String miRegisterNo = "";//医保签约号
                    if (requestParams.has("responseContent") && (requestParams.getJSONObject("responseContent") != null)) {
                        JSONObject responseContents = requestParams.getJSONObject("responseContent");//医保结构体
                    if (requestParam.has("responseContent")) {
                        String tempcontent = requestParam.getString("responseContent");//医保结构体
                        JSONObject responseContents = new JSONObject(tempcontent);
                        String miCollectDate = null;//扣费日期
                        String miCollectTime = null;//扣费时间
                        String miSettleNo = null;//扣费单据号
@ -612,5 +617,28 @@ public class OnePayController extends WeixinBaseController {
        logService.saveHttpLog(isSuccess, config.getReceiveNotify(), "异步支付通知", "POST", null, params, responses, error, logService.onepayType);
    }
    /**
     * 获取按月缴费总金额
     *
     * @throws IOException
     * @throws PayException
     */
    @RequestMapping(value = "/getTotalAmount", method = RequestMethod.POST)
    @ApiOperation("获取按月缴费总金额")
    @ResponseBody
    public String getTotalAmount(@RequestParam(defaultValue = "0447066a-5b23-11e6-8344-fa163e8aee56") String signCode) throws IOException, PayException {
        try {
            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
            SignFamily signFamily = signFamilyDao.findByCode(signCode);
            Date begin = signFamily.getBegin();
            Date end = signFamily.getEnd();
            if (begin != null && end != null) {
                String totalAmount = pay.getTotalAmount(format.format(begin), format.format(end), "yyyy-MM-dd");
                return write(200, "查询签约金额成功!", "totalAmount", totalAmount);
            }
            return write(-1, "查询签约时间失败!");
        } catch (Exception e) {
            return write(-1, "查询签约金额失败!");
        }
    }
}

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

@ -12,16 +12,16 @@ spring:
      password: jkzlehr@123
  redis:
    host: 120.41.253.95 # Redis server host.
    port: 6380 # Redis server port.
    password: jkzl_ehr
     host: 27.155.101.77 # Redis server host.
     port: 6380 # Redis server port.
     password: jkzl_ehr
server:
  server_url: http://www.xmtyw.cn/wlyy/
im:
  im_list_get: http://120.41.253.95:3000/
  im_list_get: http://27.155.101.77:3000/
  data_base_name: im
wechat: