Browse Source

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

liubing 4 years ago
parent
commit
4b23a65a91
16 changed files with 525 additions and 14 deletions
  1. 23 1
      common/common-entity/sql记录
  2. 12 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/device/DevicePatientDevice.java
  3. 11 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/lifeCare/LifeCareItemDictDO.java
  4. 41 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/sign/CapacityDoctorDO.java
  5. 4 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/device/PatientDeviceDao.java
  6. 5 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/sign/CapacityAssessmentRecordDao.java
  7. 17 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/sign/CapacityDoctorDao.java
  8. 157 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/device/PadDeviceController.java
  9. 5 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/device/PatientDeviceController.java
  10. 5 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/family/FamilyMemberEndpoint.java
  11. 130 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/lifeCare/PadLifeCareEndpoint.java
  12. 29 5
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/sign/SignEndpoint.java
  13. 41 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/PatientDeviceService.java
  14. 2 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/family/PatientFamilyMemberService.java
  15. 31 4
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/CapacityAssessmentRecordService.java
  16. 12 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/ServicePackageService.java

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

@ -448,4 +448,26 @@ alter table base_patient ADD disease varchar(50) ;
alter table patient_medicare_card ADD medicare_number varchar(50) ;
-- 2021-05-07 ysj
alter table base_patient_family_member add is_contacts tinyint(1) DEFAULT NULL COMMENT '是否是一键联系人';
alter table base_patient_family_member add is_contacts tinyint(1) DEFAULT NULL COMMENT '是否是一键联系人';
CREATE TABLE `base_capacity_doctor` (
  `id` varchar(50) NOT NULL,
  `capacity_id` varchar(50) DEFAULT NULL COMMENT '能力评估记录id',
  `doctor_id` varchar(50) DEFAULT NULL COMMENT '医生id',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='能力评估医生关联表';
CREATE TABLE `base_patient_contacts_org` (
  `id` varchar(50) NOT NULL,
  `patient` varchar(50) DEFAULT NULL,
  `org_code` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='居民联系服务站';
-- 2021-05-07 skj
ALTER TABLE base.wlyy_patient_device add COLUMN  `sos_address` varchar(50) DEFAULT NULL COMMENT '设备类型为报警器时,需要填写投放地址 category_code = 7';
-- 2021-05-08 skj
ALTER TABLE base.base_life_care_item_dict add COLUMN  `life_care_img` varchar(255) DEFAULT NULL COMMENT '服务项目图片';

+ 12 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/device/DevicePatientDevice.java

@ -65,6 +65,9 @@ public class DevicePatientDevice extends IdEntity {
    private String applyReason;
    //医生拒绝原因
    private String refuseReason;
    //设备类型为报警器时,需要填写投放地址 category_code = 7
    private String sosAddress;
  //========================非表字段======================
    //患者居住地址
    private String address;
@ -251,6 +254,15 @@ public class DevicePatientDevice extends IdEntity {
        this.checkDoctorName = checkDoctorName;
    }
    @Column(name = "sos_address")
    public String getSosAddress() {
        return sosAddress;
    }
    public void setSosAddress(String sosAddress) {
        this.sosAddress = sosAddress;
    }
    @Transient
    public String getAddress() {
        return address;

+ 11 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/lifeCare/LifeCareItemDictDO.java

@ -2,6 +2,7 @@ package com.yihu.jw.entity.care.lifeCare;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.math.BigDecimal;
@ -19,6 +20,7 @@ public class LifeCareItemDictDO extends UuidIdentityEntity{
    private BigDecimal price;//价格
    private Integer sort;//排序字段
    private Integer del;//删除标志 1正常,0删除
    private String lifeCareImg;//服务项目图片
    public String getCode() {
        return code;
@ -67,4 +69,13 @@ public class LifeCareItemDictDO extends UuidIdentityEntity{
    public void setDel(Integer del) {
        this.del = del;
    }
    @Column(name = "life_care_img")
    public String getLifeCareImg() {
        return lifeCareImg;
    }
    public void setLifeCareImg(String lifeCareImg) {
        this.lifeCareImg = lifeCareImg;
    }
}

+ 41 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/sign/CapacityDoctorDO.java

@ -0,0 +1,41 @@
package com.yihu.jw.entity.care.sign;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/5/8
 * @Description: 能力评估医生关联表
 */
@Entity
@Table(name = "base_capacity_doctor")
public class CapacityDoctorDO extends UuidIdentityEntity {
    private String capacityId;
    private String doctorId;
    @Column(name = "capacity_id")
    public String getCapacityId() {
        return capacityId;
    }
    public void setCapacityId(String capacityId) {
        this.capacityId = capacityId;
    }
    @Column(name = "doctor_id")
    public String getDoctorId() {
        return doctorId;
    }
    public void setDoctorId(String doctorId) {
        this.doctorId = doctorId;
    }
}

+ 4 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/device/PatientDeviceDao.java

@ -43,6 +43,10 @@ public interface PatientDeviceDao extends PagingAndSortingRepository<DevicePatie
    @Query("update DevicePatientDevice t set t.deviceSn = ?3 , t.userType = ?4,t.sim=?5,t.hospital=?6,t.hospitalName=?7,t.checkDoctorName=?8 where t.user = ?1 and t.deviceSn = ?2 ")
    int updatePatientDevice(String user, String deviceSN, String newDeviceSN, String userType, String sim, String hospital, String hospitalName, String checkDoctorName);
    //管理员解绑居民设备
    @Modifying
    @Query("update DevicePatientDevice t set t.del = 1  where t.deviceSn = ?1 ")
    int updatePatientDevice(String deviceSN);
    @Query("select a from DevicePatientDevice a")
    List<DevicePatientDevice> findAll();

+ 5 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/sign/CapacityAssessmentRecordDao.java

@ -2,14 +2,18 @@ package com.yihu.jw.care.dao.sign;
import com.yihu.jw.entity.care.sign.CapacityAssessmentRecordDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.Date;
/**
 * Created by yeshijie on 2021/2/25.
 */
public interface CapacityAssessmentRecordDao extends PagingAndSortingRepository<CapacityAssessmentRecordDO, String>,
        JpaSpecificationExecutor<CapacityAssessmentRecordDO> {
    CapacityAssessmentRecordDO findByPatient(String patient);
    @Query("select c from CapacityAssessmentRecordDO c where c.patient=?1 and c.assessmentTime>=?2 ")
    CapacityAssessmentRecordDO findByPatient(String patient,Date assessmentTime);
}

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

@ -0,0 +1,17 @@
package com.yihu.jw.care.dao.sign;
import com.yihu.jw.entity.care.sign.CapacityDoctorDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/5/8
 * @Description:
 */
public interface CapacityDoctorDao extends PagingAndSortingRepository<CapacityDoctorDO, String>, JpaSpecificationExecutor<CapacityDoctorDO> {
    CapacityDoctorDO findByCapacityIdAndDoctorId(String capacityId, String doctorId);
}

+ 157 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/device/PadDeviceController.java

@ -0,0 +1,157 @@
package com.yihu.jw.care.endpoint.device;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.care.dao.device.PatientDeviceDao;
import com.yihu.jw.care.endpoint.BaseController;
import com.yihu.jw.care.service.device.DeviceDetailService;
import com.yihu.jw.care.service.device.PatientDeviceService;
import com.yihu.jw.care.service.device.PatientHealthIndexService;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.sync.BaseSyncDataDO;
import com.yihu.jw.entity.care.device.DevicePatientDevice;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.rm.base.BaseRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
import java.util.List;
import java.util.Map;
/***
 * @ClassName: PadDeviceController
 * @Description:
 * @Auther: shi kejing
 * @Date: 2021/5/7 13:39
 */
@RestController
@RequestMapping(value = "pad/device")
@Api(value = "患者设备管理(平板端)", description = "患者设备管理")
public class PadDeviceController extends BaseController {
    @Autowired
    private PatientDeviceService patientDeviceService;
    @Autowired
    private DeviceDetailService deviceDetailService;
    @Autowired
    private BasePatientDao patientDao;
    private ObjectMapper objectMapper = new ObjectMapper();
    @Autowired
    private BaseDoctorDao baseDoctorDao;
    /**
     * 设备列表获取
     *
     * @return 操作结果
     */
    @ApiOperation("管理员获取设备列表")
    @RequestMapping(value = "PatientDeviceList", method = RequestMethod.GET)
    public String getDeviceByPatient(@ApiParam(name = "patientName", value = "居民姓名", defaultValue = "张")
                                     @RequestParam(value = "patientName", required = false) String patientName,
                                     @ApiParam(name = "idcard", value = "身份证号", defaultValue = "")
                                     @RequestParam(value = "idcard", required = false) String idcard,
                                     @ApiParam(name = "page", value = "分页起始id", defaultValue = "1")
                                     @RequestParam(value = "page", required = true) int page,
                                     @ApiParam(name = "pagesize", value = "每页条数", defaultValue = "10")
                                     @RequestParam(value = "pagesize", required = true) int pagesize) {
        try {
            List<Map<String , Object>> list = patientDeviceService.findDeviceFromAdmin(patientName, idcard, page, pagesize);
            return write(200, "查询成功", "data", list);
        } catch (Exception ex) {
            error(ex);
            return invalidUserException(ex, -1, ex.getMessage());
        }
    }
    @ApiOperation("平板端,添加设备时获取设备类型(大类)")
    @RequestMapping(value = "getDeviceTypeBig", method = RequestMethod.GET)
    public String getDeviceTypeBig(@ApiParam(name = "pyCode", value = "获取设备类型(默认为null,获取大类)", defaultValue = "")
                                       @RequestParam(value = "pyCode", required = false) String pyCode) {
        try {
            List<Map<String , Object>> list = patientDeviceService.getDeviceType(1,pyCode);
            return write(200, "查询成功", "data", list);
        } catch (Exception ex) {
            error(ex);
            return invalidUserException(ex, -1, ex.getMessage());
        }
    }
    @ApiOperation("平板端,添加设备时获取设备类型(小类)")
    @RequestMapping(value = "getDeviceTypeSmall", method = RequestMethod.GET)
    public String getDeviceTypeSmall(@ApiParam(name = "pyCode", value = "获取设备类型(默认为 watch,获取小类(智能手表多类型))", defaultValue = "watch")
                                         @RequestParam(value = "pyCode", required = false) String pyCode) {
        try {
            List<Map<String , Object>> list = patientDeviceService.getDeviceType(0,pyCode);
            return write(200, "查询成功", "data", list);
        } catch (Exception ex) {
            error(ex);
            return invalidUserException(ex, -1, ex.getMessage());
        }
    }
    @ApiOperation("设备保存接口(平板端绑定设备  设备为报警器时需要填写投放地址)")
    @RequestMapping(value = "SavePatientDevice", method = RequestMethod.POST)
    public String saveDevice(@ApiParam(name = "json", value = "设备数据json", defaultValue = "{     \"deviceId\":\"3\",     \"deviceName\":\"血压计-优瑞恩\",     \"deviceSn\":\"7052169111\",     \"categoryCode\":\"7\",     \"userType\":\"-1\", \"sosAddress\":\"福建省厦门市思明区望海路55号之1\" }")
                             @RequestParam(value = "json", required = true) String json,
                             @ApiParam(name = "patient", value = "居民code") @RequestParam(value = "patient", required = false) String patientCode
                             ) {
        try {
            DevicePatientDevice device = objectMapper.readValue(json, DevicePatientDevice.class);
            // 设置患者标识
            device.setUser(patientCode);
            //患者和设备是否首绑
            Map<String,Object> checkMap = patientDeviceService.checkBindingFirstAndType(device);
            boolean flag = (Boolean)checkMap.get("flag");
            int code = (Integer)checkMap.get("code");
            if (code==-30000){
                return write(-1,"设备不存在或者数据存在错误!");
            }
            BaseDoctorDO doctor = baseDoctorDao.findById(getUID());
            device.setAgent(getUID());
            device.setAgentName(doctor.getName());
            String sn = device.getDeviceSn();
            synchronized (sn.intern()){
                Boolean flagDevice = patientDeviceService.saveDevice(device);
                if (flagDevice == false){
                    return write(-1,"请填写投放地址");
                }
            }
            //修改设备表中{"1":"0", "2":"0"}的绑定次数 和其他绑定信息
            deviceDetailService.updateAfterBinding(device,new Date(),flag);
            return success("设备保存成功!");
        } catch (Exception ex) {
            error(ex);
            return invalidUserException(ex, -1, ex.getMessage());
        }
    }
    @ApiOperation("设备解绑接口(平板端解绑设备 )")
    @RequestMapping(value = "delDeviceByDeviceSn", method = RequestMethod.POST)
    public String delDeviceByDeviceSn(
                             @ApiParam(name = "deviceSn", value = "设备sn码") @RequestParam(value = "deviceSn", required = false) String deviceSn
    ) {
        try {
                int flagDevice = patientDeviceService.delDeviceByDeviceSn(deviceSn);
                if (flagDevice == 1){
                    return success("设备解绑成功!");
                }else {
                    return write(-1,"解绑失败,请确认设备sn码");
                }
        } catch (Exception ex) {
            error(ex);
            return invalidUserException(ex, -1, ex.getMessage());
        }
    }
}

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

@ -94,7 +94,11 @@ public class PatientDeviceController extends BaseController {
            }
            String sn = device.getDeviceSn();
            synchronized (sn.intern()){
                patientDeviceService.saveDevice(device);
//                patientDeviceService.saveDevice(device);
                Boolean flagDevice = patientDeviceService.saveDevice(device);
                if (flagDevice == false){
                    return write(-1,"请填写投放地址");
                }
            }
            //修改设备表中{"1":"0", "2":"0"}的绑定次数 和其他绑定信息
            deviceDetailService.updateAfterBinding(device,new Date(),flag);

+ 5 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/family/FamilyMemberEndpoint.java

@ -163,6 +163,7 @@ public class FamilyMemberEndpoint extends EnvelopRestEndpoint {
            }
            return success( "授权成功");
        }catch (Exception e){
            e.printStackTrace();
            return failed("授权失败",-1);
        }
    }
@ -256,6 +257,7 @@ public class FamilyMemberEndpoint extends EnvelopRestEndpoint {
            JSONObject result = familyMemberService.isRegister(idcard, getUID());
            return ObjEnvelop.getSuccess( "查询成功",  result);
        } catch (Exception e) {
            e.printStackTrace();
            return ObjEnvelop.getError( "查询失败");
        }
    }
@ -272,6 +274,7 @@ public class FamilyMemberEndpoint extends EnvelopRestEndpoint {
            JSONObject result = familyMemberService.checkFamilyMember(memberCode);
            return ObjEnvelop.getSuccess( "验证成功",  result);
        }catch (Exception e){
            e.printStackTrace();
            return ObjEnvelop.getError( "验证失败");
        }
    }
@ -308,6 +311,7 @@ public class FamilyMemberEndpoint extends EnvelopRestEndpoint {
                return success( "添加成功");
            }
        } catch (Exception e) {
            e.printStackTrace();
            return failed( "添加失败",-1);
        }
    }
