Browse Source

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

# Conflicts:
#	svr/svr-iot/src/main/java/com/yihu/iot/service/monitorPlatform/MonitorPlatformService.java
wangzhinan 4 năm trước cách đây
mục cha
commit
b4bbe884f4

+ 118 - 5
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java

@ -3063,7 +3063,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return rs.size();
    }
    public Map<String, Object> findDoctorInfo(String doctor, String withWork) {
    public Map<String, Object> findDoctorInfo(String doctor, String withWork,String patient) {
        BaseDoctorDO doctorDO = baseDoctorDao.findById(doctor);
        Map<String, Object> rs = new HashedMap();
@ -3157,7 +3157,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
//            Integer coordinationCout = outpatientDao.countByDoctorAndStatusAndOutpatientType(doctor,"2","2");
//            rs.put("coordinationCout",coordinationCout);
            //医生关注
            List<BaseDoctorPatientFollowDO> doctorPatientFollowDOS = baseOrgPatientDao.findByDoctor(doctor);
            List<BaseDoctorPatientFollowDO> doctorPatientFollowDOS = baseOrgPatientDao.findByDoctorAndPatient(doctor,patient);
            if (doctorPatientFollowDOS != null && doctorPatientFollowDOS.size() > 0) {
                rs.put("attention", "1");
            } else {
@ -4172,7 +4172,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                jsonObject.put("dept_code", "");
            }
            jsonObject.put("visit_status", 1);
            jsonObject.put("waiting_count", 0);
            jsonObject.put("visit_count", 0);
            jsonObject.put("offline_count",0);
            jsonObject.put("ending_count",0);
            jsonObject.put("patient_name", "");
            jsonObject.put("time_cost", 0);
@ -4211,12 +4213,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                if (StringUtils.isNoneBlank(doctor)) {
                    Long waitCount = Long.parseLong(waitObj.get("waitCount").toString());
                    if (result.keySet().contains(doctor)) {
                        result.get(doctor).put("waiting_count", waitCount);
                        result.get(doctor).put("visit_count", waitCount);
                    } else {
                        JSONObject jsonObject = new JSONObject();
                        jsonObject.put("id", doctor);
                        jsonObject.put("visit_status", 1);
                        jsonObject.put("waiting_count", waitCount);
                        jsonObject.put("visit_count", waitCount);
                        jsonObject.put("offline_count", 0);
                        jsonObject.put("ending_count", 0);
                        if (StringUtils.isNoneBlank((String) waitObj.get("doctorName"))) {
                            jsonObject.put("doctor_name", (String) waitObj.get("doctorName"));
                        } else {
@ -4230,6 +4234,115 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            }
        }
        //已结束
        String endSql = "SELECT count(op.id) AS \"endCount\"," +
                "room.doctor AS \"doctor\", " +
                "room.doctor_name AS \"doctorName\" " +
                "FROM wlyy_outpatient op,wlyy_hospital_waiting_room room " +
                "WHERE op.status=3 AND room.outpatient_id=op.id AND room.consult_type=2 " +
                "AND room.doctor IS NOT NULL ";
        if (StringUtils.isNoneBlank(dept)) {
            endSql = endSql + " and op.dept = '" + dept + "' ";
        }
        if ("xm_ykyy_wx".equals(wxId)) {
            if (flag){
                endSql += " AND room.reservation_time >= str_to_date('" + date + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                endSql += " AND room.reservation_time <= str_to_date('" + date + " 23:59:59','YYYY-MM-DD HH24:MI:SS') GROUP BY room.doctor,room.doctor_name";
            }else {
                endSql += " AND room.reservation_time >= to_date('" + date + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                endSql += " AND room.reservation_time <= to_date('" + date + " 23:59:59','YYYY-MM-DD HH24:MI:SS') GROUP BY room.doctor,room.doctor_name";
            }
        } else {
            endSql = endSql + "AND room.reservation_time>='" + date + " 00:00:00' AND room.reservation_time<='" + date + " 23:59:59' GROUP BY room.doctor,room.doctor_name; ";
        }
        List<Map<String, Object>> endlist = jdbcTemplate.queryForList(endSql);
        if (endlist != null && endlist.size() > 0) {
            //根据身份证计算年龄
            for (Map<String, Object> endObj : endlist) {
                String doctor = (String) endObj.get("doctor");
                if (StringUtils.isNoneBlank(doctor)) {
                    Long endCount = Long.parseLong(endObj.get("endCount").toString());
                    if (result.keySet().contains(doctor)) {
                        result.get(doctor).put("ending_count", endCount);
                    } else {
                        JSONObject jsonObject = new JSONObject();
                        jsonObject.put("id", doctor);
                        jsonObject.put("visit_status", 1);
                        jsonObject.put("visit_count",0);
                        jsonObject.put("offline_count", 0);
                        jsonObject.put("ending_count", endCount);
                        if (StringUtils.isNoneBlank((String) endObj.get("doctorName"))) {
                            jsonObject.put("doctor_name", (String) endObj.get("doctorName"));
                        } else {
                            jsonObject.put("doctor_name", "");
                        }
                        jsonObject.put("patient_name", "");
                        jsonObject.put("time_cost", 0);
                        result.put(doctor, jsonObject);
                    }
                }
            }
        }
        //离线
        String disconnectSql = "SELECT count(op.id) AS \"disconnectCount\"," +
                "room.doctor AS \"doctor\", " +
                "room.doctor_name AS \"doctorName\" " +
                "FROM wlyy_outpatient op,wlyy_hospital_waiting_room room ," +
                "base_patient p " +
                "WHERE  room.outpatient_id=op.id AND room.consult_type=2  AND p.id = op.patient" +
                " AND room.doctor IS NOT NULL and (p.online=0 OR P.online IS NULL) ";
        if (StringUtils.isNoneBlank(dept)) {
            disconnectSql = disconnectSql + " and op.dept = '" + dept + "' ";
        }
        if ("xm_ykyy_wx".equals(wxId)) {
            if (flag){
                disconnectSql += " AND room.reservation_time >= str_to_date('" + date + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                disconnectSql += " AND room.reservation_time <= str_to_date('" + date + " 23:59:59','YYYY-MM-DD HH24:MI:SS') GROUP BY room.doctor,room.doctor_name";
            }else {
                disconnectSql += " AND room.reservation_time >= to_date('" + date + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                disconnectSql += " AND room.reservation_time <= to_date('" + date + " 23:59:59','YYYY-MM-DD HH24:MI:SS') GROUP BY room.doctor,room.doctor_name";
            }
        } else {
            disconnectSql = disconnectSql + "AND room.reservation_time>='" + date + " 00:00:00' AND room.reservation_time<='" + date + " 23:59:59' GROUP BY room.doctor,room.doctor_name; ";
        }
        List<Map<String, Object>> disconnectlist = jdbcTemplate.queryForList(disconnectSql);
        if (disconnectlist != null && disconnectlist.size() > 0) {
            //根据身份证计算年龄
            for (Map<String, Object> endObj : endlist) {
                String doctor = (String) endObj.get("doctor");
                if (StringUtils.isNoneBlank(doctor)) {
                    Long disconnectCount = Long.parseLong(endObj.get("disconnectCount").toString());
                    if (result.keySet().contains(doctor)) {
                        result.get(doctor).put("offline_count", disconnectCount);
                    } else {
                        JSONObject jsonObject = new JSONObject();
                        jsonObject.put("id", doctor);
                        jsonObject.put("visit_status", 1);
                        jsonObject.put("ending_count",0);
                        jsonObject.put("visit_count",0);
                        jsonObject.put("offline_count", disconnectCount);
                        if (StringUtils.isNoneBlank((String) endObj.get("doctorName"))) {
                            jsonObject.put("doctor_name", (String) endObj.get("doctorName"));
                        } else {
                            jsonObject.put("doctor_name", "");
                        }
                        jsonObject.put("patient_name", "");
                        jsonObject.put("time_cost", 0);
                        result.put(doctor, jsonObject);
                    }
                }
            }
        }
        //获取进行中的居民
        String onlineSql = "SELECT " +
                "room.outpatient_id AS \"id\"," +

+ 16 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorDO.java

@ -239,6 +239,12 @@ public class BaseDoctorDO extends UuidIdentityEntityWithOperator {
     * 人气值
     */
    private Integer popularity;
    /**
     * 上线下线状态
     */
    private String online;//1上线0下线
    @Column(name = "popularity")
    public Integer getPopularity() {
        return popularity;
@ -603,4 +609,14 @@ public class BaseDoctorDO extends UuidIdentityEntityWithOperator {
    public void setLearning(String learning) {
        this.learning = learning;
    }
    @Column(name = "online")
    public String getOnline() {
        return online;
    }
    public void setOnline(String online) {
        this.online = online;
    }
}

+ 15 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BasePatientDO.java

@ -243,6 +243,11 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
    private String phone;
    /**
     * 上线下线状态
     */
    private String online;//1上线0下线
    @Column(name = "register")
    public String getRegister() {
        return register;
@ -645,4 +650,14 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
    public void setYktId(String yktId) {
        this.yktId = yktId;
    }
    @Column(name = "online")
    public String getOnline() {
        return online;
    }
    public void setOnline(String online) {
        this.online = online;
    }
}

+ 15 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/doctor/BaseDoctorVO.java

@ -196,6 +196,12 @@ public class BaseDoctorVO extends UuidIdentityVOWithOperator {
    @ApiModelProperty("医生归属科室")
    private List<String> department;
    /**
     * 上线下线状态
     */
    @ApiModelProperty("上线状态")
    private String online;//1上线0下线
    public String getPassword() {
        return password;
    }
@ -409,4 +415,13 @@ public class BaseDoctorVO extends UuidIdentityVOWithOperator {
    public void setDepartment(List<String> department) {
        this.department = department;
    }
    public String getOnline() {
        return online;
    }
    public void setOnline(String online) {
        this.online = online;
    }
}

+ 14 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/patient/BasePatientVO.java

@ -313,6 +313,11 @@ public class BasePatientVO extends UuidIdentityVOWithOperator {
    @ApiModelProperty(value = "备注", example = "某某备注")
    private String remark;
    /**
     * 上线下线状态
     */
    @ApiModelProperty("上线状态")
    private String online;//1上线0下线
    public String getSaasId() {
        return saasId;
@ -665,4 +670,13 @@ public class BasePatientVO extends UuidIdentityVOWithOperator {
    public void setAddress(String address) {
        this.address = address;
    }
    public String getOnline() {
        return online;
    }
    public void setOnline(String online) {
        this.online = online;
    }
}

+ 4 - 2
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java

@ -230,8 +230,10 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    public ObjEnvelop findDoctorInfo(@ApiParam(name = "doctor", value = "医生code")
                                     @RequestParam(value = "doctor", required = true)String doctor,
                                     @ApiParam(name = "withWork", value = "传1带排班,其他不带")
                                     @RequestParam(value = "withWork", required = false)String withWork){
        return success(prescriptionService.findDoctorInfo(doctor,withWork));
                                     @RequestParam(value = "withWork", required = false)String withWork,
                                     @ApiParam(name = "patient", value = "患者code")
                                         @RequestParam(value = "patient", required = false)String patient){
        return success(prescriptionService.findDoctorInfo(doctor,withWork,patient));
    }

+ 4 - 2
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java

@ -567,8 +567,10 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    public ObjEnvelop findDoctorInfo(@ApiParam(name = "doctor", value = "医生code")
                                     @RequestParam(value = "doctor", required = true)String doctor,
                                     @ApiParam(name = "withWork", value = "传1带排班,其他不带")
                                     @RequestParam(value = "withWork", required = false)String withWork){
        return success(prescriptionService.findDoctorInfo(doctor,withWork));
                                     @RequestParam(value = "withWork", required = false)String withWork,
                                     @ApiParam(name = "patient", value = "患者code")
                                         @RequestParam(value = "patient", required = false)String patient){
        return success(prescriptionService.findDoctorInfo(doctor,withWork,patient));
    }
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.updateDoctorInfo)