Trick 5 سال پیش
والد
کامیت
fa1a22a126

+ 53 - 55
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java

@ -672,7 +672,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    }
    public Boolean cancelPrescription(String prescriptionId) {
    public Boolean cancelPrescription(String prescriptionId){
        WlyyPrescriptionDO prescriptionDO = prescriptionDao.findOne(prescriptionId);
        prescriptionDO.setStatus(-2);
        return true;
@ -680,18 +680,18 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    /**
     * @param admNo     门诊唯一号
     *@param admNo 门诊唯一号
     * @param realOrder 处方号
     * @param status    处方状态 1审方失败,2审核完成,3结算完成
     *  @param status 处方状态 1审方失败,2审核完成,3结算完成
     * @return
     */
    public Map<String, Object> updatePrescriptionByHisStatu(String admNo, String realOrder, String status) throws Exception {
        Map<String, Object> rs = new HashedMap();
    public Map<String,Object> updatePrescriptionByHisStatu(String admNo,String realOrder,String status)throws Exception {
        Map<String,Object> rs = new HashedMap();
        String sql = "";
        //status 处方流程状态 ,13  开方失败/调整中,20 诊断完成/开方成功/待支付,已完成:100 已完成
        //pay_status`:处方结算状态,0为未结算,1为结算成功,默认为0',
        String outPatientSql = "";
        String outPatientSql="";
        if ("1".equals(status)) {
            sql = "UPDATE base.wlyy_prescription p SET p.`status`='13' WHERE p.adm_no='" + admNo + "' AND p.real_order='" + realOrder + "' ";
            WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findByRealOrder(realOrder);
@ -701,7 +701,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            //开方成功时候,先用处方号获取本地处方状态是否为开方失败,如果是则需要更新本地的处方
            sql = "UPDATE base.wlyy_prescription p SET p.`status`='20' WHERE p.adm_no='" + admNo + "' AND p.real_order='" + realOrder + "' ";
            //变更门诊状态
            outPatientSql = "UPDATE base.wlyy_outpatient p SET p.`status`='2' WHERE p.adm_no='" + admNo + "'";
            outPatientSql="UPDATE base.wlyy_outpatient p SET p.`status`='2' WHERE p.adm_no='" + admNo + "'";
            jdbcTemplate.execute(outPatientSql);
            jdbcTemplate.execute(sql);
@ -715,7 +715,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                wlyyPrescriptionDO.setPayStatus(1);
                wlyyPrescriptionDO.setStatus(100);
                prescriptionLogService.addPrescriptionLog(wlyyPrescriptionDO.getId(), 100, 2, outpatientDO.getDoctor(), outpatientDO.getDoctorName(), "", new Date());
                prescriptionLogService.addPrescriptionLog(wlyyPrescriptionDO.getId(),100,2,outpatientDO.getDoctor(),outpatientDO.getDoctorName(),"",new Date());
                prescriptionDao.save(wlyyPrescriptionDO);
            } else {
@ -723,30 +723,30 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                wlyyPrescriptionDO.setPayStatus(1);
                wlyyPrescriptionDO.setStatus(32);
                try {
                    WlyyPrescriptionVO vo = findOriginPrescription(outpatientDO.getRegisterNo(), outpatientDO.getPatient(), admNo, realOrder, demoFlag);
                try{
                    WlyyPrescriptionVO vo = findOriginPrescription(outpatientDO.getRegisterNo(),outpatientDO.getPatient(),admNo,realOrder,demoFlag);
                    wlyyPrescriptionDO.setDispUser(vo.getDispUser());
                    wlyyPrescriptionDO.setDispUserName(vo.getDispUserName());
                    wlyyPrescriptionDO.setDispDate(new Date());
                    prescriptionLogService.addPrescriptionLog(wlyyPrescriptionDO.getId(), 32, 2, vo.getDispUser(), vo.getDispUserName(), "", new Date());
                } catch (Exception e) {
                    logger.error("获取处方信息异常" + e.toString());
                    prescriptionLogService.addPrescriptionLog(wlyyPrescriptionDO.getId(),32,2,vo.getDispUser(),vo.getDispUserName(),"",new Date());
                }catch (Exception e){
                    logger.error("获取处方信息异常"+e.toString());
                }
                prescriptionDao.save(wlyyPrescriptionDO);
            }
            //发送取药系统消息
            SystemMessageDO systemMessageDO = sendPatientGetDrugMes(outpatientDO, wlyyPrescriptionDO);
            SystemMessageDO systemMessageDO = sendPatientGetDrugMes(outpatientDO,wlyyPrescriptionDO);
            rs.put("mes", systemMessageDO);
            rs.put("mes",systemMessageDO);
        }
        rs.put("flag", true);
        rs.put("flag",true);
        return rs;
    }
    public SystemMessageDO sendPatientGetDrugMes(WlyyOutpatientDO outpatient, WlyyPrescriptionDO prescriptionDO) {
    public SystemMessageDO sendPatientGetDrugMes(WlyyOutpatientDO outpatient,WlyyPrescriptionDO prescriptionDO){
        SystemMessageDO systemMessageDO = new SystemMessageDO();
        try {
        try{
            systemMessageDO.setTitle("患者取药");
            systemMessageDO.setType("7");
@ -758,38 +758,37 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            systemMessageDO.setRelationCode(outpatient.getId());
            JSONObject data = new JSONObject();
            data.put("name", outpatient.getPatientName());
            data.put("age", IdCardUtil.getAgeForIdcard(outpatient.getIdcard()));
            data.put("gender", IdCardUtil.getSexForIdcard_new(outpatient.getIdcard()));
            data.put("recipeType", prescriptionDO.getDispensaryType());
            data.put("message", "患者已完成取药");
            data.put("name",outpatient.getPatientName());
            data.put("age",IdCardUtil.getAgeForIdcard(outpatient.getIdcard()));
            data.put("gender",IdCardUtil.getSexForIdcard_new(outpatient.getIdcard()));
            data.put("recipeType",prescriptionDO.getDispensaryType());
            data.put("message","患者已完成取药");
            systemMessageDO.setData(data.toString());
            systemMessageService.saveMessage(systemMessageDO);
        } catch (Exception e) {
            logger.error("sendPatientGetDrugMes :" + e.toString());
        }catch (Exception e){
            logger.error("sendPatientGetDrugMes :"+e.toString());
        }
        return systemMessageDO;
    }
    /**
     * 获取卡记录
     *
     * @param patient
     * @return
     * @throws Exception
     */
    public JSONArray findPatientCard(String patient) throws Exception {
    public JSONArray findPatientCard(String patient)throws Exception{
        BasePatientDO patientDO = basePatientDao.findById(patient);
        JSONArray res = entranceService.BS15018(patientDO.getIdcard(), null, demoFlag);
        JSONArray res = entranceService.BS15018(patientDO.getIdcard(),null,demoFlag);
        JSONArray rs = new JSONArray();
        if (res != null) {
            for (int i = 0; i < res.size(); i++) {
        if(res !=null){
            for (int i =0;i<res.size();i++){
                JSONObject card = res.getJSONObject(i);
                String cardStat = card.getString("CARD_STAT");
                if ("激活".equals(cardStat)) {
                if("激活".equals(cardStat)){
                    rs.add(card);
                }
            }
@ -798,54 +797,53 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    }
    public Map<String, Object> checkOutpatient(String patient) throws Exception {
    public Map<String,Object> checkOutpatient(String patient)throws Exception{
        //-1卡余额不足,,-2 存在未结束的诊断热 1成功
        Map<String, Object> rs = new HashedMap();
        Map<String,Object> rs = new HashedMap();
        //1.余额判断改到前端判断
        //net.sf.json.JSONObject json = entranceService.qutpatientBalance(cardNo,demoFlag);
        //2.判断是否有未结束的
        List<WlyyOutpatientDO> list = outpatientDao.findByPatientList(patient);
        if (list != null && list.size() > 0) {
            rs.put("outpatient", list.get(0));
            rs.put("code", -2);
            rs.put("mes", "存在未结束的诊断");
        if(list!=null&&list.size()>0){
            rs.put("outpatient",list.get(0));
            rs.put("code",-2);
            rs.put("mes","存在未结束的诊断");
            return rs;
        }
        rs.put("code", 1);
        rs.put("mes", "验证通过");
        rs.put("code",1);
        rs.put("mes","验证通过");
        return rs;
    }
    /**
     * 获取所有医院列表
     *
     * @return
     */
    public List<BaseOrgVO> findAllHospital(Integer level, String keyWord) {
    public List<BaseOrgVO> findAllHospital(Integer level,String keyWord){
        if (StringUtils.isNoneEmpty(keyWord)) {
            keyWord = "%" + keyWord + "%";
            if (level != null) {
                List<BaseOrgDO> list = baseOrgDao.findByLevelAndName(level, "1", keyWord);
            if(level!=null){
                List<BaseOrgDO> list = baseOrgDao.findByLevelAndName(level,"1",keyWord);
                List<BaseOrgVO> rs = new ArrayList<>();
                return convertToModels(list, rs, BaseOrgVO.class);
            } else {
                List<BaseOrgDO> list = baseOrgDao.findByDelAndName("1", keyWord);
                return convertToModels(list,rs,BaseOrgVO.class);
            }else {
                List<BaseOrgDO> list = baseOrgDao.findByDelAndName("1",keyWord);
                List<BaseOrgVO> rs = new ArrayList<>();
                return convertToModels(list, rs, BaseOrgVO.class);
                return convertToModels(list,rs,BaseOrgVO.class);
            }
        } else {
        }else{
            if (level != null) {
                List<BaseOrgDO> list = baseOrgDao.findByLevelAndDel(level, "1");
            if(level!=null){
                List<BaseOrgDO> list = baseOrgDao.findByLevelAndDel(level,"1");
                List<BaseOrgVO> rs = new ArrayList<>();
                return convertToModels(list, rs, BaseOrgVO.class);
            } else {
                return convertToModels(list,rs,BaseOrgVO.class);
            }else {
                List<BaseOrgDO> list = baseOrgDao.findByDel("1");
                List<BaseOrgVO> rs = new ArrayList<>();
                return convertToModels(list, rs, BaseOrgVO.class);
                return convertToModels(list,rs,BaseOrgVO.class);
            }
        }
@ -885,8 +883,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @param dept
     * @return
     */
    public List<Map<String, Object>> findDoctorByHospitalAndDept(String orgCode, String dept, String chargeType, String doctorCode, String outpatientType, String startDate, String endDate, String key, String consultStatus) {
        String sql = "SELECT " +
    public List<Map<String,Object>> findDoctorByHospitalAndDept(String orgCode,String dept,String chargeType,String doctorCode,String outpatientType,String startDate,String endDate,String key,String consultStatus){
        String sql ="SELECT " +
                " d.id, " +
                " d.photo, " +
                " d.`name`, " +

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

@ -34,7 +34,7 @@ public class RehabilitationDetailDO extends UuidIdentityEntityWithOperator imple
    @Column(name = "doctor_name")
    private String doctorName;//计划完成者标识
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "execute_time", nullable = false, length = 0,updatable = false)
    @Column(name = "execute_time", nullable = true, length = 0,updatable = false)
    private Date executeTime;//服务项目执行时间
    @Column(name = "status")
    private Integer status;//状态(0未完成,1已完成,2已预约)
@ -88,7 +88,7 @@ public class RehabilitationDetailDO extends UuidIdentityEntityWithOperator imple
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "execute_time", nullable = false, length = 0,updatable = false)
    @Column(name = "execute_time", nullable = true, length = 0,updatable = false)
    public Date getExecuteTime() {
        return executeTime;
    }

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

@ -595,7 +595,7 @@ public class RehabilitationManageService {
        }
        String planDetailResult = StringUtils.isNotEmpty(planDetailList)?planDetailList.substring(1):"";
        String sql = "select i.name,i.code,i.content,d.execute_time,d.hospital_name,d.id,d.status,d.type as detailType,d.expense,d.doctor as executeDoctor," +
                " d.doctor_name as executeDoctorName,p.patient ,p.create_user as createDoctor,p.create_user_name as createDoctorName, p.status as planStatus  " +
                " d.doctor_name as executeDoctorName,p.patient ,p.id AS planId,p.create_user as createDoctor,p.create_user_name as createDoctorName, p.status as planStatus  " +
                " from wlyy_specialist.wlyy_rehabilitation_plan_detail d " +
                " LEFT JOIN wlyy_specialist.wlyy_rehabilitation_service_item i on i.code = d.hospital_service_item_id " +
                " LEFT JOIN wlyy_specialist.wlyy_patient_rehabilitation_plan p on d.plan_id=p.id " +
@ -623,6 +623,7 @@ public class RehabilitationManageService {
            resultMap.put("specialistDoctorName",one.get("createDoctorName")+"");//创建人(专科)医生名字
            resultMap.put("title",one.get("name"));//项目标题
            resultMap.put("planDetaiId",one.get("id"));//计划服务项目id
            resultMap.put("planId",one.get("planId"));//计划id
            resultMap.put("shortExecuteTime",DateUtil.dateToStr((Date) one.get("execute_time"),DateUtil.HH_MM));//项目标题
            resultMap.put("content",one.get("content"));//项目内容
            resultMap.put("hospitalName",one.get("hospital_name"));//地点
@ -1076,6 +1077,7 @@ public class RehabilitationManageService {
        guidanceMessageLogDO.setAdminTeamName(adminTeamName);
        guidanceMessageLogDO.setDoctorName(doctorName);
        guidanceMessageLogDO.setCreateTime(new Date());
        guidanceMessageLogDO.setUpdateTime(new Date());
        guidanceMessageLogDao.save(guidanceMessageLogDO);
        return Envelop.getSuccess(SpecialistMapping.api_success);
    }
@ -1353,8 +1355,10 @@ public class RehabilitationManageService {
        Integer allCount = rehabilitationDetailDao.findAllByPlanId(planId);//计划总服务项目数
        Integer finishedCount = rehabilitationDetailDao.findByStatusAndPlanId(1,planId);
        PatientRehabilitationPlanDO p =patientRehabilitationPlanDao.findById(planId);
        SpecialistPatientRelationDO specialistPatientRelationDO = specialistPatientRelationDao.findByDoctorAndPatient(p.getCreateUser(),p.getPatient());
        resultMap.put("allCount",allCount);
        resultMap.put("finishedCount",finishedCount);
        resultMap.put("specialistPatientRelationDO",specialistPatientRelationDO);
        if (p!=null){
            resultMap.put("disease",p.getDisease());
            resultMap.put("diseaseName",p.getDiseaseName());