浏览代码

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

zd_123 7 年之前
父节点
当前提交
b0ca7001a1

+ 146 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/imm/ChildImmuneVaccin.java

@ -0,0 +1,146 @@
package com.yihu.wlyy.entity.imm;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * 儿童可预约疫苗
 * @author huangwenjie
 * @date 2018/6/21 08:24
 */
@Entity
@Table(name = "wlyy_child_immune_vaccin")
public class ChildImmuneVaccin extends IdEntity {
	private String code;
	private String name;                    //儿童姓名
	private String idcard;                  //儿童身份证号
	private String ssc;                     //儿童社保卡号
	private String barcode;                 //儿童免疫条码
	private String ymkc;                    //true:可约,false:不可约
	private String ymmc;                    //疫苗名称
	private String ymkcsm;                  //疫苗库存说明(库存充足,可以预约/库存不足,不能预约)
	private String ymbm;                    //疫苗编码
	private String jzzc;                    //接种针次
	private Integer alert_tag;              //0待提醒,1已提醒
	private Date alert_time;                //提醒时间
	private Date create_time;               //创建时间
	private Date update_time;               //创建时间
	
	public String getCode() {
		return code;
	}
	
	public void setCode(String code) {
		this.code = code;
	}
	
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public String getIdcard() {
		return idcard;
	}
	
	public void setIdcard(String idcard) {
		this.idcard = idcard;
	}
	
	public String getSsc() {
		return ssc;
	}
	
	public void setSsc(String ssc) {
		this.ssc = ssc;
	}
	
	public String getBarcode() {
		return barcode;
	}
	
	public void setBarcode(String barcode) {
		this.barcode = barcode;
	}
	
	public String getYmkc() {
		return ymkc;
	}
	
	public void setYmkc(String ymkc) {
		this.ymkc = ymkc;
	}
	
	public String getYmmc() {
		return ymmc;
	}
	
	public void setYmmc(String ymmc) {
		this.ymmc = ymmc;
	}
	
	public String getYmkcsm() {
		return ymkcsm;
	}
	
	public void setYmkcsm(String ymkcsm) {
		this.ymkcsm = ymkcsm;
	}
	
	public String getYmbm() {
		return ymbm;
	}
	
	public void setYmbm(String ymbm) {
		this.ymbm = ymbm;
	}
	
	public String getJzzc() {
		return jzzc;
	}
	
	public void setJzzc(String jzzc) {
		this.jzzc = jzzc;
	}
	
	public Integer getAlert_tag() {
		return alert_tag;
	}
	
	public void setAlert_tag(Integer alert_tag) {
		this.alert_tag = alert_tag;
	}
	
