소스 검색

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

wangjun 3 년 전
부모
커밋
cf9c4fc347
18개의 변경된 파일1106개의 추가작업 그리고 37개의 파일을 삭제
  1. 37 0
      common/common-entity/sql记录
  2. 98 0
      common/common-entity/src/main/java/com/yihu/jw/entity/voluntary/VoluntaryRecruitmentArrangeDO.java
  3. 111 0
      common/common-entity/src/main/java/com/yihu/jw/entity/voluntary/VoluntaryRecruitmentCompanyDO.java
  4. 111 0
      common/common-entity/src/main/java/com/yihu/jw/entity/voluntary/VoluntaryRecruitmentPeopleDO.java
  5. 4 0
      gateway/ag-basic/src/main/resources/application.yml
  6. 15 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/voluntary/VoluntaryRecruitmentArrangeDao.java
  7. 21 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/voluntary/VoluntaryRecruitmentCompanyDao.java
  8. 23 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/voluntary/VoluntaryRecruitmentPeopleDao.java
  9. 157 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/voluntary/VoluntaryRecruitmentCompanyEndpoint.java
  10. 136 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/voluntary/VoluntaryRecruitmentEndpoint.java
  11. 107 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/voluntary/VoluntaryRecruitmentPeopleEndpoint.java
  12. 18 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/voluntary/VoluntaryRecruitmentArrangeService.java
  13. 18 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/voluntary/VoluntaryRecruitmentCompanyService.java
  14. 18 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/voluntary/VoluntaryRecruitmentPeopleService.java
  15. 119 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/voluntary/VoluntaryRecruitmentService.java
  16. 7 4
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/birthday/BirthdayWishesService.java
  17. 82 24
      svr/svr-cloud-device/src/main/java/com/yihu/jw/care/endpoint/DeviceController.java
  18. 24 9
      svr/svr-cloud-device/src/main/java/com/yihu/jw/care/service/DeviceService.java

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

