Procházet zdrojové kódy

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

wangjun před 4 roky
rodič
revize
49271c051b
43 změnil soubory, kde provedl 1628 přidání a 150 odebrání
  1. 17 0
      common/common-entity/sql记录
  2. 15 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/course/CourseDO.java
  3. 26 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/course/CourseSalesOrderRecordDO.java
  4. 3 3
      common/common-entity/src/main/java/com/yihu/jw/entity/care/course/PatientOrderRefundDO.java
  5. 40 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/course/RecruitStudentsRecordDO.java
  6. 1 1
      common/common-entity/src/main/java/com/yihu/jw/entity/care/device/DevicePatientHealthIndex.java
  7. 99 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/exam/ChildrenExaminationRecordDO.java
  8. 100 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/message/OrgNoticeDO.java
  9. 3 0
      gateway/ag-basic/src/main/java/com/yihu/AgBasicServer.java
  10. 28 0
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/DidiFilterProcessor.java
  11. 34 0
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/ErrorExtFilter.java
  12. 24 24
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/PostFilter.java
  13. 2 2
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/course/CourseCatalogueEndpoint.java
  14. 2 2
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/course/CourseEndpoint.java
  15. 2 2
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/course/CourseSalesOrderRecordEndpoint.java
  16. 2 2
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/course/CustomerServiceEndpoint.java
  17. 2 2
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/course/PatientOrderRefundEndpoint.java
  18. 2 2
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/course/RecruitStudentsEndpoint.java
  19. 2 2
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/course/RecruitStudentsRecordEndpoint.java
  20. 3 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/course/CourseCatalogueDao.java
  21. 11 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/exam/ChildrenExaminationRecordDao.java
  22. 11 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/message/OrgNoticeDao.java
  23. 14 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/message/UserNoticeDao.java
  24. 80 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/course/DoctorCourseEndpoint.java
  25. 56 4
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/course/PatientCourseEndpoint.java
  26. 34 3
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doctor/DoctorEndpoint.java
  27. 1 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doorCoach/DoctorDoorCoachOrderController.java
  28. 21 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doorCoach/PatientDoorCoachOrderController.java
  29. 81 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/exam/ChildrenExaminationEndpoint.java
  30. 81 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/exam/DoctorChildrenExaminationEndpoint.java
  31. 56 6
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/message/DoctorMessageEndpoint.java
  32. 60 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/message/PatientMessageEndpoint.java
  33. 36 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/patient/PatientEndpoint.java
  34. 4 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/consult/ConsultTeamService.java
  35. 242 55
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/course/CourseService.java
  36. 117 9
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doctor/CareDoctorService.java
  37. 9 7
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doorCoach/DoctorDoorCoachOrderService.java
  38. 45 15
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doorCoach/PatientDoorCoachOrderService.java
  39. 69 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/exam/ChildrenExaminationService.java
  40. 71 4
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/message/DoctorMessageService.java
  41. 67 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/message/PatientMessageService.java
  42. 51 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/patient/CarePatientService.java
  43. 4 0
      svr/svr-cloud-care/src/main/resources/application.yml

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

