wangjun 3 anni fa
parent
commit
f2340c4571
26 ha cambiato i file con 470 aggiunte e 114 eliminazioni
  1. 0 1
      business/base-service/src/main/java/com/yihu/jw/rehabilitation/DoctorPatientRelationDao.java
  2. 65 10
      business/base-service/src/main/java/com/yihu/jw/rehabilitation/service/DoctorPatientRelationService.java
  3. 10 0
      common/common-entity/src/main/java/com/yihu/jw/entity/followup/Followup.java
  4. 10 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/message/SystemMessageDO.java
  5. 2 1
      common/common-entity/src/main/java/com/yihu/jw/entity/rehabilitation/SpecialDiseaseMessagesDO.java
  6. 10 0
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/rehabilitation/PatientRehabilitationPlanDO.java
  7. 1 6
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/controller/RehabilitationPlanController.java
  8. 33 11
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/controller/consult/ConsultController.java
  9. 3 2
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/controller/consult/DoctorConsultController.java
  10. 11 0
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/controller/doctor/DoctorRehabilitaionInfoController.java
  11. 37 1
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/controller/doctor/DoctorRehabilitationManageController.java
  12. 12 0
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/controller/doctor/DoctorRehabilitationPlanController.java
  13. 34 0
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/controller/followUp/DoctorFollowUpController.java
  14. 22 19
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/controller/followUp/DoctorPhthisisFollowupController.java
  15. 1 1
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/dao/GuidanceMessageLogDao.java
  16. 1 1
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/dao/RehabilitationDetailAppointmentDao.java
  17. 5 0
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/dao/RehabilitationDetailDao.java
  18. 1 1
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/dao/RehabilitationOperateRecordsDao.java
  19. 4 4
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/dao/consult/EvaluateDao.java
  20. 2 2
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/dao/consult/EvaluateLabelDao.java
  21. 2 2
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/dao/consult/EvaluateScoreDao.java
  22. 19 1
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/RehabilitationInfoService.java
  23. 65 13
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/RehabilitationManageService.java
  24. 73 10
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/RehabilitationPlanService.java
  25. 36 26
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/consult/ConsultTeamService.java
  26. 11 2
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/followUp/FollowUpService.java

+ 0 - 1
business/base-service/src/main/java/com/yihu/jw/rehabilitation/DoctorPatientRelationDao.java

@ -15,5 +15,4 @@ public interface DoctorPatientRelationDao extends PagingAndSortingRepository<Doc
    @Query("from DoctorPatientRelationDO t where t.doctor =?1 and t.patient =?2 and t.dischargeRecord = ?3")
    DoctorPatientRelationDO findByDoctorAndPatientAndCode(String doctor,String patient,String code);
}

+ 65 - 10
business/base-service/src/main/java/com/yihu/jw/rehabilitation/service/DoctorPatientRelationService.java

