ソースを参照

Merge branch 'dev' of zd_123/patient-co-management into dev

liuwenbin 6 年 前
コミット
b6ad3b42d8

+ 34 - 1
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/SynergyManageService.java

@ -1927,7 +1927,7 @@ public class SynergyManageService extends BaseJpaService {
        String endTime = today+" 23:59:59";
        /*startTime="2017-11-15 00:00:00";
        endTime="2017-11-22 23:59:59";*/
        String sql="SELECT" +
        /*String sql="SELECT" +
                " u.`code`,"+
                " u.`name`," +
                " u.`online` as onlineType," +
@ -1943,6 +1943,31 @@ public class SynergyManageService extends BaseJpaService {
                " AND r.answer_status=1"+
                " GROUP BY" +
                " u.`code`," +
                " r.type";*/
        String sql="SELECT" +
                " u.`code`," +
                " u.`name`," +
                " u.`online` AS onlineType," +
                " r.type," +
                " IF (r.type IS NOT NULL, COUNT(*), 0) AS num" +
                " FROM" +
                " wlyy_user u" +
                " LEFT JOIN (" +
                " SELECT" +
                "  type," +
                "  user_code," +
                "  user_name" +
                "  FROM" +
                "  manage_call_record" +
                "  WHERE" +
                "  create_time >= '"+startTime+"'" +
                "  AND create_time <= '"+endTime+"'" +
                "  AND answer_status = 1" +
                " ) r ON u.`code` = r.user_code" +
                " WHERE" +
                " u.type = 4" +
                " GROUP BY" +
                " u.`code`," +
                " r.type";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        List<Map<String,Object>> toList =  new ArrayList<>();
@ -1964,6 +1989,10 @@ public class SynergyManageService extends BaseJpaService {
                    resultMap.put("jieruCount",0);
                    resultMap.put("waihuCount",map.get("num"));
                }
                if ("null".equals(type) || StringUtils.isEmpty(type)){
                    resultMap.put("jieruCount",0);
                    resultMap.put("waihuCount",0);
                }
                toList.add(resultMap);
            }else {
                int count =0;
@ -1990,6 +2019,10 @@ public class SynergyManageService extends BaseJpaService {
                            resultMap.put("jieruCount",0);
                            resultMap.put("waihuCount",map.get("num"));
                        }
                        if ("null".equals(type)  || StringUtils.isEmpty(type)){
                            resultMap.put("jieruCount",0);
                            resultMap.put("waihuCount",0);
                        }
                        toList.add(resultMap);
                    }
                }

+ 3 - 0
patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/common/dao/PatientHealthIndexDao.java

@ -64,5 +64,8 @@ public interface PatientHealthIndexDao
	@Query("select a from PatientHealthIndex a where a.user = ?1 and a.deviceSn = ?2 and a.value1 = ?3 and a.type = ?4 and a.recordDate >= ?5 and a.recordDate<=?6 and a.del = '1' ")
	List<PatientHealthIndex> findByTypeInHalfMinute(String patient, String deviceSn, String value1, Integer type, Date minDate,Date maxDate);
	@Query("select a from PatientHealthIndex a where a.user = ?1 and a.deviceSn = ?2 and a.value1 = ?3 and a.value2=?7 and a.value3=?8 and a.type = ?4 and a.recordDate >= ?5 and a.recordDate<=?6 and a.del = '1' ")
	List<PatientHealthIndex> findByTypeInHalfMinuteAllValue(String patient, String deviceSn, String value1, Integer type, Date minDate,Date maxDate,String value2,String value3);
}

+ 17 - 0
patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/common/util/DateUtil.java

@ -1599,4 +1599,21 @@ public class DateUtil {
        SimpleDateFormat formatter = new SimpleDateFormat(DEFAULT_DATE_YMD_FORMAT);
        return formatter.format(currentTime);
    }
    /**
     * 时间前推或后推天数(负数前推正数后推)
     * date 基准时间
     */
    public static java.util.Date getPreDays(java.util.Date date, int days) {
        java.util.Date day = null;
        try {
            Calendar c = Calendar.getInstance();
            c.setTime(date);
            c.add(Calendar.DATE, days);
            day = c.getTime();
        } catch (Exception e) {
        }
        return day;
    }
}

+ 12 - 5
patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/service/DeviceService.java

