浏览代码

Merge branch 'dev' of trick9191/patient-co-management into dev

trick9191 7 年之前
父节点
当前提交
a881229e9f

+ 102 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionExpressageService.java

@ -576,8 +576,8 @@ public class PrescriptionExpressageService extends BaseService {
                    PrescriptionExpressage prescriptionExpressage = prescriptionExpressageDao.findByPrescriptionCode(prescriptionDispensaryCode.getPrescriptionCode());
                    if(prescriptionExpressage!=null){
                        prescriptionExpressage.setHospitalDoctor(doctor);
                        prescriptionExpressage.setHospitalDoctorCode(d.getCode());
                        prescriptionExpressage.setHospitalDoctor(d.getName());
                        prescriptionExpressage.setHospitalDoctorCode(doctor);
                        prescriptionExpressage.setFetchingMedicineTime(new Date());
                        prescriptionExpressageDao.save(prescriptionExpressage);
                    }
@ -629,6 +629,7 @@ public class PrescriptionExpressageService extends BaseService {
                " FROM " +
                " wlyy_prescription p " +
                " JOIN wlyy_prescription_pay py ON py.prescription_code = p.`code` " +
                " LEFT JOIN wlyy_prescription_expressage e ON p.code = e.prescription_code" +
                " WHERE" +
                " p.hospital = '"+d.getHospital()+"' ";
        totalSql = setSQL( totalSql,keyWord,state,type,startDate,endDate,operator,flag);
@ -651,14 +652,15 @@ public class PrescriptionExpressageService extends BaseService {
                "  p.patient AS patientCode, " +
                "  py.charge_time AS chargeTime, " +
                "  p.dispensary_type AS dispensaryType, " +
                "  p.drug_delivery_operator_name AS operatorName," +
                "  e.hospital_doctor AS operatorName," +
                "  p.drug_delivery_flag AS drugDeliveryFlag, " +
                "  p.drug_delivery_time AS drugDeliveryTime," +
                "  e.fetching_medicine_time AS drugDeliveryTime," +
                "  p.code AS prescriptionCode," +
                "  p.`status` " +
                " FROM " +
                " wlyy_prescription p " +
                " JOIN wlyy_prescription_pay py ON py.prescription_code = p.`code` " +
                " LEFT JOIN wlyy_prescription_expressage e ON p.code = e.prescription_code" +
                " WHERE" +
                " p.hospital = '"+d.getHospital()+"' ";
        sql = setSQL( sql,keyWord,state,type,startDate,endDate,operator,flag);
@ -731,4 +733,100 @@ public class PrescriptionExpressageService extends BaseService {
        List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
        return rs;
    }
    public Map<String, Object> getPresEsList(String doctor,String keyWord, String state, String type, String startDate, String endDate, String operator,String flag,Integer page, Integer pageSize) {
        Map<String, Object> map = new HashedMap();
        Doctor d = doctorDao.findByCode(doctor);
        String totalSql = "SELECT count(1) AS total " +
                " FROM " +
                " wlyy_prescription p " +
                " JOIN wlyy_prescription_pay py ON py.prescription_code = p.`code` " +
                " LEFT JOIN wlyy_prescription_expressage e ON p.code = e.prescription_code" +
                " WHERE" +
                " p.hospital = '"+d.getHospital()+"' ";
        totalSql = setDrugSQL( totalSql,keyWord,state,type,startDate,endDate,operator,flag);
        totalSql +=  " AND p.`status`>=50 ";
        List<Map<String, Object>> totallist = jdbcTemplate.queryForList(totalSql);
        Long total = (Long)totallist.get(0).get("total");
        if(total==0){
            map.put("list",null);
            map.put("page",page);
            map.put("total",0);
            map.put("records",0);
            return map;
        }
        int start = (page - 1) * pageSize;
        String sql = "SELECT " +
                "  py.charge_no AS chargeNo, " +
                "  p.patient_name AS patientName, " +
                "  p.patient AS patientCode, " +
                "  py.charge_time AS chargeTime, " +
                "  p.dispensary_type AS dispensaryType, " +
                "  e.hospital_doctor AS operatorName," +
                "  p.drug_delivery_flag AS drugDeliveryFlag, " +
                "  e.fetching_medicine_time AS drugDeliveryTime," +
                "  p.code AS prescriptionCode," +
                "  p.`status` " +
                " FROM " +
                " wlyy_prescription p " +
                " JOIN wlyy_prescription_pay py ON py.prescription_code = p.`code` " +
                " LEFT JOIN wlyy_prescription_expressage e ON p.code = e.prescription_code" +
                " WHERE" +
                " p.hospital = '"+d.getHospital()+"' ";
        sql = setDrugSQL( sql,keyWord,state,type,startDate,endDate,operator,flag);
        sql +=  " AND p.`status`>=50 " +
                " ORDER BY e.fetching_medicine_time DESC " +
                " LIMIT " + start + "," + pageSize;
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        map.put("page",page);
        map.put("records",total);
        map.put("list",list);
        double t = (double)total;
        map.put("total",Math.ceil(t/pageSize));
        return map;
    }
    public String setDrugSQL(String sql,String keyWord, String state, String type, String startDate, String endDate,String operator,String flag){
        //关键字搜索
        if(StringUtils.isNotBlank(keyWord)){
            Patient p = patientDao.findByIdcard(keyWord);
            if(p!=null){
                sql += " AND p.patient = '"+p.getCode()+"' ";
            }else{
                p = patientDao.findBySsc(keyWord);
                if(p!=null){
                    sql += " AND p.patient = '"+p.getCode()+"' ";
                }else{
                    sql += " AND ( py.charge_no = '"+keyWord+"' OR p.patient_name ='"+keyWord+"' )";
                }
            }
        }
        if(StringUtils.isNotBlank(state)){
            sql += " AND p.status = "+state ;
        }
        if(StringUtils.isNotBlank(type)){
            sql +=" AND p.dispensary_type =" +type;
        }
        if(StringUtils.isNotBlank(startDate)){
            startDate +=" 00:00:00";
            sql += " AND e.fetching_medicine_time >='"+startDate+"' ";
        }
        if(StringUtils.isNotBlank(endDate)){
            endDate +=" 23:59:59";
            sql += " AND e.fetching_medicine_time <='"+endDate+"' ";
        }
        if(StringUtils.isNotBlank(operator)){
            sql += " AND p.drug_delivery_operator ='"+operator+"' ";
        }
        if(StringUtils.isNotBlank(flag)){
            sql += " AND p.drug_delivery_flag ="+flag+" ";
        }
        return sql;
    }
}

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/PatientService.java

@ -1091,7 +1091,7 @@ public class PatientService extends TokenService {
        if(list!=null&&list.size()>0){
            Map<String,Object> map = list.get(0);
            Long count = (Long)map.get("total");
            if(count>10){
            if(count>=10){
                return false;
            }else{
                return true;

+ 8 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/pc/prescription/PrescriptionExpressagePCService.java

@ -61,7 +61,7 @@ public class PrescriptionExpressagePCService extends BaseService {
    public JSONObject getMedicine(String code,String userCode) throws Exception{
        JSONObject jsonObject = new JSONObject();
        String sql = "select c.drug_delivery_flag AS drugDeliveryFlag,c.drug_delivery_operator_name AS drugDeliveryOperatorName,c.drug_delivery_time AS drugDeliveryTime,a.type,a.prescription_code as prescriptionCode ,c.status,b.hospital_code as hospitalCode, b.hospital_doctor as hospitalDoctor,\n" +
        String sql = "select c.ssc,c.drug_delivery_flag AS drugDeliveryFlag,c.drug_delivery_operator_name AS drugDeliveryOperatorName,c.drug_delivery_time AS drugDeliveryTime,a.type,a.prescription_code as prescriptionCode ,c.status,b.hospital_code as hospitalCode, b.hospital_doctor as hospitalDoctor,\n" +
                "b.code as orderCode, b.hospital_name as hospitalName,c.dispensary_type as dispensaryType,b.fetching_medicine_time as fetchingMedicineTime ,\n" +
                "b.expressage_code as expressageCode,c.patient \n" +
                "from wlyy_prescription_dispensary_code a \n" +
@ -91,6 +91,7 @@ public class PrescriptionExpressagePCService extends BaseService {
                            jsonObject.put("flag",1);
                            jsonObject.put("prescriptionInfoList",list);
                            jsonObject.put("idcard",patient.getIdcard());
                            jsonObject.put("ssc",patient.getSsc());
                            jsonObject.put("orderCode",result.get("orderCode"));
                            jsonObject.put("hospitalCode",result.get("hospitalCode"));
                            jsonObject.put("hospitalName",result.get("hospitalName"));
@ -111,6 +112,7 @@ public class PrescriptionExpressagePCService extends BaseService {
                            jsonObject.put("flag",-6);//”订单已取药,出药人:张三,出药时间:XXXX-XX-XX,无法重新出药
                            jsonObject.put("prescriptionInfoList",list);
                            jsonObject.put("idcard",patient.getIdcard());
                            jsonObject.put("ssc",patient.getSsc());
                            jsonObject.put("orderCode",result.get("orderCode"));
                            jsonObject.put("hospitalCode",result.get("hospitalCode"));
                            jsonObject.put("hospitalName",result.get("hospitalName"));
@ -129,7 +131,7 @@ public class PrescriptionExpressagePCService extends BaseService {
                    }
                    //健管师取药码
                    case 2:{
                        Patient patient = patientDao.findByCode(result.get("patient")+"");
                        //判断出药机构是否与健管师所属机构一致,不一致弹窗提示:“出药机构与您所在机构不一致,无法出药,请重新确认”。一致则进入下一步。
                        Doctor jgsDoctor = doctorService.findDoctorByCode(userCode);
                        Doctor doctor = doctorService.findDoctorByCode(result.get("expressageCode")+"");
@ -143,7 +145,8 @@ public class PrescriptionExpressagePCService extends BaseService {
                                List<PrescriptionInfo> list = prescriptionInfoDao.findByPrescriptionCode(result.get("prescriptionCode").toString());
                                jsonObject.put("prescriptionInfoList",list);
                                jsonObject.put("orderCode",result.get("orderCode"));
                                jsonObject.put("idcard",doctor.getIdcard());
                                jsonObject.put("idcard",patient.getIdcard());
                                jsonObject.put("ssc",result.get("ssc"));
                                jsonObject.put("hospitalCode",result.get("hospitalCode"));
                                jsonObject.put("hospitalName",result.get("hospitalName"));
                                jsonObject.put("status",result.get("status"));
@ -162,7 +165,8 @@ public class PrescriptionExpressagePCService extends BaseService {
                                List<PrescriptionInfo> list = prescriptionInfoDao.findByPrescriptionCode(result.get("prescriptionCode").toString());
                                jsonObject.put("prescriptionInfoList",list);
                                jsonObject.put("orderCode",result.get("orderCode"));
                                jsonObject.put("idcard",doctor.getIdcard());
                                jsonObject.put("idcard",patient.getIdcard());
                                jsonObject.put("ssc",result.get("ssc"));
                                jsonObject.put("hospitalCode",result.get("hospitalCode"));
                                jsonObject.put("hospitalName",result.get("hospitalName"));
                                jsonObject.put("status",result.get("status"));

+ 19 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionExpressageController.java

@ -143,6 +143,25 @@ public class PrescriptionExpressageController extends WeixinBaseController {
        }
    }
    @RequestMapping(value = "/getPresEsList", method = RequestMethod.GET)
    @ApiOperation(value = "获取出药记录列表")
    public String getPresEsList(@ApiParam(name = "keyWord", value = "订单号,接收人,医保号或身份证") @RequestParam(required = false)String keyWord,
                                   @ApiParam(name = "state", value = "续方状态") @RequestParam(required = false)String state,
                                   @ApiParam(name = "type", value = "1 自取 2快递配送 3健管师配送") @RequestParam(required = false)String type,
                                   @ApiParam(name = "startDate", value = "开始时间yyyy-MM--dd") @RequestParam(required = false)String startDate,
                                   @ApiParam(name = "endDate", value = "结束时间yyyy-MM-dd") @RequestParam(required = false)String endDate,
                                   @ApiParam(name = "operator", value = "操作人") @RequestParam(required = false)String operator,
                                   @ApiParam(name = "flag", value = "1为异常出药,0为正常") @RequestParam(required = false)String flag,
                                   @ApiParam(name = "page", value = "页面") @RequestParam(required = true)Integer page,
                                   @ApiParam(name = "pageSize", value = "页面大小") @RequestParam(required = true)Integer pageSize){
        try {
            return write(200, "获取成功", "data", expressageService.getPresEsList(getUID(),keyWord,state,type,startDate,endDate,operator,flag,page,pageSize));
        } catch (Exception e) {
            error(e);
            return error(-1, "获取失败");
        }
    }
    @RequestMapping(value = "/getHospitalOperator", method = RequestMethod.GET)
    @ApiOperation(value = "获取操作人员下拉列表")
    public String getHospitalOperator(){