Selaa lähdekoodia

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

542372506@qq.com 2 kuukautta sitten
vanhempi
commit
9b069cecad

+ 12 - 0
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/followup/controller/DoctorFollowUpController.java

@ -79,6 +79,18 @@ public class DoctorFollowUpController extends BaseController {
        }
    }
    @GetMapping(value = "open/exportExcel/createFollowup")
    @ApiOperation(value = " 生成随访计划")
    public Envelop createFollowup() {
        try {
            followUpService.createFollowup();
            return Envelop.getSuccess("success");
        } catch (Exception e) {
            e.printStackTrace();
            return Envelop.getError("error");
        }
    }
    @GetMapping(value = "open/exportExcel/exportFollowupList")
    @ApiOperation(value = " 导出筛随访记录列表")
    public void exportFollowupList(

+ 134 - 16
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/followup/service/FollowUpService.java

@ -6,22 +6,27 @@ 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.base.servicePackage.ServiceItemPlanDO;
import com.yihu.jw.entity.followup.Followup;
import com.yihu.jw.entity.followup.FollowupContent;
import com.yihu.jw.entity.followup.FollowupSign;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.family.WlyyPatientFamilyMemberDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.family.dao.WlyyPatientFamilyMemberDao;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.hospital.module.followup.dao.FollowUpDao;
import com.yihu.jw.hospital.module.followup.dao.FollowupContentDao;
import com.yihu.jw.hospital.module.followup.dao.FollowupSignDao;
import com.yihu.jw.hospital.module.rehabilitation.service.RehabilitationManageService;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
import com.yihu.jw.rehabilitation.ServiceItemPlanDao;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.encrypt.MD5;
import com.yihu.jw.util.idcard.IdCardUtil;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
@ -82,11 +87,15 @@ public class FollowUpService {
    private RehabilitationManageService rehabilitationManageService;
    @Autowired
    private ServiceItemPlanDao serviceItemPlanDao;
    @Autowired
    private ObjectMapper objectMapper;
    @Autowired
    private FollowupSignDao followupSignDao;
    @Autowired
    private BasePatientMedicareCardDao basePatientMedicareCardDao;
    @Autowired
    private WlyyPatientFamilyMemberDao familyMemberDao;
    //随访记录列表
    public PageEnvelop followupPage(String businessType, String businessSource, String startDate, String endDate, String patientName,
@ -98,7 +107,7 @@ public class FollowUpService {
                "pl.plan_doctor_name planDoctorName,h2.dept_name turnDownDeptName ";
        String countSql = "select count(DISTINCT f.id) ";
        String filter = " from wlyy_followup f " +
                "INNER JOIN base_service_item_plan ip on  f.id = ip.relation_code and ip.relation_type='6' " +
                "LEFT JOIN base_service_item_plan ip on  f.id = ip.relation_code and ip.relation_type='6' " +
                "LEFT JOIN wlyy_patient_rehabilitation_plan pl on pl.id = ip.plan_id " +
                "INNER JOIN base_patient p on p.id = f.patient_code " +
                "LEFT JOIN base_doctor_hospital h on f.doctor_code=h.doctor_code and h.del=1 " +
@ -666,6 +675,115 @@ public class FollowUpService {
        return null;
    }
    //生成随访计划 科室:骨科、手足外科、肿瘤科
    // 出院患者名单:接口获取、数据库批量导入
    // 仅生成随访计划,分配医生为住院主管医生,若不在医生清单明细中,则统一转给负责医生。(项目跟医务科确定这3个科室的负责人)
    // 随访计划:按出院时间 7天、1个月、3个月、6个月 生成随访计划。
    public void createFollowup(){
        int days[] = {7,30,90,180};
        //  `patient` varchar(255) DEFAULT NULL,
        //  `idcard` varchar(255) DEFAULT NULL,
        //  `name` varchar(255) DEFAULT NULL,
        //  `mobile` varchar(255) DEFAULT NULL,
        //  `outHospitalDate` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
        //  `dept` varchar(255) DEFAULT NULL,
        //  `deptName` varchar(255) DEFAULT NULL,
        //  `doctor` varchar(255) DEFAULT NULL,
        //  `doctor_name` varchar(255) DEFAULT NULL,
        //  `mapping_code` varchar(255) DEFAULT NULL,
        String sql = "select t.patient,t.idcard,t.name,t.mobile,t.doctor,t.doctor_name doctorName,t.outHospitalDate" +
                ",t.dept,t.deptName from base_patient_temp t where  t.doctor is not null";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        List<Followup> followupPlan = new ArrayList<>();
        Date now = new Date();
        for (Map<String,Object> map:list){
            String idcard = map.get("idcard")+"";
            String name = map.get("name")+"";
            String mobile = map.get("mobile")+"";
            String doctor = map.get("doctor")+"";
            String doctorName = map.get("doctorName")+"";
//            Date outHospitalDate = DateUtil.strToDate(map.get("outHospitalDate")+"");
            String patient = addPatient(idcard,name,mobile);
            for (int i=0;i<days.length;i++){
                Followup followup = new Followup();
                followup.setFollowupType("2");
//                Date date = DateUtil.getNextDay1(outHospitalDate,days[i]);
                Date date = DateUtil.getNextDay1(now,days[i]);
                followup.setFollowupDate(date);
                followup.setFollowupPlanDate(date);
                followup.setDoctorCode(doctor);
                followup.setDoctorName(doctorName);
                followup.setPatientCode(patient);
                followup.setPatientName(name);
                followup.setIdcard(idcard);
                followup.setDataFrom("2");//数据来源 1基卫 2APP
                followup.setStatus("2");//状态 0取消 1已完成 2未开始 3进行中
                followup.setCreateTime(new Date());
                followup.setCreater(doctor);
                followup.setFollowupClass("21");
                followup.setType(1);
                followupPlan.add(followup);
            }
        }
        followupDao.saveAll(followupPlan);
    }
    public String addPatient(String idcard,String name,String mobile){
        BasePatientDO patientDO = patientDao.findByIdcard(idcard);
        if(patientDO!=null){
            return patientDO.getId();
        }
        BasePatientDO patient = new BasePatientDO();
        String salt = UUID.randomUUID().toString().substring(0, 5);
        String pw = "aza354q.";
        patient.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
        patient.setSalt(salt);
        patient.setCardType("身份证");
        try {
            String year = idcard.substring(6, 10);
            String month = idcard.substring(10, 12);
            String day = idcard.substring(12, 14);
            String birthday = year + "-" + month + "-" + day;
            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
            patient.setBirthday(dateFormat.parse(birthday));
            patient.setSex(Integer.parseInt(IdCardUtil.getSexForIdcard_new(idcard)));
        } catch (Exception e) {
            e.printStackTrace();
        }
        patient.setMobile(mobile);
        patient.setDel("1");
        patient.setEnabled(1);
        patient.setLocked(0);
        patient.setCreateTime(new Date());
        patient.setUpdateTime(new Date());
        patient.setName(name);
        patient.setIdcard(idcard);
        BasePatientDO temp = patientDao.save(patient);
        PatientMedicareCardDO medicareCardDO = new PatientMedicareCardDO();
        medicareCardDO.setDel("1");
        medicareCardDO.setParentType("A");
        medicareCardDO.setType("A_01");
        medicareCardDO.setPatientCode(temp.getId());
        basePatientMedicareCardDao.save(medicareCardDO);
        WlyyPatientFamilyMemberDO wlyyPatientFamilyMemberDO = new WlyyPatientFamilyMemberDO();
        wlyyPatientFamilyMemberDO.setIsDel(1);
        wlyyPatientFamilyMemberDO.setPatient(patient.getId());
        wlyyPatientFamilyMemberDO.setFamilyMember(patient.getId());
        wlyyPatientFamilyMemberDO.setFamilyRelation("7");
        wlyyPatientFamilyMemberDO.setFamilyRelationName("本人");
        if (StringUtils.isNoneBlank(idcard)) {
            wlyyPatientFamilyMemberDO.setCardNo(idcard);
        }
        familyMemberDao.save(wlyyPatientFamilyMemberDO);
        return temp.getId();
    }
    //添加康复计划随访
    public Followup addRehabilatationFollowup(ServiceItemPlanDO itemPlanDO,String nextTime)  {
        try {
@ -764,19 +882,19 @@ public class FollowUpService {
        Followup followup = followupDao.findById(Long.valueOf(id)).orElse(null);
        if (followup != null) {
            ServiceItemPlanDO itemPlanDO = serviceItemPlanDao.findByRelationCode(id);
            System.out.println("22222222222222222"+JSON.toJSONString(itemPlanDO));
            ServiceItemPlanDO serviceItemPlanDO = serviceItemPlanDao.findByPlanIdAndPlanDetailIdAndPlanTime(itemPlanDO.getPlanId(), itemPlanDO.getPlanDetailId(), DateUtil.dateToStrLong(followup.getFollowupNextDate()));
            System.out.println("111111111111111111"+JSON.toJSONString(serviceItemPlanDO));
            if (StringUtils.isNoneBlank(plandate)) {
                followup.setFollowupNextDate(DateUtil.strToDate(plandate));
                Followup nextFollowup = followupDao.findById(Long.valueOf(serviceItemPlanDO.getRelationCode())).orElse(null);
                System.out.println("333333333333333333"+JSON.toJSONString(nextFollowup));
                nextFollowup.setFollowupDate(DateUtil.strToDateLong(plandate));
                nextFollowup.setFollowupPlanDate(DateUtil.strToDateLong(plandate));
                serviceItemPlanDO.setPlanTime(plandate);
                followupDao.save(nextFollowup);
                serviceItemPlanDao.save(serviceItemPlanDO);
            if(itemPlanDO!=null){
                ServiceItemPlanDO serviceItemPlanDO = serviceItemPlanDao.findByPlanIdAndPlanDetailIdAndPlanTime(itemPlanDO.getPlanId(), itemPlanDO.getPlanDetailId(), DateUtil.dateToStrLong(followup.getFollowupNextDate()));
                if (StringUtils.isNoneBlank(plandate)) {
                    followup.setFollowupNextDate(DateUtil.strToDate(plandate));
                    Followup nextFollowup = followupDao.findById(Long.valueOf(serviceItemPlanDO.getRelationCode())).orElse(null);
                    nextFollowup.setFollowupDate(DateUtil.strToDateLong(plandate));
                    nextFollowup.setFollowupPlanDate(DateUtil.strToDateLong(plandate));
                    serviceItemPlanDO.setPlanTime(plandate);
                    followupDao.save(nextFollowup);
                    serviceItemPlanDao.save(serviceItemPlanDO);
                }
            }
            if (followup.getStatus().compareTo("2") == 0) {
                followup.setFollowupNo(followupNo);
                followup.setFollowupDate(DateUtil.strToDate(date));
@ -1235,8 +1353,8 @@ public class FollowUpService {
                "wf.data_from as dataFrom,wf.status,wf.followup_content_phone as followupContentPhone,wf.creater,wf.sign_type as signType,wf.admin_team_code as adminTeamCode,wf.sign_code as signCode," +
                "wf.prescription_code as prescriptionCode,wf.type, q.plan_id as planId ,q.plan_detail_id  as planDetailId,q.id as planItemId ";
        String sql = " from wlyy_followup wf " +
                "  inner join base_service_item_plan q on wf.id=q.relation_code  " +
                "  inner join wlyy_patient_rehabilitation_plan p on q.plan_id=p.id ";
                "  left join base_service_item_plan q on wf.id=q.relation_code  " +
                "  left join wlyy_patient_rehabilitation_plan p on q.plan_id=p.id ";
        sql += " where 1=1 and wf.status !=0";
        if (!org.apache.commons.lang.StringUtils.isEmpty(doctor)) {
            sql += " and wf.doctor_code = '" + doctor + "'";

+ 5 - 3
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/rehabilitation/controller/RehabilitationManageController.java

@ -115,10 +115,12 @@ public class RehabilitationManageController extends EnvelopRestEndpoint {
    @GetMapping(value = "findServiceItemPlanDetail")
    @ApiOperation("执行计划详情")
    public Envelop findServiceItemPlanDetail(
            @ApiParam(name = "itemPlanId", value = "执行计划id", required = true)
            @RequestParam(value = "itemPlanId", required = true) String itemPlanId) {
            @ApiParam(name = "itemPlanId", value = "执行计划id", required = false)
            @RequestParam(value = "itemPlanId", required = false) String itemPlanId,
            @ApiParam(name = "followupId", value = "随访id", required = false)
            @RequestParam(value = "followupId", required = false) Long followupId) {
        try {
            return ObjEnvelop.getSuccess("查询成功",rehabilitationManageService.findServiceItemPlanDetail(itemPlanId));
            return ObjEnvelop.getSuccess("查询成功",rehabilitationManageService.findServiceItemPlanDetail(itemPlanId,followupId));
        }catch (ServiceException se){
            return Envelop.getError(se.getMessage());
        }catch (Exception e) {

+ 21 - 1
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/rehabilitation/service/RehabilitationManageService.java

@ -1512,7 +1512,27 @@ public class RehabilitationManageService {
    }
    //执行计划详情
    public ServiceItemPlanDO findServiceItemPlanDetail(String id) {
    public ServiceItemPlanDO findServiceItemPlanDetail(String id,Long followupId) {
        if(StringUtils.isBlank(id)&&followupId!=null){
            ServiceItemPlanDO planDO = new ServiceItemPlanDO();
            Followup followup = followupDao.findById(followupId).orElse(null);
            planDO.setFollowupStatus(followup.getStatus());
            planDO.setName("康复随访");
            planDO.setPlanDoctor(followup.getDoctorCode());
            planDO.setPlanDoctorName(followup.getDoctorName());
            planDO.setDoctor(followup.getDoctorCode());
            planDO.setDoctorName(followup.getDoctorName());
            planDO.setPlanTime(DateUtil.dateToStrLong(followup.getFollowupPlanDate()));
            planDO.setRelationType("6");
            planDO.setRelationCode(followupId+"");
            if("1".equals(followup.getStatus())){
                planDO.setStatus("1");
                planDO.setCompleteTime(DateUtil.dateToStrLong(followup.getFollowupDate()));
            }else {
                planDO.setStatus("0");
            }
            return planDO;
        }
        ServiceItemPlanDO planDO = serviceItemPlanDao.findById(id).orElse(null);
        if (planDO != null) {
            String sql = "SELECT content from wlyy_guidance_message_log WHERE plan_detail_id ='" + id + "' LIMIT 1";