ソースを参照

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

 Conflicts:
	common/common-entity/sql记录
liubing 3 年 前
コミット
582f51f1ee
34 ファイル変更2135 行追加147 行削除
  1. 53 0
      common/common-entity/sql记录
  2. 10 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/BaseExceptionDictDO.java
  3. 12 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/course/CourseCatalogueDO.java
  4. 63 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/course/CourseCatalogueReadTimeDO.java
  5. 4 3
      common/common-entity/src/main/java/com/yihu/jw/entity/care/course/CourseDO.java
  6. 107 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/course/NurseryLogDO.java
  7. 82 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/course/PatientCourseRecordDO.java
  8. 121 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/course/PatientDietRecordDO.java
  9. 14 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/exception/dao/BaseExceptionDictDao.java
  10. 8 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/exception/dao/BaseExceptionLogDao.java
  11. 11 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/exception/dao/BaseExceptionServerDictDao.java
  12. 62 1
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/web/endpoint/EnvelopRestEndpoint.java
  13. 19 0
      common/common-util/src/main/java/com/yihu/jw/util/idcard/IdCardUtil.java
  14. 18 3
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/DidiFilterProcessor.java
  15. 33 45
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/PostFilter.java
  16. 37 0
      starter/swagger-starter/pom.xml
  17. 1 0
      starter/swagger-starter/readme.MD
  18. 1 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/config/SwaggerConfig.java
  19. 3 1
      svr/svr-base/src/main/java/com/yihu/jw/base/service/course/RecruitStudentsRecordService.java
  20. 1 1
      svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/BusinessSysDictService.java
  21. 3 18
      svr/svr-cloud-care/pom.xml
  22. 2 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/aop/RedisLockAOP.java
  23. 0 44
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/config/SwaggerDocs.java
  24. 16 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/course/NurseryLogDao.java
  25. 20 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/course/PatientCourseRecordDao.java
  26. 19 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/course/PatientDietRecordDao.java
  27. 189 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/course/NurseryLogEndpoint.java
  28. 176 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/course/PatientCourseEndpoint.java
  29. 422 24
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/course/CourseService.java
  30. 374 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/course/NurseryLogService.java
  31. 8 3
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  32. 1 1
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/SpecialistService.java
  33. 243 0
      wlyy-starter/pom.xml
  34. 2 0
      wlyy-starter/readme.MD

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

