Explorar el Código

助老员部分

liubing hace 3 años
padre
commit
6062876bba
Se han modificado 43 ficheros con 1033 adiciones y 105 borrados
  1. 3 3
      business/im-service/src/main/java/com/yihu/jw/im/util/ImUtil.java
  2. 23 1
      common/common-entity/sql记录
  3. 2 1
      common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorDO.java
  4. 61 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/servicePackage/BasePatientHelperDO.java
  5. 1 1
      common/common-entity/src/main/java/com/yihu/jw/entity/base/servicePackage/ServicePackageSignRecordDO.java
  6. 1 1
      common/common-entity/src/main/java/com/yihu/jw/entity/care/device/PatientSafeAreaConfirm.java
  7. 1 1
      common/common-entity/src/main/java/com/yihu/jw/entity/care/message/BaseServiceNews.java
  8. 1 1
      common/common-entity/src/main/java/com/yihu/jw/entity/care/securitymonitoring/BaseEmergencyWarnLogDO.java
  9. 27 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/visit/BaseVisitDO.java
  10. 3 3
      server/svr-authentication/src/main/java/com/yihu/jw/security/utils/ImUtil.java
  11. 15 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/sign/BasePatientHelperDao.java
  12. 49 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/assistance/EmergencyAssistanceEndpoint.java
  13. 26 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doctor/DoctorEndpoint.java
  14. 19 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doctor/DoctorToDoWorkEndpoint.java
  15. 36 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/label/PatientLabelEndpoint.java
  16. 1 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/safeArea/DoctorSafeAreaController.java
  17. 1 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/security/SecurityMonitoringOrderEndpoint.java
  18. 59 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/sign/SignEndpoint.java
  19. 2 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/statistics/DetectionPlatformEndpoint.java
  20. 1 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/statistics/OpenStatisticsEndpoint.java
  21. 1 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/third/platForm/PatientInfoPlatFormEndpoint.java
  22. 8 3
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/visit/VisitEndpoint.java
  23. 1 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/activity/ChildActivityRegistrationService.java
  24. 2 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/apply/PatientBedApplyService.java
  25. 170 11
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/assistance/EmergencyAssistanceService.java
  26. 43 4
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/birthday/BirthdayWishesService.java
  27. 7 3
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/consult/ConsultTeamService.java
  28. 2 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/PatientDeviceService.java
  29. 55 5
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doctor/CareDoctorService.java
  30. 68 4
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/label/PatientLableService.java
  31. 87 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/message/DoctorMessageService.java
  32. 2 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/patient/CarePatientService.java
  33. 2 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/patient/OnlineContactService.java
  34. 60 23
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/security/SecurityMonitoringOrderService.java
  35. 41 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/ArchiveService.java
  36. 28 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/CapacityAssessmentRecordService.java
  37. 101 10
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/ServicePackageService.java
  38. 4 4
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/statistics/StatisticsService.java
  39. 4 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/visit/BaseVisitService.java
  40. 1 1
      svr/svr-cloud-job/src/main/java/com/yihu/jw/care/event/ApplicationEvent.java
  41. 8 0
      svr/svr-cloud-job/src/main/java/com/yihu/jw/care/service/BirthdayReminderService.java
  42. 1 1
      svr/svr-cloud-job/src/main/java/com/yihu/jw/care/service/device/PressureGlucoseNotService.java
  43. 5 0
      svr/svr-cloud-job/src/main/java/com/yihu/jw/care/util/DeviceLostMessageUtil.java

+ 3 - 3
business/im-service/src/main/java/com/yihu/jw/im/util/ImUtil.java

