瀏覽代碼

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

wangzhinan 4 年之前
父節點
當前提交
25fb231261
共有 19 個文件被更改,包括 429 次插入26 次删除
  1. 2 1
      common/common-entity/sql记录
  2. 12 1
      common/common-entity/src/main/java/com/yihu/jw/entity/door/WlyyDoorFeeDetailDO.java
  3. 67 2
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/SpecialistPatientRelationDO.java
  4. 58 1
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/rehabilitation/PatientRehabilitationPlanDO.java
  5. 58 1
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/rehabilitation/RehabilitationDetailDO.java
  6. 59 1
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/rehabilitation/RehabilitationOperateRecordsDO.java
  7. 1 1
      common/common-util/src/main/java/com/yihu/jw/util/date/DateUtil.java
  8. 0 1
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/doctor/DoorOrderController.java
  9. 15 0
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/patient/PatientController.java
  10. 23 2
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/patient/WlyyDoorServiceOrderController.java
  11. 8 0
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/dao/WlyyDoorFeeDetailDao.java
  12. 3 1
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/DoorOrderService.java
  13. 23 1
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/WlyyDoorServiceOrderService.java
  14. 13 0
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/common/ServerPackageService.java
  15. 2 1
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/controller/SpecialistController.java
  16. 1 1
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/dao/SpecialistPatientRelationDao.java
  17. 1 0
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/dao/rehabilitation/PatientRehabilitationPlanDao.java
  18. 81 11
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/SpecialistService.java
  19. 2 0
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/rehabilitation/RehabilitationManageService.java

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

@ -67,6 +67,7 @@ CREATE TABLE `wlyy_followup_drugs` (
) ENGINE=InnoDB AUTO_INCREMENT=436 DEFAULT CHARSET=utf8mb4 COMMENT='随访用药记录';
-- 2021-01-19 ysj 上门服务项费用相关
ALTER TABLE wlyy_door_fee_detail ADD pay_status TINYINT(1) COMMENT '付款状态:0未付款 1已付款' ;

+ 12 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/door/WlyyDoorFeeDetailDO.java