@ -867,3 +867,20 @@ CREATE TABLE `base_course_sales_order_record` (
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='课程销售订单记录表';
-- 2021-05-18
create table base_org_notice(
	id varchar(50) not null,
	org_code varchar(50) default null COMMENT '机构code',
	org_name varchar(50) default null COMMENT '机构名称',
	status tinyint(1) DEFAULT NULL COMMENT '状态(1待发布,2已发布)',
	del tinyint(1) DEFAULT '1' COMMENT '删除标志(1正常,0删除)',
	title VARCHAR(50) default null comment '通知标题',
	content text default null comment '通知内容',
	img VARCHAR(1000) default null COMMENT '附件',
	notice_time datetime default null COMMENT '通知时间',
	create_time datetime default null,
	PRIMARY KEY(id)
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='机构通知表';
ALTER table base_org_notice add column create_user varchar(50) DEFAULT NULL

+ 15 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/course/CourseDO.java

@ -8,6 +8,7 @@ import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
import java.util.List;
/**
 * Created with IntelliJ IDEA.
@ -83,6 +84,11 @@ public class CourseDO extends UuidIdentityEntityWithOperator {
     */
    private Integer del;
    /**
     * 小节
     */
    List<CourseCatalogueDO> catalogueDOList;
    @Column(name = "type")
    public String getType() {
        return type;
@ -236,4 +242,13 @@ public class CourseDO extends UuidIdentityEntityWithOperator {
    public void setLiveDuration(String liveDuration) {
        this.liveDuration = liveDuration;
    }
    @Transient
    public List<CourseCatalogueDO> getCatalogueDOList() {
        return catalogueDOList;
    }
    public void setCatalogueDOList(List<CourseCatalogueDO> catalogueDOList) {
        this.catalogueDOList = catalogueDOList;
    }
}

+ 26 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/course/CourseSalesOrderRecordDO.java

@ -36,10 +36,18 @@ public class CourseSalesOrderRecordDO extends UuidIdentityEntityWithTime{
     * '购买时间'
     */
    private Date buyTime;
    /**
     * 支付方式 1微信 2支付宝
     */
    private String payType;
    /**
     * '状态'
     */
    private String status;
    /**
     * 订单编号
     */
    private String orderNo;
    /**
     * 支付价格
     */
@ -126,4 +134,22 @@ public class CourseSalesOrderRecordDO extends UuidIdentityEntityWithTime{
    public void setPrice(BigDecimal price) {
        this.price = price;
    }
    @Column(name = "pay_type")
    public String getPayType() {
        return payType;
    }
    public void setPayType(String payType) {
        this.payType = payType;
    }
    @Column(name = "order_no")
    public String getOrderNo() {
        return orderNo;
    }
    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }
}

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

@ -42,7 +42,7 @@ public class PatientOrderRefundDO extends UuidIdentityEntity{
    private String refundDesc;
    /**
     * 状态
     * '1待退款2已退款'
     * '1待退款2退款完成3退款失败'
     */
    private String status;
    /**
@ -154,8 +154,8 @@ public class PatientOrderRefundDO extends UuidIdentityEntity{
        this.refundTime = refundTime;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "create_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
    }
@ -164,8 +164,8 @@ public class PatientOrderRefundDO extends UuidIdentityEntity{
        this.createTime = createTime;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "buy_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getBuyTime() {
        return buyTime;
    }

+ 40 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/course/RecruitStudentsRecordDO.java

@ -6,6 +6,7 @@ import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.math.BigDecimal;
/**
 * Created with IntelliJ IDEA.
@ -48,6 +49,18 @@ public class RecruitStudentsRecordDO  extends UuidIdentityEntityWithTime {
     */
    private String status;
    private String statusName;
    /**
     * 支付方式 1微信 2支付宝
     */
    private String payType;
    /**
     * 价格
     */
    private BigDecimal price;
    /**
     * 订单编号
     */
    private String orderNo;
    /**
     * 机构code
     */
@ -155,4 +168,31 @@ public class RecruitStudentsRecordDO  extends UuidIdentityEntityWithTime {
    public void setRecruitName(String recruitName) {
        this.recruitName = recruitName;
    }
    @Column(name = "pay_type")
    public String getPayType() {
        return payType;
    }
    public void setPayType(String payType) {
        this.payType = payType;
    }
    @Column(name = "price")
    public BigDecimal getPrice() {
        return price;
    }
    public void setPrice(BigDecimal price) {
        this.price = price;
    }
    @Column(name = "order_no")
    public String getOrderNo() {
        return orderNo;
    }
    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }
}

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

@ -35,7 +35,7 @@ public class DevicePatientHealthIndex extends IdEntity {
	private String value6;
	// 睡前
	private String value7;
	// 健康指标类型(1血糖,2血压,3体重/身高/BMI,4腰围,5心率)
	// 健康指标类型(1血糖,2血压,3体重/身高/BMI,4腰围,5心率,6体温)
	private Integer type;
	// 记录时间

+ 99 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/exam/ChildrenExaminationRecordDO.java

@ -0,0 +1,99 @@
package com.yihu.jw.entity.care.exam;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntityWithCreateTime;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by Bing on 2021/5/18.
 */
@Entity
@Table(name="base_children_examination_record")
public class ChildrenExaminationRecordDO extends UuidIdentityEntityWithCreateTime {
    private String patient;//居民id
    private String type; //1机构体检 2居家自检
    private Date examTime; //体检时间
    private String orgCode; //体检机构
    private String orgName; //机构名称
    private String monthAge;//月龄
    private String height;//身高
    private String weight;//体重
    private String headCircumference;//头围
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+08:00")
    public Date getExamTime() {
        return examTime;
    }
    public void setExamTime(Date examTime) {
        this.examTime = examTime;
    }
    public String getOrgCode() {
        return orgCode;
    }
    public void setOrgCode(String orgCode) {
        this.orgCode = orgCode;
    }
    public String getOrgName() {
        return orgName;
    }
    public void setOrgName(String orgName) {
        this.orgName = orgName;
    }
    public String getMonthAge() {
        return monthAge;
    }
    public void setMonthAge(String monthAge) {
        this.monthAge = monthAge;
    }
    public String getHeight() {
        return height;
    }
    public void setHeight(String height) {
        this.height = height;
    }
    public String getWeight() {
        return weight;
    }
    public void setWeight(String weight) {
        this.weight = weight;
    }
    public String getHeadCircumference() {
        return headCircumference;
    }
    public void setHeadCircumference(String headCircumference) {
        this.headCircumference = headCircumference;
    }
}

+ 100 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/message/OrgNoticeDO.java

@ -0,0 +1,100 @@
package com.yihu.jw.entity.care.message;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntityWithCreateTime;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by Bing on 2021/5/18.
 * 通知实体
 */
@Entity
@Table(name="base_org_notice")
public class OrgNoticeDO extends UuidIdentityEntityWithCreateTime {
    private String orgCode ;
    private String orgName ;
    private Integer status ;//
    private Integer del ;
    private String title ;//通知标题
    private String content;//通知内容
    private String img ; //附件
    private Date noticeTime ;//通知时间
    private String createUser;
    public String getOrgCode() {
        return orgCode;
    }
    public void setOrgCode(String orgCode) {
        this.orgCode = orgCode;
    }
    public String getOrgName() {
        return orgName;
    }
    public void setOrgName(String orgName) {
        this.orgName = orgName;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    public String getImg() {
        return img;
    }
    public void setImg(String img) {
        this.img = img;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getNoticeTime() {
        return noticeTime;
    }
    public void setNoticeTime(Date noticeTime) {
        this.noticeTime = noticeTime;
    }
    public String getCreateUser() {
        return createUser;
    }
    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }
}

+ 3 - 0
gateway/ag-basic/src/main/java/com/yihu/AgBasicServer.java

@ -1,5 +1,7 @@
package com.yihu;
import com.netflix.zuul.FilterProcessor;
import com.yihu.jw.gateway.filter.DidiFilterProcessor;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
@ -16,6 +18,7 @@ import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
public class AgBasicServer extends SpringBootServletInitializer {
    public static void main(String [] args) {
        FilterProcessor.setProcessor(new DidiFilterProcessor());
        SpringApplication.run(AgBasicServer.class, args);
    }

+ 28 - 0
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/DidiFilterProcessor.java

@ -0,0 +1,28 @@
package com.yihu.jw.gateway.filter;
import com.netflix.zuul.FilterProcessor;
import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.context.RequestContext;
import com.netflix.zuul.exception.ZuulException;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/5/19
 * @Description:
 */
public class DidiFilterProcessor extends FilterProcessor {
    @Override
    public Object processZuulFilter(ZuulFilter filter) throws ZuulException {
        try {
            return super.processZuulFilter(filter);
        } catch (ZuulException e) {
            ZuulException e1 = new ZuulException("123456",10085,"10000");
            RequestContext ctx = RequestContext.getCurrentContext();
            ctx.set("failed.exception", e1);
            ctx.set("failed.filter", filter);
            throw e1 ;
        }
    }
}

+ 34 - 0
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/ErrorExtFilter.java

@ -0,0 +1,34 @@
package com.yihu.jw.gateway.filter;
import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.context.RequestContext;
import org.springframework.cloud.netflix.zuul.filters.post.SendErrorFilter;
import org.springframework.stereotype.Component;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/5/19
 * @Description:
 */
@Component
public class ErrorExtFilter extends SendErrorFilter{
    @Override
    public String filterType() {
        return "error";
    }
    @Override
    public int filterOrder() {
        return 30;
    }
    @Override
    public boolean shouldFilter() {
        RequestContext ctx = RequestContext.getCurrentContext();
        ZuulFilter failedFilter = (ZuulFilter) ctx.get("failed.filter");
        if(failedFilter != null && failedFilter.filterType().equals("post")) {
            return true;
        }
        return false;
    }
}

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

@ -47,30 +47,30 @@ public class PostFilter extends ZuulFilter {
        }
        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);
        }
        logger.info(ctx.getResponseBody()+"");
            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);
            }
            logger.info(ctx.getResponseBody()+"");
        } catch (Exception e) {
            e.printStackTrace();
        }

+ 2 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/course/CourseCatalogueEndpoint.java

@ -38,7 +38,7 @@ public class CourseCatalogueEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "创建")
    public ObjEnvelop<CourseCatalogueDO> create (
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestBody String jsonData) throws Exception {
            @RequestParam String jsonData) throws Exception {
        CourseCatalogueDO catalogueDO = toEntity(jsonData, CourseCatalogueDO.class);
        catalogueDO = courseCatalogueService.save(catalogueDO);
        return success(catalogueDO);
@ -57,7 +57,7 @@ public class CourseCatalogueEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "更新")
    public ObjEnvelop<CourseCatalogueDO> update (
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestBody String jsonData) throws Exception {
            @RequestParam String jsonData) throws Exception {
        CourseCatalogueDO catalogueDO = toEntity(jsonData, CourseCatalogueDO.class);
        if (null == catalogueDO.getId()) {
            return failed("ID不能为空", ObjEnvelop.class);

+ 2 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/course/CourseEndpoint.java

@ -47,7 +47,7 @@ public class CourseEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "创建")
    public ObjEnvelop<CourseDO> create (
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestBody String jsonData) throws Exception {
            @RequestParam String jsonData) throws Exception {
        CourseDO courseDO = toEntity(jsonData, CourseDO.class);
        courseDO.setDel(1);
        courseDO.setLiveStatus("1");
@ -71,7 +71,7 @@ public class CourseEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "更新")
    public ObjEnvelop<CourseDO> update (
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestBody String jsonData) throws Exception {
            @RequestParam String jsonData) throws Exception {
        CourseDO courseDO = toEntity(jsonData, CourseDO.class);
        if (null == courseDO.getId()) {
            return failed("ID不能为空", ObjEnvelop.class);

+ 2 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/course/CourseSalesOrderRecordEndpoint.java

@ -38,7 +38,7 @@ public class CourseSalesOrderRecordEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "创建")
    public ObjEnvelop<CourseSalesOrderRecordDO> create (
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestBody String jsonData) throws Exception {
            @RequestParam String jsonData) throws Exception {
        CourseSalesOrderRecordDO courseSalesOrderRecordDO = toEntity(jsonData, CourseSalesOrderRecordDO.class);
        courseSalesOrderRecordDO = courseSalesOrderRecordService.save(courseSalesOrderRecordDO);
        return success(courseSalesOrderRecordDO);
@ -57,7 +57,7 @@ public class CourseSalesOrderRecordEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "更新")
    public ObjEnvelop<CourseSalesOrderRecordDO> update (
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestBody String jsonData) throws Exception {
            @RequestParam String jsonData) throws Exception {
        CourseSalesOrderRecordDO courseSalesOrderRecordDO = toEntity(jsonData, CourseSalesOrderRecordDO.class);
        if (null == courseSalesOrderRecordDO.getId()) {
            return failed("ID不能为空", ObjEnvelop.class);

+ 2 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/course/CustomerServiceEndpoint.java

@ -41,7 +41,7 @@ public class CustomerServiceEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "创建")
    public ObjEnvelop<CustomerServiceDO> create (
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestBody String jsonData) {
            @RequestParam String jsonData) {
        try {
            CustomerServiceDO customerServiceDO = toEntity(jsonData, CustomerServiceDO.class);
            List<CustomerServiceDO> customerServiceDOList = customerServiceDao.findByOrgCode(customerServiceDO.getOrgCode());
@ -70,7 +70,7 @@ public class CustomerServiceEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "更新")
    public ObjEnvelop<CustomerServiceDO> update (
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestBody String jsonData) throws Exception {
            @RequestParam String jsonData) throws Exception {
        CustomerServiceDO customerServiceDO = toEntity(jsonData, CustomerServiceDO.class);
        if (null == customerServiceDO.getId()) {
            return failed("ID不能为空", ObjEnvelop.class);

+ 2 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/course/PatientOrderRefundEndpoint.java

@ -38,7 +38,7 @@ public class PatientOrderRefundEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "创建")
    public ObjEnvelop<PatientOrderRefundDO> create (
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestBody String jsonData) throws Exception {
            @RequestParam String jsonData) throws Exception {
        PatientOrderRefundDO patientOrderRefundDO = toEntity(jsonData, PatientOrderRefundDO.class);
        patientOrderRefundDO = patientOrderRefundService.save(patientOrderRefundDO);
        return success(patientOrderRefundDO);
@ -57,7 +57,7 @@ public class PatientOrderRefundEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "更新")
    public ObjEnvelop<PatientOrderRefundDO> update (
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestBody String jsonData) throws Exception {
            @RequestParam String jsonData) throws Exception {
        PatientOrderRefundDO patientOrderRefundDO = toEntity(jsonData, PatientOrderRefundDO.class);
        if (null == patientOrderRefundDO.getId()) {
            return failed("ID不能为空", ObjEnvelop.class);

+ 2 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/course/RecruitStudentsEndpoint.java

@ -39,7 +39,7 @@ public class RecruitStudentsEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "创建")
    public ObjEnvelop<RecruitStudentsDO> create (
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestBody String jsonData) throws Exception {
            @RequestParam String jsonData) throws Exception {
        RecruitStudentsDO recruitStudentsDO = toEntity(jsonData, RecruitStudentsDO.class);
        recruitStudentsDO.setDel(1);
        recruitStudentsDO = recruitStudentsService.save(recruitStudentsDO);
@ -59,7 +59,7 @@ public class RecruitStudentsEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "更新")
    public ObjEnvelop<RecruitStudentsDO> update (
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestBody String jsonData) throws Exception {
            @RequestParam String jsonData) throws Exception {
        RecruitStudentsDO recruitStudentsDO = toEntity(jsonData, RecruitStudentsDO.class);
        if (null == recruitStudentsDO.getId()) {
            return failed("ID不能为空", ObjEnvelop.class);

+ 2 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/course/RecruitStudentsRecordEndpoint.java

@ -38,7 +38,7 @@ public class RecruitStudentsRecordEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "创建")
    public ObjEnvelop<RecruitStudentsRecordDO> create (
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestBody String jsonData) throws Exception {
            @RequestParam String jsonData) throws Exception {
        RecruitStudentsRecordDO recordDO = toEntity(jsonData, RecruitStudentsRecordDO.class);
        recordDO = recruitStudentsRecordService.save(recordDO);
        return success(recordDO);
@ -57,7 +57,7 @@ public class RecruitStudentsRecordEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "更新")
    public ObjEnvelop<RecruitStudentsRecordDO> update (
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestBody String jsonData) throws Exception {
            @RequestParam String jsonData) throws Exception {
        RecruitStudentsRecordDO recordDO = toEntity(jsonData, RecruitStudentsRecordDO.class);
        if (null == recordDO.getId()) {
            return failed("ID不能为空", ObjEnvelop.class);

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

@ -4,6 +4,8 @@ import com.yihu.jw.entity.care.course.CourseCatalogueDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created with IntelliJ IDEA.
 *
@ -14,5 +16,6 @@ import org.springframework.data.repository.PagingAndSortingRepository;
public interface CourseCatalogueDao extends PagingAndSortingRepository<CourseCatalogueDO, String>, JpaSpecificationExecutor<CourseCatalogueDO> {
    List<CourseCatalogueDO> findByCourserId(String courserId);
}

+ 11 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/exam/ChildrenExaminationRecordDao.java

@ -0,0 +1,11 @@
package com.yihu.jw.care.dao.exam;
import com.yihu.jw.entity.care.exam.ChildrenExaminationRecordDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Bing on 2021/5/18.
 */
public interface ChildrenExaminationRecordDao extends PagingAndSortingRepository<ChildrenExaminationRecordDO,String>,JpaSpecificationExecutor<ChildrenExaminationRecordDO> {
}

+ 11 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/message/OrgNoticeDao.java

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

+ 14 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/message/UserNoticeDao.java

@ -0,0 +1,14 @@
package com.yihu.jw.care.dao.message;
import com.yihu.jw.entity.base.notice.UserNoticeDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * 用户公告通知
 * @author yeshijie on 2018/9/30.
 */
public interface UserNoticeDao extends PagingAndSortingRepository<UserNoticeDO, String>, JpaSpecificationExecutor<UserNoticeDO> {
    UserNoticeDO findByNoticeIdAndUserIdAndDel(String noticeId,String userId,Integer del);
}

+ 80 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/course/DoctorCourseEndpoint.java

@ -1,9 +1,22 @@
package com.yihu.jw.care.endpoint.course;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.service.course.CourseService;
import com.yihu.jw.entity.care.course.CourseDO;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.util.tencent.TencentVODUtil;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
 * Created with IntelliJ IDEA.
@ -17,4 +30,69 @@ import org.springframework.web.bind.annotation.RestController;
@Api(tags = "医生课程信息", description = "医生课程信息")
public class DoctorCourseEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private CourseService courseService;
    @Value("${tencent.secretId}")
    private String secretId;
    @Value("${tencent.secretKey}")
    private String secretKey;
    @GetMapping(value = "myCourseList")
    @ApiOperation(value = "我的课程列表")
    public PageEnvelop myCourseList(
            @ApiParam(name = "doctor", value = "doctor") @RequestParam(value = "doctor", required = true) String doctor,
            @ApiParam(name = "type", value = "课程类型 1直播 2视频 3文本") @RequestParam(value = "type", required = false) String type,
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1") @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "3") @RequestParam(value = "size") int size) {
        try{
            JSONObject result = courseService.myCourseList(doctor, type, page, size);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return PageEnvelop.getError(result.getString(ResponseContant.resultMsg));
            }
            Long count = result.getLongValue(ResponseContant.count);
            return PageEnvelop.getSuccessListWithPage("查询成功",(List<CourseDO>)result.get(ResponseContant.resultMsg),page,size,count);
        }catch (Exception e){
            e.printStackTrace();
        }
        return PageEnvelop.getError("查询失败");
    }
    @GetMapping(value = "courseDetail")
    @ApiOperation(value = "课程详情")
    public ObjEnvelop courseDetail(
            @ApiParam(name = "id", value = "id") @RequestParam(value = "id", required = true) String id) {
        try{
            JSONObject result = courseService.courseDetail(id);
            return ObjEnvelop.getSuccess("查询成功",result);
        }catch (Exception e){
            e.printStackTrace();
        }
        return ObjEnvelop.getError("查询失败");
    }
    @PostMapping(value = "addCourse")
    @ApiOperation(value = "新增课程")
    public ObjEnvelop addCourse(
            @ApiParam(name = "doctorId", value = "doctorId") @RequestParam(value = "doctorId", required = true) String doctorId,
            @ApiParam(name = "jsonData", value = "jsonData") @RequestParam(value = "jsonData", required = true) String jsonData) {
        try{
            JSONObject result = courseService.addCourse(doctorId, jsonData);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return ObjEnvelop.getError(result.getString(ResponseContant.resultMsg));
            }
            return ObjEnvelop.getSuccess("新增成功",result);
        }catch (Exception e){
            e.printStackTrace();
        }
        return ObjEnvelop.getError("新增失败");
    }
    @GetMapping(value = "getTXUploadSignature")
    @ApiOperation(value = "获取腾讯视频上传签名")
    public Envelop getTXUploadSignature() throws Exception {
        TencentVODUtil tencentVODUtil = new TencentVODUtil();
        tencentVODUtil.setSecretId(secretId);
        tencentVODUtil.setSecretKey(secretKey);
        return success(tencentVODUtil.getUploadSignature());
    }
}

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

@ -1,17 +1,19 @@
package com.yihu.jw.care.endpoint.course;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.service.course.CourseService;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import 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.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
@ -44,4 +46,54 @@ public class PatientCourseEndpoint extends EnvelopRestEndpoint {
        }
    }
    @GetMapping(value = "patientOrderList")
    @ApiOperation(value = "我的订单列表")
    public PageEnvelop patientOrderList(
            @ApiParam(name = "patient", value = "patient") @RequestParam(value = "patient", required = true) String patient,
            @ApiParam(name = "status", value = "工单状态") @RequestParam(value = "status", required = false) String status,
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1") @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15") @RequestParam(value = "size") int size) {
        try{
            JSONObject result = courseService.patientOrderList(patient, status, page, size);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return PageEnvelop.getError(result.getString(ResponseContant.resultMsg));
            }
            Long count = result.getLongValue(ResponseContant.count);
            return PageEnvelop.getSuccessListWithPage("查询成功",(List<Map<String,Object>>)result.get(ResponseContant.resultMsg),page,size,count);
        }catch (Exception e){
            e.printStackTrace();
        }
        return PageEnvelop.getError("查询失败");
    }
    @GetMapping("orderInfo")
    @ApiOperation(value = "订单详情")
    public ObjEnvelop orderInfo(
            @ApiParam(name = "type", value = "订单类型") @RequestParam(value = "type", required = true) String type,
            @ApiParam(name = "id", value = "订单id") @RequestParam(value = "id", required = true) String id) {
        try {
            JSONObject json = courseService.orderInfo(id,type);
            return ObjEnvelop.getSuccess("获取成功",json);
        } catch (Exception e) {
            e.printStackTrace();
            return ObjEnvelop.getError( "获取失败!" ,-1);
        }
    }
    @PostMapping("cancalOrder")
    @ApiOperation(value = "取消订单")
    public Envelop cancalOrder(
            @ApiParam(name = "type", value = "订单类型") @RequestParam(value = "type", required = true) String type,
            @ApiParam(name = "id", value = "订单id") @RequestParam(value = "id", required = true) String id) {
        try {
            String res = courseService.cancalOrder(id,type);
            if(res == null){
                return success("取消成功");
            }
            return Envelop.getError(res, -1);
        } catch (Exception e) {
            e.printStackTrace();
            return Envelop.getError( "获取失败!" ,-1);
        }
    }
}

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

@ -106,9 +106,7 @@ public class DoctorEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "orgType",defaultValue = "1,2") String orgType
    ){
        try {
            if (orgType.equals("3")&&StringUtils.isBlank(doctorId)){
                return ListEnvelop.getError("参数错误");
            }
            return ListEnvelop.getSuccess("查询成功", doctorService.getOrgList(doctorId,orgType));
        }catch (Exception e){
            e.printStackTrace();
@ -135,4 +133,37 @@ public class DoctorEndpoint extends EnvelopRestEndpoint {
            return ObjEnvelop.getError("查询失败");
        }
    }
    @GetMapping(value = "getTeacherChildren")
    @ApiOperation(value = "教师通讯录-我的儿童")
    public PageEnvelop getTeacherChildren(
            @ApiParam(name = "doctor", value = "doctor")
            @RequestParam(value = "doctor",required = true) String doctor,
            @ApiParam(name = "searchType", value = "0未入学 1已入学")
            @RequestParam(value = "searchType",defaultValue = "0") int searchType,
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
            @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size
    ){
        try {
            return doctorService.getTeacherChildren(doctor,searchType,page,size);
        }catch (Exception e){
            e.printStackTrace();
            return PageEnvelop.getError("查询失败");
        }
    }
    @GetMapping(value = "getTeacherChildrenCount")
    @ApiOperation(value = "教师通讯录-我的儿童数量获取")
    public Object getTeacherChildrenCount(
            @ApiParam(name = "doctor", value = "doctor")
            @RequestParam(value = "doctor",required = true) String doctor){
        try {
            return doctorService.getTeacherChildrenCount(doctor);
        }catch (Exception e){
            e.printStackTrace();
            return PageEnvelop.getError("查询失败");
        }
    }
}

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doorCoach/DoctorDoorCoachOrderController.java

