Browse Source

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

 Conflicts:
	common/common-entity/sql记录
liubing 3 years ago
parent
commit
b7da8099ce

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

@ -1007,3 +1007,28 @@ CREATE TABLE `base_doctor_patient_tmp` (
  KEY `patient` (`patient`),
  KEY `patient` (`patient`),
  KEY `type_doc_code` (`type`,`doctor_code`)
  KEY `type_doc_code` (`type`,`doctor_code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='教师医生通讯录埋点数据';
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='教师医生通讯录埋点数据';
-- 2021-06-02 ysj
CREATE TABLE `base_seq` (
  `val` int(11) NOT NULL,
  `type` tinyint(4) NOT NULL COMMENT '类型1生活照料'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='自增序列';
INSERT INTO `base`.`base_seq` (`val`, `type`) VALUES ('1000000001', '1');
CREATE FUNCTION seq(seq_type TINYINT (4)) returns int
begin
 UPDATE base_seq SET val=last_insert_id(val+1) WHERE type=seq_type;
 RETURN last_insert_id();
end;
alter table base_life_care_order add column doctor_sign_time datetime DEFAULT NULL COMMENT '医生签到时间';
alter table base_life_care_order add column doctor_sign_way tinyint(1) DEFAULT NULL COMMENT '医生签到方式:1-定位,2-扫码,3-拍照';
alter table base_life_care_order add column doctor_sign_location varchar(50) DEFAULT NULL COMMENT '医生签到位置,记录详细地址';
alter table base_life_care_order add column doctor_sign_img varchar(3000) DEFAULT NULL COMMENT '医生签到照片';
alter table base_life_care_order add column sign_doctor varchar(50) DEFAULT NULL COMMENT '签到医生';
alter table base_life_care_order add column sign_doctor_name varchar(50) DEFAULT NULL COMMENT '签到医生name';
-- 2021-06-07 ysj
alter table base_life_care_order add column conclusion_imgs varchar(3000) DEFAULT NULL COMMENT '小结照片';
alter table base_life_care_order add column conclusion_time datetime DEFAULT NULL COMMENT '小结时间';
alter table base_life_care_order add column conclusion_remark varchar(1200) DEFAULT NULL COMMENT '小结内容';

+ 122 - 2
common/common-entity/src/main/java/com/yihu/jw/entity/care/lifeCare/LifeCareOrderDO.java

@ -23,7 +23,8 @@ public class LifeCareOrderDO extends UuidIdentityEntityWithOperator {
    public enum Status {
    public enum Status {
        cancel(-1, "已取消"),
        cancel(-1, "已取消"),
        waitForAccept(1, "待(医生)接单"),
        waitForAccept(1, "待(医生)接单"),//待服务
        signIn(3, "已签到"),
        complete(2,"已完成");
        complete(2,"已完成");
        private Integer type;
        private Integer type;
@ -181,9 +182,23 @@ public class LifeCareOrderDO extends UuidIdentityEntityWithOperator {
     */
     */
    private String completeRemark;
    private String completeRemark;
    /**
     * 小结照片,最多6张,逗号分隔
     */
    private String conclusionImgs;
    /**
     * 服务小结
     */
    private String conclusionRemark;
    /**
     * 工单结时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date conclusionTime;
    /**
    /**
     * 工单状态:
     * 工单状态:
     * 待服务 1、已完成 2 、已取消 -1
     * 待服务 1、已完成 2 、已取消 -1 已签到 3、
     */
     */
    private Integer status;
    private Integer status;
@ -257,7 +272,34 @@ public class LifeCareOrderDO extends UuidIdentityEntityWithOperator {
    private String hospitalName;
    private String hospitalName;
    private Integer type;//发起工单类型(1本人发起 2家人待预约 3医生代预约)
    private Integer type;//发起工单类型(1本人发起 2家人待预约 3医生代预约)
    private String relationCode;//业务关联
    private String relationCode;//业务关联
    /**
     * 医生签到时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date doctorSignTime;
    /**
     * 医生签到方式:1-定位,2-扫码
     */
    private Integer doctorSignWay;
    /**
     * 医生签到位置,记录详细地址
     */
    private String doctorSignLocation;
    /**
     * 医生签到照片
     */
    private String doctorSignImg;
    /**
     *
     */
    private String signDoctor;
    /**
     * 签到医生姓名
     */
    private String signDoctorName;
    @Column(name = "number")
    @Column(name = "number")
    public String getNumber() {
    public String getNumber() {
@ -585,4 +627,82 @@ public class LifeCareOrderDO extends UuidIdentityEntityWithOperator {
        this.relationCode = relationCode;
        this.relationCode = relationCode;
    }
    }
    @Column(name = "doctor_sign_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getDoctorSignTime() {
        return doctorSignTime;
    }
    public void setDoctorSignTime(Date doctorSignTime) {
        this.doctorSignTime = doctorSignTime;
    }
    @Column(name = "doctor_sign_way")
    public Integer getDoctorSignWay() {
        return doctorSignWay;
    }
    public void setDoctorSignWay(Integer doctorSignWay) {
        this.doctorSignWay = doctorSignWay;
    }
    @Column(name = "doctor_sign_location")
    public String getDoctorSignLocation() {
        return doctorSignLocation;
    }
    public void setDoctorSignLocation(String doctorSignLocation) {
        this.doctorSignLocation = doctorSignLocation;
    }
    @Column(name = "doctor_sign_img")
    public String getDoctorSignImg() {
        return doctorSignImg;
    }
    public void setDoctorSignImg(String doctorSignImg) {
        this.doctorSignImg = doctorSignImg;
    }
    @Column(name = "sign_doctor")
    public String getSignDoctor() {
        return signDoctor;
    }
    public void setSignDoctor(String signDoctor) {
        this.signDoctor = signDoctor;
    }
    @Column(name = "sign_doctor_name")
    public String getSignDoctorName() {
        return signDoctorName;
    }
    public void setSignDoctorName(String signDoctorName) {
        this.signDoctorName = signDoctorName;
    }
    @Column(name = "conclusion_imgs")
    public String getConclusionImgs() {
        return conclusionImgs;
    }
    public void setConclusionImgs(String conclusionImgs) {
        this.conclusionImgs = conclusionImgs;
    }
    @Column(name = "conclusion_remark")
    public String getConclusionRemark() {
        return conclusionRemark;
    }
    public void setConclusionRemark(String conclusionRemark) {
        this.conclusionRemark = conclusionRemark;
    }
    @Column(name = "conclusion_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getConclusionTime() {
        return conclusionTime;
    }
    public void setConclusionTime(Date conclusionTime) {
        this.conclusionTime = conclusionTime;
    }
}
}

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

@ -145,7 +145,7 @@ public class RecruitStudentsRecordService extends BaseJpaService<RecruitStudents
     */
     */
    public synchronized String admission(String id){
    public synchronized String admission(String id){
        RecruitStudentsRecordDO recruitStudentsRecordDO = recruitStudentsRecordDao.findOne(id);
        RecruitStudentsRecordDO recruitStudentsRecordDO = recruitStudentsRecordDao.findOne(id);
        if("1".equals(recruitStudentsRecordDO.getStatus())){
        if(!"1".equals(recruitStudentsRecordDO.getStatus())){
            return "只有待审核状态的人员才能录取";
            return "只有待审核状态的人员才能录取";
        }
        }
        if(isAdmissionFull(recruitStudentsRecordDO.getRecruitStudentsId())){
        if(isAdmissionFull(recruitStudentsRecordDO.getRecruitStudentsId())){
@ -162,7 +162,7 @@ public class RecruitStudentsRecordService extends BaseJpaService<RecruitStudents
     */
     */
    public synchronized String refuse(String id){
    public synchronized String refuse(String id){
        RecruitStudentsRecordDO recruitStudentsRecordDO = recruitStudentsRecordDao.findOne(id);
        RecruitStudentsRecordDO recruitStudentsRecordDO = recruitStudentsRecordDao.findOne(id);
        if("1".equals(recruitStudentsRecordDO.getStatus())){
        if(!"1".equals(recruitStudentsRecordDO.getStatus())){
            return "只有待审核状态的人员才能拒绝";
            return "只有待审核状态的人员才能拒绝";
        }
        }
        recruitStudentsRecordDO.setStatus("4");
        recruitStudentsRecordDO.setStatus("4");

+ 4 - 4
svr/svr-base/src/main/resources/application.yml

@ -172,7 +172,7 @@ wlyy:
  url: http://ehr.yihu.com/wlyy/
  url: http://ehr.yihu.com/wlyy/
wechat:
wechat:
  id: hz_yyyzh_wx
  id: hz_yyyzh_wx
  url: http://hzijk.cityihealth.com/
  url: https://zhyzh.hzxc.gov.cn/
  flag: false
  flag: false
pay:
pay:
  flag: false
  flag: false
@ -611,7 +611,7 @@ spring:
      connection-timeout: 60000 # Connection timeout in milliseconds.
      connection-timeout: 60000 # Connection timeout in milliseconds.
      multi-threaded: true # Enable connection requests from multiple execution threads.
      multi-threaded: true # Enable connection requests from multiple execution threads.
  activemq:
  activemq:
    broker-url: tcp://10.18.43.40:61616
    broker-url: tcp://10.18.43.41:61616
    user: admin
    user: admin
    password: admin
    password: admin
  redis:
  redis:
@ -632,7 +632,7 @@ wlyy:
  url: 1
  url: 1
wechat:
wechat:
  id: hz_yyyzh_wx
  id: hz_yyyzh_wx
  url: http://hzijk.cityihealth.com/
  url: https://zhyzh.hzxc.gov.cn/
  flag: false
  flag: false
pay:
pay:
  flag: false
  flag: false
@ -641,4 +641,4 @@ testPattern:
  sign: 0
  sign: 0
  remote_inner_url: 1
  remote_inner_url: 1
im:
im:
  im_list_get: http://10.18.43.40:3000/
  im_list_get: http://10.18.43.41:3000/

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

@ -17,4 +17,6 @@ public interface RecruitStudentsRecordDao extends PagingAndSortingRepository<Rec
        JpaSpecificationExecutor<RecruitStudentsRecordDO> {
        JpaSpecificationExecutor<RecruitStudentsRecordDO> {
    List<RecruitStudentsRecordDO> findByRecruitStudentsIdAndStatus(String recruitStudentsId, String status);
    List<RecruitStudentsRecordDO> findByRecruitStudentsIdAndStatus(String recruitStudentsId, String status);
    List<RecruitStudentsRecordDO> findByOrgCodeAndStatus(String orgCode, String status);
}
}

+ 2 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/lifeCare/LifeCareOrderDao.java

@ -8,4 +8,6 @@ import org.springframework.data.repository.PagingAndSortingRepository;
 * Created by yeshijie on 2021/3/26.
 * Created by yeshijie on 2021/3/26.
 */
 */
public interface LifeCareOrderDao extends PagingAndSortingRepository<LifeCareOrderDO, String>, JpaSpecificationExecutor<LifeCareOrderDO> {
public interface LifeCareOrderDao extends PagingAndSortingRepository<LifeCareOrderDO, String>, JpaSpecificationExecutor<LifeCareOrderDO> {
    boolean existsByPatientAndStatusIn(String patient, Integer[] status);
}
}

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

@ -0,0 +1,110 @@
package com.yihu.jw.care.endpoint.course;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.service.course.RecruitStudentService;
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.*;
import java.util.List;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/6/8
 * @Description:
 */
@RestController
@RequestMapping("recruitStudent" )
@Api(tags = "招生-在线报名", description = "招生-在线报名")
public class RecruitStudentsEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private RecruitStudentService recruitStudentService;
    @GetMapping(value = "onlineRegisterCount")
    @ApiOperation("在线报名-已报名数量")
    public ObjEnvelop onlineRegisterCount(@ApiParam(name = "doctorId", value = "doctorId")
                                          @RequestParam(value = "doctorId", required = true) String doctorId){
        try {
            return ObjEnvelop.getSuccess("查询成功",recruitStudentService.onlineRegisterCount(doctorId));
        }catch (Exception e){
            return failedObjEnvelopException(e);
        }
    }
    @GetMapping(value = "queryInfoList")
    @ApiOperation(value = "查询在线报名记录")
    public PageEnvelop queryInfoList(
            @ApiParam(name = "doctorId", value = "教师id") @RequestParam(value = "doctorId", required = true) String doctorId,
            @ApiParam(name = "status", value = "工单状态,状态为全部时不传") @RequestParam(value = "status", required = false) Integer status,
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1") @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15") @RequestParam(value = "size") int size) {
        try {
            JSONObject result = recruitStudentService.queryInfoList(doctorId, status, page, size);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return PageEnvelop.getError(result.getString(ResponseContant.resultMsg), -1);
            }
            int count = result.getIntValue(ResponseContant.count);
            return success((List) result.get(ResponseContant.resultMsg), count, page, size);
        }catch (Exception e){
            return failedPageEnvelopException(e);
        }
    }
    @GetMapping(value = "onlineRegisterStatusCount")
    @ApiOperation(value = "统计在线报名各状态下的数量")
    public Envelop onlineRegisterStatusCount(
            @ApiParam(name = "doctorId", value = "教师id")
            @RequestParam(value = "doctorId", required = true) String doctorId) {
        try {
            JSONObject result = recruitStudentService.onlineRegisterStatusCount(doctorId);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return Envelop.getError(result.getString(ResponseContant.resultMsg),-1);
            }
            return success(result.get(ResponseContant.resultMsg));
        }catch (Exception e){
            return failedException(e);
        }
    }
    @PostMapping(value = "admission")
    @ApiOperation(value = "录取")
    public Envelop admission(
            @ApiParam(name = "id", value = "id", required = true)
            @RequestParam(value = "id") String id) {
        try{
            String re =  recruitStudentService.admission(id);
            if(re == null){
                return success("录取成功");
            }else {
                return Envelop.getError(re,-1);
            }
        }catch (Exception e){
            return failedException(e);
        }
    }
    @PostMapping(value = "refuse")
    @ApiOperation(value = "拒绝")
    public Envelop refuse(
            @ApiParam(name = "id", value = "id", required = true)
            @RequestParam(value = "id") String id) {
        try{
            recruitStudentService.refuse(id);
            return success("拒绝成功");
        }catch (Exception e){
            return failedException(e);
        }
    }
}

+ 79 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/lifeCare/DoctorLifeCareEndpoint.java

@ -89,11 +89,17 @@ public class DoctorLifeCareEndpoint extends EnvelopRestEndpoint {
            @ApiParam(value = "附件", name = "completeImgs")
            @ApiParam(value = "附件", name = "completeImgs")
            @RequestParam(value = "completeImgs", required = false) String completeImgs,
            @RequestParam(value = "completeImgs", required = false) String completeImgs,
            @ApiParam(value = "完成服务记录", name = "completeRemark")
            @ApiParam(value = "完成服务记录", name = "completeRemark")
            @RequestParam(value = "completeRemark", required = true) String completeRemark,
            @RequestParam(value = "completeRemark", required = false) String completeRemark,
            @ApiParam(value = "doctorId", name = "doctorId")
            @ApiParam(value = "doctorId", name = "doctorId")
            @RequestParam(value = "doctorId", required = true) String doctorId) {
            @RequestParam(value = "doctorId", required = true) String doctorId) {
        try {
        try {
           lifeCareOrderService.completeOrder(orderId, completeImgs, completeRemark,doctorId);
            Integer result = lifeCareOrderService.completeOrder(orderId, completeImgs, completeRemark,doctorId);
            if(result == 1){
                return Envelop.getError( "签到后才能记录服务" ,-1);
            }
            if(result == 2){
                return Envelop.getError( "只有工单的签到者才能记录服务" ,-1);
            }
            return Envelop.getSuccess("记录成功");
            return Envelop.getSuccess("记录成功");
        } catch (Exception e) {
        } catch (Exception e) {
            e.printStackTrace();
            e.printStackTrace();
@ -101,6 +107,31 @@ public class DoctorLifeCareEndpoint extends EnvelopRestEndpoint {
        }
        }
    }
    }
    @PostMapping("updateConclusion")
    @ApiOperation("编辑保存服务工单小结")
    public Envelop updateConclusion(
            @ApiParam(value = "工单id", name = "orderId")
            @RequestParam(value = "orderId", required = true) String orderId,
            @ApiParam(value = "附件", name = "conclusionImgs")
            @RequestParam(value = "conclusionImgs", required = false) String conclusionImgs,
            @ApiParam(value = "完成服务记录", name = "conclusionRemark")
            @RequestParam(value = "conclusionRemark", required = true) String conclusionRemark,
            @ApiParam(value = "doctorId", name = "doctorId")
            @RequestParam(value = "doctorId", required = true) String doctorId) {
        try {
            Integer result = lifeCareOrderService.updateConclusion(orderId, conclusionImgs, conclusionRemark,doctorId);
            if(result == 1){
                return Envelop.getError( "签到后才能登记服务小结" ,-1);
            }
            if(result == 2){
                return Envelop.getError( "只有工单的签到者才能登记服务小结" ,-1);
            }
            return Envelop.getSuccess("登记成功");
        } catch (Exception e) {
            return failedException(e);
        }
    }
    @GetMapping(value = "getPatientOrderList")
    @GetMapping(value = "getPatientOrderList")
    @ApiOperation(value = "医生查看居民工单列表")
    @ApiOperation(value = "医生查看居民工单列表")
    public PageEnvelop getPatientOrderList(
    public PageEnvelop getPatientOrderList(
@ -115,4 +146,50 @@ public class DoctorLifeCareEndpoint extends EnvelopRestEndpoint {
        }
        }
        return PageEnvelop.getError("查询失败");
        return PageEnvelop.getError("查询失败");
    }
    }
    @PostMapping(value = "proxyCreate")
    @ApiOperation(value = "创建生活照料--医生代预约")
    public Envelop proxyCreate(
            @ApiParam(name = "doctor", value = "医生id") @RequestParam(value = "doctor", required = true) String doctor,
            @ApiParam(name = "jsonData", value = "Json数据", required = true) @RequestParam String jsonData) {
        try{
            JSONObject result = lifeCareOrderService.create(jsonData,doctor);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return Envelop.getError(result.getString(ResponseContant.resultMsg),-1);
            }
            return success(result);
        }catch (Exception e){
            e.printStackTrace();
            return failedException(e);
        }
    }
    @PostMapping("signIn")
    @ApiOperation(value = "服务签到")
    @ObserverRequired
    public Envelop signIn(
            @ApiParam(value = "工单id", name = "orderId")
            @RequestParam(value = "orderId", required = true) String orderId,
            @ApiParam(value = "医生id", name = "doctorId")
            @RequestParam(value = "doctorId", required = true) String doctorId,
            @ApiParam(value = "签到时间", name = "signTime")
            @RequestParam(value = "signTime", required = false) String signTime,
            @ApiParam(value = "签到方式:1-定位,2-扫码,3-拍照,4-二维码", name = "signWay")
            @RequestParam(value = "signWay", required = false) Integer signWay,
            @ApiParam(value = "签到地址", name = "signLocation")
            @RequestParam(value = "signLocation", required = false) String signLocation,
            @ApiParam(value = "签到照片", name = "signImg")
            @RequestParam(value = "signImg", required = false) String signImg,
            @ApiParam(value = "二维码内容", name = "twoDimensionalCode")
            @RequestParam(value = "twoDimensionalCode", required = false) String twoDimensionalCode) {
        try {
            LifeCareOrderDO result = lifeCareOrderService.signIn(orderId, signTime, signWay, signLocation, signImg,twoDimensionalCode,doctorId);
            if (result==null) {
                return Envelop.getError("签到失败");
            }
            return success(result);
        } catch (Exception e) {
            return failedException(e);
        }
    }
}
}

+ 31 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/common/OrderNoService.java

@ -0,0 +1,31 @@
package com.yihu.jw.care.service.common;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/6/2
 * @Description:
 */
@Service
public class OrderNoService {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
     * 根据类型获取订单号
     * @param type
     * @return
     */
    public String getOrderNo(Integer type){
        String sql = "SELECT cast(seq("+type+") as char)";
        String orderNo = jdbcTemplate.queryForObject(sql,String.class);
        return orderNo;
    }
}

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

@ -0,0 +1,189 @@
package com.yihu.jw.care.service.course;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.dao.course.RecruitStudentsDao;
import com.yihu.jw.care.dao.course.RecruitStudentsRecordDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.care.course.RecruitStudentsDO;
import com.yihu.jw.entity.care.course.RecruitStudentsRecordDO;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.ResponseContant;
import org.apache.commons.collections.map.HashedMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/6/8
 * @Description:
 */
@Service
public class RecruitStudentService {
    @Autowired
    private BasePatientDao patientDao;
    @Autowired
    private BaseDoctorDao doctorDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private RecruitStudentsRecordDao recruitStudentsRecordDao;
    @Autowired
    private RecruitStudentsDao recruitStudentsDao;
    @Autowired
    private BaseDoctorHospitalDao baseDoctorHospitalDao;
    /**
     * 在线报名-已报名数量
     * @param doctorId
     * @return
     */
    public Integer onlineRegisterCount(String doctorId){
        List<BaseDoctorHospitalDO> baseDoctorHospitalDO = baseDoctorHospitalDao.findByDoctorCode(doctorId);
        List<RecruitStudentsRecordDO> list = recruitStudentsRecordDao.findByOrgCodeAndStatus(baseDoctorHospitalDO.get(0).getOrgCode(),"1");
        return list.size();
    }
    /**
     * 统计在线报名各状态下的数量
     *
     * @return
     */
    public JSONObject onlineRegisterStatusCount(String doctorId) {
        JSONObject result = new JSONObject();
        List<BaseDoctorHospitalDO> baseDoctorHospitalDO = baseDoctorHospitalDao.findByDoctorCode(doctorId);
        int total = 0;
        Map<String,Object> res = new HashedMap();
        //状态 已报名1  已录取2 未录取4 已退学8
        res.put("1",0);
        res.put("2",0);
        res.put("4",0);
        res.put("8",0);
        String countSql = "SELECT " +
                "  count(o.id) as count, " +
                "  o.status as status " +
                " FROM " +
                "  base_recruit_students_record o " +
                " WHERE " +
                "  o.org_code = '"+ baseDoctorHospitalDO.get(0).getOrgCode() + "' and o.del = 1 "+
                " GROUP BY o.`status`";
        List<Map<String,Object>> countMapList = jdbcTemplate.queryForList(countSql);
        for(Map<String,Object> map:countMapList){
            int c = Integer.valueOf(map.get("count").toString());
            total +=c;
            res.put(String.valueOf(map.get("status")),c);
        }
        res.put("total",total);
        result.put(ResponseContant.resultFlag, ResponseContant.success);
        result.put(ResponseContant.resultMsg, res);
        return result;
    }
    /**
     * 在线报名列表
     *
     * @return
     */
    public JSONObject queryInfoList(String doctorId,Integer status, int page, int size) {
        JSONObject result = new JSONObject();
        List<BaseDoctorHospitalDO> baseDoctorHospitalDO = baseDoctorHospitalDao.findByDoctorCode(doctorId);
        String orgCode = baseDoctorHospitalDO.get(0).getOrgCode();
        status = null == status ? -100 : status;
        int start = 0 == page ? page++ : (page - 1) * size;
        int end = 0 == size ? 15 : size;
        String sql = "SELECT o.id,o.patient,o.patient_name patientName,o.status,o.create_time createTime,p.photo  " +
                " FROM  base_recruit_students_record o" +
                " left join base_patient p on o.patient = p.id " +
                " WHERE o.org_code = '{org_code}' and o.del =1 "+
                " AND (o.`status` = {status} or -100 = {status})" +
                " ORDER BY o.create_time desc" +
                " LIMIT {start},{end} ";
        String finalSql = sql.replace("{org_code}", orgCode)
                .replace("{status}", String.valueOf(status))
                .replace("{start}", String.valueOf(start))
                .replace("{end}", String.valueOf(end));
        String countSql = "SELECT count(DISTINCT o.id) FROM base_recruit_students_record o " +
                " WHERE o.org_code = '{org_code}' and o.del =1 " +
                " AND (o.`status` = {status} or -100 = {status})";
        String finqlCountSql = countSql.replace("{org_code}", orgCode)
                .replace("{status}", String.valueOf(status));
        List<Map<String,Object>> sqlResultlist= jdbcTemplate.queryForList(finalSql);
        Integer count = jdbcTemplate.queryForObject(finqlCountSql, Integer.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 id
     * @return
     */
    public synchronized String admission(String id){
        RecruitStudentsRecordDO recruitStudentsRecordDO = recruitStudentsRecordDao.findOne(id);
        if(!"1".equals(recruitStudentsRecordDO.getStatus())){
            return "只有已报名状态的人员才能录取";
        }
        if(isAdmissionFull(recruitStudentsRecordDO.getRecruitStudentsId())){
            return "超过录取名额,无法录取";
        }
        recruitStudentsRecordDO.setStatus("2");
        recruitStudentsRecordDao.save(recruitStudentsRecordDO);
        return null;
    }
    /**
     * 是否录取满 true录取满了
     * @param id
     * @return
     */
    public synchronized boolean isAdmissionFull(String id){
        List<RecruitStudentsRecordDO> list = findListById(id);
        RecruitStudentsDO recruitStudentsDO = recruitStudentsDao.findOne(id);
        if(recruitStudentsDO.getNum()<=list.size()){
            return true;
        }
        return false;
    }
    public List<RecruitStudentsRecordDO> findListById(String id){
        String sql = "select * from base_recruit_students_record where recruit_students_id = '"+id+"' and status in ('2','3','6') and del =1 ";
        List<RecruitStudentsRecordDO> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(RecruitStudentsRecordDO.class));
        return list;
    }
    /**
     * 拒绝单个
     * @param id
     */
    public synchronized String refuse(String id){
        RecruitStudentsRecordDO recruitStudentsRecordDO = recruitStudentsRecordDao.findOne(id);
        if(!"1".equals(recruitStudentsRecordDO.getStatus())){
            return "只有已报名状态的人员才能拒绝";
        }
        recruitStudentsRecordDO.setStatus("4");
        recruitStudentsRecordDao.save(recruitStudentsRecordDO);
        return null;
    }
}

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

@ -1,10 +1,12 @@
package com.yihu.jw.care.service.lifeCare;
package com.yihu.jw.care.service.lifeCare;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.dao.lifeCare.LifeCareCancelLogDao;
import com.yihu.jw.care.dao.lifeCare.LifeCareCancelLogDao;
import com.yihu.jw.care.dao.lifeCare.LifeCareFeeDetailDao;
import com.yihu.jw.care.dao.lifeCare.LifeCareFeeDetailDao;
import com.yihu.jw.care.dao.lifeCare.LifeCareItemDictDao;
import com.yihu.jw.care.dao.lifeCare.LifeCareItemDictDao;
import com.yihu.jw.care.dao.lifeCare.LifeCareOrderDao;
import com.yihu.jw.care.dao.lifeCare.LifeCareOrderDao;
import com.yihu.jw.care.service.common.OrderNoService;
import com.yihu.jw.care.util.MessageUtil;
import com.yihu.jw.care.util.MessageUtil;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
@ -21,9 +23,11 @@ import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.entity.EntityUtils;
import com.yihu.jw.util.entity.EntityUtils;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.Logger;
@ -70,6 +74,29 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
    private BaseOrgDao baseOrgDao;
    private BaseOrgDao baseOrgDao;
    @Autowired
    @Autowired
    private BaseDoctorDao doctorDao;
    private BaseDoctorDao doctorDao;
    @Autowired
    private OrderNoService orderNoService;
    /**
     * 记录完成情况
     * @param orderId
     * @param conclusionImgs
     * @param conclusionRemark
     */
    public Integer updateConclusion(String orderId,String conclusionImgs,String conclusionRemark,String doctorId){
        LifeCareOrderDO lifeCareOrderDO = lifeCareOrderDao.findOne(orderId);
        if(!lifeCareOrderDO.getStatus().equals(LifeCareOrderDO.Status.signIn.getType())){
            return 1;
        }
        if(!doctorId.equals(lifeCareOrderDO.getSignDoctor())){
            return 2;
        }
        lifeCareOrderDO.setConclusionImgs(conclusionImgs);
        lifeCareOrderDO.setConclusionRemark(conclusionRemark);
        lifeCareOrderDO.setConclusionTime(new Date());
        lifeCareOrderDao.save(lifeCareOrderDO);
        return 0;
    }
    /**
    /**
     * 记录完成情况
     * 记录完成情况
@ -77,18 +104,23 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
     * @param complereImgs
     * @param complereImgs
     * @param completeRemark
     * @param completeRemark
     */
     */
    public void completeOrder(String orderId,String complereImgs,String completeRemark,String doctorId){
    public Integer completeOrder(String orderId,String complereImgs,String completeRemark,String doctorId){
        BaseDoctorDO doctorDO = doctorDao.findById(doctorId);
        BaseDoctorDO doctorDO = doctorDao.findById(doctorId);
        LifeCareOrderDO lifeCareOrderDO = lifeCareOrderDao.findOne(orderId);
        LifeCareOrderDO lifeCareOrderDO = lifeCareOrderDao.findOne(orderId);
        if(lifeCareOrderDO.getStatus().equals(LifeCareOrderDO.Status.waitForAccept.getType())){
            lifeCareOrderDO.setDoctor(doctorId);
            lifeCareOrderDO.setDoctorName(doctorDO.getName());
            lifeCareOrderDO.setStatus(2);
            lifeCareOrderDO.setCompleteImgs(complereImgs);
            lifeCareOrderDO.setCompleteRemark(completeRemark);
            lifeCareOrderDO.setCompleteTime(new Date());
            lifeCareOrderDao.save(lifeCareOrderDO);
        if(!lifeCareOrderDO.getStatus().equals(LifeCareOrderDO.Status.signIn.getType())){
            return 1;
        }
        }
        if(!doctorId.equals(lifeCareOrderDO.getSignDoctor())){
            return 2;
        }
        lifeCareOrderDO.setDoctor(doctorId);
        lifeCareOrderDO.setDoctorName(doctorDO.getName());
        lifeCareOrderDO.setStatus(2);
        lifeCareOrderDO.setCompleteImgs(complereImgs);
        lifeCareOrderDO.setCompleteRemark(completeRemark);
        lifeCareOrderDO.setCompleteTime(new Date());
        lifeCareOrderDao.save(lifeCareOrderDO);
        return 0;
    }
    }
@ -140,9 +172,10 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
        sql +=  "  WHERE  a.hospital = ? group BY a.status";
        sql +=  "  WHERE  a.hospital = ? group BY a.status";
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql, hospital);
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql, hospital);
        Map<String, Integer> map = new HashMap<>();
        Map<String, Integer> map = new HashMap<>();
        //状态 待服务 1、已完成 2 、已取消 -1
        //状态 待服务 1、已完成 2 、已取消 -1 已签到 3
        map.put("1",0);
        map.put("1",0);
        map.put("2",0);
        map.put("2",0);
        map.put("3",0);
        map.put("-1",0);
        map.put("-1",0);
        int total = 0;
        int total = 0;
        for (Map<String, Object> one:list){
        for (Map<String, Object> one:list){
@ -200,7 +233,7 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
                " ( base_life_care_order o " +
                " ( base_life_care_order o " +
                " LEFT JOIN base_patient p ON o.patient = p.id ) "+
                " LEFT JOIN base_patient p ON o.patient = p.id ) "+
                " WHERE " +
                " WHERE " +
                "  o.hospital = '{hospital}' and o.type != 3 " +buffer+
                "  o.hospital = '{hospital}' " +buffer+
                " AND ( o.`status` = {status} OR -100 = {status} ) " +
                " AND ( o.`status` = {status} OR -100 = {status} ) " +
                " ORDER BY o.create_time desc " +
                " ORDER BY o.create_time desc " +
                " LIMIT {start},{end};";
                " LIMIT {start},{end};";
@ -319,6 +352,7 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
        //状态 待服务 1、已完成 2 、已取消 -1
        //状态 待服务 1、已完成 2 、已取消 -1
        res.put("1",0);
        res.put("1",0);
        res.put("2",0);
        res.put("2",0);
        res.put("3",0);
        res.put("-1",0);
        res.put("-1",0);
        String countSql = "SELECT " +
        String countSql = "SELECT " +
                "  count(o.id) as count, " +
                "  count(o.id) as count, " +
@ -401,6 +435,7 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
        return result;
        return result;
    }
    }
    /**
    /**
     * 申请生活照料
     * 申请生活照料
     *
     *
@ -413,40 +448,33 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
        JSONObject result = new JSONObject();
        JSONObject result = new JSONObject();
        JSONObject jsonObjectParam;
        JSONObject jsonObjectParam;
        LifeCareOrderDO orderDO = null;
        try {
        try {
            jsonObjectParam = JSONObject.parseObject(jsonData);
            jsonObjectParam = JSONObject.parseObject(jsonData);
            if (jsonObjectParam.getJSONObject("order").getInteger("type")==1||jsonObjectParam.getJSONObject("order").getInteger("type")==2){
            orderDO = EntityUtils.jsonToEntity(jsonObjectParam.get("order").toString(), LifeCareOrderDO.class);
            Integer type = orderDO.getType();
            if (type==1||type==2){
                //本人或家人代发起
                //本人或家人代发起
                BasePatientDO patientDO = patientDao.findById(proxyPatient);
                BasePatientDO patientDO = patientDao.findById(proxyPatient);
                jsonObjectParam.put("proxyPatient",proxyPatient);
                jsonObjectParam.put("proxyPatientName",patientDO.getName());
                jsonObjectParam.put("proxyPatientPhone",patientDO.getMobile());
            }
            if (jsonObjectParam.getJSONObject("order").getInteger("type")==3) {//医生代发起
                orderDO.setProxyPatient(proxyPatient);
                orderDO.setProxyPatientName(patientDO.getName());
                orderDO.setProxyPatientPhone(patientDO.getMobile());
            }else if (type==3) {
                //医生代发起
                BaseDoctorDO doctorDO = doctorDao.findById(proxyPatient);
                BaseDoctorDO doctorDO = doctorDao.findById(proxyPatient);
                jsonObjectParam.put("proxyPatient",proxyPatient);
                jsonObjectParam.put("proxyPatientName",doctorDO.getName());
                jsonObjectParam.put("proxyPatientPhone",doctorDO.getMobile());
                orderDO.setProxyPatient(proxyPatient);
                orderDO.setProxyPatientName(doctorDO.getName());
                orderDO.setProxyPatientPhone(doctorDO.getMobile());
            }
            }
        } catch (Exception e) {
        } catch (Exception e) {
            e.printStackTrace();
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            String failMsg = "参数转换成JSON对象异常:" + e.getMessage();
            String failMsg = "参数转换成JSON对象异常:" + e.getMessage();
            result.put(ResponseContant.resultMsg, failMsg);
            result.put(ResponseContant.resultMsg, failMsg);
            logger.error(failMsg);
            logger.error(failMsg);
            return result;
            return result;
        }
        }
        LifeCareOrderDO orderDO = null;
        try {
            orderDO = EntityUtils.jsonToEntity(jsonObjectParam.get("order").toString(), LifeCareOrderDO.class);
        } catch (Exception e) {
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            String failMsg = "生活照料工单服务基本信息:" + e.getMessage();
            result.put(ResponseContant.resultMsg, failMsg);
            logger.error(failMsg);
            return result;
        }
        orderDO.setCreateTime(new Date());
        orderDO.setCreateUser(orderDO.getProxyPatient());
        orderDO.setCreateUser(orderDO.getProxyPatient());
        orderDO.setCreateUserName(orderDO.getProxyPatientName());
        orderDO.setCreateUserName(orderDO.getProxyPatientName());
@ -470,14 +498,9 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
            BaseOrgDO orgDO = baseOrgDao.findByCode(orderDO.getHospital());
            BaseOrgDO orgDO = baseOrgDao.findByCode(orderDO.getHospital());
            orderDO.setHospitalName(orgDO.getName());
            orderDO.setHospitalName(orgDO.getName());
        }
        }
        orderDO.setNumber(orderNoService.getOrderNo(1));
        orderDO.setCreateTime(new Date());
        orderDO.setCreateTime(new Date());
        //判断创建生活照料类型,发起类型(1本人发起 2家人待预约 3医生代预约)
        if(orderDO.getProxyPatient().equals(orderDO.getPatient())){
            orderDO.setType(1);
        }else if(!orderDO.getProxyPatient().equals(orderDO.getPatient())){
            orderDO.setType(2);
        }
        orderDO.setStatus(1);
        this.save(orderDO);
        this.save(orderDO);
        result.put("orderId",orderDO.getId());
        result.put("orderId",orderDO.getId());
@ -498,7 +521,7 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
            totalFee = new BigDecimal(0);
            totalFee = new BigDecimal(0);
        }
        }
        for ( LifeCareFeeDetailDO feeDetailDO : feeDetailDOList) {
        for (LifeCareFeeDetailDO feeDetailDO : feeDetailDOList) {
            try {
            try {
                //工单主表中记录总费用
                //工单主表中记录总费用
                totalFee = totalFee.add(feeDetailDO.getFee().multiply(BigDecimal.valueOf(feeDetailDO.getNumber())));
                totalFee = totalFee.add(feeDetailDO.getFee().multiply(BigDecimal.valueOf(feeDetailDO.getNumber())));
@ -542,6 +565,30 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
        return false;
        return false;
    }
    }
    @Transactional(rollbackFor = Exception.class)
    public boolean orderWithFeeDelete(JSONObject jsonObjectParam,LifeCareOrderDO orderDO) {
        BigDecimal totalFee = orderDO.getTotalFee();
        //删除的服务项
        JSONArray itemArray = jsonObjectParam.getJSONArray("deleteItemArr");
        if (!CollectionUtils.isEmpty(itemArray)) {
            List<LifeCareFeeDetailDO> list = new ArrayList<>();
            //删除的服务项要减去服务项费用
            BigDecimal itemFee = new BigDecimal(0);
            for(Object oneId : itemArray) {
                JSONObject oneIdJson = (JSONObject) oneId;
                LifeCareFeeDetailDO doorFeeDetail = lifeCareFeeDetailDao.findOne(String.valueOf(oneIdJson.get("id")));
                if(doorFeeDetail.getPayStatus()==0){
                    doorFeeDetail.setStatus(3);
                    doorFeeDetail.setUpdateTime(new Date());
                    list.add(doorFeeDetail);
                    itemFee = itemFee.add(doorFeeDetail.getFee().multiply(BigDecimal.valueOf(doorFeeDetail.getNumber())));
                }
            }
            lifeCareFeeDetailDao.save(list);
        }
        return false;
    }
    public PageEnvelop getPatientOrderList(String patient, Integer status, int page, int size) {
    public PageEnvelop getPatientOrderList(String patient, Integer status, int page, int size) {
        page = page>0?page-1:0;
        page = page>0?page-1:0;
@ -561,4 +608,138 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
    }
    }
    /**
     * 签到保存
     * @param orderId
     * @param signTime
     * @param signWay
     * @param signLocation
     * @param signImg
     * @return
     */
    public LifeCareOrderDO signIn(String orderId, String signTime, Integer signWay, String signLocation,
                             String signImg, String twoDimensionalCode,String doctorId) throws Exception {
        LifeCareOrderDO lifeCareOrderDO = this.lifeCareOrderDao.findOne(orderId);
        if(!LifeCareOrderDO.Status.waitForAccept.getType().equals(lifeCareOrderDO.getStatus())){
            //待服务状态才能签到
            logger.info("签到失败"+lifeCareOrderDO.getId()+":"+lifeCareOrderDO.getStatus());
            return null;
        }
        lifeCareOrderDO.setDoctorSignTime(DateUtil.strToDate(signTime));
        lifeCareOrderDO.setDoctorSignWay(signWay);
        // 签到方式-2扫码时,需要去解析地址
        lifeCareOrderDO.setDoctorSignLocation(signLocation);
        lifeCareOrderDO.setDoctorSignImg(StringUtils.isEmpty(signImg) ? null : signImg);
        //3 已签到
        lifeCareOrderDO.setStatus(3);
        BaseDoctorDO doctorDO = doctorDao.findById(doctorId);
        lifeCareOrderDO.setSignDoctor(doctorId);
        lifeCareOrderDO.setSignDoctorName(doctorDO.getName());
        lifeCareOrderDO.setUpdateTime(new Date());
        lifeCareOrderDO.setUpdateUser(doctorId);
        lifeCareOrderDO.setUpdateUserName(doctorDO.getName());
        if(signWay == 4 ){//扫码签到
            if (twoDimensionalCode.equals(lifeCareOrderDO.getNumber())){
                lifeCareOrderDO = lifeCareOrderDao.save(lifeCareOrderDO);
                return lifeCareOrderDO;
            }else {
                logger.info("扫码签到失败");
                return null;
            }
        }else {
            lifeCareOrderDO = lifeCareOrderDao.save(lifeCareOrderDO);
            return lifeCareOrderDO;
        }
    }
    /**
     * 生活照料代预约-- 废弃用原来的接口
     * @param jsonData
     * @param doctorCode
     * @return
     */
    @Transactional
    public JSONObject proxyCreate(String jsonData,String doctorCode) {
        JSONObject result = new JSONObject();
        JSONObject jsonObjectParam;
        try {
            jsonObjectParam = JSONObject.parseObject(jsonData);
        } catch (Exception e) {
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            String failMsg = "参数转换成JSON对象异常:" + e.getMessage();
            result.put(ResponseContant.resultMsg, failMsg);
            logger.error(failMsg);
            return result;
        }
        LifeCareOrderDO orderDO = null;
        try {
            orderDO = EntityUtils.jsonToEntity(jsonObjectParam.get("order").toString(), LifeCareOrderDO.class);
        } catch (Exception e) {
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            String failMsg = "生活照料工单服务基本信息:" + e.getMessage();
            result.put(ResponseContant.resultMsg, failMsg);
            logger.error(failMsg);
            return result;
        }
        if(StringUtils.isEmpty(orderDO.getPatient())){
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            String failMsg = "当前服务对象code为空,请联系管理员检查参数!patient = " + orderDO.getPatient();
            result.put(ResponseContant.resultMsg, failMsg);
            logger.error(failMsg);
            return result;
        }
        //医生代预约
        orderDO.setType(3);
        BaseDoctorDO doctorDO = doctorDao.findById(doctorCode);
        orderDO.setProxyPatient(doctorCode);
        orderDO.setProxyPatientName(doctorDO.getName());
        orderDO.setProxyPatientPhone(doctorDO.getMobile());
        //判断工单是否已存在,新建或者编辑
        if(StringUtils.isBlank(orderDO.getId())) {
            //已取消的订单也可以申请
            boolean bool = lifeCareOrderDao.existsByPatientAndStatusIn(orderDO.getPatient(),
                    new Integer[]{LifeCareOrderDO.Status.waitForAccept.getType()
                    });
            if(bool){
                String failMsg = "当前服务对象存在未完成的生活照料,请先完成该服务!";
                result.put(ResponseContant.resultFlag, ResponseContant.fail);
                result.put(ResponseContant.resultMsg, failMsg);
                logger.error(failMsg);
                return result;
            }
            orderDO.setNumber(orderNoService.getOrderNo(1));
            orderDO.setHospital(jsonObjectParam.getJSONObject("hospital").get("code").toString());
            orderDO.setCreateTime(new Date());
            orderDO.setCreateUser(orderDO.getProxyPatient());
            orderDO.setCreateUserName(orderDO.getProxyPatientName());
        }else {
            LifeCareOrderDO serviceOrderDO = lifeCareOrderDao.findOne(orderDO.getId());
            // 删除出诊医生或服务项
            Boolean b = this.orderWithFeeDelete(jsonObjectParam, serviceOrderDO);
            if(b){
                String failMsg = "删除服务项失败!";
                result.put(ResponseContant.resultFlag, ResponseContant.fail);
                result.put(ResponseContant.resultMsg, failMsg);
                return result;
            }
            orderDO.setNumber(serviceOrderDO.getNumber());
            orderDO.setHospital(serviceOrderDO.getHospital());
            orderDO.setUpdateTime(new Date());
            orderDO.setUpdateUser(orderDO.getProxyPatient());
            orderDO.setUpdateUserName(orderDO.getProxyPatientName());
        }
        orderDO.setStatus(2);
        orderDO.setType(3);
        this.save(orderDO);
        result.put("orderId",orderDO.getId());
        //新增工单与服务项费用关联关系
        if (orderWithPackageItemFeeAdd(result, jsonObjectParam, orderDO,doctorCode)) {return result;}
        result.put(ResponseContant.resultFlag, ResponseContant.success);
        return result;
    }
}
}

+ 6 - 6
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/wechat/WeiXinEventProcess.java

@ -144,36 +144,36 @@ public class WeiXinEventProcess {
    public void setUrlItems(List<Map<String, String>> articles) {
    public void setUrlItems(List<Map<String, String>> articles) {
        Map<String, String> articleBooking = new HashMap<>();
        Map<String, String> articleBooking = new HashMap<>();
        // 图文URL
        // 图文URL
        String urlBooking = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri=http%3A%2F%2Fhzijk.cityihealth.com%2Fmedical-care-patient%2Fhome%2Findex&amp;response_type=code&amp;scope=snsapi_base&amp;state=STATE#wechat_redirect";
        String urlBooking = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri=https%3A%2F%2Fzhyzh.hzxc.gov.cn%2Fmedical-care-patient%2Fhome%2Findex&amp;response_type=code&amp;scope=snsapi_base&amp;state=STATE#wechat_redirect";
        urlBooking = urlBooking.replace("{appId}", appId);
        urlBooking = urlBooking.replace("{appId}", appId);
        articleBooking.put("Url", urlBooking);
        articleBooking.put("Url", urlBooking);
        articleBooking.put("Title", "你好啊,欢迎来到朝晖云照护!");
        articleBooking.put("Title", "你好啊,欢迎来到朝晖云照护!");
        articleBooking.put("Description", "这里是智慧养老和健康管理服务社区+幼儿成长教育服务平台\n" +
        articleBooking.put("Description", "这里是智慧养老和健康管理服务社区+幼儿成长教育服务平台\n" +
                "我们陪你一起,关爱老人,呵护孩子!\n" +
                "我们陪你一起,关爱老人,呵护孩子!\n" +
                "感谢关注,点击下方菜单直接进入朝晖云照护平台");
                "感谢关注,点击下方菜单直接进入朝晖云照护平台");
        articleBooking.put("PicUrl", "http://hzijk.cityihealth.com/image/index.png");
        articleBooking.put("PicUrl", "https://zhyzh.hzxc.gov.cn/image/index.png");
        articles.add(articleBooking);
        articles.add(articleBooking);
        Map<String, String> articleDevice = new HashMap<>();
        Map<String, String> articleDevice = new HashMap<>();
        // 图文URL
        // 图文URL
        String urlDevice = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri=http%3A%2F%2Fhzijk.cityihealth.com%2Fmedical-care-patient%2FonlineRegistration%2Findex&amp;response_type=code&amp;scope=snsapi_base&amp;state=STATE#wechat_redirect";
        String urlDevice = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri=https%3A%2F%2Fzhyzh.hzxc.gov.cn%2Fmedical-care-patient%2FonlineRegistration%2Findex&amp;response_type=code&amp;scope=snsapi_base&amp;state=STATE#wechat_redirect";
        urlDevice = urlDevice.replace("{appId}", appId);
        urlDevice = urlDevice.replace("{appId}", appId);
        articleDevice.put("Url", urlDevice);
        articleDevice.put("Url", urlDevice);
        articleDevice.put("Title", "在线入园");
        articleDevice.put("Title", "在线入园");
        articleDevice.put("Description", "申请专业托育机构入园资格");
        articleDevice.put("Description", "申请专业托育机构入园资格");
        articleDevice.put("PicUrl", "http://hzijk.cityihealth.com/image/doorCoach.png");
        articleDevice.put("PicUrl", "https://zhyzh.hzxc.gov.cn/image/doorCoach.png");
        articles.add(articleDevice);
        articles.add(articleDevice);
        Map<String, String> articleFamily = new HashMap<>();
        Map<String, String> articleFamily = new HashMap<>();
        // 图文URL
        // 图文URL
        String urlFamily = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri=http%3A%2F%2Fhzijk.cityihealth.com%2Fmedical-care-patient%2FlifeCare%2Findex&amp;response_type=code&amp;scope=snsapi_base&amp;state=STATE#wechat_redirect";
        String urlFamily = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri=https%3A%2F%2Fzhyzh.hzxc.gov.cn%2Fmedical-care-patient%2FlifeCare%2Findex&amp;response_type=code&amp;scope=snsapi_base&amp;state=STATE#wechat_redirect";
        urlFamily = urlFamily.replace("{appId}", appId);
        urlFamily = urlFamily.replace("{appId}", appId);
        articleFamily.put("Url", urlFamily);
        articleFamily.put("Url", urlFamily);
        articleFamily.put("Title", "上门预约");
        articleFamily.put("Title", "上门预约");
        articleFamily.put("Description", "预约幼儿教育专家上门育儿指导");
        articleFamily.put("Description", "预约幼儿教育专家上门育儿指导");
        articleFamily.put("PicUrl", "http://hzijk.cityihealth.com/image/online.png");
        articleFamily.put("PicUrl", "https://zhyzh.hzxc.gov.cn/image/online.png");
        articles.add(articleFamily);
        articles.add(articleFamily);
    }
    }

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

@ -440,13 +440,13 @@ wechat:
  appId: wx2c55f5b7b2f3cb56
  appId: wx2c55f5b7b2f3cb56
  appSecret: 0dd9927e58125ad5f0efb9299860d145
  appSecret: 0dd9927e58125ad5f0efb9299860d145
  wechat_token: 27eb3bb24f149a7760cf1bb154b08041
  wechat_token: 27eb3bb24f149a7760cf1bb154b08041
  wechat_base_url: http%3A%2F%2Fhzijk.cityihealth.com%2Fcityihealth%2FcloudCare%2F
  wechat_base_url: https%3A%2F%2Fzhyzh.hzxc.gov.cn%2Fcityihealth%2FcloudCare%2F
  accId: gh_da06ed9e5751
  accId: gh_da06ed9e5751
  id: hz_yyyzh_wx  # base库中,wx_wechat 的id字段
  id: hz_yyyzh_wx  # base库中,wx_wechat 的id字段
  flag: true #演示环境  true走Mysql数据库  false走Oracle
  flag: true #演示环境  true走Mysql数据库  false走Oracle
im:
im:
  im_list_get: http://10.18.43.40:3000/
  im_list_get: http://10.18.43.41:3000/
  data_base_name: im_internet_hospital
  data_base_name: im_internet_hospital
es:
es:
  pwflag: 2 # 1需要密码,2不需要密码
  pwflag: 2 # 1需要密码,2不需要密码

+ 1 - 1
svr/svr-cloud-care/src/main/resources/wechat/weixin_menu.txt

@ -3,7 +3,7 @@
   {
   {
	  "name":"进入云照护",
	  "name":"进入云照护",
	  "type":"view",
	  "type":"view",
      "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx2c55f5b7b2f3cb56&redirect_uri=http%3A%2F%2Fhzijk.cityihealth.com%2Fmedical-care-patient%2Fhome%2Findex&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
      "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx2c55f5b7b2f3cb56&redirect_uri=https%3A%2F%2Fzhyzh.hzxc.gov.cn%2Fmedical-care-patient%2Fhome%2Findex&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
   }
   }
]
]
}
}

+ 11 - 11
svr/svr-cloud-job/src/main/resources/application.yml

@ -24,7 +24,7 @@ spring:
    time-between-eviction-runs-millis: 300000 #在空闲连接回收器线程运行期间休眠的时间值,以毫秒为单位,一般比minEvictableIdleTimeMillis小
    time-between-eviction-runs-millis: 300000 #在空闲连接回收器线程运行期间休眠的时间值,以毫秒为单位,一般比minEvictableIdleTimeMillis小
fast-dfs:
fast-dfs:
  tracker-server: 172.26.0.110:22122 #服务器地址
  tracker-server: 10.18.43.40:22122 #服务器地址
  connect-timeout: 2 #链接超时时间
  connect-timeout: 2 #链接超时时间
  network-timeout: 30
  network-timeout: 30
  charset: ISO8859-1 #编码
  charset: ISO8859-1 #编码
@ -134,7 +134,7 @@ wechat:
  appId: wx2c55f5b7b2f3cb56
  appId: wx2c55f5b7b2f3cb56
  appSecret: 0dd9927e58125ad5f0efb9299860d145
  appSecret: 0dd9927e58125ad5f0efb9299860d145
  wechat_token: 27eb3bb24f149a7760cf1bb154b08041
  wechat_token: 27eb3bb24f149a7760cf1bb154b08041
  wechat_base_url: http%3A%2F%2Fhzijk.cityihealth.com%2Fcityihealth%2FcloudCare%2F
  wechat_base_url: https%3A%2F%2Fzhyzh.hzxc.gov.cn%2Fcityihealth%2FcloudCare%2F
  accId: gh_da06ed9e5751
  accId: gh_da06ed9e5751
  id: hz_yyyzh_wx  # base库中,wx_wechat 的id字段
  id: hz_yyyzh_wx  # base库中,wx_wechat 的id字段
  flag: true #演示环境  true走Mysql数据库  false走Oracle
  flag: true #演示环境  true走Mysql数据库  false走Oracle
@ -147,9 +147,9 @@ spring:
  profiles: hzprod
  profiles: hzprod
  datasource:
  datasource:
    driver-class-name: com.mysql.jdbc.Driver
    driver-class-name: com.mysql.jdbc.Driver
    url: jdbc:mysql://172.26.0.13:3306/base?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true&useSSL=false
    username: root
    password: '*ukOOSl&c0!y'
    url: jdbc:mysql://10.18.43.40:3306/base?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true&useSSL=false
    username: wlyy
    password: '0XxS3W*!cRj'
  #  elasticsearch:
  #  elasticsearch:
  #    cluster-name: jkzl #集群名 默认elasticsearch
  #    cluster-name: jkzl #集群名 默认elasticsearch
  #    cluster-nodes: 172.26.0.115:9300,172.26.0.115:9300 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
  #    cluster-nodes: 172.26.0.115:9300,172.26.0.115:9300 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
@ -159,7 +159,7 @@ spring:
  #      connection-timeout: 60000 # Connection timeout in milliseconds.
  #      connection-timeout: 60000 # Connection timeout in milliseconds.
  #      multi-threaded: true # Enable connection requests from multiple execution threads.
  #      multi-threaded: true # Enable connection requests from multiple execution threads.
  activemq:
  activemq:
    broker-url: tcp://172.26.0.13:61616
    broker-url: tcp://10.18.43.40:61616
    user: admin
    user: admin
    password: admin
    password: admin
  redis:
  redis:
@ -167,9 +167,9 @@ spring:
    port: 6379  # Redis server port.
    port: 6379  # Redis server port.
    password: Kb6wKDQP1W4
    password: Kb6wKDQP1W4
fastDFS:
fastDFS:
  fastdfs_file_url: http://172.26.0.13:8888/
  fastdfs_file_url: http://10.18.43.40:8888/
fast-dfs:
fast-dfs:
  tracker-server: 172.26.0.13:22122 #服务器地址
  tracker-server: 10.18.43.40:22122 #服务器地址
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
demo:
  flag: false
  flag: false
@ -180,7 +180,7 @@ hospital:
  SourceSysCode: S60
  SourceSysCode: S60
  TargetSysCode: S01
  TargetSysCode: S01
im:
im:
  im_list_get: http://172.26.0.12:3000/
  im_list_get: http://10.18.43.41:3000/
  data_base_name: im_internet_hospital
  data_base_name: im_internet_hospital
wlyy:
wlyy:
@ -189,11 +189,11 @@ wechat:
  appId: wx2c55f5b7b2f3cb56
  appId: wx2c55f5b7b2f3cb56
  appSecret: 0dd9927e58125ad5f0efb9299860d145
  appSecret: 0dd9927e58125ad5f0efb9299860d145
  wechat_token: 27eb3bb24f149a7760cf1bb154b08041
  wechat_token: 27eb3bb24f149a7760cf1bb154b08041
  wechat_base_url: http%3A%2F%2Fhzijk.cityihealth.com%2Fcityihealth%2FcloudCare%2F
  wechat_base_url: https%3A%2F%2Fzhyzh.hzxc.gov.cn%2Fcityihealth%2FcloudCare%2F
  accId: gh_da06ed9e5751
  accId: gh_da06ed9e5751
  id: hz_yyyzh_wx  # base库中,wx_wechat 的id字段
  id: hz_yyyzh_wx  # base库中,wx_wechat 的id字段
  flag: true #演示环境  true走Mysql数据库  false走Oracle
  flag: true #演示环境  true走Mysql数据库  false走Oracle
cloudServer:
cloudServer:
  server_url: http://172.26.0.12:10301/
  server_url: http://10.18.43.41:10301/
pay:
pay:
  flag: true
  flag: true