@ -867,6 +867,49 @@ CREATE TABLE `base_course_sales_order_record` (
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='课程销售订单记录表';
DROP TABLE IF EXISTS `base_patient_course_record`;
CREATE TABLE `base_patient_course_record` (
  `id` varchar(50) NOT NULL,
  `nursery_log_id` varchar(50) DEFAULT NULL COMMENT '托育日志id',
  `patient` varchar(50) DEFAULT NULL,
  `content` varchar(2000) DEFAULT NULL COMMENT '课程记录内容',
  `enclosure` varchar(2000) DEFAULT NULL COMMENT '附件',
  `record_date` varchar(20) DEFAULT NULL COMMENT '记录日期',
  `create_time` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='居民课程记录';
DROP TABLE IF EXISTS `base_patient_diet_record`;
CREATE TABLE `base_patient_diet_record` (
  `id` varchar(50) NOT NULL,
  `nursery_log_id` varchar(50) DEFAULT NULL COMMENT '托育日志id',
  `patient` varchar(50) DEFAULT NULL,
  `eat_food` varchar(1000) DEFAULT NULL COMMENT '食用食物json格式',
  `eat_type` varchar(255) DEFAULT NULL COMMENT '食用方式 1喂食 2自主进食',
  `intake` varchar(1) DEFAULT NULL COMMENT '摄入量 全部吃完 吃了1/3 吃了1/2 几乎没吃',
  `additional_notes` varchar(1000) DEFAULT NULL COMMENT '附加说明',
  `enclosure` varchar(2000) DEFAULT NULL COMMENT '附件',
  `record_date` varchar(20) DEFAULT NULL COMMENT '记录日期',
  `create_time` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='居民饮食记录';
DROP TABLE IF EXISTS `base_nursery_log`;
CREATE TABLE `base_nursery_log` (
  `id` varchar(50) NOT NULL,
  `patient` varchar(50) DEFAULT NULL,
  `patient_name` varchar(50) DEFAULT NULL,
  `doctor` varchar(50) DEFAULT NULL,
  `doctor_name` varchar(50) DEFAULT NULL,
  `org_code` varchar(50) DEFAULT NULL,
  `org_name` varchar(50) DEFAULT NULL,
  `record_date` varchar(20) DEFAULT NULL COMMENT '记录日期',
  `status` varchar(1) DEFAULT NULL,
  `create_time` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `unique1` (`patient`,`record_date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='托育日志记录';
-- 2021-05-18
create table base_org_notice(
	id varchar(50) not null,
@ -887,6 +930,16 @@ ALTER table base_org_notice add column create_user varchar(50) DEFAULT NULL
-- 2021-05-20 lb
ALTER table base.base_security_monitoring_order add column `order_source` tinyint(4) DEFAULT '1' COMMENT '工单发起来源状态 1APP 2手环3居家报警'
-- 2021-05-19
CREATE TABLE `base_course_catalogue_read_time` (
  `id` varchar(50) NOT NULL,
  `patient` varchar(50) DEFAULT NULL COMMENT '用户code',
  `course_catalogue_id` varchar(50) DEFAULT NULL COMMENT '课程目录id',
  `course_id` varchar(50) DEFAULT NULL COMMENT '课程id',
  `read_time` varchar(20) DEFAULT NULL COMMENT '阅读时间,保留时间戳格式,单位s',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='记录用户阅读课程时长';
-- 2021 05-21 lb
CREATE TABLE `base_emergency_warn_conclusion` (
  `id` varchar(50) NOT NULL,

+ 10 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/BaseExceptionDictDO.java

@ -18,6 +18,16 @@ public class BaseExceptionDictDO extends UuidIdentityEntity {
    private String exceptionType;
    private String exceptionTypeName;
    private String remindContent;
    private String exceptionInfo;
    @Column(name = "exception_info")
    public String getExceptionInfo() {
        return exceptionInfo;
    }
    public void setExceptionInfo(String exceptionInfo) {
        this.exceptionInfo = exceptionInfo;
    }
    @Column(name = "remind_content")
    public String getRemindContent() {
        return remindContent;

+ 12 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/course/CourseCatalogueDO.java

@ -39,6 +39,10 @@ public class CourseCatalogueDO extends UuidIdentityEntityWithTime {
     * 视频url
     */
    private String videoUrl;
    /**
     * 排序字段
     */
    private Integer sort;
    @Column(name = "course_id")
    public String getCourserId() {
@ -89,4 +93,12 @@ public class CourseCatalogueDO extends UuidIdentityEntityWithTime {
        this.videoUrl = videoUrl;
    }
    @Column(name = "sort")
    public Integer getSort() {
        return sort;
    }
    public void setSort(Integer sort) {
        this.sort = sort;
    }
}

+ 63 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/course/CourseCatalogueReadTimeDO.java

@ -0,0 +1,63 @@
package com.yihu.jw.entity.care.course;
import javax.persistence.Column;
/***
 * @ClassName: CourseCatalogueReadTimeDO
 * @Description: 记录用户阅读课程时长
 * @Auther: shi kejing
 * @Date: 2021/5/19 9:00
 */
public class CourseCatalogueReadTimeDO {
    private String id;
    private String patient;
    private String courseCatalogueId;
    private String courseId;
    private String readTime;
    @Column(name = "id")
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    public String getCourseCatalogueId() {
        return courseCatalogueId;
    }
    public void setCourseCatalogueId(String courseCatalogueId) {
        this.courseCatalogueId = courseCatalogueId;
    }
    public String getCourseId() {
        return courseId;
    }
    public void setCourseId(String courseId) {
        this.courseId = courseId;
    }
    public String getReadTime() {
        return readTime;
    }
    public void setReadTime(String readTime) {
        this.readTime = readTime;
    }
}

+ 4 - 3
common/common-entity/src/main/java/com/yihu/jw/entity/care/course/CourseDO.java

@ -7,6 +7,7 @@ import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@ -73,7 +74,7 @@ public class CourseDO extends UuidIdentityEntityWithOperator {
    /**
     * '费用'
     */
    private String fee;
    private BigDecimal fee;
    /**
     * '课程简介'
     */
@ -172,11 +173,11 @@ public class CourseDO extends UuidIdentityEntityWithOperator {
    }
    @Column(name = "fee")
    public String getFee() {
    public BigDecimal getFee() {
        return fee;
    }
    public void setFee(String fee) {
    public void setFee(BigDecimal fee) {
        this.fee = fee;
    }

+ 107 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/course/NurseryLogDO.java

@ -0,0 +1,107 @@
package com.yihu.jw.entity.care.course;
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/5/20
 * @Description:
 */
@Entity
@Table(name="base_nursery_log")
public class NurseryLogDO extends UuidIdentityEntityWithCreateTime{
    private String patient;
    private String patientName;
    private String doctor;
    private String doctorName;
    private String orgCode;
    private String orgName;
    /**
     * '记录日期'
     */
    private String recordDate;
    /**
     * 状态 暂时没用
     */
    private String status;
    @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 = "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 = "org_code")
    public String getOrgCode() {
        return orgCode;
    }
    public void setOrgCode(String orgCode) {
        this.orgCode = orgCode;
    }
    @Column(name = "org_name")
    public String getOrgName() {
        return orgName;
    }
    public void setOrgName(String orgName) {
        this.orgName = orgName;
    }
    @Column(name = "record_date")
    public String getRecordDate() {
        return recordDate;
    }
    public void setRecordDate(String recordDate) {
        this.recordDate = recordDate;
    }
    @Column(name = "status")
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
}

+ 82 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/course/PatientCourseRecordDO.java

@ -0,0 +1,82 @@
package com.yihu.jw.entity.care.course;
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/5/20
 * @Description: '居民课程记录
 */
@Entity
@Table(name="base_patient_course_record")
public class PatientCourseRecordDO extends UuidIdentityEntityWithCreateTime{
    private String patient;
    /**
     * '托育日志id'
     */
    private String nurseryLogId;
    /**
     * '课程记录内容'
     */
    private String content;
    /**
     * '附件'
     */
    private String enclosure;
    /**
     * '记录日期'
     */
    private String recordDate;
    @Column(name = "patient")
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    @Column(name = "nursery_log_id")
    public String getNurseryLogId() {
        return nurseryLogId;
    }
    public void setNurseryLogId(String nurseryLogId) {
        this.nurseryLogId = nurseryLogId;
    }
    @Column(name = "content")
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    @Column(name = "enclosure")
    public String getEnclosure() {
        return enclosure;
    }
    public void setEnclosure(String enclosure) {
        this.enclosure = enclosure;
    }
    @Column(name = "record_date")
    public String getRecordDate() {
        return recordDate;
    }
    public void setRecordDate(String recordDate) {
        this.recordDate = recordDate;
    }
}

+ 121 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/course/PatientDietRecordDO.java

@ -0,0 +1,121 @@
package com.yihu.jw.entity.care.course;
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/5/20
 * @Description: 居民饮食记录
 */
@Entity
@Table(name="base_patient_diet_record")
public class PatientDietRecordDO extends UuidIdentityEntityWithCreateTime{
    private String patient;
    /**
     * '托育日志id'
     */
    private String nurseryLogId;
    /**
     * '食用食物json格式'
     */
    private String eatFood;
    /**
     * '食用方式 1喂食 2自主进食
     */
    private String eatType;
    /**
     *'摄入量 全部吃完 吃了1/3 吃了1/2 几乎没吃'
     */
    private String intake;
    /**
     *'附加说明'
     */
    private String additionalNotes;
    /**
     *'附件'
     */
    private String enclosure;
    /**
     * '记录日期'
     */
    private String recordDate;
    @Column(name = "patient")
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    @Column(name = "nursery_log_id")
    public String getNurseryLogId() {
        return nurseryLogId;
    }
    public void setNurseryLogId(String nurseryLogId) {
        this.nurseryLogId = nurseryLogId;
    }
    @Column(name = "eat_food")
    public String getEatFood() {
        return eatFood;
    }
    public void setEatFood(String eatFood) {
        this.eatFood = eatFood;
    }
    @Column(name = "eat_type")
    public String getEatType() {
        return eatType;
    }
    public void setEatType(String eatType) {
        this.eatType = eatType;
    }
    @Column(name = "intake")
    public String getIntake() {
        return intake;
    }
    public void setIntake(String intake) {
        this.intake = intake;
    }
    @Column(name = "additional_notes")
    public String getAdditionalNotes() {
        return additionalNotes;
    }
    public void setAdditionalNotes(String additionalNotes) {
        this.additionalNotes = additionalNotes;
    }
    @Column(name = "enclosure")
    public String getEnclosure() {
        return enclosure;
    }
    public void setEnclosure(String enclosure) {
        this.enclosure = enclosure;
    }
    @Column(name = "record_date")
    public String getRecordDate() {
        return recordDate;
    }
    public void setRecordDate(String recordDate) {
        this.recordDate = recordDate;
    }
}

+ 14 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/exception/dao/BaseExceptionDictDao.java

@ -0,0 +1,14 @@
package com.yihu.jw.restmodel.exception.dao;
import com.yihu.jw.entity.base.dict.BaseExceptionDictDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
import java.util.Map;
public interface BaseExceptionDictDao  extends PagingAndSortingRepository<BaseExceptionDictDO, String>, JpaSpecificationExecutor<BaseExceptionDictDO> {
    @Query("from BaseExceptionDictDO  t where t.isDel='1' and t.exceptionInfo=?1")
    BaseExceptionDictDO findByExceptionInfo(String exceptionInfo);
}

+ 8 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/exception/dao/BaseExceptionLogDao.java

@ -0,0 +1,8 @@
package com.yihu.jw.restmodel.exception.dao;
import com.yihu.jw.entity.base.dict.BaseExceptionLogDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface BaseExceptionLogDao extends PagingAndSortingRepository<BaseExceptionLogDO, String>, JpaSpecificationExecutor<BaseExceptionLogDO> {
}

+ 11 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/exception/dao/BaseExceptionServerDictDao.java

@ -0,0 +1,11 @@
package com.yihu.jw.restmodel.exception.dao;
import com.yihu.jw.entity.base.dict.BaseExceptionServerDictDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface BaseExceptionServerDictDao extends PagingAndSortingRepository<BaseExceptionServerDictDO, String>, JpaSpecificationExecutor<BaseExceptionServerDictDO> {
    @Query("from BaseExceptionServerDictDO t where t.isDel='1' and t.path=?1")
    BaseExceptionServerDictDO findServiceByPath(String path);
}

+ 62 - 1
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/web/endpoint/EnvelopRestEndpoint.java

@ -4,9 +4,12 @@ package com.yihu.jw.restmodel.web.endpoint;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.entity.base.dict.BaseExceptionDictDO;
import com.yihu.jw.restmodel.exception.dao.BaseExceptionDictDao;
import com.yihu.jw.restmodel.web.*;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.util.StringUtils;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
@ -16,6 +19,7 @@ import javax.servlet.http.HttpServletResponse;
import java.beans.PropertyDescriptor;
import java.io.IOException;
import java.lang.reflect.Method;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.*;
@ -28,10 +32,12 @@ import java.util.*;
 *
 * @author Progr1mmer
 */
public abstract class EnvelopRestEndpoint {
public abstract class EnvelopRestEndpoint extends Exception {
    @Autowired
    protected ObjectMapper objectMapper;
    @Autowired
    protected BaseExceptionDictDao baseExceptionDictDao;
    protected Envelop success() {
        return success("success");
@ -196,6 +202,61 @@ public abstract class EnvelopRestEndpoint {
        return failed(message, -10000);
    }
    protected Envelop failedException(Exception e){
        BaseExceptionDictDO baseExceptionDictDO =baseExceptionDictDao.findByExceptionInfo(DataAccessException.class.toString());
        if (baseExceptionDictDO!=null){
            e.printStackTrace();
            return failed(baseExceptionDictDO.getRemindContent(),Integer.parseInt(baseExceptionDictDO.getCode()));
        }else {
            return failed(e.getMessage(),-10000);
        }
       /* if (e.getClass().equals(DataAccessException.class)) {
            e.printStackTrace();//数据库操作失败
            return null;
        } else if (e.getClass().toString().equals(
                NullPointerException.class.toString())) {
            e.printStackTrace();
            //调用了未经初始化的对象或者是不存在的对象!
            return failed("空指针",170004);
        } else if (e.getClass().equals(IOException.class)) {
            e.printStackTrace();
            //IO异常!
            return null;
        } else if (e.getClass().equals(ClassNotFoundException.class)) {
            e.printStackTrace();//指定的类不存在!
            return null;
        } else if (e.getClass().equals(ArithmeticException.class)) {
            e.printStackTrace();//数学运算异常!
            return null;
        } else if (e.getClass().equals(ArrayIndexOutOfBoundsException.class)) {
            e.printStackTrace();
            //数组下标越界!
            return null;
        } else if (e.getClass().equals(IllegalArgumentException.class)) {
            e.printStackTrace();
            //方法的参数错误!
            return null;
        } else if (e.getClass().equals(ClassCastException.class)) {
            e.printStackTrace();//类型强制转换错误!
            return null;
        } else if (e.getClass().equals(SecurityException.class)) {
            e.printStackTrace();//违背安全原则异常!
            return null;
        } else if (e.getClass().equals(SQLException.class)) {
            e.printStackTrace();//操作数据库异常!
            return null;
        } else if (e.getClass().equals(NoSuchMethodError.class)) {
            e.printStackTrace();//方法末找到异常!
            return null;
        } else if (e.getClass().equals(InternalError.class)) {
            e.printStackTrace();//Java虚拟机发生了内部错误
            return null;
        } else {
            e.printStackTrace();//程序内部错误,操作失败!
            return null;
        }*/
    }
    protected Envelop failed (String message, int status) {
        Envelop envelop = new Envelop();
        envelop.setMessage(message);

+ 19 - 0
common/common-util/src/main/java/com/yihu/jw/util/idcard/IdCardUtil.java

@ -179,6 +179,25 @@ public class IdCardUtil {
        }
        return sex;
    }
    /**
     * 获取性别
     * @param sex
     * @param idcard
     * @return
     */
    public static String getSex(Integer sex,String idcard){
        if(sex != null){
            return String.valueOf(sex);
        }
        String res = level_sex_3;
        try{
            return getSexForIdcard_new(idcard);
        }catch (Exception e){
            e.printStackTrace();
        }
        return res;
    }
    
    /**
     * 根据身份证的号码算出当前身份证持有者的性别,返回性别文字

+ 18 - 3
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/DidiFilterProcessor.java

@ -5,16 +5,22 @@ import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.context.RequestContext;
import com.netflix.zuul.exception.ZuulException;
import com.yihu.jw.entity.base.dict.BaseExceptionLogDO;
import com.yihu.jw.gateway.AesEncryptUtils;
import com.yihu.jw.gateway.methlog.BaseExceptionService;
import com.yihu.jw.gateway.methlog.dao.BaseExceptionDictDao;
import com.yihu.jw.gateway.methlog.dao.BaseExceptionLogDao;
import com.yihu.jw.gateway.methlog.dao.BaseExceptionServerDictDao;
import com.yihu.jw.gateway.security.BeanUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.util.StreamUtils;
import org.springframework.util.StringUtils;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.text.DecimalFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -57,14 +63,23 @@ public class DidiFilterProcessor extends FilterProcessor {
                    responseCode=serviceId+list.get(0).get("code").toString();
                    exceptionType = list.get(0).get("exceptionType").toString();
                }
                ZuulException e1 = new ZuulException(message, StringUtils.isEmpty(responseCode)?99999999:Integer.valueOf(responseCode),cause);
                ZuulException e1 = new ZuulException(message, StringUtils.isEmpty(responseCode)?99999999:Integer.parseInt(responseCode),cause);
                BaseExceptionLogDO baseExceptionLogDO = new BaseExceptionLogDO();
                baseExceptionLogDO.setCreateTime(new Date());
                baseExceptionLogDO.setExceptionType(exceptionType);
                baseExceptionLogDO.setServiceCode(serviceId);
                baseExceptionLogDO.setExceptionCode(responseCode);
                baseExceptionLogDO.setRequest(ctx.getRequest().toString());
                baseExceptionLogDO.setResponse(ctx.toString());
                try {
                    String  in = ctx.getRequest().getParameter("object");
                    String jsonobject = AesEncryptUtils.decrypt(in);
                    baseExceptionLogDO.setRequest(jsonobject);
                    InputStream stream = RequestContext.getCurrentContext().getResponseDataStream();
                    byte[] bytes = StreamUtils.copyToByteArray(stream);
                    String resp = new String(bytes,"UTF8");
                    baseExceptionLogDO.setResponse(resp);
                }catch (Exception s){
                    s.printStackTrace();
                }
                baseExceptionLogDao.save(baseExceptionLogDO);
                ctx.set("failed.exception", e1);
                ctx.set("failed.filter", filter);

+ 33 - 45
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/PostFilter.java

@ -39,52 +39,40 @@ public class PostFilter extends ZuulFilter {
    @Override
    public Object run() {
        RequestContext ctx = RequestContext.getCurrentContext();
        logger.info("进入post过滤器"+ctx.getResponseStatusCode()+"==="+ctx.getRequest().getServletPath()+"==="+ctx.getResponse().getStatus()+"==");
        if (ctx.getRequest().getServletPath().contains("/hospital/")){
            if (ctx.getResponse().getStatus()==500){
                ctx.setSendZuulResponse(false);
                ctx.setThrowable(null);
                ctx.setResponseStatusCode(10111);
            }
        logger.info("进入post过滤器");
        HttpServletRequest request = ctx.getRequest();
        String url = request.getRequestURI();
        if (url.contains("/excelControl")){
            return true;
        }
        InputStream stream = RequestContext.getCurrentContext().getResponseDataStream();
        try {
        byte[] bytes;
        if(RequestContext.getCurrentContext().getResponseGZipped()){
            GZIPInputStream gzipInputStream = null;
            gzipInputStream = new GZIPInputStream(stream);
            bytes = StreamUtils.copyToByteArray(gzipInputStream);
        }else {
            bytes = StreamUtils.copyToByteArray(stream);
        }
        String body = new String(bytes,"UTF8");
        JSONObject object = new JSONObject();
        object.put("status","200");
        object.put("data", AesEncryptUtils.encrypt(body));
        if (!(url.contains("/open/noLogin/notify")||
            url.contains("/open/noLogin/ylzReceiveNotify")||
            url.contains("/open/noLogin/receiveNotify")||
            url.contains("/open/noLogin/getSFExpressInfoNew")||
            url.contains("/open/noLogin/sfroutepushservice")||
            url.contains("/open/noLogin/ylzSettleRecord")||
                url.contains("/weixin")||url.contains("/oauth/getSsoPublicKey"))){
            RequestContext.getCurrentContext().setResponseBody(object.toJSONString());
        }else {
            RequestContext.getCurrentContext().setResponseBody(body);
        }
        if (ctx.getResponse().getStatus()!=500){
            HttpServletRequest request = ctx.getRequest();
            String url = request.getRequestURI();
            if (url.contains("/excelControl")){
                return true;
            }
            InputStream stream = RequestContext.getCurrentContext().getResponseDataStream();
            try {
                byte[] bytes;
                if(RequestContext.getCurrentContext().getResponseGZipped()){
                    GZIPInputStream gzipInputStream = null;
                    gzipInputStream = new GZIPInputStream(stream);
                    bytes = StreamUtils.copyToByteArray(gzipInputStream);
                }else {
                    bytes = StreamUtils.copyToByteArray(stream);
                }
                String body = new String(bytes,"UTF8");
                logger.info("body"+body);
                JSONObject object = new JSONObject();
                object.put("status","200");
                object.put("data", AesEncryptUtils.encrypt(body));
                if (!(url.contains("/open/noLogin/notify")||
                        url.contains("/open/noLogin/ylzReceiveNotify")||
                        url.contains("/open/noLogin/receiveNotify")||
                        url.contains("/open/noLogin/getSFExpressInfoNew")||
                        url.contains("/open/noLogin/sfroutepushservice")||
                        url.contains("/open/noLogin/ylzSettleRecord")||
                        url.contains("/weixin")||url.contains("/oauth/getSsoPublicKey"))){
                    RequestContext.getCurrentContext().setResponseBody(object.toJSONString());
                }else {
                    RequestContext.getCurrentContext().setResponseBody(body);
                }
                logger.info(ctx.getResponseBody()+"");
            } catch (Exception e) {
                logger.info("");
                e.printStackTrace();
            }
        logger.info(ctx.getResponseBody()+"");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
 

+ 37 - 0
starter/swagger-starter/pom.xml

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <artifactId>wlyy-starter</artifactId>
        <groupId>com.yihu.jw</groupId>
        <version>2.0.0</version>
    </parent>
    <artifactId>swagger-starter</artifactId>
    <dependencies>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>${version.swagger}</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>${version.swagger-ui}</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-staticdocs</artifactId>
            <version>${version.springfox-staticdocs}</version>
        </dependency>
        <dependency>
            <groupId>io.github.swagger2markup</groupId>
            <artifactId>swagger2markup</artifactId>
            <version>${version.swagger2markup}</version>
        </dependency>
    </dependencies>
</project>

+ 1 - 0
starter/swagger-starter/readme.MD

@ -0,0 +1 @@
swagger 入参多一个userAgent 入参 方便开发排查接口

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/config/SwaggerConfig.java

@ -1,4 +1,4 @@
package com.yihu.jw.care.config;
package com.yihu.jw;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

+ 3 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/service/course/RecruitStudentsRecordService.java

@ -8,6 +8,7 @@ import com.yihu.jw.entity.care.course.RecruitStudentsDO;
import com.yihu.jw.entity.care.course.RecruitStudentsRecordDO;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -106,7 +107,8 @@ public class RecruitStudentsRecordService extends BaseJpaService<RecruitStudents
     * @return
     */
    public synchronized boolean isAdmissionFull(String id){
        List<RecruitStudentsRecordDO> list = recruitStudentsRecordDao.findByRecruitStudentsIdAndStatus(id,"3");
        String sql = "select * from base_recruit_students_record where recruit_students_id = '"+id+"' and status in ('2','3','6') and del =1 ";
        List<RecruitStudentsRecordDO> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(RecruitStudentsRecordDO.class));
        RecruitStudentsDO recruitStudentsDO = recruitStudentsDao.findOne(id);
        if(recruitStudentsDO.getNum()<=list.size()){
            return true;

+ 1 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/BusinessSysDictService.java

@ -98,7 +98,7 @@ public class BusinessSysDictService extends BaseJpaService<BusinessSysDictDO, Bu
                " t.py_code  as \"pyCode\","+
                " t.img_url  as \"imgUrl\","+
                " t.create_time as \"createTime\""+
                " from base_business_sys_dict t where 1=1 ";
                " , t.ext1, t.ext2 from base_business_sys_dict t where 1=1 ";
        if (StringUtils.isNoneBlank(name)){
            sql+=" and t.dict_name like '%"+name+"%'";
        }

+ 3 - 18
svr/svr-cloud-care/pom.xml

@ -123,24 +123,9 @@
        </dependency>
        <!-- Swagger-ui library -->
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>${version.swagger}</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>${version.swagger-ui}</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-staticdocs</artifactId>
            <version>${version.springfox-staticdocs}</version>
        </dependency>
        <dependency>
            <groupId>io.github.swagger2markup</groupId>
            <artifactId>swagger2markup</artifactId>
            <version>${version.swagger2markup}</version>
            <groupId>com.yihu.jw</groupId>
            <artifactId>swagger-starter</artifactId>
            <version>2.0.0</version>
        </dependency>
        <!-- Jzkl Starter -->
        <dependency>

+ 2 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/aop/RedisLockAOP.java

@ -33,9 +33,9 @@ import java.util.List;
/**
 * redis分布式锁AOP
 *
 * @author baichuan.wu
 * @author yeshijie
 * @version 1.0.0
 * @date 2019-12-26 14:16
 * @date 2021/4/23
 */
@Aspect
@Order(-1)

+ 0 - 44
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/config/SwaggerDocs.java

@ -1,44 +0,0 @@
package com.yihu.jw.care.config;
import io.github.swagger2markup.GroupBy;
import io.github.swagger2markup.Language;
import io.github.swagger2markup.Swagger2MarkupConfig;
import io.github.swagger2markup.Swagger2MarkupConverter;
import io.github.swagger2markup.builder.Swagger2MarkupConfigBuilder;
import io.github.swagger2markup.markup.builder.MarkupLanguage;
import java.net.URL;
import java.nio.file.Path;
import java.nio.file.Paths;
/**
 * Created by lith on 2018/11/23
 */
public class SwaggerDocs {
    public static void main(String[] args) throws Exception {
        //1.请求 http://ip:port/swagger-resources获取group
        String group = "Default";
        //2.定义请求地址 new URL("http://ip:port/v2/api-docs?group=" + groupName)
        //项目的swagger-ui地址
        URL remoteSwaggerFile = new URL("http://127.0.0.1:10022/v2/api-docs?group=" + group);
        //3.定义文件输出路径
        String prefix = Thread.currentThread().getContextClassLoader().getResource("").getPath();
        //文档输出地址
        Path outputFile = Paths.get(prefix.substring(prefix.lastIndexOf(":") + 1, prefix.indexOf("target") - 1) + "/build/" + group);
        Swagger2MarkupConfig config = new Swagger2MarkupConfigBuilder()
                .withMarkupLanguage(MarkupLanguage.ASCIIDOC)
                .withOutputLanguage(Language.ZH)
                .withPathsGroupedBy(GroupBy.TAGS)
                .withGeneratedExamples()
                .withoutInlineSchema()
                //.withBasePathPrefix()
                .build();
        Swagger2MarkupConverter converter = Swagger2MarkupConverter.from(remoteSwaggerFile)
                .withConfig(config)
                .build();
        converter.toFile(outputFile);
    }
}

+ 16 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/course/NurseryLogDao.java

@ -0,0 +1,16 @@
package com.yihu.jw.care.dao.course;
import com.yihu.jw.entity.care.course.NurseryLogDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/5/20
 * @Description:
 */
public interface NurseryLogDao extends PagingAndSortingRepository<NurseryLogDO, String>, JpaSpecificationExecutor<NurseryLogDO> {
}

+ 20 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/course/PatientCourseRecordDao.java

@ -0,0 +1,20 @@
package com.yihu.jw.care.dao.course;
import com.yihu.jw.entity.care.course.PatientCourseRecordDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/5/20
 * @Description:
 */
public interface PatientCourseRecordDao extends PagingAndSortingRepository<PatientCourseRecordDO, String>,
        JpaSpecificationExecutor<PatientCourseRecordDO> {
    List<PatientCourseRecordDO> findByNurseryLogId(String nurseryLogId);
}

+ 19 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/course/PatientDietRecordDao.java

@ -0,0 +1,19 @@
package com.yihu.jw.care.dao.course;
import com.yihu.jw.entity.care.course.PatientDietRecordDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/5/20
 * @Description:
 */
public interface PatientDietRecordDao extends PagingAndSortingRepository<PatientDietRecordDO, String>, JpaSpecificationExecutor<PatientDietRecordDO> {
    List<PatientDietRecordDO> findByNurseryLogId(String nurseryLogId);
}

+ 189 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/course/NurseryLogEndpoint.java

@ -0,0 +1,189 @@
package com.yihu.jw.care.endpoint.course;
import com.yihu.jw.care.service.course.NurseryLogService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
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.*;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/5/20
 * @Description:
 */
@RestController
@RequestMapping("nursery" )
@Api(tags = "托育日志", description = "托育日志")
public class NurseryLogEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private NurseryLogService nurseryLogService;
    @GetMapping(value = "findNurseryLogByMonth")
    @ApiOperation("获取托育日志按月日历形式")
    public Envelop findNurseryLogByMonth(@ApiParam(name = "orgCode", value = "机构id")
                                      @RequestParam(value = "orgCode", required = true) String orgCode,
                                          @ApiParam(name = "patient", value = "居民")
                                      @RequestParam(value = "patient", required = false) String patient,
                                          @ApiParam(name = "patientName", value = "居民姓名")
                                      @RequestParam(value = "patientName", required = false) String patientName,
                                          @ApiParam(value = "开始时间,格式(yyyy-MM-dd)", name = "startDate",required = false)
                                      @RequestParam(value = "startDate", required = false) String startDate,
                                          @ApiParam(value = "结束时间,格式(yyyy-MM-dd)", name = "endDate",required = false)
                                      @RequestParam(value = "endDate", required = false) String endDate){
        try {
            return ObjEnvelop.getSuccess("操作成功!",nurseryLogService.findNurseryLogByMonth(orgCode,patient,patientName,startDate,endDate));
        }catch (Exception e){
            return  failedException(e);
        }
    }
    @GetMapping(value = "findNurseryLogList")
    @ApiOperation("获取托育日志列表-已填写")
    public Envelop findNurseryLogList(@ApiParam(name = "orgCode", value = "机构id")
                                            @RequestParam(value = "orgCode", required = true) String orgCode,
                                            @ApiParam(name = "recordDate", value = "时间")
                                            @RequestParam(value = "recordDate", required = false) String recordDate){
        try {
            return ObjEnvelop.getSuccess("操作成功!",nurseryLogService.findNurseryLogList(orgCode,recordDate));
        }catch (Exception e){
            return  failedException(e);
        }
    }
    @GetMapping(value = "nuseryLogUnFilledIn")
    @ApiOperation("获取未填写日志列表")
    public Envelop nuseryLogUnFilledIn(@ApiParam(name = "orgCode", value = "机构id")
                                         @RequestParam(value = "orgCode", required = true) String orgCode,
                                         @ApiParam(name = "recordDate", value = "时间")
                                         @RequestParam(value = "recordDate", required = false) String recordDate){
        try {
            return ObjEnvelop.getSuccess("操作成功!",nurseryLogService.nuseryLogUnFilledIn(orgCode,recordDate));
        }catch (Exception e){
            return  failedException(e);
        }
    }
    @PostMapping("addNurseryLog")
    @ApiOperation(value = "新增托育日志")
    public Envelop addNurseryLog(
            @ApiParam(name = "patient", value = "居民id") @RequestParam(value = "patient", required = true) String patient,
            @ApiParam(name = "patientName", value = "居民姓名") @RequestParam(value = "patientName", required = true) String patientName,
            @ApiParam(name = "doctor", value = "医生id") @RequestParam(value = "doctor", required = true) String doctor,
            @ApiParam(name = "doctorName", value = "医生姓名") @RequestParam(value = "doctorName", required = true) String doctorName,
            @ApiParam(name = "orgCode", value = "机构id") @RequestParam(value = "orgCode", required = true) String orgCode,
            @ApiParam(name = "orgName", value = "机构名称") @RequestParam(value = "orgName", required = true) String orgName,
            @ApiParam(name = "recordDate", value = "记录日期 格式 yyyy-MM-dd") @RequestParam(value = "recordDate", required = true) String recordDate) {
        try {
            return success("新增成功",nurseryLogService.addNurseryLog(patient, patientName, doctor, doctorName, orgCode, orgName, recordDate));
        } catch (Exception e) {
            return  failedException(e);
        }
    }
    @PostMapping("addCourseRecord")
    @ApiOperation(value = "新增课程记录")
    public Envelop addCourseRecord(
            @ApiParam(name = "id", value = "托育日志id") @RequestParam(value = "id", required = true) String id,
            @ApiParam(name = "content", value = "课程记录内容") @RequestParam(value = "content", required = true) String content,
            @ApiParam(name = "enclosure", value = "附件") @RequestParam(value = "enclosure", required = false) String enclosure) {
        try {
            return success("新增成功",nurseryLogService.addCourseRecord(id, content, enclosure));
        } catch (Exception e) {
            return  failedException(e);
        }
    }
    @PostMapping("addDietRecord")
    @ApiOperation(value = "新增饮食记录")
    public Envelop addDietRecord(
            @ApiParam(name = "id", value = "托育日志id") @RequestParam(value = "id", required = true) String id,
            @ApiParam(name = "eatFood", value = "食用食物") @RequestParam(value = "eatFood", required = true) String eatFood,
            @ApiParam(name = "eatType", value = "进食方式") @RequestParam(value = "eatType", required = true) String eatType,
            @ApiParam(name = "enclosure", value = "附件") @RequestParam(value = "enclosure", required = false) String enclosure,
            @ApiParam(name = "intake", value = "摄入量") @RequestParam(value = "intake", required = true) String intake,
            @ApiParam(name = "additionalNotes", value = "附加说明") @RequestParam(value = "additionalNotes", required = false) String additionalNotes) {
        try {
            return success("新增成功",nurseryLogService.addDietRecord(id, eatFood, eatType, enclosure, intake, additionalNotes));
        } catch (Exception e) {
            return  failedException(e);
        }
    }
    @GetMapping(value = "nurseryDetail")
    @ApiOperation("获取课程记录详情")
    public Envelop nurseryDetail(@ApiParam(name = "id", value = "id")
                                            @RequestParam(value = "id", required = true) String id){
        try {
            return ObjEnvelop.getSuccess("操作成功!",nurseryLogService.nurseryDetail(id));
        }catch (Exception e){
            return  failedException(e);
        }
    }
    @GetMapping(value = "findDictDiet")
    @ApiOperation("查找饮食字典")
    public Envelop findDictDiet(){
        try {
            return ObjEnvelop.getSuccess("操作成功!",nurseryLogService.findDictDiet());
        }catch (Exception e){
            return  failedException(e);
        }
    }
    @GetMapping(value = "findRecordByNurseryLogId")
    @ApiOperation("根据托育日志id查找")
    public Envelop findRecordByNurseryLogId(@ApiParam(name = "id", value = "托育日志id")
                                                   @RequestParam(value = "id", required = true) String id,
                                               @ApiParam(name = "type", value = "类型 diet饮食记录 course课程记录")
                                               @RequestParam(value = "type", required = true) String type){
        try {
            return nurseryLogService.findRecordByNurseryLogId(id,type);
        }catch (Exception e){
            return  failedException(e);
        }
    }
    @GetMapping(value = "findDietRecord")
    @ApiOperation("查找饮食记录")
    public Envelop findDietRecord(@ApiParam(name = "id", value = "id")
                                            @RequestParam(value = "id", required = true) String id){
        try {
            return nurseryLogService.findDietRecord(id);
        }catch (Exception e){
            return  failedException(e);
        }
    }
    @GetMapping(value = "findCourseRecord")
    @ApiOperation("查找课程记录记录")
    public Envelop findCourseRecord(@ApiParam(name = "id", value = "id")
                                            @RequestParam(value = "id", required = true) String id){
        try {
            return nurseryLogService.findCourseRecord(id);
        }catch (Exception e){
            return  failedException(e);
        }
    }
    @GetMapping(value = "findNurseryLogByPatient")
    @ApiOperation("获取托育日志按月日历形式 - 居民端")
    public Envelop findNurseryLogByPatient(@ApiParam(name = "patient", value = "居民")
                                         @RequestParam(value = "patient", required = true) String patient,
                                         @ApiParam(value = "开始时间,格式(yyyy-MM-dd)", name = "startDate",required = false)
                                         @RequestParam(value = "startDate", required = false) String startDate,
                                         @ApiParam(value = "结束时间,格式(yyyy-MM-dd)", name = "endDate",required = false)
                                         @RequestParam(value = "endDate", required = false) String endDate){
        try {
            return ObjEnvelop.getSuccess("操作成功!",nurseryLogService.findNurseryLogByPatient(patient,startDate,endDate));
        }catch (Exception e){
            return  failedException(e);
        }
    }
}

+ 176 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/course/PatientCourseEndpoint.java

@ -96,4 +96,180 @@ public class PatientCourseEndpoint extends EnvelopRestEndpoint {
            return Envelop.getError( "获取失败!" ,-1);
        }
    }
    @GetMapping("getCourseByCourse")
    @ApiOperation(value = "在线报名-根据课程展示")
    public ObjEnvelop getCourseByCourse(
            @ApiParam(name = "longitude", value = "所在位置经度", defaultValue = "118.10388605") @RequestParam(value = "longitude", required = true) String longitude,
            @ApiParam(name = "latitude", value = "所在位置纬度", defaultValue = "24.48923061") @RequestParam(value = "latitude", required = true) String latitude,
            @ApiParam(name = "pageSize", value = "页面大小", defaultValue = "2") @RequestParam(value = "pageSize", required = true) int pageSize,
            @ApiParam(name = "currentPage", value = "当前页面", defaultValue = "1") @RequestParam(value = "currentPage", required = true) int currentPage) {
        try {
            JSONObject json = courseService.getCourseByCourse(longitude,latitude, pageSize, currentPage);
            return ObjEnvelop.getSuccess("获取成功",json);
        } catch (Exception e) {
            e.printStackTrace();
            return ObjEnvelop.getError( "获取失败!" ,-1);
        }
    }
    @GetMapping("getCourseByOrg")
    @ApiOperation(value = "在线报名-根据机构展示")
    public ObjEnvelop getCourseByOrg(
            @ApiParam(name = "longitude", value = "所在位置经度", defaultValue = "118.10388605") @RequestParam(value = "longitude", required = true) String longitude,
            @ApiParam(name = "latitude", value = "所在位置纬度", defaultValue = "24.48923061") @RequestParam(value = "latitude", required = true) String latitude
//            @ApiParam(name = "pageSize", value = "页面大小", defaultValue = "2") @RequestParam(value = "pageSize", required = true) int pageSize,
//            @ApiParam(name = "currentPage", value = "当前页面", defaultValue = "1") @RequestParam(value = "currentPage", required = true) int currentPage
    ) {
        try {
            JSONObject json = courseService.getCourseByOrg(longitude,latitude);//, pageSize, currentPage
            return ObjEnvelop.getSuccess("获取成功",json);
        } catch (Exception e) {
            e.printStackTrace();
            return ObjEnvelop.getError( "获取失败!" ,-1);
        }
    }
    @GetMapping("getCourseByteacher")
    @ApiOperation(value = "在线报名-根据教师展示")
    public ObjEnvelop getCourseByteacher(
            @ApiParam(name = "longitude", value = "所在位置经度", defaultValue = "118.10388605") @RequestParam(value = "longitude", required = true) String longitude,
            @ApiParam(name = "latitude", value = "所在位置纬度", defaultValue = "24.48923061") @RequestParam(value = "latitude", required = true) String latitude
//            @ApiParam(name = "pageSize", value = "页面大小", defaultValue = "2") @RequestParam(value = "pageSize", required = true) int pageSize,
//            @ApiParam(name = "currentPage", value = "当前页面", defaultValue = "1") @RequestParam(value = "currentPage", required = true) int currentPage
    ) {
        try {
            JSONObject json = courseService.getCourseByteacher(longitude,latitude);//, pageSize, currentPage
            return ObjEnvelop.getSuccess("获取成功",json);
        } catch (Exception e) {
            e.printStackTrace();
            return ObjEnvelop.getError( "获取失败!" ,-1);
        }
    }
    @GetMapping("getCourseInfo")
    @ApiOperation(value = "在线报名-获取课程详情")
    public ObjEnvelop getCourseInfo(
            @ApiParam(name = "id", value = "课程id", defaultValue = "808080eb7861c327017861d18d070011") @RequestParam(value = "id", required = true) String id
    ) {
        try {
            JSONObject json = courseService.getCourseInfo(id);//, pageSize, currentPage
            return ObjEnvelop.getSuccess("获取成功",json);
        } catch (Exception e) {
            e.printStackTrace();
            return ObjEnvelop.getError( "获取失败!" ,-1);
        }
    }
    @GetMapping("getCatalogue")
    @ApiOperation(value = "在线报名-获取课程目录")
    public ObjEnvelop getCatalogue(
            @ApiParam(name = "id", value = "课程id", defaultValue = "808080eb7861c327017861d18d070011") @RequestParam(value = "id", required = true) String id,
            @ApiParam(name = "patient", value = "居民code", defaultValue = "808080eb7955aa9301795b8bad3f0078") @RequestParam(value = "patient", required = true) String patient
    ) {
        try {
            JSONObject json = courseService.getCatalogue(id,patient);//, pageSize, currentPage
            return ObjEnvelop.getSuccess("获取成功",json);
        } catch (Exception e) {
            e.printStackTrace();
            return ObjEnvelop.getError( "获取失败!" ,-1);
        }
    }
    @GetMapping("getOrgInfoById")
    @ApiOperation(value = "在线报名-获取机构详情")
    public ObjEnvelop getOrgInfoById(
            @ApiParam(name = "id", value = "机构id", defaultValue = "808080eb7861c327017861d18d070011") @RequestParam(value = "id", required = true) String id
    ) {
        try {
            JSONObject json = courseService.getOrgInfoById(id);//, pageSize, currentPage
            return ObjEnvelop.getSuccess("获取成功",json);
        } catch (Exception e) {
            e.printStackTrace();
            return ObjEnvelop.getError( "获取失败!" ,-1);
        }
    }
    @GetMapping("getTecInfoById")
    @ApiOperation(value = "在线报名-获取教师详情(根据教师id)")
    public ObjEnvelop getTecInfoById(
            @ApiParam(name = "doctor", value = "教师id", defaultValue = "402803816babc778016babca89ea0032") @RequestParam(value = "doctor", required = true) String doctor,
            @ApiParam(name = "orgCode", value = "机构code", defaultValue = "xm10086") @RequestParam(value = "orgCode", required = true) String orgCode,
            @ApiParam(name = "page", value = "page", defaultValue = "1") @RequestParam(value = "page", required = true) int page,
            @ApiParam(name = "size", value = "size", defaultValue = "10") @RequestParam(value = "size", required = true) int size
    ) {
        try {
            JSONObject json = courseService.getTecInfoById(doctor,orgCode,page,size);//, pageSize, currentPage
            return ObjEnvelop.getSuccess("获取成功",json);
        } catch (Exception e) {
            e.printStackTrace();
            return ObjEnvelop.getError( "获取失败!" ,-1);
        }
    }
    @GetMapping("getCoursrOrderStatusByPatient")
    @ApiOperation(value = "在线报名-获取居民订单(根据居民id)")
    public ObjEnvelop getCoursrOrderStatusByPatient(
            @ApiParam(name = "patient", value = "居民id", defaultValue = "3ae2673512154d5280d1dcf5ffa5626d") @RequestParam(value = "patient", required = true) String patient,
            @ApiParam(name = "status", value = "status", defaultValue = "0") @RequestParam(value = "status", required = true) int status,
            @ApiParam(name = "page", value = "page", defaultValue = "1") @RequestParam(value = "page", required = true) int page,
            @ApiParam(name = "size", value = "size", defaultValue = "10") @RequestParam(value = "size", required = true) int size
    ) {
        try {
            JSONObject json = courseService.getCoursrOrderStatusByPatient(patient,status,page,size);//, pageSize, currentPage
            return ObjEnvelop.getSuccess("获取成功",json);
        } catch (Exception e) {
            e.printStackTrace();
            return ObjEnvelop.getError( "获取失败!" ,-1);
        }
    }
    @GetMapping("getOrderInfo")
    @ApiOperation(value = "在线报名-获取订单详情(根据orderId)")
    public Envelop getOrderInfo(
            @ApiParam(name = "orderId", value = "订单id", defaultValue = "3ae2673512154d5280d1dcf5ffa5626d") @RequestParam(value = "根据orderId", required = true) String orderId
    ) {
        try {
            return success(courseService.getOrderInfo(orderId));
        } catch (Exception e) {
            return failedException(e);
        }
    }
    @PostMapping("enrollment")
    @ApiOperation(value = "招生报名")
    public Envelop enrollment(@ApiParam(name = "patient", value = "居民id", defaultValue = "3ae2673512154d5280d1dcf5ffa5626d")
                              @RequestParam(value = "patient", required = true) String patient,
                              @ApiParam(name = "recruitStudentsId", value = "招生id", defaultValue = "1")
                              @RequestParam(value = "recruitStudentsId", required = true) String recruitStudentsId){
        try {
            JSONObject json = courseService.enrollment(patient,recruitStudentsId);
            if(json.getInteger(ResponseContant.resultFlag)==0){
                return failed(json.getString(ResponseContant.resultMsg),-1);
            }
            return success("报名成功",json.get("recordDO"));
        } catch (Exception e) {
            return failedException(e);
        }
    }
    //购买课程
    @PostMapping("buyCourseOrder")
    @ApiOperation(value = "在线报名-购买课程")
    public Envelop buyCourseOrder(
            @ApiParam(name = "patient", value = "居民id", defaultValue = "3ae2673512154d5280d1dcf5ffa5626d") @RequestParam(value = "patient", required = true) String patient,
            @ApiParam(name = "patientName", value = "居民name", defaultValue = "白海灵") @RequestParam(value = "patientName", required = true) String patientName,
            @ApiParam(name = "courseId", value = "课程id", defaultValue = "808080eb7983eb630179882b9a540034") @RequestParam(value = "courseId", required = true) String courseId,
            @ApiParam(name = "payType", value = "1-微信支付,2-线下支付", defaultValue = "1") @RequestParam(value = "payType", required = true) String payType
    ) {
        try {
            return success(courseService.buyCourseOrder(patient,patientName,courseId,payType));
        } catch (Exception e) {
            return failedException(e);
        }
    }
    //申请退款
    //直播间
}

+ 422 - 24
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/course/CourseService.java

@ -1,6 +1,7 @@
package com.yihu.jw.care.service.course;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.care.dao.course.*;
@ -8,12 +9,14 @@ import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.care.course.*;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.idcard.IdCardUtil;
import com.yihu.jw.utils.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
@ -21,10 +24,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
 * Created with IntelliJ IDEA.
@ -51,10 +51,16 @@ public class CourseService {
    @Autowired
    private RecruitStudentsRecordDao recruitStudentsRecordDao;
    @Autowired
    private RecruitStudentsDao recruitStudentsDao;
    @Autowired
    private BusinessOrderDao businessOrderDao;
    @Autowired
    private PatientOrderRefundDao patientOrderRefundDao;
    @Autowired
    private BaseOrgDao orgDao;
    @Autowired
    private BaseDoctorHospitalDao doctorHospitalDao;
    @Autowired
    private ObjectMapper objectMapper;
    @Autowired
    private BaseDoctorHospitalDao baseDoctorHospitalDao;
@ -121,26 +127,22 @@ public class CourseService {
        if(flag){
            //支付信息
            BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(id);
            if(businessOrderDO!=null){
                JSONObject json = new JSONObject();
                json.put("payPrice",businessOrderDO.getPayPrice());
                json.put("payTime",DateUtil.dateToStrLong(businessOrderDO.getPayTime()));
                json.put("payType",businessOrderDO.getPayType());
                resJson.put("businessOrderDO",json);
            }
            JSONObject json = new JSONObject();
            json.put("payPrice",businessOrderDO.getPayPrice());
            json.put("payTime",businessOrderDO.getPayTime());
            json.put("payType",businessOrderDO.getPayType());
            resJson.put("businessOrderDO",json);
        }
        if("5".equals(status)||"6".equals(status)){
            //退款信息
            PatientOrderRefundDO refundDO = patientOrderRefundDao.findByTypeAndOrderId(type,id);
            if(refundDO!=null){
                JSONObject json = new JSONObject();
                json.put("createTime", DateUtil.dateToStrLong(refundDO.getCreateTime()));
                json.put("refundPrice",refundDO.getRefundPrice());
                json.put("status",refundDO.getStatus());
                json.put("refundDesc",refundDO.getRefundDesc());
                json.put("enclosure",refundDO.getEnclosure());
                resJson.put("refundDO",json);
            }
            JSONObject json = new JSONObject();
            json.put("createTime",refundDO.getCreateTime());
            json.put("refundPrice",refundDO.getRefundPrice());
            json.put("status",refundDO.getStatus());
            json.put("refundDesc",refundDO.getRefundDesc());
            json.put("enclosure",refundDO.getEnclosure());
            resJson.put("refundDO",json);
        }
        return resJson;
@ -321,14 +323,14 @@ public class CourseService {
            filter += " and status = "+ status +" ";
        }
        String sqlUnion = " SELECT id,`status`,recruit_name title,pay_type payType,price,1 type,DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%s') createTime " +
        String sqlUnion = " SELECT id,`status`,recruit_name title,pay_type payType,price,1 type,DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%s') createTtime " +
                " from base_recruit_students_record " + filter+
                " UNION ALL " +
                " SELECT id,`status`,course_name title,pay_type payType,price,2 type,DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%s') createTime  " +
                " SELECT id,`status`,course_name title,pay_type payType,price,2 type,DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%s') createTtime  " +
                " from base_course_sales_order_record " + filter+" ";
        String sql = "SELECT * from ( " + sqlUnion + " ) a " +
                " ORDER BY a.createTime desc " +
                " ORDER BY a.createTtime desc " +
                " LIMIT {start},{end};";
        String finalSql = sql.replace("{start}", String.valueOf(start))
                .replace("{end}", String.valueOf(end));
@ -361,4 +363,400 @@ public class CourseService {
        return result;
    }
    //根据机构坐标进行排序
    public JSONObject getCourseByCourse(String lon2,String lat2, int pageSize,int currentPage){
        JSONObject object = new JSONObject();
        String sql = "SELECT id,`name`,longitude,latitude FROM base.base_org where del = 1 and type = 4";
        List<Map<String , Object>> positionList = jdbcTemplate.queryForList(sql);
        List<Map<String,Object>> list = new ArrayList<>();
        List<Map<String , Object>> currentPageList = new ArrayList<>();
        if (positionList.size() > 0){
            for (int i=0;i<positionList.size();i++){
                String sql1 = "SELECT id,code,`name`,longitude,latitude ,funDistance("+positionList.get(i).get("latitude")+","+positionList.get(i).get("longitude")+","+lat2+","+lon2+") funDistance FROM base.base_org where id = '"+positionList.get(i).get("id")+"'";
                List<Map<String , Object>> mapList = jdbcTemplate.queryForList(sql1);
                JSONObject obj = new JSONObject();
                obj.put("id",mapList.get(0).get("id"));
                obj.put("name",mapList.get(0).get("name"));
                obj.put("longitude",mapList.get(0).get("longitude"));
                obj.put("latitude",mapList.get(0).get("latitude"));
                obj.put("funDistance",mapList.get(0).get("funDistance"));
                obj.put("code",mapList.get(0).get("code"));
                list.add(obj);
            }
            if (list.size() > 0){
                Collections.sort(list, new Comparator<Map<String, Object>>() {
                    public int compare(Map<String, Object> o1, Map<String, Object> o2) {
                        return (Double) o1.get("funDistance") > (Double) o2.get("funDistance") ? 1 : ((Double) o1.get("funDistance") == (Double) o2.get("funDistance") ? 0 : -1);
                    }
                });
            }
            List<Map<String , Object>> aList = new ArrayList();
            if (list.size() > 0){
                for (int i =0;i<list.size();i++){
                    String sql1 = "SELECT * FROM base_course WHERE del = 1 AND org_code = '"+list.get(i).get("code")+"'" ;
                    List<Map<String , Object >> amapList = jdbcTemplate.queryForList(sql1);
                    if (amapList.size() > 0){
                        for (int j = 0;j<amapList.size();j++){
                            JSONObject o = new JSONObject();
                            o.put("id",amapList.get(j).get("id"));
                            o.put("name",amapList.get(j).get("name"));
                            o.put("orgCode",amapList.get(j).get("org_code"));
                            o.put("orgName",amapList.get(j).get("org_name"));
                            o.put("doctor",amapList.get(j).get("doctor"));
                            o.put("doctorName",amapList.get(j).get("doctor_name"));
                            o.put("liveTime",amapList.get(j).get("live_time"));
                            o.put("liveStatus",amapList.get(j).get("live_status"));
                            o.put("liveDuration",amapList.get(j).get("live_duration"));
                            o.put("courseCover",amapList.get(j).get("course_cover"));
                            o.put("status",amapList.get(j).get("status"));
                            o.put("fee",amapList.get(j).get("fee"));
                            o.put("introduction",amapList.get(j).get("introduction"));
                            aList.add(o);
                        }
                    }
                }
                if (aList.size() > 0 ){
                    if (aList != null && aList.size() > 0) {
                        int currIdx = (currentPage > 1 ? (currentPage - 1) * pageSize : 0);
                        for (int i = 0; i < pageSize && i < aList.size() - currIdx; i++) {
                            Map<String, Object> data = (Map<String, Object>) aList.get(currIdx + i);
                            currentPageList.add(data);
                        }
                    }
                }
            }
            object.put("object",currentPageList);
        }
        return object;
    }
    public JSONObject getCourseByOrg(String lon2,String lat2){ //, int pageSize,int currentPage
        JSONObject object = new JSONObject();
        String sql = "SELECT id,`name`,longitude,latitude FROM base.base_org where del = 1 and type = 4";
        List<Map<String , Object>> positionList = jdbcTemplate.queryForList(sql);
        List<Map<String,Object>> list = new ArrayList<>();
        if (positionList.size() > 0){
            for (int i=0;i<positionList.size();i++){
                String sql1 = "SELECT id,`name`,photo,address,longitude,latitude ,funDistance("+positionList.get(i).get("latitude")+","+positionList.get(i).get("longitude")+","+lat2+","+lon2+") funDistance FROM base.base_org where id = '"+positionList.get(i).get("id")+"'";
                List<Map<String , Object>> mapList = jdbcTemplate.queryForList(sql1);
                JSONObject obj = new JSONObject();
                obj.put("id",mapList.get(0).get("id"));
                obj.put("name",mapList.get(0).get("name"));
                obj.put("photo",mapList.get(0).get("photo"));
                obj.put("address",mapList.get(0).get("address"));
                obj.put("longitude",mapList.get(0).get("longitude"));
                obj.put("latitude",mapList.get(0).get("latitude"));
                obj.put("funDistance",mapList.get(0).get("funDistance"));
                list.add(obj);
            }
            if (list.size() > 0){
                Collections.sort(list, new Comparator<Map<String, Object>>() {
                    public int compare(Map<String, Object> o1, Map<String, Object> o2) {
                        return (Double) o1.get("funDistance") > (Double) o2.get("funDistance") ? 1 : ((Double) o1.get("funDistance") == (Double) o2.get("funDistance") ? 0 : -1);
                    }
                });
            }
            object.put("object",list);
//            List<Map<String , Object>> currentPageList = new ArrayList<>();
//            if (list.size() > 0 ){
//                if (list != null && list.size() > 0) {
//                    int currIdx = (currentPage > 1 ? (currentPage - 1) * pageSize : 0);
//                    for (int i = 0; i < pageSize && i < list.size() - currIdx; i++) {
//                        Map<String, Object> data = list.get(currIdx + i);
//                        currentPageList.add(data);
//                    }
//                }
//            }
//            object.put("object",currentPageList);
        }
        return object;
    }
    public JSONObject getCourseByteacher(String lon2,String lat2){ //, int pageSize,int currentPage
        JSONObject object = new JSONObject();
        String sql = "SELECT id,`name`,longitude,latitude FROM base.base_org where del = 1 and type = 4";
        List<Map<String , Object>> positionList = jdbcTemplate.queryForList(sql);
        List<Map<String,Object>> list = new ArrayList<>();
        List<Map<String , Object>> currentPageList = new ArrayList<>();
        if (positionList.size() > 0){
            for (int i=0;i<positionList.size();i++){
                String sql1 = "SELECT id,code,`name`,longitude,latitude ,funDistance("+positionList.get(i).get("latitude")+","+positionList.get(i).get("longitude")+","+lat2+","+lon2+") funDistance FROM base.base_org where id = '"+positionList.get(i).get("id")+"'";
                List<Map<String , Object>> mapList = jdbcTemplate.queryForList(sql1);
                JSONObject obj = new JSONObject();
                obj.put("id",mapList.get(0).get("id"));
                obj.put("code",mapList.get(0).get("code"));
                obj.put("name",mapList.get(0).get("name"));
                obj.put("longitude",mapList.get(0).get("longitude"));
                obj.put("latitude",mapList.get(0).get("latitude"));
                obj.put("funDistance",mapList.get(0).get("funDistance"));
                list.add(obj);
            }
            if (list.size() > 0){
                Collections.sort(list, new Comparator<Map<String, Object>>() {
                    public int compare(Map<String, Object> o1, Map<String, Object> o2) {
                        return (Double) o1.get("funDistance") > (Double) o2.get("funDistance") ? 1 : ((Double) o1.get("funDistance") == (Double) o2.get("funDistance") ? 0 : -1);
                    }
                });
            }
            List<Map<String , Object >> aList = new ArrayList<>();
            if (list.size() > 0){
                for (int i =0;i<list.size();i++){
                    String sql1 = "SELECT id,`name`,job_title_code,job_title_name,visit_hospital,visit_hospital_name FROM base_doctor WHERE doctor_level = 3 AND enabled = 1 AND locked = 0 AND del = 1 and  visit_hospital = '"+list.get(i).get("code")+"'" ;
                    List<Map<String , Object >> amapList = jdbcTemplate.queryForList(sql1);
                    if (amapList.size() > 0){
                        for (int j=0;j<amapList.size();j++){
                            JSONObject o = new JSONObject();
                            o.put("id",amapList.get(j).get("id"));
                            o.put("name",amapList.get(j).get("name"));
                            o.put("jobTitleCode",amapList.get(j).get("jobTitleCode"));
                            o.put("jobtitlename",amapList.get(j).get("jobtitlename"));
                            o.put("visithospital",amapList.get(j).get("visithospital"));
                            o.put("visitHospitalName",amapList.get(j).get("visitHospitalName"));
                            aList.add(o);
                        }
                    }
                }
            object.put("object",aList);
//                if (list.size() > 0 ){
//                    if (list != null && list.size() > 0) {
//                        int currIdx = (currentPage > 1 ? (currentPage - 1) * pageSize : 0);
//                        for (int i = 0; i < pageSize && i < list.size() - currIdx; i++) {
//                            Map<String, Object> data = list.get(currIdx + i);
//                            currentPageList.add(data);
//                        }
//                    }
//                }
            }
//            object.put("object",currentPageList);
        }
        return object;
    }
    public JSONObject getCourseInfo(String id){
        JSONObject object = new JSONObject();
        String sql = "SELECT * FROM base_course WHERE id = '"+id+"' AND del = 1 ";
        List<Map<String , Object>> mapList = jdbcTemplate.queryForList(sql);
        if (mapList.size() > 0){
            object.put("doctor",mapList.get(0).get("doctor"));
            object.put("doctorName",mapList.get(0).get("doctor_name"));
            List<BaseDoctorHospitalDO> baseDoctorHospitalDO = doctorHospitalDao.findByDoctorCode(mapList.get(0).get("doctor").toString());
            object.put("org",baseDoctorHospitalDO.get(0).getOrgCode());
            object.put("orgName",baseDoctorHospitalDO.get(0).getOrgName());
            object.put("jobTitleCode",baseDoctorHospitalDO.get(0).getDoctorDutyCode());
            object.put("jobTitleName",baseDoctorHospitalDO.get(0).getDoctorDutyName());
            object.put("introduction",mapList.get(0).get("introduction")); // 课程简介
        }
        return object;
    }
    public JSONObject getCatalogue(String id,String patient){
        JSONObject object = new JSONObject();
        String sql = "SELECT cc.* FROM base_course_catalogue cc,base_course c WHERE cc.course_id = '"+id+"' AND cc.course_id = c.id AND c.del = 1";
        List<Map<String , Object>> mapList = jdbcTemplate.queryForList(sql);
        JSONArray array = new JSONArray();
        if (mapList.size() > 0){
            for (int i = 0; i < mapList.size() ; i++){
                //  根据居民code,查询居民是否阅读过本课程
                String readSql = "SELECT read_time FROM base_course_catalogue_read_time WHERE course_id = '"+mapList.get(i).get("course_id")+"' AND course_catalogue_id = '"+id+"' AND patient = '"+patient+"'";
                List<Map<String , Object>> readMapList = jdbcTemplate.queryForList(readSql);
                if (readMapList.size() > 0){
                    mapList.add(readMapList.get(0));
                }
                array.add(mapList.get(i));
            }
        }
        object.put("object",array);
        return object;
    }
    public JSONObject getOrgInfoById(String id){
        JSONObject object = new JSONObject();
        String sql = "SELECT o.id,o.`code`,o.`name`,o.mobile,o.photo,o.address,o.intro,rs.start_time startTime,rs.end_time endTime,rs.num,rs.fee,rs.id rsId \n" +
                "FROM base_org o,base_recruit_students rs\n" +
                "WHERE o.id = '"+id+"' AND o.type = 4 AND o.del = 1 AND o.`code` = rs.org_code AND rs.del = 1";
        List<Map<String,Object>> mapList = jdbcTemplate.queryForList(sql);
        if (mapList.size() > 0){
            object.put("id",mapList.get(0).get("id"));//机构id
            object.put("name",mapList.get(0).get("name"));//机构名称
            object.put("mobile",mapList.get(0).get("mobile"));//机构联系方式
            object.put("photo",mapList.get(0).get("photo"));//机构图片
            object.put("address",mapList.get(0).get("address"));//机构地址
            object.put("intro",mapList.get(0).get("intro"));//机构简介
            object.put("startTime",mapList.get(0).get("startTime"));//招生开始时间
            object.put("endTime",mapList.get(0).get("endTime"));//招生结束时间
            object.put("num",mapList.get(0).get("num"));//招生名额
            object.put("fee",mapList.get(0).get("fee"));//报名费用
            String sql1 = "SELECT COUNT(*) count\n" +
                    "FROM base_org o,base_recruit_students_record rsr,base_recruit_students rs\n" +
                    "WHERE o.`code` = rsr.org_code AND rsr.recruit_students_id = '"+mapList.get(0).get("rsId")+"' AND o.`code` = '"+mapList.get(0).get("code")+"' AND (`status` = 3 OR `status` = 6);\n";
            Integer count = jdbcTemplate.queryForObject(sql1,Integer.class);
            String sql2 = "SELECT * FROM base_course WHERE del = 1 AND org_code = '"+mapList.get(0).get("code")+"'" ;
            List<Map<String , Object >> amapList = jdbcTemplate.queryForList(sql2);
            if (amapList.size() > 0){
                object.put("allCourse",amapList);//课程
            }else {
                object.put("allCourse","");//课程
            }
            String sql3 = "SELECT *  FROM base_doctor d,base_doctor_hospital dh\n" +
                    "WHERE d.doctor_level = 3 AND d.locked = 0 AND d.enabled = 1 AND d.del = 1 AND d.id = dh.doctor_code AND dh.del = 1 AND dh.org_code = '"+mapList.get(0).get("code")+"'" ;
            List<Map<String , Object >> bmapList = jdbcTemplate.queryForList(sql3);
            if (bmapList.size() > 0){
                object.put("allDoctor",bmapList);//教师
            }else {
                object.put("allDoctor","");//教师
            }
            object.put("count",count);//已报名人数
        }
        return object;
    }
    public JSONObject getTecInfoById(String doctor,String orgCode,int page,int size){
        JSONObject object = new JSONObject();
        //老师的基本信息
        String sql = "SELECT d.id,d.name,d.job_title_code jobTitleCode,d.job_title_name jobTitleName,dh.org_code orgCode,dh.org_name orgName\n" +
                "FROM base_doctor d,base_doctor_hospital dh\n" +
                "WHERE d.id = '"+doctor+"' AND dh.org_code = '"+orgCode+"' AND d.enabled = 1 AND d.locked = 0 AND d.del = 1 AND dh.del = 1 AND dh.doctor_code = d.id";
        List<Map<String , Object>> mapList = jdbcTemplate.queryForList(sql);
        object.put("doctorInfo",mapList.get(0));
        if (mapList.size() > 0){
            page = page - 1;
            size = (page+1)*size;
            String sql1 = "SELECT * FROM base_course WHERE doctor = '"+doctor+"' AND del = 1 limit "+page+","+size+"";
            List<Map<String , Object>> mapList1 = jdbcTemplate.queryForList(sql1);
            if (mapList1.size() > 0){
                object.put("allCourse",mapList1);
            }else {
                object.put("allCourse","");
            }
        }
        return  object;
    }
    public JSONObject getCoursrOrderStatusByPatient(String patient,int status,int page,int size){
        page = page - 1;
        size = (page+1)*10;
        JSONObject object = new JSONObject();
        String sql = "SELECT id,course_name courseName,buy_time buyTime,pay_type payType,status FROM base_course_sales_order_record WHERE patient = '"+patient+"'";
        if (status > 0){
            sql += " and status = "+status+" ";
        }
        sql += " order by create_time desc limit "+page+","+size+" ";
        List<Map<String,Object>> mapList = jdbcTemplate.queryForList(sql);
        String sql1 = "SELECT id,org_code orgCode,org_name orgName,pay_type payType,create_time createTime,status FROM base_recruit_students_record WHERE patient = '"+patient+"'";
        if (status > 0){
            sql1 += " and status = "+status+" ";
        }
        sql1 += " order by create_time desc limit "+page+","+size+"  ";
        List<Map<String,Object>> mapList1 = jdbcTemplate.queryForList(sql1);
        object.put("course",mapList);
        object.put("org",mapList1);
        return object;
    }
    public JSONObject getOrderInfo(String orderId){
        JSONObject object = new JSONObject();
        String sql = "SELECT id,course_name courseName,order_no orderNo,buy_time buyTime,pay_type payType,status orderStatus FROM base_course_sales_order_record WHERE id = '"+orderId+"'";
        List<Map<String , Object>> mapList = jdbcTemplate.queryForList(sql);
        if (mapList.size() < 0){
            sql = "SELECT id,org_code orgCode,org_name orgName,order_no orderNo,pay_type payType,create_time createTime,status FROM base_recruit_students_record WHERE patient = '"+orderId+"'";
            mapList = jdbcTemplate.queryForList(sql);
        }
        if (mapList.size() > 0 && mapList.get(0).get("orderStatus").equals(6)){
            String sql1 = "select status,create_time createTime,refund_price refundPrice,refund_desc refundDesc,enclosure from base_patient_order_refund where order_id = '"+mapList.get(0).get("id")+"' " ;
            List<Map<String , Object>> mapList1 = jdbcTemplate.queryForList(sql1);
            mapList.get(0).put("refundStatus",mapList1.get(0).get("status"));       //退款状态
            mapList.get(0).put("createTime",mapList1.get(0).get("createTime"));     //退款申请时间
            mapList.get(0).put("refundPrice",mapList1.get(0).get("refundPrice"));      //退款金额
            mapList.get(0).put("refundDesc",mapList1.get(0).get("refundDesc"));     //退款原因
            mapList.get(0).put("enclosure",mapList1.get(0).get("enclosure"));   //附件
        }
        object.put("object",mapList);
        return object;
    }
    /**
     * 招生报名
     */
    public JSONObject enrollment(String patient,String recruitStudentsId){
        JSONObject result = new JSONObject();
        RecruitStudentsDO recruitStudentsDO = recruitStudentsDao.findOne(recruitStudentsId);
        long now = System.currentTimeMillis();
        long start = recruitStudentsDO.getStartTime().getTime();
        if(now<start){
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg, "招生未开始");
            return result;
        }
        long end = recruitStudentsDO.getEndTime().getTime();
        if(now>end){
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg, "招生已结束");
            return result;
        }
        if(isEnrollment(patient,recruitStudentsId)){
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg, "请不要重复报名");
            return result;
        }
        BasePatientDO patientDO = patientDao.findById(patient);
        RecruitStudentsRecordDO recordDO = new RecruitStudentsRecordDO();
        recordDO.setDel(1);
        recordDO.setStatus("1");
        recordDO.setCreateTime(new Date());
        recordDO.setMobile(patientDO.getMobile());
        recordDO.setOrderNo(getOrderNo("1"));
        recordDO.setOrgCode(recruitStudentsDO.getOrgCode());
        recordDO.setOrgName(recruitStudentsDO.getOrgName());
        recordDO.setPatient(patientDO.getId());
        recordDO.setPatientName(patientDO.getName());
        recordDO.setPrice(recruitStudentsDO.getFee());
        recordDO.setSex(IdCardUtil.getSex(patientDO.getSex(),patientDO.getIdcard()));
        recordDO.setRecruitName(recruitStudentsDO.getTheme());
        recordDO.setRecruitStudentsId(recruitStudentsId);
        recruitStudentsRecordDao.save(recordDO);
        result.put(ResponseContant.resultFlag, ResponseContant.success);
        result.put("recordDO",recordDO);
        return result;
    }
    /**
     * 绑定居民是否已经报名 有待审核,待付款,已付款,退款中的订单都不能报名
     * @param patient
     * @param recruitStudentsId
     * @return
     */
    public boolean isEnrollment(String patient,String recruitStudentsId){
        String sql = "select * from base_recruit_students_record where recruit_students_id = '"+recruitStudentsId+
                "' and patient='"+patient+"' and status in ('1','2','3','6') and del =1 ";
        List<RecruitStudentsRecordDO> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(RecruitStudentsRecordDO.class));
        if(list.size()>0){
            return true;
        }
        return false;
    }
    public CourseSalesOrderRecordDO buyCourseOrder(String patient, String patientName, String courseId,String payType){
        CourseDO courseDO = courseDao.findOne(courseId);
        CourseSalesOrderRecordDO recordDO = new CourseSalesOrderRecordDO();
        recordDO.setBuyTime(new Date());
        recordDO.setPatient(patient);
        recordDO.setPatientName(patientName);
        recordDO.setCourseId(courseId);
        recordDO.setCourseName(courseDO.getName());
        recordDO.setOrgCode(courseDO.getOrgCode());
        recordDO.setOrgName(courseDO.getOrgName());
        recordDO.setPrice(courseDO.getFee());
        recordDO.setPayType(payType);
        recordDO.setOrderNo(getOrderNo("2"));
        courseSalesOrderRecordDao.save(recordDO);
        return recordDO;
    }
}

+ 374 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/course/NurseryLogService.java

@ -0,0 +1,374 @@
package com.yihu.jw.care.service.course;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.dao.course.NurseryLogDao;
import com.yihu.jw.care.dao.course.PatientCourseRecordDao;
import com.yihu.jw.care.dao.course.PatientDietRecordDao;
import com.yihu.jw.entity.care.common.DictDietDO;
import com.yihu.jw.entity.care.course.NurseryLogDO;
import com.yihu.jw.entity.care.course.PatientCourseRecordDO;
import com.yihu.jw.entity.care.course.PatientDietRecordDO;
import com.yihu.jw.entity.care.course.RecruitStudentsRecordDO;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.StringUtil;
import org.apache.commons.collections.map.HashedMap;
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.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/5/20
 * @Description:
 */
@Service
public class NurseryLogService {
    @Autowired
    private NurseryLogDao nurseryLogDao;
    @Autowired
    private PatientDietRecordDao patientDietRecordDao;
    @Autowired
    private PatientCourseRecordDao patientCourseRecordDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
     * 查找饮食字典
     * @return
     */
    public List<DictDietDO> findDictDiet(){
        String sql = "select * from dict_diet ";
        List<DictDietDO> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(DictDietDO.class));
        return list;
    }
    /**
     * 根据托育日志id查找
     * @param id
     * @return
     */
    public ObjEnvelop findRecordByNurseryLogId(String id,String type){
        if("diet".equals(type)){
            List<PatientDietRecordDO> dietRecordDOs = patientDietRecordDao.findByNurseryLogId(id);
            if(dietRecordDOs.size()>0){
                return ObjEnvelop.getSuccess("查找成功",dietRecordDOs.get(0));
            }
        }else if("course".equals(type)){
            List<PatientCourseRecordDO> courseRecordDOs = patientCourseRecordDao.findByNurseryLogId(id);
            if(courseRecordDOs.size()>0){
                return ObjEnvelop.getSuccess("查找成功",courseRecordDOs.get(0));
            }
        }
        return ObjEnvelop.getError("未找到记录");
    }
    /**
     * 查找饮食记录
     * @param id
     * @return
     */
    public ObjEnvelop findDietRecord(String id){
        PatientDietRecordDO dietRecordDO = patientDietRecordDao.findOne(id);
        return ObjEnvelop.getSuccess("查找成功",dietRecordDO);
    }
    /**
     * 查找课程记录记录
     * @param id
     * @return
     */
    public ObjEnvelop findCourseRecord(String id){
        PatientCourseRecordDO courseRecordDO = patientCourseRecordDao.findOne(id);
        return ObjEnvelop.getSuccess("查找成功",courseRecordDO);
    }
    /**
     * 获取课程记录详情
     * @param id
     * @return
     */
    public JSONObject nurseryDetail(String id){
        JSONObject json = new JSONObject();
        NurseryLogDO nurseryLogDO = nurseryLogDao.findOne(id);
        json.put("nurseryLog",nurseryLogDO);
        List<PatientDietRecordDO> dietRecordDOs = patientDietRecordDao.findByNurseryLogId(id);
        List<PatientCourseRecordDO> courseRecordDOs = patientCourseRecordDao.findByNurseryLogId(id);
        json.put("diet",dietRecordDOs.size());
        json.put("course",courseRecordDOs.size());
        return json;
    }
    /**
     * 新增托育日志
     * @param patient
     * @param patientName
     * @param doctor
     * @param doctorName
     * @param orgCode
     * @param orgName
     * @param recordDate
     * @return
     */
    public NurseryLogDO addNurseryLog(String patient,String patientName, String doctor,String doctorName,String orgCode,String orgName,String recordDate) {
        NurseryLogDO nurseryLogDO = new NurseryLogDO();
        nurseryLogDO.setPatient(patient);
        nurseryLogDO.setPatientName(patientName);
        nurseryLogDO.setDoctorName(doctorName);
        nurseryLogDO.setDoctor(doctor);
        nurseryLogDO.setOrgName(orgName);
        nurseryLogDO.setOrgCode(orgCode);
        nurseryLogDO.setRecordDate(recordDate);
        nurseryLogDO.setStatus("0");
        nurseryLogDO.setCreateTime(new Date());
        nurseryLogDao.save(nurseryLogDO);
        return nurseryLogDO;
    }
    /**
     * 新增课程记录
     * @return
     */
    public PatientCourseRecordDO addCourseRecord(String id,String content, String enclosure) {
        PatientCourseRecordDO recordDO = new PatientCourseRecordDO();
        recordDO.setCreateTime(new Date());
        recordDO.setContent(content);
        recordDO.setEnclosure(enclosure);
        recordDO.setNurseryLogId(id);
        NurseryLogDO nurseryLogDO = nurseryLogDao.findOne(id);
        recordDO.setRecordDate(nurseryLogDO.getRecordDate());
        patientCourseRecordDao.save(recordDO);
        return recordDO;
    }
    /**
     * 新增饮食记录
     * @return
     */
    public PatientDietRecordDO addDietRecord(String id,String eatFood,String eatType, String enclosure,String intake,String additionalNotes) {
        PatientDietRecordDO recordDO = new PatientDietRecordDO();
        recordDO.setCreateTime(new Date());
        recordDO.setEnclosure(enclosure);
        recordDO.setNurseryLogId(id);
        recordDO.setEatFood(eatFood);
        recordDO.setEatType(eatType);
        recordDO.setIntake(intake);
        recordDO.setAdditionalNotes(additionalNotes);
        NurseryLogDO nurseryLogDO = nurseryLogDao.findOne(id);
        recordDO.setRecordDate(nurseryLogDO.getRecordDate());
        patientDietRecordDao.save(recordDO);
        return recordDO;
    }
    /**
     *获取托育日志列表
     * @param orgCode
     * @return
     * @throws Exception
     */
    public List<NurseryLogDO> findNurseryLogList(String orgCode, String recordDate){
        String sql = "select * from base_nursery_log wf ";
        sql+= " where wf.org_code = '"+orgCode+"'";
        if(!StringUtil.isEmpty(recordDate)){
            sql+=" and wf.record_date ='"+recordDate+"'";
        }
        sql+=" order by wf.create_time desc";
        List<NurseryLogDO> nurseryLogDOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(NurseryLogDO.class));
        return nurseryLogDOs;
    }
    /**
     * 获取未填写日志列表
     * @param orgCode
     */
    public JSONArray nuseryLogUnFilledIn(String orgCode,String recordDate){
        JSONArray jsonArray = new JSONArray();
        String sql ="SELECT * from base_recruit_students_record " +
                "where org_code = '"+orgCode+"' and `status` in ('3','6') and del =1";
        List<RecruitStudentsRecordDO> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(RecruitStudentsRecordDO.class));
        List<NurseryLogDO> nurseryLogDOs = findNurseryLogList(orgCode, recordDate);
        List<String> nurseryList = nurseryLogDOs.stream().map(NurseryLogDO::getPatient).collect(Collectors.toList());
        for(RecruitStudentsRecordDO recordDO:list){
            if(nurseryList.contains(recordDO.getPatient())){
                continue;
            }
            JSONObject json = new JSONObject();
            json.put("patient",recordDO.getPatient());
            json.put("patientName",recordDO.getPatientName());
            jsonArray.add(json);
        }
        return jsonArray;
    }
    /**
     *获取托育日志按月日历形式
     * @param orgCode
     * @param startTime
     * @param endTime
     * @return
     * @throws Exception
     */
    public Map<String,Object> findNurseryLogByMonth(String orgCode, String patient,  String patientName, String startTime, String endTime)throws Exception{
        String sql = "select * from base_nursery_log wf ";
        sql+= " where wf.org_code = '"+orgCode+"'";
        if(!StringUtil.isEmpty(patient)){
            sql+=" and wf.patient_code = '"+patient+"'";
        }
        if(!StringUtil.isEmpty(patientName)){
            sql+=" and wf.patient_name like '%"+patientName+"%'";
        }
        if(!StringUtil.isEmpty(startTime)){
            sql+=" and wf.record_date >='"+startTime+"'";
        }
        if(!org.apache.commons.lang.StringUtils.isEmpty(endTime)){
            Date currentTime = DateUtil.strToDate(endTime + " 23:59:59");
            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            String dateString = formatter.format(currentTime);
            sql+=" and wf.record_date <='"+dateString+"'";
        }
        sql+=" order by wf.create_time desc";
        List<NurseryLogDO> nurseryLogDOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(NurseryLogDO.class));
        //按时间分组
        Map<String,Object> date = sortNurseryLogByDate(nurseryLogDOs);
        //统计每一天完成数与计划数目
        if(date!=null&&date.size()>0){
            for(String key : date.keySet()){
                //获取一天的数据
                Map<String,Object> d = (Map<String,Object>)date.get(key);
                // 获取一天随访数据
                List<NurseryLogDO> dateFollowups = (List<NurseryLogDO>)d.get("nurserys");
                //统计一天各项纬度指标
                List<Map<String,Object>> statistics = new ArrayList<>();
                //统计单条
                Map<String,Object> fs = sortNurseryLogList(dateFollowups);
                Integer count = (Integer)fs.get("count");
                if(count!=0){
                    statistics.add(fs);
                }
                d.put("statistics",statistics);
            }
        }
        return date;
    }
    public Map<String,Object> sortNurseryLogByDate(List<NurseryLogDO> nurseryLogDOs){
        //按时间分组
        Map<String,Object> date = new HashedMap();
        if(nurseryLogDOs!=null&&nurseryLogDOs.size()>0){
            Iterator it = nurseryLogDOs.iterator();
            while (it.hasNext()){
                NurseryLogDO nurseryLogDO = (NurseryLogDO)it.next();
                //1.获取日期分组
                Map<String,Object> dateNurserys = (Map<String,Object>)date.get(nurseryLogDO.getRecordDate());
                //判断随访时间是否已经创建分组
                if(dateNurserys!=null&&dateNurserys.size()>0){
                    //同一天时间已经有分组则加入list
                    List<NurseryLogDO> list = (List<NurseryLogDO>)dateNurserys.get("nurserys");
                    list.add(nurseryLogDO);
                }else{
                    //同一天的时间没有该分组则创建这天的随访计划List
                    Map<String,Object> newdateNursery = new HashedMap();
                    List<NurseryLogDO> dateNurseryLogs = new ArrayList<>();
                    dateNurseryLogs.add(nurseryLogDO);
                    newdateNursery.put("nurserys",dateNurseryLogs);
                    date.put(nurseryLogDO.getRecordDate(),newdateNursery);
                }
            }
        }
        return date;
    }
    public Map<String,Object> sortNurseryLogList(List<NurseryLogDO> nurseryLogDOs){
        //统计完成数
        Integer compeleCount = 0;
        //总数
        Integer count = 0;
        //迭代数组
        List<NurseryLogDO> rs = new ArrayList<>();
        if(nurseryLogDOs!=null&&nurseryLogDOs.size()>0){
            Iterator it = nurseryLogDOs.iterator();
            while (it.hasNext()){
                NurseryLogDO nurseryLogDO = (NurseryLogDO)it.next();
                rs.add(nurseryLogDO);
                if("1".equals(nurseryLogDO.getStatus())){
                    compeleCount++;
                }
            }
            //设置总数
            count = rs.size();
        }
        Map<String,Object> mapFollow =new HashedMap();
        mapFollow.put("compeleCount",compeleCount);
        mapFollow.put("count",count);
        return mapFollow;
    }
    /**
     *获取托育日志按月日历形式 - 居民端
     * @param patient
     * @param startTime
     * @param endTime
     * @return
     * @throws Exception
     */
    public Map<String,Object> findNurseryLogByPatient(String patient, String startTime, String endTime)throws Exception{
        String filter = " where patient = '"+patient+"'";
        if(!StringUtil.isEmpty(startTime)){
            filter+=" and record_date >='"+startTime+"'";
        }
        if(!StringUtil.isEmpty(endTime)){
            filter+=" and record_date <='"+endTime+"'";
        }
        String sql = "select * from (SELECT nursery_log_id nurseryLogId,record_date recordDate,patient,'diet' type  from base_patient_diet_record " +filter+
                " union all " +
                " SELECT nursery_log_id nurseryLogId,record_date recordDate,patient,'course' type from base_patient_course_record "+filter +" ) a";
        sql+=" order by recordDate desc";
        List<Map<String,Object>> nurseryLogDOs = jdbcTemplate.queryForList(sql);
        //按时间分组
        Map<String,Object> date = sortNurseryByDate(nurseryLogDOs);
        return date;
    }
    public Map<String,Object> sortNurseryByDate(List<Map<String,Object>> nurseryLogDOs){
        //按时间分组
        Map<String,Object> date = new HashedMap();
        if(nurseryLogDOs!=null&&nurseryLogDOs.size()>0){
            Iterator it = nurseryLogDOs.iterator();
            while (it.hasNext()){
                Map<String,Object> nurseryLogDO = (Map<String,Object>)it.next();
                //1.获取日期分组
                Map<String,Object> dateNurserys = (Map<String,Object>)date.get(String.valueOf(nurseryLogDO.get("recordDate")));
                //判断随访时间是否已经创建分组
                if(dateNurserys!=null&&dateNurserys.size()>0){
                    //同一天时间已经有分组则加入list
                    List<Map<String,Object>> list = (List<Map<String,Object>>)dateNurserys.get("nurserys");
                    list.add(nurseryLogDO);
                }else{
                    //同一天的时间没有该分组则创建这天的随访计划List
                    Map<String,Object> newdateNursery = new HashedMap();
                    List<Map<String,Object>> dateNurseryLogs = new ArrayList<>();
                    dateNurseryLogs.add(nurseryLogDO);
                    newdateNursery.put("nurserys",dateNurseryLogs);
                    date.put(String.valueOf(nurseryLogDO.get("recordDate")),newdateNursery);
                }
            }
        }
        return date;
    }
}

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

@ -344,13 +344,18 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.findDoctorInfo)
    @ApiOperation(value = "获取医生信息", notes = "获取医生信息")
    public ObjEnvelop findDoctorInfo(@ApiParam(name = "doctor", value = "医生code")
    public Envelop findDoctorInfo(@ApiParam(name = "doctor", value = "医生code")
                                     @RequestParam(value = "doctor", required = true)String doctor,
                                     @ApiParam(name = "withWork", value = "传1带排班,其他不带")
                                     @RequestParam(value = "withWork", required = false)String withWork,
                                     @ApiParam(name = "patient", value = "患者code")
                                         @RequestParam(value = "patient", required = false)String patient){
        return success(prescriptionService.findDoctorInfo(doctor,withWork,patient));
                                         @RequestParam(value = "patient", required = false)String patient)throws Exception{
        try {
            return success(prescriptionService.findDoctorInfo(doctor,withWork,patient));
        }catch (Exception e){
            return  failedException(e);
        }
    }

+ 1 - 1
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/SpecialistService.java

@ -259,7 +259,7 @@ public class SpecialistService{
                    "d.label AS healthcode," +
                    "a.health_assistant AS healthAssistant,a.health_assistant_name AS healthAssistantName," +
//                    "a.health_assistant_name AS healthAssistantName, " +
                    ",a.is_manage AS isManage, " +
                    " a.is_manage AS isManage, " +
                    "a.id AS specialCode " +
                    "FROM wlyy_specialist.wlyy_specialist_patient_relation a " +
                    "JOIN "+basedb+".wlyy_patient_disease_server b ON a.id=b.specialist_relation_code AND b.disease=" +labelCode+" and b.del=1 "+

+ 243 - 0
wlyy-starter/pom.xml

@ -0,0 +1,243 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <!-- Parent -->
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.9.RELEASE</version>
    </parent>
    <!-- Self -->
    <groupId>com.yihu.jw</groupId>
    <artifactId>wlyy-starter</artifactId>
    <packaging>pom</packaging>
    <version>2.0.0</version>
    <!-- 模块列表 -->
    <modules>
        <!--<module>../starter/hbase-starter</module>-->
       <module>../starter/swagger-starter</module>
    </modules>
    <!-- 项目发布到这个服务器 -->
    <distributionManagement>
        <repository>
            <id>jkzlRepositories</id>
            <name>jkzlRepositories</name>
            <url>http://192.168.1.220:8081/nexus/content/repositories/jkzlRepositories/</url>
        </repository>
    </distributionManagement>
    <properties>
        <version.spring-cloud>Edgware.SR4</version.spring-cloud>
        <version.jackson>2.6.6</version.jackson>
        <version.fastdfs>1.27</version.fastdfs>
        <version.swagger>2.7.0</version.swagger>
        <version.swagger-ui>2.7.0</version.swagger-ui>
        <version.swagger2markup>1.3.2</version.swagger2markup>
        <version.springfox-staticdocs>2.6.1</version.springfox-staticdocs>
        <version.mysql>5.1.45</version.mysql>
        <version.commons-dbcp2>2.1.1</version.commons-dbcp2>
        <version.commons-lang3>3.4</version.commons-lang3>
        <version.commons.collections>3.2.1</version.commons.collections>
        <version.hibernate>5.0.12.Final</version.hibernate>
        <version.hibernate-validator>6.0.10.Final</version.hibernate-validator>
        <version.hibernate-jpa-api>1.0.0.Final</version.hibernate-jpa-api>
        <version.elasticsearch>2.4.0</version.elasticsearch>
        <version.elasticsearch-sql>2.4.1.0</version.elasticsearch-sql>
        <version.jest>2.4.0</version.jest>
        <verion.fastjson>1.2.17</verion.fastjson>
        <version.druid>1.0.15</version.druid>
        <version.jna>3.0.9</version.jna>
        <version.hbase-client>2.2.4</version.hbase-client>
        <version.spring-data-hadoop>2.2.0.RELEASE</version.spring-data-hadoop>
        <version.spring-data-solr>2.1.3.RELEASE</version.spring-data-solr>
        <version.bcprov-jdk15on>1.59</version.bcprov-jdk15on>
        <version.json>20160212</version.json>
        <version.json-lib>2.4</version.json-lib>
        <version.pinyin4j>2.5.0</version.pinyin4j>
        <version.cat>2.0.0</version.cat>
        <version.feign-okhttp>9.3.1</version.feign-okhttp>
    </properties>
    <dependencyManagement>
        <dependencies>
            <!-- Spring Cloud -->
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${version.spring-cloud}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <!-- Swagger-ui library -->
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger2</artifactId>
                <version>${version.swagger}</version>
            </dependency>
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger-ui</artifactId>
                <version>${version.swagger-ui}</version>
            </dependency>
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-staticdocs</artifactId>
                <version>${version.springfox-staticdocs}</version>
            </dependency>
            <dependency>
                <groupId>io.github.swagger2markup</groupId>
                <artifactId>swagger2markup</artifactId>
                <version>${version.swagger2markup}</version>
            </dependency>
            <!-- Alibaba library -->
            <dependency>
                <groupId>com.alibaba</groupId>
                <artifactId>fastjson</artifactId>
                <version>${verion.fastjson}</version>
            </dependency>
            <!-- jna library -->
            <dependency>
                <groupId>com.sun.jna</groupId>
                <artifactId>jna</artifactId>
                <version>${version.jna}</version>
            </dependency>
            <!-- Apache library -->
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-dbcp2</artifactId>
                <version>${version.commons-dbcp2}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-lang3</artifactId>
                <version>${version.commons-lang3}</version>
            </dependency>
            <dependency>
                <groupId>commons-collections</groupId>
                <artifactId>commons-collections</artifactId>
                <version>${version.commons.collections}</version>
            </dependency>
            <!-- Jackson library -->
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-annotations</artifactId>
                <version>${version.jackson}</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-core</artifactId>
                <version>${version.jackson}</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
                <version>${version.jackson}</version>
            </dependency>
            <!-- Json library -->
            <dependency>
                <groupId>org.json</groupId>
                <artifactId>json</artifactId>
                <version>${version.json}</version>
            </dependency>
            <!-- Net json library -->
            <dependency>
                <groupId>net.sf.json-lib</groupId>
                <artifactId>json-lib</artifactId>
                <version>${version.json-lib}</version>
            </dependency>
            <!-- Hbase library -->
            <dependency>
                <groupId>org.apache.hbase</groupId>
                <artifactId>hbase-client</artifactId>
                <version>${version.hbase-client}</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.apache.hadoop</groupId>
                        <artifactId>*</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-log4j12</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.apache.hbase</groupId>
                <artifactId>hbase-common</artifactId>
                <version>${version.hbase-client}</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-log4j12</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.apache.hbase</groupId>
                <artifactId>hbase-protocol</artifactId>
                <version>${version.hbase-client}</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-log4j12</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.springframework.data</groupId>
                <artifactId>spring-data-hadoop-hbase</artifactId>
                <version>${version.spring-data-hadoop}</version>
            </dependency>
            <!-- security library -->
            <dependency>
                <groupId>org.bouncycastle</groupId>
                <artifactId>bcprov-jdk15on</artifactId>
                <version>${version.bcprov-jdk15on}</version>
            </dependency>
            <!-- 拼音 -->
            <dependency>
                <groupId>com.belerweb</groupId>
                <artifactId>pinyin4j</artifactId>
                <version>${version.pinyin4j}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <configuration>
                    <attach>true</attach>
                </configuration>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

+ 2 - 0
wlyy-starter/readme.MD

@ -0,0 +1,2 @@
i健康2.0工程基础maven
    1.一般子maven需要的jar包在父类maven工程定义好,子maven工程不需要添加版本号,版本由父maven决定