瀏覽代碼

随访修改

wangjun 3 年之前
父節點
當前提交
3135804afb
共有 17 個文件被更改,包括 502 次插入99 次删除
  1. 1 1
      business/base-service/src/main/java/com/yihu/jw/hospital/message/dao/SystemMessageDao.java
  2. 4 0
      business/base-service/src/main/java/com/yihu/jw/rehabilitation/service/DoctorPatientRelationService.java
  3. 95 0
      common/common-entity/src/main/java/com/yihu/jw/entity/rehabilitation/WlyyDoctorOperateRecordDO.java
  4. 9 0
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/rehabilitation/RehabilitationDetailDO.java
  5. 19 0
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/controller/RehabilitationPlanController.java
  6. 2 1
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/controller/doctor/DoctorRehabilitationManageController.java
  7. 56 0
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/controller/doctor/DoctorRehabilitationPlanController.java
  8. 7 8
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/controller/followUp/DoctorFollowUpController.java
  9. 22 1
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/dao/RehabilitationOperateRecordsDao.java
  10. 17 0
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/dao/WlyyDoctorOperateRecordDao.java
  11. 125 51
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/RehabilitationManageService.java
  12. 120 22
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/RehabilitationPlanService.java
  13. 19 13
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/followUp/FollowUpService.java
  14. 1 0
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/controller/rehabilitation/RehabilitationPlanController.java
  15. 2 2
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/dao/rehabilitation/RehabilitationOperateRecordsDao.java
  16. 1 0
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/rehabilitation/RehabilitationManageService.java
  17. 2 0
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/rehabilitation/RehabilitationPlanService.java

+ 1 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/message/dao/SystemMessageDao.java

@ -48,7 +48,7 @@ public interface SystemMessageDao extends PagingAndSortingRepository<SystemMessa
    Integer setSpecialistReadById(String id);
    @Query("update SystemMessageDO a set a.isRead = 0,a.over = '0' where a.receiver = ?1 and a.type = ?2 and (a.createTime > ?3 and a.createTime< ?4)")
    @Query("update SystemMessageDO a set a.isRead = '0',a.over = '0' where a.receiver = ?1 and a.type = ?2 and (a.createTime > ?3 and a.createTime< ?4)")
    @Modifying
    void setMessageOverByType(String doctor, Integer type, Date start, Date end);

+ 4 - 0
business/base-service/src/main/java/com/yihu/jw/rehabilitation/service/DoctorPatientRelationService.java

@ -71,6 +71,9 @@ public class DoctorPatientRelationService <T, R extends CrudRepository> extends
        if (StringUtils.isNoneBlank(patient)){
            sql+=" and t.patient='"+patient+"'";
        }
        if (StringUtils.isNoneBlank(patient)){
            sql+=" and t.patient='"+patient+"'";
        }
        if (StringUtils.isNoneBlank(patientName)){
            sql+=" and t.patient_name like '%"+patientName+"%'";
        }
@ -245,4 +248,5 @@ public class DoctorPatientRelationService <T, R extends CrudRepository> extends
        return data;
    }
}

+ 95 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/rehabilitation/WlyyDoctorOperateRecordDO.java

@ -0,0 +1,95 @@
package com.yihu.jw.entity.rehabilitation;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
@Entity
@Table(name = "wlyy_doctor_operate_record")
public class WlyyDoctorOperateRecordDO extends UuidIdentityEntity {
    private String plandetailId;
    private String operator;
    private String operatorName;
    private String createUser;
    private String createUserName;
    private Date createTime;
    private String imgUrl;
    private String replyContent;
    @Column(name =  "plandetail_id")
    public String getPlandetailId() {
        return plandetailId;
    }
    public void setPlandetailId(String plandetailId) {
        this.plandetailId = plandetailId;
    }
    @Column(name =  "operator")
    public String getOperator() {
        return operator;
    }
    public void setOperator(String operator) {
        this.operator = operator;
    }
    @Column(name =  "operator_name")
    public String getOperatorName() {
        return operatorName;
    }
    public void setOperatorName(String operatorName) {
        this.operatorName = operatorName;
    }
    @Column(name =  "create_user")
    public String getCreateUser() {
        return createUser;
    }
    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }
    @Column(name =  "create_user_name")
    public String getCreateUserName() {
        return createUserName;
    }
    public void setCreateUserName(String createUserName) {
        this.createUserName = createUserName;
    }
    @Column(name =  "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @Column(name =  "img_url")
    public String getImgUrl() {
        return imgUrl;
    }
    public void setImgUrl(String imgUrl) {
        this.imgUrl = imgUrl;
    }
    @Column(name =  "reply_content")
    public String getReplyContent() {
        return replyContent;
    }
    public void setReplyContent(String replyContent) {
        this.replyContent = replyContent;
    }
}

+ 9 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/rehabilitation/RehabilitationDetailDO.java