@ -865,7 +865,7 @@ public class ImUtil {
	/**
	/**
	 * 获取在线人数
	 * 获取在线人数
	 * helper 助老员,teacher 教师,child 幼儿,olderWx 老人公众号,olderPad 老人平板
	 * helper 社工,teacher 教师,child 幼儿,olderWx 老人公众号,olderPad 老人平板
	 */
	 */
	public String getOnlineCountByType(String type) {
	public String getOnlineCountByType(String type) {
		String url = im_host + "api/v2/sessions/getOnlineCountByType?type="+type;
		String url = im_host + "api/v2/sessions/getOnlineCountByType?type="+type;
@ -875,7 +875,7 @@ public class ImUtil {
	/**
	/**
	 * 获取在线人数列表
	 * 获取在线人数列表
	 * helper 助老员,teacher 教师,child 幼儿,olderWx 老人公众号,olderPad 老人平板
	 * helper 社工,teacher 教师,child 幼儿,olderWx 老人公众号,olderPad 老人平板
	 */
	 */
	public String getOnlineListByType(String type) {
	public String getOnlineListByType(String type) {
		String url = im_host + "api/v2/sessions/getOnlineListByType?type="+type;
		String url = im_host + "api/v2/sessions/getOnlineListByType?type="+type;
@ -885,7 +885,7 @@ public class ImUtil {
	/**
	/**
	 * 获取在线状态
	 * 获取在线状态
	 * helper 助老员,teacher 教师,child 幼儿,older 老人
	 * helper 社工,teacher 教师,child 幼儿,older 老人
	 * 返回 {"status":200,"data":1} data>0 说明在线 data =0 不在线
	 * 返回 {"status":200,"data":1} data>0 说明在线 data =0 不在线
	 */
	 */
	public String findByUserIdAndType(String userId,String type) {
	public String findByUserIdAndType(String userId,String type) {

+ 23 - 1
common/common-entity/sql记录

@ -1671,4 +1671,26 @@ ALTER table base_life_care_item_dict add COLUMN serve_standard VARCHAR(200) DEFA
ALTER table base_life_care_item_dict add COLUMN org_code varchar(50) DEFAULT NULL COMMENT '服务机构';
ALTER table base_life_care_item_dict add COLUMN org_code varchar(50) DEFAULT NULL COMMENT '服务机构';
ALTER table base_life_care_item_dict add COLUMN org_name varchar(50) DEFAULT NULL COMMENT '服务机构名称';
ALTER table base_life_care_item_dict add COLUMN org_name varchar(50) DEFAULT NULL COMMENT '服务机构名称';
ALTER table base_life_care_item_dict MODIFY COLUMN `code` varchar(10) DEFAULT NULL;
ALTER table base_life_care_item_dict MODIFY COLUMN `code` varchar(10) DEFAULT NULL;
ALTER table base_patient add COLUMN `home_state` TINYINT(2) DEFAULT NULL COMMENT '居家状态:1居家0离家';
ALTER table base_patient add COLUMN `home_state` TINYINT(2) DEFAULT NULL COMMENT '居家状态:1居家0离家';
-- 2022-03-11
CREATE TABLE `base_patient_helper` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `patient` varchar(50) DEFAULT NULL,
  `patient_name` varchar(50) DEFAULT NULL,
  `doctor` varchar(50) DEFAULT NULL,
  `doctor_name` varchar(50) DEFAULT NULL,
   del varchar(1) DEFAULT NULL COMMENT '状态(1有效0无效)',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `create_user` varchar(50) DEFAULT NULL ,
  `create_user_name` varchar(50) DEFAULT NULL,
  `update_time` timestamp  DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
  `update_user` varchar(50) DEFAULT NULL ,
  `update_user_name` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='助老员老人关联表';
--
ALTER table base_visit add COLUMN `device_maintenance` VARCHAR(500) DEFAULT NULL COMMENT '设备维护';
ALTER table base_visit add COLUMN `health` VARCHAR(500) DEFAULT NULL COMMENT '健康情况';
ALTER table base_visit add COLUMN `life_consult` VARCHAR(500) DEFAULT NULL COMMENT '生活咨询';

+ 2 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorDO.java

@ -285,7 +285,8 @@ public class BaseDoctorDO extends UuidIdentityEntityWithOperator {
    private String visitTime;
    private String visitTime;
    /**
    /**
     * 类型 1社区医生,2助老员, 3教师
     *
     * 类型 1社区医生,2社工, 3教师,4助老员
     */
     */
    private Integer level;
    private Integer level;
    private String doctorLat;//医生当前定位地址纬度
    private String doctorLat;//医生当前定位地址纬度

+ 61 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/servicePackage/BasePatientHelperDO.java

@ -0,0 +1,61 @@
package com.yihu.jw.entity.base.servicePackage;
import com.yihu.jw.entity.IntegerIdentityEntityWithOperator;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created by Bing on 2022/3/11.
 * 老人助老员关联实体
 */
@Entity
@Table(name = "base_patient_helper")
public class BasePatientHelperDO extends IntegerIdentityEntityWithOperator {
    private String patient;
    private String patientName;
    private String doctor;
    private String doctorName;
    private String del;//状态(1有效0无效)
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    public String getPatientName() {
        return patientName;
    }
    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
}

+ 1 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/base/servicePackage/ServicePackageSignRecordDO.java

@ -35,7 +35,7 @@ public class ServicePackageSignRecordDO extends UuidIdentityEntityWithCreateTime
    //社区医生
    //社区医生
    private List<Map<String,Object>> doctorList;
    private List<Map<String,Object>> doctorList;
    //助老员
    //社工
    private List<Map<String,Object>> helperList;
    private List<Map<String,Object>> helperList;
    //服务包
    //服务包
    private List<Map<String,Object>> packageList;
    private List<Map<String,Object>> packageList;

+ 1 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/care/device/PatientSafeAreaConfirm.java

@ -16,7 +16,7 @@ import java.util.Date;
public class PatientSafeAreaConfirm extends IdEntity {
public class PatientSafeAreaConfirm extends IdEntity {
    private String patient;
    private String patient;
    private String doctorCode;//助老员code
    private String doctorCode;//社工code
    private String safeId; //安全区域id 关联居民电子围栏id
    private String safeId; //安全区域id 关联居民电子围栏id
    private String del;//作废标识,1正常,0作废
    private String del;//作废标识,1正常,0作废
    private Integer manageStatus;//电子围栏确认情况 0待确认 1已确认
    private Integer manageStatus;//电子围栏确认情况 0待确认 1已确认

+ 1 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/care/message/BaseServiceNews.java

@ -25,7 +25,7 @@ public class BaseServiceNews extends UuidIdentityEntityWithCreateTime {
    //类型 1上门辅导、2发起咨询、3发起生活照料、4生活照料代预约
    //类型 1上门辅导、2发起咨询、3发起生活照料、4生活照料代预约
    private String type;
    private String type;
    private String relationCode;//type对应工单id 或咨询id
    private String relationCode;//type对应工单id 或咨询id
    private Integer userType;//用户类型 1居民 2助老员
    private Integer userType;//用户类型 1居民 2社工
    private Integer archiveType;//居民类型
    private Integer archiveType;//居民类型
    private String residentialArea;//居住小区;
    private String residentialArea;//居住小区;

+ 1 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/care/securitymonitoring/BaseEmergencyWarnLogDO.java

@ -19,7 +19,7 @@ public class BaseEmergencyWarnLogDO extends IdEntity {
    public String orderId;
    public String orderId;
    public String userCode;
    public String userCode;
    public String userName;
    public String userName;
    public Integer userType; //用户类型 1居民 2助老员
    public Integer userType; //用户类型 1居民 2社工
    public String content;
    public String content;
    public Date createTime;
    public Date createTime;

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

@ -24,6 +24,9 @@ public class BaseVisitDO extends UuidIdentityEntityWithCreateTime {
    private String doctorName;
    private String doctorName;
    private String visitContent;//走访记录
    private String visitContent;//走访记录
    private String visitImg;//走访图片
    private String visitImg;//走访图片
    private String deviceMaintenance;//设备维护
    private String health;//健康情况
    private String lifeConsult;//生活咨询
    @Column(name = "patient")
    @Column(name = "patient")
    public String getPatient() {
    public String getPatient() {
@ -114,4 +117,28 @@ public class BaseVisitDO extends UuidIdentityEntityWithCreateTime {
    public void setVisitImg(String visitImg) {
    public void setVisitImg(String visitImg) {
        this.visitImg = visitImg;
        this.visitImg = visitImg;
    }
    }
    public String getDeviceMaintenance() {
        return deviceMaintenance;
    }
    public void setDeviceMaintenance(String deviceMaintenance) {
        this.deviceMaintenance = deviceMaintenance;
    }
    public String getHealth() {
        return health;
    }
    public void setHealth(String health) {
        this.health = health;
    }
    public String getLifeConsult() {
        return lifeConsult;
    }
    public void setLifeConsult(String lifeConsult) {
        this.lifeConsult = lifeConsult;
    }
}
}

+ 3 - 3
server/svr-authentication/src/main/java/com/yihu/jw/security/utils/ImUtil.java

@ -864,7 +864,7 @@ public class ImUtil {
	/**
	/**
	 * 获取在线人数
	 * 获取在线人数
	 * helper 助老员,teacher 教师,child 幼儿,olderWx 老人公众号,olderPad 老人平板
	 * helper 社工,teacher 教师,child 幼儿,olderWx 老人公众号,olderPad 老人平板
	 */
	 */
	public String getOnlineCountByType(String type) {
	public String getOnlineCountByType(String type) {
		String url = im_host + "api/v2/sessions/getOnlineCountByType?type="+type;
		String url = im_host + "api/v2/sessions/getOnlineCountByType?type="+type;
@ -874,7 +874,7 @@ public class ImUtil {
	/**
	/**
	 * 获取在线人数列表
	 * 获取在线人数列表
	 * helper 助老员,teacher 教师,child 幼儿,olderWx 老人公众号,olderPad 老人平板
	 * helper 社工,teacher 教师,child 幼儿,olderWx 老人公众号,olderPad 老人平板
	 */
	 */
	public String getOnlineListByType(String type) {
	public String getOnlineListByType(String type) {
		String url = im_host + "api/v2/sessions/getOnlineListByType?type="+type;
		String url = im_host + "api/v2/sessions/getOnlineListByType?type="+type;
@ -884,7 +884,7 @@ public class ImUtil {
	/**
	/**
	 * 获取在线状态
	 * 获取在线状态
	 * helper 助老员,teacher 教师,child 幼儿,older 老人
	 * helper 社工,teacher 教师,child 幼儿,older 老人
	 * 返回 {"status":200,"data":1} data>0 说明在线 data =0 不在线
	 * 返回 {"status":200,"data":1} data>0 说明在线 data =0 不在线
	 */
	 */
	public String findByUserIdAndType(String userId,String type) {
	public String findByUserIdAndType(String userId,String type) {

+ 15 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/sign/BasePatientHelperDao.java

@ -0,0 +1,15 @@
package com.yihu.jw.care.dao.sign;
import com.yihu.jw.entity.base.servicePackage.BasePatientHelperDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Bing on 2022/3/11.
 */
public interface BasePatientHelperDao extends PagingAndSortingRepository<BasePatientHelperDO,Long>,
        JpaSpecificationExecutor<BasePatientHelperDO> {
    @Query("select p from BasePatientHelperDO p where p.patient=?1 and p.doctor=?2 and p.del=1 ")
    BasePatientHelperDO findByPatientAndDoctor(String patient,String doctor);
}

+ 49 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/assistance/EmergencyAssistanceEndpoint.java

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.aop.ObserverRequired;
import com.yihu.jw.care.aop.ObserverRequired;
import com.yihu.jw.care.aop.ServicesAuth;
import com.yihu.jw.care.aop.ServicesAuth;
import com.yihu.jw.care.service.assistance.EmergencyAssistanceService;
import com.yihu.jw.care.service.assistance.EmergencyAssistanceService;
import com.yihu.jw.care.service.security.SecurityMonitoringOrderService;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
@ -25,6 +26,8 @@ public class EmergencyAssistanceEndpoint extends EnvelopRestEndpoint {
    @Autowired
    @Autowired
    private EmergencyAssistanceService assistanceService;
    private EmergencyAssistanceService assistanceService;
    @Autowired
    private SecurityMonitoringOrderService securityMonitoringOrderService;
    @PostMapping(value = "newOrder")
    @PostMapping(value = "newOrder")
    @ApiOperation(value = "居民发起新的紧急救助")
    @ApiOperation(value = "居民发起新的紧急救助")
@ -320,7 +323,7 @@ public class EmergencyAssistanceEndpoint extends EnvelopRestEndpoint {
    }
    }
    @PostMapping("doctorSendMessageLog")
    @PostMapping("doctorSendMessageLog")
    @ApiOperation(value = "助老员紧急预警im发送消息日志")
    @ApiOperation(value = "社工紧急预警im发送消息日志")
    @ObserverRequired
    @ObserverRequired
    public ObjEnvelop doctorSendMessageLog(
    public ObjEnvelop doctorSendMessageLog(
            @ApiParam(name="doctor")@RequestParam(value = "doctor")String doctor,
            @ApiParam(name="doctor")@RequestParam(value = "doctor")String doctor,
@ -334,4 +337,49 @@ public class EmergencyAssistanceEndpoint extends EnvelopRestEndpoint {
        }
        }
    }
    }
    /******************************************助老员部分********************************************/
    @GetMapping(value = "helper/getEmeAndSecuOrderList")
    @ApiOperation(value = "助老员获取安防与紧急呼叫工单列总和")
    public ListEnvelop getEmeAndSecuOrderList(@ApiParam(name="patientId",value = "居民id")
                                    @RequestParam(value = "patientId",required = false) String patientId,
                                    @ApiParam(name="patientName",value = "患者姓名/身份证")
                                    @RequestParam(value = "patientName",required = false) String patientName,
                                    @ApiParam(name="doctor",value = "查看医生")
                                    @RequestParam(value = "doctor",required = true) String doctor,
                                    @ApiParam(name="status",value = "工单状态-2误报警-1已取消0已完成1申请中")
                                    @RequestParam(value = "status",required = false) String status,
                                    @ApiParam(name="svrDesc",value = "安防工单服务类型 关联security_server_dict字典")
                                    @RequestParam(value = "svrDesc",required = false)String svrDesc,
                                    @ApiParam(name="orderType",value = "工单类型,20紧急呼叫22安防工单")
                                    @RequestParam(value = "orderType",required = true)String orderType,
                                    @ApiParam(name="page",value = "page")
                                    @RequestParam(value = "page",required = true) Integer page,
                                    @ApiParam(name="pageSize",value = "pageSize")
                                    @RequestParam(value = "pageSize",required = true) Integer pageSize
    ){
        try {
            if (StringUtils.isBlank(patientId)&&StringUtils.isBlank(doctor)){
                return ListEnvelop.getError("请求参数错误");
            }
            return ListEnvelop.getSuccess( "查询成功",assistanceService.getEmeAndSecuOrderList(orderType,patientId,patientName,doctor,status,page,pageSize,svrDesc));
        }catch (Exception e){
            return failedListEnvelopException2(e);
        }
    }
    @GetMapping(value = "helper/getEmeAndSecuOrderTab")
    @ApiOperation(value = "助老员获取安防与紧急呼叫工单Tab")
    public ObjEnvelop getEmeAndSecuOrderTab(@ApiParam(name="orderType",value = "工单类型,20紧急呼叫22安防工单")
                                             @RequestParam(value = "orderType",required = true)String orderType,
                                             @ApiParam(name="doctor",value = "查看医生")
                                             @RequestParam(value = "doctor",required = true) String doctor){
        try {
            return ObjEnvelop.getSuccess( "查询成功",assistanceService.getEmeAndSecuOrderTab(orderType,doctor));
        }catch (Exception e){
            return failedObjEnvelopException2(e);
        }
    }
}
}

+ 26 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doctor/DoctorEndpoint.java

@ -224,7 +224,7 @@ public class DoctorEndpoint extends EnvelopRestEndpoint {
    }
    }
    @GetMapping(value = "getNotificationCount")
    @GetMapping(value = "getNotificationCount")
    @ApiOperation(value = "教师首页-上门辅导待完成工单、在线咨询未回复、消息列表未回复")
    @ApiOperation(value = "上门辅导待完成工单、在线咨询未回复、消息列表未回复")
    public ObjEnvelop getNotificationCount(
    public ObjEnvelop getNotificationCount(
            @ApiParam(name = "doctor", value = "doctor", defaultValue = "4028030c796376b801796380a2b50003") @RequestParam(value = "doctor",required = true) String doctor
            @ApiParam(name = "doctor", value = "doctor", defaultValue = "4028030c796376b801796380a2b50003") @RequestParam(value = "doctor",required = true) String doctor
//            ,@ApiParam(name = "type", value = "type", defaultValue = "0") @RequestParam(value = "type",required = false) Integer type
//            ,@ApiParam(name = "type", value = "type", defaultValue = "0") @RequestParam(value = "type",required = false) Integer type
@ -266,7 +266,7 @@ public class DoctorEndpoint extends EnvelopRestEndpoint {
    }
    }
    @GetMapping(value = "/baseInfoCount")
    @GetMapping(value = "/baseInfoCount")
    @ApiOperation(value = "医生首页服务数量获取")
    @ApiOperation(value = "首页养老服务数量获取")
    public ObjEnvelop baseInfoCount(@ApiParam(name="doctor")@RequestParam(value = "doctor")String doctor){
    public ObjEnvelop baseInfoCount(@ApiParam(name="doctor")@RequestParam(value = "doctor")String doctor){
        try {
        try {
            return ObjEnvelop.getSuccess("查询成功",doctorService.baseInfoCount(doctor)) ;
            return ObjEnvelop.getSuccess("查询成功",doctorService.baseInfoCount(doctor)) ;
@ -296,4 +296,28 @@ public class DoctorEndpoint extends EnvelopRestEndpoint {
            return failedException2(e);
            return failedException2(e);
        }
        }
    }
    }
    /*******************************助老员部分**********************************************/
    @GetMapping(value = "helper/baseInfoCount")
    @ApiOperation(value = "首页养老服务数量获取")
    public ObjEnvelop baseHelperInfoCount(@ApiParam(name="doctor")@RequestParam(value = "doctor")String doctor){
        try {
            return ObjEnvelop.getSuccess("查询成功",doctorService.baseHelperInfoCount(doctor)) ;
        }catch (Exception e){
            return failedObjEnvelopException2(e);
        }
    }
    @GetMapping(value = "helper/patientCount")
    @ApiOperation(value = "获取我的居民统计数量")
    public ObjEnvelop helperPatientCount (
            @ApiParam(name = "doctorId", value = "医生id", required = true)
            @RequestParam(value = "doctorId",required = true) String doctorId){
        try{
            return ObjEnvelop.getSuccess("查询成功",capacityAssessmentRecordService.getHelperPatientNum(doctorId));
        }catch (Exception e){
            return failedObjEnvelopException2(e);
        }
    }
}
}

+ 19 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doctor/DoctorToDoWorkEndpoint.java

@ -15,13 +15,13 @@ import org.springframework.web.bind.annotation.RestController;
/***
/***
 * @ClassName: DoctorToDoWorkEndpoint
 * @ClassName: DoctorToDoWorkEndpoint
 * @Description: 助老员 待办工作
 * @Description: 社工 待办工作
 * @Auther: shi kejing
 * @Auther: shi kejing
 * @Date: 2021/5/8 17:42
 * @Date: 2021/5/8 17:42
 */
 */
@RestController
@RestController
@RequestMapping(value = "doctor/todowork")
@RequestMapping(value = "doctor/todowork")
@Api(description = "助老员 - 待办工作")
@Api(description = "社工 - 待办工作")
public class DoctorToDoWorkEndpoint extends EnvelopRestEndpoint {
public class DoctorToDoWorkEndpoint extends EnvelopRestEndpoint {
    @Autowired
    @Autowired
@ -67,4 +67,21 @@ public class DoctorToDoWorkEndpoint extends EnvelopRestEndpoint {
            return failedPageEnvelopException2(e);
            return failedPageEnvelopException2(e);
        }
        }
    }
    }
    /*************************************助老员部分*************************************************/
    @GetMapping(value = "helper/todowork")
    @ApiOperation("待办工作")
    public ObjEnvelop helperMessages(@ApiParam(name = "serviceSype", value = "工作类型: 生活照料,安防监护=preventLost,紧急救助=emergencyAssistance,生活照料=fifeCare")
                               @RequestParam(value = "serviceSype", required = false) String serviceSype,
                               @ApiParam(name = "id", value = "查看详情需要传id")
                               @RequestParam(value = "id", required = false) String id,
                               @ApiParam(name = "doctor", value = "doctor")
                               @RequestParam(value = "doctor", required = true) String doctor){
        try {
            return ObjEnvelop.getSuccess("查询成功",doctorMessageService.getHelperPreventLost(doctor,id,serviceSype));
        }catch (Exception e){
            return failedObjEnvelopException2(e);
        }
    }
}
}

+ 36 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/label/PatientLabelEndpoint.java

@ -62,4 +62,40 @@ public class PatientLabelEndpoint extends EnvelopRestEndpoint {
        }
        }
    }
    }
    /**********************************助老员部分***************************************************/
    @GetMapping(value = "helper/findSignPatientLabelList")
    @ApiOperation(value = "助老员标签查找签约居民")
    public PageEnvelop<List<Map<String,Object>>> findSignPatientLabelList (
            @ApiParam(name = "doctor", value = "医生code", required = true)
            @RequestParam(value = "doctor",required = true) String doctor,
            @ApiParam(name = "labelCode", value = "标签", required = false)
            @RequestParam(value = "labelCode",required = false) String labelCode,
            @ApiParam(name = "name", value = "姓名或身份证", required = false)
            @RequestParam(value = "name",required = false) String name,
            @ApiParam(name = "topicItem", value = "专题code,关联security_topic_dict字典", required = false)//有绑定相关专题设备
            @RequestParam(value = "topicItem",required = false) String topicItem,
            @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 {
        try{
            return patientLableService.findSignPatientLabelList(doctor,labelCode, name,topicItem, page, size);
        }catch (Exception e){
            return failedPageEnvelopException2(e);
        }
    }
    @GetMapping(value = "helper/findSignPatientLabelNum")
    @ApiOperation(value = "助老员查找签约居民的标签统计")
    public ListEnvelop findSignPatientLabelNum (
            @ApiParam(name = "doctor", value = "医生code", required = true)
            @RequestParam(value = "doctor",required = true) String doctor) {
        try{
            return ListEnvelop.getSuccess("查询成功",patientLableService.findSignPatientLabelNum(doctor));
        }catch (Exception e){
            return failedListEnvelopException2(e);
        }
    }
}
}

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/safeArea/DoctorSafeAreaController.java

@ -30,7 +30,7 @@ public class DoctorSafeAreaController extends EnvelopRestEndpoint {
    @Autowired
    @Autowired
    private SafeAreaService safeAreaService;
    private SafeAreaService safeAreaService;
    @ApiOperation("助老员新增电子围栏记录")
    @ApiOperation("社工新增电子围栏记录")
    @ObserverRequired
    @ObserverRequired
    @RequestMapping(value = "doctorNewSafeArea",method = RequestMethod.GET)
    @RequestMapping(value = "doctorNewSafeArea",method = RequestMethod.GET)
    public ObjEnvelop doctorNewSafeArea(@ApiParam(name = "doctor",value = "doctor")
    public ObjEnvelop doctorNewSafeArea(@ApiParam(name = "doctor",value = "doctor")

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/security/SecurityMonitoringOrderEndpoint.java

@ -363,7 +363,7 @@ public class SecurityMonitoringOrderEndpoint extends EnvelopRestEndpoint {
        }
        }
    }
    }
    @ApiOperation("助老员端获取日常监护居民")
    @ApiOperation("社工端获取日常监护居民")
    @GetMapping(value = "findMonitorPatientsByDoctor")
    @GetMapping(value = "findMonitorPatientsByDoctor")
    @ResponseBody
    @ResponseBody
    public ObjEnvelop findMonitorPatientsByDoctor(@ApiParam(name = "doctor",  required = true)@RequestParam(value = "doctor")String doctor,
    public ObjEnvelop findMonitorPatientsByDoctor(@ApiParam(name = "doctor",  required = true)@RequestParam(value = "doctor")String doctor,

+ 59 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/sign/SignEndpoint.java

@ -32,7 +32,7 @@ import java.util.Map;
 */
 */
@RestController
@RestController
@RequestMapping(value = "sign")
@RequestMapping(value = "sign")
@Api(value = "签约相关", description = "签约相关", tags = {"签约相关"})
@Api(value = "社工签约相关", description = "签约相关", tags = {"签约相关"})
public class SignEndpoint extends EnvelopRestEndpoint {
public class SignEndpoint extends EnvelopRestEndpoint {
    @Autowired
    @Autowired
@ -667,4 +667,62 @@ public class SignEndpoint extends EnvelopRestEndpoint {
        }
        }
    }
    }
    /****************************助老员部分*******************************************/
    @PostMapping(value = "helper/addPatient")
    @ApiOperation(value = "助老员添加监护居民")
    public Envelop helperAddPatient(
            @ApiParam(name = "patient",value = "添加居民id",required = true)
            @RequestParam(value = "patient")String patient,
            @ApiParam(name = "doctor",value = "当前操作助老员id",required = true)
            @RequestParam(value = "doctor")String doctor
            ){
        try {
            JSONObject result = servicePackageService.helperAddPatient(patient,doctor);
            return success(result.getString(ResponseContant.resultMsg),result.getIntValue(ResponseContant.resultFlag));
        }catch (Exception e){
           return failedException2(e);
        }
    }
    @PostMapping(value = "helper/delPatient")
    @ApiOperation(value = "助老员删除监护居民")
    public Envelop helperDelPatient(
            @ApiParam(name = "patient",value = "添加居民id",required = true)
            @RequestParam(value = "patient")String patient,
            @ApiParam(name = "doctor",value = "当前操作助老员id",required = true)
            @RequestParam(value = "doctor")String doctor
    ){
        try {
            JSONObject result = servicePackageService.helperDelPatient(patient,doctor);
            return success(result.getString(ResponseContant.resultMsg),result.getIntValue(ResponseContant.resultFlag));
        }catch (Exception e){
            return failedException2(e);
        }
    }
    @PostMapping(value = "helper/patientList")
    @ApiOperation(value = "助老员获取监护居民列表")
    public PageEnvelop<List<Map<String,Object>>> helperArchiveList(
            @ApiParam(name = "doctorId", value = "医生id", required = false)
            @RequestParam(value = "doctorId",required = false) String doctorId,
            @ApiParam(name = "userRole", value = "管理员权限,没有传空", required = false)
            @RequestParam(value = "userRole",required = false) String userRole,
            @ApiParam(name = "name", value = "居民姓名", required = false)
            @RequestParam(value = "name",required = false) String name,
            @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 {
        try{
            if (StringUtils.isBlank(doctorId)&&StringUtils.isBlank(name)){
                return PageEnvelop.getError("请求参数错误");
            }
            return archiveService.helperArchiveList(doctorId,userRole,page,size,name);
        }catch (Exception e){
            return failedPageEnvelopException2(e);
        }
    }
}
}

+ 2 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/statistics/DetectionPlatformEndpoint.java

@ -296,7 +296,7 @@ public class DetectionPlatformEndpoint extends EnvelopRestEndpoint {
        }
        }
    }
    }
    @ApiOperation("助老员端获取日常监护居民")
    @ApiOperation("社工端获取日常监护居民")
    @GetMapping(value = "findMonitorPatientsByDoctor")
    @GetMapping(value = "findMonitorPatientsByDoctor")
    @ResponseBody
    @ResponseBody
    public ObjEnvelop findMonitorPatientsByDoctor(
    public ObjEnvelop findMonitorPatientsByDoctor(
@ -317,7 +317,7 @@ public class DetectionPlatformEndpoint extends EnvelopRestEndpoint {
        }
        }
    }
    }
    @ApiOperation("助老员端获取日常监护居民")
    @ApiOperation("社工端获取日常监护居民")
    @GetMapping(value = "findSignOlder")
    @GetMapping(value = "findSignOlder")
    @ResponseBody
    @ResponseBody
    public ObjEnvelop findSignOlder(
    public ObjEnvelop findSignOlder(

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

@ -210,7 +210,7 @@ public class OpenStatisticsEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value = "findUserByType")
    @GetMapping(value = "findUserByType")
    @ApiOperation(value = "人员实时动态搜索")
    @ApiOperation(value = "人员实时动态搜索")
    public Envelop findUserByType(@ApiParam(name = "type", value = "类型:1幼儿,2老人,3助老员,4医生,5老人家属。不传返回四个类型的数据")
    public Envelop findUserByType(@ApiParam(name = "type", value = "类型:1幼儿,2老人,3社工,4医生,5老人家属。不传返回四个类型的数据")
                                  @RequestParam(value = "type", required = false) String type,
                                  @RequestParam(value = "type", required = false) String type,
                                  @ApiParam(name = "name", value = "姓名")
                                  @ApiParam(name = "name", value = "姓名")
                                  @RequestParam(value = "name", required = false) String name,
                                  @RequestParam(value = "name", required = false) String name,

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/third/platForm/PatientInfoPlatFormEndpoint.java

@ -82,7 +82,7 @@ public class PatientInfoPlatFormEndpoint extends EnvelopRestEndpoint {
    }
    }
    @GetMapping(value = "getLatLon")
    @GetMapping(value = "getLatLon")
    @ApiOperation("查询所有助老员坐标")
    @ApiOperation("查询所有社工坐标")
    public ListEnvelop getLatLon(){
    public ListEnvelop getLatLon(){
        try {
        try {
            return ListEnvelop.getSuccess("查询成功",baseServiceNewsService.getLatLon());
            return ListEnvelop.getSuccess("查询成功",baseServiceNewsService.getLatLon());

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

@ -119,9 +119,15 @@ public class VisitEndpoint extends EnvelopRestEndpoint {
                            @ApiParam(name = "visitContent", value = "走访记录")
                            @ApiParam(name = "visitContent", value = "走访记录")
                            @RequestParam(value = "visitContent", required = true) String visitContent,
                            @RequestParam(value = "visitContent", required = true) String visitContent,
                            @ApiParam(name = "visitImg", value = "走访图片")
                            @ApiParam(name = "visitImg", value = "走访图片")
                            @RequestParam(value = "visitImg", required = true) String visitImg) {
                            @RequestParam(value = "visitImg", required = true) String visitImg,
                            @ApiParam(name = "deviceMaintenance", value = "设备维护")
                            @RequestParam(value = "deviceMaintenance", required = false) String deviceMaintenance,
                            @ApiParam(name = "health", value = "健康情况")
                            @RequestParam(value = "health", required = false) String health,
                            @ApiParam(name = "lifeConsult", value = "生活咨询")
                            @RequestParam(value = "lifeConsult", required = false) String lifeConsult) {
        try {
        try {
            String result = baseVisitService.completeVisit(id,visitContent,visitImg);
            String result = baseVisitService.completeVisit(id,visitContent,visitImg,deviceMaintenance,health,lifeConsult);
            if(StringUtils.isNotBlank(result)){
            if(StringUtils.isNotBlank(result)){
                return Envelop.getError("操作失败:"+result,-1);
                return Envelop.getError("操作失败:"+result,-1);
            }
            }
@ -148,5 +154,4 @@ public class VisitEndpoint extends EnvelopRestEndpoint {
            return failedException2(e);
            return failedException2(e);
        }
        }
    }
    }
}
}

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/activity/ChildActivityRegistrationService.java

@ -73,7 +73,7 @@ public class ChildActivityRegistrationService {
     * @param size
     * @param size
     */
     */
    public PageEnvelop childActivityRegistrationList(String patient,String activityType,String orgCode, int page, int size){
    public PageEnvelop childActivityRegistrationList(String patient,String activityType,String orgCode, int page, int size){
        String sql = "SELECT a.id,a.activity_type activityType,a.patient,p.name,p.sex,p.idcard,p.photo,org.code,org.name orgName,DATE_FORMAT(a.create_time,'%Y-%m-%d %H:%i:%S') create_time from base_child_activity_registration a " +
        String sql = "SELECT a.id,a.activity_type activityType,a.patient,p.name,p.sex,p.idcard,p.archive_type archiveType,p.photo,org.code,org.name orgName,DATE_FORMAT(a.create_time,'%Y-%m-%d %H:%i:%S') create_time from base_child_activity_registration a " +
                "LEFT JOIN base_org org on a.org_code = org.code ,base_patient p " +
                "LEFT JOIN base_org org on a.org_code = org.code ,base_patient p " +
                "WHERE a.patient = p.id";
                "WHERE a.patient = p.id";

+ 2 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/apply/PatientBedApplyService.java

@ -70,7 +70,7 @@ public class PatientBedApplyService extends BaseJpaService<PatientBedApplyDo, Pa
        else {
        else {
            //
            //
            String sql = " select count(*) from base_patient p,base_service_package_sign_record sr, base_service_package_record pr,base_service_package pack\n" +
            String sql = " select count(*) from base_patient p,base_service_package_sign_record sr, base_service_package_record pr,base_service_package pack\n" +
                    "where p.idcard = '"+idcard+"' and p.id = sr.patient and sr.id = pr.sign_id and pr.service_package_id = pack.id and sr.`status`=1 and pack.del=1 ";
                    "where p.idcard = '"+idcard+"' and p.id = sr.patient and sr.id = pr.sign_id and pr.service_package_id = pack.id and sr.`status`=1 and p.del=1 and pack.del=1 ";
            Integer count = jdbcTemplate.queryForObject(sql,Integer.class);
            Integer count = jdbcTemplate.queryForObject(sql,Integer.class);
            if (count>0){
            if (count>0){
                String failMsg = "居民已签约,无法进行床位申请";
                String failMsg = "居民已签约,无法进行床位申请";
@ -113,7 +113,7 @@ public class PatientBedApplyService extends BaseJpaService<PatientBedApplyDo, Pa
    public List<Map<String,Object>> getApplyList(String doctor){
    public List<Map<String,Object>> getApplyList(String doctor){
        List<Map<String,Object>> result = new ArrayList<>();
        List<Map<String,Object>> result = new ArrayList<>();
        BaseDoctorDO doctorDO = baseDoctorDao.findById(doctor);
        BaseDoctorDO doctorDO = baseDoctorDao.findById(doctor);
        if (doctorDO.getLevel()!=null&&doctorDO.getLevel()==2){//助老员
        if (doctorDO.getLevel()!=null&&doctorDO.getLevel()==2){//社工
            List<BaseDoctorHospitalDO> hospitalDOS = baseDoctorHospitalDao.findDistinctOrgByDoctorCode(doctor);
            List<BaseDoctorHospitalDO> hospitalDOS = baseDoctorHospitalDao.findDistinctOrgByDoctorCode(doctor);
            for (BaseDoctorHospitalDO obj:hospitalDOS){
            for (BaseDoctorHospitalDO obj:hospitalDOS){
                String sql="select ap.id,p.id patientCode,ap.patient_name name,p.sex,ap.idcard,p.photo,ap.status,DATE_FORMAT(ap.create_time,'%Y-%m-%d %H:%i:%S') create_time " +
                String sql="select ap.id,p.id patientCode,ap.patient_name name,p.sex,ap.idcard,p.photo,ap.status,DATE_FORMAT(ap.create_time,'%Y-%m-%d %H:%i:%S') create_time " +

+ 170 - 11
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/assistance/EmergencyAssistanceService.java

@ -670,12 +670,22 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
        if (StringUtils.isNotBlank(patient)){
        if (StringUtils.isNotBlank(patient)){
            sql.append( " and (ord.patient='"+patient+"' or ord.proxy_patient='"+patient+"' ) group by ord.status  ");
            sql.append( " and (ord.patient='"+patient+"' or ord.proxy_patient='"+patient+"' ) group by ord.status  ");
        }
        }
        else if (StringUtils.isNotBlank(doctor))    {
            sql.append(" AND EXISTS (" +
                    "SELECT sr.patient from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i ," +
                    "base_team_member m " +
                    "where ord.patient = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id and  m.team_code = r.team_code " +
                    " and i.del = 1 and sr.`status`=1  and i.code='emergencyAssistance' and m.doctor_code = '"+doctor+"' and m.del = '1') group by ord.status");
        else if (StringUtils.isNotBlank(doctor)){
            BaseDoctorDO doctorDO = doctorDao.findById(doctor);
            if (null!=doctorDO){
                if (2==doctorDO.getLevel()){//社工
                    sql.append(" AND EXISTS (" +
                            "SELECT sr.patient from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i ," +
                            "base_team_member m " +
                            "where ord.patient = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id and  m.team_code = r.team_code " +
                            " and i.del = 1 and sr.`status`=1  and i.code='emergencyAssistance' and m.doctor_code = '"+doctor+"' and m.del = '1') group by ord.status");
                }
                if (4==doctorDO.getLevel()){//助老员
                    sql.append(" and EXISTS (" +
                            "SELECT 1 from base_patient_helper ph INNER JOIN base_patient p on ph.patient = p.id and p.del=1 " +
                            " where ord.patient = ph.patient and ph.doctor='"+doctor+"' and ph.del=1) group by ord.status  ");
                }
            }
        }
        }
        List<Map<String,Object>> sqlResult = jdbcTemplate.queryForList(sql.toString());
        List<Map<String,Object>> sqlResult = jdbcTemplate.queryForList(sql.toString());
        for (Map<String,Object> map:sqlResult){
        for (Map<String,Object> map:sqlResult){
@ -721,11 +731,21 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
    public List<EmergencyAssistanceDO> getOrderList(String patient,String patientName,String doctor,String status,Integer page,Integer pageSize,String sort){
    public List<EmergencyAssistanceDO> getOrderList(String patient,String patientName,String doctor,String status,Integer page,Integer pageSize,String sort){
        StringBuilder sql = new StringBuilder(" select ord.* from base_emergency_assistance_order ord inner join base_patient pa on pa.id = ord.patient and pa.del=1  where 1=1 ");
        StringBuilder sql = new StringBuilder(" select ord.* from base_emergency_assistance_order ord inner join base_patient pa on pa.id = ord.patient and pa.del=1  where 1=1 ");
        if (StringUtils.isNotBlank(doctor)){
        if (StringUtils.isNotBlank(doctor)){
            sql.append(" AND EXISTS (" +
                    "SELECT sr.patient from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i ," +
                    "base_team_member m " +
                    "where ord.patient = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id and  m.team_code = r.team_code " +
                    " and i.del = 1 and sr.`status`=1  and i.code='emergencyAssistance' and m.doctor_code = '"+doctor+"' and m.del = '1') ");
            BaseDoctorDO doctorDO = doctorDao.findById(doctor);
            if (null!=doctorDO){
                if (2==doctorDO.getLevel()){//社工
                    sql.append(" AND EXISTS (" +
                            "SELECT sr.patient from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i ," +
                            "base_team_member m " +
                            "where ord.patient = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id and  m.team_code = r.team_code " +
                            " and i.del = 1 and sr.`status`=1  and i.code='emergencyAssistance' and m.doctor_code = '"+doctor+"' and m.del = '1') ");
                }
                if (4==doctorDO.getLevel()){//助老员
                    sql.append(" and EXISTS (" +
                            "SELECT 1 from base_patient_helper ph INNER JOIN base_patient p on ph.patient = p.id and p.del=1 " +
                            " where ord.patient = ph.patient and ph.doctor='"+doctor+"' and ph.del=1) ");
                }
            }
        }
        }
        if (StringUtils.isNotBlank(patient)){
        if (StringUtils.isNotBlank(patient)){
            sql.append(" and ( ord.patient  = '"+patient+"' or ord.proxy_patient='"+patient+"' )");
            sql.append(" and ( ord.patient  = '"+patient+"' or ord.proxy_patient='"+patient+"' )");
@ -1206,4 +1226,143 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
        return logDO;
        return logDO;
    }
    }
    /****************************************助老员部分*************************************************************************/
    /**
     * 查看居民救助历史记录
     * @param patient
     * @param doctor
     * @return
     */
    public List<Map<String,Object>> getEmeAndSecuOrderList(String orderType,String patient,String patientName,String doctor,String status,Integer page,Integer pageSize,String svrDesc){
        page = page>0?page-1:0;
        List<Map<String,Object>> result = new ArrayList<>();
        String filter = " ";
        if (StringUtils.isNotBlank(patient)){
            filter += " and ord.patient ='"+patient+"' ";
        }
        if (StringUtils.isNotBlank(patientName)){
            filter += " and ord.patient_name like'%"+patientName+"%' ";
        }
        if (StringUtils.isNotBlank(doctor)){
            filter += "  and EXISTS ( SELECT 1 from base_patient_helper ph INNER JOIN base_patient p on ph.patient = p.id " +
                    " and p.del=1 where ord.patient = ph.patient and ph.doctor='"+doctor+"' and ph.del=1) ";
        }
        if (StringUtils.isNotBlank(status)){
            filter += " and ord.status ='"+status+"' ";
        }
        String sql = " ";
        if (StringUtils.isNotBlank(orderType)){
            List<String> orderTypes = Arrays.asList(orderType.split(",").clone());
            if (orderTypes.contains("20")){
                sql += "select '20' as OrderType,ord.id,ord.patient,ord.patient_name,ord.doctor,ord.status,ord.doctor_name," +
                        "'紧急呼叫' as serve_desc,DATE_FORMAT(ord.create_time,'%Y-%m-%d %H:%i:%S') create_time ,case p.sex when 1 then '男' when 2 then '女' else p.sex end as sex," +
                        " TIMESTAMPDIFF(YEAR,p.birthday,now()) as age " +
                        "from base_emergency_assistance_order ord  INNER JOIN base_patient p on ord.patient = p.id  where 1=1 " +filter;
            }
            if (orderTypes.contains("20")&&orderTypes.contains("22")){
                sql += " UNION ";
            }
            if (orderTypes.contains("22")){
                sql += " select  '22' as 'OrderType',ord.id,ord.patient,ord.patient_name,ord.doctor,ord.status,ord.doctor_name," +
                        "ord.serve_desc,DATE_FORMAT(ord.create_time,'%Y-%m-%d %H:%i:%S') create_time ,case p.sex when 1 then '男' when 2 then '女' else p.sex end as sex, " +
                        "TIMESTAMPDIFF(YEAR,p.birthday,now()) as age from base_security_monitoring_order ord " +
                        " INNER JOIN base_patient p on ord.patient = p.id  where 1=1 "+filter;
                if(StringUtils.isNotBlank(svrDesc)){
                    sql += " and ord.service = '"+svrDesc+"' ";
                }
            }
            sql += "order by create_time desc limit "+page*pageSize+","+pageSize;
            result =   jdbcTemplate.queryForList(sql);
        }
        return result;
    }
    public JSONObject getEmeAndSecuOrderTab(String orderType,String doctor){
        JSONObject result = new JSONObject();
        if ("20".equals(orderType)){
            JSONObject tmpObj = new JSONObject();
            tmpObj.put("status_-2",0);//误报警
            tmpObj.put("status_-1",0);//已取消
            tmpObj.put("status_0",0);//已完成
            tmpObj.put("status_1",0);//预警中
            String sql = " select ord.status,count(ord.id) count from base_emergency_assistance_order ord where 1=1" ;
            if (StringUtils.isNotBlank(doctor)){
                sql+= " and EXISTS (" +
                        "SELECT 1 from base_patient_helper ph INNER JOIN base_patient p on ph.patient = p.id and p.del=1 " +
                        " where ord.patient = ph.patient and ph.doctor='"+doctor+"' and ph.del=1) ";
            }
            List<Map<String,Object>> sqlResult = jdbcTemplate.queryForList(sql.toString());
            for (Map<String,Object> map:sqlResult){
                tmpObj.put("status_"+map.get("status"),map.get("count"));
            }
            Integer All = 0;
            Set<String> keySet = tmpObj.keySet();
            for (String key : keySet){
                All+=tmpObj.getInteger(key);
            }
            tmpObj.put("all",All);
            result.put(ResponseContant.resultFlag, ResponseContant.success);
            result.put(ResponseContant.resultMsg,tmpObj);
        }
        else if("22".equals(orderType)){
            result.put("status_-2", 0);//误报警
            result.put("status_-1", 0);//已取消
            result.put("status_0", 0);//已完成
            result.put("status_1", 0);//预警中
            result.put("status_all", 0);//
            result.put("svr_all", 0);//
            Map<String, String> serverTmp = new HashMap<>();
            String sql = " select py_code,dict_value from wlyy_hospital_sys_dict where dict_name='security_server_dict' ";
            List<Map<String, Object>> servers = jdbcTemplate.queryForList(sql);
            for (Map<String, Object> server : servers) {
                result.put("svr_" + server.get("py_code").toString(), 0);
                serverTmp.put(server.get("dict_value").toString(), server.get("py_code").toString());
            }
            sql = "select ord.status,ord.serve_desc,count(ord.id) count from base_security_monitoring_order ord INNER JOIN base_patient p on p.id = ord.patient " +
                    "where 1=1 ";
            String fliter = "  ";
            if (StringUtils.isNotBlank(doctor)) {
                fliter+= " and EXISTS (" +
                        "SELECT 1 from base_patient_helper ph INNER JOIN base_patient p on ph.patient = p.id and p.del=1 " +
                        " where ord.patient = ph.patient and ph.doctor='"+doctor+"' and ph.del=1) ";
            }
            fliter += " group by ord.status,ord.serve_desc ";
            List<Map<String, Object>> sqlResult = jdbcTemplate.queryForList(sql + fliter);
            String pyCode = "";
            for (Map<String, Object> map : sqlResult) {
                result.put("status_" + map.get("status"), result.getInteger("status_" + map.get("status")) + Integer.parseInt(map.get("count").toString()));
                pyCode = serverTmp.get(map.get("serve_desc")) == null ? null : serverTmp.get(map.get("serve_desc")).toString();
                if (StringUtils.isNotBlank(pyCode)) {
                    result.put("svr_" + pyCode, result.getInteger("svr_" + pyCode) + Integer.parseInt(map.get("count").toString()));
                    result.put("status_all", result.getInteger("status_all") + Integer.parseInt(map.get("count").toString()));
                    result.put("svr_all", result.getInteger("svr_all") + Integer.parseInt(map.get("count").toString()));
                }
            }
            return result;
        }else {
            String sql = " select count(ord.id)  from base_emergency_assistance_order ord where 1=1" ;
            if (StringUtils.isNotBlank(doctor)){
                sql+= " and EXISTS (" +
                        "SELECT 1 from base_patient_helper ph INNER JOIN base_patient p on ph.patient = p.id and p.del=1 " +
                        " where ord.patient = ph.patient and ph.doctor='"+doctor+"' and ph.del=1) ";
            }
            Long emeCount = jdbcTemplate.queryForObject(sql,Long.class);
            result.put("emeAll",emeCount);
            sql = "select count(ord.id) count from base_security_monitoring_order ord INNER JOIN base_patient p on p.id = ord.patient " +
                    "where 1=1 ";
            String fliter = "  ";
            if (StringUtils.isNotBlank(doctor)) {
                sql += " and EXISTS (" +
                        "SELECT 1 from base_patient_helper ph INNER JOIN base_patient p on ph.patient = p.id and p.del=1 " +
                        " where ord.patient = ph.patient and ph.doctor='"+doctor+"' and ph.del=1) ";
            }
            Long secuCount = jdbcTemplate.queryForObject(sql,Long.class);
            result.put("secuAll",secuCount);
        }
        return result;
    }
}
}

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

@ -176,7 +176,7 @@ public class BirthdayWishesService {
                "CASE p.sex WHEN 1 THEN '男' WHEN 2 THEN '女' END sex," +
                "CASE p.sex WHEN 1 THEN '男' WHEN 2 THEN '女' END sex," +
                "p.idcard, p.photo," +
                "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 " +
                " 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( " +
                "from wlyy_archive a,base_patient p WHERE  a.patient = p.id and a.sign_status = 1 and p.del=1 and EXISTS( " +
                "SELECT DISTINCT sr.patient from base_service_package_sign_record sr,base_service_package_record r,base_service_package pack, " +
                "SELECT DISTINCT sr.patient from base_service_package_sign_record sr,base_service_package_record r,base_service_package pack, " +
                "base_team_member m " +
                "base_team_member m " +
                "WHERE  sr.id = r.sign_id and sr.patient = a.patient and r.service_package_id = pack.id  " +
                "WHERE  sr.id = r.sign_id and sr.patient = a.patient and r.service_package_id = pack.id  " +
@ -222,7 +222,7 @@ public class BirthdayWishesService {
        SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
        SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
        String now = f.format(new Date());
        String now = f.format(new Date());
        String sql = "SELECT DISTINCT p.id " +
        String sql = "SELECT DISTINCT p.id " +
                "from wlyy_archive a,base_patient p WHERE  a.patient = p.id and a.sign_status = 1 and EXISTS( " +
                "from wlyy_archive a,base_patient p WHERE  a.patient = p.id and p.del=1 and a.sign_status = 1 and EXISTS( " +
                "SELECT DISTINCT sr.patient from base_service_package_sign_record sr,base_service_package_record r, " +
                "SELECT DISTINCT sr.patient from base_service_package_sign_record sr,base_service_package_record r, " +
                "base_team_member m " +
                "base_team_member m " +
                "WHERE  sr.id = r.sign_id and sr.patient = a.patient and sr.id = r.sign_id " +
                "WHERE  sr.id = r.sign_id and sr.patient = a.patient and sr.id = r.sign_id " +
@ -252,12 +252,12 @@ public class BirthdayWishesService {
        List<Map<String, Object>> resultList = new ArrayList();
        List<Map<String, Object>> resultList = new ArrayList();
        Long allCount = 0l;
        Long allCount = 0l;
        //判断是否筛选推送条件,若未筛选则从数据库直接查生日居民,再进行匹配是否推送,若选择已推送则从推送记录查,若未发送则从未推送表查
        //判断是否筛选推送条件,若未筛选则从数据库直接查生日居民,再进行匹配是否推送,若选择已推送则从推送记录查,若未发送则从未推送表查
        //助老员签约患者
        //社工签约患者
        String sql = " SELECT Distinct p.id patient,p.idcard,p.mobile,p.name,p.sex,p.id,p.photo," +
        String sql = " SELECT Distinct p.id patient,p.idcard,p.mobile,p.name,p.sex,p.id,p.photo," +
                "CASE LENGTH(p.idcard) WHEN 18 THEN SUBSTR(p.idcard, 11, 4) WHEN 15 THEN SUBSTR(p.idcard, 9, 4) END birthday  " ;
                "CASE LENGTH(p.idcard) WHEN 18 THEN SUBSTR(p.idcard, 11, 4) WHEN 15 THEN SUBSTR(p.idcard, 9, 4) END birthday  " ;
        String sqlCount = "SELECT count(distinct p.idcard) ";
        String sqlCount = "SELECT count(distinct p.idcard) ";
        String whereSql = "from wlyy_archive a,base_patient p WHERE  a.patient = p.id and a.sign_status = 1 and EXISTS( " +
        String whereSql = "from wlyy_archive a,base_patient p WHERE  a.patient = p.id and a.sign_status = 1 and p.del=1 and EXISTS( " +
                "SELECT DISTINCT sr.patient from base_service_package_sign_record sr,base_service_package_record r,base_service_package pack , " +
                "SELECT DISTINCT sr.patient from base_service_package_sign_record sr,base_service_package_record r,base_service_package pack , " +
                "base_team_member m " +
                "base_team_member m " +
                "WHERE  sr.id = r.sign_id and sr.patient = a.patient and  r.service_package_id = pack.id " +
                "WHERE  sr.id = r.sign_id and sr.patient = a.patient and  r.service_package_id = pack.id " +
@ -514,4 +514,43 @@ public class BirthdayWishesService {
        BirthDayWishesToPatient tmp = bwToPatientDao.findOne(id);
        BirthDayWishesToPatient tmp = bwToPatientDao.findOne(id);
        return tmp;
        return tmp;
    }
    }
    /************************************助老员部分****************************************************************/
    /**
     * 获取助老员当天未发送生日祝福居民数量
     * @param doctor
     * @return
     */
    public Integer getHelperPatientByDoctorCount(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 DISTINCT p.id from  base_patient p INNER JOIN base_patient_helper ph on p.id = ph.patient and ph.del=1 " +
                " WHERE ph.doctor='"+doctor+"' " +
                "AND CASE LENGTH(p.idcard) WHEN  18 then SUBSTR(p.idcard,11,4) when 15 then SUBSTR(p.idcard, 9,4) END =  '" + dateString + "'  " ;
        List<String> patientInfos =  jdbcTemplate.queryForList(sql,String.class);
        Integer count=0;
        for (String tmp:patientInfos){
            if (null == sendPatients){
                count = patientInfos.size();
                break;
            }
            if (!sendPatients.contains(tmp)){
                count++;
            }
        }
        return count;
    }
}
}

+ 7 - 3
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/consult/ConsultTeamService.java

@ -245,8 +245,10 @@ public class ConsultTeamService {
            }
            }
        }
        }
        //加入团队医生
        //加入签约社工
        List<Map<String,Object>> doctorList = servicePackageService.fingdDoctorByPaitenId(patient,2);
        List<Map<String,Object>> doctorList = servicePackageService.fingdDoctorByPaitenId(patient,2);
        //加入助老员
        doctorList.addAll(servicePackageService.findHelperByPatientId(patient));
        for(Map<String,Object> map:doctorList){
        for(Map<String,Object> map:doctorList){
            participants.put(String.valueOf(map.get("id")), 0);
            participants.put(String.valueOf(map.get("id")), 0);
        }
        }
@ -420,7 +422,7 @@ public class ConsultTeamService {
        //(im创建咨询) 安防警报咨询的sessionid为居民code+咨询类型
        //(im创建咨询) 安防警报咨询的sessionid为居民code+咨询类型
        String sessionId = patient + "_" + consultTeam.getType();
        String sessionId = patient + "_" + consultTeam.getType();
        //4、安防警报咨询-参与者  提供服务的助老员 老人本人 家属
        //4、安防警报咨询-参与者  提供服务的社工 老人本人 家属
        JSONObject participants = new JSONObject();
        JSONObject participants = new JSONObject();
        participants.put(patient, 0);
        participants.put(patient, 0);
        //家属
        //家属
@ -468,8 +470,10 @@ public class ConsultTeamService {
            }
            }
        }
        }
        //加入团队医生
        //加入签约社工
        List<Map<String,Object>> doctorList = servicePackageService.fingdDoctorByPaitenId(patient,2);
        List<Map<String,Object>> doctorList = servicePackageService.fingdDoctorByPaitenId(patient,2);
        //加入助老员
        doctorList.addAll(servicePackageService.findHelperByPatientId(patient));
        for(Map<String,Object> map:doctorList){
        for(Map<String,Object> map:doctorList){
            participants.put(String.valueOf(map.get("id")), 0);
            participants.put(String.valueOf(map.get("id")), 0);
        }
        }

+ 2 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/PatientDeviceService.java

@ -413,7 +413,7 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
        String sql = "select Distinct p.id,p.`name`,dd.photo,pd.device_id deviceId,pd.category_code categoryCode,pd.device_name deviceName, " +
        String sql = "select Distinct p.id,p.`name`,dd.photo,pd.device_id deviceId,pd.category_code categoryCode,pd.device_name deviceName, " +
                " pd.device_sn deviceSn,pd.czrq,pd.doctor,pd.doctor_name doctorName,pd.agent,pd.agent_name agentName " +
                " pd.device_sn deviceSn,pd.czrq,pd.doctor,pd.doctor_name doctorName,pd.agent,pd.agent_name agentName " +
                " from wlyy_patient_device pd,wlyy_devices wd,base_patient p,dm_device dd where p.id = pd.`user`  and pd.del = 0 " +
                " from wlyy_patient_device pd,wlyy_devices wd,base_patient p,dm_device dd where p.id = pd.`user`  and pd.del = 0 " +
                " and pd.device_sn = wd.device_code and pd.category_code = dd.category_code and dd.model = wd.device_model";
                " and pd.device_sn = wd.device_code and pd.category_code = dd.category_code and dd.model = wd.device_model and p.del=1 ";
        if (StringUtils.isNotBlank(patientName)){
        if (StringUtils.isNotBlank(patientName)){
            sql += " AND (p.`name` LIKE '%" + patientName +"%' or  p.idcard LIKE '%" + patientName + "%') ";
            sql += " AND (p.`name` LIKE '%" + patientName +"%' or  p.idcard LIKE '%" + patientName + "%') ";
        }
        }
@ -1916,7 +1916,7 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
    /**
    /**
     * 助老员新增电子围栏记录
     * 社工新增电子围栏记录
     */
     */
    public com.alibaba.fastjson.JSONObject doctorNewSafeArea(String doctor,String patient,String safe_area) throws Exception{
    public com.alibaba.fastjson.JSONObject doctorNewSafeArea(String doctor,String patient,String safe_area) throws Exception{

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

@ -137,7 +137,7 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
     * @return
     * @return
     */
     */
    public PageEnvelop<List<Map<String,Object>>> doctorPage(String name,String orgCode,int page, int size){
    public PageEnvelop<List<Map<String,Object>>> doctorPage(String name,String orgCode,int page, int size){
        String sql = "SELECT d.id,d.name,d.photo,d.mobile,d.idcard,d.sex,h.dept_code deptCode,h.dept_name deptName,d.job_title_code jobTitleCode,d.job_title_name jobTitleName ";
        String sql = "SELECT d.id,d.name,d.photo,d.doctor_level level,d.mobile,d.idcard,d.sex,h.dept_code deptCode,h.dept_name deptName,d.job_title_code jobTitleCode,d.job_title_name jobTitleName ";
        String countSql = "SELECT count(d.id) ";
        String countSql = "SELECT count(d.id) ";
        String filters = "from base_doctor d,base_doctor_hospital h " +
        String filters = "from base_doctor d,base_doctor_hospital h " +
@ -203,7 +203,7 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
                isSearchDoctorOrgType=true;
                isSearchDoctorOrgType=true;
            }
            }
        }
        }
        if (2==doctorLevel) {//助老员
        if (2==doctorLevel||4==doctorLevel) {//社工或助老员
            doctorOrgType=3;
            doctorOrgType=3;
            if ("3".equals(orgType)){
            if ("3".equals(orgType)){
                isSearchDoctorOrgType=true;
                isSearchDoctorOrgType=true;
@ -262,7 +262,7 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        if (StringUtils.isNotBlank(doctor)){
        if (StringUtils.isNotBlank(doctor)){
            BaseDoctorDO doctorDO = baseDoctorDao.findById(doctor);
            BaseDoctorDO doctorDO = baseDoctorDao.findById(doctor);
            //教师角色登录时为本机构科室列表,点击展开人员列表
            //教师角色登录时为本机构科室列表,点击展开人员列表
            //助老员角色登录时为本机构科室列表,点击展开人员列表
            //社工角色登录时为本机构科室列表,点击展开人员列表
            Integer doctorLevel = doctorDO.getLevel();
            Integer doctorLevel = doctorDO.getLevel();
            Integer doctorOrgType =0 ;
            Integer doctorOrgType =0 ;
            boolean isSearchDoctorOrgType=false;
            boolean isSearchDoctorOrgType=false;
@ -272,7 +272,7 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
                    isSearchDoctorOrgType=true;
                    isSearchDoctorOrgType=true;
                }
                }
            }
            }
            if (2==doctorLevel) {//助老员
            if (2==doctorLevel) {//社工
                doctorOrgType=3;
                doctorOrgType=3;
                if ("3".equals(orgType)){
                if ("3".equals(orgType)){
                    isSearchDoctorOrgType=true;
                    isSearchDoctorOrgType=true;
@ -332,7 +332,7 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        if (StringUtils.isNotBlank(deptCode)){
        if (StringUtils.isNotBlank(deptCode)){
            count+=" and dict.code='"+deptCode+"' ";
            count+=" and dict.code='"+deptCode+"' ";
        }
        }
        String sql = "select dh.org_code,dh.org_name,doc.id,doc.name,doc.mobile,doc.photo,dict.code deptCode,dict.name deptName,dh.doctor_duty_code job,dh.doctor_duty_name jobName\n" +
        String sql = "select dh.org_code,dh.org_name,doc.id,doc.name,doc.mobile,doc.photo,doc.doctor_level as level,dict.code deptCode,dict.name deptName,dh.doctor_duty_code job,dh.doctor_duty_name jobName\n" +
                " from base_doctor_hospital dh INNER JOIN base_doctor doc on dh.doctor_code = doc.id  " +
                " from base_doctor_hospital dh INNER JOIN base_doctor doc on dh.doctor_code = doc.id  " +
                " and dh.del=1 LEFT JOIN " +
                " and dh.del=1 LEFT JOIN " +
                " dict_hospital_dept dict on dh.dept_code = dict.`code` and dh.org_code = dict.org_code where dh.org_code='"+orgCode+"' ";
                " dict_hospital_dept dict on dh.dept_code = dict.`code` and dh.org_code = dict.org_code where dh.org_code='"+orgCode+"' ";
@ -557,6 +557,7 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
    }
    }
    //首页养老服务数量获取
    public JSONObject baseInfoCount(String doctor){
    public JSONObject baseInfoCount(String doctor){
        JSONObject result = new JSONObject();
        JSONObject result = new JSONObject();
        result.put("lifeCare",0);
        result.put("lifeCare",0);
@ -610,4 +611,53 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        return result;
        return result;
    }
    }
    /******************************************助老员部分*************************************************/
    //首页养老服务数量获取
    public JSONObject baseHelperInfoCount(String doctor){
        JSONObject result = new JSONObject();
        result.put("lifeCare",0);
        result.put("emergencyAssistance",0);
        result.put("patientCare",0);//人文关怀
        result.put("security",0);
        List<BaseDoctorHospitalDO> doctorHospitalDOs = doctorHospitalDao.findByDoctorCode(doctor);
        String hospital = doctorHospitalDOs.get(0).getOrgCode();
        //生活照料
        String countSql = "SELECT  " +
                "   count(o.id)  " +
                " FROM  " +
                "   base_life_care_order o  " +
                " LEFT JOIN base_patient p ON o.patient = p.id " +
                " WHERE  " +
                "  o.hospital = 'hospital' "+
                " AND o.status = 1 and o.pay_status>0  ";
        Long count = jdbcTemplate.queryForObject(countSql,Long.class);
        if (count>0){
            result.put("lifeCare",count);
        }
        //紧急救助
        countSql = " select count(ord.id) count from base_emergency_assistance_order ord where ord.status=1 " +
                "AND EXISTS ( SELECT 1 from base_patient_helper ph inner join base_patient p on ph.patient = p.id and p.del=1 where ord.patient = ph.patient and ph.doctor='"+doctor+"' and ph.del=1 ) ";
        count = jdbcTemplate.queryForObject(countSql,Long.class);
        if (count>0){
            result.put("emergencyAssistance",count);
        }
        //安防工单
        countSql = " select count(ord.id) count from base_security_monitoring_order ord where ord.status=1 " +
                "AND EXISTS ( SELECT 1 from base_patient_helper ph inner join base_patient p on ph.patient = p.id and p.del=1 where ord.patient = ph.patient and ph.doctor='"+doctor+"' and ph.del=1 ) ";
        count = jdbcTemplate.queryForObject(countSql,Long.class);
        if (count>0){
            result.put("security",count);
        }
        //人文关怀
        try {
            Integer counts = birthdayWishesService.getHelperPatientByDoctorCount(doctor);
            if (counts>0){
                result.put("patientCare",counts);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
        return result;
    }
}
}

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

@ -63,7 +63,7 @@ public class PatientLableService extends BaseJpaService<WlyyPatientLabelDO, Wlyy
     * @return
     * @return
     */
     */
    public PageEnvelop<List<Map<String,Object>>> findSignPatientLabelListByTeamCode(String teamCode, String labelCode, String name,String topicItem, int page, int size){
    public PageEnvelop<List<Map<String,Object>>> findSignPatientLabelListByTeamCode(String teamCode, String labelCode, String name,String topicItem, int page, int size){
        String sql = "SELECT DISTINCT p.id,p.name,p.photo,p.idcard,p.mobile,p.openid,p.sex,p.pad_imei padImei " ;
        String sql = "SELECT DISTINCT p.id,p.name,p.photo,p.sex,p.archive_type as archiveType,p.idcard,p.mobile,p.openid,p.pad_imei padImei " ;
        sql +=",(select COUNT(*) from wlyy_patient_device a where a.`user` = p.id and a.del=0) deviceFlag ";
        sql +=",(select COUNT(*) from wlyy_patient_device a where a.`user` = p.id and a.del=0) deviceFlag ";
        String countSql = "SELECT count(DISTINCT p.id) ";
        String countSql = "SELECT count(DISTINCT p.id) ";
        String filters ="";
        String filters ="";
@ -71,13 +71,13 @@ public class PatientLableService extends BaseJpaService<WlyyPatientLabelDO, Wlyy
             filters = "from base_service_package_sign_record sr,base_service_package_record r,  " +
             filters = "from base_service_package_sign_record sr,base_service_package_record r,  " +
                    "                base_patient p,wlyy_patient_label l " +
                    "                base_patient p,wlyy_patient_label l " +
                    "                WHERE sr.id = r.sign_id and sr.status=1  " +
                    "                WHERE sr.id = r.sign_id and sr.status=1  " +
                    "                and r.team_code =  '"+teamCode+"' " +
                    "                and  p.del=1 and r.team_code =  '"+teamCode+"' " +
                    "                and sr.patient = p.id and p.id = l.patient and l.label_type = 1 and l.label_code =  '"+labelCode+"' ";
                    "                and sr.patient = p.id and p.id = l.patient and l.label_type = 1 and l.label_code =  '"+labelCode+"' ";
        }else {
        }else {
            filters = "from base_service_package_sign_record sr,base_service_package_record r,  " +
            filters = "from base_service_package_sign_record sr,base_service_package_record r,  " +
                    "                base_patient p,wlyy_patient_label l " +
                    "                base_patient p,wlyy_patient_label l " +
                    "                WHERE sr.id = r.sign_id and sr.status=1  " +
                    "                WHERE sr.id = r.sign_id and sr.status=1  " +
                    "                and r.team_code =  '"+teamCode+"' " +
                    "                and p.del=1 and r.team_code =  '"+teamCode+"' " +
                    "                and sr.patient = p.id and p.id = l.patient and l.label_type = 1  ";
                    "                and sr.patient = p.id and p.id = l.patient and l.label_type = 1  ";
        }
        }
        if(StringUtils.isNotBlank(name)){
        if(StringUtils.isNotBlank(name)){
@ -88,7 +88,7 @@ public class PatientLableService extends BaseJpaService<WlyyPatientLabelDO, Wlyy
                    "where  pd.user = sr.patient and  FIND_IN_SET('"+topicItem+"',dd.service_topic)) ";
                    "where  pd.user = sr.patient and  FIND_IN_SET('"+topicItem+"',dd.service_topic)) ";
        }
        }
        String orderBy = " ORDER BY sr.create_time DESC " +
        String orderBy = " ORDER BY sr.create_time,p.id DESC " +
                "LIMIT "+ (page - 1) * size + "," + size;
                "LIMIT "+ (page - 1) * size + "," + size;
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql+filters+orderBy);
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql+filters+orderBy);
        for (Map<String,Object> map : list){
        for (Map<String,Object> map : list){
@ -105,5 +105,69 @@ public class PatientLableService extends BaseJpaService<WlyyPatientLabelDO, Wlyy
        return PageEnvelop.getSuccessListWithPage("success",list,page,size,count);
        return PageEnvelop.getSuccessListWithPage("success",list,page,size,count);
    }
    }
    /**************************************助老员部分***************************************************************************/
    /**
     * 按团队和标签查找签约居民
     */
    public PageEnvelop<List<Map<String,Object>>> findSignPatientLabelList(String doctor,String labelCode, String name,String topicItem, int page, int size){
        String sql = "SELECT DISTINCT p.id,p.name,p.photo,p.sex,p.archive_type as archiveType,p.idcard,p.mobile,p.openid,p.pad_imei padImei " ;
        sql +=",(select COUNT(*) from wlyy_patient_device a where a.`user` = p.id and a.del=0) deviceFlag ";
        String countSql = "SELECT count(DISTINCT p.id) ";
        String filters ="";
        if(StringUtils.isNotBlank(labelCode)){
            filters = " from base_patient_helper ph, base_patient p,wlyy_patient_label l " +
                    "   WHERE ph.patient = p.id and ph.doctor='"+doctor+"' and p.del=1 and p.id = l.patient and l.label_type = 1 " +
                    " and l.label_code =  '"+labelCode+"' ";
        }else {
            filters = " from base_patient_helper ph, base_patient p,wlyy_patient_label l " +
                    "   WHERE ph.patient = p.id and ph.doctor='"+doctor+"' and p.del=1 and p.id = l.patient and l.label_type = 1 ";
        }
        if(StringUtils.isNotBlank(name)){
            filters += " and (p.name like '%"+name+"%' or p.idcard like '%"+name+"%') ";
        }
        if (StringUtils.isNotBlank(topicItem)){
            filters += " and EXISTS (select 1 from wlyy_patient_device pd INNER JOIN dm_device dd on pd.device_id = dd.id " +
                    "where  pd.user = sr.patient and  FIND_IN_SET('"+topicItem+"',dd.service_topic)) ";
        }
        String orderBy = " ORDER BY sr.create_time,p.id DESC " +
                "LIMIT "+ (page - 1) * size + "," + size;
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql+filters+orderBy);
        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()));
            //签约医生标识
            List<Map<String,Object>> doctorList = servicePackageService.getServerDoctorAll(map.get("id").toString(),"0","1");
            List<Map<String,Object>> helperList = servicePackageService.getServerDoctorAll(map.get("id").toString(),"0","2");
            map.put("helper", helperList.size()>0?1:0);
            map.put("doctor", doctorList.size()>0?1:0);
        }
        Long count = jdbcTemplate.queryForObject(countSql+filters,Long.class);
        return PageEnvelop.getSuccessListWithPage("success",list,page,size,count);
    }
    /**
     * 查找签约居民的标签统计
     * @return
     */
    public List<Map<String,Object>> findSignPatientLabelNum(String doctor){
        String sql = " SELECT COUNT(a.id) num,dict.dict_code labelCode,dict.dict_value labelName  " +
                " from wlyy_hospital_sys_dict dict  " +
                " LEFT JOIN (SELECT DISTINCT l.id,l.label_code  " +
                " from base_patient_helper ph, base_patient p,wlyy_patient_label l  " +
                " WHERE p.id = ph.patient and ph.del=1 and p.id = l.patient and l.label_type = 1)a  " +
                "  on dict.dict_code = a.label_code  " +
                " where dict.dict_name = '"+ConstantUtil.DICT_SERVICE_TYPE+"' and dict_code<>5   " +
                " GROUP BY labelCode,labelName ";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        for (Map<String,Object> map:list){
            if(map.get("labelCode")==null){
                list.remove(map);
                break;
            }
        }
        return list;
    }
}
}

+ 87 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/message/DoctorMessageService.java

@ -339,7 +339,7 @@ public class DoctorMessageService {
                        " m.team_code = r.team_code  and m.doctor_code = '"+doctor+"'  and a.status = 1 ";
                        " m.team_code = r.team_code  and m.doctor_code = '"+doctor+"'  and a.status = 1 ";
                total += jdbcTemplate.queryForObject(sql,Integer.class);
                total += jdbcTemplate.queryForObject(sql,Integer.class);
            }
            }
            if (2==doctorDO.getLevel()){//助老员
            if (2==doctorDO.getLevel()){//社工
                //紧急救助、安防、生活
                //紧急救助、安防、生活
                if(doctorServicePermissionsService.isPermission(doctor,8)==1){
                if(doctorServicePermissionsService.isPermission(doctor,8)==1){
                    sql = " select count(ord.id) from base_emergency_assistance_order ord where 1=1  AND EXISTS (SELECT sr.patient from " +
                    sql = " select count(ord.id) from base_emergency_assistance_order ord where 1=1  AND EXISTS (SELECT sr.patient from " +
@ -382,8 +382,94 @@ public class DoctorMessageService {
                        " and h.del=1 where 1=1  and o.status in (3,4,5)and o.doctor= '"+doctor+"' ";
                        " and h.del=1 where 1=1  and o.status in (3,4,5)and o.doctor= '"+doctor+"' ";
                total += jdbcTemplate.queryForObject(sql,Integer.class);
                total += jdbcTemplate.queryForObject(sql,Integer.class);
            }
            }
            if (4==doctorDO.getLevel()){//助老员
                if(doctorServicePermissionsService.isPermission(doctor,8)==1){
                    sql = " select count(ord.id) from base_emergency_assistance_order ord where 1=1  AND EXISTS ( " +
                            " SELECT 1 from base_patient_helper ph inner join base_patient p on ph.patient = p.id and p.del=1  where ord.patient = ph.patient and ph.doctor='"+doctor+"' and ph.del=1 ) " +
                            " and ord.status in ('1') ";
                    total += jdbcTemplate.queryForObject(sql,Integer.class);
                }
                if(doctorServicePermissionsService.isPermission(doctor,10)==1){
                    sql = " select count(ord.id) from base_security_monitoring_order ord INNER JOIN base_patient p on p.id = ord.patient " +
                            " where 1=1    and  EXISTS ( SELECT 1 from base_patient_helper ph inner join base_patient p on ph.patient = p.id and p.del=1 where ord.patient = ph.patient and ph.doctor='"+doctor+"' and ph.del=1  ) " +
                            "  and ord.status='1'  ";
                    total += jdbcTemplate.queryForObject(sql,Integer.class);
                }
                if(doctorServicePermissionsService.isPermission(doctor,7)==1){
                    List<BaseDoctorHospitalDO> doctorHospitalDOs = doctorHospitalDao.findByDoctorCode(doctor);
                    if (doctorHospitalDOs.size()>0){
                        String hospital = doctorHospitalDOs.get(0).getOrgCode();
                        sql =" SELECT count(o.id)   FROM  base_life_care_order o LEFT JOIN base_patient p ON o.patient = p.id  " +
                                "WHERE  o.hospital = '"+hospital+"'  AND (o.`status` = 1 or -100 = 1) and o.pay_status>0 and o.status<>0 ";
                        total += jdbcTemplate.queryForObject(sql,Integer.class);
                    }
                }
            }
        }
        }
        return total;
        return total;
    }
    }
    //助老员
    public JSONObject getHelperPreventLost(String doctor,String id,String type){
        JSONObject result = new JSONObject();
        boolean typeNull = StringUtils.isBlank(type);
        if (typeNull||type.equals("preventLost")){//安全监护
            String sql ="select id,patient_name,DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%S') create_time,'preventLost' as service_type " +
                    " from base_security_monitoring_order ord where 1=1  " +
                    "and status ='1'   " +
                    "and  EXISTS ( SELECT 1 from base_patient_helper ph inner join base_patient p on ph.patient = p.id and p.del=1 where ord.patient = ph.patient and ph.doctor='"+doctor+"' and ph.del=1 ) " +
                    "order by create_time DESC ";
            if (StringUtils.isNotBlank(id)){
                sql = "select * from base_security_monitoring_order ord where 1=1 \n" +
                        "AND id = '"+id+"'\n" +
                        "and status ='1' \n" +
                        "and  EXISTS (SELECT 1 from base_patient_helper ph inner join base_patient p on ph.patient = p.id and p.del=1 where ord.patient = ph.patient and ph.doctor='"+doctor+"' and ph.del=1) ";
            }
            List<Map<String,Object>> sqlResult  = jdbcTemplate.queryForList(sql);
            result.put("preventLost",sqlResult);
        }
        if (typeNull||type.equals("emergencyAssistance")){//紧急救助
            String sql ="select id,patient_name,DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%S') create_time,'emergencyAssistance' as service_type from base_emergency_assistance_order ord where 1=1\n" +
                    "and status =1  " +
                    "and EXISTS (  " +
                    "SELECT 1 from base_patient_helper ph inner join base_patient p on ph.patient = p.id and p.del=1 where ord.patient = ph.patient and ph.doctor='"+doctor+"' and ph.del=1 ) " +
                    "order by create_time DESC ";
            if (StringUtils.isNotBlank(id)){
                sql = "select * from base_emergency_assistance_order ord where 1=1 "+
                        " AND id = '"+id+"' and status =1  " +
                        " and EXISTS (SELECT 1 from base_patient_helper ph inner join base_patient p on ph.patient = p.id and p.del=1 where ord.patient = ph.patient and ph.doctor='"+doctor+"' and ph.del=1 ) ";
            }
            List<Map<String,Object>> sqlResult  = jdbcTemplate.queryForList(sql);
            result.put("emergencyAssistance",sqlResult);
        }
        if (typeNull||type.equals("fifeCare")){//生活照料
            String sql ="select id,patient_name,DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%S') create_time,'fifeCare' as service_type from base_life_care_order lco where 1=1 " +
                    "and status =1  " +
                    "and EXISTS (SELECT 1 from base_patient_helper ph inner join base_patient p on ph.patient = p.id and p.del=1 where lco.patient = ph.patient and ph.doctor='"+doctor+"' and ph.del=1  ) " +
                    "order by create_time DESC ";
            if (StringUtils.isNotBlank(id)){
                sql = "select * from base_life_care_order lco where 1=1 " +
                        "AND id = '"+id+"' " +
                        "and status =1  " +
                        "and EXISTS (SELECT 1 from base_patient_helper ph inner join base_patient p on ph.patient = p.id and p.del=1 where lco.patient = ph.patient and ph.doctor='"+doctor+"' and ph.del=1 )";
            }
            List<Map<String,Object>> sqlResult  = jdbcTemplate.queryForList(sql);
            result.put("fifeCare",sqlResult);
        }
        return result;
    }
}
}

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

@ -501,7 +501,7 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
    /**
    /**
     *
     *
     * @param type 类型:1幼儿,2老人,3助老员,4医生。不传返回四个类型的数据
     * @param type 类型:1幼儿,2老人,3社工,4医生。不传返回四个类型的数据
     * @param name 姓名
     * @param name 姓名
     * @param residentialArea 居住小区
     * @param residentialArea 居住小区
     * @return
     * @return
@ -693,7 +693,7 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
    }
    }
    /**
    /**
     * 查找助老员
     * 查找社工
     * @param name
     * @param name
     * @param limit
     * @param limit
     * @return
     * @return

+ 2 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/patient/OnlineContactService.java

@ -71,11 +71,11 @@ public class OnlineContactService extends BaseJpaService<BasePatientDO, BasePati
                }
                }
                helperObj.put("onLineFlag", onLineFlag);
                helperObj.put("onLineFlag", onLineFlag);
                list.add(helperObj);
                list.add(helperObj);
                obj.put("helperObj",list);///助老员
                obj.put("helperObj",list);///社工
            }
            }
        } else {
        } else {
            List list = new ArrayList();
            List list = new ArrayList();
            obj.put("helperObj",list);///助老员
            obj.put("helperObj",list);///社工
        }
        }
        if (jsList.size() > 0){
        if (jsList.size() > 0){

+ 60 - 23
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/security/SecurityMonitoringOrderService.java

@ -715,14 +715,22 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
                    break;
                    break;
            }
            }
            if (StringUtils.isNotBlank(doctor)) {//日常监护医生必传
            if (StringUtils.isNotBlank(doctor)) {//日常监护医生必传
                fliter += " and EXISTS( SELECT 1 " +
                        " from  base_service_package_sign_record sr,base_service_package_record r,base_team_member m  " +
                        " WHERE ord.patient = CONVERT(sr.patient USING utf8) and sr.status=1 and m.team_code = r.team_code and sr.id=r.sign_id  " +
                        " and m.doctor_code = '" + doctor + "' and m.del = '1' ) ";
                fliter += " and EXISTS (select 1 from wlyy_patient_device pd INNER JOIN dm_device dd on pd.device_id = dd.id  " +
                        " where  pd.user = p.id and pd.del=0 and pd.category_code in (" + categoryCode + ") and FIND_IN_SET('" + topicItem + "',dd.service_topic)) ";
                BaseDoctorDO doctorDO = baseDoctorDao.findById(doctor);
                if (null!=doctorDO){
                    if (2==doctorDO.getLevel()) {//社工
                        fliter += " and EXISTS( SELECT 1 " +
                                " from  base_service_package_sign_record sr,base_service_package_record r,base_team_member m  " +
                                " WHERE ord.patient = CONVERT(sr.patient USING utf8) and sr.status=1 and m.team_code = r.team_code and sr.id=r.sign_id  " +
                                " and m.doctor_code = '" + doctor + "' and m.del = '1' ) ";
                    }
                    if (4==doctorDO.getLevel()){//助老员
                        fliter+= " and EXISTS (" +
                                "SELECT 1 from base_patient_helper ph INNER JOIN base_patient p on ph.patient = p.id and p.del=1 " +
                                " where ord.patient = ph.patient and ph.doctor='"+doctor+"' and ph.del=1) ";
                    }
                    fliter += " and EXISTS (select 1 from wlyy_patient_device pd INNER JOIN dm_device dd on pd.device_id = dd.id  " +
                            " where  pd.user = p.id and pd.del=0 and pd.category_code in (" + categoryCode + ") and FIND_IN_SET('" + topicItem + "',dd.service_topic)) ";
                }
                if ("preventLost".equals(topicItem)) {//有绑定围栏的居民
                if ("preventLost".equals(topicItem)) {//有绑定围栏的居民
                    fliter += " and EXISTS (select 1 from wlyy_patient_safe_area sf where sf.patient = p.id and sf.del=1 and sf.manage_status=1) ";
                    fliter += " and EXISTS (select 1 from wlyy_patient_safe_area sf where sf.patient = p.id and sf.del=1 and sf.manage_status=1) ";
                }
                }
@ -730,10 +738,20 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        } else {
        } else {
            if (StringUtils.isNotBlank(doctor)) {
            if (StringUtils.isNotBlank(doctor)) {
                fliter += " and  EXISTS ( SELECT 1 from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i ," +
                        "base_team_member m " +
                        "where ord.patient = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and " +
                        " r.service_package_id = i.service_package_id and  m.team_code = r.team_code  and i.del = 1 and sr.`status`=1  and m.doctor_code = '" + doctor + "' and m.del = '1') ";
                BaseDoctorDO doctorDO = baseDoctorDao.findById(doctor);
                if (null!=doctorDO) {
                    if (2 == doctorDO.getLevel()){//社工
                        fliter += " and  EXISTS ( SELECT 1 from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i ," +
                                "base_team_member m " +
                                "where ord.patient = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and " +
                                " r.service_package_id = i.service_package_id and  m.team_code = r.team_code  and i.del = 1 and sr.`status`=1  and m.doctor_code = '" + doctor + "' and m.del = '1') ";
                    }
                    if (4==doctorDO.getLevel()){//助老员
                        fliter+= " and EXISTS (" +
                                "SELECT 1 from base_patient_helper ph INNER JOIN base_patient p on ph.patient = p.id and p.del=1 " +
                                " where ord.patient = ph.patient and ph.doctor='"+doctor+"' and ph.del=1) ";
                    }
                }
            }
            }
        }
        }
@ -866,13 +884,22 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
                    break;
                    break;
            }
            }
            if (StringUtils.isNotBlank(doctor)) {//日常监护医生必传
            if (StringUtils.isNotBlank(doctor)) {//日常监护医生必传
                fliter += " and EXISTS( SELECT 1" +
                        " from base_service_package_sign_record sr,base_service_package_record r,base_team_member m  " +
                        " WHERE ord.patient = CONVERT(sr.patient USING utf8) and sr.status=1 and m.team_code = r.team_code and sr.id=r.sign_id  " +
                        " and m.doctor_code = '" + doctor + "' and m.del = '1' ) ";
                fliter += " and EXISTS (select 1 from wlyy_patient_device pd INNER JOIN dm_device dd on pd.device_id = dd.id  " +
                        " where  pd.user = p.id and pd.del=0 and pd.category_code in (" + categoryCode + ") and FIND_IN_SET('" + topicItem + "',dd.service_topic)) ";
                BaseDoctorDO doctorDO = baseDoctorDao.findById(doctor);
                if (null!=doctorDO) {
                    if (2==doctorDO.getLevel()){//社工
                        fliter += " and EXISTS( SELECT 1" +
                                " from base_service_package_sign_record sr,base_service_package_record r,base_team_member m  " +
                                " WHERE ord.patient = CONVERT(sr.patient USING utf8) and sr.status=1 and m.team_code = r.team_code and sr.id=r.sign_id  " +
                                " and m.doctor_code = '" + doctor + "' and m.del = '1' ) ";
                    }
                    if (4==doctorDO.getLevel()){//助老员
                        fliter+= " and EXISTS (" +
                                "SELECT 1 from base_patient_helper ph INNER JOIN base_patient p on ph.patient = p.id and p.del=1 " +
                                " where ord.patient = ph.patient and ph.doctor='"+doctor+"' and ph.del=1) ";
                    }
                    fliter += " and EXISTS (select 1 from wlyy_patient_device pd INNER JOIN dm_device dd on pd.device_id = dd.id  " +
                            " where  pd.user = p.id and pd.del=0 and pd.category_code in (" + categoryCode + ") and FIND_IN_SET('" + topicItem + "',dd.service_topic)) ";
                }
                if ("preventLost".equals(topicItem)) {//有绑定围栏的居民
                if ("preventLost".equals(topicItem)) {//有绑定围栏的居民
                    fliter += " and EXISTS (select 1 from wlyy_patient_safe_area sf where sf.patient = p.id and sf.del=1 and sf.manage_status=1) ";
                    fliter += " and EXISTS (select 1 from wlyy_patient_safe_area sf where sf.patient = p.id and sf.del=1 and sf.manage_status=1) ";
@ -880,10 +907,20 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
            }
            }
        } else {
        } else {
            if (StringUtils.isNotBlank(doctor)) {
            if (StringUtils.isNotBlank(doctor)) {
                fliter += " and  EXISTS ( SELECT 1 from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i ," +
                        "base_team_member m " +
                        "where ord.patient = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and " +
                        " r.service_package_id = i.service_package_id and  m.team_code = r.team_code  and i.del = 1 and sr.`status`=1  and m.doctor_code = '" + doctor + "' and m.del = '1') ";
                BaseDoctorDO doctorDO = baseDoctorDao.findById(doctor);
                if (null!=doctorDO){
                    if (2==doctorDO.getLevel()){//社工
                        fliter += " and  EXISTS ( SELECT 1 from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i ," +
                                "base_team_member m " +
                                "where ord.patient = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and " +
                                " r.service_package_id = i.service_package_id and  m.team_code = r.team_code  and i.del = 1 and sr.`status`=1  and m.doctor_code = '" + doctor + "' and m.del = '1') ";
                    }
                    if (4==doctorDO.getLevel()){//助老员
                        fliter+= " and EXISTS (" +
                                "SELECT 1 from base_patient_helper ph INNER JOIN base_patient p on ph.patient = p.id and p.del=1 " +
                                " where ord.patient = ph.patient and ph.doctor='"+doctor+"' and ph.del=1) ";
                    }
                }
            }
            }
        }
        }
        if (StringUtils.isNotBlank(patient)) {
        if (StringUtils.isNotBlank(patient)) {

+ 41 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/ArchiveService.java

@ -105,7 +105,7 @@ public class ArchiveService extends BaseJpaService<ArchiveDO, ArchiveDao> {
        if (signStatus!=null&&signStatus==1){//已签约不按建档查询,只要该居民服务医生就在列表中
        if (signStatus!=null&&signStatus==1){//已签约不按建档查询,只要该居民服务医生就在列表中
            filters+=" UNION " +
            filters+=" UNION " +
                    " SELECT a.create_time,p.openid,p.pad_imei padImei,p.idcard,p.mobile,p.name,p.sex,p.id,p.photo,CAST(a.sign_status AS char) sign_status \n" +
                    " SELECT a.create_time,p.openid,p.pad_imei padImei,p.idcard,p.mobile,p.name,p.sex,p.id,p.photo,CAST(a.sign_status AS char) sign_status \n" +
                    "from wlyy_archive a,base_patient p WHERE  a.patient = p.id and a.sign_status = 1 and EXISTS( " +
                    "from wlyy_archive a,base_patient p WHERE  a.patient = p.id and a.sign_status = 1 and p.del=1 and EXISTS( " +
                    "SELECT DISTINCT sr.patient from base_service_package_sign_record sr,base_service_package_record r, " +
                    "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 " +
                    "base_service_package_item i,base_team_member m " +
                    "WHERE  sr.id = r.sign_id and sr.patient = a.patient and sr.status=1 and r.service_package_id = i.service_package_id " +
                    "WHERE  sr.id = r.sign_id and sr.patient = a.patient and sr.status=1 and r.service_package_id = i.service_package_id " +
@ -206,4 +206,44 @@ public class ArchiveService extends BaseJpaService<ArchiveDO, ArchiveDao> {
    }
    }
    /************************************助老员部分************************************************************/
    /**
     *助老员获取监护居民列表
     */
    public PageEnvelop<List<Map<String,Object>>> helperArchiveList(String doctorId,String admin,int page, int size,String name){
        String sql = " SELECT ph.create_time,p.openid,p.pad_imei padImei,p.idcard,p.mobile,p.name,p.sex,p.id,p.photo,'1' sign_status ";
        String countSql = "SELECT count(distinct p.id)  ";
        String filters = " from base_patient p INNER JOIN base_patient_helper ph on p.id = ph.patient where ph.del=1 ";
        if (StringUtils.isNotBlank(admin)){//管理员展示所有档案
        }else if(StringUtils.isNotBlank(doctorId)){
            filters += " and ph.doctor='"+doctorId+"' ";
        }
        if(StringUtils.isNotBlank(name)){
            filters += " and p.name like '%"+name+"%' ";
        }
        filters+= " GROUP BY p.id ";
        String orderBy = "  ORDER BY ph.create_time DESC " +
                "LIMIT "+ (page - 1) * size + "," + size;
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql+filters+orderBy);
        for (Map<String,Object> map :list){
            String idcard = map.get("idcard").toString();
            String patientId = map.get("id").toString();
            String sign_status = map.get("sign_status").toString();
            map.put("createTime", map.get("create_time").toString().substring(0,19));
            map.put("age", IdCardUtil.getAgeForIdcard(idcard));
            if("1".endsWith(sign_status)){
                map.put("servicePackageList",servicePackageService.getServicePackageListByPatient(patientId,null));
            }
            map.put("deviceType",deviceService.getPatientDeviceCategoryCode(map.get("id").toString()));
            List<Map<String,Object>> doctorList = servicePackageService.getServerDoctorAll(map.get("id").toString(),"0","1");
            List<Map<String,Object>> helperList = servicePackageService.getServerDoctorAll(map.get("id").toString(),"0","2");
            map.put("helper", helperList.size()>0?1:0);
            map.put("doctor", doctorList.size()>0?1:0);
        }
        Long count = jdbcTemplate.queryForObject(countSql+filters,Long.class);
        return PageEnvelop.getSuccessListWithPage("success",list,page,size,count);
    }
}
}

+ 28 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/CapacityAssessmentRecordService.java

@ -604,4 +604,32 @@ public class CapacityAssessmentRecordService extends BaseJpaService<CapacityAsse
       }
       }
       return result;
       return result;
    }
    }
    /**********************************************助老员部分********************************************************************/
    /**
     * 获取居民统计
     * @param doctorId
     * @return
     */
    public Map<String,Object> getHelperPatientNum(String doctorId){
        Map<String,Object> res = new HashedMap();
        //能力完好(0级) 轻度失能(1级) 中度失能(2级) 重度失能(3级) 新生儿 10
        res.put("0",0);
        res.put("1",0);
        res.put("2",0);
        res.put("3",0);
        String sql = " SELECT COUNT(DISTINCT A.patient) count,A.level_conclusion \n" +
                " from ( select ar.patient,ar.label_code as level_conclusion from  wlyy_patient_label ar, " +
                "  base_patient_helper ph where  ar.patient = ph.patient and  ph.doctor='"+doctorId+"' and ph.del=1  " +
                " GROUP BY ar.patient ORDER BY ar.czrq desc)A " +
                " GROUP BY a.level_conclusion " ;
        List<Map<String,Object>> countMapList = jdbcTemplate.queryForList(sql);
        for(Map<String,Object> map:countMapList){
            int c = Integer.valueOf(map.get("count").toString());
            res.put(String.valueOf(map.get("level_conclusion")),c);
        }
        return res;
    }
}
}

+ 101 - 10
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/ServicePackageService.java

@ -12,10 +12,7 @@ import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.servicePackage.ServicePackageDO;
import com.yihu.jw.entity.base.servicePackage.ServicePackageItemDO;
import com.yihu.jw.entity.base.servicePackage.ServicePackageRecordDO;
import com.yihu.jw.entity.base.servicePackage.ServicePackageSignRecordDO;
import com.yihu.jw.entity.base.servicePackage.*;
import com.yihu.jw.entity.care.apply.PatientBedApplyDo;
import com.yihu.jw.entity.care.apply.PatientBedApplyDo;
import com.yihu.jw.entity.care.archive.ArchiveDO;
import com.yihu.jw.entity.care.archive.ArchiveDO;
import com.yihu.jw.entity.care.label.WlyyPatientLabelDO;
import com.yihu.jw.entity.care.label.WlyyPatientLabelDO;
@ -84,6 +81,8 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
    private DictService dictService;
    private DictService dictService;
    @Autowired
    @Autowired
    private DeviceService deviceService;
    private DeviceService deviceService;
    @Autowired
    private BasePatientHelperDao patientHelperDao;
    public void addPatientSignList(){
    public void addPatientSignList(){
@ -218,7 +217,6 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
        if (StringUtils.isNotBlank(name)){
        if (StringUtils.isNotBlank(name)){
            sql += " and o.name like '%"+name+"%' ";
            sql += " and o.name like '%"+name+"%' ";
        }
        }
        //type =4 新生儿
        List<BaseOrgDO> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper(BaseOrgDO.class));
        List<BaseOrgDO> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper(BaseOrgDO.class));
        return list;
        return list;
@ -294,7 +292,7 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
    }
    }
    /**
    /**
     * 根据签约记录查找医生/助老员
     * 根据签约记录查找医生/社工
     * @param signId
     * @param signId
     */
     */
    public List<Map<String,Object>> fingdDoctorBySignId(String signId,Integer level){
    public List<Map<String,Object>> fingdDoctorBySignId(String signId,Integer level){
@ -395,7 +393,7 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
    }
    }
    /**
    /**
     * 获取医生签约总数
     * 获取社工签约总数
     * @param doctorId
     * @param doctorId
     * @return
     * @return
     */
     */
@ -665,7 +663,7 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
    public List<Map<String,Object>> getServerDoctorAll(String patient,String onlineFlag,String doctorLevel){
    public List<Map<String,Object>> getServerDoctorAll(String patient,String onlineFlag,String doctorLevel){
        String sql="SELECT DISTINCT doc.id doctor,doc.name as doctorName,doc.sex,CONCAT(doc.`name`,CASE WHEN doc.doctor_level=1 " +
        String sql="SELECT DISTINCT doc.id doctor,doc.name as doctorName,doc.sex,CONCAT(doc.`name`,CASE WHEN doc.doctor_level=1 " +
                " THEN '(社区医生)' ELSE '(社工)' END) as name,doc.photo,doc.mobile,doc.job_title_name as jobName,doc.job_title_code as job, " +
                " THEN '(社区医生)' ELSE '(社工)' END) as name,doc.photo,doc.doctor_level as level,doc.mobile,doc.job_title_name as jobName,doc.job_title_code as job, " +
                " 0 as onLineFlag,org.code,org.name as orgName ,doc.doctor_level doctorLevel " +
                " 0 as onLineFlag,org.code,org.name as orgName ,doc.doctor_level doctorLevel " +
                "from base_service_package_sign_record sr,base_service_package_record r,base_team_member m,base_doctor doc, " +
                "from base_service_package_sign_record sr,base_service_package_record r,base_team_member m,base_doctor doc, " +
                "base_service_package pack,base_org org " +
                "base_service_package pack,base_org org " +
@ -744,7 +742,7 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
                " base_service_package p " +
                " base_service_package p " +
                "WHERE " +
                "WHERE " +
                " sr.id = r.sign_id and r.service_package_id = p.id " +
                " sr.id = r.sign_id and r.service_package_id = p.id " +
                "AND sr.patient = '"+patient+"' ORDER BY sr.create_time desc";
                "AND sr.patient = '"+patient+"' ORDER BY sr.create_time,p.id desc";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        String doctorSql = "SELECT d.name from base_team_member t,base_doctor d WHERE t.team_code = ? and t.doctor_code = d.id and d.del = 1 and t.del =1";
        String doctorSql = "SELECT d.name from base_team_member t,base_doctor d WHERE t.team_code = ? and t.doctor_code = d.id and d.del = 1 and t.del =1";
        for(Map<String,Object> map:list){
        for(Map<String,Object> map:list){
@ -830,7 +828,7 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
            filters += " and (p.name like '%"+name+"%' or p.idcard like '%"+name+"%') ";
            filters += " and (p.name like '%"+name+"%' or p.idcard like '%"+name+"%') ";
        }
        }
        filters += paitentFilter;
        filters += paitentFilter;
        String orderBy = " ORDER BY sr.create_time DESC " +
        String orderBy = " ORDER BY sr.create_time,p.id DESC " +
                "LIMIT "+ (page - 1) * size + "," + size;
                "LIMIT "+ (page - 1) * size + "," + size;
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql+filters+orderBy);
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql+filters+orderBy);
        for (Map<String,Object> map : list){
        for (Map<String,Object> map : list){
@ -846,4 +844,97 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
        Long count = jdbcTemplate.queryForObject(countSql+filters,Long.class);
        Long count = jdbcTemplate.queryForObject(countSql+filters,Long.class);
        return PageEnvelop.getSuccessListWithPage("success",list,page,size,count);
        return PageEnvelop.getSuccessListWithPage("success",list,page,size,count);
    }
    }
    /****************************************助老员部分***************************************************************/
    /**
     *助老员添加监护角色
     */
    public JSONObject helperAddPatient(String patient,String doctor){
        JSONObject result = new JSONObject();
        BasePatientHelperDO patientHelperDO =  patientHelperDao.findByPatientAndDoctor(patient,doctor);
        if (null!=patientHelperDO){
            result.put(ResponseContant.resultFlag,-1);
            result.put(ResponseContant.resultMsg,"居民已存在,无需重复添加");
            return result;
        }
        BasePatientDO patientDO = patientDao.findById(patient);
        if (null==patientDO){
            result.put(ResponseContant.resultFlag,-1);
            result.put(ResponseContant.resultMsg,"添加居民不存在,无法操作");
            return result;
        }
        BaseDoctorDO doctorDO = doctorDao.findById(doctor);
        if (null==doctorDO){
            result.put(ResponseContant.resultFlag,-1);
            result.put(ResponseContant.resultMsg,"助老员不存在,无法操作");
            return result;
        }
        //只有存在签约的居民才可被助老员关联
        String sql = " SELECT count(DISTINCT p.id)  " +
                "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 sr.status=1 and r.service_package_id = i.service_package_id  " +
                "and i.del = 1 and m.team_code = r.team_code " +
                "and p.id='"+patient+"' ) ";
        Integer signFlag = jdbcTemplate.queryForObject(sql,Integer.class);
        if (signFlag==0){
            result.put(ResponseContant.resultFlag,-1);
            result.put(ResponseContant.resultMsg,"当前居民未与社工签约,无法添加");
            return result;
        }
        patientHelperDO = new BasePatientHelperDO();
        patientHelperDO.setPatient(patient);
        patientHelperDO.setPatientName(patientDO.getName());
        patientHelperDO.setDoctor(doctor);
        patientHelperDO.setDoctorName(doctorDO.getName());
        patientHelperDO.setCreateTime(new Date());
        patientHelperDO.setCreateUser(doctor);
        patientHelperDO.setDel("1");
        patientHelperDO.setCreateUserName(doctorDO.getName());
        patientHelperDao.save(patientHelperDO);
        result.put(ResponseContant.resultFlag,200);
        result.put(ResponseContant.resultMsg,"添加成功");
        return result;
    }
    /**
     * 助老员删除监护老人
     */
    public JSONObject helperDelPatient(String patient,String doctor){
        JSONObject result = new JSONObject();
        BasePatientHelperDO patientHelperDO =  patientHelperDao.findByPatientAndDoctor(patient,doctor);
        if (null==patientHelperDO){
            result.put(ResponseContant.resultFlag,-1);
            result.put(ResponseContant.resultMsg,"居民已不在你的列表中");
            return result;
        }
        BaseDoctorDO doctorDO = doctorDao.findById(doctor);
        if (null==doctorDO){
            result.put(ResponseContant.resultFlag,-1);
            result.put(ResponseContant.resultMsg,"助老员不存在,无法操作");
            return result;
        }
        patientHelperDO.setDel("0");
        patientHelperDO.setUpdateTime(new Date());
        patientHelperDO.setUpdateUser(doctorDO.getId());
        patientHelperDO.setUpdateUserName(doctorDO.getName());
        result.put(ResponseContant.resultFlag,200);
        result.put(ResponseContant.resultMsg,"删除成功");
        return result;
    }
    /**********************************助老员部分******************************************************/
    /**
     * 根据居民和服务项查找医生
     * @param patientId
     */
    public List<Map<String,Object>> findHelperByPatientId(String patientId){
        String sql = " select distinct doc.id,doc.name from base_patient_helper ph INNER JOIN base_doctor doc " +
                " on ph.doctor = doc.id where ph.del=1 and ph.patient='"+patientId+"' and doc.del=1 " ;
        return jdbcTemplate.queryForList(sql);
    }
}
}

+ 4 - 4
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/statistics/StatisticsService.java

@ -337,7 +337,7 @@ public class StatisticsService {
        String elderlyCarServiceSql = "SELECT COUNT(1) FROM base_org WHERE type = 3 AND del = 1" + orgFilter;
        String elderlyCarServiceSql = "SELECT COUNT(1) FROM base_org WHERE type = 3 AND del = 1" + orgFilter;
        String childcareInstitutionsssSql = "SELECT COUNT(1) FROM base_org WHERE type = 4 AND del = 1" + orgFilter;
        String childcareInstitutionsssSql = "SELECT COUNT(1) FROM base_org WHERE type = 4 AND del = 1" + orgFilter;
        //助老员和教师注册人数
        //社工和教师注册人数
        Integer doctorNum = 0;
        Integer doctorNum = 0;
        Integer helperNum = 0;
        Integer helperNum = 0;
        Integer teacherNum = 0;
        Integer teacherNum = 0;
@ -368,7 +368,7 @@ public class StatisticsService {
        res.put("elderlyCarServiceNum", elderlyCarServiceNum);               //养老机构
        res.put("elderlyCarServiceNum", elderlyCarServiceNum);               //养老机构
        res.put("childcareInstitutionsssNum", childcareInstitutionsssNum);   //托育机构
        res.put("childcareInstitutionsssNum", childcareInstitutionsssNum);   //托育机构
        res.put("doctorNum", doctorNum);     //医生
        res.put("doctorNum", doctorNum);     //医生
        res.put("helperNum", helperNum);     //助老员
        res.put("helperNum", helperNum);     //社工
        res.put("teacherNum", teacherNum);   //教师
        res.put("teacherNum", teacherNum);   //教师
        return res;
        return res;
    }
    }
@ -707,7 +707,7 @@ public class StatisticsService {
        olderTotal = olderOff + olderOn;
        olderTotal = olderOff + olderOn;
        childTotal = childOff + childOn;
        childTotal = childOff + childOn;
        //助老员和教师注册人数
        //社工和教师注册人数
        String sql2 = "SELECT COUNT(a.id) c,a.doctor_level,IFNULL(a.on_line,0) online from base_doctor a,base_doctor_hospital h where a.id=h.doctor_code and a.del = '1' and h.del = '1' " +
        String sql2 = "SELECT COUNT(a.id) c,a.doctor_level,IFNULL(a.on_line,0) online from base_doctor a,base_doctor_hospital h where a.id=h.doctor_code and a.del = '1' and h.del = '1' " +
                "and a.doctor_level is not null and h.org_code not in ( " +
                "and a.doctor_level is not null and h.org_code not in ( " +
                "SELECT dict_code from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_org'  " +
                "SELECT dict_code from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_org'  " +
@ -765,7 +765,7 @@ public class StatisticsService {
        olderFamilyBinding = jdbcTemplate.queryForObject(sql2,Integer.class);
        olderFamilyBinding = jdbcTemplate.queryForObject(sql2,Integer.class);
        //helper 助老员,teacher 教师,child 幼儿,olderWx 老人公众号,olderPad 老人平板
        //helper 社工,teacher 教师,child 幼儿,olderWx 老人公众号,olderPad 老人平板
        result.put("olderTotal", olderTotal);
        result.put("olderTotal", olderTotal);
        result.put("childTotal", childTotal);
        result.put("childTotal", childTotal);
        result.put("helperTotal", helperTotal);
        result.put("helperTotal", helperTotal);

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

@ -163,7 +163,7 @@ public class BaseVisitService {
     * @param id
     * @param id
     * @return
     * @return
     */
     */
    public String completeVisit(String id,String visitContent,String visitImg){
    public String completeVisit(String id,String visitContent,String visitImg,String deviceMaintenance,String health,String lifeConsult){
        BaseVisitDO visitDO = baseVisitDao.findOne(id);
        BaseVisitDO visitDO = baseVisitDao.findOne(id);
        if("1".equals(visitDO.getStatus())){
        if("1".equals(visitDO.getStatus())){
            return "走访已完成,请勿重复操作";
            return "走访已完成,请勿重复操作";
@ -172,6 +172,9 @@ public class BaseVisitService {
        visitDO.setStatus("1");
        visitDO.setStatus("1");
        visitDO.setVisitContent(visitContent);
        visitDO.setVisitContent(visitContent);
        visitDO.setVisitImg(visitImg);
        visitDO.setVisitImg(visitImg);
        visitDO.setDeviceMaintenance(deviceMaintenance);
        visitDO.setHealth(health);
        visitDO.setLifeConsult(visitImg);
        baseVisitDao.save(visitDO);
        baseVisitDao.save(visitDO);
        return null;
        return null;
    }
    }

+ 1 - 1
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/event/ApplicationEvent.java

@ -48,7 +48,7 @@ public class ApplicationEvent implements ApplicationListener<ContextRefreshedEve
                logger.info("finish_consult_job exist");
                logger.info("finish_consult_job exist");
            }
            }
            //#每天的早上9:00,给所有医生/助老员/教师发送一条短信
            //#每天的早上9:00,给所有医生/社工/教师发送一条短信
            if (!quartzHelper.isExistJob("DOCTOR_SEND_UNREAD_MES_JOB")) {
            if (!quartzHelper.isExistJob("DOCTOR_SEND_UNREAD_MES_JOB")) {
                String trigger = SystemConf.getInstance().getSystemProperties().getProperty("DOCTOR_SEND_UNREAD_MES_JOB");
                String trigger = SystemConf.getInstance().getSystemProperties().getProperty("DOCTOR_SEND_UNREAD_MES_JOB");
                quartzHelper.addJob(DoctorSendUnreadJob.class, trigger, "DOCTOR_SEND_UNREAD_MES_JOB", new HashMap<String, Object>());
                quartzHelper.addJob(DoctorSendUnreadJob.class, trigger, "DOCTOR_SEND_UNREAD_MES_JOB", new HashMap<String, Object>());

+ 8 - 0
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/service/BirthdayReminderService.java

@ -38,7 +38,15 @@ public class BirthdayReminderService {
                "  and m.del = '1' and " +
                "  and m.del = '1' and " +
                "CASE LENGTH(p.idcard) WHEN  18 then SUBSTR(p.idcard,11,4) when 15 then SUBSTR(p.idcard, 9,4) END = '"+dateString+"' " +
                "CASE LENGTH(p.idcard) WHEN  18 then SUBSTR(p.idcard,11,4) when 15 then SUBSTR(p.idcard, 9,4) END = '"+dateString+"' " +
                "GROUP BY d.id";
                "GROUP BY d.id";
        //社工
        List<Map<String, Object>> docList = jdbcTemplate.queryForList(sql);
        List<Map<String, Object>> docList = jdbcTemplate.queryForList(sql);
        //助老员
        sql = " SELECT d.id,d.name,d.mobile,COUNT(DISTINCT p.id) c  " +
                " from base_patient_helper ph ,base_patient p ,base_doctor d  " +
                " WHERE ph.patient = p.id and ph.del=1 and p.del=1 and ph.doctor = d.id and d.del=1 and " +
                " CASE LENGTH(p.idcard) WHEN  18 then SUBSTR(p.idcard,11,4) when 15 then SUBSTR(p.idcard, 9,4) END = '"+dateString+"' " +
                " GROUP BY d.id " ;
        docList.addAll(jdbcTemplate.queryForList(sql));
        for (Map<String, Object> map:docList){
        for (Map<String, Object> map:docList){
            try {
            try {
                String doctorName = map.get("name")+"";
                String doctorName = map.get("name")+"";

+ 1 - 1
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/service/device/PressureGlucoseNotService.java

@ -44,7 +44,7 @@ public class PressureGlucoseNotService {
                " select p.id,p.name,pd.category_code from wlyy_patient_device pd INNER JOIN base_patient p on pd.`user` = p.id " +
                " select p.id,p.name,pd.category_code from wlyy_patient_device pd INNER JOIN base_patient p on pd.`user` = p.id " +
                " where pd.del=0 and pd.category_code =1 and NOT EXISTS ( " +
                " where pd.del=0 and pd.category_code =1 and NOT EXISTS ( " +
                " select phi.id from wlyy_patient_health_index phi where phi.device_sn = pd.device_sn and phi.user = p.id " +
                " select phi.id from wlyy_patient_health_index phi where phi.device_sn = pd.device_sn and phi.user = p.id " +
                " and phi.record_date>='"+dateTime7+" 00:00:00:00' and phi.record_date<='"+dateTime7+" 23:59:59' ) GROUP BY p.id ";
                " and phi.record_date>='"+dateTime7+" 00:00:00:00' and phi.record_date<='"+dateTime+" 23:59:59' ) GROUP BY p.id ";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        for (Map<String,Object>tmp:list){
        for (Map<String,Object>tmp:list){
            String patient = tmp.get("id").toString();
            String patient = tmp.get("id").toString();

+ 5 - 0
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/util/DeviceLostMessageUtil.java

@ -52,10 +52,15 @@ public class DeviceLostMessageUtil {
            List<DevicePatientDevice> pds =  patientDeviceDao.findByDeviceSn(id);
            List<DevicePatientDevice> pds =  patientDeviceDao.findByDeviceSn(id);
            if (pds.size()>0){
            if (pds.size()>0){
                DevicePatientDevice deviceDO = pds.get(0);
                DevicePatientDevice deviceDO = pds.get(0);
                //社工
                String sql = "SELECT DISTINCT d.id,d.name,'doctor' as 'user' from base_service_package_sign_record sr,base_service_package_record r,base_team_member m,base_doctor d  " +
                String sql = "SELECT DISTINCT d.id,d.name,'doctor' as 'user' from base_service_package_sign_record sr,base_service_package_record r,base_team_member m,base_doctor d  " +
                        "               WHERE sr.status=1 and m.team_code = r.team_code and sr.id=r.sign_id and m.doctor_code = d.id " +
                        "               WHERE sr.status=1 and m.team_code = r.team_code and sr.id=r.sign_id and m.doctor_code = d.id " +
                        "               and m.del = '1' and sr.patient = '"+deviceDO.getUser()+"' and d.doctor_level=2 " ;
                        "               and m.del = '1' and sr.patient = '"+deviceDO.getUser()+"' and d.doctor_level=2 " ;
                List<Map<String,Object>> doctors = jdbcTemplate.queryForList(sql);
                List<Map<String,Object>> doctors = jdbcTemplate.queryForList(sql);
                //助老员
                sql = " select distinct doc.id,doc.name,'doctor' as 'user' from base_patient_helper ph INNER JOIN base_doctor doc " +
                        " on ph.doctor = doc.id where ph.del=1 and ph.patient='"+deviceDO.getUser()+"' and doc.del=1 " ;
                doctors.addAll(jdbcTemplate.queryForList(sql));
                // 家属
                // 家属
                sql = " select  t2.id,t2.name,t2.openid,'family3' as 'user' from  base_patient_family_member t1,  base_patient t2 where  " +
                sql = " select  t2.id,t2.name,t2.openid,'family3' as 'user' from  base_patient_family_member t1,  base_patient t2 where  " +
                         "t2.id in (select family_member from base_patient_family_member where patient = '"+deviceDO.getUser()+"' )  " +
                         "t2.id in (select family_member from base_patient_family_member where patient = '"+deviceDO.getUser()+"' )  " +