@ -1167,5 +1167,42 @@ ALTER table base.base_login_log add column client_type varchar(10) DEFAULT NULL
-- 2021-7-22 lb
-- 2021-7-22 lb
alter table base_life_care_item_dict add column pad_icon_img varchar(255) DEFAULT NULL COMMENT 'pad图标'
alter table base_life_care_item_dict add column pad_icon_img varchar(255) DEFAULT NULL COMMENT 'pad图标'
-- 2021-08-02 ysj
CREATE TABLE `voluntary_recruitment_arrange` (
  `id` varchar(50) NOT NULL,
  `company_id` varchar(50) DEFAULT NULL,
  `day` varchar(10) DEFAULT NULL COMMENT '服务日期',
  `time` varchar(10) DEFAULT NULL COMMENT '服务时间段',
  `people_id` varchar(50) DEFAULT NULL COMMENT '服务人员id',
  `station` varchar(50) DEFAULT NULL COMMENT '服务站',
  `people_name` varchar(50) DEFAULT NULL COMMENT '服务人员姓名',
  `create_time` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `voluntary_recruitment_company` (
  `id` varchar(50) NOT NULL,
  `name` varchar(100) DEFAULT NULL COMMENT '单位名称',
  `contacts` varchar(50) DEFAULT NULL COMMENT '联系人',
  `phone` varchar(50) DEFAULT NULL COMMENT '联系人手机',
  `times` varchar(30) DEFAULT NULL COMMENT '服务时间段',
  `service_station` varchar(5000) DEFAULT NULL COMMENT '服务站',
  `num` int(10) DEFAULT NULL COMMENT '报名人数',
  `create_time` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='新冠志愿招募-企业';
CREATE TABLE `voluntary_recruitment_people` (
  `id` varchar(50) NOT NULL,
  `company_id` varchar(50) DEFAULT NULL,
  `company_name` varchar(100) DEFAULT NULL,
  `name` varchar(50) DEFAULT NULL,
  `phone` varchar(50) DEFAULT NULL,
  `idcard` varchar(50) DEFAULT NULL,
  `vaccination` tinyint(1) DEFAULT NULL COMMENT '是否接种疫苗 0未接种 1接种1针 2已接种',
  `experience` tinyint(1) DEFAULT NULL COMMENT '是否有核酸设备运维经验',
  `create_time` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='企业人员表';

+ 98 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/voluntary/VoluntaryRecruitmentArrangeDO.java

@ -0,0 +1,98 @@
package com.yihu.jw.entity.voluntary;
import com.yihu.jw.entity.UuidIdentityEntityWithCreateTime;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created with IntelliJ IDEA.
 * 志愿招募人员安排表
 * @Author: yeshijie
 * @Date: 2021/8/1
 * @Description:
 */
@Entity
@Table(name="voluntary_recruitment_arrange")
public class VoluntaryRecruitmentArrangeDO extends UuidIdentityEntityWithCreateTime{
    /**
     * 单位id
     */
    private String companyId;
    /**
     * '服务日期'
     */
    private String day;
    /**
     * '服务时间段'
     */
    private String time;
    /**
     * '服务人员id'
     */
    private String peopleId;
    /**
     * '服务人员姓名'
     */
    private String peopleName;
    /**
     * '服务站'
     */
    private String station;
    @Column(name = "company_id")
    public String getCompanyId() {
        return companyId;
    }
    public void setCompanyId(String companyId) {
        this.companyId = companyId;
    }
    @Column(name = "day")
    public String getDay() {
        return day;
    }
    public void setDay(String day) {
        this.day = day;
    }
    @Column(name = "time")
    public String getTime() {
        return time;
    }
    public void setTime(String time) {
        this.time = time;
    }
    @Column(name = "people_id")
    public String getPeopleId() {
        return peopleId;
    }
    public void setPeopleId(String peopleId) {
        this.peopleId = peopleId;
    }
    @Column(name = "people_name")
    public String getPeopleName() {
        return peopleName;
    }
    public void setPeopleName(String peopleName) {
        this.peopleName = peopleName;
    }
    @Column(name = "station")
    public String getStation() {
        return station;
    }
    public void setStation(String station) {
        this.station = station;
    }
}

+ 111 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/voluntary/VoluntaryRecruitmentCompanyDO.java

@ -0,0 +1,111 @@
package com.yihu.jw.entity.voluntary;
import com.yihu.jw.entity.UuidIdentityEntityWithCreateTime;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.List;
/**
 * Created with IntelliJ IDEA.
 * 只有招募单位表
 * @Author: yeshijie
 * @Date: 2021/8/1
 * @Description:
 */
@Entity
@Table(name="voluntary_recruitment_company")
public class VoluntaryRecruitmentCompanyDO extends UuidIdentityEntityWithCreateTime{
    /**
     * 单位名称
     */
    private String name;
    /**
     * 联系人
     */
    private String contacts;
    /**
     * 联系人手机
     */
    private String phone;
    /**
     * 服务时间段
     */
    private String times;
    /**
     * 服务站
     */
    private String serviceStation;
    /**
     * 报名人数
     */
    private Integer num;
    List<VoluntaryRecruitmentPeopleDO> peopleDOList;
    @Column(name = "name")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @Column(name = "contacts")
    public String getContacts() {
        return contacts;
    }
    public void setContacts(String contacts) {
        this.contacts = contacts;
    }
    @Column(name = "phone")
    public String getPhone() {
        return phone;
    }
    public void setPhone(String phone) {
        this.phone = phone;
    }
    @Column(name = "times")
    public String getTimes() {
        return times;
    }
    public void setTimes(String times) {
        this.times = times;
    }
    @Column(name = "service_station")
    public String getServiceStation() {
        return serviceStation;
    }
    public void setServiceStation(String serviceStation) {
        this.serviceStation = serviceStation;
    }
    @Column(name = "num")
    public Integer getNum() {
        return num;
    }
    public void setNum(Integer num) {
        this.num = num;
    }
    @Transient
    public List<VoluntaryRecruitmentPeopleDO> getPeopleDOList() {
        return peopleDOList;
    }
    public void setPeopleDOList(List<VoluntaryRecruitmentPeopleDO> peopleDOList) {
        this.peopleDOList = peopleDOList;
    }
}

+ 111 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/voluntary/VoluntaryRecruitmentPeopleDO.java

@ -0,0 +1,111 @@
package com.yihu.jw.entity.voluntary;
import com.yihu.jw.entity.UuidIdentityEntityWithCreateTime;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created with IntelliJ IDEA.
 * 志愿招募企业表
 * @Author: yeshijie
 * @Date: 2021/8/1
 * @Description:
 */
@Entity
@Table(name="voluntary_recruitment_people")
public class VoluntaryRecruitmentPeopleDO extends UuidIdentityEntityWithCreateTime{
    /**
     * 单位id
     */
    private String companyId;
    /**
     * 单位名称
     */
    private String companyName;
    /**
     * 姓名
     */
    private String name;
    /**
     * 手机
     */
    private String phone;
    /**
     * 身份证
     */
    private String idcard;
    /**
     * 是否接种疫苗 0未接种 1接种1针 2已接种
     */
    private String vaccination;
    /**
     * 是否有核酸设备运维经验
     */
    private String experience;
    @Column(name = "company_id")
    public String getCompanyId() {
        return companyId;
    }
    public void setCompanyId(String companyId) {
        this.companyId = companyId;
    }
    @Column(name = "company_name")
    public String getCompanyName() {
        return companyName;
    }
    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }
    @Column(name = "name")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @Column(name = "phone")
    public String getPhone() {
        return phone;
    }
    public void setPhone(String phone) {
        this.phone = phone;
    }
    @Column(name = "idcard")
    public String getIdcard() {
        return idcard;
    }
    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }
    @Column(name = "vaccination")
    public String getVaccination() {
        return vaccination;
    }
    public void setVaccination(String vaccination) {
        this.vaccination = vaccination;
    }
    @Column(name = "experience")
    public String getExperience() {
        return experience;
    }
    public void setExperience(String experience) {
        this.experience = experience;
    }
}

+ 4 - 0
gateway/ag-basic/src/main/resources/application.yml

@ -62,6 +62,10 @@ zuul:
    svr-base:
    svr-base:
      path: /cityihealth/base/**
      path: /cityihealth/base/**
      serviceId: svr-base
      serviceId: svr-base
#新冠患者招募
    svr-base-vol:
      path: /cityihealth/baseVol/**
      serviceId: svr-base-vol
    svr-authentication:
    svr-authentication:
      path: /cityihealth/auth/**
      path: /cityihealth/auth/**
      serviceId: svr-authentication
      serviceId: svr-authentication

+ 15 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/voluntary/VoluntaryRecruitmentArrangeDao.java

@ -0,0 +1,15 @@
package com.yihu.jw.base.dao.voluntary;
import com.yihu.jw.entity.voluntary.VoluntaryRecruitmentArrangeDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * @Author: yeshijie
 * @Date: 2021/8/1
 * @Description:
 */
public interface VoluntaryRecruitmentArrangeDao extends PagingAndSortingRepository<VoluntaryRecruitmentArrangeDO, String>, JpaSpecificationExecutor<VoluntaryRecruitmentArrangeDO> {
}

+ 21 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/voluntary/VoluntaryRecruitmentCompanyDao.java

@ -0,0 +1,21 @@
package com.yihu.jw.base.dao.voluntary;
import com.yihu.jw.entity.voluntary.VoluntaryRecruitmentCompanyDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * @Author: yeshijie
 * @Date: 2021/8/1
 * @Description:
 */
public interface VoluntaryRecruitmentCompanyDao extends PagingAndSortingRepository<VoluntaryRecruitmentCompanyDO, String>, JpaSpecificationExecutor<VoluntaryRecruitmentCompanyDO> {
    VoluntaryRecruitmentCompanyDO findByName(String name);
    boolean existsByName(String name);
    List<VoluntaryRecruitmentCompanyDO> findByContactsAndPhone(String contacts,String phone);
}

+ 23 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/voluntary/VoluntaryRecruitmentPeopleDao.java

@ -0,0 +1,23 @@
package com.yihu.jw.base.dao.voluntary;
import com.yihu.jw.entity.voluntary.VoluntaryRecruitmentPeopleDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * @Author: yeshijie
 * @Date: 2021/8/1
 * @Description:
 */
public interface VoluntaryRecruitmentPeopleDao extends PagingAndSortingRepository<VoluntaryRecruitmentPeopleDO, String>, JpaSpecificationExecutor<VoluntaryRecruitmentPeopleDO> {
    boolean existsByPhone(String phone);
    List<VoluntaryRecruitmentPeopleDO> queryByIdIn(String[] id);
    @Query("select count(1) from VoluntaryRecruitmentPeopleDO where companyId = ?1 ")
    Integer findByCompanyId(String CompanyId);
}

+ 157 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/voluntary/VoluntaryRecruitmentCompanyEndpoint.java

@ -0,0 +1,157 @@
package com.yihu.jw.base.endpoint.voluntary;
import com.yihu.jw.base.service.voluntary.VoluntaryRecruitmentCompanyService;
import com.yihu.jw.entity.voluntary.VoluntaryRecruitmentCompanyDO;
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 jxl.Workbook;
import jxl.write.Label;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import jxl.write.WriteException;
import org.apache.http.client.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/8/1
 * @Description:
 */
@RestController
@RequestMapping(value = "voluntaryRecruitmentCompany")
@Api(value = "新冠-志愿招募单位管理", description = "新冠-志愿招募单位管理", tags = {"新冠-志愿招募单位管理"})
public class VoluntaryRecruitmentCompanyEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private VoluntaryRecruitmentCompanyService companyService;
    @PostMapping(value = "delete")
    @ApiOperation(value = "删除")
    public Envelop delete(
            @ApiParam(name = "ids", value = "id串,中间用,分隔", required = true)
            @RequestParam(value = "ids") String ids) {
        companyService.delete(ids.split(","));
        return success("删除成功");
    }
    @PostMapping(value = "update")
    @ApiOperation(value = "更新")
    public ObjEnvelop<VoluntaryRecruitmentCompanyDO> update(
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestParam String jsonData) throws Exception {
        VoluntaryRecruitmentCompanyDO appVersion = toEntity(jsonData, VoluntaryRecruitmentCompanyDO.class);
        if (null == appVersion.getId()) {
            return failed("ID不能为空", ObjEnvelop.class);
        }
        appVersion = companyService.save(appVersion);
        return success(appVersion, VoluntaryRecruitmentCompanyDO.class);
    }
    @GetMapping(value = "page")
    @ApiOperation(value = "获取分页")
    public PageEnvelop<VoluntaryRecruitmentCompanyDO> page(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts,
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
            @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size) throws Exception {
        List<VoluntaryRecruitmentCompanyDO> appVersions = companyService.search(fields, filters, sorts, page, size);
        int count = (int) companyService.getCount(filters);
        return success(appVersions, count, page, size, VoluntaryRecruitmentCompanyDO.class);
    }
    @GetMapping(value = "list")
    @ApiOperation(value = "获取列表")
    public ListEnvelop<VoluntaryRecruitmentCompanyDO> list(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
        List<VoluntaryRecruitmentCompanyDO> appVersions = companyService.search(fields, filters, sorts);
        return success(appVersions, VoluntaryRecruitmentCompanyDO.class);
    }
    @GetMapping(value = "/excelControl/exportExcel")
    @ApiOperation("导出列表")
    @ResponseBody
    public void searchList(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts,
            HttpServletResponse response) {
        try {
            List<VoluntaryRecruitmentCompanyDO> appVersions = companyService.search(fields, filters, sorts);
            response.setContentType("octets/stream");
            response.setHeader("Content-Disposition", "attachment; filename=" + new String("volunteerInfo.xls"));
            OutputStream os = response.getOutputStream();
            this.write(os, appVersions);
        } catch (Exception ex) {
            Envelop.getError("导出失败");
        }
    }
    private void write(OutputStream os, List<VoluntaryRecruitmentCompanyDO> list) throws Exception {
        WritableWorkbook wwb = Workbook.createWorkbook(os);
        try {
            WritableSheet sheet = wwb.createSheet("sheet", 1);
            String header[] = {"序号", "所在单位", "单位联系人", " 联系人手机号", "报名志愿者人数", "意向服务时间段", "意向服务的核酸采集点"};
            int i = 0;
            for (String h : header) {
                addCell(sheet, 0, i, h);
                i++;
            }
            int j = 1;
            int ii=1;
            for (VoluntaryRecruitmentCompanyDO tmp : list) {
                addCell(sheet, j, 0, ii + "");
                addCell(sheet, j, 1, tmp.getName());
                addCell(sheet, j, 2, tmp.getContacts());
                addCell(sheet, j, 3, tmp.getPhone() + "");
                addCell(sheet, j, 4, tmp.getNum()+"");
                addCell(sheet, j, 5, tmp.getTimes() + "");
                addCell(sheet, j, 6, tmp.getServiceStation() + "");
                j++;
                ii++;
            }
            wwb.write();
            wwb.close();
        } catch (Exception e) {
            e.printStackTrace();
            if (wwb != null) wwb.close();
        }
    }
    private void addCell(WritableSheet ws, int row, int column, String data) throws WriteException {
        Label label = new Label(column, row, data);
        ws.addCell(label);
    }
}