@ -61,6 +61,15 @@ public class RehabilitationDetailDO extends UuidIdentityEntity implements Serial
    private Date updateTime;
    private String updateUser;
    private String updateUserName;
    private String orginJson;
    @Column(name = "orgin_json")
    public String getOrginJson() {
        return orginJson;
    }
    public void setOrginJson(String orginJson) {
        this.orginJson = orginJson;
    }
    @Column(name = "reservation_type")
    public Integer getReservationType() {

+ 19 - 0
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/controller/RehabilitationPlanController.java

@ -225,6 +225,25 @@ public class RehabilitationPlanController extends EnvelopRestEndpoint {
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping("/findOperateRecordByDetailId")
    @ApiOperation(value = "查询operateRecord")
    public MixEnvelop findOperateRecordByDetailId(@ApiParam(name = "detailId", value = "康复计划明细id", required = true)
                                                      @RequestParam(value = "detailId", required = true)String detailId){
        try {
            String[] detail=detailId.split(",");
            com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
            for (int i=0;i<detail.length;i++){
                jsonObject.put(detail[i],rehabilitationOperateRecordsDao.findByRehabilitationDetailId(detail[i]));
            }
           /* if (list!=null && list.size()>0){
                return MixEnvelop.getError("该明细日志已存在!");
            }*/
            return MixEnvelop.getSuccess(SpecialistMapping.api_success,jsonObject);
        }catch (Exception e){
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = SpecialistMapping.rehabilitation.updatePlanStatusById)
    @ApiOperation(value = "康复管理-更新康复计划状态")

+ 2 - 1
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/controller/doctor/DoctorRehabilitationManageController.java

@ -364,9 +364,10 @@ public class DoctorRehabilitationManageController extends EnvelopRestEndpoint {
                                                              @ApiParam(name = "node", value = "服务完成笔记", required = true)@RequestParam(value = "node", required = false)String node,
                                                              @ApiParam(name = "image", value = "相关记录图片,json格式", required = true)@RequestParam(value = "image", required = false)String image,
                                                              @ApiParam(name = "relationCode", value = "业务code", required = true)@RequestParam(value = "relationCode", required = false)String relationCode,
                                                              @ApiParam(name = "recordId", value = "recordId", required = true)@RequestParam(value = "recordId", required = false)String recordId,
                                                              @ApiParam(name = "status", value = "是否确认完成 0未确认 1确认", required = true)@RequestParam(value = "status", required = false)String status){
        try {
            Map<String,Object> map = rehabilitationManageService.updateNodeAndRelationRecordImg(node,image,status,planDetailId,relationCode);
            Map<String,Object> map = rehabilitationManageService.updateNodeAndRelationRecordImg(node,image,status,planDetailId,relationCode,recordId);
            return ObjEnvelop.getSuccess(SpecialistMapping.api_success,map);
        }catch (Exception e){

+ 56 - 0
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/controller/doctor/DoctorRehabilitationPlanController.java

@ -5,6 +5,7 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.patient.Patient;
import com.yihu.jw.entity.rehabilitation.SpecialDiseaseMessagesDO;
import com.yihu.jw.entity.rehabilitation.WlyyDoctorOperateRecordDO;
import com.yihu.jw.entity.specialist.rehabilitation.RehabilitationOperateRecordsDO;
import com.yihu.jw.entity.util.AesEncryptUtils;
import com.yihu.jw.patient.dao.BasePatientDao;
@ -171,8 +172,10 @@ public class DoctorRehabilitationPlanController extends EnvelopRestEndpoint {
    @RequestMapping(value = RehabilitationRequestMapping.DoctorRehabilitationPlan.saveRehabilitationOperateRecord, method = RequestMethod.POST)
    @ApiOperation("康复管理-新增operateRecord")
    public MixEnvelop saveRehabilitationOperateRecord(@ApiParam(name = "dataJson", value = "实体json",defaultValue = "{\"rehabilitationDetailId\":\"402803f6657f195301657f4fbd3c0001\",\"patientCode\":\"00\",\"patientName\":\"11\",\"doctorCode\":\"22\",\"doctorName\":\"33\",\"node\":\"jjjjjj\",\"relationRecordType\":\"4\",\"relation_record_code\":\"55\",\"relationRecordImg\":\"666666\",\"status\":\"0\"}")@RequestParam(value = "dataJson", required = true)String dataJson){
        System.out.println("进入saveRehabilitationOperateRecord");
        try {
            JSONObject json = new JSONObject(dataJson);
            System.out.println("json=="+json);
            if(json.has("patientCode")){
                BasePatientDO patient = basePatientDao.findById(json.get("patientCode")+"");
                json.put("patientName",patient!=null?patient.getName():"");
@ -195,6 +198,7 @@ public class DoctorRehabilitationPlanController extends EnvelopRestEndpoint {
                BaseDoctorDO doctor = baseDoctorDao.findById(json.get("doctorCode")+"");
                json.put("doctorName",doctor!=null?doctor.getName():"");
            }
            System.out.println("saveRehabilitationOperateRecord");
            RehabilitationOperateRecordsDO rehabilitationOperateRecordsDO= toEntity(json.toString(), RehabilitationOperateRecordsDO.class);
            return MixEnvelop.getSuccess(SpecialistMapping.api_success,rehabilitationPlanService.saveRehabilitationRecord(rehabilitationOperateRecordsDO));
        }catch (Exception e){
@ -273,6 +277,8 @@ public class DoctorRehabilitationPlanController extends EnvelopRestEndpoint {
                                        @RequestParam(value = "doctor", required = false)String doctor,
                                         @ApiParam(name = "patient", value = "患者id", required = false)
                                         @RequestParam(value = "patient", required = false)String patient,
                                         @ApiParam(name = "deptCode", value = "deptCode", required = false)
                                             @RequestParam(value = "deptCode", required = false)String deptCode,
                                         @ApiParam(name = "patientName", value = "患者姓名", required = false)
                                             @RequestParam(value = "patientName", required = false)String patientName,
                                         @ApiParam(name = "isDeal", value = "是否下转1是0否", required = false)
@ -474,4 +480,54 @@ public class DoctorRehabilitationPlanController extends EnvelopRestEndpoint {
            return failed( "请求失败");
        }
    }
    @PostMapping("/getOperateRecordByDetailId")
    @ApiOperation(value = "getOperateRecordByDetailId")
    public MixEnvelop getOperateRecordByDetailId(@ApiParam(name = "planI", value = "康复计划id", required = true)
                                           @RequestParam(value = "planId", required = true)String planId,
                                           @ApiParam(name = "status", value = "状态", required = true)
                                           @RequestParam(value = "status", required = true)Integer status,
                                           @ApiParam(name = "abortReason", value = "中止原因", required = true)
                                           @RequestParam(value = "abortReason", required = false)String abortReason){
        try {
            if(status!=0){
                return rehabilitationPlanService.updatePlanStatusById(status,planId);
            }else {
                return rehabilitationPlanService.abortPlanById(planId,abortReason);
            }
        }catch (Exception e){
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping("/saveOperateRecordByDetailId")
    @ApiOperation(value = "getOperateRecordByDetailId")
    public Envelop getOperateRecordByDetailId(@ApiParam(name = "json", value = "康复计划id", required = true)
                                                 @RequestParam(value = "json", required = true)String json){
        try {
            WlyyDoctorOperateRecordDO wlyyDoctorOperateRecordDO = objectMapper.readValue(json,WlyyDoctorOperateRecordDO.class);
           return success(rehabilitationPlanService.saveRecordDetail(wlyyDoctorOperateRecordDO)) ;
        }catch (Exception e){
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping("/findOperateRecordByDetailId")
    @ApiOperation(value = "findOperateRecordByDetailId")
    public MixEnvelop findOperateRecordByDetailId(@ApiParam(name = "detailId", value = "detailId", required = true)
                                              @RequestParam(value = "detailId", required = true)String detailId,
                                                  @ApiParam(name = "page", value = "page", required = false)
                                                  @RequestParam(value = "page", required = false)Integer page,
                                                  @ApiParam(name = "pageSize", value = "pageSize", required = false)
                                                      @RequestParam(value = "pageSize", required = false)Integer pageSize){
        try {
            return rehabilitationPlanService.findRecordByDetailId(detailId,page,pageSize);
        }catch (Exception e){
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
}

+ 7 - 8
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/controller/followUp/DoctorFollowUpController.java

@ -20,10 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@ -200,7 +197,7 @@ public class DoctorFollowUpController  extends EnvelopRestEndpoint {
        try {
            JSONObject jsonObject = new JSONObject(followupProjectData);
            Followup followup = followUpService.startFollowup(id, followupNo, date, followupType, followupClass, followupManagerStatus, plandate, prescriptioncode);
            followUpService.finishFollowup(id);
            followUpService.finishFollowup(id,"");
            followUpService.saveAllFollowupProjectData(id, jsonObject.getJSONObject("followupProjectData").toString());
            followupDrugsService.saveFollowupDrugs(id,jsonObject.getJSONArray("drugsData").toString());
            return success( "保存随访项目数据成功!");
@ -497,13 +494,15 @@ public class DoctorFollowUpController  extends EnvelopRestEndpoint {
    }
    @ApiOperation("完成随访记录")
    @RequestMapping(value = "/finishFollowup", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
    @PostMapping(value = "/finishFollowup")
    @ResponseBody
    @ObserverRequired
    public Envelop finishFollowup(@ApiParam(name = "id", value = "随访记录ID", defaultValue = "")
                                 @RequestParam(value = "id", required = true) String id) {
                                 @RequestParam(value = "id", required = true) String id,
                                  @ApiParam(name = "followUpJson", value = "followUpJson", defaultValue = "")
                                  @RequestParam(value = "followUpJson", required = false) String followUpJson) {
        try {
            followUpService.finishFollowup(id);
            followUpService.finishFollowup(id,followUpJson);
            return success("完成随访记录成功!");
        } catch (Exception e) {

+ 22 - 1
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/dao/RehabilitationOperateRecordsDao.java

@ -1,6 +1,7 @@
package com.yihu.rehabilitation.dao;
import com.yihu.jw.entity.specialist.rehabilitation.RehabilitationOperateRecordsDO;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
@ -11,10 +12,13 @@ import java.util.List;
/**
 * Created by 刘文彬 on 2018/8/29.
 */
public interface RehabilitationOperateRecordsDao extends PagingAndSortingRepository<RehabilitationOperateRecordsDO, Long>,JpaSpecificationExecutor<RehabilitationOperateRecordsDO> {
public interface RehabilitationOperateRecordsDao extends PagingAndSortingRepository<RehabilitationOperateRecordsDO, String>,JpaSpecificationExecutor<RehabilitationOperateRecordsDO> {
    List<RehabilitationOperateRecordsDO> findByRehabilitationDetailId(String rehabilitationDetailId);
    @Query("select count(1) from RehabilitationOperateRecordsDO t where t.rehabilitationDetailId=?1 ")
    Integer getCountByDetailID(String rehabilitationDetailId);
    List<RehabilitationOperateRecordsDO> findByRehabilitationDetailIdAndId(String rehabilitationDetailId, String id);
    @Modifying
@ -35,4 +39,21 @@ public interface RehabilitationOperateRecordsDao extends PagingAndSortingReposit
    @Query("select a from RehabilitationOperateRecordsDO a where a.rehabilitationDetailId=?1 and a.doctorCode=?2 and a.status<>?3")
    List<RehabilitationOperateRecordsDO> findByRehabilitationDetailIdAndDoctorCodeAndStatusNot(String rehabilitationDetailId, String doctorCode, Integer status);
    @Modifying
    @Query("update RehabilitationOperateRecordsDO a set a.status=?1 where a.id =?2 ")
    int updateStatusById(Integer status, String id);
    @Modifying
    @Query("update RehabilitationOperateRecordsDO a set a.node=?1,a.relationRecordImg=?2,a.status=1 where a.id =?3 ")
    int updateNodeAndRelationRecordImgById(String node, String rehabilitationRecordImg, String id);
    @Modifying
    @Query("update RehabilitationOperateRecordsDO a set a.node=?1,a.status=1 where a.id =?2 ")
    int updateNodeByPlanDetailIdById(String node, String id);
    @Modifying
    @Query("update RehabilitationOperateRecordsDO a set a.relationRecordImg=?1,a.status=1 where a.id =?2 ")
    int updateImagByPlanDetailIdById(String image, String id);
}

+ 17 - 0
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/dao/WlyyDoctorOperateRecordDao.java

@ -0,0 +1,17 @@
package com.yihu.rehabilitation.dao;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.rehabilitation.RehabilitationguidancePatientDO;
import com.yihu.jw.entity.rehabilitation.WlyyDoctorOperateRecordDO;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface WlyyDoctorOperateRecordDao extends PagingAndSortingRepository<WlyyDoctorOperateRecordDO, String>, JpaSpecificationExecutor<WlyyDoctorOperateRecordDO> {
    @Query("select a from WlyyDoctorOperateRecordDO a where a.plandetailId = ?1 ")
    Page<WlyyDoctorOperateRecordDO> findByplandetailId(String plandetailId, Pageable pageRequest);
    @Query("select count(1) from WlyyDoctorOperateRecordDO a where a.plandetailId = ?1 ")
    Integer getCountByplandetailId(String plandetailId);
}

+ 125 - 51
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/RehabilitationManageService.java

@ -13,13 +13,19 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.door.SignFamily;
import com.yihu.jw.entity.hospital.DmHospitalDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.doctor.Frequency;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.team.WlyyAdminTeamDO;
import com.yihu.jw.entity.patient.Patient;
import com.yihu.jw.entity.specialist.DoctorPatientRelationDO;
import com.yihu.jw.entity.specialist.SpecialistPatientRelationDO;
import com.yihu.jw.entity.specialist.rehabilitation.*;
import com.yihu.jw.entity.util.TransforSqlUtl;
import com.yihu.jw.hospital.HospitalDao;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.team.dao.WlyyAdminTeamDao;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.rehabilitation.*;
@ -111,9 +117,15 @@ public class RehabilitationManageService {
    @Autowired
    private RehabilitationInfoService rehabilitationInfoService;
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    @Autowired
    private ObjectMapper objectMapper;
    @Value("${demo.flag}")
    private Boolean demoFlag;
    @Autowired
    private WlyyAdminTeamDao wlyyAdminTeamDao;
    @Autowired
    private HospitalDao hospitalDao;
    /**
     * 预约协诊
     * @param doctor
@ -162,6 +174,13 @@ public class RehabilitationManageService {
                doctorType = 2;
            }
        }
        String orgName="";
        String deptName="";
        List<BaseDoctorHospitalDO> orgs = baseDoctorHospitalDao.findByDoctorCode(doctorCode);
        if(orgs!=null&&orgs.size()>0){
            orgName=orgs.get(0).getOrgName();
            deptName=orgs.get(0).getDeptName();
        }
        String sql = " select DISTINCT p.* " +
                " from wlyy_rehabilitation_plan_detail a INNER JOIN wlyy_patient_rehabilitation_plan p " +
                " on a.plan_id = p.id  " ;
@ -206,20 +225,41 @@ public class RehabilitationManageService {
            for(Map<String,Object> one:patientRehabilitationPlanDOList){
                Map<String,Object> resultMap = new HashMap<>();
                String onePlanType=one.get("plan_type")==null?"":one.get("plan_type").toString();
                if ("2".equalsIgnoreCase(onePlanType)){
                    String adminTeam=one.get("admin_team_code")==null?"":one.get("admin_team_code").toString();
                    if (StringUtils.isNoneBlank(adminTeam)){
                        WlyyAdminTeamDO wlyyAdminTeamDO =wlyyAdminTeamDao.findOne(Integer.valueOf(adminTeam));
                        if (wlyyAdminTeamDO!=null){
                            DmHospitalDO dmHospitalDO = hospitalDao.findByCode(wlyyAdminTeamDO.getOrgCode());
                            if (dmHospitalDO!=null){
                                resultMap.put("location",dmHospitalDO.getName());
                            }
                        }
                    }
                }else {
                    resultMap.put("location",orgName);
                }
                resultMap.put("diseaseName",one.get("disease_name"));
                resultMap.put("deptName",deptName);
//                Integer age = IdCardUtil.getAgeForIdcard(one.get("idcard")+"");
//                String sex = IdCardUtil.getSexForIdcard_new(one.get("idcard")+"");
//                resultMap.put("age",age);
                resultMap.put("hospitalName",one.get("hospital_name"));
//                resultMap.put("sex","1".equals(sex)?"男":("2".equals(sex)?"女":"未知"));
                resultMap.put("patientName",one.get("patientName"));
                resultMap.put("patientName",one.get("name"));
                resultMap.put("patientCode",one.get("patient"));
                patient = basePatientDao.findById(one.get("patient").toString());
                if (patient!=null){
                    resultMap.put("photo",patient!=null?patient.getPhoto():"");
                    Integer age = IdCardUtil.getAgeForIdcard(patient.getIdcard());
                    String sex = IdCardUtil.getSexForIdcard_new(patient.getIdcard());
                    resultMap.put("age",age);
                    resultMap.put("sex","1".equals(sex)?"男":("2".equals(sex)?"女":"未知"));
                    resultMap.put("age",age);
                    SignFamily signFamily = signFamilyDao.findByPatient(one.get("patient").toString());
                    if (signFamily != null){
                        resultMap.put("hospitalName",signFamily.getHospitalName());
@ -1581,46 +1621,62 @@ public class RehabilitationManageService {
     * @param planDeatilId
     * @return
     */
    public Map<String,Object> updateNodeAndRelationRecordImg(String node,String image,String status,String planDeatilId,String relationCode)throws Exception{
    public Map<String,Object> updateNodeAndRelationRecordImg(String node,String image,String status,String planDeatilId,String relationCode,String recordId)throws Exception{
        Map<String,Object> resultMap = new HashedMap();
        try{
            RehabilitationDetailDO detailDO = rehabilitationDetailDao.findById(planDeatilId);
            detailDO.setStatus(1);
            if (StringUtils.isNoneBlank(status)){
                detailDO.setStatus(Integer.parseInt(status));
            }
            detailDO.setUpdateTime(new Date());
            if (StringUtils.isNoneBlank(relationCode)){
                detailDO.setRelationCode(relationCode);
            }
            rehabilitationDetailDao.save(detailDO);
            if (StringUtils.isNoneBlank(image)&&StringUtils.isNoneBlank(node)){
                int j = rehabilitationOperateRecordsDao.updateNodeAndRelationRecordImg(node,image,planDeatilId);
            }
            else if (StringUtils.isNoneBlank(node)){
                int j = rehabilitationOperateRecordsDao.updateNodeByPlanDetailId(node,planDeatilId);
            }
            else if (StringUtils.isNoneBlank(image)){//
                int j = rehabilitationOperateRecordsDao.updateImagByPlanDetailId(image,planDeatilId);
            }
            else{//跟新为已完成
                int j = rehabilitationOperateRecordsDao.updateStatus(1,planDeatilId);
            }
            //如果整个计划的服务项都完成了,整个计划也完成了
            String allSql ="SELECT * FROM wlyy_rehabilitation_plan_detail where plan_id = (SELECT plan_id FROM `wlyy_rehabilitation_plan_detail` WHERE id='"+planDeatilId+"')";
            allSql = TransforSqlUtl.wlyy_rehabilitation_plan_detailAll(allSql);
            List<RehabilitationDetailDO> rehabilitationDetailDOList = jdbcTemplate.query(allSql,new BeanPropertyRowMapper<>(RehabilitationDetailDO.class));
            int allCount=0;
            String planId="";
            for (RehabilitationDetailDO rehabilitationDetailDO : rehabilitationDetailDOList){
                if (rehabilitationDetailDO.getStatus()==1){
                    allCount++;
            if (!StringUtils.isNoneBlank(recordId)){
                RehabilitationDetailDO detailDO = rehabilitationDetailDao.findById(planDeatilId);
                detailDO.setStatus(1);
                if (StringUtils.isNoneBlank(status)){
                    detailDO.setStatus(Integer.parseInt(status));
                }
                detailDO.setUpdateTime(new Date());
                if (StringUtils.isNoneBlank(relationCode)){
                    detailDO.setRelationCode(relationCode);
                }
                rehabilitationDetailDao.save(detailDO);
                if (StringUtils.isNoneBlank(image)&&StringUtils.isNoneBlank(node)){
                    int j = rehabilitationOperateRecordsDao.updateNodeAndRelationRecordImg(node,image,planDeatilId);
                }
                else if (StringUtils.isNoneBlank(node)){
                    int j = rehabilitationOperateRecordsDao.updateNodeByPlanDetailId(node,planDeatilId);
                }
                else if (StringUtils.isNoneBlank(image)){//
                    int j = rehabilitationOperateRecordsDao.updateImagByPlanDetailId(image,planDeatilId);
                }
                else{//跟新为已完成
                    int j = rehabilitationOperateRecordsDao.updateStatus(1,planDeatilId);
                }
                //如果整个计划的服务项都完成了,整个计划也完成了
                String allSql ="SELECT * FROM wlyy_rehabilitation_plan_detail where plan_id = (SELECT plan_id FROM `wlyy_rehabilitation_plan_detail` WHERE id='"+planDeatilId+"')";
                allSql = TransforSqlUtl.wlyy_rehabilitation_plan_detailAll(allSql);
                List<RehabilitationDetailDO> rehabilitationDetailDOList = jdbcTemplate.query(allSql,new BeanPropertyRowMapper<>(RehabilitationDetailDO.class));
                int allCount=0;
                String planId="";
                for (RehabilitationDetailDO rehabilitationDetailDO : rehabilitationDetailDOList){
                    if (rehabilitationDetailDO.getStatus()==1){
                        allCount++;
                    }
                }
                if (rehabilitationDetailDOList.size()>0 && rehabilitationDetailDOList.size()==allCount){
                    planId = rehabilitationDetailDOList.get(0).getPlanId();
                    patientRehabilitationPlanDao.updateStatusAndTimeById(2,planId, new Date());
                }
            }else {
                if (StringUtils.isNoneBlank(image)&&StringUtils.isNoneBlank(node)){
                    int j = rehabilitationOperateRecordsDao.updateNodeAndRelationRecordImgById(node,image,recordId);
                }
                else if (StringUtils.isNoneBlank(node)){
                    int j = rehabilitationOperateRecordsDao.updateNodeByPlanDetailIdById(node,recordId);
                }
                else if (StringUtils.isNoneBlank(image)){//
                    int j = rehabilitationOperateRecordsDao.updateImagByPlanDetailIdById(image,recordId);
                }
                else{//跟新为已完成
                    int j = rehabilitationOperateRecordsDao.updateStatusById(1,recordId);
                }
            }
            if (rehabilitationDetailDOList.size()>0 && rehabilitationDetailDOList.size()==allCount){
                planId = rehabilitationDetailDOList.get(0).getPlanId();
                patientRehabilitationPlanDao.updateStatusAndTimeById(2,planId, new Date());
            }
        }catch (Exception e){
            throw  new Exception("更新服务状态失败!");
        }
@ -1781,12 +1837,32 @@ public class RehabilitationManageService {
        PatientRehabilitationPlanDO p =patientRehabilitationPlanDao.findById(planId);
        List<DoctorPatientRelationDO> doctorPatientRelationDO= doctorPatientRelationDao.findByDoctorAndPatient(p.getCreateUser(),p.getPatient());
        List<RehabilitationDetailDO> details=rehabilitationDetailDao.findByPlanId(planId);
        List<WlyyHospitalSysDictDO> dicts=wlyyHospitalSysDictDao.findByDictName("healthCondition");
        String doctor="";
        String doctorName="";
        List<Map<String,Object>> doctorMaps=new ArrayList<>();
        if (details!=null&&details.size()>0){
            doctor=details.get(0).getDoctor();
            doctorName=details.get(0).getDoctorName();
            for (RehabilitationDetailDO rehabilitationDetailDO:details){
                Map<String,Object> doctorMap = new HashMap<>();
                doctor=rehabilitationDetailDO.getDoctor();
                doctorName=rehabilitationDetailDO.getDoctorName();
                List<BaseDoctorHospitalDO> baseDoctorHospitalDOTo = baseDoctorHospitalDao.findByDoctorCode(doctor);
                BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doctor);
                if (baseDoctorDO!=null){
                    doctorMap.put("photo",baseDoctorDO.getPhoto());
                    doctorMap.put("jobTitle",baseDoctorDO.getJobTitleName());
                }
                if (baseDoctorHospitalDOTo!=null&&baseDoctorHospitalDOTo.size()>0){
                    doctorMap.put("doctorName",doctorName);
                    doctorMap.put("doctor",doctor);
                    doctorMap.put("doctorDept",baseDoctorHospitalDOTo.get(0).getDeptCode());
                    doctorMap.put("doctorDeptName",baseDoctorHospitalDOTo.get(0).getDeptName());
                }
                doctorMaps.add(doctorMap);
            }
        }
        resultMap.put("doctorMaps",doctorMaps);
        resultMap.put("allCount",allCount);
        resultMap.put("finishedCount",finishedCount);
        resultMap.put("specialistPatientRelationDO",doctorPatientRelationDO);
@ -1794,6 +1870,12 @@ public class RehabilitationManageService {
            resultMap.put("disease",p.getDisease());
            resultMap.put("planType",p.getPlanType());
            resultMap.put("healthStatusCode",p.getHealthStatusCode());
            for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:dicts){
                if (p.getHealthStatusCode().equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
                    resultMap.put("healthStatusName",wlyyHospitalSysDictDO.getDictValue());
                    break;
                }
            }
            resultMap.put("diseaseName",p.getDiseaseName());
            resultMap.put("createUser",p.getCreateUser());
            resultMap.put("planTitle",p.getTitle());
@ -1810,21 +1892,13 @@ public class RehabilitationManageService {
                resultMap.put("createUserDept",baseDoctorHospitalDO.get(0).getDeptCode());
                resultMap.put("createUserDeptName",baseDoctorHospitalDO.get(0).getDeptName());
            }
            List<BaseDoctorHospitalDO> baseDoctorHospitalDOTo = baseDoctorHospitalDao.findByDoctorCode(doctor);
            BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doctor);
            if (baseDoctorDO!=null){
                resultMap.put("photo",baseDoctorDO.getPhoto());
                resultMap.put("jobTitle",baseDoctorDO.getJobTitleName());
            }
            if (baseDoctorHospitalDOTo!=null&&baseDoctorHospitalDOTo.size()>0){
                resultMap.put("doctorName",doctorName);
                resultMap.put("doctor",doctor);
                resultMap.put("doctorDept",baseDoctorHospitalDOTo.get(0).getDeptCode());
                resultMap.put("doctorDeptName",baseDoctorHospitalDOTo.get(0).getDeptName());
            }
            PatientMedicalRecordsDO patientMedicalRecordsDO = patientMedicalRecordsDao.findByCode(p.getMedicalRecordsCode());
            resultMap.put("patientMedicalRecordsDO",patientMedicalRecordsDO);
        }
        Date beginTime = DateUtil.strToDateLong(DateUtil.getStringDateShort()+ " "+"00:00:00");
        Date endTime = DateUtil.strToDateLong(DateUtil.getStringDateShort()+ " "+"23:59:59");
        Integer todayBacklogCount = rehabilitationDetailDao.todayBacklogCount(planId,beginTime,endTime);
        resultMap.put("todayBacklogCount",todayBacklogCount);//今日待办总数
        BasePatientDO basePatientDO = basePatientDao.findById(patientCode);
        Integer age = IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard());
        String sex = IdCardUtil.getSexForIdcard_new(basePatientDO.getIdcard());

+ 120 - 22
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/RehabilitationPlanService.java

@ -14,6 +14,7 @@ import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.entity.door.SignFamily;
import com.yihu.jw.entity.hospital.doctor.Frequency;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.rehabilitation.WlyyDoctorOperateRecordDO;
import com.yihu.jw.entity.specialist.DoctorPatientRelationDO;
import com.yihu.jw.entity.specialist.RehabilitationServiceItemDO;
import com.yihu.jw.entity.specialist.rehabilitation.*;
@ -51,6 +52,9 @@ import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
@ -138,6 +142,8 @@ public class RehabilitationPlanService extends BaseJpaService<PatientRehabilitat
    private EnterpriseService enterpriseService;
    @Autowired
    private FollowUpService followUpService;
    @Autowired
    private WlyyDoctorOperateRecordDao wlyyDoctorOperateRecordDao;
    public Envelop updatePatientImgById(String planId, String patientImg) {
        if(patientRehabilitationPlanDao.updatePatientImgById(planId,patientImg) > 0){
@ -860,24 +866,51 @@ public class RehabilitationPlanService extends BaseJpaService<PatientRehabilitat
    }
    public RehabilitationOperateRecordsDO saveRehabilitationRecord(RehabilitationOperateRecordsDO rehabilitationOperateRecordsDO){
        RehabilitationDetailDO rehabilitationDetailDO = rehabilitationDetailDao.findById(rehabilitationOperateRecordsDO.getRehabilitationDetailId());
        if (!StringUtils.isNoneBlank(rehabilitationOperateRecordsDO.getId())){
            rehabilitationOperateRecordsDO.setId(getCode());
        }
        if (rehabilitationDetailDO.getExecuteTime()!=null){
            rehabilitationOperateRecordsDO.setReserveTime(rehabilitationDetailDO.getExecuteTime());
        }
        rehabilitationOperateRecordsDO.setCompleteTime(new Date());
        rehabilitationOperateRecordsDO.setCreateTime(new Date());
        rehabilitationOperateRecordsDO.setUpdateTime(new Date());
        rehabilitationOperateRecordsDO.setStatus(rehabilitationOperateRecordsDO.getStatus());
        if (StringUtils.isEmpty(rehabilitationOperateRecordsDO.getPatientName())){
            String sql ="select name from base_patient where id='"+rehabilitationOperateRecordsDO.getPatientCode()+"'";
            List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
            if (list!=null && list.size()>0){
                rehabilitationOperateRecordsDO.setPatientName(String.valueOf(list.get(0).get("name")));
        if (rehabilitationDetailDO!=null){
            if (!StringUtils.isNoneBlank(rehabilitationOperateRecordsDO.getId())){
                rehabilitationOperateRecordsDO.setId(getCode());
            }
            if (rehabilitationDetailDO.getExecuteTime()!=null){
                rehabilitationOperateRecordsDO.setReserveTime(rehabilitationDetailDO.getExecuteTime());
            }
            System.out.println("123saveRehabilitationRecord");
            rehabilitationOperateRecordsDO.setCompleteTime(new Date());
            rehabilitationOperateRecordsDO.setCreateTime(new Date());
            rehabilitationOperateRecordsDO.setUpdateTime(new Date());
            System.out.println();
            rehabilitationDetailDO.setStatus(rehabilitationOperateRecordsDO.getStatus());
            rehabilitationDetailDao.save(rehabilitationDetailDO);
            if (StringUtils.isEmpty(rehabilitationOperateRecordsDO.getPatientName())){
                String sql ="select name from base_patient where id='"+rehabilitationOperateRecordsDO.getPatientCode()+"'";
                List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
                if (list!=null && list.size()>0){
                    rehabilitationOperateRecordsDO.setPatientName(String.valueOf(list.get(0).get("name")));
                }
            }
            return rehabilitationOperateRecordsDao.save(rehabilitationOperateRecordsDO);
        }else {
            RehabilitationOperateRecordsDO old =  rehabilitationOperateRecordsDao.findOne(rehabilitationOperateRecordsDO.getRehabilitationDetailId());
            if(old!=null){
                old.setStatus(rehabilitationOperateRecordsDO.getStatus());
                rehabilitationOperateRecordsDao.save(old);
                if (!StringUtils.isNoneBlank(rehabilitationOperateRecordsDO.getId())){
                    rehabilitationOperateRecordsDO.setId(getCode());
                }
                System.out.println("123saveRehabilitationRecord");
                rehabilitationOperateRecordsDO.setCompleteTime(new Date());
                rehabilitationOperateRecordsDO.setCreateTime(new Date());
                rehabilitationOperateRecordsDO.setUpdateTime(new Date());
                if (StringUtils.isEmpty(rehabilitationOperateRecordsDO.getPatientName())){
                    String sql ="select name from base_patient where id='"+rehabilitationOperateRecordsDO.getPatientCode()+"'";
                    List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
                    if (list!=null && list.size()>0){
                        rehabilitationOperateRecordsDO.setPatientName(String.valueOf(list.get(0).get("name")));
                    }
                }
            }
            return rehabilitationOperateRecordsDao.save(rehabilitationOperateRecordsDO);
        }
        return rehabilitationOperateRecordsDao.save(rehabilitationOperateRecordsDO);
    }
@ -1204,13 +1237,33 @@ public class RehabilitationPlanService extends BaseJpaService<PatientRehabilitat
        object.put("createUser", doctor.getId());
        object.put("createUserName", doctor.getName());
        String planId = object.getString("planId");
        String hospitalServiceItemId = object.getString("hospitalServiceItemId");
        //删除该服务项目今日之后未完成的计划
        PatientRehabilitationPlanDO patientRehabilitationPlanDO= patientRehabilitationPlanDao.findById(planId);
        if(StringUtils.isBlank(updateStatus)||updateStatus.equals("0")){//单个服务的修改
            String hospitalServiceItemId = object.get("hospitalServiceItemId")==null?"":object.getString("hospitalServiceItemId");
            deleteDetailByPlanIdAndHospitalServiceItemId(planId, hospitalServiceItemId, DateUtil.getDateShort(new Date()));
        }
        else{
           deleteDetailByPlanId(planId, DateUtil.getDateShort(new Date()));
            String oldArray=patientRehabilitationPlanDO.getDetailJson();
            JSONArray oldJsonArray= new JSONArray(oldArray);
            Iterator<Object> o = oldJsonArray.iterator();
            while (o.hasNext()) {
                JSONObject jo = (JSONObject ) o.next();
                if(jo.getString("hospitalServiceItemId") .equalsIgnoreCase(hospitalServiceItemId)) {
                    //ja.remove(jo); //不要用这种方式删除,会报出ConcurrentModificationException
                    o.remove(); //这种方式OK的
                }
            }
            for (int n=0;n<array.length();n++){
                JSONObject jsonObject = array.getJSONObject(n);
                System.out.println(jsonObject.toString());
                oldJsonArray.put(jsonObject);
            }
            patientRehabilitationPlanDO.setDetailJson(oldJsonArray.toString());
        } else{
            System.out.println("detail===="+array.toString());
            patientRehabilitationPlanDO.setDetailJson(array.toString());
            deleteDetailByPlanId(planId, DateUtil.getDateShort(new Date()));
        }
        JSONArray array1 = new JSONArray();
@ -1253,9 +1306,22 @@ public class RehabilitationPlanService extends BaseJpaService<PatientRehabilitat
            }
        }
        String planDetails = array1.toString();
        PatientRehabilitationPlanDO patientRehabilitationPlanDO= patientRehabilitationPlanDao.findById(planId);
        if (patientRehabilitationPlanDO!=null){
            patientRehabilitationPlanDO.setDetailJson(array.toString());
            if (object.has("adviceContent")){
                patientRehabilitationPlanDO.setAdviceContent(object.getString("adviceContent"));
            }
            if (object.has("disease")){
                patientRehabilitationPlanDO.setDisease(object.getString("disease"));
            }
            if (object.has("diseaseName")){
                patientRehabilitationPlanDO.setDiseaseName(object.getString("diseaseName"));
            }
            if (object.has("healthStatusCode")){
                patientRehabilitationPlanDO.setHealthStatusCode(object.getString("healthStatusCode"));
            }
            patientRehabilitationPlanDao.save(patientRehabilitationPlanDO);
        }
        ObjectMapper object1 = new ObjectMapper();
@ -1467,4 +1533,36 @@ public class RehabilitationPlanService extends BaseJpaService<PatientRehabilitat
    public PatientRehabilitationPlanDO findByPlanById(String planId){
        return patientRehabilitationPlanDao.findById(planId);
    }
    public WlyyDoctorOperateRecordDO saveRecordDetail(WlyyDoctorOperateRecordDO wlyyDoctorOperateRecordDO){
        wlyyDoctorOperateRecordDO.setCreateTime(new Date());
        BaseDoctorDO baseDoctorDO = doctorDao.findById(wlyyDoctorOperateRecordDO.getCreateUser());
        if (baseDoctorDO!=null){
            wlyyDoctorOperateRecordDO.setCreateUserName(baseDoctorDO.getName());
        }
        if (StringUtils.isNotBlank(wlyyDoctorOperateRecordDO.getOperator())){
            BaseDoctorDO nowOperator = doctorDao.findById(wlyyDoctorOperateRecordDO.getCreateUser());
            if (nowOperator!=null){
                wlyyDoctorOperateRecordDO.setOperatorName(nowOperator.getName());
            }
        }
        return wlyyDoctorOperateRecordDao.save(wlyyDoctorOperateRecordDO);
    }
    public MixEnvelop findRecordByDetailId(String detailId,Integer page,Integer pageSize){
        // 排序
        Sort sort = new Sort(Sort.Direction.DESC, "createTime");
        // 分页信息
        PageRequest pageRequest = new PageRequest(page-1, pageSize, sort);
        Page<WlyyDoctorOperateRecordDO> pageList=wlyyDoctorOperateRecordDao.findByplandetailId(detailId,pageRequest);
        MixEnvelop mixEnvelop = new MixEnvelop();
        Integer count =0;
        if (wlyyDoctorOperateRecordDao.getCountByplandetailId(detailId)!=null){
            count=wlyyDoctorOperateRecordDao.getCountByplandetailId(detailId);
        }
        mixEnvelop.setDetailModelList(pageList.getContent());
        mixEnvelop.setPageSize(pageSize);
        mixEnvelop.setCurrPage(page);
        mixEnvelop.setTotalCount(count);
        return mixEnvelop;
    }
}

+ 19 - 13
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/followUp/FollowUpService.java

@ -180,7 +180,7 @@ public class FollowUpService {
                    throw new Exception("not exit doctor:" + doctorCode + ".\r\n");
                }
                Followup followup = new Followup();
                followup.setFollowJson(map.get("followJson"));
                followup.setFollowJson(map.get("followUpJson"));
                followup.setFollowupType(String.valueOf(map.get("type")));
                Date date = DateUtil.strToDate(map.get("date"));
                followup.setFollowupDate(date);
@ -195,11 +195,7 @@ public class FollowUpService {
                followup.setPatientName(patient.getName());
                followup.setIdcard(patient.getIdcard());
                followup.setDataFrom("2");//数据来源 1基卫 2APP
                if (map.get("followJson")!=null){
                    followup.setStatus("1");
                }else {
                    followup.setStatus("2");
                }
                followup.setStatus("2");
                    //状态 0取消 1已完成 2未开始 3进行中
                followup.setCreateTime(new Date());
                followup.setCreater(doctorCode);
@ -413,10 +409,11 @@ public class FollowUpService {
    /**
     * 完成随访记录,并上传随访记录
     */
    public void finishFollowup(String id) throws Exception {
    public void finishFollowup(String id,String followUpJson) throws Exception {
        Followup followup = followupDao.findOne(Integer.valueOf(id));
        if (followup != null) {
            followup.setStatus("1");  //状态 0取消 1已完成 2未开始 3进行中
            followup.setFollowJson(followUpJson);
            followup = followupDao.save(followup);
            //上传随访计划映射表记录
@ -435,11 +432,11 @@ public class FollowUpService {
            followUpMappingDao.save(followupMapping);
            //随访完成,增加随访状态完成的标记
            WlyyPrescriptionDO prescription = prescriptionDao.findOne(followup.getPrescriptionCode());
            /*WlyyPrescriptionDO prescription = prescriptionDao.findOne(followup.getPrescriptionCode());
            if(prescription  != null){
                //prescription.setViewSuifang(1);
                prescriptionDao.save(prescription);
            }
            }*/
//            new Thread(new FollowupUploadTask(String.valueOf(followup.getId()))).start();
        } else {
@ -541,12 +538,12 @@ public class FollowUpService {
        String followupClass = followup.getFollowupClass();
        re.put("followupClass", followupClass);
        String followupClassName = wlyyHospitalSysDictService.getDictValue("FOLLOWUP_CLASS_DICT", followup.getFollowupClass());
        String followupClassName = wlyyHospitalSysDictService.getDictValue("diseaseType", followup.getFollowupClass());
        if (StringUtils.isNoneBlank(followupClass) && followupClass.contains(",")) {
            String[] followupClassArray = followupClass.split(",");
            followupClassName = "";
            for (int i = 0; i < followupClassArray.length; i++) {
                followupClassName += wlyyHospitalSysDictService.getDictValue("FOLLOWUP_CLASS_DICT", followupClassArray[i]);
                followupClassName += wlyyHospitalSysDictService.getDictValue("diseaseType", followupClassArray[i]);
                if (i != followupClassArray.length - 1) {
                    followupClassName += ",";
                }
@ -668,7 +665,15 @@ public class FollowUpService {
     */
    public void getNotStartFollowup(String doctor, Date followupPlanDate) {
        //如果计划随访日已经没有未开始状态的随访计划,就将该天的随访消息设成已操作状态
        String now = DateUtil.dateToStrShort(followupPlanDate);
        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
        String now="";
        if (followupPlanDate==null){
            now =  sf.format(new Date());
        }else {
            now = sf.format(followupPlanDate);
        }
        System.out.println(now);
        String start = now + " 00:00:00";
        String end = now + " 23:59:59";
@ -678,7 +683,8 @@ public class FollowUpService {
        Long followupToday = jdbcTemplate.queryForObject(sql, Long.class);
        System.out.println("计划中随访:" + followupToday);
        if(followupToday == 0){
            systemMessageDao.setMessageOverByType(doctor, 4, DateUtil.strToDateLong(start), DateUtil.strToDateLong(end));
            String upSql="update base_system_message a set a.is_read = '0',a.over = '0' where a.receiver = '"+doctor+"' and a.type = 4 and (a.create_time > '"+start+"' and a.create_time< '"+end+"')";
            jdbcTemplate.update(upSql);
        }
    }

File diff suppressed because it is too large
+ 1 - 0
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/controller/rehabilitation/RehabilitationPlanController.java


+ 2 - 2
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/dao/rehabilitation/RehabilitationOperateRecordsDao.java

@ -12,9 +12,9 @@ import java.util.List;
 * Created by 刘文彬 on 2018/8/29.
 */
public interface RehabilitationOperateRecordsDao extends PagingAndSortingRepository<RehabilitationOperateRecordsDO, Long>,JpaSpecificationExecutor<RehabilitationOperateRecordsDO> {
    @Query("from RehabilitationOperateRecordsDO t where t.rehabilitationDetailId=?1 order by t.createTime desc")
    List<RehabilitationOperateRecordsDO> findByRehabilitationDetailId(String rehabilitationDetailId);
    @Query("from RehabilitationOperateRecordsDO t where t.rehabilitationDetailId=?1 and t.id=?2 order by t.createTime desc")
    List<RehabilitationOperateRecordsDO> findByRehabilitationDetailIdAndId(String rehabilitationDetailId,String id);
    @Modifying

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

@ -1274,6 +1274,7 @@ public class RehabilitationManageService {
        rehabilitationOperateRecordsDO.setPatientName(patientRehabilitationPlanDO.getName());
        rehabilitationOperateRecordsDO.setDoctorCode(jsonObject.getString("doctorCode"));
        rehabilitationOperateRecordsDO.setDoctorName(jsonObject.getString("doctorName"));
        rehabilitationOperateRecordsDO.setNode("电话关怀");
        rehabilitationOperateRecordsDO.setRelationRecordType(5);
        rehabilitationOperateRecordsDO.setCompleteTime(new Date());
        rehabilitationOperateRecordsDO.setCreateTime(new Date());

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

@ -379,6 +379,8 @@ public class RehabilitationPlanService extends BaseJpaService<RehabilitationPlan
        rehabilitationOperateRecordsDO.setCreateTime(new Date());
        rehabilitationOperateRecordsDO.setUpdateTime(new Date());
        rehabilitationOperateRecordsDO.setStatus(rehabilitationOperateRecordsDO.getStatus());
        System.out.println("saveRehabilitationOperateRecord=="+rehabilitationOperateRecordsDO.getStatus());
        System.out.println("id==="+rehabilitationOperateRecordsDO.getId());
        if (StringUtils.isEmpty(rehabilitationOperateRecordsDO.getPatientName())){
            String sql ="select name from "+basedb+".wlyy_patient where code='"+rehabilitationOperateRecordsDO.getPatientCode()+"'";
            List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);