Explorar el Código

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

wangzhinan hace 3 años
padre
commit
c87b5ed404
Se han modificado 34 ficheros con 920 adiciones y 160 borrados
  1. 2 1
      business/base-service/src/main/java/com/yihu/jw/patient/service/BasePatientService.java
  2. 7 2
      business/es-service/src/main/java/com/yihu/jw/es/util/ElasticsearchUtil.java
  3. 23 0
      common/common-entity/sql记录
  4. 1 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/im/ConsultTeamDo.java
  5. 36 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/consult/BaseYunxingChannelDO.java
  6. 128 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/prescription/BaseCarePrescriptionDO.java
  7. 1 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/message/SystemMessageDO.java
  8. 6 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/device/DeviceDao.java
  9. 3 3
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/device/DeviceDetailDao.java
  10. 17 27
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/device/DeviceManageEndpoint.java
  11. 41 15
      svr/svr-base/src/main/java/com/yihu/jw/base/service/device/DeviceManageService.java
  12. 7 1
      svr/svr-base/src/main/java/com/yihu/jw/base/service/device/DmDeviceService.java
  13. 17 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/consult/BaseYunxingChannelDao.java
  14. 12 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/prescription/BaseCarePrescriptionDao.java
  15. 19 11
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/consult/PatientConsultEndpoint.java
  16. 113 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/prescription/PrescriptionEndpoint.java
  17. 16 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/sign/SignEndpoint.java
  18. 18 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/third/patient/PatientNoLoginEndPoint.java
  19. 36 3
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/consult/ConsultService.java
  20. 9 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/NetworkCardService.java
  21. 1 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/PatientDeviceService.java
  22. 11 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/YsDeviceService.java
  23. 8 12
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doctor/CareDoctorService.java
  24. 78 41
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/lifeCare/LifeCareOrderService.java
  25. 6 6
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/patient/CarePatientService.java
  26. 190 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/prescription/BaseCarePrescriptionService.java
  27. 52 17
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/ServicePackageService.java
  28. 0 9
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/statistics/StatisticsService.java
  29. 24 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/util/DeviceUtil.java
  30. 1 0
      svr/svr-cloud-device/src/main/java/com/yihu/jw/care/service/DeviceService.java
  31. 22 1
      svr/svr-cloud-device/src/main/java/com/yihu/jw/care/service/YsDeviceService.java
  32. 2 2
      svr/svr-cloud-job/src/main/java/com/yihu/jw/care/job/consult/FinishConsultJob.java
  33. 9 1
      svr/svr-cloud-job/src/main/java/com/yihu/jw/care/service/device/NetworkCardService.java
  34. 4 5
      svr/svr-internet-hospital-entrance/pom.xml

+ 2 - 1
business/base-service/src/main/java/com/yihu/jw/patient/service/BasePatientService.java

@ -337,10 +337,11 @@ public class BasePatientService<T, R extends CrudRepository> extends BaseJpaServ
            basePatientDO1.setLiveTownCode(basePatientDO.getLiveTownCode());
            basePatientDO1.setLiveTownName(basePatientDO.getLiveTownName());
            basePatientDO1.setAddress(basePatientDO.getAddress());
            basePatientDO1.setResidentialArea(basePatientDO.getResidentialArea());
            basePatientDO1.setCommitteeCode(basePatientDO.getCommitteeCode());
            basePatientDO1.setCommitteeName(basePatientDO.getCommitteeName());
            // 保存修改的居民信息
            this.save(basePatientDO1);
            basePatientDao.save(basePatientDO1);
        }
        Set<Object> cardIdList = basePatientMedicardCardService.findIdListByPatientCode(basePatientDO.getId());

+ 7 - 2
business/es-service/src/main/java/com/yihu/jw/es/util/ElasticsearchUtil.java