@ -6,16 +6,20 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.jw.entity.patient.Patient;
import com.yihu.jw.entity.specialist.DoctorPatientRelationDO;
import com.yihu.jw.entity.specialist.rehabilitation.PatientMedicalRecordsDO;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
import com.yihu.jw.rehabilitation.DoctorPatientRelationDao;
import com.yihu.jw.rehabilitation.PatientMedicalRecordsDao;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.jw.wlyy.wlyyhttp.WlyyHttpService;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.security.MD5;
import org.apache.commons.lang3.StringUtils;
@ -23,10 +27,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.*;
@Service
public class DoctorPatientRelationService <T, R extends CrudRepository> extends BaseJpaService<DoctorPatientRelationDO, DoctorPatientRelationDao> {
@ -43,6 +44,10 @@ public class DoctorPatientRelationService <T, R extends CrudRepository> extends
    private DoctorPatientRelationDao doctorPatientRelationDao;
    @Autowired
    private PatientMedicalRecordsDao patientMedicalRecordsDao;
    @Autowired
    private WlyyHttpService wlyyHttpService;
    @Autowired
    private BasePatientMedicareCardDao patientMedicareCardDao;
    public MixEnvelop findDoctorPatients(String doctor, String patient, String patientName, String isdeal, String idcard,Integer page , Integer pageSize){
        MixEnvelop mixEnvelop = new MixEnvelop();
@ -54,6 +59,7 @@ public class DoctorPatientRelationService <T, R extends CrudRepository> extends
                " t.patient_name as \"patientName\"," +
                " t.create_time as \"createTime\"," +
                " t.isdeal as \"isdeal\"," +
                " b.photo as \"photo\"," +
                " b.idcard as \"idcard\"," +
                " t.status as \"status\"," +
                " t.relation_type as \"relationType\"" +
@ -122,9 +128,12 @@ public class DoctorPatientRelationService <T, R extends CrudRepository> extends
        }else if ("2".equalsIgnoreCase(relationType)){
            recordCode=reOutpatientId;
        }
        DoctorPatientRelationDO doctorPatientRelationDO = doctorPatientRelationDao.findByDoctorAndPatientAndCode(doctor,basePatientDO.getId(),recordCode);
        if (doctorPatientRelationDO==null){
            doctorPatientRelationDO = new DoctorPatientRelationDO();
        List<DoctorPatientRelationDO> doctorPatientRelationDOs = doctorPatientRelationDao.findByDoctorAndPatient(doctor,basePatientDO.getId());
        DoctorPatientRelationDO doctorPatientRelationDO =null;
        if (doctorPatientRelationDOs!=null&&doctorPatientRelationDOs.size()>0){
            doctorPatientRelationDO = doctorPatientRelationDOs.get(0);
        }else {
            doctorPatientRelationDO= new DoctorPatientRelationDO();
        }
        doctorPatientRelationDO.setPatient(basePatientDO.getId());
        doctorPatientRelationDO.setPatientName(basePatientDO.getName());
@ -148,19 +157,63 @@ public class DoctorPatientRelationService <T, R extends CrudRepository> extends
     * @param doctorCode
     * @return
     */
    public JSONObject getPatientByIdcardOrSsc(String patientInfo, String doctorCode) {
    public JSONObject getPatientByIdcardOrSsc(String patientInfo, String doctorCode) throws Exception {
        JSONObject data = new JSONObject();
        BasePatientDO patientList = basePatientDao.findByIdcardAndDel(patientInfo,"1");
        BasePatientDO patient = null;
        String recordCode="123";
        if(patientList==null){
            //未找到居民,从健康档案添加居民
            patient = new BasePatientDO();//todo 调用医院查询居民接口
            /*patient = new BasePatientDO();//todo 调用医院查询居民接口
            patient.setName("测试");
            patient.setSex(1);
            patient.setIdcard("210555111199992525");
            patient.setPhone("18877777777");
            basePatientDao.save(patient);
            basePatientDao.save(patient);*/
            Map<String,String> params = new HashMap<>();
            params.put("idcard",patientInfo);
            JSONObject rs = wlyyHttpService.sendWlyyMes("wlyyGetPatient",null,params);
            if(rs!=null){
                Integer status = rs.getInteger("status");
                if(200 == status){
                    JSONObject dataPatient = rs.getJSONObject("data");
                    BasePatientDO patientNew = new BasePatientDO();
                    String salt = UUID.randomUUID().toString().substring(0,5);
                    String mobile = dataPatient.getString("mobile");
                    String pw = null;
                    if(StringUtils.isNotBlank(mobile)){
                        pw = mobile.substring(mobile.length()-6);
                    }else{
                        pw = patientInfo.substring(patientInfo.length()-6);
                    }
                    patientNew.setIdcard(patientInfo);
                    patientNew.setName(data.getString("name"));
                    patientNew.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
                    patientNew.setSalt(salt);
                    patientNew.setMobile(mobile);
                    patientNew.setDel("1");
                    patientNew.setEnabled(1);
                    patientNew.setLocked(0);
                    patientNew.setCreateTime(new Date());
                    patientNew.setUpdateTime(new Date());
                    patientNew.setBirthday(DateUtil.strToDate(data.getString("birthday"),"yyyyMMdd"));
                    patient = basePatientDao.save(patientNew);
                    if(data.get("ssc")!=null){
                        PatientMedicareCardDO patientMedicareCardDO = new PatientMedicareCardDO();
                        patientMedicareCardDO.setDel("1");
                        patientMedicareCardDO.setPatientCode(patient.getId());
                        patientMedicareCardDO.setCode(data.getString("ssc"));
                        patientMedicareCardDO.setType("A_01");
                        patientMedicareCardDao.save(patientMedicareCardDO);
                    }
                }else{
                    throw new Exception("请求i健康接口,获取居民信息失败");
                }
            }
        }else{
            patient = patientList;
        }
@ -181,6 +234,8 @@ public class DoctorPatientRelationService <T, R extends CrudRepository> extends
        doctorPatientRelationDO.setDoctor(doctorCode);
        doctorPatientRelationDO.setDoctorName(doctor==null?"":doctor.getName());
        doctorPatientRelationDO.setIsdeal("0");
        doctorPatientRelationDO.setCreateUser(doctorCode);
        doctorPatientRelationDO.setCreateUserName(doctor==null?"":doctor.getName());
        doctorPatientRelationDO.setStatus("0");
        doctorPatientRelationDO.setRelationType("");
        doctorPatientRelationDO.setDischargeRecord("");

+ 10 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/followup/Followup.java

@ -87,6 +87,16 @@ public class Followup extends IntegerIdentityEntity {
	private List<Map<String,Object>> followupLabelPatient;
	//居民头像
	private String photo;
	private String followJson;
	@Column(name = "follow_json")
	public String getFollowJson() {
		return followJson;
	}
	public void setFollowJson(String followJson) {
		this.followJson = followJson;
	}
	//随访类型1、新增随访、2临时随访、3入户访视
	private Integer type;
	//随访角色【FAMILY_WORK_TYPE_DICT】【1. 专科医生 2. 全科医生 3. 健康管理师】

+ 10 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/message/SystemMessageDO.java

@ -77,6 +77,16 @@ public class SystemMessageDO extends UuidIdentityEntity {
    private Integer readonly;
    private String reason;
    private String senderPhoto;
    private String code;
    @Column(name = "code")
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    @Column(name = "content")
    public String getContent() {
        return content;

+ 2 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/rehabilitation/SpecialDiseaseMessagesDO.java

@ -1,6 +1,7 @@
package com.yihu.jw.entity.rehabilitation;
import com.yihu.jw.entity.IdEntity;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
@ -13,7 +14,7 @@ import javax.persistence.Table;
 */
@Entity
@Table(name = "wlyy_special_disease_messages")
public class SpecialDiseaseMessagesDO extends IdEntity {
public class SpecialDiseaseMessagesDO extends UuidIdentityEntity {
    private String name;
    private String address;

+ 10 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/rehabilitation/PatientRehabilitationPlanDO.java

@ -59,8 +59,18 @@ public class PatientRehabilitationPlanDO extends UuidIdentityEntity implements S
    private String healthStatusCode;//健康情况
    private String isVerify;
    private String detailJson;
    private Long adminTeamCode;//家签行政团队Id
    @Column(name = "detail_json")
    public String getDetailJson() {
        return detailJson;
    }
    public void setDetailJson(String detailJson) {
        this.detailJson = detailJson;
    }
    @Column(name = "is_verify")
    public String getIsVerify() {

+ 1 - 6
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/controller/RehabilitationPlanController.java

@ -4,24 +4,19 @@ import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.hospital.doctor.Frequency;
import com.yihu.jw.entity.specialist.rehabilitation.*;
import com.yihu.jw.rehabilitation.RehabilitationOperateRecordsDao;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.specialist.SpecialistMapping;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.rehabilitation.dao.FrequencyDao;
import com.yihu.rehabilitation.dao.RehabilitationOperateRecordsDao;
import com.yihu.rehabilitation.service.RehabilitationPlanService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;

+ 33 - 11
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/controller/consult/ConsultController.java

@ -9,8 +9,10 @@ import com.yihu.jw.message.service.MessageService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.wechat.enterprise.EnterpriseService;
import com.yihu.rehabilitation.dao.SignFamilyDao;
import com.yihu.rehabilitation.service.consult.ConsultTeamService;
import com.yihu.rehabilitation.service.followUp.FollowUpService;
import com.yihu.rehabilitation.util.BusinessLogs;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -24,10 +26,7 @@ import org.springframework.data.domain.Page;
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.text.SimpleDateFormat;
import java.util.ArrayList;
@ -47,6 +46,12 @@ public class ConsultController extends EnvelopRestEndpoint {
    @Autowired
    private ConsultTeamService consultTeamService;
    @Autowired
    private EnterpriseService enterpriseService;
    @Value("wechat.id")
    private String wxId;
    @Autowired
    private FollowUpService followUpService;
    /**
     * 三师咨询添加接口
@ -67,6 +72,7 @@ public class ConsultController extends EnvelopRestEndpoint {
                       @RequestParam(required = false) String images,
                       @RequestParam(required = false) String voice,
                       @RequestParam(required = false) Long guidance,
                       @RequestParam(required = false) String patient,
                       @RequestParam(required = false) String doctor) {
        try {
            System.out.println("guidance1="+guidance);
@ -101,13 +107,13 @@ public class ConsultController extends EnvelopRestEndpoint {
            // 保存到数据库
            int res = 0;
            JSONArray dts = null;
            synchronized (getUID().intern()){//新增同步方法。设备保存写在service层但是不生效,写在controller层才生效
            synchronized (patient.intern()){//新增同步方法。设备保存写在service层但是不生效,写在controller层才生效
                JSONObject re;
                if(type==18){//康复咨询
                    re = consultTeamService.addRecoverConsult(consult,getRepUID(),getUID());
                    re = consultTeamService.addRecoverConsult(consult,patient,getUID());
                }
                else{
                    re = consultTeamService.addTeamConsult(consult,getRepUID(), getUID());
                    re = consultTeamService.addTeamConsult(consult,patient, getUID());
                }
                res = re.getInt("status");
                dts = re.has("doctor")?re.getJSONArray("doctor"):null;
@ -127,7 +133,21 @@ public class ConsultController extends EnvelopRestEndpoint {
            // consult.setGroupCode(jo.getString("groupCode"));
            //更新讨论组
            //consultTeamService.save(consult);
            //推送消息给医生
            String baseUrl = followUpService.findDomainUrlInDict();
            String msg=consult.getDoctorName()+"医生您好,有患者向您发起咨询,请进入手机APP查看。";
            String title="您有新的指定咨询";
            if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
                String url=baseUrl+"/hlwyy/ims-app-web/#/onlineChat/detail?_rs_title="+consult.getSymptoms()+"&type=3&id="+consult.getId();
                enterpriseService.sendTWMesByDoctor("zsyy",doctor,title,msg,url);
            }else if(wxId.equalsIgnoreCase("xm_ykyy_wx")){
                String url=baseUrl+"/ims-app-web/#/onlineChat/detail?_rs_title="+consult.getSymptoms()+"&type=3&id="+consult.getId();
                enterpriseService.sendTWMesByDoctor("xm_ykyy_wx",doctor,title,msg,url);
            }else if (wxId.equalsIgnoreCase("xm_xzzx_wx")){
                String url="https://ih.xmheart.com/hlwyy/ims-app-web/#/onlineChat/detail?_rs_title="+consult.getSymptoms()+"&type=3&id="+consult.getId();
                enterpriseService.sendTWMesByDoctor("xm_xzzx_wx",doctor,title,msg,url);
            }
            System.out.println("发送企业模板消息成功");
            BusinessLogs.info(BusinessLogs.BusinessType.consult, getRepUID(), getUID(), new JSONObject(consult));
            return success("提交成功",  consult);
        } catch (Exception ex) {
@ -164,20 +184,22 @@ public class ConsultController extends EnvelopRestEndpoint {
     * @return
     */
    @ApiOperation("查询与某个医生是否存在未结束的咨询")
    @RequestMapping(value = "/is_consult_unfinished",method = RequestMethod.POST)
    @PostMapping(value = "/is_consult_unfinished")
    @ResponseBody
    public Envelop isExistsUnfinishedConsult(@RequestParam(required = false) String patient,
                                             @RequestParam(required = false) String type,
                                             @RequestParam(required = true) String doctor) {
        try {
            JSONObject result = new JSONObject();
            List<Map<String,Object>> consults = consultTeamService.getUnfinishedConsult(StringUtils.isEmpty(patient) ? getUID() : patient, doctor);
            List<Map<String,Object>> consults = consultTeamService.getUnfinishedConsult(StringUtils.isEmpty(patient) ? getUID() : patient, doctor,type);
            if (consults != null && consults.size() > 0) {
                return success("查询成功",  consults.get(0).get("consult"));
            } else {
                return failed( "查询成功" );
                return success( "查询成功" );
            }
        } catch (Exception e) {
            e.printStackTrace();
            return failedException(e);
        }
    }

+ 3 - 2
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/controller/consult/DoctorConsultController.java

@ -62,12 +62,13 @@ public class DoctorConsultController extends EnvelopRestEndpoint {
    @ApiOperation("获取续方咨询列表")
    public Envelop getKangFuConsultList(@ApiParam(name = "title", value = "咨询标题") @RequestParam(required = false) String title,
                                        @ApiParam(name = "patient", value = "居民CODE") @RequestParam(required = false) String patient,
                                        @ApiParam(name = "doctor", value = "医生CODE") @RequestParam(required = false) String doctor,
                                        @ApiParam(name = "id", value = "第几页") @RequestParam(required = true) Integer id,
                                        @ApiParam(name = "pagesize", value = "页面大小") @RequestParam(required = true) int pagesize){
        try {
            JSONArray array = new JSONArray();
//            Page<Object> data = consultTeamService.findConsultRecordByType("a663d0cf7f8c4d38a8327cedc921e65f", id, pagesize,8, title);//8表示续方咨询
            List<Map<String,Object>> data = consultTeamService.findConsultRecordByType(patient, id, pagesize,18, title);//18表示康复咨询
            List<Map<String,Object>> data = consultTeamService.findConsultRecordByType(patient,doctor, id, pagesize,18, title);//18表示康复咨询
            BasePatientDO patientobj = basePatientDao.findById(patient);
            if (data != null) {
                for (Map<String,Object> consult : data) {
@ -96,7 +97,7 @@ public class DoctorConsultController extends EnvelopRestEndpoint {
                    array.put(json);
                }
            }
            return success( "查询成功!",  array);
            return success( "查询成功!",  array.toString());
        } catch (Exception e) {
            e.printStackTrace();
            return failedException(e);

+ 11 - 0
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/controller/doctor/DoctorRehabilitaionInfoController.java

@ -163,4 +163,15 @@ public class DoctorRehabilitaionInfoController extends EnvelopRestEndpoint {
            return failed( "查询失败!");
        }
    }
    @RequestMapping(value = "/getFrontCount", method = RequestMethod.GET)
    @ApiOperation(value = "数量")
    public Envelop getFrontCount(@RequestParam(required = false)
                                @ApiParam(value = "医生id", name = "doctor") String doctor) {
        try {
            return success("操作成功!", rehabilitationInfoService.findRehabilitationCountByDoctor(doctor));
        } catch (Exception e) {
            return failed( "查询失败!");
        }
    }
}

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

@ -771,7 +771,7 @@ public class DoctorRehabilitationManageController extends EnvelopRestEndpoint {
    public Envelop confirmManage(@ApiParam(name = "doctor", value = "签约医生code", required = true)
                                @RequestParam(value = "doctor", required = true) String signDoctor,
                                @ApiParam(name = "patient", value = "居民code", required = true)
                                @RequestParam(value = "patient", required = true) String patient,
                                    @RequestParam(value = "patient", required = true) String patient,
                                @ApiParam(name = "specialist", value = "专医code", required = true)
                                @RequestParam(value = "specialist", required = true) String specialist,
                                @ApiParam(name = "relationId", value = "签约关系id", required = true)
@ -1062,4 +1062,40 @@ public class DoctorRehabilitationManageController extends EnvelopRestEndpoint {
    }
    @RequestMapping(value = "findPatientRehabilitaionList", method = RequestMethod.GET)
    @ApiOperation("康复管理-查询计划列表")
    public Envelop findPatientRehabilitaionList(@ApiParam(name = "diseaseCode", value = "diseaseCode", required = false)
                                          @RequestParam(value = "diseaseCode", required = false) String diseaseCode,
                                          @ApiParam(name = "patientCondition", value = "patientCondition", required = false)
                                          @RequestParam(value = "patientCondition", required = false) String patientCondition,
                                          @ApiParam(name = "doctor", value = "医生code", required = false)
                                          @RequestParam(value = "doctor", required = false) String doctor,
                                          @ApiParam(name = "page", value = "页码", required = false)
                                          @RequestParam(value = "page", required = false) Integer page,
                                          @ApiParam(name = "pagesize", value = "每页大小", required = false)
                                          @RequestParam(value = "pagesize", required = false) Integer pagesize) {
        try {
            return success( "请求成功!", rehabilitationManageService.findPatientRehabilitation(doctor,diseaseCode,patientCondition,page,pagesize));
        } catch (Exception e) {
            e.printStackTrace();
            return failed( "请求失败");
        }
    }
    @RequestMapping(value = "deleteRehabilitaionPlan", method = RequestMethod.GET)
    @ApiOperation("康复管理-查询计划列表")
    public Envelop findPatientRehabilitaionList(@ApiParam(name = "planId", value = "planId", required = false)
                                                @RequestParam(value = "planId", required = false) String planId,
                                                @ApiParam(name = "doctor", value = "doctor", required = false)
                                                @RequestParam(value = "doctor", required = false) String doctor) {
        try {
            rehabilitationManageService.delteRehabilitaionPlan(planId,doctor);
            return success( "请求成功!" );
        } catch (Exception e) {
            e.printStackTrace();
            return failed( "请求失败");
        }
    }
}

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

@ -462,4 +462,16 @@ public class DoctorRehabilitationPlanController extends EnvelopRestEndpoint {
            return failed("发送失败");
        }
    }
    @RequestMapping(value = "/findRehabilitationJson", method = RequestMethod.GET)
    @ApiOperation(value = "获取计划详情")
    public Envelop findRehabilitationJson(@ApiParam(name = "planId", value = "planId")
                                      @RequestParam(required = true)String planId){
        try {
            return success( "获取成功", rehabilitationPlanService.findByPlanById(planId));
        } catch (Exception e) {
            e.printStackTrace();
            return failed( "请求失败");
        }
    }
}

+ 34 - 0
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/controller/followUp/DoctorFollowUpController.java

@ -531,4 +531,38 @@ public class DoctorFollowUpController  extends EnvelopRestEndpoint {
            return failed( "获取随访项目数据失败!" + e.getMessage());
        }
    }
    @ApiOperation("新增临时随访记录(返回ID)")
    @RequestMapping(value = "/addFollowup", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
    @ResponseBody
    @ObserverRequired
    public Envelop addFollowup(@ApiParam(name = "followUpJson", value = "followUpJson")
                                   @RequestParam(value = "followUpJson", required = false) String followUpJson,
            @ApiParam(name = "doctor", value = "医生代码", defaultValue = "443a196ef8744536a531260eb26c05d7")
                              @RequestParam(value = "doctor", required = true) String doctor,
                              @ApiParam(name = "patient", value = "患者代码", defaultValue = "443a196ef8744536a531260eb26c05d7")
                              @RequestParam(value = "patient", required = true) String patient,
                              @ApiParam(name = "date", value = "下次随访时间", defaultValue = "2016-12-15 20:00:00")
                              @RequestParam(value = "date", required = true) String date,
                              @ApiParam(name = "followupType", value = "随访方式【字典FOLLOWUP_WAY_DICT】", defaultValue = "12")
                              @RequestParam(value = "followupType", required = true) String followupType,
                              @ApiParam(name = "followupClass", value = "随访类别【1.高血压 2.糖尿病 3高糖】", defaultValue = "1")
                              @RequestParam(value = "followupClass", required = true) String followupClass,
                              @ApiParam(name = "followupManagerStatus", value = "随访管理状态【字典FOLLOWUP_MANAGER_STATUS】", defaultValue = "1")
                              @RequestParam(value = "followupManagerStatus", required = false) String followupManagerStatus,
                              @ApiParam(name = "plandate", value = "下次随访时间", defaultValue = "2016-12-14 20:00:00")
                              @RequestParam(value = "plandate", required = false) String plandate,
                              @ApiParam(name = "prescriptioncode", value = "续方CODE", defaultValue = "续方CODE")
                              @RequestParam(value = "prescriptioncode", required = false) String prescriptioncode) {
        try {
            String response = followUpService.addFollowup(followUpJson,doctor, patient, date, followupType, followupClass, followupManagerStatus,plandate,prescriptioncode,null
            );
            return success( "新增临时随访记录成功!", response);
        } catch (Exception e) {
            e.printStackTrace();
            return failedException(e);
        }
    }
}

+ 22 - 19
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/controller/followUp/DoctorPhthisisFollowupController.java

@ -1,8 +1,9 @@
package com.yihu.wlyy.web.doctor.followup;
package com.yihu.rehabilitation.controller.followUp;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.service.app.followup.PhthisisFollowupService;
import com.yihu.wlyy.web.BaseController;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.rehabilitation.service.followUp.PhthisisFollowupService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -20,60 +21,62 @@ import java.util.List;
@RestController
@RequestMapping(value = "/doctor/phthisis", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(value = "医生端-肺结核随访记录服务")
public class DoctorPhthisisFollowupController extends BaseController {
public class DoctorPhthisisFollowupController  extends EnvelopRestEndpoint {
    @Autowired
    private PhthisisFollowupService phthisisFollowupService;
    @PostMapping(value = "/saveFirst")
    @ApiOperation(value = "保存第一次肺结核随访数据")
    public String saveFirstFollowup(@ApiParam(name = "jsonData", value = "随访json") @RequestParam(value = "jsonData", required = true) String jsonData) {
    public Envelop saveFirstFollowup(@ApiParam(name = "jsonData", value = "随访json") @RequestParam(value = "jsonData", required = true) String jsonData) {
        StringBuilder errMsg = new StringBuilder();
        try {
            if(!phthisisFollowupService.saveFirstFollowup(jsonData,errMsg)){
                return error( -1, "保存第一次肺结核随访数据失败," + errMsg);
                return failed(  "保存第一次肺结核随访数据失败," + errMsg);
            }
        } catch (Exception e) {
            return errorResult(e);
            e.printStackTrace();
            return failedException(e);
        }
        return write(200, "保存第一次肺结核随访数据成功!");
        return success( "保存第一次肺结核随访数据成功!");
    }
    @PostMapping(value = "/saveNTimes")
    @ApiOperation("保存第n次肺结核随访数据")
    public String saveNTimesFollowup(@ApiParam(name = "jsonData", value = "随访json") @RequestParam(value = "jsonData", required = true) String jsonData) {
    public Envelop saveNTimesFollowup(@ApiParam(name = "jsonData", value = "随访json") @RequestParam(value = "jsonData", required = true) String jsonData) {
        StringBuilder errMsg = new StringBuilder();
        try {
            if(!phthisisFollowupService.saveNTimesFollowup(jsonData,errMsg)){
                return error( -1, "保存第n次肺结核随访数据失败," + errMsg);
                return failed( "保存第n次肺结核随访数据失败," + errMsg);
            }
        } catch (Exception e) {
            error(e);
            return error(-1, "保存第n次肺结核随访数据失败," + e.getMessage());
            e.printStackTrace();
            return failedException(e);
        }
        return write(200, "保存第n次肺结核随访数据成功!");
        return failed( "保存第n次肺结核随访数据成功!");
    }
    @GetMapping(value = "/getFirst")
    @ApiOperation("查询第一次肺结核随访数据详情")
    public String queryFirst(@ApiParam(name = "followupId", value = "随访记录ID")
    public Envelop queryFirst(@ApiParam(name = "followupId", value = "随访记录ID")
                                         @RequestParam(value = "followupId", required = true) String followupId) {
        try {
            JSONObject firstFollowupES = phthisisFollowupService.queryFirstByFollowupId(followupId);
            return write(200, "查询成功!", "data", firstFollowupES);
            return success( "查询成功!",  firstFollowupES);
        } catch (Exception e) {
            return invalidUserException(e, -1, "查询失败!" + e.getMessage());
            return failedException(e);
        }
    }
    @GetMapping(value = "/getNTimes")
    @ApiOperation("查询第n次肺结核随访数据详情")
    public String queryNTimes(@ApiParam(name = "followupId", value = "随访记录ID")
    public Envelop queryNTimes(@ApiParam(name = "followupId", value = "随访记录ID")
                                         @RequestParam(value = "followupId", required = true) String followupId) {
        try {
            List<JSONObject> ntimesFollowups = phthisisFollowupService.queryNTimesByFollowupId(followupId);
            return write(200, "查询成功!", "data", ntimesFollowups);
            return success("查询成功!", ntimesFollowups);
        } catch (Exception e) {
            return invalidUserException(e, -1, "查询失败!" + e.getMessage());
            e.printStackTrace();
            return failedException(e);
        }
    }

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

@ -1,4 +1,4 @@
package com.yihu.jw.rehabilitation;
package com.yihu.rehabilitation.dao;
import com.yihu.jw.entity.specialist.rehabilitation.GuidanceMessageLogDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

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

@ -1,4 +1,4 @@
package com.yihu.jw.rehabilitation;
package com.yihu.rehabilitation.dao;
import com.yihu.jw.entity.specialist.rehabilitation.RehabilitationDetailAppointmentDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

+ 5 - 0
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/dao/RehabilitationDetailDao.java

@ -91,4 +91,9 @@ public interface RehabilitationDetailDao extends PagingAndSortingRepository<Reha
    @Query("select d from RehabilitationDetailDO d where d.planId = ?1 and d.type=?2 and d.doctor=?3 and d.status<>?4 ")
    List<RehabilitationDetailDO> findByPlanIdAndTypeAndDoctorAndStatusNot(String planId, Integer type, String doctor, Integer status);
    @Modifying
    @Query("delete from RehabilitationDetailDO t where t.planId = ?1   and t.status <> 1 ")
    void deleteDetailOnlyByPlanId(String planId);
}

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

@ -1,4 +1,4 @@
package com.yihu.jw.rehabilitation;
package com.yihu.rehabilitation.dao;
import com.yihu.jw.entity.specialist.rehabilitation.RehabilitationOperateRecordsDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

+ 4 - 4
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/dao/consult/EvaluateDao.java

@ -17,26 +17,26 @@ public interface EvaluateDao extends PagingAndSortingRepository<BaseEvaluateDO,
     * @param consult
     * @return
     */
    List<BaseEvaluateDO> findByConsult(String consult);
   // List<BaseEvaluateDO> findByConsult(String consult);
    /**
     * 根据咨询获取实名或者匿名评分
     * @param consult
     * @return
     */
    List<BaseEvaluateDO> findByConsultAndType(String consult, int type);
   // List<BaseEvaluateDO> findByConsultAndType(String consult, int type);
    /**
     * 根据医生获取实名或者匿名评分
     * @param doctor
     * @return
     */
    List<BaseEvaluateDO> findByDoctorAndType(String doctor, int type);
   // List<BaseEvaluateDO> findByDoctorAndType(String doctor, int type);
    /**
     * 查找所有分数为零的接口
     */
    @Query("select a from Evaluate a where a.score =0")
    @Query("select a from BaseEvaluateDO a where a.score =0")
    List<BaseEvaluateDO> findByScoreZero();
}

+ 2 - 2
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/dao/consult/EvaluateLabelDao.java

@ -16,13 +16,13 @@ public interface EvaluateLabelDao extends PagingAndSortingRepository<SpecialistE
     * @param consult
     * @return
     */
    List<SpecialistEvaluateLabelDO> findByConsult(String consult);
    //List<SpecialistEvaluateLabelDO> findByConsult(String consult);
    /**
     * 获取某个医生的标签
     * @param doctor
     * @return
     */
    List<SpecialistEvaluateLabelDO> findByDoctor(String doctor);
   // List<SpecialistEvaluateLabelDO> findByDoctor(String doctor);
}

+ 2 - 2
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/dao/consult/EvaluateScoreDao.java

@ -19,7 +19,7 @@ public interface EvaluateScoreDao extends PagingAndSortingRepository<BaseEvaluat
     * @param consult
     * @return
     */
    List<BaseEvaluateScoreDO> findByConsult(String consult);
    /*List<BaseEvaluateScoreDO> find(String consult);
    List<BaseEvaluateScoreDO> findByConsultAndDoctor(String consult, String doctor);
    List<BaseEvaluateScoreDO> findByConsultAndDoctor(String consult, String doctor);*/
}

+ 19 - 1
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/RehabilitationInfoService.java

@ -25,6 +25,8 @@ import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.util.wechat.WeixinMessagePushUtils;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WxPushLogDao;
import com.yihu.jw.wechat.dao.WxTemplateConfigDao;
@ -86,6 +88,8 @@ public class RehabilitationInfoService {
    private XzzxEntranceService xzzxEntranceService;
    @Autowired
    private EntranceService entranceService;
    @Autowired
    private HibenateUtils hibenateUtils;
    @Value("${wechat.id}")
    private String wxId;
    //基卫服务地址
@ -277,7 +281,7 @@ public class RehabilitationInfoService {
                aa += "and  p.idcard like '%" + idcard + "%' ";
            }
            String sql = "SELECT * FROM (\n" +
                    "select d.id as  id, p.idcard,p.id as code,p.NAME patientName,p.sex,NULL age,p.address  from wlyy_doctor_patient_relation d,base_patient p\n" +
                    "select d.id as  id, p.idcard,p.id as patient,p.NAME patientName,p.sex,NULL age,p.address  from wlyy_doctor_patient_relation d,base_patient p\n" +
                    "where "+aa+"AND p. id = d.patient AND  d.patient NOT IN \n" +
                    "(   SELECT i.patient FROM wlyy_patient_rehabilitation_plan i,base_patient p   WHERE i.create_user = '"+doctorCode+"' \n" +
                    "AND i. STATUS != 0 AND p. id = i.patient GROUP BY i.patient ORDER BY i.create_time desc)GROUP BY d.patient ORDER BY d.create_time DESC\n" +
@ -587,4 +591,18 @@ public class RehabilitationInfoService {
        }
        return res;
    }
    public Integer findRehabilitationCountByDoctor(String doctor){
        String sql ="select DISTINCT t.id  from wlyy_patient_rehabilitation_plan t" +
                " left join wlyy_rehabilitation_plan_detail b on t.id = b.plan_id" +
                " where 1=1 ";
        if (StringUtils.isNoneBlank(doctor)){
            sql+=" and (b.doctor='"+doctor+"' or t.create_user ='"+doctor+"')";
        }
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);
        if (list!=null&&list.size()>0){
            return list.size();
        }else {
            return 0;
        }
    }
}

+ 65 - 13
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/RehabilitationManageService.java

@ -40,13 +40,16 @@ import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.PageRequest;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.management.MXBean;
import java.io.InputStream;
import java.sql.SQLClientInfoException;
import java.sql.Timestamp;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
@ -68,8 +71,6 @@ public class RehabilitationManageService {
    @Autowired
    private GuidanceMessageLogDao guidanceMessageLogDao;
    @Autowired
    private SpecialistPatientRelationDao specialistPatientRelationDao;
    @Autowired
    private RehabilitationOperateRecordsDao rehabilitationOperateRecordsDao;
    @Autowired
    private RehabilitationDetailAppointmentDao rehabilitationDetailAppointmentDao;
@ -183,7 +184,7 @@ public class RehabilitationManageService {
            sql+=" and p.disease='"+diseaseCode+"'";
        }
        if(StringUtils.isNotEmpty(patientCondition)){//姓名idcard模糊查询
            sql +=" AND EXISTS (select code from base_patient where  `id` = p.patient and ( `name` LIKE '%"+patientCondition+"%' or idcard like '%"+patientCondition+"%') )";
            sql +=" AND EXISTS (select id from base_patient where  `id` = p.patient and ( `name` LIKE '%"+patientCondition+"%' or idcard like '%"+patientCondition+"%') )";
        }
        if (doctorType==1){
            sql +=" AND (p.create_user = '"+doctorCode+"' \n" +
@ -272,8 +273,52 @@ public class RehabilitationManageService {
        return MixEnvelop.getSuccessListWithPage(SpecialistMapping.api_success,resultList,page,pageSize,Long.valueOf(count));
    }
    //查询康复计划
    public MixEnvelop findPatientRehabilitation(String doctor,String diseaseCode,String patientCondition,Integer page,Integer pageSize){
        String sql ="select DISTINCT t.* from wlyy_patient_rehabilitation_plan t left join base_patient b on t.patient=b.id" +
                " left join wlyy_rehabilitation_plan_detail p on t.id=p.plan_id   where 1=1";
        String countSql="select count(1) as \"count\" from wlyy_patient_rehabilitation_plan t  left join base_patient b on t.patient=b.id " +
                " left join wlyy_rehabilitation_plan_detail p on t.id=p.plan_id where 1=1";
        if (StringUtils.isNotBlank(doctor)){
            sql+=" and (t.create_user='"+doctor+"' or p.doctor='"+doctor+"')";
            countSql+=" and (t.create_user='"+doctor+"' or p.doctor='"+doctor+"')";
        }
        if (StringUtils.isNotBlank(diseaseCode)){
            sql+=" and t.disease='"+diseaseCode+"'";
            countSql+=" and t.disease='"+diseaseCode+"'";
        }
        if (StringUtils.isNotBlank(patientCondition)){
            sql+=" and (b.name like '%"+patientCondition+"%' or b.idcard like '%"+patientCondition+"%')";
            countSql+=" and (b.name like '%"+patientCondition+"%' or b.idcard like '%"+patientCondition+"%')";
        }
        countSql+=" group by t.id";
        sql+=" order by t.create_time desc";
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql,page,pageSize);
        List<Map<String,Object>> countList = hibenateUtils.createSQLQuery(countSql);
        Integer count=0;
        if (countList!=null&&countList.size()>0){
            count=Integer.parseInt(countList.get(0).get("count").toString());
        }
        MixEnvelop mixEnvelop= new MixEnvelop();
        mixEnvelop.setTotalCount(count);
        mixEnvelop.setDetailModelList(list);
        mixEnvelop.setPageSize(pageSize);
        mixEnvelop.setCurrPage(page);
        return mixEnvelop;
    }
    //删除康复计划
    public void delteRehabilitaionPlan(String planId,String doctorCode) throws  Exception{
        PatientRehabilitationPlanDO patientRehabilitationPlanDO = patientRehabilitationPlanDao.findById(planId);
        if (patientRehabilitationPlanDO!=null){
            if (!doctorCode.equalsIgnoreCase(patientRehabilitationPlanDO.getCreateUser())){
                throw new Exception("当前医生非创建者不能删除");
            }if (patientRehabilitationPlanDO.getStatus()>=1){
                throw new Exception("开始的计划不能删除");
            }
            patientRehabilitationPlanDao.delete(patientRehabilitationPlanDO);
            rehabilitationDetailDao.deleteDetailOnlyByPlanId(planId);
        }
    }
    /**
     * 康复管理更多计划
@ -1747,6 +1792,8 @@ public class RehabilitationManageService {
        resultMap.put("specialistPatientRelationDO",doctorPatientRelationDO);
        if (p!=null){
            resultMap.put("disease",p.getDisease());
            resultMap.put("planType",p.getPlanType());
            resultMap.put("healthStatusCode",p.getHealthStatusCode());
            resultMap.put("diseaseName",p.getDiseaseName());
            resultMap.put("createUser",p.getCreateUser());
            resultMap.put("planTitle",p.getTitle());
@ -1764,6 +1811,11 @@ public class RehabilitationManageService {
                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);
@ -2099,7 +2151,7 @@ public class RehabilitationManageService {
    @Transactional(propagation= Propagation.NOT_SUPPORTED)
    public com.alibaba.fastjson.JSONArray  selectPlanServerDoctor(String planId,String doctorCode) throws Exception{
        String sql ="SELECT t.patient,t.create_user FROM wlyy_patient_rehabilitation_plan t  where t.id='"+planId+"'";//专科
        String sql ="SELECT distinct t.patient,t.create_user as create_user FROM wlyy_patient_rehabilitation_plan t left join wlyy_rehabilitation_plan_detail b on t.id = b.plan_id  where t.id='"+planId+"'";//专科
        List<Map<String,Object>> mapList = jdbcTemplate.queryForList(sql);
        com.alibaba.fastjson.JSONArray jsonArray = new com.alibaba.fastjson.JSONArray();
        String patient = "";
@ -2679,7 +2731,7 @@ public class RehabilitationManageService {
                " where 1=1 " ;
        if(StringUtils.isNoneBlank(patientInfo)){
            sql +=" AND (p.idcard like '%"+patientInfo+"%' OR p.`name`like '%"+patientInfo+"%') ";
            sql +=" AND (p.idcard like '%"+patientInfo+"%' OR p.`name`like '%"+patientInfo+"%' or d.doctor_name like '%"+patientInfo+"%') ";
        }
        if (doctorType.equalsIgnoreCase("1")){
            sql +=" AND d.doctor = '"+doctor+"'";
@ -2698,7 +2750,7 @@ public class RehabilitationManageService {
            sqlCondition +=" and pr.id IN (SELECT pds.specialist_relation_code FROM wlyy_patient_disease_server pds WHERE  pds.del=1 and pds.disease ='"+disease+"')";
        }*/
        //LIMIT+(page-1)*pageSize+","+pageSize
        sql += " ORDER BY p.create_time DESC  ";
        sql += " ORDER BY t.create_time DESC  ";
        List<Map<String,Object>> mapList = hibenateUtils.createSQLQuery(sql,page,pageSize);
        System.out.println("mapList"+sql);
        for (Map<String,Object> map:mapList){
@ -2882,7 +2934,7 @@ public class RehabilitationManageService {
            {//康复咨询
                //总康复咨询数量
                String sqlTotal = "select count(*)\n" +
                        "from wlyy_consult a,wlyy_consult_team b where a.id = b.consult and a.patient = '"+map.get("patient")+"' and a.del = '1' and a.type=18";
                        "from wlyy_consult a,wlyy_consult_team b where a.id = b.consult and a.patient = '"+map.get("patient")+"' and a.del = '1' and a.type=18 and b.doctor='"+doctorCode+"'";
                Integer consultTotal = jdbcTemplate.queryForObject(sqlTotal,Integer.class);
                /*String healthCount = "SELECT * FROM wlyy_patient_reservation WHERE incidental_msg_type = 0 AND source = 4 AND patient = '"+map.get("patient")+"' ORDER BY start_time DESC";
                List<Map<String , Object>> healthList = jdbcTemplate.queryForList(healthCount);
@ -2890,12 +2942,12 @@ public class RehabilitationManageService {
                map.put("total",consultTotal );
                //完成康复咨询数量
                sqlTotal = "select count(*)\n" +
                        "from wlyy_consult a,wlyy_consult_team b where a.id = b.consult and a.patient = '"+map.get("patient")+"' and a.del = '1' and a.type=18 and b.`status`=1";
                        "from wlyy_consult a,wlyy_consult_team b where a.id = b.consult and a.patient = '"+map.get("patient")+"' and a.del = '1' and a.type=18 and b.`status`=1 and b.doctor='"+doctorCode+"'";
                consultTotal = jdbcTemplate.queryForObject(sqlTotal,Integer.class);
                map.put("compeletTotal",consultTotal );
                //上次发起时间
                String sqlTemp ="select a.czrq\n" +
                        "from wlyy_consult a,wlyy_consult_team b where a.id = b.consult and a.patient = '"+map.get("patient")+"' and a.del = '1' and a.type=18 order by a.czrq desc limit 1";
                        "from wlyy_consult a,wlyy_consult_team b where a.id = b.consult and a.patient = '"+map.get("patient")+"' and a.del = '1' and a.type=18 and b.doctor='"+doctorCode+"' order by a.czrq desc limit 1";
                List<Map<String,Object>> czrqMap = jdbcTemplate.queryForList(sqlTemp);
                if(czrqMap.size()!=0){
                    if(czrqMap.get(0).get("czrq")!=null){
@ -2911,7 +2963,7 @@ public class RehabilitationManageService {
                        "WHERE p.participant_id = d.id AND t.session_id = p.session_id AND t.session_id = s.id\n" +
                        "AND s.type =18  AND t.`reply` = 0  AND a.consult = t.id\n" +
                        "and a.id in( select b.id from wlyy_consult a,wlyy_consult_team b \n" +
                        "where a.id = b.consult and a.patient = '"+map.get("patient")+"' and a.del = '1' and a.type=18 )\n" +
                        "where a.id = b.consult and a.patient = '"+map.get("patient")+"' and a.del = '1' and a.type=18 and b.doctor='"+doctorCode+"' )\n" +
                        ")";
                Integer noReplay = jdbcTemplate.queryForObject(sqlTotal,Integer.class);
                map.put("noReplay",noReplay);
@ -3225,7 +3277,7 @@ public class RehabilitationManageService {
            }
        }
        String sql = "select d.id as doctor,p.create_time as createTime,p.id,d.photo,p.title,d.idcard,YEAR (now()) - YEAR (substring(d.idcard, 7, 8)) AS age, d.sex,p.name,p.patient,d.name as doctorName,p.advice_content as adviceContent,p.medical_records_code as medicalRecordsCode,p.create_time as create_time " +
        String sql = "select d.id as doctor,p.create_time as createTime,p.disease,p.disease_name,p.id,d.photo,p.title,d.idcard,YEAR (now()) - YEAR (substring(d.idcard, 7, 8)) AS age, d.sex,p.name,p.patient,d.name as doctorName,p.advice_content as adviceContent,p.medical_records_code as medicalRecordsCode,p.create_time as create_time " +
                " FROM wlyy_patient_rehabilitation_plan p " +
                " LEFT JOIN base_doctor d ON d.id = p.create_user " +
                "WHERE p.patient='"+patient+"'";

File diff suppressed because it is too large
+ 73 - 10
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/RehabilitationPlanService.java


+ 36 - 26
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/consult/ConsultTeamService.java

@ -149,16 +149,15 @@ public class ConsultTeamService extends ConsultService {
     * 按类型查找居民的咨询记录
     * @return
     */
    public List<Map<String,Object>> findConsultRecordByType(String patient,Integer page,int pagesize,Integer type,String title){
    public List<Map<String,Object>> findConsultRecordByType(String patient,String doctor,Integer page,int pagesize,Integer type,String title){
        if(!StringUtils.isEmpty(title)){
            title="%"+title+"%";
            return findConsultNew(patient,page,pagesize,type, title);
            return findConsultNew(patient,doctor,page,pagesize,type, title);
        }else{
            return findConsultNew(patient,page,pagesize,type,"");
            return findConsultNew(patient,doctor,page,pagesize,type,"");
        }
    }
    public List<Map<String,Object>> findConsultNew(String patient, Integer page, Integer pagesize, Integer type, String title){
    public List<Map<String,Object>> findConsultNew(String patient,String doctor, Integer page, Integer pagesize, Integer type, String title){
        String sql = "SELECT\n" +
                "\ta.id,\n" +
                "\ta.type,\n" +
@ -173,20 +172,22 @@ public class ConsultTeamService extends ConsultService {
                "\twlyy_consult a,\n" +
                "\twlyy_consult_team b \n" +
                "WHERE\n" +
                "\ta.CODE = b.consult \n" ;
                "\ta.id = b.consult \n" ;
        // 排序
        if (org.apache.commons.lang3.StringUtils.isNoneBlank(patient)){
            sql+=" AND a.patient = '"+patient+"'";
        }
        if (org.apache.commons.lang3.StringUtils.isNoneBlank(doctor)){
            sql+=" AND b.doctor = '"+doctor+"'";
        }
        if (type!=null){
            sql+=" AND a.type = "+type+"";
        }
        if (org.apache.commons.lang3.StringUtils.isNoneBlank(title)){
            sql+=" AND a.symptoms like '%"+title+"%'";
            sql+=" AND a.symptoms like '%"+title+"%' ";
        }
        sql+="ORDER BY\n" +
                "\ta.czrq DESC";
        sql+="    order by \n" +
                "\ta.czrq desc";
        return hibenateUtils.createSQLQuery(sql,page,pagesize);
    }
    public ConsultTeamDo findByCode(String code) {
@ -200,14 +201,14 @@ public class ConsultTeamService extends ConsultService {
     * @param doctor  医生
     * @return
     */
    public List<Map<String,Object>> getUnfinishedConsult(String patient, String doctor) {
        return findUnfinishedConsultType(patient, doctor);
    public List<Map<String,Object>> getUnfinishedConsult(String patient, String doctor,String type) {
        return findUnfinishedConsultType(patient, doctor,type);
    }
    public List<Map<String,Object>> findUnfinishedConsultType(String patient,String doctor){
    public List<Map<String,Object>> findUnfinishedConsultType(String patient,String doctor,String type){
        String sql = "SELECT\n" +
                "\ta \n" +
                "FROM\n" +
                "\twlyy_consult_team a,\n" +
                "\t a.* \n" +
                " FROM\n" +
                "\twlyy_consult_team a ,\n" +
                "\twlyy_consult_team_doctor b \n" +
                "WHERE\n" +
                "\ta.consult = b.consult \n" ;
@ -218,9 +219,12 @@ public class ConsultTeamService extends ConsultService {
        if (!StringUtils.isEmpty(doctor)){
            sql+="   AND b.to_doctor = '"+doctor+"'";
        }
        sql+= "\tAND a.del = '1' \n" +
                "\tAND a.type <> 8 \n" +
                "\tAND a.STATUS = 0";
        if (!StringUtils.isEmpty(type)){
            sql+="   AND a.type="+type+"";
        }
        sql+= "\t AND a.del = '1' \n" +
                "\t AND a.status = 0";
        System.out.println("======="+sql);
        return  hibenateUtils.createSQLQuery(sql);
    }
@ -228,7 +232,7 @@ public class ConsultTeamService extends ConsultService {
        JSONObject result = new JSONObject();
        String sql="SELECT DISTINCT p.patient, p.name AS patient_name, d.`id` as special_code, d.`name` as special_name \n" +
                "FROM wlyy_patient_rehabilitation_plan p, base_doctor d \n" +
                "WHERE p.patient = '"+patientCode+"' AND d.`code`= p.create_user  GROUP BY p.patient, p.create_user,p.team_code";
                "WHERE p.patient = '"+patientCode+"' AND d.`id`= p.create_user  GROUP BY p.patient, p.create_user,p.team_code";
        sql = TransforSqlUtl.wlyy_patient_rehabilitation_planName2(sql);
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        result.put("ConsultTeamList",list);
@ -255,6 +259,7 @@ public class ConsultTeamService extends ConsultService {
     */
    public JSONObject addRecoverConsult(ConsultTeamDo ct,String patient,String agent) throws Exception {
        JSONObject re = new JSONObject();
        System.out.println("ct.getdoctor"+ct.getDoctor());
        if (exist(patient, ct.getType(),ct.getDoctor())) {//判断是否有未结束的咨询移到同步方法中
            re.put("status", -3);
            return re;
@ -360,23 +365,28 @@ public class ConsultTeamService extends ConsultService {
        String sql ="SELECT\n" +
                "\tcount( 1 ) as \"count\"\n" +
                "FROM\n" +
                "\tConsultTeam a,\n" +
                "\tConsultTeamDoctor b \n" +
                "\twlyy_consult_team a,\n" +
                "\twlyy_consult_team_doctor b \n" +
                "WHERE\n" +
                "\ta.consult = b.consult \n" +
                "\tAND a.STATUS = 0 \n" +
                "\tAND a.status = 0 \n" +
                "\tAND a.del = '1' \n" ;
        if (StringUtils.isEmpty(patient)){
        if (!StringUtils.isEmpty(patient)){
            sql+=" and a.patient = '"+patient+"'";
        }
        if (StringUtils.isEmpty(doctor)){
        if (!StringUtils.isEmpty(doctor)){
            sql+=" and b.to_doctor = '"+doctor+"'";
        }
        if (type!=null){
            sql+=" and a.type = "+type+"";
        }
        System.out.println(sql);
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);
        int count = list==null?0:list.size();
        Integer count=0;
        if (list!=null&&list.size()>0){
            count = Integer.valueOf(list.get(0).get("count").toString());
            System.out.println("count"+count);
        }
        return count > 0;
    }

+ 11 - 2
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/followUp/FollowUpService.java

@ -180,6 +180,7 @@ public class FollowUpService {
                    throw new Exception("not exit doctor:" + doctorCode + ".\r\n");
                }
                Followup followup = new Followup();
                followup.setFollowJson(map.get("followJson"));
                followup.setFollowupType(String.valueOf(map.get("type")));
                Date date = DateUtil.strToDate(map.get("date"));
                followup.setFollowupDate(date);
@ -194,7 +195,12 @@ public class FollowUpService {
                followup.setPatientName(patient.getName());
                followup.setIdcard(patient.getIdcard());
                followup.setDataFrom("2");//数据来源 1基卫 2APP
                followup.setStatus("2");     //状态 0取消 1已完成 2未开始 3进行中
                if (map.get("followJson")!=null){
                    followup.setStatus("1");
                }else {
                    followup.setStatus("2");
                }
                    //状态 0取消 1已完成 2未开始 3进行中
                followup.setCreateTime(new Date());
                followup.setCreater(doctorCode);
                followup.setFollowupClass(map.get("followupClass"));
@ -249,6 +255,7 @@ public class FollowUpService {
                if (StringUtils.isNoneBlank(plandate)) {
                    followup.setFollowupNextDate(DateUtil.strToDate(plandate));
                    Followup nextFollowup = new Followup();
                    nextFollowup.setFollowJson(followup.getFollowJson());
                    nextFollowup.setDataFrom(followup.getDataFrom());
                    nextFollowup.setStatus("2");
                    nextFollowup.setFollowupType(followupType);
@ -306,7 +313,7 @@ public class FollowUpService {
    /**
     * 新增临时随访记录(返回ID)
     */
    public String addFollowup(String doctorCode, String patientCode, String date, String followupType, String followupClass, String followupManagerStatus, String plandate, String prescriptioncode,Integer type) throws Exception {
    public String addFollowup(String followUpJson,String doctorCode, String patientCode, String date, String followupType, String followupClass, String followupManagerStatus, String plandate, String prescriptioncode,Integer type) throws Exception {
        String re = "";
        //获取医生信息
@ -324,6 +331,7 @@ public class FollowUpService {
        Followup followup = new Followup();
        Date followDate = DateUtil.strToDate(date);
        followup.setFollowupDate(followDate);
        followup.setFollowJson(followUpJson);
        followup.setFollowupPlanDate(followDate);
        followup.setDoctorCode(doctorCode);
        followup.setDoctorName(doctor.getName());
@ -518,6 +526,7 @@ public class FollowUpService {
        }
        re.put("id", String.valueOf(followup.getId()));
        re.put("followUpJson", followup.getFollowJson());
        re.put("followupNo", followup.getFollowupNo());
        re.put("followupDate", DateUtil.dateToStrLong(followup.getFollowupDate()));
        re.put("followupNextDate", DateUtil.dateToStrLong(followup.getFollowupNextDate()));