@ -357,6 +361,7 @@ public class FamilyMemberEndpoint extends EnvelopRestEndpoint {
                return success( "添加成功");
            }
        } catch (Exception e) {
            e.printStackTrace();
            return failed( "添加失败",-1);
        }
    }

+ 130 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/lifeCare/PadLifeCareEndpoint.java

@ -0,0 +1,130 @@
package com.yihu.jw.care.endpoint.lifeCare;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.service.lifeCare.LifeCareOrderService;
import com.yihu.jw.entity.care.lifeCare.LifeCareOrderDO;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/***
 * @ClassName: PadLifeCareEndpoint
 * @Description:
 * @Auther: shi kejing
 * @Date: 2021/5/7 11:05
 */
@RestController
@RequestMapping(value = "pad/lifeCare")
@Api(value = "平板端-生活照料", description = "生活照料相关", tags = {"平板端-生活照料相关"})
public class PadLifeCareEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private LifeCareOrderService lifeCareOrderService;
    @PostMapping(value = "create")
    @ApiOperation(value = "申请生活照料")
    public Envelop create(@ApiParam(name = "jsonData", value = "Json数据", required = true) @RequestParam String jsonData) {
        JSONObject result = new JSONObject();
        try{
            result = lifeCareOrderService.create(jsonData,getUID());
        }catch (Exception e){
            e.printStackTrace();
            return Envelop.getError("操作失败",-1);
        }
        if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
            return Envelop.getError(result.getString(ResponseContant.resultMsg),-1);
        }
        return success(result);
    }
    @PostMapping(value = "cancelOrder")
    @ApiOperation(value = "取消工单")
    public Envelop cancelOrder(
            @ApiParam(name = "orderId", value = "工单id") @RequestParam(value = "orderId", required = true) String orderId,
            @ApiParam(name = "reason", value = "取消理由") @RequestParam(value = "reason", required = true) String reason) {
        JSONObject result = new JSONObject();
        try{
            result = lifeCareOrderService.cancelOrder(orderId, 2, reason);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return Envelop.getError(result.getString(ResponseContant.resultMsg),-1);
            }
        }catch (Exception e){
            e.printStackTrace();
            return Envelop.getError("操作失败",-1);
        }
        return success(result.get(ResponseContant.resultMsg));
    }
    @GetMapping(value = "queryInfoStatusCountList")
    @ApiOperation(value = "统计生活照料工单各状态下的数量列表")
    public Envelop queryInfoStatusCountList(
            @ApiParam(name = "patient", value = "居民code") @RequestParam(value = "patient", required = false) String patient) {
        try {
            JSONObject result = lifeCareOrderService.queryInfoStatusCountList(patient);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return Envelop.getError(result.getString(ResponseContant.resultMsg),-1);
            }
            return success(result.get(ResponseContant.resultMsg));
        }catch (Exception e){
            e.printStackTrace();
            return Envelop.getError("查询失败",-1);
        }
    }
    @GetMapping(value = "infoList")
    @ApiOperation(value = "查询工单记录")
    public PageEnvelop page(
            @ApiParam(name = "patient", value = "居民code") @RequestParam(value = "patient", required = true) String patient,
            @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 = lifeCareOrderService.queryInfoList(patient, status, page, size);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return PageEnvelop.getError(result.getString(ResponseContant.resultMsg), -1);
            }
            int count = result.getIntValue(ResponseContant.count);
            return success((List) result.get(ResponseContant.resultMsg), count, page, size);
        }catch (Exception e){
            e.printStackTrace();
            return PageEnvelop.getError("查询失败", -1);
        }
    }
    @GetMapping(value = "findItemDict")
    @ApiOperation(value = "查找服务项字典")
    public ListEnvelop findItemDict() {
        try {
            return ListEnvelop.getSuccess("查询成功",lifeCareOrderService.findItemDict());
        }catch (Exception e){
            e.printStackTrace();
            return ListEnvelop.getError("查询失败");
        }
    }
    @GetMapping("getByOrderId")
    @ApiOperation(value = "根据工单id获取相应的工单")
    public ObjEnvelop getByOrderId(
            @ApiParam(value = "工单id", name = "orderId")
            @RequestParam(value = "orderId", required = true) String orderId) {
        try {
            // 根据orderId获取工单信息
            LifeCareOrderDO doorServiceOrderDO = lifeCareOrderService.getServiceOrderById(orderId);
            return ObjEnvelop.getSuccess("获取成功", doorServiceOrderDO);
        } catch (Exception e) {
            e.printStackTrace();
            return ObjEnvelop.getError( "获取失败" ,-1);
        }
    }
}

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