@ -332,7 +332,7 @@ public class DoctorDoorCoachOrderController extends BaseController {
            @ApiParam(value = "角色0、医生,1、管理员", name = "isManage",required = false)
            @RequestParam(value = "isManage", required = false) String isManage,
            @ApiParam(value = "发起类型(1本人发起 2家人待预约 3医生代预约)", name = "type")
            @RequestParam(value = "type", required = false,defaultValue = "1") Integer type,
            @RequestParam(value = "type", required = false) Integer type,
            @ApiParam(value = "页码", name = "page",defaultValue = "1",required = true)
            @RequestParam(value = "page", required = true) Integer page,
            @ApiParam(value = "每页数目", name = "pageSize",defaultValue = "10",required = true)

+ 21 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doorCoach/PatientDoorCoachOrderController.java

@ -153,7 +153,7 @@ public class PatientDoorCoachOrderController extends EnvelopRestEndpoint {
            @ApiParam(value = "居民ID", name = "patient",required = false)
            @RequestParam(value = "patient", required = false) String patient,
            @ApiParam(value = "发起类型(1本人发起 2家人待预约 3医生代预约)", name = "type")
            @RequestParam(value = "type", required = false,defaultValue = "1") Integer type,
            @RequestParam(value = "type", required = false) Integer type,
            @ApiParam(value = "页码", name = "page",defaultValue = "1",required = true)
            @RequestParam(value = "page", required = true) Integer page,
            @ApiParam(value = "每页数目", name = "pageSize",defaultValue = "10",required = true)
@ -206,6 +206,26 @@ public class PatientDoorCoachOrderController extends EnvelopRestEndpoint {
        }
    }
    @PostMapping(value = "dispatcherIntoTopic")
    @ApiOperation(value = "调度员进入会话")
    public ObjEnvelop dispatcherIntoTopic(
            @ApiParam(name = "orderId", value = "工单id", required = true) @RequestParam String orderId,
            @ApiParam(name = "hospitalName", value = "机构名称", required = true) @RequestParam String hospitalName,
            @ApiParam(name = "dispatcher", value = "调度员code", required = true) @RequestParam String dispatcher,
            @ApiParam(name = "dispatcherName", value = "调度员姓名", required = true) @RequestParam  String dispatcherName
    ) {
        try{
            JSONObject result = patientDoorCoachOrderService.dispatcherIntoTopic(orderId,hospitalName,dispatcher,dispatcherName);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return ObjEnvelop.getError(result.getString(ResponseContant.resultMsg));
            }
            return ObjEnvelop.getSuccess("转接成功",result.get(ResponseContant.resultMsg));
        }catch (Exception e){
            e.printStackTrace();
        }
        return ObjEnvelop.getError("转接失败");
    }
    /**
     * 获取服务项目
     *

+ 81 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/exam/ChildrenExaminationEndpoint.java

@ -0,0 +1,81 @@
package com.yihu.jw.care.endpoint.exam;
import com.yihu.jw.care.service.exam.ChildrenExaminationService;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
 * Created by Bing on 2021/5/18.
 */