+ 136 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/voluntary/VoluntaryRecruitmentEndpoint.java

@ -0,0 +1,136 @@
package com.yihu.jw.base.endpoint.voluntary;
import com.yihu.jw.base.dao.voluntary.VoluntaryRecruitmentPeopleDao;
import com.yihu.jw.base.service.voluntary.VoluntaryRecruitmentCompanyService;
import com.yihu.jw.base.service.voluntary.VoluntaryRecruitmentService;
import com.yihu.jw.entity.voluntary.VoluntaryRecruitmentCompanyDO;
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.utils.StringUtil;
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;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/8/1
 * @Description:
 */
@RestController
@RequestMapping(value = "open/voluntary")
@Api(value = "新冠-志愿招募管理", description = "新冠-志愿招募管理", tags = {"新冠-志愿招募管理"})
public class VoluntaryRecruitmentEndpoint extends EnvelopRestEndpoint {
 
    @Autowired
    private VoluntaryRecruitmentService voluntaryRecruitmentService;
    @Autowired
    private VoluntaryRecruitmentCompanyService companyService;
    @Autowired
    private VoluntaryRecruitmentPeopleDao peopleDao;
    @PostMapping(value = "add")
    @ApiOperation(value = "企业报名")
    public Envelop add (
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
         @RequestParam String jsonData){
        try {
            VoluntaryRecruitmentCompanyDO companyDO = toEntity(jsonData, VoluntaryRecruitmentCompanyDO.class);
            String result = voluntaryRecruitmentService.add(companyDO);
            if(StringUtil.isBlank(result)){
                return success("报名成功");
            }
           return Envelop.getError(result,-1);
        }catch (Exception e){
            e.printStackTrace();
            return failedException2(e);
        }
    }
    @GetMapping(value = "page")
    @ApiOperation(value = "获取分页")
    public PageEnvelop<VoluntaryRecruitmentCompanyDO> page (
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts,
            @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 {
                List<VoluntaryRecruitmentCompanyDO> appVersions = companyService.search(fields, filters, sorts, page, size);
                int count = (int)companyService.getCount(filters);
                return success(appVersions, count, page, size, VoluntaryRecruitmentCompanyDO.class);
            }catch (Exception e){
                e.printStackTrace();
                return  PageEnvelop.getError("查询失败");
            }
    }
    @GetMapping(value = "existsByPhone")
    @ApiOperation(value = "人员是否已报名")
    public ObjEnvelop existsByPhone (
            @ApiParam(name = "phone", value = "联系人手机")
            @RequestParam(value = "phone", required = true) String phone){
        try {
            return ObjEnvelop.getSuccess("查找成功",peopleDao.existsByPhone(phone));
        }catch (Exception e){
            e.printStackTrace();
            return  ObjEnvelop.getError("查询失败");
        }
    }
    @GetMapping(value = "findByContactsAndPhone")
    @ApiOperation(value = "查找单个企业")
    public ObjEnvelop<VoluntaryRecruitmentCompanyDO> findByContactsAndPhone (
            @ApiParam(name = "contacts", value = "联系人姓名")
            @RequestParam(value = "contacts", required = true) String contacts,
            @ApiParam(name = "phone", value = "联系人手机")
            @RequestParam(value = "phone", required = true) String phone){
        try {
            VoluntaryRecruitmentCompanyDO companyDO = voluntaryRecruitmentService.findByContactsAndPhone(contacts,phone);
            if(companyDO==null){
               return ObjEnvelop.getError("未找到关联企业");
            }
            return ObjEnvelop.getSuccess("查找成功",companyDO);
        }catch (Exception e){
            e.printStackTrace();
            return  ObjEnvelop.getError("查询失败");
        }
    }
    @PostMapping(value = "arrange")
    @ApiOperation(value = "人员安排")
    public Envelop arrange (
            @ApiParam(name = "companyId", value = "联系人姓名")
            @RequestParam(value = "companyId", required = true) String companyId,
            @ApiParam(name = "day", value = "服务日期")
            @RequestParam(value = "day", required = true) String day,
            @ApiParam(name = "time", value = "服务时间段")
            @RequestParam(value = "time", required = true) String time,
            @ApiParam(name = "peoples", value = "服务人员 id+姓名逗号间隔。例:1:测试1,2:测试2")
            @RequestParam(value = "peoples", required = true) String peoples,
            @ApiParam(name = "station", value = "服务站")
            @RequestParam(value = "station", required = true) String station){
        try {
            voluntaryRecruitmentService.arrange(companyId, day, time, peoples, station);
            return success("报名成功");
        }catch (Exception e){
            e.printStackTrace();
            return failedException2(e);
        }
    }
}