@ -112,6 +112,11 @@ public class WlyyDoorFeeDetailDO extends UuidIdentityEntityWithOperator {
	 */
	private Integer status;
    /**
     * 付款状态:0未付款 1已付款
     */
    private Integer payStatus;
	@Column(name = "order_id")
    public String getOrderId() {
@ -177,6 +182,12 @@ public class WlyyDoorFeeDetailDO extends UuidIdentityEntityWithOperator {
        this.status = status;
    }
    @Column(name = "pay_status")
    public Integer getPayStatus() {
        return payStatus;
    }
    public void setPayStatus(Integer payStatus) {
        this.payStatus = payStatus;
    }
}

+ 67 - 2
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/SpecialistPatientRelationDO.java

@ -1,6 +1,7 @@
package com.yihu.jw.entity.specialist;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntity;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
@ -14,7 +15,7 @@ import java.util.Date;
 */
@Entity
@Table(name = "wlyy_specialist_patient_relation")
public class SpecialistPatientRelationDO extends UuidIdentityEntityWithOperator implements Serializable {
public class SpecialistPatientRelationDO extends UuidIdentityEntity implements Serializable {
    @Column(name = "saas_id")
    private String saasId;
@ -87,7 +88,13 @@ public class SpecialistPatientRelationDO extends UuidIdentityEntityWithOperator
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "manage_time")
    private Date manageTime;
    private Date createTime;
    private String createUser;
    private String createUserName;
    private Date updateTime;
    private String updateUser;
    private String updateUserName;
    private String remindTime;
    public String getSaasId() {
        return saasId;
@ -298,4 +305,62 @@ public class SpecialistPatientRelationDO extends UuidIdentityEntityWithOperator
    public void setManageTime(Date manageTime) {
        this.manageTime = manageTime;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getCreateUser() {
        return createUser;
    }
    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }
    public String getCreateUserName() {
        return createUserName;
    }
    public void setCreateUserName(String createUserName) {
        this.createUserName = createUserName;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public String getUpdateUser() {
        return updateUser;
    }
    public void setUpdateUser(String updateUser) {
        this.updateUser = updateUser;
    }
    public String getUpdateUserName() {
        return updateUserName;
    }
    public void setUpdateUserName(String updateUserName) {
        this.updateUserName = updateUserName;
    }
    public String getRemindTime() {
        return remindTime;
    }
    public void setRemindTime(String remindTime) {
        this.remindTime = remindTime;
    }
}

+ 58 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/rehabilitation/PatientRehabilitationPlanDO.java

@ -1,6 +1,7 @@
package com.yihu.jw.entity.specialist.rehabilitation;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntity;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
@ -14,7 +15,7 @@ import java.util.Date;
 */
@Entity
@Table(name = "wlyy_patient_rehabilitation_plan")
public class PatientRehabilitationPlanDO extends UuidIdentityEntityWithOperator implements Serializable {
public class PatientRehabilitationPlanDO extends UuidIdentityEntity implements Serializable{
    @Column(name = "saas_id")
    private String saasId;
@ -50,6 +51,12 @@ public class PatientRehabilitationPlanDO extends UuidIdentityEntityWithOperator
    private String adviceContent;//康复建议(wlyy_rehabilitation_advice 的content)
    @Column(name = "team_code")
    private Integer teamCode;//专科医生签约团队
    private Date createTime;
    private String createUser;
    private String createUserName;
    private Date updateTime;
    private String updateUser;
    private String updateUserName;
    private String healthStatusCode;//健康情况
@ -213,4 +220,54 @@ public class PatientRehabilitationPlanDO extends UuidIdentityEntityWithOperator
    public void setHealthStatusCode(String healthStatusCode) {
        this.healthStatusCode = healthStatusCode;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getCreateUser() {
        return createUser;
    }
    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }
    public String getCreateUserName() {
        return createUserName;
    }
    public void setCreateUserName(String createUserName) {
        this.createUserName = createUserName;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public String getUpdateUser() {
        return updateUser;
    }
    public void setUpdateUser(String updateUser) {
        this.updateUser = updateUser;
    }
    public String getUpdateUserName() {
        return updateUserName;
    }
    public void setUpdateUserName(String updateUserName) {
        this.updateUserName = updateUserName;
    }
}

+ 58 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/rehabilitation/RehabilitationDetailDO.java

@ -2,6 +2,7 @@ package com.yihu.jw.entity.specialist.rehabilitation;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntity;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
@ -15,7 +16,7 @@ import java.util.Date;
 */
@Entity
@Table(name = "wlyy_rehabilitation_plan_detail")
public class RehabilitationDetailDO extends UuidIdentityEntityWithOperator implements Serializable {
public class RehabilitationDetailDO extends UuidIdentityEntity implements Serializable {
    @Column(name = "saas_id")
    private String saasId;
@ -52,6 +53,12 @@ public class RehabilitationDetailDO extends UuidIdentityEntityWithOperator imple
    private String relationCode;//业务关联code
    private Integer reservationType;//复诊类型:1线上,2线下,3远程
    private Date createTime;
    private String createUser;
    private String createUserName;
    private Date updateTime;
    private String updateUser;
    private String updateUserName;
    @Column(name = "reservation_type")
    public Integer getReservationType() {
@ -206,4 +213,54 @@ public class RehabilitationDetailDO extends UuidIdentityEntityWithOperator imple
    public void setRelationCode(String relationCode) {
        this.relationCode = relationCode;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getCreateUser() {
        return createUser;
    }
    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }
    public String getCreateUserName() {
        return createUserName;
    }
    public void setCreateUserName(String createUserName) {
        this.createUserName = createUserName;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public String getUpdateUser() {
        return updateUser;
    }
    public void setUpdateUser(String updateUser) {
        this.updateUser = updateUser;
    }
    public String getUpdateUserName() {
        return updateUserName;
    }
    public void setUpdateUserName(String updateUserName) {
        this.updateUserName = updateUserName;
    }
}

+ 59 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/rehabilitation/RehabilitationOperateRecordsDO.java

@ -1,5 +1,7 @@
package com.yihu.jw.entity.specialist.rehabilitation;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntity;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
@ -13,7 +15,7 @@ import java.util.Date;
 */
@Entity
@Table(name = "wlyy_rehabilitation_operate_records")
public class RehabilitationOperateRecordsDO extends UuidIdentityEntityWithOperator implements Serializable {
public class RehabilitationOperateRecordsDO extends UuidIdentityEntity implements Serializable {
    private String saasId;
    private String rehabilitationDetailId;//康复计划明细表id
    private String patientCode;//居民code
@ -29,6 +31,12 @@ public class RehabilitationOperateRecordsDO extends UuidIdentityEntityWithOperat
    private String node;//服务完成笔记
    private String relationCode;//业务id
    private String flag;//标记(1随访2临时随访)
    private Date createTime;
    private String createUser;
    private String createUserName;
    private Date updateTime;
    private String updateUser;
    private String updateUserName;
    @Column(name = "saas_id")
    public String getSaasId() {
@ -164,4 +172,54 @@ public class RehabilitationOperateRecordsDO extends UuidIdentityEntityWithOperat
    public void setFlag(String flag) {
        this.flag = flag;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getCreateUser() {
        return createUser;
    }
    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }
    public String getCreateUserName() {
        return createUserName;
    }
    public void setCreateUserName(String createUserName) {
        this.createUserName = createUserName;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public String getUpdateUser() {
        return updateUser;
    }
    public void setUpdateUser(String updateUser) {
        this.updateUser = updateUser;
    }
    public String getUpdateUserName() {
        return updateUserName;
    }
    public void setUpdateUserName(String updateUserName) {
        this.updateUserName = updateUserName;
    }
}

+ 1 - 1
common/common-util/src/main/java/com/yihu/jw/util/date/DateUtil.java

@ -905,7 +905,7 @@ public class DateUtil {
    public static int getSignYear(){
        Calendar ca = Calendar.getInstance();
        if(getNowMonth()>=4){
        if(getNowMonth()>=7){
            return getNowYear();
        }
        return getNowYear()-1;

+ 0 - 1
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/doctor/DoorOrderController.java

@ -546,7 +546,6 @@ public class DoorOrderController extends BaseController {
    @RequestMapping(value = "selectServiceTypes", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "获取服务项目类型-上门服务")
    public String selectServiceTypes(){
        try {

+ 15 - 0
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/patient/PatientController.java

@ -2,6 +2,7 @@ package com.yihu.jw.door.controller.patient;
import com.yihu.jw.door.controller.BaseController;
import com.yihu.jw.door.dao.common.SignFamilyDao;
import com.yihu.jw.door.service.common.ServerPackageService;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.door.SignFamily;
@ -19,6 +20,7 @@ import org.springframework.http.MediaType;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
@ -43,6 +45,19 @@ public class PatientController extends BaseController {
    private BasePatientMedicareCardDao patientMedicareCardDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private ServerPackageService serverPackageService;
    @RequestMapping(value = "serviceOrder/selectServiceTypes", method = RequestMethod.POST)
    @ApiOperation(value = "获取服务项目类型-上门服务")
    public String selectServiceTypes(){
        try {
            return write(200, "查询成功", "data",serverPackageService.selectPatientTypes());
        } catch (Exception ex) {
            error(ex);
            return error(-1, "查询失败");
        }
    }
    @GetMapping(value = "getProfessionalDict")
    @ApiOperation("职业状态字典")

+ 23 - 2
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/patient/WlyyDoorServiceOrderController.java

@ -283,7 +283,6 @@ public class WlyyDoorServiceOrderController extends EnvelopRestEndpoint {
    }
    @GetMapping(value = "getPrescriptionByCode")
    @ResponseBody
    @ApiOperation("获取长处方详情")
    public Envelop getPrescriptionByCode(@ApiParam(name = "recipeNo", value = "挂号号",required = true)
                                         @RequestParam String recipeNo) {
@ -296,7 +295,6 @@ public class WlyyDoorServiceOrderController extends EnvelopRestEndpoint {
    }
    @GetMapping(value = "getProxyPatientList")
    @ResponseBody
    @ApiOperation("获取代预约服务对象列表")
    public Envelop getProxyPatientList() {
        try {
@ -307,5 +305,28 @@ public class WlyyDoorServiceOrderController extends EnvelopRestEndpoint {
        }
    }
    @GetMapping(value = "getServiceItemFees")
    @ApiOperation("获取未付款的服务项")
    public Envelop getServiceItemFees(@ApiParam(name = "orderId", value = "订单id",required = true)
                                         @RequestParam String orderId) {
        try {
            JSONObject json = wlyyDoorServiceOrderService.getServiceItemFees(orderId);
            return success(json);
        } catch (Exception e) {
            return failed(e.getMessage());
        }
    }
    @PostMapping(value = "payServiceItemFees")
    @ApiOperation("付服务项费用")
    public Envelop payServiceItemFees(@ApiParam(name = "ids", value = "订单id",required = true)
                                      @RequestParam String[] ids) {
        try {
            wlyyDoorServiceOrderService.payServiceItemFees(ids);
            return success();
        } catch (Exception e) {
            return failed(e.getMessage());
        }
    }
}

+ 8 - 0
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/dao/WlyyDoorFeeDetailDao.java

@ -2,6 +2,7 @@ package com.yihu.jw.door.dao;
import com.yihu.jw.entity.door.WlyyDoorFeeDetailDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
@ -29,6 +30,13 @@ public interface WlyyDoorFeeDetailDao extends PagingAndSortingRepository<WlyyDoo
    @Query("select d from WlyyDoorFeeDetailDO d where d.orderId = ?1 and d.type=?2 and d.status <> 3")
    List<WlyyDoorFeeDetailDO> findByOrderIdAndType(String orderId, Integer type);
    @Query("select d from WlyyDoorFeeDetailDO d where d.orderId = ?1 and d.payStatus=?2 and d.status <> 3")
    List<WlyyDoorFeeDetailDO> findByOrderIdAndPayStatus(String orderId, Integer payStatus);
    @Query("select d.id as id,d.fee as fee,d.orderId as orderId from WlyyDoorFeeDetailDO d where d.code in(:codes) and d.type = :type")
    List<Map<String,Object>> findIdByCodeAndType(@Param("codes") List<String> codes, @Param("type") Integer type);
    @Modifying
    @Query("update WlyyDoorFeeDetailDO  set payStatus = 1 where id in (?1) ")
    int updatePayStatusById(String[] ids);
}

+ 3 - 1
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/DoorOrderService.java

@ -552,7 +552,9 @@ public class DoorOrderService {
        JSONArray docArr = new JSONArray();
        docArr.add(doc);
        jsonObjectParam.put("doctorArr",docArr);
        if (wlyyDoorServiceOrderService.orderWithDoctorAdd(new JSONObject(), jsonObjectParam, doorServiceOrder)) return null;
        if (wlyyDoorServiceOrderService.orderWithDoctorAdd(new JSONObject(), jsonObjectParam, doorServiceOrder)){
            return null;
        }
        doorServiceOrderDao.save(doorServiceOrder);

+ 23 - 1
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/WlyyDoorServiceOrderService.java

@ -250,7 +250,7 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
                    orderItemDO.setDoctor(order.getDoctor());
                    orderItemDO.setCode(feeDetailDO.getCode());
                    orderItemDO.setCreateTime(new Date());
                    orderItemDO.setPatient(orderItemDO.getPatient());
                    orderItemDO.setPatient(order.getPatient());
                    orderItemDOList.add(orderItemDO);
                } catch (Exception e) {
                    result.put(ResponseContant.resultFlag, ResponseContant.fail);
@ -277,6 +277,7 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
                }else{
                    feeDetailDO.setStatus(status);
                }
                feeDetailDO.setPayStatus(0);
//                feeDetailDO.setNumber(1);
                feeDetailDO.setOrderId(order.getId());
                if(StringUtils.isBlank(feeDetailDO.getId())) {
@ -2929,4 +2930,25 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
        result.put(ResponseContant.resultMsg, wlyyDoorServiceOrder);
        return result;
    }
    /**
     * 获取未付款的服务项
     * @param orderId
     * @return
     */
    public JSONObject getServiceItemFees(String orderId){
        JSONObject json = new JSONObject();
        List<WlyyDoorFeeDetailDO> feeDetailDOs = wlyyDoorFeeDetailDao.findByOrderIdAndPayStatus(orderId, 0);
        BigDecimal sum = feeDetailDOs.stream().map(WlyyDoorFeeDetailDO::getFee).reduce(BigDecimal::add).get();
        sum = sum.setScale(1, BigDecimal.ROUND_DOWN);
        json.put("orderId",orderId);
        json.put("sum",sum);
        json.put("feeDetailDOs",feeDetailDOs);
        return json;
    }
    @Transactional
    public void payServiceItemFees(String[] ids){
        wlyyDoorFeeDetailDao.updatePayStatusById(ids);
    }
}

+ 13 - 0
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/common/ServerPackageService.java

@ -137,7 +137,20 @@ public class ServerPackageService  {
        return mapList;
    }
    /**
     * 居民端服务项类型
     * @return
     */
    public List<Map<String,Object>> selectPatientTypes(){
        String sql = "SELECT code,value type from base_system_dict_entry WHERE dict_code = 'door_service_subject_class_dict' and code = 'door'";
        List<Map<String,Object>> mapList = jdbcTemplate.queryForList(sql);
        return mapList;
    }
    /**
     * 医生端服务项类型
     * @return
     */
    public List<Map<String,Object>> selectTypes(){
        String sql = "SELECT code,value type from base_system_dict_entry WHERE dict_code = 'door_service_subject_class_dict' ORDER BY sort";
        List<Map<String,Object>> mapList1 = jdbcTemplate.queryForList(sql);

+ 2 - 1
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/controller/SpecialistController.java

@ -535,11 +535,12 @@ public class SpecialistController extends EnvelopRestEndpoint {
    @PostMapping(value="/transferPatients")
    @ApiOperation(value = "专科端转移居民")
    public Envelop transferPatients(@ApiParam(name="teamCode",value = "医生所在团队",required = true)@RequestParam(value = "teamCode",required = true) String teamCode,
                                    @ApiParam(name="toTeamCode",value = "转移医生医生所在所在团队,跨团队时必传",required = true)@RequestParam(value = "toTeamCode",required = false) String toTeamCode,
                                    @ApiParam(name="doctorCode",value = "当前医生code",required = true)@RequestParam(value = "doctorCode",required = true)String doctorCode,
                                    @ApiParam(name="toDoctorCode",value = "接收患者医生code",required = true)@RequestParam(value = "toDoctorCode",required = true)String toDoctorCode,
                                    @ApiParam(name="patients",value = "患者JsonArray列表(包含code)",required = true)@RequestParam(value = "patients",required = true)String patients){
        try {
            return MixEnvelop.getSuccess(SpecialistMapping.api_success,specialistService.transferPatients(teamCode, doctorCode, toDoctorCode, patients));
            return MixEnvelop.getSuccess(SpecialistMapping.api_success,specialistService.transferPatients(teamCode,toTeamCode,doctorCode, toDoctorCode, patients));
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());

+ 1 - 1
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/dao/SpecialistPatientRelationDao.java

@ -33,6 +33,6 @@ public interface SpecialistPatientRelationDao extends PagingAndSortingRepository
    @Query("select p from SpecialistPatientRelationDO p where p.doctor=?1 and p.patient =?2 and p.teamCode =?3 and p.status>=0 and p.signStatus=1")
    public SpecialistPatientRelationDO findByDoctorAndPatientAndTeamCode(String doctor,String patient,Integer teamCode);
    @Query("select p from SpecialistPatientRelationDO p where p.teamCode=?1 and p.patient=?2 and p.doctor=?3 and p.status>=0 and p.signStatus=1")
    @Query("select p from SpecialistPatientRelationDO p where p.teamCode=?1 and p.patient=?2 and p.doctor=?3 and p.status>=0 and p.status >=0 and p.signStatus=1")
    List<SpecialistPatientRelationDO> findListByTeamCodeAndPatientAndDoctor(Integer teamCode,String patient,String doctor);
}

+ 1 - 0
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/dao/rehabilitation/PatientRehabilitationPlanDao.java

@ -56,4 +56,5 @@ public interface PatientRehabilitationPlanDao extends PagingAndSortingRepository
    @Query("update PatientRehabilitationPlanDO a set a.status=?1,a.abortTime= ?3 where a.id =?2 ")
    @Modifying
    int updateStatusAndTimeById(Integer status, String id, Date date);
}

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

@ -1293,8 +1293,12 @@ public class SpecialistService{
    }
    public JSONObject transferPatients(String teamCode,String doctorCode,String toDoctorCode,String patients){
    public JSONObject transferPatients(String teamCode,String toTeamCode,String doctorCode,String toDoctorCode,String patients){
        String[] patient = patients.split(",");
        boolean flag=false;//同团队时 teamCode==toTeamCode
        if (!teamCode.equals(toTeamCode)){//跨团队
            flag=true;
        }
        String sql =" select name from wlyy.wlyy_doctor where code='"+toDoctorCode+"'";
        String toDoctorName = jdbcTemplate.queryForObject(sql,String.class);
        sql =" select name from wlyy.wlyy_doctor where code='"+doctorCode+"'";
@ -1305,6 +1309,8 @@ public class SpecialistService{
        JSONArray specialistPatientRelation = new JSONArray();
        JSONArray rehabilitationOperateRecords = new JSONArray();
        for (String patientCode:patient){
            sql ="select name from wlyy.wlyy_patient where code='"+patientCode+"' ";
            String patientName = jdbcTemplate.queryForObject(sql,String.class);
            List<PatientRehabilitationPlanDO> planList  = patientRehabilitationPlanDao.findByPatientAndCreateUserAndTeamCode(patientCode,doctorCode,Integer.parseInt(teamCode));{
                for (PatientRehabilitationPlanDO plan:planList){
                    plan.setCreateUser(toDoctorCode);
@ -1312,6 +1318,9 @@ public class SpecialistService{
                    plan.setUpdateUser(doctorCode);
                    plan.setUpdateUserName(doctorName);
                    plan.setUpdateTime(new Date());
                    if (flag){
                        plan.setTeamCode(Integer.parseInt(toTeamCode));
                    }
                    patientRehabilitationPlanDao.save(plan);
                    planObject.add(plan.getId());
                    PatientRehabilitationPlanLogDO planLogDO = new PatientRehabilitationPlanLogDO();
@ -1319,10 +1328,12 @@ public class SpecialistService{
                    planLogDO.setPlanId(plan.getId());
                    planLogDO.setCreateTime(new Date());
                    planLogDO.setCreateUser(doctorCode);
                    planLogDO.setCreateUserName(toDoctorName);
                    planLogDO.setCreateUserName(doctorName);
                    patientRehabilitationPlanLogDao.save(planLogDO);
                    List<RehabilitationDetailDO> planDetails  = rehabilitationDetailDao.findByPlanIdAndTypeAndDoctorAndStatusNot(plan.getId(),2,doctorCode,1);//未完成的任务
                    for (RehabilitationDetailDO planDetail:planDetails){
                        planDetail.setCreateUser(toDoctorCode);
                        planDetail.setCreateUserName(toDoctorName);
                        planDetail.setDoctor(toDoctorCode);
                        planDetail.setDoctorName(toDoctorName);
                        planDetail.setUpdateTime(new Date());
@ -1343,15 +1354,74 @@ public class SpecialistService{
                    }
                }
            }
            List<SpecialistPatientRelationDO> relations = specialistPatientRelationDao.findListByTeamCodeAndPatientAndDoctor(Integer.parseInt(teamCode),patientCode,doctorCode);
            for (SpecialistPatientRelationDO relation:relations){
                relation.setDoctor(toDoctorCode);
                relation.setDoctorName(toDoctorName);
                relation.setUpdateTime(new Date());
                relation.setUpdateUser(doctorCode);
                relation.setUpdateUserName(doctorName);
                specialistPatientRelationDao.save(relation);
                specialistPatientRelation.add(relation.getId());
            if (flag){
                SpecialistPatientRelationDO relations = specialistPatientRelationDao.findByTeamCodeAndPatient(Integer.parseInt(toTeamCode),patientCode);
                SpecialistPatientRelationDO relationDoBefore = specialistPatientRelationDao.findByTeamCodeAndPatient(Integer.parseInt(teamCode),patientCode);
                if (relations==null){//跨团队时  患者未与目标团队签约
                    SpecialistPatientRelationDO relationDO = new SpecialistPatientRelationDO();
                    relationDO.setId(UUID.randomUUID().toString().replace("-",""));
                    relationDO.setDoctorName(toDoctorCode);
                    relationDO.setDoctorName(toDoctorName);
                    relationDO.setPatient(patientCode);
                    relationDO.setPatientName(patientName);
                    relationDO.setTeamCode(Integer.parseInt(toTeamCode));
                    relationDO.setSignStatus("1");
                    relationDO.setStatus("1");
                    relationDO.setSignYear(DateUtil.getSignYear()+"");
                    relationDO.setSignDate(new Date());
                    relationDO.setCreateTime(new Date());
                    relationDO.setCreateUser(toDoctorCode);
                    relationDO.setCreateUserName(toDoctorName);
                    relationDO.setUpdateTime(new Date());
                    if (StringUtils.isNotBlank(relationDoBefore.getDiseaseCode())){
                        relationDO.setDiseaseCode(relationDoBefore.getDiseaseCode());
                    }
                    if (relationDoBefore.getDiseaseCode()!=null){
                        relationDO.setIsManage(relationDoBefore.getIsManage());
                    }
                    if (StringUtils.isNotBlank(relationDoBefore.getManageUser())){
                        relationDO.setManageUser(relationDoBefore.getManageUser());
                    }
                    if (StringUtils.isNotBlank(relationDoBefore.getManageTime().toString())){
                        relationDO.setManageTime(relationDoBefore.getManageTime());
                    }
                    if (StringUtils.isNotBlank(relationDoBefore.getRemindTime())){
                        relationDO.setRemindTime(relationDoBefore.getRemindTime());
                    }
                    specialistPatientRelationDao.save(relationDO);
                    specialistPatientRelation.add(relationDO.getId());
                    sql = "UPDATE wlyy.wlyy_patient_disease_server set specialist_relation_code='"+relationDO.getId()+"' \n" +
                            "where specialist_relation_code='"+relationDoBefore.getId()+"'";
                    jdbcTemplate.execute(sql);
                }
                else{
                    relations.setCreateUser(toDoctorCode);
                    relations.setCreateUserName(toDoctorName);
                    relations.setDoctor(toDoctorCode);
                    relations.setDoctorName(toDoctorName);
                    relations.setUpdateTime(new Date());
                    relations.setUpdateUser(doctorCode);
                    relations.setUpdateUserName(doctorName);
                    specialistPatientRelationDao.save(relations);
                    specialistPatientRelation.add(relations.getId());
                    sql = "UPDATE wlyy.wlyy_patient_disease_server set specialist_relation_code='"+relations.getId()+"' \n" +
                            "where specialist_relation_code='"+relationDoBefore.getId()+"'";
                    jdbcTemplate.execute(sql);
                }
            }
            else{//
                List<SpecialistPatientRelationDO> relations = specialistPatientRelationDao.findListByTeamCodeAndPatientAndDoctor(Integer.parseInt(teamCode),patientCode,doctorCode);
                for (SpecialistPatientRelationDO relation:relations){
                    relation.setCreateUser(toDoctorCode);
                    relation.setCreateUserName(toDoctorName);
                    relation.setDoctor(toDoctorCode);
                    relation.setDoctorName(toDoctorName);
                    relation.setUpdateTime(new Date());
                    relation.setUpdateUser(doctorCode);
                    relation.setUpdateUserName(doctorName);
                    specialistPatientRelationDao.save(relation);
                    specialistPatientRelation.add(relation.getId());
                }
            }
        }
        result.put("planList",planObject);

+ 2 - 0
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/rehabilitation/RehabilitationManageService.java

@ -1502,6 +1502,8 @@ public class RehabilitationManageService {
            resultMap.put("status", p.getStatus());
            resultMap.put("patientImg", p.getPatientImg());
            resultMap.put("adviceContent",p.getAdviceContent());
            resultMap.put("createTimeDate",DateUtil.dateToStr(p.getCreateTime(),"yyyy-MM-dd"));
            resultMap.put("createTime", DateUtil.dateToStr(p.getCreateTime(),"yyyy-MM-dd HH:mm:ss"));
            resultMap.put("medicalRecordsCode",p.getMedicalRecordsCode());
        }