@RestController
@RequestMapping("patient/examinationRecord")
@Api(description = "居民端儿童体检")
public class ChildrenExaminationEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private ChildrenExaminationService examinationService;
    @PostMapping("newRecord")
    @ApiOperation("居民居家自建记录添加")
    public ObjEnvelop newRecord(@ApiParam(name="patient",value ="儿童id")
                                @RequestParam(value = "patient",required = true)String patient,
                                @ApiParam(name="examTime",value ="体检日期 yyyy-mm-dd")
                                @RequestParam(value = "examTime",required = false)String examTime,
                                @ApiParam(name="monthAge",value ="月龄")
                                @RequestParam(value = "monthAge",required = false)String monthAge,
                                @ApiParam(name="height",value ="身高")
                                @RequestParam(value = "height",required = false)String height,
                                @ApiParam(name="weight",value ="体重")
                                @RequestParam(value = "weight",required = false)String weight,
                                @ApiParam(name="headCircumference",value ="头围")
                                @RequestParam(value = "headCircumference",required = false)String headCircumference){
        try {
            return ObjEnvelop.getSuccess("新建成功",examinationService.newRecord(patient,examTime,monthAge,height,weight,headCircumference)) ;
        }catch (Exception e){
            e.printStackTrace();
            return ObjEnvelop.getError("新建记录失败");
        }
    }
    @GetMapping("getRecordDetailById")
    @ApiOperation("获取居民体检详情")
    public ObjEnvelop getRecordDetailById(@ApiParam(name="recordId",value ="体检id")
                                           @RequestParam(value = "recordId",required = true)String recordId){
        try {
            return ObjEnvelop.getSuccess("查询成功",examinationService.getRecordDetailById(recordId));
        }catch (Exception e){
            e.printStackTrace();;
            return ObjEnvelop.getError("查询失败");
        }
    }
    @GetMapping("getRecordList")
    @ApiOperation("获取居民体检记录")
    public PageEnvelop getRecordList(@ApiParam(name="patient",value ="儿童id")
                                     @RequestParam(value = "patient",required = true)String patient,
                                     @ApiParam(name="type",value = "体检类型 1机构体检 2居家自检")
                                     @RequestParam(value = "type",required = false)String type,
                                     @ApiParam(name="orgCode",value = "体检机构")
                                     @RequestParam(value = "orgCode",required = false)String orgCode,
                                     @ApiParam(name="startTime",value = "yyyy-MM-dd hh:mm:ss")
                                     @RequestParam(value = "startTime",required = false)String startTime,
                                     @ApiParam(name="endTime",value = "yyyy-MM-dd hh:mm:ss")
                                     @RequestParam(value = "endTime",required = false)String endTime,
                                     @ApiParam(name = "page")
                                     @RequestParam(value = "page",defaultValue = "1")int page,
                                     @ApiParam(name = "size")
                                     @RequestParam(value = "size",defaultValue = "15")int size){
        try {
            return examinationService.getRecordList(patient,type,orgCode,startTime,endTime,page,size);
        }catch (Exception e){
            e.printStackTrace();
            return PageEnvelop.getError("查询失败");
        }
    }
}

+ 81 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/exam/DoctorChildrenExaminationEndpoint.java

@ -0,0 +1,81 @@
package com.yihu.jw.care.endpoint.exam;
import com.yihu.jw.care.service.exam.ChildrenExaminationService;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
 * Created by Bing on 2021/5/19.
 */
@RestController
@RequestMapping("doctor/examinationRecord")
@Api(description = "医生端-儿童体检")
public class DoctorChildrenExaminationEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private ChildrenExaminationService examinationService;
    @PostMapping("newRecord")
    @ApiOperation("居民居家自建记录添加")
    public ObjEnvelop newRecord(@ApiParam(name="patient",value ="儿童id")
                                @RequestParam(value = "patient",required = true)String patient,
                                @ApiParam(name="examTime",value ="体检日期 yyyy-mm-dd")
                                @RequestParam(value = "examTime",required = false)String examTime,
                                @ApiParam(name="monthAge",value ="月龄")
                                @RequestParam(value = "monthAge",required = false)String monthAge,
                                @ApiParam(name="height",value ="身高")
                                @RequestParam(value = "height",required = false)String height,
                                @ApiParam(name="weight",value ="体重")
                                @RequestParam(value = "weight",required = false)String weight,
                                @ApiParam(name="headCircumference",value ="头围")
                                @RequestParam(value = "headCircumference",required = false)String headCircumference){
        try {
            return ObjEnvelop.getSuccess("新建成功",examinationService.newRecord(patient,examTime,monthAge,height,weight,headCircumference)) ;
        }catch (Exception e){
            e.printStackTrace();
            return ObjEnvelop.getError("新建记录失败");
        }
    }
    @GetMapping("getRecordDetailById")
    @ApiOperation("获取居民体检详情")
    public ObjEnvelop getRecordDetailById(@ApiParam(name="recordId",value ="体检id")
                                          @RequestParam(value = "recordId",required = true)String recordId){
        try {
            return ObjEnvelop.getSuccess("查询成功",examinationService.getRecordDetailById(recordId));
        }catch (Exception e){
            e.printStackTrace();;
            return ObjEnvelop.getError("查询失败");
        }
    }
    @GetMapping("getRecordList")
    @ApiOperation("获取居民体检记录")
    public PageEnvelop getRecordList(@ApiParam(name="patient",value ="儿童id")
                                     @RequestParam(value = "patient",required = true)String patient,
                                     @ApiParam(name="type",value = "体检类型 1机构体检 2居家自检")
                                     @RequestParam(value = "type",required = false)String type,
                                     @ApiParam(name="orgCode",value = "体检机构")
                                     @RequestParam(value = "orgCode",required = false)String orgCode,
                                     @ApiParam(name="startTime",value = "yyyy-MM-dd hh:mm:ss")
                                     @RequestParam(value = "startTime",required = false)String startTime,
                                     @ApiParam(name="endTime",value = "yyyy-MM-dd hh:mm:ss")
                                     @RequestParam(value = "endTime",required = false)String endTime,
                                     @ApiParam(name = "page")
                                     @RequestParam(value = "page",defaultValue = "1")int page,
                                     @ApiParam(name = "size")
                                     @RequestParam(value = "size",defaultValue = "15")int size){
        try {
            return examinationService.getRecordList(patient,type,orgCode,startTime,endTime,page,size);
        }catch (Exception e){
            e.printStackTrace();
            return PageEnvelop.getError("查询失败");
        }
    }
}

+ 56 - 6
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/message/DoctorMessageEndpoint.java

@ -1,18 +1,16 @@
package com.yihu.jw.care.endpoint.message;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.service.message.DoctorMessageService;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
/**
 * Created by Bing on 2021/4/10.
@ -38,4 +36,56 @@ public class DoctorMessageEndpoint extends EnvelopRestEndpoint {
        }
    }
    @PostMapping(value = "newOrgNotice")
    @ApiOperation("创建机构通知消息")
    public ObjEnvelop newOrgNotice(@ApiParam(name = "jsonDate", value = "消息通知json")
                               @RequestParam(value = "jsonDate", required = false) String jsonDate,
                               @ApiParam(name = "patients", value = "通知居民列表")
                               @RequestParam(value = "patients", required = false) String[] patients){
        try {
            JSONObject result = doctorMessageService.newOrgNotice(jsonDate,patients);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return ObjEnvelop.getError(result.getString(ResponseContant.resultMsg));
            }
            return ObjEnvelop.getSuccess("查询成功",result.getJSONObject(ResponseContant.resultMsg));
        }catch (Exception e){
            e.printStackTrace();
            return ObjEnvelop.getError("查询失败"+e.getMessage());
        }
    }
    @PostMapping(value = "getOrgNoticeList")
    @ApiOperation("获取机构通知消息")
    public PageEnvelop getOrgNoticeList(@ApiParam(name = "orgCode", value = "机构code")
                                       @RequestParam(value = "orgCode", required = true) String orgCode,
                                        @ApiParam(name = "createUser", value = "通知创建者")
                                       @RequestParam(value = "createUser", required = false) String createUser,
                                        @ApiParam(name = "beginTime", value = "提醒开始时间")
                                       @RequestParam(value = "beginTime", required = false) String beginTime,
                                        @ApiParam(name = "endTime", value = "提醒结束时间")
                                       @RequestParam(value = "endTime", required = false) String endTime,
                                        @ApiParam(name = "page", value = "page")
                                       @RequestParam(value = "page", required = true,defaultValue = "1") int page,
                                        @ApiParam(name = "size", value = "size")
                                       @RequestParam(value = "size", required = true,defaultValue = "15") int size){
        try {
            return doctorMessageService.getOrgNoticeList(orgCode,createUser,beginTime,endTime,page,size);
        }catch (Exception e){
            e.printStackTrace();
            return PageEnvelop.getError("查询失败"+e.getMessage());
        }
    }
    @PostMapping(value = "orgNoticeDetail")
    @ApiOperation("获取机构通知消息详情")
    public ObjEnvelop orgNoticeDetail(@ApiParam(name = "noticeId", value = "通知id")
                                   @RequestParam(value = "noticeId", required = false) String noticeId){
        try {
            return ObjEnvelop.getSuccess("查询成功",doctorMessageService.orgNoticeDetail(noticeId));
        }catch (Exception e){
            e.printStackTrace();
            return ObjEnvelop.getError("查询失败"+e.getMessage());
        }
    }
}

+ 60 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/message/PatientMessageEndpoint.java

@ -0,0 +1,60 @@
package com.yihu.jw.care.endpoint.message;
import com.yihu.jw.care.service.message.PatientMessageService;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
 * Created by Bing on 2021/5/19.
 */
@RestController
@RequestMapping("patient/message")
@Api(description = "居民端消息")
public class PatientMessageEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private PatientMessageService patientMessageService;
    @PostMapping(value = "getNoticeList")
    @ApiOperation("获取患者机构通知消息")
    public PageEnvelop getNoticeList(@ApiParam(name = "patient", value = "患者id")
                                        @RequestParam(value = "patient", required = true) String patient,
                                        @ApiParam(name = "beginTime", value = "提醒开始时间")
                                        @RequestParam(value = "beginTime", required = false) String beginTime,
                                        @ApiParam(name = "endTime", value = "提醒结束时间")
                                        @RequestParam(value = "endTime", required = false) String endTime,
                                        @ApiParam(name = "page", value = "page")
                                        @RequestParam(value = "page", required = true,defaultValue = "1") int page,
                                        @ApiParam(name = "size", value = "size")
                                        @RequestParam(value = "size", required = true,defaultValue = "15") int size){
        try {
            return patientMessageService.getNoticeList(patient,beginTime,endTime,page,size);
        }catch (Exception e){
            e.printStackTrace();
            return PageEnvelop.getError("查询失败"+e.getMessage());
        }
    }
    @PostMapping(value = "orgNoticeDetail")
    @ApiOperation("获取机构通知消息详情")
    public ObjEnvelop orgNoticeDetail(@ApiParam(name = "noticeId", value = "通知id")
                                      @RequestParam(value = "noticeId", required = false) String noticeId,
                                      @ApiParam(name = "patient", value = "patient")
                                      @RequestParam(value = "patient", required = false) String patient){
        try {
            return ObjEnvelop.getSuccess("查询成功",patientMessageService.orgNoticeDetail(noticeId,patient));
        }catch (Exception e){
            e.printStackTrace();
            return ObjEnvelop.getError("查询失败"+e.getMessage());
        }
    }
}

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

@ -10,6 +10,7 @@ import com.yihu.jw.care.service.patient.CarePatientService;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
@ -185,4 +186,39 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
    }
    @GetMapping(value = "getTeacherOrgList")
    @ApiOperation(value = "居民端-教育机构列表")
    public ListEnvelop getTeacherOrgList (
            @ApiParam(name = "patient", value = "患者code", required = true)
            @RequestParam(value = "patient",required = true) String patient){
        try{
            return ListEnvelop.getSuccess("查询成功",patientService.getTeacherOrgList(patient));
        }catch (Exception e){
            e.printStackTrace();
            return ListEnvelop.getError("查询失败");
        }
    }
    @GetMapping(value = "getTeacherList")
    @ApiOperation(value = "居民端通讯录-教育医生")
    public PageEnvelop getTeacherList(
            @ApiParam(name = "patient", value = "患者code", required = true)
            @RequestParam(value = "patient",required = true) String patient,
            @ApiParam(name = "orgCode", value = "orgCode")
            @RequestParam(value = "orgCode") String orgCode,
            @ApiParam(name = "deptCode", value = "deptCode")
            @RequestParam(value = "deptCode",required = false) String deptCode,
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
            @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size
    ){
        try {
            return patientService.getTeacherList(patient,orgCode,deptCode,page,size);
        }catch (Exception e){
            e.printStackTrace();
            return PageEnvelop.getError("查询失败");
        }
    }
}

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