+ 107 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/voluntary/VoluntaryRecruitmentPeopleEndpoint.java

@ -0,0 +1,107 @@
package com.yihu.jw.base.endpoint.voluntary;
import com.yihu.jw.base.dao.voluntary.VoluntaryRecruitmentCompanyDao;
import com.yihu.jw.base.service.voluntary.VoluntaryRecruitmentPeopleService;
import com.yihu.jw.entity.voluntary.VoluntaryRecruitmentCompanyDO;
import com.yihu.jw.entity.voluntary.VoluntaryRecruitmentPeopleDO;
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;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/8/1
 * @Description:
 */
@RestController
@RequestMapping(value = "voluntaryRecruitmentPeople")
@Api(value = "新冠-志愿招募单位人员管理", description = "新冠-志愿招募单位人员管理", tags = {"新冠-志愿招募单位人员管理"})
public class VoluntaryRecruitmentPeopleEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private VoluntaryRecruitmentPeopleService peopleService;
    @Autowired
    private VoluntaryRecruitmentCompanyDao companyDao;
    @PostMapping(value = "delete")
    @ApiOperation(value = "删除")
    public Envelop delete(
            @ApiParam(name = "ids", value = "id串,中间用,分隔", required = true)
            @RequestParam(value = "ids") String ids) {
        String[] idsTmp = ids.split(",");
        List<VoluntaryRecruitmentPeopleDO> List = peopleService.getRepository().queryByIdIn(idsTmp);
        peopleService.delete(ids.split(","));
        for (VoluntaryRecruitmentPeopleDO tmp:List){
            VoluntaryRecruitmentCompanyDO companyDO = companyDao.findOne(tmp.getCompanyId());
            if (null !=companyDO ){
                Integer count = peopleService.getRepository().findByCompanyId(tmp.getCompanyId());
                companyDO.setNum(count);
                companyDao.save(companyDO);
            }
        }
        return success("删除成功");
    }
    @PostMapping(value = "update")
    @ApiOperation(value = "更新")
    public ObjEnvelop<VoluntaryRecruitmentPeopleDO> update (
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestParam String jsonData) throws Exception {
        VoluntaryRecruitmentPeopleDO appVersion = toEntity(jsonData, VoluntaryRecruitmentPeopleDO.class);
        if (null == appVersion.getId()) {
            return failed("ID不能为空", ObjEnvelop.class);
        }
        appVersion = peopleService.save(appVersion);
        VoluntaryRecruitmentCompanyDO companyDO = companyDao.findOne(appVersion.getCompanyId());
        if (null !=companyDO ){
            Integer count = peopleService.getRepository().findByCompanyId(appVersion.getCompanyId());
            companyDO.setNum(count);
            companyDao.save(companyDO);
        }
        return success(appVersion, VoluntaryRecruitmentPeopleDO.class);
    }
    @GetMapping(value = "page")
    @ApiOperation(value = "获取分页")
    public PageEnvelop<VoluntaryRecruitmentPeopleDO> page (
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts,
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
            @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size) throws Exception {
        List<VoluntaryRecruitmentPeopleDO> appVersions = peopleService.search(fields, filters, sorts, page, size);
        int count = (int)peopleService.getCount(filters);
        return success(appVersions, count, page, size, VoluntaryRecruitmentPeopleDO.class);
    }
    @GetMapping(value = "list")
    @ApiOperation(value = "获取列表")
    public ListEnvelop<VoluntaryRecruitmentPeopleDO> list (
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
        List<VoluntaryRecruitmentPeopleDO> appVersions = peopleService.search(fields, filters, sorts);
        return success(appVersions, VoluntaryRecruitmentPeopleDO.class);
    }
}

