Explorar el Código

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

trick9191 hace 7 años
padre
commit
010d6a17d4

+ 1 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionDispensaryCodeDao.java

@ -19,6 +19,7 @@ public interface PrescriptionDispensaryCodeDao extends PagingAndSortingRepositor
    @Query(nativeQuery = true, value = "select * from wlyy_prescription_dispensary_code  where code=?1 order by create_time desc limit 0,1 ")
    PrescriptionDispensaryCode finByCode(String code);
    List<PrescriptionDispensaryCode> findByPrescriptionCode(String prescriptionCode);
    //    @Query("select  count(1) from wlyy_prescription_dispensary_code p1 \n" +
//            "LEFT JOIN wlyy_prescription p2 on p1.prescription_Code = p2.code where p2.status in(21,20,100) and p2.patient =?1 ")
//    int dispensaryCodeCount(String patientCode);

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

@ -566,22 +566,22 @@ public class PrescriptionExpressageService extends BaseService {
            try {
                //更新二维码(isUse)
                PrescriptionDispensaryCode prescriptionDispensaryCode = prescriptionDispensaryCodeDao.finByCode(prescriptionCode);
                if(prescriptionDispensaryCode!=null){
                List<PrescriptionDispensaryCode> list = prescriptionDispensaryCodeDao.findByPrescriptionCode(prescriptionCode);
                if(list!=null&&list.size()>0){
                    //修改取药码code为已经使用
                    prescriptionDispensaryCode.setIsUse(1);
                    prescriptionDispensaryCodeDao.save(prescriptionDispensaryCode);
                    //更新配送信息
                    PrescriptionExpressage prescriptionExpressage = prescriptionExpressageDao.findByPrescriptionCode(prescriptionDispensaryCode.getPrescriptionCode());
                    if(prescriptionExpressage!=null){
                        prescriptionExpressage.setHospitalDoctor(d.getName());
                        prescriptionExpressage.setHospitalDoctorCode(doctor);
                        prescriptionExpressage.setFetchingMedicineTime(new Date());
                        prescriptionExpressageDao.save(prescriptionExpressage);
                    for(PrescriptionDispensaryCode prescriptionDispensaryCode:list){
                        prescriptionDispensaryCode.setIsUse(1);
                        prescriptionDispensaryCodeDao.save(prescriptionDispensaryCode);
                    }
                }
                //更新配送信息
                PrescriptionExpressage prescriptionExpressage = prescriptionExpressageDao.findByPrescriptionCode(prescriptionCode);
                if(prescriptionExpressage!=null){
                    prescriptionExpressage.setHospitalDoctor(d.getName());
                    prescriptionExpressage.setHospitalDoctorCode(doctor);
                    prescriptionExpressage.setFetchingMedicineTime(new Date());
                    prescriptionExpressageDao.save(prescriptionExpressage);
                }
            }catch (Exception e){
                logger.info("更新二维码(isUse),更新配送信息 异常:"+e.getMessage());
            }
@ -665,7 +665,7 @@ public class PrescriptionExpressageService extends BaseService {
                " p.hospital = '"+d.getHospital()+"' ";
        sql = setSQL( sql,keyWord,state,type,startDate,endDate,operator,flag);
        sql +=  " AND p.`status`>=50 " +
                " ORDER BY py.create_time DESC " +
                " ORDER BY py.charge_time DESC " +
                " LIMIT " + start + "," + pageSize;
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
@ -702,14 +702,14 @@ public class PrescriptionExpressageService extends BaseService {
        }
        if(StringUtils.isNotBlank(startDate)){
            startDate +=" 00:00:00";
            sql += " AND py.create_time >='"+startDate+"' ";
            sql += " AND py.charge_time >='"+startDate+"' ";
        }
        if(StringUtils.isNotBlank(endDate)){
            endDate +=" 23:59:59";
            sql += " AND py.create_time <='"+endDate+"' ";
            sql += " AND py.charge_time <='"+endDate+"' ";
        }
        if(StringUtils.isNotBlank(operator)){
            sql += " AND p.drug_delivery_operator ='"+operator+"' ";
            sql += " AND e.hospital_doctor_code ='"+operator+"' ";
        }
        if(StringUtils.isNotBlank(flag)){
            sql += " AND p.drug_delivery_flag ="+flag+" ";
@ -720,16 +720,16 @@ public class PrescriptionExpressageService extends BaseService {
    public List<Map<String,Object>> getHospitalOperator(String doctor){
        Doctor d = doctorDao.findByCode(doctor);
        String sql = "SELECT " +
                " p.drug_delivery_operator AS operator, " +
                " p.drug_delivery_operator_name AS operatorName " +
                " p.hospital_doctor_code AS operator, " +
                " p.hospital_doctor AS operatorName " +
                " FROM " +
                " wlyy_prescription p " +
                " wlyy_prescription_expressage p " +
                " WHERE " +
                " p.hospital = '"+d.getHospital()+"' " +
                " AND p.drug_delivery_operator IS NOT NULL" +
                " AND p.drug_delivery_operator <>'' " +
                " p.hospital_code = '"+d.getHospital()+"' " +
                " AND p.hospital_doctor_code IS NOT NULL" +
                " AND p.hospital_doctor_code <>'' " +
                " GROUP BY " +
                " p.drug_delivery_operator ";
                " p.hospital_doctor_code ";
        List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
        return rs;
    }
@ -822,7 +822,7 @@ public class PrescriptionExpressageService extends BaseService {
            sql += " AND e.fetching_medicine_time <='"+endDate+"' ";
        }
        if(StringUtils.isNotBlank(operator)){
            sql += " AND p.drug_delivery_operator ='"+operator+"' ";
            sql += " AND e.hospital_doctor_code ='"+operator+"' ";
        }
        if(StringUtils.isNotBlank(flag)){
            sql += " AND p.drug_delivery_flag ="+flag+" ";

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

@ -154,8 +154,7 @@ public class PrescriptionExpressageController extends WeixinBaseController {
                                   @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));
        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, "获取失败");