Browse Source

康复代码

suqinyi 1 year ago
parent
commit
9ca4fbd2ac

+ 132 - 146
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/rehabilitation/controller/DoctorRehabilitaionInfoController.java

@ -36,104 +36,107 @@ public class DoctorRehabilitaionInfoController extends EnvelopRestEndpoint {
    @ApiOperation("获取康复下转居民列表")
    public String getRehabilitationPatientList(@ApiParam(name = "idcard", value = "身份证", required = false)
                                               @RequestParam(value = "idcard", required = false) String idcard,
                                               @ApiParam(name = "isTurnDown", value = "是否已下转 -2:未下转未家签,-1未下转 0未下转全部,;1已下转(未接收);2已下转(已接收);3已下转全部;03已下转全部+未下转全部", defaultValue = "0",required = false)
                                               @RequestParam(value = "isTurnDown", required = false,defaultValue = "3") String isTurnDown ,
                                               @ApiParam(name = "page", value = "起始页", required = false) @RequestParam(value = "page", required = false,defaultValue = "1") Integer page,
                                               @ApiParam(name = "pagesize", value = "每页显示数据条数", required = false) @RequestParam(value = "pagesize", required = false,defaultValue = "10") Integer pagesize
                                               @ApiParam(name = "isTurnDown", value = "是否已下转 -2:未下转未家签,-1未下转 0未下转全部,;1已下转(未接收);2已下转(已接收);3已下转全部;03已下转全部+未下转全部", defaultValue = "0", required = false)
                                               @RequestParam(value = "isTurnDown", required = false, defaultValue = "3") String isTurnDown,
                                               @ApiParam(name = "page", value = "起始页", required = false) @RequestParam(value = "page", required = false, defaultValue = "1") Integer page,
                                               @ApiParam(name = "pagesize", value = "每页显示数据条数", required = false) @RequestParam(value = "pagesize", required = false, defaultValue = "10") Integer pagesize
    ) {
        try {
            if(page==null){
            if (page == null) {
                page = 1;
            }
            if(pagesize==null){
            if (pagesize == null) {
                pagesize = 10;
            }
            JSONObject result = rehabilitationInfoService.getRehabilitationPatientList(idcard, getUID(),isTurnDown,page,pagesize);
            JSONObject result = rehabilitationInfoService.getRehabilitationPatientList(idcard, getUID(), isTurnDown, page, pagesize);
            return write(200, "请求成功", "data", result);
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
    @RequestMapping(value = "getDeorsumvergenceCount", method = RequestMethod.GET)
    @ApiOperation("康复下转已下转顶头数据")
    public String getDeorsumvergenceCount() {
        try {
            JSONObject result = rehabilitationInfoService.getDeorsumvergenceCount(getUID());
            return write(200, "请求成功", "data", result);
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
    @RequestMapping(value = "createAdvice", method = RequestMethod.POST)
    @ApiOperation("创建/编辑康复建议模板")
    public String createAdvice(
            @ApiParam(name = "doctorCode", value = "医生code", required = false) @RequestParam(value = "doctorCode", required = false) String doctorCode,
            @ApiParam(name = "code", value = "模板code") @RequestParam(value = "code", required = false) String code,
            @ApiParam(name = "name", value = "模板名称", required = true) @RequestParam(value = "name", required = true) String name,
            @ApiParam(name = "content", value = "模板内容", required = true) @RequestParam(value = "content", required = true) String content
    ) {
        try {
            if (StringUtils.isBlank(doctorCode)) {
                doctorCode = getUID();
            }
            rehabilitationInfoService.createAdvice(doctorCode, code, name, content);
            return write(200, "更新成功");
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
    @RequestMapping(value = "deleteAdvice", method = RequestMethod.POST)
    @ApiOperation("删除康复建议模板")
    public String deleteAdvice(
            @ApiParam(name = "id", value = "模板id") @RequestParam(value = "id", required = false) Long id) {
        try {
            rehabilitationInfoService.deleteAdvice(id);
            return write(200, "删除成功");
        } catch (Exception e) {
            return error(-1,e.getMessage());
        }
    }
    @RequestMapping(value = "getAdviceListByDoctor", method = RequestMethod.GET)
    @ApiOperation("获取医生创建康复建议模板及系统模板")
    public String getAdviceListByDoctor(@ApiParam(name = "doctorCode", value = "医生code", required = false)
                                        @RequestParam(value = "doctorCode", required = false) String doctorCode) {
        try {
            if (StringUtils.isBlank(doctorCode)) {
                doctorCode = getUID();
            }
            List<RehabilitationAdviceDO> list = rehabilitationInfoService.getAdviceListByDoctor(doctorCode);
            return write(200, "请求成功", "data", list);
        } catch (Exception e) {
            return error(-1,e.getMessage());
        }
    }
    @RequestMapping(value = "createMedicalRecords", method = RequestMethod.POST)
    @ApiOperation("添加编辑住院病历")
    public String createMedicalRecords(
            @ApiParam(name = "doctorCode", value = "医生code", required = false) @RequestParam(value = "doctorCode", required = false) String doctorCode,
            @ApiParam(name = "patient", value = "居民code") @RequestParam String patient,
            @ApiParam(name = "patientName", value = "居民姓名") @RequestParam String patientName,
            @ApiParam(name = "jsonData", value = "住院病历相关数据") @RequestParam(value = "jsonData", required = true) String jsonData,
            @ApiParam(name = "id", value = "模板id,编辑时传入") @RequestParam(value = "id", required = false) Long id
    ) {
        try {
            if (StringUtils.isBlank(doctorCode)) {
                doctorCode = getUID();
            }
            objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
            PatientMedicalRecordsDO patientMedicalRecordsDO = objectMapper.readValue(jsonData, PatientMedicalRecordsDO.class);
            return write(200, "添加成功", "data", rehabilitationInfoService.createMedicalRecords(doctorCode, patient, patientName, patientMedicalRecordsDO, id));
        } catch (Exception e) {
            return error(-1,e.getMessage());
        }
    }
//    @RequestMapping(value = "createAdvice", method = RequestMethod.POST)
//    @ApiOperation("创建/编辑康复建议模板")
//    public String createAdvice(@ApiParam(name = "doctorCode", value = "医生code", required = false)
//                               @RequestParam(value = "doctorCode", required = false) String doctorCode,
//                               @ApiParam(name = "code", value = "模板code")
//                               @RequestParam(value = "code", required = false) String code,
//                               @ApiParam(name = "name", value = "模板名称", required = true)
//                               @RequestParam(value = "name", required = true) String name,
//                               @ApiParam(name = "content", value = "模板内容", required = true)
//                               @RequestParam(value = "content", required = true) String content) {
//
//        try {
//            if (StringUtils.isBlank(doctorCode)) {
//                doctorCode = getUID();
//            }
//            rehabilitationInfoService.createAdvice(doctorCode, code, name, content);
//            return write(200, "更新成功");
//        } catch (Exception e) {
//            return error(-1,e.getMessage());
//        }
//    }
//
//    @RequestMapping(value = "deleteAdvice", method = RequestMethod.POST)
//    @ApiOperation("删除康复建议模板")
//
//    public String deleteAdvice(@ApiParam(name = "id", value = "模板id")
//                               @RequestParam(value = "id", required = false) Long id) {
//
//        try {
//            rehabilitationInfoService.deleteAdvice(id);
//            return write(200, "删除成功");
//        } catch (Exception e) {
//            return error(-1,e.getMessage());;
//        }
//    }
//
//    @RequestMapping(value = "getAdviceListByDoctor", method = RequestMethod.GET)
//    @ApiOperation("获取医生创建康复建议模板及系统模板")
//    public String getAdviceListByDoctor(@ApiParam(name = "doctorCode", value = "医生code", required = false)
//                                        @RequestParam(value = "doctorCode", required = false) String doctorCode) {
//
//        try {
//            if (StringUtils.isBlank(doctorCode)) {
//                doctorCode = getUID();
//            }
//            List<RehabilitationAdviceDO> list = rehabilitationInfoService.getAdviceListByDoctor(doctorCode);
//            return write(200, "请求成功", "data", list);
//        } catch (Exception e) {
//            return error(-1,e.getMessage());;
//        }
//    }
//
//    @RequestMapping(value = "createMedicalRecords", method = RequestMethod.POST)
//    @ApiOperation("添加编辑住院病历")
//
//    public String createMedicalRecords(@ApiParam(name = "doctorCode", value = "医生code", required = false)
//                                       @RequestParam(value = "doctorCode", required = false) String doctorCode,
//                                       @ApiParam(name = "patient", value = "居民code")
//                                       @RequestParam String patient,
//                                       @ApiParam(name = "patientName", value = "居民姓名")
//                                       @RequestParam String patientName,
//                                       @ApiParam(name = "jsonData", value = "住院病历相关数据")
//                                       @RequestParam(value = "jsonData", required = true) String jsonData,
//                                       @ApiParam(name = "id", value = "模板id,编辑时传入")
//                                           @RequestParam(value = "id", required = false) Long id) {
//
//        try {
//            if (StringUtils.isBlank(doctorCode)) {
//                doctorCode = getUID();
//            }
//            objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
//            PatientMedicalRecordsDO patientMedicalRecordsDO = objectMapper.readValue(jsonData, PatientMedicalRecordsDO.class);
//            return write(200, "添加成功", "data", rehabilitationInfoService.createMedicalRecords(doctorCode, patient, patientName, patientMedicalRecordsDO, id));
//        } catch (Exception e) {
//            return error(-1,e.getMessage());;
//        }
//    }
//
//    @RequestMapping(value = "getMedicalHistoryDetail", method = RequestMethod.GET)
//    @ApiOperation("出院就诊详情")
//    public String getMedicalHistoryDetail(@ApiParam(name = "code", value = "code", required = true)
@ -143,42 +146,39 @@ public class DoctorRehabilitaionInfoController extends EnvelopRestEndpoint {
//            XxzxMedicalHistory history = rehabilitationInfoService.getMedicalHistoryDetail(code);
//            return write(200, "请求成功", "data", history);
//        } catch (Exception e) {
//            return error(-1,e.getMessage());;
//        }
//    }
//
//    @RequestMapping(value = "getMedicalHistoryList", method = RequestMethod.GET)
//    @ApiOperation("获取厦心出院就诊记录信息")
//    public String getMedicalHistoryList(@ApiParam(name = "code", value = "居民code", required = true)
//                                        @RequestParam(value = "code", required = true) String code,
//                                        @ApiParam(name = "page", value = "page", required = true)
//                                        @RequestParam(value = "page", required = true) Integer page,
//                                        @ApiParam(name = "size", value = "size", required = true)
//                                        @RequestParam(value = "size", required = true) Integer size) {
//        try {
//            List<Map<String,Object>> list = rehabilitationInfoService.getMedicalHistoryList(code,page,size);
//            return write(200, "请求成功", "data", list);
//        } catch (Exception e) {
//            return error(-1,e.getMessage());;
//        }
//    }
//
//
//    @RequestMapping(value = "getDischargePatientList", method = RequestMethod.GET)
//    @ApiOperation("获取即将出院居民列表,区分家签非家签")
//    public String getDischargePatientList(@ApiParam(name = "hospital", value = "机构code", required = false)
//                                          @RequestParam(value = "hospital", required = true) String hospital) {
//
//        try {
//            JSONObject result = rehabilitationInfoService.getDischargePatientList(hospital, getUID());
//            return write(200, "请求成功", "data", result);
//        } catch (Exception e) {
//            return error(-1,e.getMessage());;
//            return error(-1,e.getMessage());
//        }
//    }
//
//
//
    @RequestMapping(value = "getMedicalHistoryList", method = RequestMethod.GET)
    @ApiOperation("获取厦心出院就诊记录信息")
    public String getMedicalHistoryList(
            @ApiParam(name = "code", value = "居民code", required = true) @RequestParam(value = "code", required = true) String code,
            @ApiParam(name = "page", value = "page", required = true) @RequestParam(value = "page", required = true) Integer page,
            @ApiParam(name = "size", value = "size", required = true) @RequestParam(value = "size", required = true) Integer size) {
        try {
            List<Map<String,Object>> list = rehabilitationInfoService.getMedicalHistoryList(code,page,size);
            return write(200, "请求成功", "data", list);
        } catch (Exception e) {
            return error(-1,e.getMessage());
        }
    }
    @RequestMapping(value = "getDischargePatientList", method = RequestMethod.GET)
    @ApiOperation("获取即将出院居民列表,区分家签非家签")
    public String getDischargePatientList(@ApiParam(name = "hospital", value = "机构code", required = false)
                                          @RequestParam(value = "hospital", required = true) String hospital) {
        try {
            JSONObject result = rehabilitationInfoService.getDischargePatientList(hospital, getUID());
            return write(200, "请求成功", "data", result);
        } catch (Exception e) {
            return error(-1,e.getMessage());
        }
    }
//    @RequestMapping(value = "remindDoctorReceive", method = RequestMethod.POST)
//    @ApiOperation("提醒家医接收")
//    public String remindDoctorReceive(@ApiParam(name = "diseaseName", value = "疾病名称", required = true)
@ -189,45 +189,31 @@ public class DoctorRehabilitaionInfoController extends EnvelopRestEndpoint {
//            rehabilitationInfoService.remindDoctorReceive(diseaseName,getUID() , doctorCode);
//            return success("请求成功");
//        } catch (Exception e) {
//            return error(-1,e.getMessage());;
//        }
//    }
//
//    @RequestMapping(value = "getDeorsumvergenceCount", method = RequestMethod.GET)
//    @ApiOperation("康复下转已下转顶头数据")
//    public String getDeorsumvergenceCount(){
//        try {
//            JSONObject result = rehabilitationInfoService.getDeorsumvergenceCount(getUID());
//            return write(200, "请求成功", "data", result);
//        } catch (Exception e) {
//            return error(-1,e.getMessage());;
//            return error(-1,e.getMessage());
//        }
//    }
//
//
//
//    @RequestMapping(value = "sendWxMsgRemindSign", method = RequestMethod.POST)
//    @ApiOperation("发送微信模板提醒签约消息")
//    public String sendWxTemplate(@ApiParam(name = "patient", value = "居民code", required = false)
//                                 @RequestParam(value = "patient", required = false)String patient){
//
//    public String sendWxTemplate(
//            @ApiParam(name = "patient", value = "居民code", required = false)
//            @RequestParam(value = "patient", required = false)String patient)
//    {
//        try {
//            rehabilitationInfoService.sendWxMsgRemindSign(patient);
//            return write(200, "发送成功!");
//        } catch (Exception e) {
//            return error(-1,e.getMessage());;
//            return error(-1,e.getMessage());
//        }
//    }
//
//    @RequestMapping(value = "getPatientByIdcardOrSsc", method = RequestMethod.POST)
//    @ApiOperation("根据患者身份证或社保卡号进行搜索添加出院记录")
//
//    public String getPatientByIdcardOrSsc(@ApiParam(name = "patientInfo", value = "居民身份证或者社保卡", required = true)
//                                              @RequestParam(value = "patientInfo")String patientInfo,
//                                          @ApiParam(name = "type", value = "1患者家签列表 2康复下转列表", required = true)
//                                          @RequestParam(value = "type") Integer type) {
//    public String getPatientByIdcardOrSsc(
//            @ApiParam(name = "patientInfo", value = "居民身份证或者社保卡", required = true) @RequestParam(value = "patientInfo")String patientInfo,
//            @ApiParam(name = "type", value = "1患者家签列表 2康复下转列表", required = true) @RequestParam(value = "type") Integer type) {
//        try {
//
//            JSONObject object = rehabilitationInfoService.getPatientByIdcardOrSsc(patientInfo, type, getUID());
//            if(object.getInteger("status") == 200) {
//                return write(200, "添加成功!", "data", object.get("data"));
@ -235,7 +221,7 @@ public class DoctorRehabilitaionInfoController extends EnvelopRestEndpoint {
//                return write(-1, "添加失败!", "data", object.getString("msg"));
//            }
//        } catch (Exception e) {
//            return error(-1,e.getMessage());;
//            return error(-1,e.getMessage());
//        }
//    }

+ 20 - 0
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/rehabilitation/dao/RehabilitationAdviceDao.java

@ -0,0 +1,20 @@
package com.yihu.jw.hospital.module.rehabilitation.dao;
import com.yihu.jw.entity.specialist.rehabilitation.RehabilitationAdviceDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
// create by hmf on 2020/02/27
public interface RehabilitationAdviceDao extends
        PagingAndSortingRepository<RehabilitationAdviceDO, Long>,
        JpaSpecificationExecutor<RehabilitationAdviceDO> {
    RehabilitationAdviceDO findByCode(String code);
    @Query("select a from RehabilitationAdviceDO a where a.createUser = ?1 or a.createUser is null order by a.createUser, a.createTime desc")
    List<RehabilitationAdviceDO> findByDoctor(String doctorCode);
}

+ 47 - 6
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/rehabilitation/service/RehabilitationInfoService.java

@ -10,10 +10,12 @@ import com.yihu.jw.entity.door.SignFamily;
import com.yihu.jw.entity.hospital.DmHospitalDO;
import com.yihu.jw.entity.rehabilitation.PatientDischargeDO;
import com.yihu.jw.entity.specialist.rehabilitation.PatientMedicalRecordsDO;
import com.yihu.jw.entity.specialist.rehabilitation.RehabilitationAdviceDO;
import com.yihu.jw.entity.util.TransforSqlUtl;
import com.yihu.jw.hospital.HospitalDao;
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
import com.yihu.jw.hospital.module.rehabilitation.dao.PatientDischargeDao;
import com.yihu.jw.hospital.module.rehabilitation.dao.RehabilitationAdviceDao;
import com.yihu.jw.hospital.module.specialist.dao.PatientMedicalRecordsRehabilitationDao;
import com.yihu.jw.hospital.module.system.dao.SystemDictDao;
import com.yihu.jw.hospital.task.PushMsgTask;
@ -68,7 +70,10 @@ public class RehabilitationInfoService  {
    private BasePatientDao patientDao;
    @Autowired
    private WlyySignFamilyDao signFamilyDao;
    
    @Autowired
    private RehabilitationAdviceDao adviceDao;
    @Autowired
    private PatientMedicalRecordsRehabilitationDao patientMedicalRecordsDao;
    
 
    //基卫服务地址
@ -81,13 +86,9 @@ public class RehabilitationInfoService  {
//    private XxzxMedicalHistoryDisposeDao medicalHistoryDisposeDao;
//    @Autowired
//    private XxzxMedicalHistoryDa medicalHistoryDao;
//
    @Autowired
    private PatientMedicalRecordsRehabilitationDao patientMedicalRecordsDao;
//    @Autowired
//    private HospitalMappingDao hospitalMappingDao;
//    @Autowired
//    private RehabilitationAdviceDao adviceDao;
    public PatientMedicalRecordsDO findByCode(String code) {
@ -908,4 +909,44 @@ public class RehabilitationInfoService  {
        }
        return  object;
    }
    /**
     * 新增或编辑康复建议模板
     * @param doctorCode
     * @param code 模板code
     * @param name
     * @param content
     */
    public void createAdvice(String doctorCode, String code, String name, String content) {
        RehabilitationAdviceDO adviceDO = null;
        //判断是新增还是编辑
        if (StringUtils.isNotBlank(code)) {
            adviceDO = adviceDao.findByCode(code);
        } else {
            adviceDO = new RehabilitationAdviceDO();
            adviceDO.setCode(UUID.randomUUID().toString().replaceAll("-", ""));
            BaseDoctorDO doctor = doctorDao.findById(doctorCode).orElse(null);
            adviceDO.setCreateUser(doctorCode);
            adviceDO.setCreateUserName(doctor.getName());
        }
        adviceDO.setName(name);
        adviceDO.setContent(content);
        adviceDO.setCreateTime(new Date());
        adviceDao.save(adviceDO);
    }
    public void deleteAdvice(Long id) {
        adviceDao.deleteById(id);
    }
    /**
     * 获取医生创建康复建议模板及系统模板
     * @param doctorCode
     * @return
     */
    public List<RehabilitationAdviceDO> getAdviceListByDoctor(String doctorCode) {
        List<RehabilitationAdviceDO> list = adviceDao.findByDoctor(doctorCode);
        return list;
    }
}