+ 18 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/voluntary/VoluntaryRecruitmentArrangeService.java

@ -0,0 +1,18 @@
package com.yihu.jw.base.service.voluntary;
import com.yihu.jw.base.dao.voluntary.VoluntaryRecruitmentArrangeDao;
import com.yihu.jw.entity.voluntary.VoluntaryRecruitmentArrangeDO;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.stereotype.Service;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/8/1
 * @Description:
 */
@Service
public class VoluntaryRecruitmentArrangeService extends BaseJpaService<VoluntaryRecruitmentArrangeDO, VoluntaryRecruitmentArrangeDao> {
    
}

+ 18 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/voluntary/VoluntaryRecruitmentCompanyService.java

@ -0,0 +1,18 @@
package com.yihu.jw.base.service.voluntary;
import com.yihu.jw.base.dao.voluntary.VoluntaryRecruitmentCompanyDao;
import com.yihu.jw.entity.voluntary.VoluntaryRecruitmentCompanyDO;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.stereotype.Service;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/8/1
 * @Description:
 */
@Service
public class VoluntaryRecruitmentCompanyService extends BaseJpaService<VoluntaryRecruitmentCompanyDO, VoluntaryRecruitmentCompanyDao> {
}

+ 18 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/voluntary/VoluntaryRecruitmentPeopleService.java

@ -0,0 +1,18 @@
package com.yihu.jw.base.service.voluntary;
import com.yihu.jw.base.dao.voluntary.VoluntaryRecruitmentPeopleDao;
import com.yihu.jw.entity.voluntary.VoluntaryRecruitmentPeopleDO;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.stereotype.Service;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/8/1
 * @Description:
 */
@Service
public class VoluntaryRecruitmentPeopleService extends BaseJpaService<VoluntaryRecruitmentPeopleDO, VoluntaryRecruitmentPeopleDao> {
    
}

+ 119 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/voluntary/VoluntaryRecruitmentService.java

@ -0,0 +1,119 @@
package com.yihu.jw.base.service.voluntary;
import com.yihu.jw.base.dao.voluntary.VoluntaryRecruitmentArrangeDao;
import com.yihu.jw.base.dao.voluntary.VoluntaryRecruitmentCompanyDao;
import com.yihu.jw.base.dao.voluntary.VoluntaryRecruitmentPeopleDao;
import com.yihu.jw.entity.voluntary.VoluntaryRecruitmentArrangeDO;
import com.yihu.jw.entity.voluntary.VoluntaryRecruitmentCompanyDO;
import com.yihu.jw.entity.voluntary.VoluntaryRecruitmentPeopleDO;
import com.yihu.jw.utils.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/8/1
 * @Description:
 */