@ -442,8 +442,13 @@ public class ElasticsearchUtil {
    public List findDateQuotaLevel0(String startDate, String endDate, String area, int level, String index, String timeLevel, String interval, String lowLevel,String areaLevel) throws Exception {
        //时间格式转换  yyyy-MM-dd转成 2017-07-17T00:00:00+0800
        if (StringUtils.isBlank(areaLevel)){
            areaLevel="6";
        areaLevel="6";
        if (!index.contains(",")){
            String sqlArea = " select area_level from wlyy_job_config_new where id="+index;
            List<String> areaLevels = jdbcTemplate.queryForList(sqlArea,String.class);
            if (areaLevels.size()>0){
                areaLevel = areaLevels.get(0);
            }
        }
        if (StringUtils.isNotEmpty(startDate)) {
            if (startDate.length() > 10) {

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

@ -1527,3 +1527,26 @@ CREATE TABLE `base_capacity_label` (
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='能力状况记录表';
-- 2021-10-11 ysj
CREATE TABLE `base_care_prescription` (
  `id` varchar(50) NOT NULL,
  `patient` varchar(50) DEFAULT NULL,
  `patient_name` varchar(50) DEFAULT NULL,
  `status` tinyint(4) DEFAULT NULL COMMENT '状态1待处理 2已处理',
  `doctor` varchar(50) DEFAULT NULL COMMENT '处理医生',
  `doctor_name` varchar(50) DEFAULT NULL,
  `apply_imgs` varchar(500) DEFAULT NULL COMMENT '申请附件',
  `apply_content` varchar(500) DEFAULT NULL COMMENT '申请内容',
  `deal_imgs` varchar(500) DEFAULT NULL COMMENT '处理附件',
  `deal_content` varchar(500) DEFAULT NULL COMMENT '处理内容',
  `create_time` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='医养处方表';
CREATE TABLE `base_yunxing_channel` (
  `id` varchar(50) NOT NULL,
  `session_id` varchar(200) DEFAULT NULL COMMENT '会话id',
  `channel_id` varchar(50) DEFAULT NULL COMMENT '云信视频id',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='云信会话关联表';

+ 1 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/im/ConsultTeamDo.java

@ -26,6 +26,7 @@ public class ConsultTeamDo extends UuidIdentityEntity {
	// 13、互联网医院专家咨询, 20紧急救助咨询, 21上门辅导咨询, 22安防警报咨询
	// 23 新生儿在线咨询
	// 24 老人在线咨询
	// 25
	private String patient;         // 提问者标识
	private String name;            // 患者姓名
	private Integer sex;            // 患者性别

+ 36 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/consult/BaseYunxingChannelDO.java

@ -0,0 +1,36 @@
package com.yihu.jw.entity.care.consult;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created by yeshijie on 2021/10/11.
 */
@Entity
@Table(name = "base_yunxing_channel")
public class BaseYunxingChannelDO extends UuidIdentityEntity {
    private String sessionId;
    private String channelId;
    @Column(name = "session_id")
    public String getSessionId() {
        return sessionId;
    }
    public void setSessionId(String sessionId) {
        this.sessionId = sessionId;
    }
    @Column(name = "channel_id")
    public String getChannelId() {
        return channelId;
    }
    public void setChannelId(String channelId) {
        this.channelId = channelId;
    }
}

+ 128 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/prescription/BaseCarePrescriptionDO.java

@ -0,0 +1,128 @@
package com.yihu.jw.entity.care.prescription;
import com.yihu.jw.entity.UuidIdentityEntityWithCreateTime;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
/**
 * Created by yeshijie on 2021/10/11.
 */
@Entity
@Table(name="base_care_prescription")
public class BaseCarePrescriptionDO extends UuidIdentityEntityWithCreateTime {
    private String patient;//
    private String patientName;//
    private Integer status;//状态1待处理 2已处理
    private String doctor;//处理医生
    private String doctorName;//
    private String applyImgs;//申请附件
    private String applyContent;//申请内容
    private String dealImgs;//处理附件
    private String dealContent;//处理内容
    private String sex;
    private String age;
    @Column(name = "patient")
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    @Column(name = "patient_name")
    public String getPatientName() {
        return patientName;
    }
    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }
    @Column(name = "status")
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    @Column(name = "doctor")
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    @Column(name = "doctor_name")
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    @Column(name = "apply_imgs")
    public String getApplyImgs() {
        return applyImgs;
    }
    public void setApplyImgs(String applyImgs) {
        this.applyImgs = applyImgs;
    }
    @Column(name = "apply_content")
    public String getApplyContent() {
        return applyContent;
    }
    public void setApplyContent(String applyContent) {
        this.applyContent = applyContent;
    }
    @Column(name = "deal_imgs")
    public String getDealImgs() {
        return dealImgs;
    }
    public void setDealImgs(String dealImgs) {
        this.dealImgs = dealImgs;
    }
    @Column(name = "deal_content")
    public String getDealContent() {
        return dealContent;
    }
    public void setDealContent(String dealContent) {
        this.dealContent = dealContent;
    }
    @Transient
    public String getSex() {
        return sex;
    }
    public void setSex(String sex) {
        this.sex = sex;
    }
    @Transient
    public String getAge() {
        return age;
    }
    public void setAge(String age) {
        this.age = age;
    }
}

+ 1 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/message/SystemMessageDO.java

@ -25,6 +25,7 @@ public class SystemMessageDO extends UuidIdentityEntity {
     * 家属紧急预警系统消息 50
     * 新生儿在线咨询 850
     * 老人在线咨询 851
     * 老人健康咨询 852
     */
    private String type;
    /**

+ 6 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/device/DeviceDao.java

@ -25,9 +25,15 @@ public interface DeviceDao extends PagingAndSortingRepository<Device, Long> {
	@Query("select count(1) from Device a where a.del = '1' and a.name=?1 ")
	Integer findTotalByName(String name);
	@Query("select count(1) from Device a where a.del = '1' and a.categoryCode=?1 and a.name=?2 ")
	Integer findTotalByCategoryCodeAndName(String categoryCode,String name);
	@Query("select count(1) from Device a where a.del = '1' and a.model=?1")
	Integer findTotalByModel(String model);
	@Query("select count(1) from Device a where a.del = '1' and a.categoryCode=?1 and a.name=?2 and a.model=?3 ")
	Integer findTotalByCodeNameModel(String categoryCode,String name,String model);
	@Query("select a from Device a where a.del = '1' and a.model=?1")
	Device findByModel(String model);
}

+ 3 - 3
svr/svr-base/src/main/java/com/yihu/jw/base/dao/device/DeviceDetailDao.java

@ -20,13 +20,13 @@ public interface DeviceDetailDao extends PagingAndSortingRepository<DeviceDetail
    @Query("select a from DeviceDetail a where a.deviceCode = ?1 and a.manufacturerCode = ?2")
    DeviceDetail findByDeviceCodeAndManufacturerCode(String deviceCode,String manufacturerCode);
    @Query("select a from DeviceDetail a where a.sim = ?2")
    @Query("select a from DeviceDetail a where a.sim = ?1")
    List<DeviceDetail> findBySim(String sim);
    @Query("select a from DeviceDetail a where a.iccid = ?2")
    @Query("select a from DeviceDetail a where a.iccid = ?1")
    List<DeviceDetail> findByIccid(String iccid);
    @Query("select a from DeviceDetail a where a.imsi = ?2")
    @Query("select a from DeviceDetail a where a.imsi = ?1")
    List<DeviceDetail> findByImsi(String sim);
}

+ 17 - 27
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/device/DeviceManageEndpoint.java

@ -3,18 +3,14 @@ package com.yihu.jw.base.endpoint.device;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.base.dao.device.DeviceDao;
import com.yihu.jw.base.dao.device.DeviceDetailDao;
import com.yihu.jw.base.service.device.DeviceManageService;
import com.yihu.jw.base.service.device.DmDeviceService;
import com.yihu.jw.base.service.device.WlyyPatientDeviceService;
import com.yihu.jw.base.service.device.YsDeviceService;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.care.device.Device;
import com.yihu.jw.entity.care.device.DeviceDetail;
import com.yihu.jw.entity.care.device.DevicePatientDevice;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.iot.device.WlyyPatientDeviceVO;
@ -27,37 +23,22 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import jxl.Sheet;
import jxl.Workbook;
import jxl.write.Label;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import jxl.write.WriteException;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.scheduling.annotation.Async;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.swing.*;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.text.SimpleDateFormat;
import java.util.*;
import static com.yihu.jw.util.common.BeanUtils.getNullPropertyNames;
/**
 * Created by Bing on 2021/9/22.
 */
@ -354,13 +335,6 @@ public class DeviceManageEndpoint extends EnvelopRestEndpoint {
            map.put("failedNum", rows-1 - correctLs.size() );
            map.put("errorData", JSON.toJSONString(errorMsgMapTotal, SerializerFeature.WriteMapNullValue));
            map.put("errorData", errorLs);
            //失败数据下载
            if (errorLs.size()>0){
                response.setContentType("octets/stream");
                response.setHeader("Content-Disposition", "attachment; filename=" + new String("deviceImport.xls"));
                OutputStream os = response.getOutputStream();
                deviceManageService.write(os, errorLs);
            }
            return ObjEnvelop.getSuccess("success",JSON.toJSONString(map,SerializerFeature.WriteMapNullValue));
        } catch (Exception e) {
@ -376,7 +350,7 @@ public class DeviceManageEndpoint extends EnvelopRestEndpoint {
            response.setContentType("octets/stream");
            response.setHeader("Content-Disposition", "attachment; filename=" + new String("deviceImport.xls"));
            OutputStream os = response.getOutputStream();
            deviceManageService.write(os, null);
            deviceManageService.write(os, new ArrayList());
        } catch (Exception ex) {
            ex.printStackTrace();
        }
@ -393,4 +367,20 @@ public class DeviceManageEndpoint extends EnvelopRestEndpoint {
            return failedException2(e);
        }
    }
    @GetMapping("findDmDeviceDictName")
    @ApiOperation("根据设备类型查询设备名称以及型号")
    public ObjEnvelop findDmDeviceDictName(@ApiParam(name = "code", value = "category_code")
                                               @RequestParam(value = "code", required = false) String code,
                                           @ApiParam(name = "name", value = "name", required = false)
                                               @RequestParam(value = "name", required = false) String name){
            try{
                return ObjEnvelop.getSuccess("查询成功",deviceManageService.findDmDeviceDictName(code,name)) ;
            }catch (Exception e) {
                return failedObjEnvelopException2(e);
            }
    }
}

+ 41 - 15
svr/svr-base/src/main/java/com/yihu/jw/base/service/device/DeviceManageService.java

@ -7,6 +7,7 @@ import com.yihu.jw.base.dao.device.DeviceDetailDao;
import com.yihu.jw.entity.care.device.Device;
import com.yihu.jw.entity.care.device.DeviceDetail;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.mysql.query.BaseJpaService;
import jxl.Workbook;
import jxl.write.*;
@ -50,33 +51,41 @@ public class DeviceManageService extends BaseJpaService<DeviceDetail,DeviceDetai
        String iccid = deviceDetail.getIccid();
        String imsi = deviceDetail.getImsi();
        DeviceDetail tmps1 =  deviceDetailDao.findBySn(deviceSn);
        if (tmps1!=null){
            result.put(ResponseContant.resultFlag,ResponseContant.fail);
            result.put(ResponseContant.resultMsg,"设备SN码重复");
            return result;
        if (tmps1 != null) {
            if (tmps1.getId().longValue()!=deviceDetail.getId().longValue()) {
                result.put(ResponseContant.resultFlag, ResponseContant.fail);
                result.put(ResponseContant.resultMsg, "设备SN码重复");
                return result;
            }
        }
        if (StringUtils.isNotBlank(sim)){
            List<DeviceDetail> tmps = deviceDetailDao.findBySim(sim);
            if (tmps.size()>0){
                result.put(ResponseContant.resultFlag,ResponseContant.fail);
                result.put(ResponseContant.resultMsg,"sim卡号重复");
                return result;
                if (tmps.get(0).getId().longValue()!=deviceDetail.getId().longValue()) {
                    result.put(ResponseContant.resultFlag,ResponseContant.fail);
                    result.put(ResponseContant.resultMsg,"sim卡号重复");
                    return result;
                }
            }
        }
        if (StringUtils.isNotBlank(iccid)){
            List<DeviceDetail> tmps =  deviceDetailDao.findByIccid(iccid);
            if (tmps.size()>0){
                result.put(ResponseContant.resultFlag,ResponseContant.fail);
                result.put(ResponseContant.resultMsg,"iccid重复");
                return result;
                if (tmps.get(0).getId().longValue()!=deviceDetail.getId().longValue()) {
                    result.put(ResponseContant.resultFlag,ResponseContant.fail);
                    result.put(ResponseContant.resultMsg,"iccid重复");
                    return result;
                }
            }
        }
        if (StringUtils.isNotBlank(imsi)){
            List<DeviceDetail> tmps =  deviceDetailDao.findByImsi(imsi);
            if (tmps.size()>0){
                result.put(ResponseContant.resultFlag,ResponseContant.fail);
                result.put(ResponseContant.resultMsg,"imsi重复");
                return result;
                if (tmps.get(0).getId().longValue()!=deviceDetail.getId().longValue()) {
                    result.put(ResponseContant.resultFlag,ResponseContant.fail);
                    result.put(ResponseContant.resultMsg,"imsi重复");
                    return result;
                }
            }
        }
        //名称、设备类型、设备型号判断
@ -85,12 +94,12 @@ public class DeviceManageService extends BaseJpaService<DeviceDetail,DeviceDetai
            result.put(ResponseContant.resultMsg,"设备类型不存在");
            return result;
        }
        if (0==deviceDao.findTotalByName(deviceName)){
        if (0==deviceDao.findTotalByCategoryCodeAndName(categoryCode,deviceName)){
            result.put(ResponseContant.resultFlag,ResponseContant.fail);
            result.put(ResponseContant.resultMsg,"设备名称不存在");
            return result;
        }
        if (0==deviceDao.findTotalByModel(deviceModel)){
        if (0==deviceDao.findTotalByCodeNameModel(categoryCode,deviceName,deviceModel)){
            result.put(ResponseContant.resultFlag,ResponseContant.fail);
            result.put(ResponseContant.resultMsg,"设备型号不存在");
            return result;
@ -182,4 +191,21 @@ public class DeviceManageService extends BaseJpaService<DeviceDetail,DeviceDetai
        ws.addCell(label);
    }
    public JSONObject findDmDeviceDictName(String code, String name) {
        JSONObject result = new JSONObject();
        String deviceSql = "select id, name, model from dm_device where 1=1 ";
        if (StringUtils.isNotBlank(code)){
            deviceSql+=" and category_code = "+ code;
        }
        if (StringUtils.isNotBlank(name)){
            deviceSql+=" and name = " + "'" + name + "'";
        }
        List<Map<String, Object>> deviceName = jdbcTemplate.queryForList(deviceSql);
        result.put("deviceName",deviceName);
        return result;
    }
}

+ 7 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/service/device/DmDeviceService.java

@ -25,6 +25,9 @@ public class DmDeviceService extends BaseJpaService<Device, DeviceDao> {
    @Autowired
    private ObjectMapper objectMapper;
    public static void findDmDeviceDict(String deviceName, String deviceModel) {
    }
    public JSONObject saveDmDevice(String json) throws IOException {
        JSONObject result = new JSONObject();
        Device device = objectMapper.readValue(json,Device.class);
@ -49,12 +52,15 @@ public class DmDeviceService extends BaseJpaService<Device, DeviceDao> {
                result.put(ResponseContant.resultFlag,ResponseContant.fail);
                result.put(ResponseContant.resultMsg,"设备型号已存在");
                return result;
            }else if (deviceTmp.getId()!=device.getId()){//
            }else if (deviceTmp.getId().longValue()!=device.getId().longValue()){//
                result.put(ResponseContant.resultFlag,ResponseContant.fail);
                result.put(ResponseContant.resultMsg,"设备型号已存在");
                return result;
            }
        }
        if (null==device.getId()){
            device.setDel("1");
        }
        deviceDao.save(device);
        result.put(ResponseContant.resultFlag,ResponseContant.success);
        result.put(ResponseContant.resultMsg,"success");

+ 17 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/consult/BaseYunxingChannelDao.java

@ -0,0 +1,17 @@
package com.yihu.jw.care.dao.consult;
import com.yihu.jw.entity.care.booking.BaseBookingServiceDo;
import com.yihu.jw.entity.care.consult.BaseYunxingChannelDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by yeshijie on 2021/10/11.
 */
public interface BaseYunxingChannelDao extends PagingAndSortingRepository<BaseYunxingChannelDO,String>,
        JpaSpecificationExecutor<BaseYunxingChannelDO> {
    @Query("select a from BaseYunxingChannelDO a where a.sessionId = ?1 ")
    BaseYunxingChannelDO findBySessionId(String sessionId);
}

+ 12 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/prescription/BaseCarePrescriptionDao.java

@ -0,0 +1,12 @@
package com.yihu.jw.care.dao.prescription;
import com.yihu.jw.entity.care.message.OrgNoticeDO;
import com.yihu.jw.entity.care.prescription.BaseCarePrescriptionDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by yeshijie on 2021/10/11.
 */
public interface BaseCarePrescriptionDao  extends PagingAndSortingRepository<BaseCarePrescriptionDO,String>, JpaSpecificationExecutor<BaseCarePrescriptionDO> {
}

+ 19 - 11
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/consult/PatientConsultEndpoint.java

@ -117,7 +117,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "sessionId",required = false) String sessionId,
			@ApiParam(name = "patient", value = "居民CODE")
			@RequestParam(value = "patient",required = true) String patient,
			@ApiParam(name="type",value = "咨询类型 23新生儿在线咨询 24老人在线咨询")
			@ApiParam(name="type",value = "咨询类型 23新生儿在线咨询 24老人在线咨询,25老人健康咨询")
			@RequestParam(value = "type",required = false,defaultValue = "23") Integer type){
		try {
			if (StringUtils.isBlank(orgCode)&&StringUtils.isBlank(sessionId)){
@ -136,7 +136,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@RequestParam(value = "doctor",required = false) String doctor,
			@ApiParam(name = "patient", value = "居民CODE")
			@RequestParam(value = "patient",required = true) String patient,
			@ApiParam(name="type",value = "咨询类型 23新生儿在线咨询 24老人在线咨询")
			@ApiParam(name="type",value = "咨询类型 23新生儿在线咨询 24老人在线咨询,25老人健康咨询")
			@RequestParam(value = "type",required = false,defaultValue = "23") Integer type){
		try {
			String consultCode = consultService.getUnfinishedConsult(patient, doctor, type);
@ -160,7 +160,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@RequestParam(value = "images",required = false) String images,
			@ApiParam(name = "voice", value = "语音")
			@RequestParam(value = "voice",required = false) String voice,
			@ApiParam(name = "type", value = "咨询类型:23在线咨询,24老人在线咨询")
			@ApiParam(name = "type", value = "咨询类型:23在线咨询,24老人在线咨询,25老人健康咨询")
			@RequestParam(value = "type",required = false) Integer type,
			@ApiParam(name = "source", value = "咨询类型来源")
			@RequestParam(value = "source",required = false) String source){
@ -173,7 +173,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			String agent = getAgentUID();
			ConsultTeamDo consult = new ConsultTeamDo();
			// 设置咨询类型:23 在线咨询 24老人在线咨询
			// 设置咨询类型:23 在线咨询 24老人在线咨询 25老人健康咨询
			consult.setType(type);
			// 设置主要症状
			consult.setSymptoms(symptoms);
@ -189,10 +189,19 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
				re = consultService.addTeamConsult(consult, patient,doctor,source,agent);
				//发送系统消息
				SystemMessageDO systemMessageDO = new SystemMessageDO();
				systemMessageDO.setTitle("新增在线咨询");
				systemMessageDO.setType("850");
				if (type==24){
					systemMessageDO.setType("851");
				switch (type){
					case 23:
						systemMessageDO.setTitle("新增在线咨询");
						systemMessageDO.setType("850");
						break;
					case 24:
						systemMessageDO.setTitle("新增在线咨询");
						systemMessageDO.setType("851");
						break;
					case 25:
						systemMessageDO.setTitle("新增健康咨询");
						systemMessageDO.setType("852");
						break;
				}
				systemMessageDO.setReceiver(re.getString("doctor"));
				systemMessageDO.setReceiverName(re.getString("doctorName"));
@ -226,7 +235,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@RequestParam(value = "patient",required = true) String patient,
			@ApiParam(name = "orgCode", value = "机构code")
			@RequestParam(value = "orgCode",required = true) String orgCode,
			@ApiParam(name="type",value = "咨询类型 23新生儿在线咨询 24老人在线咨询")
			@ApiParam(name="type",value = "咨询类型 23新生儿在线咨询 24老人在线咨询 25老人健康咨询")
			@RequestParam(value = "type",required = false,defaultValue = "23") Integer type,
			@ApiParam(name = "page", value = "第几页")
			@RequestParam(value = "page",required = false) int page,
@ -251,7 +260,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@RequestParam(value = "symptoms",required = false) String symptoms,
			@ApiParam(name = "id", value = "咨询ID")
			@RequestParam(value = "id",required = false) String id,
			@ApiParam(name = "type", value = "咨询类型 23新生儿在线咨询 24老人在线咨询")
			@ApiParam(name = "type", value = "咨询类型 23新生儿在线咨询 24老人在线咨询 25老人健康咨询")
			@RequestParam(value = "type",required = true) String type,
			@ApiParam(name = "status", value = "咨询状态:0进行中,1已完成,-1患者取消,-2超时未响应自动关闭")
			@RequestParam(value = "status",required = false) Integer status,
@ -528,7 +537,6 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
				object.put("relation_code",session_id);
				imService.sendWaiSocketMessage(sender_id,doctorRoleDO.getDoctorCode(),object.toString(),"1");
			}
			return success(result);
		} catch (Exception e) {
			return failedException2(e);

+ 113 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/prescription/PrescriptionEndpoint.java

@ -0,0 +1,113 @@
package com.yihu.jw.care.endpoint.prescription;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.aop.ObserverRequired;
import com.yihu.jw.care.service.prescription.BaseCarePrescriptionService;
import com.yihu.jw.entity.care.prescription.BaseCarePrescriptionDO;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.util.common.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
 * Created by yeshijie on 2021/10/11.
 */
@RestController
@RequestMapping("prescription" )
@Api(tags = "续方信息", description = "续方信息")
public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private BaseCarePrescriptionService prescriptionService;
    @GetMapping(value = "queryPatientList")
    @ApiOperation(value = "居民查询工单列表")
    public PageEnvelop queryPatientList(
            @ApiParam(name = "patientId", value = "居民id") @RequestParam(value = "patientId", required = true) String patientId,
            @ApiParam(name = "status", value = "工单状态") @RequestParam(value = "status", required = false) Integer status,
            @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) {
        try{
            JSONObject result = prescriptionService.queryPatientList(patientId, status, page, size);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return PageEnvelop.getError(result.getString(ResponseContant.resultMsg));
            }
            Long count = result.getLongValue(ResponseContant.count);
            return PageEnvelop.getSuccessListWithPage("查询成功",(List<BaseCarePrescriptionDO>)result.get(ResponseContant.resultMsg),page,size,count);
        }catch (Exception e){
            return failedPageEnvelopException2(e);
        }
    }
    @GetMapping(value = "queryDoctorList")
    @ApiOperation(value = "医生端列表查询")
    public PageEnvelop queryDoctorList(
            @ApiParam(name = "doctorCode", value = "医生id") @RequestParam(value = "doctorCode", required = true) String doctorCode,
            @ApiParam(name = "status", value = "工单状态") @RequestParam(value = "status", required = false) Integer status,
            @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) {
        try{
            JSONObject result = prescriptionService.queryDoctorList(doctorCode, status, page, size);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return PageEnvelop.getError(result.getString(ResponseContant.resultMsg));
            }
            Long count = result.getLongValue(ResponseContant.count);
            return PageEnvelop.getSuccessListWithPage("查询成功",(List<BaseCarePrescriptionDO>)result.get(ResponseContant.resultMsg),page,size,count);
        }catch (Exception e){
            return failedPageEnvelopException2(e);
        }
    }
    @PostMapping(value = "applyPrescription")
    @ApiOperation(value = "申请续方")
    public ObjEnvelop applyPrescription(@ApiParam(name = "applyImgs", value = "申请图片")
                             @RequestParam(value = "applyImgs", required = false)String applyImgs,
                                        @ApiParam(name = "applyContent", value = "附加说明")
                             @RequestParam(value = "applyContent", required = false)String applyContent,
                                        @ApiParam(name = "patientId", value = "居民id")
                                            @RequestParam(value = "patientId", required = true)String patientId){
        try{
            return success(prescriptionService.applyPrescription(patientId,applyImgs,applyContent));
        }catch (Exception e){
            return failedObjEnvelopException2(e);
        }
    }
    @PostMapping(value = "dealPrescription")
    @ApiOperation(value = "处理续方")
    @ObserverRequired
    public Envelop dealPrescription(@ApiParam(name = "dealImgs", value = "处理图片")
                                    @RequestParam(value = "dealImgs", required = false)String dealImgs,
                                    @ApiParam(name = "dealContent", value = "续方说明")
                                    @RequestParam(value = "dealContent", required = false)String dealContent,
                                    @ApiParam(name = "id", value = "居民id")
                                    @RequestParam(value = "id", required = true)String id,
                                    @ApiParam(name = "doctorId", value = "医生id")
                                    @RequestParam(value = "doctorId", required = true)String doctorId){
        try{
            String result = prescriptionService.dealPrescription(id,dealImgs,dealContent,doctorId);
            if(StringUtils.isBlank(result)){
                return success("处理成功");
            }else {
                return failed(result,-1);
            }
        }catch (Exception e){
            return failedException2(e);
        }
    }
}

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

@ -76,6 +76,22 @@ public class SignEndpoint extends EnvelopRestEndpoint {
        }
    }
    @GetMapping(value = "findOrgWithoutSigned")
    @ApiOperation(value = "查找签约机构")
    public ListEnvelop findOrgWithoutSigned (
            @ApiParam(name = "patient", value = "患者code", required = true)
            @RequestParam(value = "patient",required = true) String patient,
            @ApiParam(name = "name", value = "机构名称", required = false)
            @RequestParam(value = "name",required = false) String name,
            @ApiParam(name = "type", value = "类型 3 养老 4 教育,1 医疗", required = false)
            @RequestParam(value = "type",required = false) String type) throws Exception {
        try{
            return ListEnvelop.getSuccess("查询成功",servicePackageService.findOrgWithoutSigned(patient,name,type));
        }catch (Exception e){
            return failedListEnvelopException2(e);
        }
    }
    @GetMapping(value = "findSignDoctor")
    @ApiOperation(value = "查找签约医生")
    public ListEnvelop findSignDoctor (

+ 18 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/third/patient/PatientNoLoginEndPoint.java

@ -1,6 +1,7 @@
package com.yihu.jw.care.endpoint.third.patient;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.service.consult.ConsultService;
import com.yihu.jw.care.service.course.CourseService;
import com.yihu.jw.care.service.org.BaseOrgService;
import com.yihu.jw.care.service.sign.ServicePackageService;
@ -50,6 +51,8 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    private ServicePackageService servicePackageService;
    @Autowired
    private PatientNoLoginService patientNoLoginService;
    @Autowired
    private ConsultService consultService;
    /**
     * 获取微信openid
@ -171,4 +174,19 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
        }
    }
    @PostMapping(value = "updateChannelId")
    @ApiOperation(value = "保存云信channelId", notes = "保存云信channelId")
    public Envelop updateChannelId(@ApiParam(name = "sessionId", value = "sessionId")
                                   @RequestParam(value = "sessionId", required = true)String sessionId,
                                   @ApiParam(name = "channelId", value = "渠道id")
                                   @RequestParam(value = "channelId", required = true)String channelId) {
        try {
            consultService.updateChannelId(sessionId,channelId);
            return success("保存成功");
        }catch (Exception e) {
            return failedException(e);
        }
    }
}

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

@ -2,6 +2,7 @@ package com.yihu.jw.care.service.consult;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.dao.consult.BaseYunxingChannelDao;
import com.yihu.jw.care.util.EntranceUtil;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
@ -11,6 +12,7 @@ import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.im.ConsultTeamDoctorDo;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.care.consult.BaseYunxingChannelDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
@ -72,6 +74,23 @@ public class ConsultService {
    private BaseDoctorHospitalDao doctorHospitalDao;
    @Autowired
    private EntranceUtil entranceUtil;
    @Autowired
    private BaseYunxingChannelDao yunxingChannelDao;
    /**
     * 保存云信channelId
     * @param sessionId
     * @param channelId
     */
    public void updateChannelId(String sessionId,String channelId){
        BaseYunxingChannelDO channelDO = yunxingChannelDao.findBySessionId(sessionId);
        if(channelDO == null){
            channelDO = new BaseYunxingChannelDO();
            channelDO.setSessionId(sessionId);
        }
        channelDO.setChannelId(channelId);
        yunxingChannelDao.save(channelDO);
    }
    /**
     * 获取居民该机构的最近一次在线咨询
@ -498,6 +517,20 @@ public class ConsultService {
     */
    public JSONObject addTeamConsult(ConsultTeamDo ct, String patient, String doctor, String source,String agent) throws Exception {
        JSONObject re = new JSONObject();
        String title = "";
        switch (ct.getType()){
            case 23:
                title="在线咨询";
                break;
            case 24:
                title="在线咨询";
                break;
            case 25:
                title="健康咨询";
                break;
            default:
                throw new RuntimeException("暂不支持发起此类型的咨询!");
        }
        boolean boo = StringUtils.isEmpty(getUnfinishedConsult(patient, doctor,ct.getType()));
        logger.info("boo"+boo);
        WlyyHospitalSysDictDO sysDictDO = hospitalSysDictDao.findById("consultClose");
@ -509,7 +542,7 @@ public class ConsultService {
        }
        if (!flag){
            if (!StringUtils.isEmpty(getUnfinishedConsult(patient, doctor,ct.getType()))) {
                throw new RuntimeException("居民还有未结束的在线咨询!");
                throw new RuntimeException("居民还有未结束的"+title+"!");
            }
        }
@ -538,7 +571,7 @@ public class ConsultService {
        // 医生未读数量为1
        ct.setDoctorRead(1);
        // 添加咨询记录
        ConsultDo consult = imService.addConsult(ct.getPatient(), "在线咨询", ct.getSymptoms(), ct.getImages(), ct.getType(),source);
        ConsultDo consult = imService.addConsult(ct.getPatient(), title, ct.getSymptoms(), ct.getImages(), ct.getType(),source);
//		// 设置关联指导
//		consult.setGuidance(ct.getGuidance());
        // 设置咨询标识
@ -549,7 +582,7 @@ public class ConsultService {
        ct.setDoctorName(baseDoctorDO.getName());
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("title", tempPatient.getName() + "申请在线咨询");
        jsonObject.put("title", tempPatient.getName() + "申请"+title);
        jsonObject.put("content",ct.getSymptoms());
        jsonObject.put("age", DateUtil.getAgeForIdcard(tempPatient.getIdcard()));
        jsonObject.put("sex",tempPatient.getSex());

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

@ -118,8 +118,16 @@ public class NetworkCardService {
        String groupInfo = httpClientUtil.get(NetworkCardConfig.getGroupId,params,"UTF-8");
        JSONObject responseBody = JSONObject.parseObject(groupInfo);
        if (responseBody.getInteger("status")==0) {
            String groupId = "";
            JSONArray groupList = responseBody.getJSONArray("result").getJSONObject(0).getJSONArray("groupList");
            String groupId = groupList.getJSONObject(0).getString("groupId");
            for(int i=0;i<groupList.size();i++){
                JSONObject tmp = groupList.getJSONObject(i);
                if (tmp.containsKey("offeringId")){
                    if ("11000006".equals( tmp.getString("offeringId"))){//语音卡群组
                        groupId = tmp.getString("groupId");
                    }
                }
            }
            if (StringUtils.isNotBlank(groupId)) {
                params.add(new BasicNameValuePair("groupId", groupId));
                params.add(new BasicNameValuePair("operType", operType));

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

@ -323,7 +323,7 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
        List<Map<String , Object>> list = jdbcTemplate.queryForList(sql);
        if (list.size() > 0){
            Integer count = patientDeviceDao.deleteByDeviceSn(deviceSn);
            sql = "update device.wlyy_devices dd set dd.is_binding=? where dd.device_code=?";
            sql = "update wlyy_devices dd set dd.is_binding=? where dd.device_code=?";
            jdbcTemplate.update(sql,new Object[]{0,deviceSn});
            return count;
        }else {

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

@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.config.YsConfig;
import com.yihu.jw.care.dao.device.PatientDeviceDao;
import com.yihu.jw.care.dao.label.WlyyPatientLabelDao;
import com.yihu.jw.care.util.DeviceUtil;
import com.yihu.jw.entity.care.device.DevicePatientDevice;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.rm.iot.IotRequestMapping;
@ -47,6 +48,8 @@ public class YsDeviceService {
    private HttpClientUtil httpClientUtil;
    @Autowired
    private PatientDeviceDao patientDeviceDao;
    @Autowired
    private DeviceUtil deviceUtil;
    /**
     * 获取萤石设备assesToken
@ -224,36 +227,43 @@ public class YsDeviceService {
                case 0:
                    result.put(ResponseContant.resultFlag,ResponseContant.success);
                    result.put(ResponseContant.resultMsg,tmp);
                    deviceUtil.updateOnLineStatus(deviceSerial,1);
                    break;
                case 1:
                    result.put(ResponseContant.resultFlag,ResponseContant.fail);
                    result.put(ResponseContant.resultMsg,"设备不在线");
                    deviceUtil.updateOnLineStatus(deviceSerial,0);
                    break;
                case 2:
                    result.put(ResponseContant.resultFlag,ResponseContant.fail);
                    deviceUtil.updateOnLineStatus(deviceSerial,1);
                    result.put(ResponseContant.resultMsg,"设备开启视频加密,请联系管理员先进行解密");
                    break;
                case 3:
                    result.put(ResponseContant.resultFlag,ResponseContant.fail);
                    deviceUtil.updateOnLineStatus(deviceSerial,0);
                    result.put(ResponseContant.resultMsg,"设备删除");
                    break;
                case 4:
                    result.put(ResponseContant.resultFlag,ResponseContant.fail);
                    deviceUtil.updateOnLineStatus(deviceSerial,0);
                    result.put(ResponseContant.resultMsg,"失效");
                    break;
                case 5:
                    result.put(ResponseContant.resultFlag,ResponseContant.fail);
                    deviceUtil.updateOnLineStatus(deviceSerial,0);
                    result.put(ResponseContant.resultMsg,"未绑定");
                    break;
                case 6:
                    result.put(ResponseContant.resultFlag,ResponseContant.fail);
                    deviceUtil.updateOnLineStatus(deviceSerial,0);
                    result.put(ResponseContant.resultMsg,"账户下流量已超出");
                    break;
                case 7:
                    result.put(ResponseContant.resultFlag,ResponseContant.fail);
                    deviceUtil.updateOnLineStatus(deviceSerial,0);
                    result.put(ResponseContant.resultMsg,"设备接入限制");
                    break;
            }
        }
        else {

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

@ -193,8 +193,7 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        if (doctorDO==null){
            return new ArrayList<>();
        }
        //教师角色登录时为本机构科室列表,点击展开人员列表
        //助老员角色登录时为本机构科室列表,点击展开人员列表
        //医生通讯录只展示医生所在医院下所有科室列表 其他角色同理
        Integer doctorLevel = doctorDO.getLevel();
        Integer doctorOrgType =0 ;
        boolean isSearchDoctorOrgType=false;
@ -210,18 +209,13 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
                isSearchDoctorOrgType=true;
            }
        }
        if (1==doctorLevel) {//专科医生
            doctorOrgType=1;
            if ("1,2".equals(orgType)){
                isSearchDoctorOrgType=true;
            }
        }
        if (2==doctorLevel) {//社区医生
        if (1==doctorLevel) {//社区医生
            doctorOrgType=2;
            if ("1,2".equals(orgType)){
                isSearchDoctorOrgType=true;
            }
        }
        //医生机构
        String sql ="select org.code from base_doctor_hospital dh inner join base_org org on dh.org_code = org.code " +
                "and dh.doctor_code='"+doctorId+"' and org.type='"+doctorOrgType+"' ORDER BY dh.create_time desc limit 1";
@ -235,11 +229,13 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
                sql += " and org.code = '"+doctorOrg.get(0)+"' ";
            }
            sql += " GROUP BY org.`code` ";
        }
        else if (orgType.equals("1,2")){//医疗机构
        } else if (orgType.equals("1,2")){//医疗机构
           sql+=" and org.type in(1,2) ";
            if (isSearchDoctorOrgType&&doctorOrg.size()>0){
                sql += " and org.code = '"+doctorOrg.get(0)+"' ";
            }
        }
        else {//养老
        else {//教师
            if (isSearchDoctorOrgType&&doctorOrg.size()>0){
                sql += " and org.code = '"+doctorOrg.get(0)+"' and org.type='"+orgType+"'  ";
            }else {

+ 78 - 41
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/lifeCare/LifeCareOrderService.java

@ -97,6 +97,8 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
    @Autowired
    private DoctorServicePermissionsService doctorServicePermissionsService;
    //是否开启支付 false 不需要支付
    public static final boolean  isNeedPay = false;
    /**
     * 记录完成情况
@ -450,16 +452,19 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
            logger.error(failMsg);
            return result;
        }
        if(orderDO.getStatus() != LifeCareOrderDO.Status.waitForPay.getType()){
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            String failMsg = "无法取消工单,已支付的工单需要到我的订单中进行申请退款," + orderId;
            result.put(ResponseContant.resultMsg, failMsg);
            logger.error(failMsg);
            return result;
        if(isNeedPay){
            if(orderDO.getStatus() != LifeCareOrderDO.Status.waitForPay.getType()){
                result.put(ResponseContant.resultFlag, ResponseContant.fail);
                String failMsg = "无法取消工单,已支付的工单需要到我的订单中进行申请退款," + orderId;
                result.put(ResponseContant.resultMsg, failMsg);
                logger.error(failMsg);
                return result;
            }
            BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(orderDO.getId());
            businessOrderDO.setStatus(2);
            businessOrderDao.save(businessOrderDO);
        }
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(orderDO.getId());
        businessOrderDO.setStatus(2);
        businessOrderDao.save(businessOrderDO);
//        if(orderDO.getStatus().equals(LifeCareOrderDO.Status.complete.getType())){
//            result.put(ResponseContant.resultFlag, ResponseContant.fail);
//            String failMsg = "只有医生服务前的工单才可取消";
@ -489,16 +494,19 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
        lifeCareCancelLogDao.save(cancelLogDO);
        // 发送微信模板消息,通知居民工单已取消(smyyyqx-上门预约已取消)
//        String first = "key1,您好,您的上门预约服务已退回,点击查看原因";
//        BasePatientDO patient = patientDao.findById(orderDO.getPatient());
//        first  = first.replace("key1", null != patient.getName() ? patient.getName() : "");
//        JSONObject json = new JSONObject();
//        json.put("id", orderDO.getId());
//        List<BasePatientWechatDo> basePatientWechatDos = basePatientWechatDao.findByWechatIdAndPatientId(wxId,patient.getId());
//        if(basePatientWechatDos.size()>0){
//            String openId = basePatientWechatDos.get(0).getOpenid();
//            messageUtil.putTemplateWxMessage(wxId,"template_process_feedback","smyyyqx",openId,first,null,null,30,json, DateUtil.dateToChineseDate(new Date()),"生活照料已取消");
//        }
        if(!isNeedPay){
            String first = "key1,您好,您的上门预约服务已退回,点击查看原因";
            BasePatientDO patient = patientDao.findById(orderDO.getPatient());
            first  = first.replace("key1", null != patient.getName() ? patient.getName() : "");
            JSONObject json = new JSONObject();
            json.put("id", orderDO.getId());
            List<BasePatientWechatDo> basePatientWechatDos = basePatientWechatDao.findByWechatIdAndPatientId(wxId,patient.getId());
            if(basePatientWechatDos.size()>0){
                String openId = basePatientWechatDos.get(0).getOpenid();
                messageUtil.putTemplateWxMessage(wxId,"template_process_feedback","smyyyqx",openId,first,null,null,30,json, DateUtil.dateToChineseDate(new Date()),"生活照料已取消");
            }
        }
        result.put(ResponseContant.resultFlag, ResponseContant.success);
        result.put(ResponseContant.resultMsg, "工单服务已取消!");
        return result;
@ -520,19 +528,37 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
        try {
            jsonObjectParam = JSONObject.parseObject(jsonData);
            orderDO = EntityUtils.jsonToEntity(jsonObjectParam.get("order").toString(), LifeCareOrderDO.class);
            //存在未支付的订单不能发起
            boolean bool = lifeCareOrderDao.existsByPatientAndStatusIn(orderDO.getPatient(),
                    new Integer[]{
                            BaseDoorCoachOrderDO.Status.waitForPay.getType()
                    });
            if(isNeedPay){
                //存在未支付的订单不能发起
                boolean bool = lifeCareOrderDao.existsByPatientAndStatusIn(orderDO.getPatient(),
                        new Integer[]{
                                LifeCareOrderDO.Status.waitForPay.getType(),
                                LifeCareOrderDO.Status.waitForAccept.getType(),
                                LifeCareOrderDO.Status.signIn.getType()
                        });
                if(bool){
                    String failMsg = "当前服务对象存在未支付或未完成,无法再次申请!";
                    result.put(ResponseContant.resultFlag, ResponseContant.fail);
                    result.put(ResponseContant.resultMsg, failMsg);
                    logger.error(failMsg);
                    return result;
                }
            }else{
                boolean bool = lifeCareOrderDao.existsByPatientAndStatusIn(orderDO.getPatient(),
                        new Integer[]{
                                LifeCareOrderDO.Status.waitForAccept.getType(),
                                LifeCareOrderDO.Status.signIn.getType()
                        });
                if(bool){
                    String failMsg = "当前服务对象存在未完成,无法再次申请!";
                    result.put(ResponseContant.resultFlag, ResponseContant.fail);
                    result.put(ResponseContant.resultMsg, failMsg);
                    logger.error(failMsg);
                    return result;
                }
            if(bool){
                String failMsg = "当前服务对象存在未支付或未完成,无法再次申请!";
                result.put(ResponseContant.resultFlag, ResponseContant.fail);
                result.put(ResponseContant.resultMsg, failMsg);
                logger.error(failMsg);
                return result;
            }
            Integer type = orderDO.getType();
            if (type==1||type==2){
@ -547,12 +573,14 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
                orderDO.setProxyPatient(proxyPatient);
                orderDO.setProxyPatientName(doctorDO.getName());
                orderDO.setProxyPatientPhone(doctorDO.getMobile());
                List<BasePatientWechatDo> basePatientWechatDos = basePatientWechatDao.findByWechatIdAndPatientId(wxId,orderDO.getPatient());
                if (basePatientWechatDos.size()>0){
                    JSONObject json = new JSONObject();
                    String openId = basePatientWechatDos.get(0).getOpenid();
                    messageUtil.putTemplateWxMessage(wxId,"template_process_feedback","shzldzf",openId,null,null,"请在30分钟内完成支付",3,json,
                            DateUtil.dateToChineseDate(new Date()),"助老员已为您代预约生活照料","待支付");
                if(isNeedPay){
                    List<BasePatientWechatDo> basePatientWechatDos = basePatientWechatDao.findByWechatIdAndPatientId(wxId,orderDO.getPatient());
                    if (basePatientWechatDos.size()>0){
                        JSONObject json = new JSONObject();
                        String openId = basePatientWechatDos.get(0).getOpenid();
                        messageUtil.putTemplateWxMessage(wxId,"template_process_feedback","shzldzf",openId,null,null,"请在30分钟内完成支付",3,json,
                                DateUtil.dateToChineseDate(new Date()),"助老员已为您代预约生活照料","待支付");
                    }
                }
            }
            if(StringUtils.isNotBlank(agent)){
@ -597,7 +625,12 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
        }
        orderDO.setNumber(orderNoService.getOrderNo(1));
        orderDO.setCreateTime(new Date());
        orderDO.setStatus(0);//待付款状态
        if(isNeedPay){
            orderDO.setStatus(0);//待付款状态
        }else {
            orderDO.setStatus(1);//待(医生)接单
        }
        try {
            BaseAdminServiceDynamic baseAdminServiceDynamic = new BaseAdminServiceDynamic();
@ -628,7 +661,9 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
        result.put(ResponseContant.resultMsg, orderDO);
        //发起支付订单
        payService.submitOrder(orderDO.getPatient(),"4",orderDO.getId(),orderDO.getTotalFee().doubleValue());
        if (isNeedPay){
            payService.submitOrder(orderDO.getPatient(),"4",orderDO.getId(),orderDO.getTotalFee().doubleValue());
        }
        //给签约医生发送预约短信
        String sql ="SELECT i.code,r.team_code,pack.org_code,pack.org_name from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i,base_service_package pack  \n" +
@ -640,9 +675,11 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
        for (BaseDoctorDO doctorDO:doctorDOS){
            try {
                if (StringUtils.isNotBlank(doctorDO.getMobile())){
                    messageUtil.sendTXYSJson("1099805",doctorDO.getMobile(),orderDO.getPatientName());
                    messageUtil.sendTXYSJson("1099807",doctorDO.getMobile(),orderDO.getPatientName(),"生活照料");
                }
            }catch (Exception e){}
            }catch (Exception e){
                e.printStackTrace();
            }
        }
        return result;

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

@ -622,12 +622,12 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
        }
        sql += filter1;
        sql += " GROUP BY a.id,a.name,a.photo,a.idcard,a.birthday,a.residential_area,a.sex,online,signStatus ";
        sql += " ORDER BY online desc,signStatus desc";
        sql += " ORDER BY online desc,a.ykt_id desc,signStatus desc";
        sql += limit;
        List<Map<String,Object>>  list = jdbcTemplate.queryForList(sql);
        String sqlLife= "SELECT COUNT(*) from base_life_care_order where `status` = 2";
        String sqlEmergency= "SELECT COUNT(*) from base_emergency_assistance_order where `status` = 0";
        String sqlSecurity= "SELECT COUNT(*) from base_security_monitoring_order where `status` = 7 ";
        String sqlLife= "SELECT COUNT(*) from base_life_care_order ";
        String sqlEmergency= "SELECT COUNT(*) from base_emergency_assistance_order ";
        String sqlSecurity= "SELECT COUNT(*) from base_security_monitoring_order  ";
        String sqlDevice = "SELECT pd.category_code deviceFlag, IFNULL(d.contact_status,0) status from wlyy_patient_device pd,wlyy_devices d";
        for (Map<String,Object> map:list){
            String paientId = map.get("id").toString();
@ -636,7 +636,7 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
            Date birthday = DateUtil.strToDate(map.get("birthday").toString());
            Integer age = IdCardUtil.getAgeByIdcardOrBirthday(idcardNo,birthday);
            map.put("age",age);
            String filter = " and patient = '"+paientId+"'";
            String filter = " where patient = '"+paientId+"'";
            Integer lifeCare = jdbcTemplate.queryForObject(sqlLife+filter,Integer.class);
            Integer emergency = jdbcTemplate.queryForObject(sqlEmergency+filter,Integer.class);
            Integer security = jdbcTemplate.queryForObject(sqlSecurity+filter,Integer.class);
@ -681,7 +681,7 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
        String sql = "SELECT a.id,a.name,a.photo,a.sex,IFNULL(a.on_line,0) online from base_doctor a,base_doctor_hospital h" +
                "  WHERE a.id=h.doctor_code and a.doctor_level = 2 and a.del = '1' and h.del = '1' ";
        if(!StringUtil.isBlank(name)){
            sql+= " a.and name like '%"+name+"%' ";
            sql+= " and a.name like '%"+name+"%' ";
        }
        sql += fileter;
        sql += " ORDER BY online desc";

+ 190 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/prescription/BaseCarePrescriptionService.java

@ -0,0 +1,190 @@
package com.yihu.jw.care.service.prescription;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.dao.prescription.BaseCarePrescriptionDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.care.prescription.BaseCarePrescriptionDO;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.ResponseContant;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
 * Created by yeshijie on 2021/10/11.
 */
@Service
public class BaseCarePrescriptionService {
    @Autowired
    private BaseCarePrescriptionDao carePrescriptionDao;
    @Autowired
    private BasePatientDao patientDao;
    @Autowired
    private BaseDoctorDao doctorDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
     * 医生端列表查询
     * @param doctorCode
     * @param status
     * @param page
     * @param size
     * @return
     */
    public JSONObject queryDoctorList(String doctorCode, Integer status, int page, int size) {
        JSONObject result = new JSONObject();
        List<BaseCarePrescriptionDO> sqlResultlist;
        String sql = "select distinct a.*," +
                "     case p.sex " +
                "     when 1 then '男'  " +
                "     when 2 then '女' " +
                "     end AS sex, " +
                "     TIMESTAMPDIFF(year,p.birthday,NOW()) AS age  ";
        String filters = "from base_care_prescription a" +
                " LEFT JOIN base_patient p ON a.patient = p.id," +
                "         base_service_package_sign_record sr,base_service_package_record r,base_service_package pack," +
                "         base_team_member m " +
                "         WHERE  sr.id = r.sign_id and sr.patient = a.patient and r.service_package_id = pack.id " +
                "         and m.team_code = r.team_code  and m.doctor_code = '"+doctorCode+"' ";
        if(status != null){
            filters += " and a.status = "+status;
        }
        int start = 0 == page ? page++ : (page - 1) * size;
        int end = 0 == size ? 15 : size;
        String limit = " order by a.create_time desc limit "+start+","+end;
        String countSql = "SELECT count(distinct a.id) ";
        try {
            sqlResultlist = jdbcTemplate.query(sql+filters+limit,new BeanPropertyRowMapper(BaseCarePrescriptionDO.class));
        } catch (Exception e) {
            e.printStackTrace();
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg, "从数据库查询列表信息失败");
            return result;
        }
        Long count;
        try {
            count = jdbcTemplate.queryForObject(countSql+filters, Long.class);
        } catch (Exception e) {
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg, "从数据库统计数量失败" );
            return result;
        }
        result.put(ResponseContant.resultFlag, ResponseContant.success);
        result.put(ResponseContant.resultMsg, sqlResultlist);
        JSONObject countItem = new JSONObject();
        countItem.put("count", count);
        result.putAll(countItem);
        return result;
    }
    /**
     * 居民端列表查询
     * @param patientId
     * @param status
     * @param page
     * @param size
     * @return
     */
    public JSONObject queryPatientList(String patientId, Integer status, int page, int size) {
        JSONObject result = new JSONObject();
        List<BaseCarePrescriptionDO> sqlResultlist;
        String sql = "select * from base_care_prescription  ";
        String filters = " where patient = '"+patientId+"' ";
        if(status != null){
            filters += " and status = "+status;
        }
        int start = 0 == page ? page++ : (page - 1) * size;
        int end = 0 == size ? 15 : size;
        String limit = " order by create_time desc limit "+start+","+end;
        String countSql = "SELECT count(id) from base_care_prescription ";
        try {
            sqlResultlist = jdbcTemplate.query(sql+filters+limit,new BeanPropertyRowMapper(BaseCarePrescriptionDO.class));
        } catch (Exception e) {
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg, "从数据库查询列表信息失败");
            return result;
        }
        Long count;
        try {
            count = jdbcTemplate.queryForObject(countSql+filters, Long.class);
        } catch (Exception e) {
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg, "从数据库统计数量失败" );
            return result;
        }
        result.put(ResponseContant.resultFlag, ResponseContant.success);
        result.put(ResponseContant.resultMsg, sqlResultlist);
        JSONObject countItem = new JSONObject();
        countItem.put("count", count);
        result.putAll(countItem);
        return result;
    }
    /**
     * 申请续方
     * @param patient
     * @param applyImgs
     * @param applyContent
     */
    public BaseCarePrescriptionDO applyPrescription(String patient,String applyImgs,String applyContent){
        BaseCarePrescriptionDO prescriptionDO = new BaseCarePrescriptionDO();
        prescriptionDO.setApplyImgs(applyImgs);
        prescriptionDO.setApplyContent(applyContent);
        BasePatientDO patientDO = patientDao.findById(patient);
        prescriptionDO.setPatient(patient);
        prescriptionDO.setPatientName(patientDO.getName());
        prescriptionDO.setStatus(1);
        carePrescriptionDao.save(prescriptionDO);
        return prescriptionDO;
    }
    /**
     * 医生处理续方
     * @param id
     * @param dealImgs
     * @param dealContent
     */
    public String dealPrescription(String id,String dealImgs,String dealContent,String doctor){
        String result = "";
        BaseCarePrescriptionDO prescriptionDO = carePrescriptionDao.findOne(id);
        if(2 == prescriptionDO.getStatus()){
            return "请勿重复处理";
        }
        prescriptionDO.setDealContent(dealContent);
        prescriptionDO.setDealImgs(dealImgs);
        prescriptionDO.setStatus(2);
        prescriptionDO.setDoctor(doctor);
        BaseDoctorDO doctorDO = doctorDao.findById(doctor);
        prescriptionDO.setDoctorName(doctorDO.getName());
        carePrescriptionDao.save(prescriptionDO);
        return result;
    }
}

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

@ -203,6 +203,27 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
        return list;
    }
    public List<BaseOrgDO> findOrgWithoutSigned(String patient,String name,String type){
        String sql = " select DISTINCT o.* from base_org o where o.`code` not in ( " +
                "SELECT  DISTINCT i.org_code FROM  base_service_package_sign_record sr, " +
                " base_service_package_record r,  base_service_package i WHERE  sr.id = r.sign_id " +
                " and sr.status=1 and sr.patient = '"+patient+"' " +
                " AND r.service_package_id = i.id AND i.del = 1  AND sr.`status` = 1 " +
                ") ";
        if("1".equals(type)){
            sql += " and (o.type =1 or o.type = 2) ";
        }else if("3".equals(type)){
            sql += " and o.type =3 ";
        }
        if (StringUtils.isNotBlank(name)){
            sql += " and o.name like '%"+name+"%' ";
        }
        //type =4 新生儿
        List<BaseOrgDO> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper(BaseOrgDO.class));
        return list;
    }
    /**
     * 查找签约医生
     * @param patient
@ -370,11 +391,25 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
        signRecordDO.setPatient(patientId);
        signRecordDO.setName(patientDO.getName());
        List<ServicePackageRecordDO> recordDOList = signRecordDO.getRecordDOList();
        List<String> packages = recordDOList.stream().map(ServicePackageRecordDO::getServicePackageId).collect(Collectors.toList());
        if (packages.size()>0){
            String packagesId = packages.stream().map(String::valueOf).collect(Collectors.joining("','"));
            String sql  = " SELECT  DISTINCT i.org_code FROM  base_service_package_sign_record sr, " +
                    " base_service_package_record r,  base_service_package i WHERE  sr.id = r.sign_id  " +
                    " and sr.status=1 and sr.patient = '"+patientId+"'  " +
                    " AND r.service_package_id = i.id AND i.del = 1  AND sr.`status` = 1 and i.id in ('"+packagesId+"') ";
            if (jdbcTemplate.queryForList(sql).size()>0){
                result.put(ResponseContant.resultFlag, ResponseContant.fail);
                result.put(ResponseContant.resultMsg,"您已签约该机构,无法重复签约");
                return result;
            }
        }
        String signId = signRecordDO.getId();
        List<String> idList = new ArrayList<>();
        if(StringUtil.isEmpty(signId)){
            List<ServicePackageSignRecordDO> signRecordDOs = servicePackageSignRecordDao.findByStatusAndPatient(1,signRecordDO.getPatient());
            if(signRecordDOs.size()==0){
//            List<ServicePackageSignRecordDO> signRecordDOs = servicePackageSignRecordDao.findByStatusAndPatient(1,signRecordDO.getPatient());
//            if(signRecordDOs.size()==0){
                BaseDoctorDO doctorDO = doctorDao.findById(doctorId);
                //需要新增签约记录
                signRecordDO.setStatus(1);
@ -399,24 +434,24 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
                    archiveDO.setSignStatus(1);
                    archiveDao.save(archiveDO);
                }
            }else{
                //不能重复签约
                result.put(ResponseContant.resultFlag, ResponseContant.fail);
                result.put(ResponseContant.resultMsg,"请勿重复签约");
                return result;
//                ArchiveDO archiveDO = archiveDao.findByPatientAndDoctorCode(patientId,doctorId);
//                if(archiveDO!=null){
//                    archiveDO.setSignStatus(1);
//                    archiveDao.save(archiveDO);
//                }
//                signId = signRecordDOs.get(0).getId();
//                List<ServicePackageRecordDO> existList = servicePackageRecordDao.findBySignId(signId);
//                idList = existList.stream().map(ServicePackageRecordDO::getServicePackageId).collect(Collectors.toList());
            }
//            }else{
//                //不能重复签约
//                result.put(ResponseContant.resultFlag, ResponseContant.fail);
//                result.put(ResponseContant.resultMsg,"请勿重复签约");
//                return result;
////                ArchiveDO archiveDO = archiveDao.findByPatientAndDoctorCode(patientId,doctorId);
////                if(archiveDO!=null){
////                    archiveDO.setSignStatus(1);
////                    archiveDao.save(archiveDO);
////                }
////                signId = signRecordDOs.get(0).getId();
////                List<ServicePackageRecordDO> existList = servicePackageRecordDao.findBySignId(signId);
////                idList = existList.stream().map(ServicePackageRecordDO::getServicePackageId).collect(Collectors.toList());
//            }
        }else{
            //不能重复签约
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg,"请勿重复签约");
            result.put(ResponseContant.resultMsg,"不允许修改原有签约信息");
            return result;
        }
        //生成居民标签

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

@ -553,15 +553,6 @@ public class StatisticsService {
        String areaLevel = null;
        for(String ind:indexes){
            //总量
            if (ind.equals("41")||ind.equals("46")){//指标统计最小单位
                areaLevel="4";
            }
            if (ind.equals("45")){
                areaLevel="2";
            }
            if (ind.equals("52")){
                areaLevel="2";
            }
            SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel0(endDate, endDate, area, level, ind, SaveModel.timeLevel_DDL,areaLevel);
            res.put("index_"+ind+"_total",saveModel.getResult2().longValue());
            if(StringUtils.isNotBlank(type)){

+ 24 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/util/DeviceUtil.java

@ -0,0 +1,24 @@
package com.yihu.jw.care.util;
import com.yihu.jw.care.dao.device.DeviceDetailDao;
import com.yihu.jw.entity.care.device.DeviceDetail;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
 * Created by Bing on 2021/10/8.
 */
@Component
public class DeviceUtil {
    @Autowired
    private DeviceDetailDao deviceDetailDao;
    public void updateOnLineStatus(String deviceSn,Integer status) {
        DeviceDetail deviceDetail = deviceDetailDao.findBySn(deviceSn);
        if (deviceDetail != null) {
            deviceDetail.setContactStatus(status);
            deviceDetailDao.save(deviceDetail);
        }
    }
}

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

@ -888,6 +888,7 @@ public class DeviceService {
            DeviceDetail deviceDetail = deviceDetailDao.findBySn(device);
            if(deviceDetail!=null){
                deviceDetail.setContactStatus(Integer.parseInt(onlinestatu));
                deviceDetailDao.save(deviceDetail);
                if ("0".equals(onlinestatu)){
                    List<String> sns = new ArrayList<>();
                    sns.add(device);

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 22 - 1
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/service/YsDeviceService.java


+ 2 - 2
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/job/consult/FinishConsultJob.java

@ -59,7 +59,7 @@ public class FinishConsultJob implements Job {
            sql.append("SELECT s.id session_id, s.name session_name, s.create_date session_create_time, s.last_message_time, ")
            .append("t.id topic_id, t.name topic_name, t.create_time topic_create_time, t.start_message_id ")
            .append("FROM ").append(imDb).append(".sessions s,").append(imDb).append(".wlyy_consults t ")
            .append("WHERE s.id = t.session_id AND s.type in(23,24)  AND t.end_message_id IS NULL AND s.last_content_type in(1,2,3,4,15,16,17) and s.last_sender_id IN ( ")
            .append("WHERE s.id = t.session_id AND s.type in(23,24,25)  AND t.end_message_id IS NULL AND s.last_content_type in(1,2,3,4,15,16,17) and s.last_sender_id IN ( ")
            .append("SELECT id FROM ").append(imDb).append(".doctors d where d.id<>t.patient) ")
            .append("AND UNIX_TIMESTAMP(now()) - UNIX_TIMESTAMP(s.last_message_time) > 24*3600 ")
            .append("ORDER BY t.create_time");
@ -82,7 +82,7 @@ public class FinishConsultJob implements Job {
            sql = new StringBuffer();
            sql.append("SELECT s.id session_id,t.id topic_id, t.name topic_name ")
             .append("FROM ").append(imDb).append(".sessions s,").append(imDb).append(".wlyy_consults t ")
             .append("WHERE s.id = t.session_id AND s.type in (23,24) AND t.end_message_id IS NULL AND t.reply=1 AND s.last_content_type =14 ")
             .append("WHERE s.id = t.session_id AND s.type in (23,24,25) AND t.end_message_id IS NULL AND t.reply=1 AND s.last_content_type =14 ")
             .append("AND UNIX_TIMESTAMP(now()) - UNIX_TIMESTAMP(s.last_message_time) > 24*3600  ");
            StringBuffer sql2 = new StringBuffer();

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

@ -122,7 +122,15 @@ public class NetworkCardService {
        JSONObject responseBody = JSONObject.parseObject(groupInfo);
        if (responseBody.getInteger("status")==0) {
            JSONArray groupList = responseBody.getJSONArray("result").getJSONObject(0).getJSONArray("groupList");
            String groupId = groupList.getJSONObject(0).getString("groupId");
            String groupId = "";
            for(int i=0;i<groupList.size();i++){
                JSONObject tmp = groupList.getJSONObject(i);
                if (tmp.containsKey("offeringId")){
                    if ("11000006".equals( tmp.getString("offeringId"))){//语音卡群组
                        groupId = tmp.getString("groupId");
                    }
                }
            }
            if (StringUtils.isNotBlank(groupId)) {
                params.add(new BasicNameValuePair("groupId", groupId));
                params.add(new BasicNameValuePair("operType", operType));

+ 4 - 5
svr/svr-internet-hospital-entrance/pom.xml

@ -63,7 +63,10 @@
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-activemq</artifactId>
        </dependency>
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
@ -152,10 +155,6 @@
            <artifactId>mqSdk</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
        </dependency>
        <dependency>
            <groupId>io.github.swagger2markup</groupId>