瀏覽代碼

长处方统计

trick9191 7 年之前
父節點
當前提交
134e3c3550

+ 4 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionAdressDao.java

@ -4,8 +4,12 @@ import com.yihu.wlyy.entity.patient.prescription.PrescriptionAdress;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Trick on 2017/10/20.
 */
public interface PrescriptionAdressDao extends PagingAndSortingRepository<PrescriptionAdress, Long>, JpaSpecificationExecutor<PrescriptionAdress> {
    List<PrescriptionAdress> findByPatient(String patient);
}

+ 16 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionAdressService.java

@ -32,14 +32,28 @@ public class PrescriptionAdressService extends BaseService {
        List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
        return rs;
    }
    public Map<String,Object> getDefAdress(String patient){
        String sql = "SELECT ad.* FROM wlyy_prescription_adress ad WHERE ad.patient ='"+patient+"' AND ad.default_flag = 1";
        List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
        if(rs!=null&&rs.size()>0){
            return rs.get(0);
        }else{
            return null;
        }
    }
    //保存
    public String saveAdress(String adressJosn){
        JSONObject jsonObject = JSONObject.fromObject(adressJosn);
        PrescriptionAdress p = (PrescriptionAdress) net.sf.json.JSONObject.toBean(jsonObject,PrescriptionAdress.class);
        p.setCreateTime(new Date());
        if(p.getDefaultFlag()==1){
            String sql ="UPDATE wlyy_prescription_adress set defaultFlag = 0 WHERE patient ='"+p.getPatient()+"' ";
            jdbcTemplate.execute(sql);
            List<PrescriptionAdress> list =  prescriptionAdressDao.findByPatient(p.getPatient());
            if(list!=null&&list.size()>0){
                String sql ="UPDATE wlyy_prescription_adress set default_flag = 0 WHERE patient ='"+p.getPatient()+"' ";
                jdbcTemplate.execute(sql);
            }
        }
        prescriptionAdressDao.save(p);
        return "1";

+ 30 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statistics/StatisticsService.java

@ -4906,6 +4906,17 @@ public class StatisticsService extends BaseService {
                " AND p.`status` = ? " +
                " AND p.create_time <= ? " +
                " AND p.create_time >= ? ";
        String cancelSql = "SELECT " +
                " count(1) count" +
                " FROM " +
                " wlyy_prescription p " +
                " WHERE " +
                " p.admin_team_id = ? " +
                " AND p.`status` <= ? " +
                " AND p.create_time <= ? " +
                " AND p.create_time >= ? ";
        Map<String,Object> rs = new HashedMap();
        //总数
        List<Map<String,Object>> total = jdbcTemplate.queryForList(totalSql,new Object[]{adminTeamId,endDate,startDate});
@ -4943,7 +4954,7 @@ public class StatisticsService extends BaseService {
            rs.put("noReviewedCount",0);
        }
        //其他原因取消
        List<Map<String,Object>> payOuttimeCount = jdbcTemplate.queryForList(stateSql,new Object[]{adminTeamId,PrescriptionLog.PrescriptionLogStatus.pay_outtime.getValue(),endDate,startDate});
        List<Map<String,Object>> payOuttimeCount = jdbcTemplate.queryForList(cancelSql,new Object[]{adminTeamId,PrescriptionLog.PrescriptionLogStatus.pay_outtime.getValue(),endDate,startDate});
        if(total!=null&&total.size()>0){
            rs.put("payOuttimeCount",payOuttimeCount.get(0).get("count"));
        }else{
@ -4980,7 +4991,7 @@ public class StatisticsService extends BaseService {
        processingSql += " AND  p.`status` < " + PrescriptionLog.PrescriptionLogStatus.finish.getValue() +
                " AND p.`status`>= " + PrescriptionLog.PrescriptionLogStatus.revieweding.getValue() ;
        //已完成,已经取消,审核不通过,其他原因取消
        //已完成,已经取消,审核不通过
        String stateSql = "SELECT " +
                " count(1) count" +
                " FROM " +
@ -4992,6 +5003,18 @@ public class StatisticsService extends BaseService {
        }
        stateSql += " AND p.`status` = ? " ;
        //其他原因取消
        String cancelSql = "SELECT " +
                " count(1) count" +
                " FROM " +
                " wlyy_prescription p ";
        if(StringUtils.isNotBlank(disease)){
            cancelSql += " JOIN wlyy_prescription_diagnosis d ON  d.prescription_code = p.code WHERE d.health_problem ='"+disease+"' ";
        }else{
            cancelSql +=" WHERE 1=1 ";
        }
        cancelSql += " AND p.`status` <= ? " ;
        //市区
        if("4".equals(level)){
            //市区无过滤
@ -5000,11 +5023,13 @@ public class StatisticsService extends BaseService {
            totalSql += " AND LEFT(p.hospital, 6) = '"+area+"' ";
            processingSql += " AND LEFT(p.hospital, 6) = '"+area+"' ";
            stateSql += " AND LEFT(p.hospital, 6) = '"+area+"' ";
            cancelSql += " AND LEFT(p.hospital, 6) = '"+area+"' ";
        //机构
        }else if("2".equals(level)){
            totalSql += " AND p.hospital = '"+area+"' ";
            processingSql += " AND p.hospital = '"+area+"' ";
            stateSql += " AND p.hospital = '"+area+"' ";
            cancelSql += " AND LEFT(p.hospital, 6) = '"+area+"' ";
        }
        Map<String,Object> rs = new HashedMap();
@ -5044,7 +5069,7 @@ public class StatisticsService extends BaseService {
            rs.put("noReviewedCount",0);
        }
        //其他原因取消
        List<Map<String,Object>> payOuttimeCount = jdbcTemplate.queryForList(stateSql,new Object[]{PrescriptionLog.PrescriptionLogStatus.pay_outtime.getValue()});
        List<Map<String,Object>> payOuttimeCount = jdbcTemplate.queryForList(cancelSql,new Object[]{PrescriptionLog.PrescriptionLogStatus.pay_outtime.getValue()});
        if(total!=null&&total.size()>0){
            rs.put("payOuttimeCount",payOuttimeCount.get(0).get("count"));
        }else{
@ -5109,7 +5134,7 @@ public class StatisticsService extends BaseService {
            sql +=" AND p.`status` <'"+PrescriptionLog.PrescriptionLogStatus.finish.getValue()+"' " +
                  " AND p.`status`>='"+PrescriptionLog.PrescriptionLogStatus.revieweding+"'";
        }else if("6".equals(type)){
            sql +=" AND p.`status` ='"+PrescriptionLog.PrescriptionLogStatus.pay_outtime.getValue()+"'";
            sql +=" AND p.`status` <='"+PrescriptionLog.PrescriptionLogStatus.pay_outtime.getValue()+"'";
        }
        sql += " AND p.create_time >='"+DateUtil.dateToStr(dd.getTime(),"YYYY-MM-dd HH:mm:ss")+"' AND p.create_time <='"+ DateUtil.dateToStr(new Date(),"YYYY-MM-dd HH:mm:ss")+"'  GROUP BY LEFT(p.create_time,7) ";
@ -5301,7 +5326,7 @@ public class StatisticsService extends BaseService {
            sql +=" AND p.`status` <'"+PrescriptionLog.PrescriptionLogStatus.finish.getValue()+"' " +
                    " AND p.`status`>='"+PrescriptionLog.PrescriptionLogStatus.revieweding+"'";
        }else if("6".equals(type)){
            sql +=" AND p.`status` ='"+PrescriptionLog.PrescriptionLogStatus.pay_outtime.getValue()+"'";
            sql +=" AND p.`status` <='"+PrescriptionLog.PrescriptionLogStatus.pay_outtime.getValue()+"'";
        }
        return sql;

+ 25 - 9
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionPayController.java

@ -216,30 +216,42 @@ public class PatientPrescriptionPayController extends WeixinBaseController {
        }
    }
//===========================v1.3.9======================================================================
    @RequestMapping(value = "/getAdressList", method = RequestMethod.POST)
    @ApiOperation(value = "获取患者所有默认地址")
    @RequestMapping(value = "/getAddressList", method = RequestMethod.POST)
    @ApiOperation(value = "获取患者所有地址")
    public String getAdressList( @ApiParam(name = "patient", value = "居民code")
                                     @RequestParam(value = "patient", required = true)String patient){
        try {
            prescriptionAdressService.getAdressList(patient);
            return write(200, "发送成功!");
            return write(200, "获取成功!","data",prescriptionAdressService.getAdressList(patient));
        } catch (Exception e) {
            return error(-1, "获取失败!");
        }
    }
    @RequestMapping(value = "/getDefAddress", method = RequestMethod.POST)
    @ApiOperation(value = "获取患者默认地址")
    public String getDefAdress(String patient){
        try {
            return write(200, "获取成功!","data",prescriptionAdressService.getDefAdress(patient));
        } catch (Exception e) {
            error(e);
            return error(-1, "发送失败!");
        }
    }
    @RequestMapping(value = "/saveAdress", method = RequestMethod.POST)
    @RequestMapping(value = "/saveAddress", method = RequestMethod.POST)
    @ApiOperation(value = "保存地址")
    public String saveAdress(@ApiParam(name = "adressJosn", value = "实体json串")
                             @RequestParam(value = "adressJosn", required = true)String adressJosn){
    public String saveAdress(@ApiParam(name = "addressJson", value = "实体json串")
                             @RequestParam(value = "addressJson", required = true)String addressJson){
        try {
            return write(200, "获取成功!", "data", prescriptionAdressService.saveAdress(adressJosn));
            return write(200, "获取成功!", "data", prescriptionAdressService.saveAdress(addressJson));
        } catch (Exception e) {
            error(e);
            return error(-1, "获取失败!");
        }
    }
    @RequestMapping(value = "/delAdress", method = RequestMethod.POST)
    @RequestMapping(value = "/delAddress", method = RequestMethod.POST)
    @ApiOperation(value = "删除地址")
    public String delAdress(@ApiParam(name = "id", value = "主键")
                                @RequestParam(value = "id", required = true)Long id){
@ -247,6 +259,7 @@ public class PatientPrescriptionPayController extends WeixinBaseController {
            return write(200, "获取成功!", "data", prescriptionAdressService.delAdress(id));
        } catch (Exception e) {
            error(e);
            return error(-1, "获取失败!");
        }
    }
@ -258,6 +271,7 @@ public class PatientPrescriptionPayController extends WeixinBaseController {
            return write(200, "获取成功!", "data", prescriptionAdressService.getProvince());
        } catch (Exception e) {
            error(e);
            return error(-1, "获取失败!");
        }
    }
@ -270,6 +284,7 @@ public class PatientPrescriptionPayController extends WeixinBaseController {
            return write(200, "获取成功!", "data", prescriptionAdressService.getCityByProvince(province));
        } catch (Exception e) {
            error(e);
            return error(-1, "获取失败!");
        }
    }
@ -282,6 +297,7 @@ public class PatientPrescriptionPayController extends WeixinBaseController {
            return write(200, "获取成功!", "data", prescriptionAdressService.getTowmByCity(city));
        } catch (Exception e) {
            error(e);
            return error(-1, "获取失败!");
        }
    }