@Service
public class VoluntaryRecruitmentService {
    @Autowired
    private VoluntaryRecruitmentCompanyDao companyDao;
    @Autowired
    private VoluntaryRecruitmentArrangeDao arrangeDao;
    @Autowired
    private VoluntaryRecruitmentPeopleDao peopleDao;
    /**
     * 人员安排
     */
    public void arrange(String companyId,String day,String time,String peoples,String station){
        List<VoluntaryRecruitmentArrangeDO> arrangeDOs = new ArrayList<>();
        String people[] = peoples.split(",");
        for (String peo:people){
            String p[] = peo.split(":");
            VoluntaryRecruitmentArrangeDO arrangeDO = new VoluntaryRecruitmentArrangeDO();
            arrangeDO.setCompanyId(companyId);
            arrangeDO.setDay(day);
            arrangeDO.setPeopleId(p[0]);
            arrangeDO.setPeopleName(p[1]);
            arrangeDO.setStation(station);
            arrangeDO.setTime(time);
            arrangeDOs.add(arrangeDO);
        }
        arrangeDao.save(arrangeDOs);
    }
    public VoluntaryRecruitmentCompanyDO findByContactsAndPhone(String contacts,String phone){
        List<VoluntaryRecruitmentCompanyDO> companyDOs = companyDao.findByContactsAndPhone(contacts,phone);
        if(companyDOs!=null&&companyDOs.size()>0){
            return companyDOs.get(0);
        }
        return null;
    }
    /**
     * 企业报名
     */
    public String add(VoluntaryRecruitmentCompanyDO companyDO){
        List<VoluntaryRecruitmentPeopleDO> peopleDOs = new ArrayList<>();
        if(StringUtil.isBlank(companyDO.getId())){
            if(companyDao.existsByName(companyDO.getName())){
                return "该企业已报名,请勿重复报名";
            }
            List<VoluntaryRecruitmentCompanyDO> companyDOs = companyDao.findByContactsAndPhone(companyDO.getContacts(),companyDO.getPhone());
            if(companyDOs!=null&&companyDOs.size()>0){
                return "该联系人已被其他企业添加";
            }
            List<VoluntaryRecruitmentPeopleDO> peopleDOList = companyDO.getPeopleDOList();
            if(peopleDOList!=null){
                addPeople(peopleDOList,peopleDOs,companyDO);
                return null;
            }
            return null;
        }
        List<VoluntaryRecruitmentPeopleDO> peopleDOList = companyDO.getPeopleDOList();
        if(peopleDOList==null){
            return "请添加人员";
        }
        addPeople(peopleDOList,peopleDOs,companyDO);
        return null;
    }
    public void addPeople(List<VoluntaryRecruitmentPeopleDO> peopleDOList,List<VoluntaryRecruitmentPeopleDO> peopleDOs,VoluntaryRecruitmentCompanyDO companyDO){
        if(!StringUtil.isBlank(companyDO.getId())){
            VoluntaryRecruitmentCompanyDO old = companyDao.findOne(companyDO.getId());
            companyDO = old;
        }else {
            companyDO.setNum(0);
            companyDao.save(companyDO);
        }
        for (VoluntaryRecruitmentPeopleDO peopleDO:peopleDOList){
            if(peopleDao.existsByPhone(peopleDO.getPhone())){
                continue;
            }
            peopleDO.setCompanyId(companyDO.getId());
            peopleDO.setCompanyName(companyDO.getName());
            peopleDOs.add(peopleDO);
        }
        if(peopleDOs.size()>0){
            peopleDao.save(peopleDOs);
        }
        companyDO.setNum(companyDO.getNum()+peopleDOs.size());
        companyDao.save(companyDO);
    }
}

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

@ -333,8 +333,12 @@ public class BirthdayWishesService {
                            map.put("birthday", esMap.get("birthday") + "");
                            map.put("birthday", esMap.get("birthday") + "");
                            map.put("doctorName", esMap.get("doctorName") + "");
                            map.put("doctorName", esMap.get("doctorName") + "");
                            map.put("content", esMap.get("content") + "");
                            map.put("content", esMap.get("content") + "");
                            map.put("createTime", (esMap.get("createTime") + "").replace("T", " ").replace("+0800", ""));
                            map.put("createTimeStr", (esMap.get("createTime") + "").replace("T", " ").replace("+0800", ""));
                            Date dateTmp = DateUtil.strToDate(esMap.get("createTime") + "");
                            map.put("createTime", (DateUtil.dateToChineseDate(dateTmp)));
                            map.put("status", "已发送");
                            map.put("status", "已发送");
                            BasePatientDO patientDO = patientDao.findById(map.get("patient") + "");
                            map.put("patientBirthday", IdCardUtil.getBirthdayForIdcardStr(patientDO.getIdcard()));
                            patientSet.add(patientCode);
                            patientSet.add(patientCode);
                            resultList.add(map);
                            resultList.add(map);
                        }
                        }
@ -349,11 +353,10 @@ public class BirthdayWishesService {
                        String birthday = map.get("birthday")+"日";
                        String birthday = map.get("birthday")+"日";
                        StringBuilder bir = new StringBuilder(birthday);
                        StringBuilder bir = new StringBuilder(birthday);
                        bir.insert(2, "月");
                        bir.insert(2, "月");
//                            int age = IdCardUtil.getAgeForIdcard(map.get("idcard") + "");
                        map.put("birthday", bir.toString());
                        map.put("birthday", bir.toString());
//                        int age = IdCardUtil.getAgeForIdcard(map.get("idcard") + "");
//                        map.put("age", age);
                        map.put("status", "未发送");
                        map.put("status", "未发送");
                        BasePatientDO patientDO = patientDao.findById(map.get("patient") + "");
                        map.put("patientBirthday", IdCardUtil.getBirthdayForIdcardStr(patientDO.getIdcard()));
                        resultList.add(map);
                        resultList.add(map);
                    }
                    }
                }
                }

+ 82 - 24
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/endpoint/DeviceController.java