@ -279,7 +279,7 @@ public class ConsultTeamService {
        //咨询详细信息
        ConsultTeamDo consultTeam = new ConsultTeamDo();
        consultTeam.setType(21);  //上门服务咨询
        consultTeam.setType(21);  //上门辅导咨询
        consultTeam.setRelationCode(doorServiceOrderDO.getId()); //关联业务code
        consultTeam.setSymptoms(doorServiceOrderDO.getServeDesc());
        consultTeam.setPatient(patient);
@ -336,6 +336,9 @@ public class ConsultTeamService {
     */
    public boolean finishDoorCoachConsult(BaseDoorCoachOrderDO assistanceDO, String endOperator, int endType){
        ConsultTeamDo consultTeam = consultTeamDao.queryByRelationCode(assistanceDO.getId());
        if (consultTeam==null){
            return true;
        }
        ConsultDo consult = consultDao.findOne(consultTeam.getConsult());
        String sessionId = assistanceDO.getPatient() + "_" + consultTeam.getConsult() + "_" + consultTeam.getType();

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

@ -1,22 +1,31 @@
package com.yihu.jw.care.service.course;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.dao.course.CourseCatalogueDao;
import com.yihu.jw.care.dao.course.CourseDao;
import com.yihu.jw.care.dao.course.CourseSalesOrderRecordDao;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.care.dao.course.*;
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.care.course.*;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.StringUtil;
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 org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.yihu.jw.rm.iot.IotRequestMapping.Common.hospital;
/**
 * Created with IntelliJ IDEA.
 *
@ -39,9 +48,107 @@ public class CourseService {
    private BaseDoctorDao doctorDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private RecruitStudentsRecordDao recruitStudentsRecordDao;
    @Autowired
    private BusinessOrderDao businessOrderDao;
    @Autowired
    private PatientOrderRefundDao patientOrderRefundDao;
    @Autowired
    private ObjectMapper objectMapper;
    @Autowired
    private BaseDoctorHospitalDao baseDoctorHospitalDao;
    public String getOrderNo(String type){
        return type + System.currentTimeMillis()+(int)(Math.random() * 900)+100 +"";
    }
    /**
     * 取消订单
     * @param id
     * @param type
     * @return
     */
    public String cancalOrder(String id,String type){
        if("1".equals(type)){
            //招生
            RecruitStudentsRecordDO recordDO = recruitStudentsRecordDao.findOne(id);
            if(!"2".equals(recordDO.getStatus())){
                return "只有待支付的订单才能取消";
            }
            recordDO.setStatus("7");
            recruitStudentsRecordDao.save(recordDO);
        }else  if("2".equals(type)){
            //课程
            CourseSalesOrderRecordDO recordDO = courseSalesOrderRecordDao.findOne(id);
            if(!"2".equals(recordDO.getStatus())){
                return "只有待支付的订单才能取消";
            }
            recordDO.setStatus("7");
            courseSalesOrderRecordDao.save(recordDO);
        }
        return null;
    }
    /**
     * 订单详情接口
     * @param id
     * @param type
     */
    public JSONObject orderInfo(String id,String type){
        JSONObject resJson = new JSONObject();
        resJson.put("type",type);
        resJson.put("id",id);
        String status = "";
        if("1".equals(type)){
            //招生
            RecruitStudentsRecordDO recordDO = recruitStudentsRecordDao.findOne(id);
            status = recordDO.getStatus();
            resJson.put("title",recordDO.getRecruitName());
            resJson.put("status",recordDO.getStatus());
            resJson.put("price",recordDO.getPrice());
            resJson.put("orderNo",recordDO.getOrderNo());
        }else  if("2".equals(type)){
            //课程
            CourseSalesOrderRecordDO recordDO = courseSalesOrderRecordDao.findOne(id);
            status = recordDO.getStatus();
            resJson.put("title",recordDO.getCourseName());
            resJson.put("status",recordDO.getStatus());
            resJson.put("price",recordDO.getPrice());
            resJson.put("orderNo",recordDO.getOrderNo());
        }
        boolean flag = "3".equals(status)||"5".equals(status)||"6".equals(status);
        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);
            }
        }
        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);
            }
        }
        return resJson;
    }
    /**
     * 顶部状态栏订单各分类总条数
     * 待审核 1     待支付 2     已支付 3     审核未通过 4     已退款 5     退款中 6     已取消 7
     * @param patient
     * @return
     */