@ -7,9 +7,7 @@ import com.yihu.jw.care.dao.sign.CapacityAssessmentRecordDao;
import com.yihu.jw.care.service.sign.ArchiveService;
import com.yihu.jw.care.service.sign.CapacityAssessmentRecordService;
import com.yihu.jw.care.service.sign.ServicePackageService;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.servicePackage.ServicePackageSignRecordDO;
import com.yihu.jw.entity.care.archive.ArchiveDO;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.ResponseContant;
@ -21,12 +19,9 @@ import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -290,6 +285,23 @@ public class SignEndpoint extends EnvelopRestEndpoint {
        }
    }
    @PostMapping(value = "synCapacityRecord" )
    @ApiOperation(value = "同步能力评估报告")
    @ObserverRequired
    public Envelop synCapacityRecord(
            @ApiParam(name = "patient", value = "患者id", required = true)
            @RequestParam String patient,
            @ApiParam(name = "doctorId", value = "医生id", required = true)
            @RequestParam String doctorId) {
        try{
            capacityAssessmentRecordService.synCapacityRecord(patient,doctorId);
            return success("同步成功");
        }catch (Exception e){
            e.printStackTrace();
            return failed("同步失败",-1);
        }
    }
    @PostMapping(value = "capacityAssessmentByPatient" )
    @ApiOperation(value = "通过患者id生成当年能力评估报告")
    @ObserverRequired