@ -107,7 +107,7 @@ public class DeviceController {
    }
    }
    //
    //
    @ApiOperation("柏颐设备位置接收")
    @ApiOperation("爱牵挂位置接收")
    @RequestMapping(value = "byLocation", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    @RequestMapping(value = "byLocation", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    public String byLocation(
    public String byLocation(
            @ApiParam(name="imei",required = false,value="15位设备唯一序号",defaultValue = "")
            @ApiParam(name="imei",required = false,value="15位设备唯一序号",defaultValue = "")
@ -131,7 +131,7 @@ public class DeviceController {
            HttpServletRequest request){
            HttpServletRequest request){
        try {
        try {
            String paraString = JSON.toJSONString(request.getParameterMap());
            String paraString = JSON.toJSONString(request.getParameterMap());
            logger.info("柏颐设备位置接收,请求参数:\n"+paraString);
            logger.info("爱牵挂位置接收,请求参数:\n"+paraString);
            deviceService.byLocation(imei,time_begin,is_reply,is_track,city,address,lon,lat,type);
            deviceService.byLocation(imei,time_begin,is_reply,is_track,city,address,lon,lat,type);
            return success();
            return success();
@ -142,7 +142,7 @@ public class DeviceController {
    }
    }
    @ApiOperation("柏颐心率数据接收")
    @ApiOperation("爱牵挂心率数据接收")
    @RequestMapping(value = "byHeartRate", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    @RequestMapping(value = "byHeartRate", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    public String byHeartRate(
    public String byHeartRate(
            @ApiParam(name = "imei", value = "15位设备唯一序号")
            @ApiParam(name = "imei", value = "15位设备唯一序号")
@ -158,7 +158,7 @@ public class DeviceController {
            HttpServletRequest request){
            HttpServletRequest request){
        try {
        try {
            String paraString = JSON.toJSONString(request.getParameterMap());
            String paraString = JSON.toJSONString(request.getParameterMap());
            logger.info("柏颐心率数据接收,请求参数: \n"+paraString);
            logger.info("爱牵挂心率数据接收,请求参数: \n"+paraString);
            deviceService.byHeartRate(imei,time_begin,heartrate,theshold_heartrate_h,theshold_heartrate_l);
            deviceService.byHeartRate(imei,time_begin,heartrate,theshold_heartrate_h,theshold_heartrate_l);
            return success();
            return success();
@ -168,7 +168,7 @@ public class DeviceController {
        }
        }
    }
    }
    @ApiOperation("柏颐血压数据接收")
    @ApiOperation("爱牵挂血压数据接收")
    @RequestMapping(value = "byBloodPressure", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    @RequestMapping(value = "byBloodPressure", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    public String byBloodPressure(
    public String byBloodPressure(
            @ApiParam(name = "imei", value = "15位设备唯一序号", required = true)
            @ApiParam(name = "imei", value = "15位设备唯一序号", required = true)
@ -186,7 +186,7 @@ public class DeviceController {
            HttpServletRequest request){
            HttpServletRequest request){
        try {
        try {
            String paraString = JSON.toJSONString(request.getParameterMap());
            String paraString = JSON.toJSONString(request.getParameterMap());
            logger.info("柏颐血压数据,接收请求参数:\n"+paraString);
            logger.info("爱牵挂血压数据,接收请求参数:\n"+paraString);
            deviceService.byBloodPressure(imei,time_begin,dbp,dbp_l,sbp,sbp_h);
            deviceService.byBloodPressure(imei,time_begin,dbp,dbp_l,sbp,sbp_h);
            return success();
            return success();
@ -196,7 +196,7 @@ public class DeviceController {
        }
        }
    }
    }
    @ApiOperation("柏颐跌倒数据接收")
    @ApiOperation("爱牵挂跌倒数据接收")
    @RequestMapping(value = "byFall", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    @RequestMapping(value = "byFall", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    public String byFall(
    public String byFall(
            @ApiParam(name = "imei", value = "15位设备唯一序号", required = true)
            @ApiParam(name = "imei", value = "15位设备唯一序号", required = true)
@ -216,7 +216,7 @@ public class DeviceController {
            HttpServletRequest request){
            HttpServletRequest request){
        try {
        try {
            String paraString = JSON.toJSONString(request.getParameterMap());
            String paraString = JSON.toJSONString(request.getParameterMap());
            logger.info("柏颐跌倒数据接收,请求参数: \n"+paraString);
            logger.info("爱牵挂跌倒数据接收,请求参数: \n"+paraString);
            deviceService.byFall(imei,time_begin,city,address,lon,lat,type);
            deviceService.byFall(imei,time_begin,city,address,lon,lat,type);
            return success();
            return success();
@ -238,7 +238,7 @@ public class DeviceController {
            HttpServletRequest request) {
            HttpServletRequest request) {
        try {
        try {
            String paraString = JSON.toJSONString(request.getParameterMap());
            String paraString = JSON.toJSONString(request.getParameterMap());
            logger.info("柏颐设备步数接收,请求参数:\n"+paraString);
            logger.info("爱牵挂步数接收,请求参数:\n"+paraString);
            deviceService.bySteps(imei,time_begin,value);
            deviceService.bySteps(imei,time_begin,value);
            return success();
            return success();
@ -248,29 +248,87 @@ public class DeviceController {
        }
        }
    }
    }
    @ApiOperation("柏颐设备睡眠接收")
    @ApiOperation("爱牵挂设备睡眠接收")
    @RequestMapping(value = "bySleep", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    @RequestMapping(value = "bySleep", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    public String bySleep(
    public String bySleep(
            @ApiParam(name="imei",required = false,value="15位设备唯一序号",defaultValue = "")
            @RequestParam(value = "imei",required = true) String imei,
            @ApiParam(name="device",required = false,value="睡眠带MAC地址",defaultValue = "")
            @RequestParam(value = "device",required = true) String device,
            @ApiParam(name="time_begin",required = false,value="发生时间YYYY-MM-DD HH:mm:SS")
            @ApiParam(name="time_begin",required = false,value="发生时间YYYY-MM-DD HH:mm:SS")
            @RequestParam(value = "time_begin",required = false) String time_begin,
            @RequestParam(value = "time_begin",required = false) String time_begin,
            @ApiParam(name="time_end",required = false,value="结束时间YYYY-MM-DD HH:mm:SS")
            @RequestParam(value = "time_end",required = false) String time_end,
            @ApiParam(name="interval",required = false,value="固定30分钟")
            @RequestParam(value = "interval",required = false) int interval,
            @ApiParam(name="total",required = false,value="检测次数")
            @RequestParam(value = "total",required = false) int total,
            @ApiParam(name="data",required = false,value="样例截取 睡眠数据 (格式:state,turn_over|state,turn_over|...)")
            @RequestParam(value = "data",required = false)String data,
            @ApiParam(name="heartrate",required = false,value="心率数据(离床或翻身测量失败时为0)")
            @RequestParam(value = "heartrate",required = false) String heartrate,
            @ApiParam(name="breath",required = false,value="呼吸率(离床或翻身测量失败时为0)")
            @RequestParam(value = "breath",required = false) String breath,
            @ApiParam(name="bed_status",required = false,value="在离床状态(0 离床,1 在床) ")
            @RequestParam(value = "bed_status",required = false) String bed_status,
            @ApiParam(name="turn_over",required = false,value="翻身状态(0 没翻身,1 在翻身)")
            @RequestParam(value = "turn_over",required = false)String turn_over,
            @ApiParam(name="is_warn",required = false,value="是否为离床报警(0 否 默认,1 是)")
            @RequestParam(value = "is_warn",required = false)String is_warn,
            HttpServletRequest request) {
            HttpServletRequest request) {
        try {
        try {
            //data 为字符串,格式为:  state,turn_over|state,turn_over|state, ... state和turn_over的
            // 含义见object.md 文档中sleepdatasleep
            String paraString = JSON.toJSONString(request.getParameterMap());
            logger.info("爱牵挂睡眠接收,请求参数:"+paraString);
            deviceService.bySleep(device,time_begin,heartrate,breath,turn_over,is_warn);
            return success();
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1,"Device data incoming failure");
        }
    }
    @ApiOperation("爱牵挂设备睡眠报告接收")
    @RequestMapping(value = "bySleepReport", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    public String bySleep(
            @ApiParam(name="device",required = false,value="睡眠带MAC地址",defaultValue = "")
            @RequestParam(value = "device",required = true) String device,
            @ApiParam(name="date",required = false,value="产生日期 YYYYMMDD")
            @RequestParam(value = "date",required = false) String date,
            @ApiParam(name="fallasleep",required = false,value="入睡时长 (分钟)")
            @RequestParam(value = "fallasleep",required = false) String fallasleep,
            @ApiParam(name="sleepTime",required = false,value="睡眠时长 (分钟)")
            @RequestParam(value = "sleepTime",required = false) String sleepTime,
            @ApiParam(name="restTime",required = false,value="休息时长 (分钟)")
            @RequestParam(value = "restTime",required = false) String restTime,
            @ApiParam(name="bed_status",required = false,value="在离床状态(0 离床,1 在床) ")
            @RequestParam(value = "bed_status",required = false) String bed_status,
            @ApiParam(name="awakeTime",required = false,value="清醒时长 (分钟)")
            @RequestParam(value = "awakeTime",required = false)String awakeTime,
            @ApiParam(name="lightTime",required = false,value="浅睡时长 (分钟)")
            @RequestParam(value = "lightTime",required = false)String lightTime,
            @ApiParam(name="remTime",required = false,value="rem时长  (分钟)")
            @RequestParam(value = "remTime",required = false)String remTime,
            @ApiParam(name="deepTime",required = false,value="深睡时长 (分钟) ")
            @RequestParam(value = "deepTime",required = false)String deepTime,
            @ApiParam(name="bucket",required = false,value="睡眠时段 ['18:00-18:21', '21:30-07:09'] ")
            @RequestParam(value = "bucket",required = false)String[] bucket,
            @ApiParam(name="avghr",required = false,value="平均心率 ")
            @RequestParam(value = "avghr",required = false)String avghr,
            @ApiParam(name="avgbr",required = false,value="平均呼吸率 ")
            @RequestParam(value = "avgbr",required = false)String avgbr,
            @ApiParam(name="awakePer",required = false,value="清醒百分比")
            @RequestParam(value = "awakePer",required = false)String awakePer,
            @ApiParam(name="remPer",required = false,value="rem百分比")
            @RequestParam(value = "remPer",required = false)String remPer,
            @ApiParam(name="lightPer",required = false,value="浅睡百分比")
            @RequestParam(value = "lightPer",required = false)String lightPer,
            @ApiParam(name="deepPer",required = false,value="深睡百分比")
            @RequestParam(value = "deepPer",required = false)String deepPer,
            @ApiParam(name="efficiency",required = false,value="睡眠效率")
            @RequestParam(value = "efficiency",required = false)String efficiency,
            @ApiParam(name="score",required = false,value="睡眠评分 <=0无睡眠数据,<60待改善,<70一般,<85良好 其他,非常好")
            @RequestParam(value = "score",required = false)String score,
            HttpServletRequest request) {
        try {
            String paraString = JSON.toJSONString(request.getParameterMap());
            String paraString = JSON.toJSONString(request.getParameterMap());
            logger.info("柏颐设备睡眠接收,请求参数:"+paraString);
            logger.info("爱牵挂睡眠接收,请求参数:"+paraString);
            deviceService.bySleep(imei,time_begin,time_end,interval,total,data);
            deviceService.bySleepReport(device,date,fallasleep,sleepTime,restTime,awakeTime,lightTime,remTime,deepTime,bucket,
                    avghr,avgbr,awakePer,remPer,lightPer,efficiency,score);
            return success();
            return success();
        } catch (Exception e) {
        } catch (Exception e) {
            e.printStackTrace();
            e.printStackTrace();

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

@ -537,18 +537,33 @@ public class DeviceService {
    }
    }
    /**
    /**
     *柏颐睡眠数据接收
     * @param imei 15位设备唯一序号
     * @param time_begin 发生时间YYYY-MM-DD HH:mm:SS
     * @param time_end 结束时间YYYY-MM-DD HH:mm:SS
     * @param interval 固定30分钟
     * @param total 检测次数
     * @param data 样例截取   睡眠数据 (格式:state,turn_over|state,turn_over|...) 含义见object.md 文档中sleepdatasleep
     *
     * @param device
     * @param time_begin
     * @param heartrate
     * @param breath
     * @param turn_over
     * @param is_warn
     */
     */
    @Async
    @Async
    public void bySleep(String imei,String time_begin,String time_end,int interval,int total,String data) {
    public void bySleep(String device,String time_begin,String heartrate,String breath,String turn_over,String is_warn) {
        try {
        try {
            if(StringUtils.isNotBlank(imei)){
            if(StringUtils.isNotBlank(device)){
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    @Async
    public void bySleepReport(String device,String date,String fallasleep,String sleepTime,String restTime,String awakeTime,String lightTime,
                              String remTime,String deepTime,String[] bucket,String avghr,String avgbr,String awakePer,String remPer,String lightPer,
                              String efficiency,String score) {
        try {
            if(StringUtils.isNotBlank(device)){
            }
            }