Bladeren bron

Merge branch 'dev' of liubing/wlyy2.0 into dev

liubing 3 jaren geleden
bovenliggende
commit
aedff22d34

+ 11 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doctor/DoctorBirthdayWishesEndpoint.java

@ -116,7 +116,7 @@ public class DoctorBirthdayWishesEndpoint extends BaseController {
        }
    }
    @ApiOperation("获取医生签约患者当天生日未发生")
    @ApiOperation("获取医生签约患者当天生日未发送")
    @RequestMapping(value = "getPatientByDoctor", method = RequestMethod.GET)
    public String getPatientByDoctor(){
        try {
@ -126,6 +126,16 @@ public class DoctorBirthdayWishesEndpoint extends BaseController {
        }
    }
    @ApiOperation("获取医生签约患者当天生日未发送数量")
    @RequestMapping(value = "getPatientByDoctorCount", method = RequestMethod.GET)
    public String getPatientByDoctorCount(){
        try {
            return write(200, "查询成功", "data", birthdayWishesService.getPatientByDoctorCount(getUID()));
        } catch (Exception e) {
            return errorResult(e);
        }
    }
    @ApiOperation("获取生日居民列表")
    @RequestMapping(value = "getBirthdayPatientList", method = RequestMethod.GET)
    public String getBirthdayPatientList(@ApiParam(name = "patientName", value = "居民姓名")

+ 34 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/birthday/BirthdayWishesService.java

@ -197,6 +197,40 @@ public class BirthdayWishesService {
    }
    /**
     * 获取医生当天未发送生日祝福居民数量
     * @param doctor
     * @return
     */
    public Integer getPatientByDoctorCount(String doctor) throws Exception{
        //es日期格式
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String createTime = sdf.format(new Date()) + " 00:00:00";
        //今日推送的居民
        Set<String> sendPatients = (Set<String>) redisTemplate.opsForValue().get("birthday:wish:sendPatient");
        Date currentTime = new Date();
        SimpleDateFormat format = new SimpleDateFormat("MMdd");
        String dateString = format.format(currentTime);
        //获取当天0点
        SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
        String now = f.format(new Date());
        String sql = "SELECT p.id patient, p.`name`, " +
                "CASE p.sex WHEN 1 THEN '男' WHEN 2 THEN '女' END sex," +
                "p.idcard, p.photo," +
                " CASE LENGTH(p.idcard) WHEN  18 then SUBSTR(p.idcard,11,4) when 15 then SUBSTR(p.idcard, 9,4) END date " +
                "from wlyy_archive a,base_patient p WHERE  a.patient = p.id and a.sign_status = 1 and EXISTS( " +
                "SELECT DISTINCT sr.patient from base_service_package_sign_record sr,base_service_package_record r, " +
                "base_service_package_item i,base_team_member m " +
                "WHERE  sr.id = r.sign_id and sr.patient = a.patient  and r.service_package_id = i.service_package_id " +
                "and i.del = 1 and m.team_code = i.team_code and m.doctor_code = '"+doctor+"' ) "+
                " and (p.archive_status<>2 or p.archive_status is null) " +
                "AND CASE LENGTH(p.idcard) WHEN  18 then SUBSTR(p.idcard,11,4) when 15 then SUBSTR(p.idcard, 9,4) END =  '" + dateString + "' " ;
        List<Map<String, Object>> patientInfos =  jdbcTemplate.queryForList(sql);
        return patientInfos.size();
    }
    /**
     * 获取医生生日列表
     */

+ 24 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/DeviceService.java

@ -1,13 +1,17 @@
package com.yihu.jw.care.service.device;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.dao.device.DeviceDao;
import com.yihu.jw.entity.care.device.Device;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.stream.Collectors;
/**
 * 设备管理
@ -19,6 +23,8 @@ public class DeviceService extends BaseJpaService<Device, DeviceDao> {
	@Autowired
	private DeviceDao deviceDao;
	@Autowired
	private JdbcTemplate jdbcTemplate;
	/**
@ -35,4 +41,22 @@ public class DeviceService extends BaseJpaService<Device, DeviceDao> {
	{
		return deviceDao.findOne(Long.valueOf(id));
	}
	/**
	 * 获取用户设备绑定类型
	 * @param patient
	 * @return
	 */
	public String getPatientDeviceCategoryCode(String patient){
		if (StringUtils.isNotBlank(patient)){
			String sql = "select Distinct category_code from wlyy_patient_device where user='"+patient+"' and del=0 order by category_code asc";
			List<String> categorys = jdbcTemplate.queryForList(sql,String.class);
			if (categorys.size()>0){
				String categoryStr =  categorys.stream().map(String::valueOf).collect(Collectors.joining(","));
				return categoryStr;
			}
		}
		return "0";
	}
}

+ 4 - 11
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doctor/CareDoctorService.java

@ -2,6 +2,7 @@ package com.yihu.jw.care.service.doctor;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.dao.doorCoach.BaseDoorCoachOrderDao;
import com.yihu.jw.care.service.device.DeviceService;
import com.yihu.jw.care.service.role.RoleService;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
@ -57,6 +58,8 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
    private BaseDoorCoachOrderDao baseDoorCoachOrderDao;
    @Autowired
    private ImService imService;
    @Autowired
    private DeviceService deviceService;
    /**
     * 获取医生详情
@ -364,17 +367,7 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
            }else {
                map.put("age", null);
            }
            if (map.get("deviceType")!=null){
                if ("1,2".equals(map.get("deviceType").toString())){
                    map.put("deviceType",3);//deviceType 设备状态:0未绑定,1血糖仪,2血压仪,3血糖仪+血压仪
                }
                else {
                    map.put("deviceType",Integer.valueOf(map.get("deviceType").toString()));
                }
            }
            else {
                map.put("deviceType",0);
            }
            map.put("deviceType",deviceService.getPatientDeviceCategoryCode(map.get("id").toString()));
        }
        return PageEnvelop.getSuccessListWithPage("查询成功",list,page,size,count);
    }

+ 5 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/label/PatientLableService.java

@ -2,6 +2,7 @@ package com.yihu.jw.care.service.label;
import com.yihu.jw.care.dao.label.WlyyPatientLabelDao;
import com.yihu.jw.care.service.common.DictService;
import com.yihu.jw.care.service.device.DeviceService;
import com.yihu.jw.care.util.ConstantUtil;
import com.yihu.jw.entity.care.label.WlyyPatientLabelDO;
import com.yihu.jw.restmodel.web.PageEnvelop;
@ -24,6 +25,8 @@ public class PatientLableService extends BaseJpaService<WlyyPatientLabelDO, Wlyy
    private WlyyPatientLabelDao patientLabelDao;
    @Autowired
    private DictService dictService;
    @Autowired
    private DeviceService deviceService;
    /**
     * 按团队查找签约居民的标签统计
@ -58,7 +61,7 @@ public class PatientLableService extends BaseJpaService<WlyyPatientLabelDO, Wlyy
     * @return
     */
    public PageEnvelop<List<Map<String,Object>>> findSignPatientLabelListByTeamCode(String teamCode, String labelCode, String name, int page, int size){
        String sql = "SELECT DISTINCT p.id,p.name,p.photo,p.idcard,p.mobile,p.openid,p.sex " ;
        String sql = "SELECT DISTINCT p.id,p.name,p.photo,p.idcard,p.mobile,p.openid,p.sex,p.pad_imei padImei " ;
        String countSql = "SELECT count(DISTINCT p.id) ";
        String filters = "from base_service_package_sign_record sr,base_service_package_record r,  " +
                "                base_service_package_item i,base_patient p,wlyy_patient_label l " +
@ -74,6 +77,7 @@ public class PatientLableService extends BaseJpaService<WlyyPatientLabelDO, Wlyy
        for (Map<String,Object> map : list){
            String idcard = map.get("idcard").toString();
            map.put("age", IdCardUtil.getAgeForIdcard(idcard));
            map.put("deviceType",deviceService.getPatientDeviceCategoryCode(map.get("id").toString()));
        }
        Long count = jdbcTemplate.queryForObject(countSql+filters,Long.class);
        return PageEnvelop.getSuccessListWithPage("success",list,page,size,count);