@ -55,12 +162,14 @@ public class CourseService {
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        Map<String, Integer> map = new HashMap<>();
        //状态 待服务 1、已完成 2 、已取消 -1
        //状态 待审核 1     待支付 2     已支付 3     审核未通过 4     已退款 5     退款中 6     已取消 7
        map.put("1",0);
        map.put("2",0);
        map.put("3",0);
        map.put("4",0);
        map.put("5",0);
        map.put("6",0);
        map.put("7",0);
        int total = 0;
        if(list.size()>0){
            for (Map<String, Object> one:list){
@ -69,79 +178,157 @@ public class CourseService {
            }
        }
        map.put("total", total);
        return map;
    }
    /**
     * 课程详情
     * @param id
     * @return
     */
    public JSONObject courseDetail(String id){
        JSONObject result = new JSONObject();
        CourseDO courseDO = courseDao.findOne(id);
        if(!"1".equals(courseDO.getType())){
            List<CourseCatalogueDO> catalogueDOList = courseCatalogueDao.findByCourserId(id);
            courseDO.setCatalogueDOList(catalogueDOList);
        }
        result.put("courseDO",courseDO);
        return result;
    }
    /**
     * 新增课程
     * @param doctorId
     * @param jsonData
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    public JSONObject addCourse(String doctorId,String jsonData){
        JSONObject result = new JSONObject();
        JSONObject json = JSON.parseObject(jsonData);
        BaseDoctorDO doctorDO = doctorDao.findById(doctorId);
        List<BaseDoctorHospitalDO> baseDoctorHospitalDO = baseDoctorHospitalDao.findByDoctorCode(doctorId);
        CourseDO courseDO = null;
        try{
            courseDO = objectMapper.readValue(json.getJSONObject("course").toString(), CourseDO.class);
        }catch (Exception e){
            e.printStackTrace();
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg, "传参有误");
        }
        courseDO.setStatus("1");
        courseDO.setDel(1);
        courseDO.setDoctor(doctorId);
        courseDO.setDoctorName(doctorDO.getName());
        courseDO.setOrgCode(baseDoctorHospitalDO.get(0).getOrgCode());
        courseDO.setOrgName(baseDoctorHospitalDO.get(0).getOrgName());
        courseDO.setCreateTime(new Date());
        courseDO.setCreateUser(doctorId);
        courseDO.setCreateUserName(doctorDO.getName());
        if("1".equals(courseDO.getType())){
            //直播课程
            courseDO.setLiveStatus("1");
        }
        List<CourseCatalogueDO> catalogueDOList = courseDO.getCatalogueDOList();
        courseDao.save(courseDO);
        if(catalogueDOList!=null&&catalogueDOList.size()>0){
            for (CourseCatalogueDO catalogueDO : catalogueDOList){
                catalogueDO.setCourserId(catalogueDO.getId());
                catalogueDO.setType(courseDO.getType());
                catalogueDO.setCreateTime(new Date());
            }
            courseCatalogueDao.save(catalogueDOList);
        }
        result.put(ResponseContant.resultFlag, ResponseContant.success);
        return result;
    }
    public JSONObject patientOrderList(String patient, Integer status, int page, int size) {
    /**
     * 教师我的课程
     * @param doctor
     * @param page
     * @param size
     * @return
     */
    public JSONObject myCourseList(String doctor,String type, int page, int size) {
        JSONObject result = new JSONObject();
        int start = 0 == page ? page++ : (page - 1) * size;
        int end = 0 == size ? 15 : size;
        StringBuffer buffer = new StringBuffer();
        String sql = "SELECT " +
                "  p.name AS patientName, " +
                "  p.photo AS photo, " +
                "  p.idcard," +
                "  case p.sex  " +
                "  when 1 then '男'  " +
                "  when 2 then '女' " +
                "  end AS sex, " +
                "  TIMESTAMPDIFF(year,p.birthday,NOW()) AS age," +
                "  o.id as orderId, " +
                "  o.patient_phone as phone, " +
                "  o.proxy_patient as proxyPatient, " +
                "  o.patient as patient, " +
                "  o.number as number, " +
                "  o.patient_expected_serve_time as serveTime, o.doctor, o.doctor_name as doctorName, " +
                "  o.serve_address as address, " +
                "  o.type as type, " +
                "  o.serve_lon as lon, " +
                "  o.serve_lat as lat, " +
                "  o.`status` as status " +
                " FROM " +
                " ( base_life_care_order o " +
                " LEFT JOIN base_patient p ON o.patient = p.id ) "+
                " WHERE " +
                "  o.hospital = '{hospital}' and o.type != 3 " +buffer+
                " AND ( o.`status` = {status} OR -100 = {status} ) " +
                " ORDER BY o.create_time desc " +
        int end = 0 == size ? 3 : size;
        String filter = " where a.doctor = '"+doctor+"' ";
        if(!StringUtil.isBlank(type)){
            filter += " and a.type = '"+type+"' ";
        }
        String sql = "SELECT * from base_course a " +filter +
                " ORDER BY a.create_time desc " +
                " LIMIT {start},{end};";
        String finalSql = sql.replace("{status}", String.valueOf(status))
                .replace("{start}", String.valueOf(start))
        String finalSql = sql.replace("{start}", String.valueOf(start))
                .replace("{end}", String.valueOf(end));
        String countSql = "SELECT  " +
                "   count(o.id)  " +
                " FROM  " +
                "   base_life_care_order o  " +
                " LEFT JOIN base_patient p ON o.patient = p.id " +
                " WHERE  " +
                "  o.hospital = '{hospital}' " +buffer+
                " AND (o.`status` = {status} or -100 = {status})";
        String countSql = "SELECT count(a.id) FROM base_course a " +filter ;
        List<CourseDO> sqlResultlist = jdbcTemplate.query(finalSql,new BeanPropertyRowMapper<>(CourseDO.class));
        Long count = jdbcTemplate.queryForObject(countSql, Long.class);
        result.put(ResponseContant.resultFlag, ResponseContant.success);
        result.put(ResponseContant.resultMsg, sqlResultlist);
        JSONObject countItem = new JSONObject();
        countItem.put("count", count);
        result.putAll(countItem);
        return result;
    }
    /**
     * 居民我的订单列表
     * @param patient
     * @param status
     * @param page
     * @param size
     * @return
     */
    public JSONObject patientOrderList(String patient, String status, int page, int size) {
        JSONObject result = new JSONObject();
        int start = 0 == page ? page++ : (page - 1) * size;
        int end = 0 == size ? 15 : size;
        String filter = " where patient = '"+patient+"' ";
        if(!StringUtil.isEmpty(status)){
            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 " +
                " 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  " +
                " from base_course_sales_order_record " + filter+" ";
        String finqlCountSql = countSql.replace("{hospital}", hospital)
                .replace("{status}", String.valueOf(status));
        String sql = "SELECT * from ( " + sqlUnion + " ) a " +
                " ORDER BY a.createTime desc " +
                " LIMIT {start},{end};";
        String finalSql = sql.replace("{start}", String.valueOf(start))
                .replace("{end}", String.valueOf(end));
        String countSql = "SELECT  count(a.id)  FROM  ( " + sqlUnion + " ) a " ;
        List<Map<String,Object>> sqlResultlist;
        try {
            sqlResultlist = jdbcTemplate.queryForList(finalSql);
        } catch (Exception e) {
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg, "从数据库查询生活照料工单列表信息失败");
            result.put(ResponseContant.resultMsg, "从数据库查询工单列表信息失败");
            return result;
        }
        Long count;
        try {
            count = jdbcTemplate.queryForObject(finqlCountSql, Long.class);
            count = jdbcTemplate.queryForObject(countSql, Long.class);
        } catch (Exception e) {
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg, "从数据库统计生活照料工单数量失败" );
            result.put(ResponseContant.resultMsg, "从数据库统计工单数量失败" );
            return result;
        }

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

@ -21,6 +21,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -131,17 +132,52 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
    public List<Map<String,Object>> getOrgList(String doctorId,String orgType){
        List<Map<String,Object>> result = new ArrayList<>();
        String sql ="SELECT org.code org_code,org.`name`,org.type from base_org org  where  org.del=1 ";
        if (orgType.equals("3")){
            sql= " SELECT org.code org_code,org.`name`,org.type from base_org org,base_doctor_hospital dh  where dh.org_code = org.code " +
                    "and  org.del=1 and dh.del=1 and doctor_code='"+doctorId+"' and org.type=3 GROUP BY org.`code` ";
        BaseDoctorDO doctorDO = baseDoctorDao.findById(doctorId);
        if (doctorDO==null){
            return new ArrayList<>();
        }
        //教师角色登录时为本机构科室列表,点击展开人员列表
        //助老员角色登录时为本机构科室列表,点击展开人员列表
        Integer doctorLevel = doctorDO.getLevel();
        Integer doctorOrgType =0 ;
        boolean isSearchDoctorOrgType=false;
        if (3==doctorLevel){//教师
            doctorOrgType=4;
            if ("4".equals(orgType)){
                isSearchDoctorOrgType=true;
            }
        }
        if (2==doctorLevel) {//助老员
            doctorOrgType=3;
            if ("3".equals(orgType)){
                isSearchDoctorOrgType=true;
            }
        }
        String sql ="select org.code from base_doctor_hospital dh inner join base_org org on dh.org_code = org.code " +
                "and dh.doctor_code='"+doctorId+"' and org.type='"+doctorOrgType+"' ORDER BY dh.create_time desc limit 1";
        List<String> doctorOrg = jdbcTemplate.queryForList(sql,String.class);
        sql ="SELECT org.code org_code,org.`name`,org.type from base_org org  where  org.del=1 ";
        if (orgType.equals("3")){//养老
            sql= " SELECT org.code org_code,org.`name`,org.type from base_org org where  " +
                    "  org.del=1  and org.type=3 " ;
            if (isSearchDoctorOrgType&&doctorOrg.size()>0){
                sql += " and org.code = '"+doctorOrg.get(0)+"' ";
            }
            sql += " GROUP BY org.`code` ";
        }
        else if (orgType.equals("1,2")){//医疗机构
           sql+=" and org.type in(1,2) ";
        }
        else {
            sql+=" and org.type='"+orgType+"' ";
            if (isSearchDoctorOrgType&&doctorOrg.size()>0){
                sql += " and org.code = '"+doctorOrg.get(0)+"' and org.type='"+orgType+"'  ";
            }else {
                sql+=" and org.type='"+orgType+"' ";
            }
        }
        sql+=" ORDER BY org.`code` asc";
        List<Map<String,Object>> tmpList = jdbcTemplate.queryForList(sql);
@ -158,14 +194,16 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
    public JSONObject getOrgDoctor(String orgCode,String deptCode,int page,int size){
        JSONObject result = new JSONObject();
        String count = "select count(Distinct doc.id)\n" +
                "from base_doctor_hospital dh,dict_hospital_dept dict,base_doctor doc where  dh.doctor_code = doc.id  " +
                "and dh.dept_code = dict.`code` and dh.org_code = dict.org_code and dh.del=1 and dh.org_code='"+orgCode+"' " ;
                " from base_doctor_hospital dh INNER JOIN base_doctor doc on dh.doctor_code = doc.id  " +
                " and dh.del=1 LEFT JOIN " +
                " dict_hospital_dept dict on dh.dept_code = dict.`code` and dh.org_code = dict.org_code where dh.org_code='"+orgCode+"' ";
        if (StringUtils.isNotBlank(deptCode)){
            count+=" and dict.code='"+deptCode+"' ";
        }
        String sql = "select dh.org_code,dh.org_name,doc.id,doc.name,doc.mobile,doc.photo,dict.code deptCode,dict.name deptName,dh.doctor_duty_code job,dh.doctor_duty_name jobName\n" +
                "from base_doctor_hospital dh,dict_hospital_dept dict,base_doctor doc where  dh.doctor_code = doc.id  " +
                "and dh.dept_code = dict.`code` and dh.org_code = dict.org_code and dh.del=1 and dh.org_code='"+orgCode+"' ";
                " from base_doctor_hospital dh INNER JOIN base_doctor doc on dh.doctor_code = doc.id  " +
                " and dh.del=1 LEFT JOIN " +
                " dict_hospital_dept dict on dh.dept_code = dict.`code` and dh.org_code = dict.org_code where dh.org_code='"+orgCode+"' ";
        if (StringUtils.isNotBlank(deptCode)){
            sql+=" and dict.code='"+deptCode+"' ";
        }
@ -185,4 +223,74 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        return result;
    }
    public PageEnvelop getTeacherChildren(String doctor,int searchType,int page,int size){
        page = page>0?page-1:0;
        List<Map<String,Object>> list = new ArrayList<>();
        //未入学
        String sql0 = "select Distinct sor.patient from base_course_sales_order_record sor INNER JOIN base_course bc on sor.course_id = bc.id " +
                " and bc.del=1 where bc.doctor ='"+doctor+"'  and sor.`status` =5 and not EXISTS (select DISTINCT rsr.patient " +
                " from base_recruit_students_record rsr INNER JOIN  base_org org on rsr.org_code = org.`code` and org.del=1 " +
                " INNER JOIN base_doctor_hospital dh on rsr.org_code = dh.org_code and dh.del =1  where rsr.patient=sor.patient and " +
                " dh.doctor_code='"+doctor+"'   and rsr.del<>0  and rsr.`status` = 3  )";
        //已入学
        String sql1=" select DISTINCT rsr.patient from base_recruit_students_record rsr INNER JOIN  base_org org on rsr.org_code = org.`code` " +
                "and org.del=1 INNER JOIN base_doctor_hospital dh on rsr.org_code = dh.org_code and dh.del =1  where dh.doctor_code='"+doctor+"' " +
                "and rsr.del<>0  and rsr.`status` = 3 GROUP BY dh.doctor_code  ";
        String sql = "select p.id,p.name,p.photo,p.sex,p.idcard,p.openid,p.mobile,group_concat( pd.category_code) deviceType from ( {sqlReplace} )tmp Inner JOIN base_patient p on tmp.patient  = p.id " +
                " LEFT JOIN wlyy_patient_device pd on pd.`user`=p.id and pd.category_code BETWEEN 1 and 2 GROUP BY p.id ";
        String sqlcpunt = "select count(Distinct p.id) from ( {sqlReplace} )tmp Inner JOIN base_patient p on tmp.patient  = p.id " +
                " LEFT JOIN wlyy_patient_device pd on pd.`user`=p.id and pd.category_code BETWEEN 1 and 2  ";
        Long count = 0L;
        if (0==searchType){
            list = jdbcTemplate.queryForList(sql.replace("{sqlReplace}",sql0));
            count = jdbcTemplate.queryForObject(sqlcpunt.replace("{sqlReplace}",sql0),Long.class);
        }
        if (1==searchType){//
            list = jdbcTemplate.queryForList(sql.replace("{sqlReplace}",sql1));
            count = jdbcTemplate.queryForObject(sqlcpunt.replace("{sqlReplace}",sql1),Long.class);
        }
        for (Map<String,Object>map:list){
            if (map.get("idcard")!=null){
                String idcard = map.get("idcard").toString();
                map.put("age", IdCardUtil.getAgeForIdcard(idcard));
            }else {
                map.put("age", null);
            }
            if (map.get("deviceType")!=null){
                if ("1,2".equals(map.get("deviceType").toString())){
                    map.put("deviceType",3);//deviceType 设备状态:0未绑定,1血糖仪,2血压仪,3血糖仪+血压仪
                }
                else {
                    map.put("deviceType",Integer.valueOf(map.get("deviceType").toString()));
                }
            }
            else {
                map.put("deviceType",0);
            }
        }
        return PageEnvelop.getSuccessListWithPage("查询成功",list,page,size,count);
    }
    public Map<String,Long> getTeacherChildrenCount(String doctor){
        Map<String,Long> result = new HashMap<>();
        //未入学
        String sql0 = "select Distinct sor.patient from base_course_sales_order_record sor INNER JOIN base_course bc on sor.course_id = bc.id " +
                " and bc.del=1 where bc.doctor ='"+doctor+"'  and sor.`status` =5 and not EXISTS (select DISTINCT rsr.patient " +
                " from base_recruit_students_record rsr INNER JOIN  base_org org on rsr.org_code = org.`code` and org.del=1 " +
                " INNER JOIN base_doctor_hospital dh on rsr.org_code = dh.org_code and dh.del =1  where rsr.patient=sor.patient and " +
                " dh.doctor_code='"+doctor+"'   and rsr.del<>0  and rsr.`status` = 3  )";
        //已入学
        String sql1=" select DISTINCT rsr.patient from base_recruit_students_record rsr INNER JOIN  base_org org on rsr.org_code = org.`code` " +
                "and org.del=1 INNER JOIN base_doctor_hospital dh on rsr.org_code = dh.org_code and dh.del =1  where dh.doctor_code='"+doctor+"' " +
                "and rsr.del<>0  and rsr.`status` = 3 GROUP BY dh.doctor_code  ";
        String sqlcpunt = "select count(Distinct p.id) from ( {sqlReplace} )tmp Inner JOIN base_patient p on tmp.patient  = p.id " +
                " LEFT JOIN wlyy_patient_device pd on pd.`user`=p.id and pd.category_code BETWEEN 1 and 2  ";
        Long count = 0L;
        count = jdbcTemplate.queryForObject(sqlcpunt.replace("{sqlReplace}",sql0),Long.class);
        result.put("notEnrol",count);
        count = jdbcTemplate.queryForObject(sqlcpunt.replace("{sqlReplace}",sql1),Long.class);
        result.put("enrol",count);
        return result;
    }
}

+ 9 - 7
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doorCoach/DoctorDoorCoachOrderService.java

@ -220,7 +220,7 @@ public class DoctorDoorCoachOrderService {
        //获取医生代预约记录
        if(type != null && type == 3 ){
            sql += " and o.type = " + type + " and o.proxy_patient = '" + doctorCode + "'";
        }else{
        }else if (type!=null){
            sql += " and o.type = " + type +" ";
        }
        if(StringUtils.isNotBlank(doctorCode)){
@ -652,9 +652,10 @@ public class DoctorDoorCoachOrderService {
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        Map<String, Integer> map = new HashMap<>();
        Integer all = list.size();
        Integer waitForServe = 0;
        Integer served = 0;
        Integer cancel = 0;
        Integer waitForAccept = 0;//待接单
        Integer waitForServe = 0;//待服务
        Integer served = 0;//已完成
        Integer cancel = 0;//已取消
        // -1已取消 [1,4]待服务 [5,6]已服务
       for (Map<String, Object> tmp:list){
           switch (String.valueOf(tmp.get("status"))){
@ -662,10 +663,10 @@ public class DoctorDoorCoachOrderService {
                   cancel += Integer.valueOf(tmp.get("num").toString()) ;
                   break;
               case "1":
                   waitForServe += Integer.valueOf(tmp.get("num").toString()) ;
                   waitForAccept += Integer.valueOf(tmp.get("num").toString()) ;
                   break;
               case "2":
                   waitForServe += Integer.valueOf(tmp.get("num").toString()) ;
                   waitForAccept += Integer.valueOf(tmp.get("num").toString()) ;
                   break;
               case "3":
                   waitForServe += Integer.valueOf(tmp.get("num").toString()) ;
@ -674,7 +675,7 @@ public class DoctorDoorCoachOrderService {
                   waitForServe += Integer.valueOf(tmp.get("num").toString()) ;
                   break;
               case "5":
                   served += Integer.valueOf(tmp.get("num").toString()) ;
                   waitForServe += Integer.valueOf(tmp.get("num").toString()) ;
                   break;
               case "6":
                   served += Integer.valueOf(tmp.get("num").toString()) ;
@ -685,6 +686,7 @@ public class DoctorDoorCoachOrderService {
           }
       }
       map.put("all",all);
       map.put("waitForAccept",waitForAccept);
       map.put("waitForServe",waitForServe);
       map.put("served",served);
       map.put("cancel",cancel);

+ 45 - 15
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doorCoach/PatientDoorCoachOrderService.java

@ -12,8 +12,6 @@ import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.care.doorCoach.*;
import com.yihu.jw.entity.door.WlyyDoorFeeDetailDO;
import com.yihu.jw.entity.door.WlyyDoorOrderItemDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.im.dao.ConsultDao;
@ -961,6 +959,40 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
    }
    /**
     * 调度员进入聊天室
     * @param dispatcher
     * @param orderId
     */
    public JSONObject dispatcherIntoTopic(String orderId, String hospitalName, String dispatcher, String dispatcherName) {
        JSONObject result = new JSONObject();
        BaseDoorCoachOrderDO orderDO = baseDoorCoachOrderDao.findOne(orderId);
        if (null == orderDO) {
            String failMsg = "调度员进入聊天室时,找不到对应工单,工单id=" + orderId;
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg, failMsg);
            logger.error(failMsg);
            return result;
        }
        ConsultDo consult = consultDao.queryByRelationCode(orderId);
        String sessionId = orderDO.getPatient() + "_" + consult.getId() + "_"  + orderDO.getNumber() +  "_" +  consult.getType();
        // 把调度员拉入会话,作为其中一个成员,第一个进入会话的调度员,系统发送欢迎语和居民的预约卡片信息
        if (org.apache.commons.lang3.StringUtils.isEmpty(orderDO.getDispatcher())) {
            orderDO.setDispatcher(dispatcher);
            orderDO.setDispatcherName(dispatcherName);
            this.save(orderDO);
            // 先进入会话,再聊天
            imUtill.updateParticipantNew(sessionId,dispatcher,null);
            String noticeContent = hospitalName + dispatcherName + "为您服务";
            this.qucikSendIM(orderId, dispatcher, "智能助手", "1", noticeContent);
        }
        // 把调度员拉入会话,作为其中一个成员
        imUtill.updateParticipantNew(sessionId,dispatcher,null);
        result.put(ResponseContant.resultFlag, ResponseContant.success);
        result.put(ResponseContant.resultMsg, "调度员["+dispatcherName+"]进入会话成功");
        return result;
    }
    /**
     * 工单与服务项费用关联关系
     *
@ -1002,11 +1034,6 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
                JSONObject oneJson = (JSONObject)one;
                try {
                    feeDetailDO = EntityUtils.jsonToEntity(one.toString(), BaseDoorCoachFeeDetailDO.class);
                    WlyyDoorOrderItemDO orderItemDO = new WlyyDoorOrderItemDO();
                    orderItemDO.setDoctor(order.getDoctor());
                    orderItemDO.setCode(feeDetailDO.getCode());
                    orderItemDO.setCreateTime(new Date());
                    orderItemDO.setPatient(order.getPatient());
                } catch (Exception e) {
                    result.put(ResponseContant.resultFlag, ResponseContant.fail);
                    String failMsg = "工单与服务费用关联关系时," + e.getMessage();
@ -1112,9 +1139,10 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        Map<String, Integer> map = new HashMap<>();
        Integer all = list.size();
        Integer waitForServe = 0;
        Integer served = 0;
        Integer cancel = 0;
        Integer waitForAccept = 0;//待接单
        Integer waitForServe = 0;//待服务
        Integer served = 0;//已完成
        Integer cancel = 0;//已取消
        // -1已取消 [1,4]待服务 [5,6]已服务
        for (Map<String, Object> tmp:list){
            switch (String.valueOf(tmp.get("status"))){
@ -1122,10 +1150,10 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
                    cancel += Integer.valueOf(tmp.get("num").toString()) ;
                    break;
                case "1":
                    waitForServe += Integer.valueOf(tmp.get("num").toString()) ;
                    waitForAccept += Integer.valueOf(tmp.get("num").toString()) ;
                    break;
                case "2":
                    waitForServe += Integer.valueOf(tmp.get("num").toString()) ;
                    waitForAccept += Integer.valueOf(tmp.get("num").toString()) ;
                    break;
                case "3":
                    waitForServe += Integer.valueOf(tmp.get("num").toString()) ;
@ -1134,7 +1162,7 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
                    waitForServe += Integer.valueOf(tmp.get("num").toString()) ;
                    break;
                case "5":
                    served += Integer.valueOf(tmp.get("num").toString()) ;
                    waitForServe += Integer.valueOf(tmp.get("num").toString()) ;
                    break;
                case "6":
                    served += Integer.valueOf(tmp.get("num").toString()) ;
@ -1145,6 +1173,7 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
            }
        }
        map.put("all",all);
        map.put("waitForAccept",waitForAccept);
        map.put("waitForServe",waitForServe);
        map.put("served",served);
        map.put("cancel",cancel);
@ -1205,8 +1234,9 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
            sql+=" and o.doctor_name like '%"+serverDoctorName+"%'";
        }
        //获取医生代预约记录
        sql += " and o.type = " + type +" ";
        if (type!=null){
            sql += " and o.type = " + type +" ";
        }
        if(org.apache.commons.lang.StringUtils.isNotBlank(patientId)){
            sql += " and o.patient= '"+patientId+"' ";

+ 69 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/exam/ChildrenExaminationService.java

@ -0,0 +1,69 @@
package com.yihu.jw.care.service.exam;
import com.yihu.jw.care.dao.exam.ChildrenExaminationRecordDao;
import com.yihu.jw.entity.care.exam.ChildrenExaminationRecordDO;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * Created by Bing on 2021/5/18.
 */
@Service
public class ChildrenExaminationService extends BaseJpaService<ChildrenExaminationRecordDO, ChildrenExaminationRecordDao> {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private ChildrenExaminationRecordDao childrenExaminationRecordDao;
    public ChildrenExaminationRecordDO newRecord(String patient,String examTime,String monthAge,String height,String weight,String headCircumference){
        ChildrenExaminationRecordDO recordDO = new ChildrenExaminationRecordDO();
        recordDO.setType("2");//居家自检
        recordDO.setPatient(patient);
        Date recordDate = DateUtil.strToDate(examTime);
        recordDO.setExamTime(recordDate);
        recordDO.setMonthAge(monthAge);
        recordDO.setHeight(height);
        recordDO.setWeight(weight);
        recordDO.setHeadCircumference(headCircumference);
        this.save(recordDO);
        return recordDO;
    }
    public ChildrenExaminationRecordDO getRecordDetailById(String recordId){
        return childrenExaminationRecordDao.findOne(recordId);
    }
    public PageEnvelop getRecordList(String patient,String type,String orgCode,String startTime,String endTime,int page,int size){
        page=page>0?page-1:0;
        String sql = "select id,patient,type,DATE_FORMAT(exam_time,'%Y-%m-%d %H:%i:%S') examTime,org_code orgCode,org_name orgName,month_age monthAge,height,weight, " +
                "head_circumference headCircumference,DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%S') createTime from base_children_examination_record where patient ='"+patient+"' ";
        String sqlCount = "select count(id) from base_children_examination_record where patient ='"+patient+"' ";
        String sqlCondition=" ";
        if (StringUtils.isNotBlank(type)){
            sqlCondition += " and type='"+type+"' ";
        }
        if (StringUtils.isNotBlank(orgCode)){
            sqlCondition += " and org_code='"+orgCode+"' ";
        }
        if (StringUtils.isNotBlank(startTime)){
            sqlCondition += " and exam_time>='"+startTime+"' ";
        }
        if (StringUtils.isNotBlank(endTime)){
            sqlCondition += " and exam_time<='"+endTime+"' ";
        }
        Long count = jdbcTemplate.queryForObject(sqlCount+sqlCondition,Long.class);
        sqlCondition +=" order by exam_time,create_time desc limit "+(page*size)+","+size;
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql+sqlCondition);
        return PageEnvelop.getSuccessListWithPage("查询成功",list,page,size,count);
    }
}

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

@ -2,19 +2,25 @@ package com.yihu.jw.care.service.message;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.yihu.jw.care.dao.apply.PatientBedApplyDao;
import com.yihu.jw.care.dao.message.OrgNoticeDao;
import com.yihu.jw.care.dao.message.UserNoticeDao;
import com.yihu.jw.care.dao.security.SecurityMonitoringOrderDao;
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.notice.UserNoticeDO;
import com.yihu.jw.entity.care.message.OrgNoticeDO;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.entity.EntityUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import javax.persistence.criteria.CriteriaBuilder;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
@ -35,6 +41,10 @@ public class DoctorMessageService {
    private PatientBedApplyDao patientBedApplyDao;
    @Autowired
    private SecurityMonitoringOrderDao securityMonitoringOrderDao;
    @Autowired
    private OrgNoticeDao orgNoticeDao;
    @Autowired
    private UserNoticeDao userNoticeDao;
    /**
     *
@ -150,7 +160,7 @@ public class DoctorMessageService {
                        "SELECT 1 from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i ,\n" +
                        "base_team_member m where ord.patient = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and \n" +
                        "r.service_package_id = i.service_package_id and  m.team_code = i.team_code  and i.del = 1 and sr.`status`=1  and i.code='preventLost' \n" +
                        "and m.doctor_code = '13' and m.del = '1') ";
                        "and m.doctor_code = '"+doctor+"' and m.del = '1') ";
            }
            List<Map<String,Object>> sqlResult  = jdbcTemplate.queryForList(sql);
@ -177,7 +187,7 @@ public class DoctorMessageService {
                        "SELECT 1 from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i ,\n" +
                        "base_team_member m where ord.patient = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and \n" +
                        "r.service_package_id = i.service_package_id and  m.team_code = i.team_code  and i.del = 1 and sr.`status`=1  and i.code='emergencyAssistance' \n" +
                        "and m.doctor_code = '13' and m.del = '1')";
                        "and m.doctor_code = '"+doctor+"' and m.del = '1')";
            }
            List<Map<String,Object>> sqlResult  = jdbcTemplate.queryForList(sql);
@ -211,4 +221,61 @@ public class DoctorMessageService {
        return result;
    }
    public JSONObject newOrgNotice(String jsonDate, String[] patients){
        JSONObject result = new JSONObject();
        OrgNoticeDO orgNoticeDO = new OrgNoticeDO();
        try{
            orgNoticeDO  = EntityUtils.jsonToEntity(jsonDate, OrgNoticeDO.class);
        }catch (Exception e){
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            String failMsg = "参数转换成JSON对象异常:" + e.getMessage();
            result.put(ResponseContant.resultMsg, failMsg);
            return result;
        }
        orgNoticeDao.save(orgNoticeDO);
        for(String user:patients){
            UserNoticeDO userNoticeDO = new UserNoticeDO();
            userNoticeDO.setUserId(user);
            userNoticeDO.setDel(1);
            userNoticeDO.setIsRead(0);
            userNoticeDO.setNoticeId(orgNoticeDO.getId());
            userNoticeDao.save(userNoticeDO);
        }
        result.put(ResponseContant.resultFlag, ResponseContant.success);
        JSONObject Msg = JSONObject.parseObject(JSON.toJSONStringWithDateFormat(orgNoticeDO,"yyyy-MM-dd HH:mm:ss", SerializerFeature.WriteMapNullValue));
        result.put(ResponseContant.resultMsg, Msg);
        return result;
    }
    public PageEnvelop getOrgNoticeList(String orgCode,String createUser,String beginTime,String endTime,int page,int size){
        page = page>0?page-1:0;
        String sqlCount = "select count(id) from base_org_notice where del=1 ";
        String sql = "select id,title,org_code orgCode,org_name orgName,DATE_FORMAT(notice_time,'%Y-%m-%d %H:%i:%S') noticeTime,content,img from base_org_notice where del=1 ";
        String sqlCondition ="";
        if (StringUtils.isNotBlank(orgCode)){
            sqlCondition += " and org_code = '"+orgCode+"' ";
        }
        if (StringUtils.isNotBlank(createUser)){
            sqlCondition += " and create_user = '"+createUser+"' ";
        }
        if (StringUtils.isNotBlank(beginTime)){
            sqlCondition += " and notice_time >= '"+beginTime+"' ";
        }
        if (StringUtils.isNotBlank(endTime)){
            sqlCondition += " and notice_time <= '"+endTime+"' ";
        }
        if (StringUtils.isBlank(beginTime)&&StringUtils.isBlank(endTime)){
            String time = DateUtil.getStringDate();
            sqlCondition += " and notice_time <= '"+time+"' ";
        }
        Long count = jdbcTemplate.queryForObject(sqlCount+sqlCondition,Long.class);
        sqlCondition += " order by notice_time desc limit "+page*size+","+size;
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql+sqlCondition);
        return PageEnvelop.getSuccessListWithPage("查询成功",list,page,size,count);
    }
    public OrgNoticeDO orgNoticeDetail(String noticeId){
        return orgNoticeDao.findOne(noticeId);
    }
}

+ 67 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/message/PatientMessageService.java

@ -0,0 +1,67 @@
package com.yihu.jw.care.service.message;
import com.yihu.jw.care.dao.message.OrgNoticeDao;
import com.yihu.jw.care.dao.message.UserNoticeDao;
import com.yihu.jw.entity.base.notice.UserNoticeDO;
import com.yihu.jw.entity.care.message.OrgNoticeDO;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.util.date.DateUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
 * Created by Bing on 2021/5/19.
 */
@Service
public class PatientMessageService {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private OrgNoticeDao orgNoticeDao;
    @Autowired
    private UserNoticeDao userNoticeDao;
    public PageEnvelop getNoticeList(String patient,String beginTime, String endTime, int page, int size){
        page = page>0?page-1:0;
        String sqlCount = "select count(t.id) from base_org_notice t INNER JOIN base_user_notice usno on t.id = CONVERT(usno.notice_id USING utf8) and usno.del=1 " +
                "where t.del=1 ";
        String sql = "select t.id,t.title,t.org_code orgCode,t.org_name orgName,DATE_FORMAT(t.notice_time,'%Y-%m-%d %H:%i:%S') noticeTime, " +
                "t.content,t.img,usno.is_read isRead from base_org_notice t INNER JOIN base_user_notice usno on t.id = CONVERT(usno.notice_id USING utf8) " +
                "and usno.del=1 where t.del=1 ";
        String sqlCondition ="";
        if (StringUtils.isNotBlank(patient)){
            sqlCondition += " and usno.user_id = '"+patient+"' ";
        }
        if (StringUtils.isNotBlank(beginTime)){
            sqlCondition += " and t.notice_time >= '"+beginTime+"' ";
        }
        if (StringUtils.isNotBlank(endTime)){
            sqlCondition += " and t.notice_time <= '"+endTime+"' ";
        }
        String time = DateUtil.getStringDate();
        sqlCondition += " and t.notice_time <= '"+time+"' ";
        Long count = jdbcTemplate.queryForObject(sqlCount+sqlCondition,Long.class);
        sqlCondition += " order by t.notice_time desc limit "+page*size+","+size;
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql+sqlCondition);
        return PageEnvelop.getSuccessListWithPage("查询成功",list,page,size,count);
    }
    public OrgNoticeDO orgNoticeDetail(String noticeId,String patient){
        OrgNoticeDO orgNoticeDO =  orgNoticeDao.findOne(noticeId);
        if (orgNoticeDO!=null){
            UserNoticeDO userNoticeDO =  userNoticeDao.findByNoticeIdAndUserIdAndDel(orgNoticeDO.getId(),patient,1);
            if (userNoticeDO!=null){
                userNoticeDO.setIsRead(1);
                userNoticeDao.save(userNoticeDO);
            }
        }
        return orgNoticeDO;
    }
}

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

@ -20,6 +20,7 @@ import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.utils.StringUtil;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.security.MD5;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.stereotype.Service;
@ -224,4 +225,54 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
        saveDoctorPwlimitDate(id);*/
        return true;
    }
    public List<Map<String,Object>> getTeacherOrgList(String patient){
        String sql = "select Distinct sor.org_code,org.name from base_course_sales_order_record sor " +
                "INNER JOIN base_org org on sor.org_code = org.code " +
                "where sor.patient ='"+patient+"' and sor.`status` =3 " +
                "UNION " +
                "select DISTINCT rsr.org_code,org.name from base_recruit_students_record rsr INNER JOIN  " +
                "base_org org on rsr.org_code = org.`code` and org.del=1 " +
                "where rsr.patient='"+patient+"' and rsr.del<>0 and rsr.`status` = 3";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        return list;
    }
    /**
     *
     * @param patient
     * @param orgCode
     * @param deptCode
     * @param page
     * @param size
     * @return
     * 居民教育通讯录:购买课程的老师+入学机构的所有老师
     */
    public PageEnvelop getTeacherList(String patient,String orgCode,String deptCode,int page,int size){
        page = page>0?page-1:0;
        String sqlCount = "select count(DISTINCT doc.id) ";
        String sql=" select dh.org_code,dh.org_name,doc.id,doc.name,doc.mobile,doc.photo,dict.code deptCode,dict.name deptName, " +
                " dh.doctor_duty_code job,dh.doctor_duty_name jobName ";
        String sqlCondition = " from  " +
                "(select Distinct bc.doctor doctor,sor.org_code from base_course_sales_order_record sor INNER JOIN base_course bc on " +
                "sor.course_id = bc.id and bc.del=1 " +
                "where sor.patient ='"+patient+"'  and sor.`status` =3   GROUP BY bc.doctor  " +//购入课程
                "UNION " +
                "select DISTINCT dh.doctor_code doctor,rsr.org_code from base_recruit_students_record rsr INNER JOIN  " +
                "base_org org on rsr.org_code = org.`code` and org.del=1 INNER JOIN base_doctor_hospital dh on rsr.org_code = dh.org_code " +
                "and dh.del =1  " +
                "where rsr.patient='"+patient+"' and rsr.del<>0  and rsr.`status` = 3 GROUP BY dh.doctor_code " +//入学机构
                ")A INNER JOIN base_doctor_hospital dh on A.doctor =dh.doctor_code and a.org_code = dh.org_code " +
                "INNER JOIN base_doctor doc on dh.doctor_code = doc.id LEFT JOIN dict_hospital_dept dict on dh.dept_code = dict.`code` " +
                "and dh.org_code = dict.org_code and dh.del=1 where 1=1 ";
        if (StringUtils.isNotBlank(orgCode)){
            sqlCondition += " and dh.org_code = '"+orgCode+"' ";
        }
        if (StringUtils.isNotBlank(deptCode)){
            sqlCondition +=" and dict.code='"+deptCode+"' ";
        }
        Long cont = jdbcTemplate.queryForObject(sqlCount+sqlCondition,Long.class);
        sqlCondition +=" GROUP BY doc.id limit "+page*size+","+size;
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql+sqlCondition);
        return PageEnvelop.getSuccessListWithPage("查询成功",list,page,size,cont);
    }
}

+ 4 - 0
svr/svr-cloud-care/src/main/resources/application.yml

@ -74,6 +74,10 @@ fast-dfs:
configDefault: # 默认配置
  saasId: xmjkzl_saasId
tencent:
  secretId: AKIDa1C6k7D2astd6JGvKRJvFJ6dsrZ1C5h2
  secretKey: 7xWpsd7KGC3f16vUq0ucARRAcnhKfjX4
---
spring:
  profiles: jwdev