	public Date getCreate_time() {
		return create_time;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	public void setCreate_time(Date create_time) {
		this.create_time = create_time;
	}
	
	public Date getUpdate_time() {
		return update_time;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	public void setUpdate_time(Date update_time) {
		this.update_time = update_time;
	}
	
	public Date getAlert_time() {
		return alert_time;
	}
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	public void setAlert_time(Date alert_time) {
		this.alert_time = alert_time;
	}
}

+ 5 - 5
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/job/business/MysqlToEsQuotaJob.java

@ -63,7 +63,7 @@ public class MysqlToEsQuotaJob implements Job {
    private String year;//要统计的年份
    private Date quotaDate;//统计的时间
    private String timeLevel;//1 日 2年
    private Integer incrementInterval;//增量的时间间隔(天)
    private String incrementInterval;//增量的时间间隔(天)
    @Autowired
    private QuartzJobLogDao quartzJobLogDao;//执行日志Dao
@ -108,7 +108,7 @@ public class MysqlToEsQuotaJob implements Job {
        this.timeLevel = map.getString("timeLevel");
        this.endTime = map.getString("endTime");
        this.startTime = map.getString("startTime");
        this.incrementInterval = (Integer) map.get("incrementInterval");
        this.incrementInterval = map.get("incrementInterval")!=null?String.valueOf(map.get("incrementInterval")):"1";
        //为空默认是统计昨天的数据  统计昨天的数据是从 前天的下午17:00:00 到昨天的下午17:00:00
        //初始化结束时间
        if (StringUtils.isEmpty(endTime)) {
@ -332,12 +332,12 @@ public class MysqlToEsQuotaJob implements Job {
    public void getStartTime() throws Exception{
        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
        if(this.incrementInterval==1){//日
        if("1".equals(this.incrementInterval)){//日
            startTime = new LocalDate(new DateTime().minusDays(2)).toString("yyyy-MM-dd") + " 17:00:00";
        }else if(this.incrementInterval==2){//周
        }else if("2".equals(this.incrementInterval)){//周
            Date monday = DateUtil.getMondayOfThisDayToDate(sf.parse(endTime));
            startTime =sf.format(monday)+ " 17:00:00";
        }else if(this.incrementInterval==3){//月
        }else if("3".equals(this.incrementInterval)){//月
            Date fristDay = DateUtil.getFristDayOfMonthToDate(sf.parse(endTime));
            startTime = sf.format(fristDay)+ " 17:00:00";
        }

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

@ -110,6 +110,7 @@ public class JobService {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("jobConfig", wlyyJobConfigVO.getId());
        params.put("incrementInterval", wlyyJobConfigVO.getIncrementInterval()!=null?String.valueOf(wlyyJobConfigVO.getIncrementInterval()):"1");
        if (!StringUtils.isEmpty(quartzJobConfig.getJobClass())) {
            for (int j = 1; j <= 2; j++) {
                if (breakPoint(wlyyJobConfigVO, j)) continue;
@ -129,6 +130,7 @@ public class JobService {
        Map<String, String> params = new HashMap<String, String>();
        params.put("jobConfig", wlyyJobConfigVO.getId());
        params.put("incrementInterval", wlyyJobConfigVO.getIncrementInterval()!=null?String.valueOf(wlyyJobConfigVO.getIncrementInterval()):"1");
        for (int i = 1; i <= 2; i++) {
            if (breakPoint(wlyyJobConfigVO, i)) continue;
            params.put("timeLevel", i + "");
@ -141,27 +143,35 @@ public class JobService {
    }
    private boolean breakPoint(WlyyJobConfigVO wlyyJobConfigVO, int i) {
        //该方法使用于每日统计
        if(wlyyJobConfigVO.getIncrementInterval()!=1){
            return true;
        }
        //如果为空或者等3说明纪要生成到达量也要生成增量
        if (StringUtils.isEmpty(wlyyJobConfigVO.getTimeLevel()) || Integer.valueOf(wlyyJobConfigVO.getTimeLevel()) == 3) {
            return true;
            return false;
        }
        //如果不为空 并且是1或者2 说明只要增量或者只要到达量
        if (!(StringUtils.isEmpty(wlyyJobConfigVO.getTimeLevel())) && Integer.valueOf(wlyyJobConfigVO.getTimeLevel()) == i) {
            return true;
            return false;
        }
        return false;
        return true;
    }
    private boolean breakPoint(QuartzJobConfig wlyyJobConfigVO, int i) {
        //该方法使用于每日统计
        if(wlyyJobConfigVO.getIncrementInterval()!=1){
            return true;
        }
        //如果为空或者等3说明纪要生成到达量也要生成增量
        if (StringUtils.isEmpty(wlyyJobConfigVO.getTimeLevel()) || Integer.valueOf(wlyyJobConfigVO.getTimeLevel()) == 3) {
            return true;
            return false;
        }
        //如果不为空 并且是1或者2 说明只要增量或者只要到达量
        if (!(StringUtils.isEmpty(wlyyJobConfigVO.getTimeLevel())) && Integer.valueOf(wlyyJobConfigVO.getTimeLevel()) == i) {
            return true;
            return false;
        }
        return false;
        return true;
    }
    public void productDataByDay(Integer day) throws Exception {
@ -173,6 +183,7 @@ public class JobService {
            Map<String, String> params = new HashMap<String, String>();
            params.put("jobConfig", wlyyJobConfigVO.getId());
            params.put("incrementInterval", wlyyJobConfigVO.getIncrementInterval()!=null?String.valueOf(wlyyJobConfigVO.getIncrementInterval()):"1");
            for (int i = 1; i <= day; i++) {
                for (int j = 1; j <= 2; j++) {
                    if (breakPoint(wlyyJobConfigVO, j)) continue;
@ -217,6 +228,7 @@ public class JobService {
            Map<String, String> params = new HashMap<String, String>();
            params.put("jobConfig", wlyyJobConfigVO.getId());
            params.put("incrementInterval", wlyyJobConfigVO.getIncrementInterval()!=null?String.valueOf(wlyyJobConfigVO.getIncrementInterval()):"1");
            //往quartz框架添加任务
            params.put("startTime", daybefore);
            params.put("endTime", yesterday);
@ -263,7 +275,7 @@ public class JobService {
        Map<String, String> params = new HashMap<String, String>();
        params.put("jobConfig", wlyyJobConfigVO.getId());
        params.put("incrementInterval", wlyyJobConfigVO.getIncrementInterval()!=null?String.valueOf(wlyyJobConfigVO.getIncrementInterval()):"1");
        //往quartz框架添加任务
        params.put("startTime", daybefore);
        params.put("endTime", yesterday);
@ -289,6 +301,7 @@ public class JobService {
        Map<String, String> params = new HashMap<String, String>();
        params.put("jobConfig", wlyyJobConfigVO.getId());
        params.put("incrementInterval", wlyyJobConfigVO.getIncrementInterval()!=null?String.valueOf(wlyyJobConfigVO.getIncrementInterval()):"1");
        for (int i = 1; i <= day; i++) {
            //往quartz框架添加任务
            params.put("startTime", getYesterday(0 - i - 1));
@ -397,7 +410,7 @@ public class JobService {
        Map<String, String> params = new HashMap<String, String>();
        params.put("jobConfig", wlyyJobConfigVO.getId());
        params.put("incrementInterval", wlyyJobConfigVO.getIncrementInterval()!=null?String.valueOf(wlyyJobConfigVO.getIncrementInterval()):"1");
        //往quartz框架添加任务
        params.put("startTime", daybefore);
        params.put("endTime", yesterday);
@ -433,6 +446,7 @@ public class JobService {
            Map<String, String> params = new HashMap<String, String>();
            params.put("jobConfig", wlyyJobConfigVO.getId());
            params.put("incrementInterval", wlyyJobConfigVO.getIncrementInterval()!=null?String.valueOf(wlyyJobConfigVO.getIncrementInterval()):"1");
            //往quartz框架添加任务
            params.put("startTime", daybefore);
            params.put("endTime", yesterday);
@ -556,6 +570,7 @@ public class JobService {
            Map<String, String> params = new HashMap<String, String>();
            params.put("jobConfig", wlyyJobConfigVO.getId());
            params.put("incrementInterval", wlyyJobConfigVO.getIncrementInterval()!=null?String.valueOf(wlyyJobConfigVO.getIncrementInterval()):"1");
            //往quartz框架添加任务
            params.put("startTime", start);
            params.put("endTime", end);

+ 16 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/imm/ChildImmuneVaccinDao.java

@ -0,0 +1,16 @@
package com.yihu.wlyy.repository.imm;
import com.yihu.wlyy.entity.imm.ChildImmuneVaccin;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * @author huangwenjie
 * @date 2018/6/21 09:38
 */
public interface ChildImmuneVaccinDao extends PagingAndSortingRepository<ChildImmuneVaccin, Long>,
		JpaSpecificationExecutor<ChildImmuneVaccin> {
	@Query("select p from ChildImmuneVaccin p where p.barcode=?1")
	ChildImmuneVaccin getChildImmuneVaccinByBarcode(String barcode);
}

+ 8 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/bank/TaskService.java

@ -14,6 +14,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
@ -153,8 +154,13 @@ public class TaskService {
     *
     * @return
     */
    public JSONObject selectByOpenId(String openId){
        Patient patient = patientDao.findByOpenid(openId);
    public JSONObject selectByOpenId(String openId,String code){
        String sql = "select * from wlyy_patient where code = '"+code+"' and openid = '"+openId+"'";
        List<Patient> patients = jdbcTemplate.query(sql,new BeanPropertyRowMapper(Patient.class));
        Patient patient = new Patient();
        if (patients != null && patients.size()!=0){
            patient = patients.get(0);
        }
        List<Patient> patientList = new ArrayList<>();
        JSONObject object = new JSONObject();
        if (patient != null){

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

@ -940,6 +940,18 @@ public class StatisticsESService {
            saveModels = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, area, level, index, timelevel, SaveModel.interval_day);
        }
        List<JSONObject> result = new ArrayList<>();
//        if (saveModels != null && saveModels.size() >0) {
            List<Map<String, Object>> resultList = DateUtil.findDates(dateFormat.parse(startDate), dateFormat.parse(DateUtil.getNextDay(endDate, 1)));
//            result.clear();
            for (Map<String, Object> one : resultList) {
                JSONObject json = new JSONObject();
                json.put("range", one.get("date"));
                json.put("amount", 0);
                result.add(json);
            }
//        }
        if (saveModels != null) {
            // 计算结果
            for (SaveModel saveModel : saveModels) {
@ -949,20 +961,40 @@ public class StatisticsESService {
                    range = df.format(saveModel.getQuotaDate());
                }
                long amount = saveModel.getResult2().longValue();
                json.put("range", range);
                json.put("amount", amount);
                result.add(json);
            }
            if (saveModels != null && saveModels.size() == 1 && saveModels.get(0).getHospital() == null) {
                List<Map<String, Object>> resultList = DateUtil.findDates(dateFormat.parse(startDate), dateFormat.parse(DateUtil.getNextDay(endDate, 1)));
                result.clear();
                for (Map<String, Object> map : resultList) {
                    JSONObject json = new JSONObject();
                    json.put("range", map.get("date"));
                    json.put("amount", 0);
                    result.add(json);
                for(JSONObject obj : result){
                    if((obj.get("range")+"").equals(range)){
                        obj.put("amount", amount);
                    }
                }
//                json.put("range", range);
//                json.put("amount", amount);
//                result.add(json);
            }
//            if (saveModels != null && saveModels.size() == 1 && saveModels.get(0).getHospital() == null) {
//                List<Map<String, Object>> resultList = DateUtil.findDates(dateFormat.parse(startDate), dateFormat.parse(DateUtil.getNextDay(endDate, 1)));
//                result.clear();
//                for (Map<String, Object> map : resultList) {
//                    JSONObject json = new JSONObject();
//                    json.put("range", map.get("date"));
//                    json.put("amount", 0);
//                    result.add(json);
//                }
//            }
//            SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
//            Date startDate1 = sf.parse(startDate);
//            Date endDate1 = sf.parse(endDate);
//            long days = DateUtil.getDays(startDate1,endDate1);
//            Calendar calendar = Calendar.getInstance();
//            calendar.setTime(startDate1);
//            List<JSONObject> resultTemp = new ArrayList<>();
//            for(int i=1;i<=days;i++){
//                calendar.add(calendar.DATE,i);//把日期往后增加一天.整数往后推,负数往前移动
//                String dateString = sf.format(calendar.getTime());
//                Map<String, Object> map = new HashMap<>();
//                map.put("range",sf.format(calendar.getTime()));
//                map.put()
//            }
            // 排序
            result.sort(new Comparator<JSONObject>() {
@ -5435,9 +5467,16 @@ public class StatisticsESService {
        //居民活跃统计
//        resultMap.put("activityPatientRange",df.format(participantCount > 0.0 ? ((participantCount) / (allCount * 1.0000) * 100) : 0.0) + "%");//已报名
        resultMap.put("participantRange",df.format(participantCount > 0.0 ? ((participantCount) / (applyCount * 1.0000) * 100) : 0.0) + "%");//已参与
        resultMap.put("creditsRange",df.format(creditsCount > 0.0 ? ((creditsCount) / (applyCount * 1.0000) * 100) : 0.0) + "%");//已获取积分
        resultMap.put("expiryRange","0%");//已兑奖
        if(applyCount>0){
            resultMap.put("participantRange",df.format(participantCount > 0.0 ? ((participantCount) / (applyCount * 1.0000) * 100) : 0.0) + "%");//已参与
            resultMap.put("creditsRange",df.format(creditsCount > 0.0 ? ((creditsCount) / (applyCount * 1.0000) * 100) : 0.0) + "%");//已获取积分
            resultMap.put("expiryRange","0%");//已兑奖
        }else{
            resultMap.put("participantRange","0%");//已参与
            resultMap.put("creditsRange","0%");//已获取积分
            resultMap.put("expiryRange","0%");//已兑奖
        }
        return resultMap;
    }

+ 31 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/imm/ChildFamilyImmuneService.java

@ -1,8 +1,10 @@
package com.yihu.wlyy.service.imm;
import com.yihu.wlyy.entity.imm.ChildFamilyImmune;
import com.yihu.wlyy.entity.imm.ChildImmuneVaccin;
import com.yihu.wlyy.entity.imm.ChildInfo;
import com.yihu.wlyy.repository.imm.ChildFamilyImmuneDao;
import com.yihu.wlyy.repository.imm.ChildImmuneVaccinDao;
import com.yihu.wlyy.repository.imm.ChildInfoDao;
import com.yihu.wlyy.service.BaseService;
import org.apache.commons.lang.StringUtils;
@ -32,6 +34,8 @@ public class ChildFamilyImmuneService extends BaseService {
	private ChildInfoDao childInfoDao;
	@Autowired
	JdbcTemplate jdbcTemplate;
	@Autowired
	private ChildImmuneVaccinDao childImmuneVaccinDao;
	
	/**
	 * 绑定家庭成员免疫关系
@ -89,4 +93,31 @@ public class ChildFamilyImmuneService extends BaseService {
		List<Map<String, Object>> rs = jdbcTemplate.queryForList(sql);
		return rs;
	}
	
	/**
	 * 获取签约居民待接种疫苗列表
	 * @param doctorcode
	 * @return
	 */
	public List<Map<String,Object>> getImmVaccinList(String doctorcode) {
		String sql = "select t.*,m.family_name,m.child_name,m.birthday from wlyy_child_immune_vaccin t " +
				" inner join ( " +
				" select a.*,b.name as family_name ,c.name as child_name,c.barcode as barcode ,c.birthday as birthday from  wlyy_child_family_immune a " +
				" inner join (select patient,name from wlyy_sign_family where type in (1,2) and `status` = 1 and expenses_status = 1 and doctor = '"+doctorcode+"') b " +
				" on a.family_code = b.patient " +
				" left join wlyy_child_info c on c.`code` = a.child_code " +
				") m on m.barcode = t.barcode ";
		
		List<Map<String, Object>> rs = jdbcTemplate.queryForList(sql);
		return rs;
	}
	
	/**
	 * 根据免疫条码获取待接种免疫记录
	 * @param barcode
	 * @return
	 */
	public ChildImmuneVaccin getChildImmuneVaccinByBarcode(String barcode){
		return childImmuneVaccinDao.getChildImmuneVaccinByBarcode(barcode);
	}
}

+ 7 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/WeiXinCoreService.java

@ -3,6 +3,7 @@ package com.yihu.wlyy.service.weixin;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.web.WeixinBaseController;
import com.yihu.wlyy.wechat.process.WeiXinEventProcess;
import com.yihu.wlyy.wechat.util.WeiXinMessageUtils;
import org.dom4j.Document;
@ -12,6 +13,8 @@ import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import org.json.JSONException;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -28,6 +31,7 @@ import java.util.Map;
 */
@Service
public class WeiXinCoreService extends BaseService {
    private Logger logger= LoggerFactory.getLogger(WeiXinCoreService.class);
    @Autowired
    private WeiXinEventProcess weiXinEventProcess;
@ -58,7 +62,7 @@ public class WeiXinCoreService extends BaseService {
                Element ele = (Element) e;
                message.put(ele.getName(), ele.getText());
            }
            System.out.println("weixin  event:" + message.toString());
            logger.info("weixin  event:" + message.toString());
            // 释放资源
            inputStream.close();
            // 添加access_token参数
@ -91,9 +95,9 @@ public class WeiXinCoreService extends BaseService {
                String content = message.get("Content");
                if ("续签".equals(content)){
//                      发送续签和签约图文消息
                    System.out.print("content======? "+content);
                    logger.info("content======? "+content);
                    result = weiXinEventProcess.replyKeyword(message);
                    System.out.print("图文结束======? ");
                    logger.info("图文结束======? ");
                }
                break;
            default:

+ 77 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/imm/DoctorImmController.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.web.doctor.imm;
import com.yihu.wlyy.entity.imm.ChildImmuneVaccin;
import com.yihu.wlyy.entity.imm.ChildInfoVO;
import com.yihu.wlyy.service.imm.ChildFamilyImmuneService;
import com.yihu.wlyy.service.imm.ChildInfoService;
@ -7,6 +8,7 @@ import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
@ -77,4 +79,79 @@ public class DoctorImmController extends BaseController {
			return error(-1, e.getMessage());
		}
	}
	
	@RequestMapping(value = "/getImmVaccinList", method = RequestMethod.GET)
	@ApiOperation(value = "获取签约居民待接种疫苗列表")
	public String getImmVaccinList(@ApiParam(name = "doctorcode", value = "医生CODE", defaultValue = "")
	                               @RequestParam(value = "doctorcode", required = false) String doctorcode){
		
		try {
			
			if(StringUtils.isBlank(doctorcode)){
				doctorcode = getUID();
			}
			
			List<Map<String, Object>> immrs = childFamilyImmuneService.getImmVaccinList(doctorcode);
			JSONArray jsonArray = new JSONArray();
			if (immrs != null) {
				for (Map<String, Object> map : immrs) {
					JSONObject json = new JSONObject();
					json.put("child_code", map.get("child_code"));//儿童编码
					json.put("name", map.get("name"));//儿童姓名
					json.put("photo", map.get("photo"));//头像
					json.put("idcard", map.get("idcard"));//新生儿身份证号
					json.put("barcode", map.get("barcode"));//新生儿条码
					json.put("family_code", map.get("family_code"));//家人CODE
					json.put("relation", map.get("relation"));//---1父亲 2母亲 3老公 4老婆 5儿子 6女儿 7其他
					json.put("del", map.get("del"));//0为有效,1为删除状态
					jsonArray.put(json);
				}
			}
			return write(200, "查询成功", "data", jsonArray);
		} catch (Exception e) {
			e.printStackTrace();
			return error(-1, "查询失败");
		}
	}
	@RequestMapping(value = "/alertImmVacclinByDoctor", method = RequestMethod.POST)
	@ApiOperation(value = "医生批量提醒待接种疫苗接种")
	public String alertImmVacclinByDoctor(@ApiParam(name = "doctorcode", value = "医生CODE", defaultValue = "")
	                                      @RequestParam(value = "doctorcode", required = true) String doctorcode){
		try {
			// TODO: 2018/6/21
			return write(200, "请求成功");
		} catch (Exception e) {
			e.printStackTrace();
			return error(-1, "查询失败");
		}
	}
	
	@RequestMapping(value = "/alertImmVacclinByPatient", method = RequestMethod.POST)
	@ApiOperation(value = "医生提醒单个居民疫苗接种")
	public String alertImmVacclinByPatient(@ApiParam(name = "code", value = "待接种记录CODE", defaultValue = "")
	                                      @RequestParam(value = "待接种记录CODE", required = true) String code){
		try {
			// TODO: 2018/6/21
			return write(200, "请求成功");
		} catch (Exception e) {
			e.printStackTrace();
			return error(-1, "查询失败");
		}
	}
	
	@RequestMapping(value = "/getPatientImmVacclin", method = RequestMethod.GET)
	@ApiOperation(value = "根据儿童免疫条码获取待接种疫苗")
	public String getPatientImmVacclin(@ApiParam(name = "barcode", value = "儿童免疫编码", defaultValue = "")
	                                       @RequestParam(value = "儿童免疫编码", required = true) String barcode){
		try {
			ChildImmuneVaccin childImmuneVaccin = childFamilyImmuneService.getChildImmuneVaccinByBarcode(barcode);
			return write(200, "请求成功","data",childImmuneVaccin);
		} catch (Exception e) {
			e.printStackTrace();
			return error(-1, "查询失败");
		}
	}
	
	
}

+ 14 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/family/FamilyMemberController.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.web.patient.family;
import com.yihu.wlyy.entity.imm.ChildImmuneVaccin;
import com.yihu.wlyy.entity.imm.ChildInfo;
import com.yihu.wlyy.entity.imm.ChildInfoVO;
import com.yihu.wlyy.entity.patient.Patient;
@ -543,4 +544,17 @@ public class FamilyMemberController extends WeixinBaseController {
            return error(-1, e.getMessage());
        }
    }
    
    @RequestMapping(value = "/getPatientImmVacclin", method = RequestMethod.GET)
    @ApiOperation(value = "根据儿童免疫条码获取待接种疫苗")
    public String getPatientImmVacclin(@ApiParam(name = "barcode", value = "儿童免疫编码", defaultValue = "")
                                       @RequestParam(value = "儿童免疫编码", required = true) String barcode){
        try {
            ChildImmuneVaccin childImmuneVaccin = childFamilyImmuneService.getChildImmuneVaccinByBarcode(barcode);
            return write(200, "请求成功","data",childImmuneVaccin);
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "查询失败");
        }
    }
}

+ 82 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/health/bank/CreditsLogController.java

@ -4,8 +4,15 @@
package com.yihu.wlyy.web.patient.health.bank;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.wechat.WechatTemplateConfig;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.wechat.WechatTemplateConfigDao;
import com.yihu.wlyy.service.app.health.bank.CreditLogService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.web.BaseController;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -18,6 +25,9 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
/**
 * @author wangzhinan
 * @create 2018-05-07 8:50
@ -31,6 +41,14 @@ public class CreditsLogController extends BaseController {
    @Autowired
    private CreditLogService service;
    @Autowired
    private WechatTemplateConfigDao templateConfigDao;
    @Autowired
    private PushMsgTask pushMsgTask;
    @Autowired
    private WeiXinAccessTokenUtils weiXinAccessTokenUtils;
    @Autowired
    private PatientDao patientDao;
    /**
@ -66,11 +84,73 @@ public class CreditsLogController extends BaseController {
     */
    @RequestMapping(value = "/insertCredits",method = RequestMethod.POST)
    @ApiOperation("添加积分")
    public String insert(@ApiParam(name = "creditsDetail",value = "居民对象JSON")
                          @RequestParam(name = "creditsDetail") String creditsDetail){
    public String insert(@ApiParam(name = "creditsDetail",value = "居民id集合")
                         @RequestParam(name = "creditsDetail") String creditsDetail){
        try {
            JSONObject object = JSONObject.parseObject(creditsDetail);
            JSONObject result = service.insert(object);
            String status = result.getString("status");
            logger.info("健康银行居民新增积分:"+result.toString());
            if ("200".equals(status)){
                List<Map<String,Object>> list = (List<Map<String,Object>>)result.get("detailModelList");
                if (list!=null && list.size()>0){
                    //积分
                    String integrate = String.valueOf(list.get(0).get("integrate"));
                    String patientid = String.valueOf(list.get(0).get("patientId"));
                    String total = String.valueOf(list.get(0).get("total"));
                    try {
                        //@TODO 获取积分调用发送微信模板接口
                        Patient people = patientDao.findByCode(patientid);
                        String openId = people.getOpenid();
                        String name = people.getName();
                        org.json.JSONObject sendJson = new org.json.JSONObject();
                        String first = "";
                        String remark = "";
                        String url = "";
                        WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_healthbank_credit","jfdztz");
                        first = templateConfig.getFirst();
                        remark = templateConfig.getRemark();
//                    String keyword1 = templateConfig.getKeyword1();
                        sendJson.put("keyword1", integrate);
                        sendJson.put("keyword2", DateUtil.getStringDate());
                        sendJson.put("keyword3", total);
                        sendJson.put("first", first);
                        sendJson.put("remark", remark);
                        url = templateConfig.getUrl();
                        url = url.replace("key1",(integrate==null?"":integrate));
                        sendJson.put("url", url);//带参数的模板跳转链接
                        System.out.println(sendJson.toString());
                        pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 23, openId, name, sendJson);
//	                    //发送代理人
//	                    jsonArray = weiXinOpenIdUtils.getAgentOpenId(patient, openId);
//	                    if (jsonArray != null && jsonArray.length() > 0) {
//		                    for (int i = 0; i < jsonArray.length(); i++) {
//			                    org.json.JSONObject j = jsonArray.getJSONObject(i);
//			                    Patient member = (Patient) j.get("member");
//			                    int start = url.indexOf("&toUser=");
//			                    int end = url.indexOf("&", start + 1);
//			                    String touser = url.substring(start, end);
//			                    url = url.replace(touser, "&toUser=" + member.getCode());
//			                    //name患者姓名
//			                    sendJson.put("first", weiXinOpenIdUtils.getTitleMes(people, (int) j.get("relation"), name) + first);
//			                    sendJson.put("url", url);
//			                    pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 19, member.getOpenid(), name, sendJson);
//		                    }
//	                    }
                    }catch (Exception e){
                        logger.info("健康银行居民新增积分,微信模板消息发送失败:"+e.getMessage());
//	                        e.printStackTrace();
                    }
                }
            }
            return write(200,"添加成功","data",result);
        }catch (Exception e){
            error(e);

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/health/bank/TaskController.java

@ -114,7 +114,7 @@ public class TaskController extends BaseController{
    @ApiOperation("获取用户信息")
    public String selectByOpenId(){
        try {
            return write(200,"添加成功","data",service.selectByOpenId(getOpenid()));
            return write(200,"查询成功","data",service.selectByOpenId(getOpenid(),getUID()));
        }catch (Exception e){
            error(e);
            return error(-1,e.getMessage());