@ -492,6 +504,18 @@ public class SignEndpoint extends EnvelopRestEndpoint {
        }
    }
    @GetMapping(value="getServerDoctorAll")
    @ApiOperation(value = "获取所有服务医生")
    public ListEnvelop getServerDoctorAll(            @ApiParam(name = "patient", value = "患者id", required = true)
                                                          @RequestParam(value = "patient") String patient){
        try {
            return ListEnvelop.getSuccess("查询成功",servicePackageService.getServerDoctorAll(patient));
        }catch (Exception e){
            e.printStackTrace();
            return ListEnvelop.getError("查询失败");
        }
    }
    @GetMapping(value="getPackageDetailById")
    @ApiOperation(value = "获取服务包详情")
    public ObjEnvelop getPackageDetailById(@ApiParam(name="packageId",value = "服务包id",required = true)

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

@ -18,6 +18,7 @@ import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.utils.StringUtil;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
@ -127,11 +128,18 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
        String type = devicePatientDevice.getCategoryCode();
        Long deviceId = devicePatientDevice.getDeviceId();
        String userType = devicePatientDevice.getUserType();
        String sosAddress = null;
        if (userType == null) {
            userType = "-1";
            devicePatientDevice.setUserType("-1");
        }
        if (type.equals("7")){
            if (StringUtils.isBlank(devicePatientDevice.getSosAddress())){
                return false;
            }
        }
        boolean needVerify = true;
        //修改操作
        if (devicePatientDevice.getId() != null) {
@ -168,6 +176,15 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
        return true;
    }
    public int delDeviceByDeviceSn(String deviceSn){
        String sql = "select * from wlyy_patient_device where del = 0 and device_sn = '"+deviceSn+"'";
        List<Map<String , Object>> list = jdbcTemplate.queryForList(sql);
        if (list.size() > 0){
            return patientDeviceDao.updatePatientDevice(deviceSn);
        }else {
            return 0;
        }
    }
    public void deleteDevices(String deviceSn, String type, String uuid) {
        List<DevicePatientDevice> devicePatientDevices = patientDeviceDao.findByDeviceSnAndCategoryCode(deviceSn, type);
@ -230,6 +247,30 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
        return patientDeviceDao.findAll(spec, pageRequest);
    }
    public List<Map<String , Object>> findDeviceFromAdmin(String patientName, String Idcard, int page, int pageSize) {
        String sql = "select p.id,p.`name`,pd.device_id deviceId,pd.category_code categoryCode,pd.device_name deviceName,pd.device_sn deviceSn,pd.czrq,pd.doctor,\n" +
                "pd.doctor_name doctorName,pd.agent,pd.agent_name agentName from wlyy_patient_device pd,base_patient p where p.id = pd.`user`";
        if (StringUtils.isNotBlank(patientName)){
            sql += " AND p.`name` LIKE '%" + patientName +"%'";
        }
        if (StringUtils.isNotBlank(Idcard)){
            sql += " AND p.idcard LIKE '%" + Idcard + "%'";
        }
        sql += " ORDER BY pd.czrq DESC LIMIT "+ (page-1)*pageSize +" , " + pageSize + " ";
        List<Map<String , Object>> list = jdbcTemplate.queryForList(sql);
        return list;
    }
    public List<Map<String , Object>> getDeviceType(int type,String pyCode) {
        String sql = "SELECT * FROM base_system_dict WHERE saas_id = 'device_type' AND type = "+type+"";
        if (StringUtils.isNotBlank(pyCode)){
            sql += " and py_code = '"+pyCode+"' " ;
        }
        List<Map<String , Object>> list = jdbcTemplate.queryForList(sql);
        return list;
    }
    /**
     * 患者设备列表接口--医生端
     */

+ 2 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/family/PatientFamilyMemberService.java

@ -365,9 +365,9 @@ public class PatientFamilyMemberService extends BaseJpaService<BasePatientFamily
                "    t2.id in (select family_member from base_patient_family_member where patient = ? ) " +
                "    and t1.patient = ? " +
                "    and t1.family_member = t2.id ";
        if(isContacts != null){
/*        if(isContacts != null){
            sql += " and t1.is_contacts = "+ isContacts;
        }
        }*/
        List<Map<String, Object>> result = jdbcTemplate.queryForList(sql, new Object[]{patient, patient});
        if (result != null && result.size() > 0) {

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

@ -75,14 +75,17 @@ public class CapacityAssessmentRecordService extends BaseJpaService<CapacityAsse
    private PatientBedApplyDao patientBedApplyDao;
    @Autowired
    private BaseDoctorHospitalDao baseDoctorHospitalDao;
    @Autowired
    private CapacityDoctorDao capacityDoctorDao;
    /**
     * 按id查找评估明细
     * @param patient
     * @return
     */
    public CapacityAssessmentRecordDO findAssessmentByPatientId(String patient)  {
        CapacityAssessmentRecordDO recordDO = capacityAssessmentRecordDao.findByPatient(patient);
    public CapacityAssessmentRecordDO findAssessmentByPatientId(String patient) throws Exception {
        Date assessmentTime =  DateUtil.dateTimeParse(DateUtil.getNowYear() + "-01-01 00:00:00");
        CapacityAssessmentRecordDO recordDO = capacityAssessmentRecordDao.findByPatient(patient,assessmentTime);
        recordDO.setLevelConclusionName(dictService.fingByNameAndCode(ConstantUtil.DICT_LEVEL_CONCLUSION,String.valueOf(recordDO.getLevelConclusion())));
        return recordDO;
    }
@ -152,11 +155,11 @@ public class CapacityAssessmentRecordService extends BaseJpaService<CapacityAsse
                "c.`status`,c.level_conclusion levelConclusion,c.org_code orgCode,c.org_name orgName,p.name,p.photo,p.mobile,p.sex,p.idcard  ";
        String countSql = "SELECT count(*) ";
        String filters = "from base_capacity_assessment_record c,base_patient p " +
        String filters = "from base_capacity_assessment_record c left join base_capacity_doctor d on c.id =d.capacity_id ,base_patient p " +
                "WHERE  c.patient = p.id  and c.assessment_time>='" + DateUtil.getNowYear() + "-01-01'";
        if(StringUtils.isNoneBlank(doctorId)){
            filters += " and c.doctor = '"+doctorId+"' ";
            filters += " and (c.doctor = '"+doctorId+"' or d.doctor_id = '"+doctorId+"')";
        }
        if(status!=null){
            filters += " and c.status = "+status;
@ -271,6 +274,30 @@ public class CapacityAssessmentRecordService extends BaseJpaService<CapacityAsse
        return result;
    }
    /**
     * 同步能力评估
     * @param patient
     * @param doctorId
     * @throws Exception
     */
    public void synCapacityRecord(String patient,String doctorId) throws Exception{
        Date assessmentTime =  DateUtil.dateTimeParse(DateUtil.getNowYear() + "-01-01 00:00:00");
        CapacityAssessmentRecordDO recordDO = capacityAssessmentRecordDao.findByPatient(patient,assessmentTime);
        if(recordDO == null){
            throw new Exception("居民不存在有效的能力评估报告");
        }
        if(doctorId.equals(recordDO.getDoctor())){
           return;
        }
        CapacityDoctorDO capacityDoctorDO = capacityDoctorDao.findByCapacityIdAndDoctorId(recordDO.getId(),doctorId);
        if(capacityDoctorDO == null){
            capacityDoctorDO = new CapacityDoctorDO();
            capacityDoctorDO.setCapacityId(recordDO.getId());
            capacityDoctorDO.setDoctorId(doctorId);
            capacityDoctorDao.save(capacityDoctorDO);
        }
    }
    /**
     * 通过患者id 生成当年评估报告
     * @param patient

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

@ -480,6 +480,18 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
        return result;
    }
    public List<Map<String,Object>> getServerDoctorAll(String patient){
        String sql="select DISTINCT doc.id doctor,CONCAT(doc.`name`,CASE WHEN doc.doctor_level=1 THEN '(社区医生)' ELSE '(助老员)' END) as name,doc.photo,doc.mobile\n" +
                "from base_service_package_item item ,base_service_package pack,base_team_member mem,base_doctor doc\n" +
                "where item.service_package_id in (\n" +
                "SELECT spc.service_package_id FROM base_service_package_record spc ,base_service_package_sign_record spsr\n" +
                "WHERE spc.patient = '"+patient+"' AND spsr.status = 1 AND spsr.patient = spc.patient\n" +
                ") and item.service_package_id = pack.id\n" +
                "and item.team_code = mem.team_code and mem.doctor_code = doc.id and mem.del=1 and pack.del=1 and item.del = 1";
        List<Map<String,Object>>result = jdbcTemplate.queryForList(sql);
        return result;
    }
    public Map<String,Object> getPackageDetailById(String packageId){
        String sql="select * from base_service_package where id='"+packageId+"' and del=1 ";
        Map<String,Object>result = jdbcTemplate.queryForMap(sql);