瀏覽代碼

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

liubing 3 年之前
父節點
當前提交
506f042618

+ 1 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/care/visit/BaseVisitDO.java

@ -16,7 +16,7 @@ public class BaseVisitDO extends UuidIdentityEntityWithCreateTime {
    private String patient;
    private String patientName;
    private String type;//类型 1老人日常走访
    private String type;//类型 1老人日常走访 2老人日常临时走访(管理端直接新增记录没有计划)
    private String status;//状态 0计划中 1 已完成 2计划超时
    private Date visitDate;//完成走访时间
    private Date visitPlanDate;//计划走访时间

+ 3 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/visit/BaseVisitDao.java

@ -15,4 +15,7 @@ public interface BaseVisitDao  extends PagingAndSortingRepository<BaseVisitDO, S
    @Query("select a from BaseVisitDO a where a.doctor = ?1 and a.visitPlanDate between ?2 and ?3 ")
    List<BaseVisitDO> findByDoctor(String doctor, Date begin, Date end) throws Exception;
    @Query("select a from BaseVisitDO a where a.visitPlanDate between ?1 and ?2 ")
    List<BaseVisitDO> findByDoctor2(Date begin, Date end) throws Exception;
}

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/device/PatientDeviceController.java

@ -373,7 +373,7 @@ public class PatientDeviceController extends BaseController {
    @ApiOperation("获取getAqgDeviceInfo2定位数据")
    @RequestMapping(value = "getAqgDeviceInfo2",method = RequestMethod.GET)
    public String getAqgDeviceInfo2(@ApiParam(name = "deviceSn",value = "设备sn码")
                                 @RequestParam(value = "deviceSn",required = true)String deviceSn){
                                    @RequestParam(value = "deviceSn",required = true)String deviceSn){
        try {
            return write(200,"获取成功","data",patientDeviceService.getAqgDeviceInfo2(deviceSn));
        }catch (Exception e){

+ 20 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/visit/VisitEndpoint.java

@ -38,8 +38,8 @@ public class VisitEndpoint extends EnvelopRestEndpoint {
                                        @RequestParam(value = "startTime", required = true) String startTime,
                                       @ApiParam(name = "endTime", value = "结束时间", defaultValue = "2021-11-30 00:00:00")
                                        @RequestParam(value = "endTime", required = true) String endTime,
                                       @ApiParam(name = "doctor", value = "医生id")
                                        @RequestParam(value = "doctor", required = true) String doctor) {
                                       @ApiParam(name = "doctor", value = "医生id", required = false)
                                        @RequestParam(value = "doctor", required = false) String doctor) {
        try {
            List<Map<String, Object>> result = baseVisitService.getListByDoctor(doctor, startTime, endTime);
            return ListEnvelop.getSuccess("创建成功",result);
@ -131,4 +131,22 @@ public class VisitEndpoint extends EnvelopRestEndpoint {
        }
    }
    @ApiOperation("直接新增走访--管理员端")
    @RequestMapping(value = "/adminAddVisit",method = RequestMethod.POST)
    public Envelop adminAddVisit(@ApiParam(name = "doctor", value = "医生id")
                                 @RequestParam(value = "doctor", required = true) String doctor,
                                 @ApiParam(name = "patient", value = "患者代码")
                                 @RequestParam(value = "patient", required = true) String patient,
                                 @ApiParam(name = "visitContent", value = "走访记录")
                                 @RequestParam(value = "visitContent", required = true) String visitContent,
                                 @ApiParam(name = "visitImg", value = "走访图片")
                                 @RequestParam(value = "visitImg", required = true) String visitImg) {
        try {
            baseVisitService.adminAddVisit(doctor,patient,visitContent,visitImg);
            return Envelop.getSuccess("操作成功");
        } catch (Exception e) {
            return failedException2(e);
        }
    }
}

+ 62 - 6
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/wlyygc/WlyygcDataEndpoint.java

@ -15,11 +15,14 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
/**
 * Created by yeshijie on 2022/1/18.
 */
@RestController
@RequestMapping(value = "open/gc/data")
@RequestMapping(value = "open/g1c/data")
@Api(value = "对外开放统计数据", tags = {"对外开放统计数据"})
public class WlyygcDataEndpoint extends EnvelopRestEndpoint {
@ -64,17 +67,70 @@ public class WlyygcDataEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value = "emeAndSecInfo")
    @ApiOperation(value = "安防/紧急呼叫概要")
    public ListEnvelop emeAndSecInfo(@ApiParam(name = "code", value = "社区编码")
                                    @RequestParam(value = "code", required = true) String code,
    public ListEnvelop emeAndSecInfo(@ApiParam(name = "code", value = "社区编码", required = true)
                                     @RequestParam(value = "code", required = true) String code,
                                     @ApiParam(name = "page", value = "分页大小", required = true)
                                    @RequestParam(value = "page") Integer page,
                                     @RequestParam(value = "page") Integer page,
                                     @ApiParam(name = "size", value = "页码", required = true)
                                    @RequestParam(value = "size") Integer size) {
                                     @RequestParam(value = "size") Integer size,
                                     @ApiParam(name = "type", value = "类型", required = false)
                                     @RequestParam(value = "type", required = false) Integer type,
                                     @ApiParam(name = "status", value = "状态", required = false)
                                     @RequestParam(value = "status", required = false) Integer status) {
        try {
            JSONArray result = wlyygcStatisticsService.emeAndSecInfo(page,size,code);
            JSONArray result = wlyygcStatisticsService.emeAndSecInfo(page,size,code,type,status);
            return success(result);
        } catch (Exception e) {
            return failedListEnvelopException2(e);
        }
    }
    @GetMapping(value = "signOldList")
    @ApiOperation(value = "获取签约老人")
    public ListEnvelop signOldList(@ApiParam(name = "code", value = "社区编码")
                                   @RequestParam(value = "code", required = true) String code,
                                   @ApiParam(name = "page", value = "分页大小", required = true)
                                   @RequestParam(value = "page") Integer page,
                                   @ApiParam(name = "size", value = "页码", required = true)
                                   @RequestParam(value = "size") Integer size) {
        try {
            List<Map<String, Object>> maps = wlyygcStatisticsService.signOldList(code, page, size);
            return success(maps);
        } catch (Exception e) {
            return failedListEnvelopException2(e);
        }
    }
    @GetMapping(value = "securityEmergencyList")
    @ApiOperation(value = "获取安防/监护")
    public ObjEnvelop securityEmergencyList(@ApiParam(name = "code", value = "社区编码")
                                            @RequestParam(value = "code", required = true) String code,
                                            @ApiParam(name = "page", value = "分页大小", required = true)
                                            @RequestParam(value = "page") Integer page,
                                            @ApiParam(name = "size", value = "页码", required = true)
                                            @RequestParam(value = "size") Integer size) {
        try {
            JSONObject jsonObject = wlyygcStatisticsService.securityEmergencyList(code,page,size);
            return success(jsonObject);
        } catch (Exception e) {
            return failedObjEnvelopException2(e);
        }
    }
    @GetMapping(value = "deviceList")
    @ApiOperation(value = "获取设备列表")
    public ListEnvelop deviceList(@ApiParam(name = "code", value = "社区编码")
                                  @RequestParam(value = "code", required = true) String code,
                                  @ApiParam(name = "page", value = "分页大小", required = true)
                                  @RequestParam(value = "page") Integer page,
                                  @ApiParam(name = "size", value = "页码", required = true)
                                  @RequestParam(value = "size") Integer size) {
        try {
            List<Map<String, Object>> maps = wlyygcStatisticsService.deviceList(code, page, size);
            return success(maps);
        } catch (Exception e) {
            return failedListEnvelopException2(e);
        }
    }
}

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/statistics/DetectionPlatformService.java

@ -535,7 +535,7 @@ public class DetectionPlatformService  {
    public List<Map<String,Object >> findSignOlder(String doctorId){
/*        String sql=  "SELECT p.id,p.name,p.photo,p.idcard,CAST(IFNULL(p.birthday,'') AS char ) birthday,p.residential_area residentialArea,p.sex, " +
        /*String sql=  "SELECT p.id,p.name,p.photo,p.idcard,CAST(IFNULL(p.birthday,'') AS char ) birthday,p.residential_area residentialArea,p.sex, " +
                " p.ykt_id yktId, case 1 WHEN p.openid is not null then 1 WHEN p.on_line = '1' then 1 ELSE 0 end as online,IFNULL(p.sign_status,0) signStatus "+
                " from base_service_package_sign_record sr,base_patient p,base_service_package_record r,base_team_member m " +
                "WHERE sr.status=1 and sr.patient = p.id and m.team_code = r.team_code and sr.id=r.sign_id " +

+ 113 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/statistics/WlyygcStatisticsService.java

@ -181,7 +181,7 @@ public class WlyygcStatisticsService {
     * @param code
     * @return
     */
    public JSONArray emeAndSecInfo(Integer page, Integer size,String code){
    public JSONArray emeAndSecInfo(Integer page, Integer size,String code,Integer type,Integer status){
        JSONArray jsonArray = new JSONArray();
        String filter = "";
        if("1".equals(code)){
@ -189,6 +189,9 @@ public class WlyygcStatisticsService {
        }else {
            return jsonArray;
        }
        if(status!=null){
            filter += " and o.status = "+status;
        }
        if(page==null){
            page =1;
        }
@ -212,7 +215,12 @@ public class WlyygcStatisticsService {
                ", base_service_package_record r, base_security_monitoring_order o " +
                "WHERE p.del = 1 and p.archive_type =1 and r.patient = p.id " +
                "and p.id = o.patient " + filter +
                " ) a ORDER BY a.create_time desc limit "+(page*size)+","+size;
                " ) a where 1=1 ";
        if(type!=null){
            sql += " and a.type = '"+type+"'";
        }
        sql += "ORDER BY a.create_time desc limit "+(page-1)*size+","+size;
        List<Map<String,Object>> res = jdbcTemplate.queryForList(sql);
        for (Map<String,Object> map : res){
            JSONObject json = new JSONObject();
@ -236,4 +244,107 @@ public class WlyygcStatisticsService {
        return jsonArray;
    }
    public List<Map<String, Object>> signOldList(String code, Integer page, Integer size) {
        if (page == null) {
            page = 1;
        }
        if (size == null) {
            size = 10;
        }
        String sql = "SELECT DISTINCT p.`name`, p.mobile, p.idcard,(CASE WHEN p.sex = 1 THEN  '男' ELSE '女' END ) AS sex,p.address, TIMESTAMPDIFF(YEAR, p.birthday, CURDATE()) years,p.residential_area AS residentialArea" +
                " FROM base_patient p INNER JOIN base_service_package_sign_record br ON p.id = br.patient, base_service_package_record r" +
                " WHERE p.del = 1 AND br.`status` = 1 AND p.archive_type = 1 AND r.patient = p.id ";
        if ("1".equals(code)) {
            //1华联社区
            sql += "  and r.team_code = '8a92aba97a9f6f49017ae4fdbdmqteam' ";
        } else {
            return null;
        }
        sql += "ORDER BY p.`name` desc limit " + (page - 1)*size + "," + size;
        List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
        return maps;
    }
    public JSONObject securityEmergencyList(String code,Integer page,Integer size) {
        JSONObject jsonObject = new JSONObject();
        if (page == null) {
            page = 1;
        }
        if (size == null) {
            size = 10;
        }
        String jjsql = "SELECT DISTINCT " +
                "ord.patient_name," +
                "'紧急呼叫' AS serveDesc " +
                "FROM base_emergency_assistance_order ord ";
        String afsql ="SELECT DISTINCT " +
                "ord.patient_name AS NAME," +
                "ord.serve_desc AS serveDesc " +
                "FROM " +
                "base_security_monitoring_order ord " +
                "INNER JOIN base_service_package_sign_record br ON ord.patient = CONVERT (br.patient USING utf8) COLLATE utf8_unicode_ci," +
                " base_service_package_record r " +
                "WHERE " +
                "r.patient = ord.patient ";
        if ("1".equals(code)) {
                                             //808080eb78f276d40178f3373c8c000b
            jjsql += "WHERE ord.team_code ='8a92aba97a9f6f49017ae4fdbdmqteam'";
            afsql += "AND r.team_code ='8a92aba97a9f6f49017ae4fdbdmqteam'";
        }else {
            return jsonObject;
        }
        jjsql += " ORDER BY ord.patient_name DESC limit " + (page - 1)*size + "," + size;
        afsql += " ORDER BY ord.patient_name DESC limit " + (page - 1)*size + "," + size;
        List<Map<String, Object>> jj = jdbcTemplate.queryForList(jjsql);
        List<Map<String, Object>> af = jdbcTemplate.queryForList(afsql);
        jsonObject.put("Security", af);
        jsonObject.put("Emergency", jj);
        return jsonObject;
    }
    public List<Map<String, Object>> deviceList(String code,Integer page,Integer size){
        if (page == null) {
            page = 1;
        }
        if (size == null) {
            size = 10;
        }
        String filter ="";
        if ("1".equals(code)){
            filter += "AND r.team_code = '8a92aba97a9f6f49017ae4fdbdmqteam'";
        }else {
            return null;
        }
        String deviceSql = "SELECT DISTINCT" +
                " pd.device_name as deviceName," +
                "pd.device_type as deviceType," +
                "wd.collect_num as collectNum " +
                "FROM " +
                "base_patient p " +
                "INNER JOIN base_service_package_sign_record sr ON p.id = sr.patient " +
                "AND sr.`status` = 1," +
                " base_service_package_record r," +
                " wlyy_patient_device pd," +
                " wlyy_devices wd " +
                "WHERE " +
                "p.del = 1 " +
                "AND p.archive_type = 1 " +
                "AND r.patient = p.id " +
                "AND p.id = pd.`user` " +
                "AND pd.del = 0 "+
                "AND wd.device_code = pd.device_sn "+filter+" ORDER BY pd.device_name DESC limit " + (page - 1)*size + "," + size;
        List<Map<String, Object>> maps = jdbcTemplate.queryForList(deviceSql);
        return maps;
    }
}

+ 38 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/visit/BaseVisitService.java

@ -10,6 +10,7 @@ import com.yihu.jw.entity.care.visit.BaseVisitDO;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -37,8 +38,12 @@ public class BaseVisitService {
    public List<Map<String, Object>> getListByDoctor(String doctorCode, String startTime, String endTime) throws Exception {
        List<Map<String, Object>> re = new ArrayList<>();
        Map<String, Map<String, Object>> temp = new HashMap<>();
        List<BaseVisitDO> list = baseVisitDao.findByDoctor(doctorCode, DateUtil.strToDate(startTime), DateUtil.strToDate(endTime));
        List<BaseVisitDO> list = null;
        if(StringUtils.isNotBlank(doctorCode)){
            list = baseVisitDao.findByDoctor(doctorCode, DateUtil.strToDate(startTime), DateUtil.strToDate(endTime));
        }else{
            list = baseVisitDao.findByDoctor2(DateUtil.strToDate(startTime), DateUtil.strToDate(endTime));
        }
        if (list != null && list.size() > 0) {
            for (BaseVisitDO visitDO : list) {
                String date = DateUtil.dateToStrShort(visitDO.getVisitPlanDate());
@ -121,6 +126,37 @@ public class BaseVisitService {
        return null;
    }
    /**
     * 直接新增走访--管理员端
     * @param visitContent
     * @param visitImg
     */
    public void adminAddVisit(String doctorCode,String patientCode,String visitContent,String visitImg) throws Exception{
        BaseVisitDO visitDO = new BaseVisitDO();
        //获取患者信息
        BasePatientDO patient = patientDao.findById(patientCode);
        if (patient == null) {
            throw new Exception("获取不到用户信息!");
        }
        BaseDoctorDO doctor = doctorDao.findById(doctorCode);
        if (doctor == null) {
            throw new Exception("获取不到医生信息!");
        }
        visitDO.setDoctor(doctorCode);
        visitDO.setDoctorName(doctor.getName());
        visitDO.setPatient(patientCode);
        visitDO.setPatientName(patient.getName());
        visitDO.setVisitPlanDate(new Date());
        visitDO.setVisitDate(new Date());
        visitDO.setStatus("1");
        visitDO.setType("2");
        visitDO.setVisitContent(visitContent);
        visitDO.setVisitImg(visitImg);
        baseVisitDao.save(visitDO);
    }
    /**
     * 完成走访
     * @param id