Parcourir la source

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

叶仕杰 il y a 3 ans
Parent
commit
31d8e1656f

+ 6 - 6
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/patient/PatientEndpoint.java

@ -104,7 +104,7 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
            @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size) throws Exception {
            @RequestParam(value = "size") int size) {
        try{
            return patientService.myPatientPage(name, doctorId, page, size);
        }catch (Exception e){
@ -131,7 +131,7 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
    public Envelop updLatLon(@ApiParam(name = "latLon", value = "经纬度24.48923061,118.10388605")
                              @RequestParam(value = "latLon", required = true)String latLon,
                              @ApiParam(name = "patientId", value = "居民id")
                              @RequestParam(value = "patientId", required = true)String patientId)throws Exception{
                              @RequestParam(value = "patientId", required = true)String patientId){
        try{
            patientService.updLatLon(latLon, patientId);
            return success("修改成功");
@ -145,7 +145,7 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
    public Envelop updPatient(@ApiParam(name = "jsonData", value = "json格式")
                                  @RequestParam(value = "jsonData", required = true)String jsonData,
                                  @ApiParam(name = "doctorId", value = "医生id")
                                  @RequestParam(value = "doctorId", required = false)String doctorId)throws Exception{
                                  @RequestParam(value = "doctorId", required = false)String doctorId){
        try{
            JSONObject result =  patientService.updPatient(jsonData, doctorId);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
@ -165,7 +165,7 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value = "findPatientLabel")
    @ApiOperation(value = "获取居民标签信息")
    public Envelop findPatientLabel(@ApiParam(name = "patientId", value = "居民id")
                                   @RequestParam(value = "patientId", required = true)String patientId)throws Exception{
                                   @RequestParam(value = "patientId", required = true)String patientId){
        try{
            return success("修改成功",patientLabelDao.findByPatient(patientId));
        }catch (Exception e){
@ -179,7 +179,7 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
    public Envelop updPatientLabel(@ApiParam(name = "jsonData", value = "json格式")
                              @RequestParam(value = "jsonData", required = true)String jsonData,
                              @ApiParam(name = "patientId", value = "居民id")
                              @RequestParam(value = "patientId", required = true)String patientId)throws Exception{
                              @RequestParam(value = "patientId", required = true)String patientId){
        try{
            patientService.updPatientLabel(jsonData, patientId);
            return success("修改成功");
@ -195,7 +195,7 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
                                  @ApiParam(name = "pw", value = "密码")
                                  @RequestParam(value = "pw", required = true)String pw,
                                  @ApiParam(name = "orgPw", value = "原密码")
                                  @RequestParam(value = "orgPw", required = false)String orgPw)throws Exception{
                                  @RequestParam(value = "orgPw", required = false)String orgPw){
        Boolean isSuccess = patientService.updatePatientPw(id,pw,orgPw);
        if (isSuccess){
            return success(isSuccess);

+ 23 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/statistics/OpenStatisticsEndpoint.java

@ -1,12 +1,15 @@
package com.yihu.jw.care.endpoint.statistics;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.service.patient.CarePatientService;
import com.yihu.jw.care.service.statistics.StatisticsService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@ -27,6 +30,8 @@ public class OpenStatisticsEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private StatisticsService statisticsService;
    @Autowired
    private CarePatientService patientService;
    @GetMapping(value = "statisticsTotalAmount")
    @ApiOperation(value = "统计总数")
@ -73,4 +78,22 @@ public class OpenStatisticsEndpoint extends EnvelopRestEndpoint {
        }
    }
    @GetMapping(value = "findUserByType")
    @ApiOperation(value = "人员实时动态搜索")
    public Envelop findUserByType(@ApiParam(name = "type", value = "类型:1幼儿,2老人,3助老员,4医生。不传返回四个类型的数据")
                                    @RequestParam(value = "type", required = false)String type,
                                    @ApiParam(name = "name", value = "姓名")
                                    @RequestParam(value = "name", required = false)String name,
                                    @ApiParam(name = "residentialArea", value = "居住小区")
                                    @RequestParam(value = "residentialArea", required = false)String residentialArea,
                                    @ApiParam(name = "page", value = "第几页")
                                        @RequestParam(value = "page", required = false)Integer page,
                                    @ApiParam(name = "size", value = "页面大小")
                                        @RequestParam(value = "size", required = false)Integer size){
        try{
            return success("修改成功",patientService.findUserByType(type, name, residentialArea, page, size));
        }catch (Exception e){
            return failedException2(e);
        }
    }
}

+ 133 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/patient/CarePatientService.java

@ -13,6 +13,7 @@ import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.servicePackage.ServicePackageSignRecordDO;
import com.yihu.jw.entity.care.label.WlyyPatientLabelDO;
import com.yihu.jw.entity.care.sign.CapacityAssessmentRecordDO;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.service.BasePatientMedicardCardService;
import com.yihu.jw.restmodel.ResponseContant;
@ -59,6 +60,8 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
    private CapacityAssessmentRecordService capacityAssessmentRecordService;
    @Autowired
    private PatientFamilyMemberService familyMemberService;
    @Autowired
    private ImUtil imUtil;
    /**
     * 签约记录
@ -389,4 +392,134 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
        return result;
    }
    /**
     *
     * @param type 类型:1幼儿,2老人,3助老员,4医生。不传返回四个类型的数据
     * @param name 姓名
     * @param residentialArea 居住小区
     * @return
     */
    public JSONObject findUserByType(String type,String name,String residentialArea,Integer page,Integer size){
        JSONObject re = new JSONObject();
        if(page == null){
            page = 1;
        }
        if(size == null){
            size = 3;
        }
        String online= imUtil.getOnlineListByType(null);
        JSONObject json = JSON.parseObject(online).getJSONObject("data");
        String limit = " limit "+(page-1)*size+","+size;
        if("1".equals(type)||StringUtil.isBlank(type)){
            List<Map<String,Object>> list = findChild(name,residentialArea,limit,json.getJSONObject("child"));
            re.put("child",list);
        }
        if("2".equals(type)||StringUtil.isBlank(type)){
            List<Map<String,Object>> list = findOld(name,residentialArea,limit,json);
            re.put("old",list);
        }
        if("3".equals(type)||StringUtil.isBlank(type)){
            List<Map<String,Object>> list = findHelper(name,limit,json.getJSONObject("helper"));
            re.put("helper",list);
        }
        return re;
    }
    /**
     * 查找幼儿
     * @param name
     * @param residentialArea
     * @param limit
     * @param json
     * @return
     */
    public List<Map<String,Object>> findChild(String name,String residentialArea,String limit,JSONObject json){
        String sql = "SELECT id,name,photo from base_patient WHERE archive_type = 2 and del = '1' ";
        if(!StringUtil.isBlank(name)){
            sql+= " and name like '%"+name+"%' ";
        }
        if(!StringUtil.isBlank(residentialArea)){
            sql+= " and residential_area = '"+residentialArea+"' ";
        }
        sql+=limit;
        List<Map<String,Object>>  list = jdbcTemplate.queryForList(sql);
        String sqlCount = "SELECT COUNT(*) from base_door_coach_order where `status` = 6";
        for (Map<String,Object> map:list){
            String paientId = map.get("id").toString();
            String filter = " and patient = '"+paientId+"'";
            Integer count = jdbcTemplate.queryForObject(sqlCount+filter,Integer.class);
            map.put("online",json.containsKey(paientId));
            map.put("doorCoach",count);
        }
        return list;
    }
    /**
     * 查找老人
     * @param name
     * @param residentialArea
     * @param limit
     * @param json
     * @return
     */
    public List<Map<String,Object>> findOld(String name,String residentialArea,String limit,JSONObject json){
        String sql = "SELECT id,name,photo from base_patient WHERE archive_type = 1 and del = '1' ";
        if(!StringUtil.isBlank(name)){
            sql+= " and name like '%"+name+"%' ";
        }
        if(!StringUtil.isBlank(residentialArea)){
            sql+= " and residential_area = '"+residentialArea+"' ";
        }
        sql+=limit;
        List<Map<String,Object>>  list = jdbcTemplate.queryForList(sql);
        String sqlLife= "SELECT COUNT(*) from base_life_care_order where `status` = 2";
        String sqlEmergency= "SELECT COUNT(*) from base_emergency_assistance_order where `status` = 0";
        String sqlSecurity= "SELECT COUNT(*) from base_security_monitoring_order where `status` = 7 ";
        for (Map<String,Object> map:list){
            String paientId = map.get("id").toString();
            String filter = " and patient = '"+paientId+"'";
            Integer lifeCare = jdbcTemplate.queryForObject(sqlLife+filter,Integer.class);
            Integer emergency = jdbcTemplate.queryForObject(sqlEmergency+filter,Integer.class);
            Integer security = jdbcTemplate.queryForObject(sqlSecurity+filter,Integer.class);
            map.put("onlinePad",json.getJSONObject("olderPad").containsKey(paientId));
            map.put("onlineWx",json.getJSONObject("olderWx").containsKey(paientId));
            map.put("lifeCare",lifeCare);
            map.put("emergency",emergency);
            map.put("security",security);
        }
        return list;
    }
    /**
     * 查找助老员
     * @param name
     * @param limit
     * @param json
     * @return
     */
    public List<Map<String,Object>> findHelper(String name,String limit,JSONObject json){
        String sql = "SELECT id,name,photo from base_doctor WHERE doctor_level = 2 and del = '1' ";
        if(!StringUtil.isBlank(name)){
            sql+= " and name like '%"+name+"%' ";
        }
        sql+=limit;
        List<Map<String,Object>>  list = jdbcTemplate.queryForList(sql);
        String sqlLife= "SELECT COUNT(*) from base_life_care_order where `status` = 2";
        String sqlEmergency= "SELECT COUNT(*) from base_emergency_assistance_order where `status` = 0";
        String sqlSecurity= "SELECT COUNT(*) from base_security_monitoring_order where `status` = 7 ";
        for (Map<String,Object> map:list){
            String doctorId = map.get("id").toString();
            String filter = " and doctor = '"+doctorId+"'";
            Integer lifeCare = jdbcTemplate.queryForObject(sqlLife+filter,Integer.class);
            Integer emergency = jdbcTemplate.queryForObject(sqlEmergency+filter,Integer.class);
            Integer security = jdbcTemplate.queryForObject(sqlSecurity+filter,Integer.class);
            map.put("online",json.containsKey(doctorId));
            map.put("lifeCare",lifeCare);
            map.put("emergency",emergency);
            map.put("security",security);
        }
        return list;
    }
}