@ -487,18 +487,25 @@ public class DeviceService extends BaseService{
        if (device!=null) {
            /************设备数据重复推送处理 start**********************/
            String value1 = data;
            String value2="";
            String value3="";
            if("2".equals(type)){
                String[] value = data.split(",");
                if (value.length > 0) {
                    value1 = value[0];     //收缩压
                    value2 = value[1];
                    value3 = value[2];
                }
            }
            if (value1.equals(value2) && value2.equals(value3)){
                return null;
            }
//            List<PatientHealthIndex> list = patientHealthIndexDao.findByType(device.getUser(),deviceSn,value1,Integer.parseInt(type),time);
            long maxtime = time.getTime()+30*1000;
            long mintime = time.getTime()-30*1000;
            Date minDate = new Date(mintime);
            Date maxDate = new Date(maxtime);
            List<PatientHealthIndex> list = iotDeviceService.findByType(device.getUser(),deviceSn,value1,Integer.parseInt(type),time,minDate,maxDate);
            /*long maxtime = time.getTime()+30*1000;
            long mintime = time.getTime()-30*1000;*/
            Date minDate = DateUtil.getPreDays(time,-3);
            Date maxDate = DateUtil.getPreDays(time,3);
            List<PatientHealthIndex> list = iotDeviceService.findByType(device.getUser(),deviceSn,value1,value2,value3,Integer.parseInt(type),time,minDate,maxDate);
            if(list!=null&&list.size()>0){
                DeviceInfo deviceInfo = new DeviceInfo();
                deviceInfo.setDeviceData(json.toString());

+ 8 - 2
patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/service/IotDeviceService.java

@ -130,12 +130,18 @@ public class IotDeviceService extends BaseService{
     * @param time
     * @return
     */
    public List<PatientHealthIndex> findByType(String user,String deviceSn,String value1,Integer type,Date time,Date timeMin,Date timeMax){
    public List<PatientHealthIndex> findByType(String user,String deviceSn,String value1,String value2,String value3,Integer type,Date time,Date timeMin,Date timeMax){
        if(isUploadIot()){
            return findRepeat(user,deviceSn,value1,type,time);
        }else {
            //return  patientHealthIndexDao.findByType(user,deviceSn,value1,type,time);
            return  patientHealthIndexDao.findByTypeInHalfMinute(user,deviceSn,value1,type,timeMin,timeMax);
            List<PatientHealthIndex> list = new ArrayList<>();
            if (type==1){
                list =  patientHealthIndexDao.findByTypeInHalfMinute(user,deviceSn,value1,type,timeMin,timeMax);
            }else if (type==2){
                list = patientHealthIndexDao.findByTypeInHalfMinuteAllValue(user,deviceSn,value1,type,timeMin,timeMax,value2,value3);
            }
            return list;
        }
    }

+ 12 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/imm/ChildFamilyImmuneService.java

@ -189,7 +189,7 @@ public class ChildFamilyImmuneService extends BaseService {
	 * @param barcode
	 * @return
	 */
	public List<ChildImmuneVaccin> getChildImmuneVaccinByBarcode(String barcode){
	public List<ChildImmuneVaccin> getChildImmuneVaccinByBarcode(String barcode)throws Exception{
		return childImmuneVaccinDao.getChildImmuneVaccinByBarcodeAndYmsx(barcode);
	}
@ -222,6 +222,8 @@ public class ChildFamilyImmuneService extends BaseService {
			String childName = jsonObject.getString("childName");
			String vaccinName = jsonObject.getString("vaccinName");
			String vaccinCode = jsonObject.getString("vaccinCode");
            String jzrq = jsonObject.getString("jzrq");
            String jzzc = jsonObject.getString("jzzc");
			String sql ="SELECT" +
					" cfi.relation," +
					" p.`code`," +
@ -247,10 +249,10 @@ public class ChildFamilyImmuneService extends BaseService {
							WechatTemplateConfig temp = templateConfigDao.findByScene("template_doctor_survey", "ymjztx");
							JSONObject json = new JSONObject();
							json.put("toUser",String.valueOf(map.get("code")));
							json.put("keyword1", temp.getKeyword1());
							json.put("keyword1", temp.getKeyword1().replace("key1",vaccinName).replace("key2",jzzc));
							json.put("keyword2", temp.getKeyword2().replace("key1",DateUtil.dateToStr(new Date(), "yyyy-MM-dd")));
							json.put("remark", temp.getRemark());
							json.put("first", temp.getFirst().replace("key1",String.valueOf(map.get("name"))).replace("key2", childName));
							json.put("first", temp.getFirst().replace("key1",String.valueOf(map.get("name"))).replace("key2", childName).replace("key3",jzrq));
							json.put("url",temp.getUrl().replace("key1",childCode));
							logger.info("weiTempJOSN:"+json.toString());
							pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 11,String.valueOf(map.get("openid")) , String.valueOf(map.get("name")), json);
@ -288,7 +290,8 @@ public class ChildFamilyImmuneService extends BaseService {
		if (StringUtils.isEmpty(alertDataJsonStr)){
			return -1;
		}
		Doctor doctorObj = doctorDao.findByCode(doctor);
		return alertImmVacclinByChildInfoCodes("["+alertDataJsonStr+"]",doctor);
		/*Doctor doctorObj = doctorDao.findByCode(doctor);
		String doctorName = "";
		String doctorLevel = "";
		if (doctorObj!=null){
@ -309,6 +312,8 @@ public class ChildFamilyImmuneService extends BaseService {
		String childName = jsonObject.getString("childName");
		String vaccinName = jsonObject.getString("vaccinName");
		String vaccinCode = jsonObject.getString("vaccinCode");
		String jzrq = jsonObject.getString("jzrq");
        String jzzc = jsonObject.getString("jzzc");
		String sql ="SELECT" +
				" cfi.relation," +
				" p.`code`," +
@ -367,7 +372,7 @@ public class ChildFamilyImmuneService extends BaseService {
		}
		//保存到es的提醒日志表中
		esSavePatientRemindRecord(patientRemindRecordESDOList);
		return 200;
		return 200;*/
	}
@ -403,6 +408,8 @@ public class ChildFamilyImmuneService extends BaseService {
                    jsonObject.put("childName", map.get("child_name"));//儿童姓名
                    jsonObject.put("childCode", map.get("childCode"));//儿童code
                    jsonObject.put("vaccinName", map.get("ymmc"));//疫苗名称
                    jsonObject.put("jzrq",map.get("jzrq"));//接种日期
                    jsonObject.put("jzzc",map.get("jzzc"));//接种针次
                    jsonArray.put(jsonObject);
                }
			}

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

@ -115,6 +115,7 @@ public class DoctorImmController extends BaseController {
					json.put("sex",IdCardUtil.getSexForIdcard_new(idCard));//性别
					json.put("jzzc",map.get("jzzc"));//接种针次
					json.put("ymkc",map.get("ymkc"));//true:可约,false:不可约
					json.put("jzrq",map.get("jzrq"));//接种日期
					jsonArray.put(json);
				}
			}
@ -147,7 +148,7 @@ public class DoctorImmController extends BaseController {
	@RequestMapping(value = "/alertImmVacclinByChildInfoCodes", method = RequestMethod.POST)
	@ApiOperation(value = "医生提醒居民疫苗接种(作废)")
	@ApiOperation(value = "医生提醒居民疫苗接种(作废).")
	public String alertImmVacclinByChildInfoCodes(@ApiParam(name = "alertDataJsonStr", value = "[{\"childCode\":\"123\",\"childName\":\"张三\",\"vaccinCode\":\"asd123\",\"vaccinName\":\"疫苗名称\"}]", defaultValue = "")
										   @RequestParam(value = "alertDataJsonStr", required = true) String alertDataJsonStr){
		try {
@ -161,7 +162,7 @@ public class DoctorImmController extends BaseController {
	@RequestMapping(value = "/alertImmVacclinByChildInfoCode", method = RequestMethod.POST)
	@ApiOperation(value = "医生提醒居民疫苗接种")
	public String alertImmVacclinByChildInfoCode(@ApiParam(name = "alertDataJsonStr", value = "{\"childCode\":\"123\",\"childName\":\"张三\",\"vaccinCode\":\"asd123\",\"vaccinName\":\"疫苗名称\"}", defaultValue = "")
	public String alertImmVacclinByChildInfoCode(@ApiParam(name = "alertDataJsonStr", value = "{\"childCode\":\"123\",\"childName\":\"张三\",\"vaccinCode\":\"asd123\",\"vaccinName\":\"疫苗名称\",\"jzrq\":\"接种日期\",\"jzzc\":\"接种针次\"}", defaultValue = "")
												  @RequestParam(value = "alertDataJsonStr", required = true) String alertDataJsonStr){
		try {
			int result = childFamilyImmuneService.alertImmVacclinByChildInfoCode(alertDataJsonStr,getUID());

+ 4 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/controller/message/GcOtherMessageController.java

@ -73,7 +73,7 @@ public class GcOtherMessageController {
            ) {
        try {
            Patient patient =  patientDao.findBySsc(cardNo);
            /*Patient patient =  patientDao.findBySsc(cardNo);
            SignFamily signFamily = null;
            if (patient!=null){
                signFamily = signFamilyDao.findByPatient(patient.getCode());
@ -100,9 +100,9 @@ public class GcOtherMessageController {
                System.out.println("消息模板id----"+templateId);
                weiXinTempMsgSendUtils.sendTemplateMessage(templateId, patient.getOpenid(), url, new JSONObject(templateJson));
            }
            /*if ("3502110100".equals(signFamily.getHospital())){
            *//*if ("3502110100".equals(signFamily.getHospital())){
                weiXinTempMsgSendUtils.sendTemplateMessage(templateId, patient.getOpenid(), url, new JSONObject(templateJson));
            }*/
            }*//*
            //秀萍
            if ("oULM4xPHQO1MYOPJdI9AtVKx3fIo".equals(patient.getOpenid())){
                System.out.println("------------start send message--------------");
@ -113,7 +113,7 @@ public class GcOtherMessageController {
                System.out.println("接收者id----"+patient.getOpenid());
                System.out.println("消息模板id----"+templateId);
                weiXinTempMsgSendUtils.sendTemplateMessage(templateId, patient.getOpenid(), url, new JSONObject(templateJson));
            }
            }*/
            return new BaseResultModel(BaseResultModel.statusEm.success.getCode(),BaseResultModel.statusEm.success.getMessage());
        } catch (Exception e) {
            e.printStackTrace();