Browse Source

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

liuwenbin 7 years ago
parent
commit
9538ac28c5

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

@ -21,7 +21,7 @@ public interface PrescriptionDispensaryCodeDao extends PagingAndSortingRepositor
//    @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);
    @Query("select count(1) from PrescriptionDispensaryCode a ,Prescription b where a.prescriptionCode =b.code and a.code= ?1 and b.status != 100")
    @Query("select count(1) from PrescriptionDispensaryCode a where a.code= ?1 and a.isUse =0")
    Integer getResidentQRCodeCount(String code);
//    @Query("select p1 from PrescriptionInfo p1 left join Prescription p2 on p1.prescriptionCode=p2.code where p1.prescriptionCode = ?1")

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

@ -67,7 +67,7 @@ public class PrescriptionDispensaryCodeService extends BaseService {
            }
        }
        List<Object> params = new ArrayList<>();
        String precriptionSql = "select p2.*,p1.diagnosis as diagnosis ,p3.address as address from wlyy_prescription_dispensary_code p2 left join  wlyy_prescription p1 on p2.prescription_code=p1.code LEFT JOIN wlyy_prescription_expressage p3 on p1.code=p3.prescription_code where p1.patient=? and p2.type=? ";
        String precriptionSql = "select p2.*,p1.diagnosis as diagnosis ,p3.address as address from wlyy_prescription_dispensary_code p2 left join  wlyy_prescription p1 on p2.prescription_code=p1.code LEFT JOIN wlyy_prescription_expressage p3 on p1.code=p3.prescription_code where p1.patient=? and p2.type=?  and p2.is_Use=0 ";
        params.add(patientCode);
        params.add(type);
        if(status!=null){
@ -93,9 +93,9 @@ public class PrescriptionDispensaryCodeService extends BaseService {
    }
    //判断居民是否有(21等待领药、20配送中、100已完成)取药码
    public int dispensaryCodeCount(String patientCode){
        String sql = "select  count(1) from wlyy_prescription where status in(21,20,100) and patient =?";// where p2.status in(21,20,100)  and p2.patient =?1
        int count = jdbcTemplate.queryForObject(sql,Integer.class,patientCode);
    public int dispensaryCodeCount(String patientCode,Integer type){
        String sql = "select  count(1) from wlyy_prescription_dispensary_code p1 left join wlyy_prescription p2 on p1.prescription_code=p2.code where p1.is_use=0 and p1.type=? and p2.patient =? ";// where p2.status in(21,20,100)  and p2.patient =?1
        int count = jdbcTemplate.queryForObject(sql,Integer.class,type,patientCode);
        return  count;
    }
@ -109,6 +109,7 @@ public class PrescriptionDispensaryCodeService extends BaseService {
    }
    //生成居民端取药码
    @Transactional
    public PrescriptionDispensaryCode savePatientQRCode(String token,String prescriptionCode){
        //获取年月日8位数
        Calendar cal  = Calendar.getInstance();
@ -145,6 +146,7 @@ public class PrescriptionDispensaryCodeService extends BaseService {
    }
    //生成配送员(健管师)取药码
    @Transactional
    public PrescriptionDispensaryCode saveDoctorQRCode(String code,String token,String prescriptionCode){
        String jgsCode= "";
        synchronized (obj2){

+ 35 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionCodeController.java

@ -9,6 +9,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -27,7 +28,7 @@ public class PrescriptionCodeController extends BaseController{
    @Autowired
    private PrescriptionExpressageService prescriptionExpressageService;
    /**
     * 显示居民所有的取药码列表
     * 显示健管师(配送员)所有的取药码列表
     * @param status 处方状态
     * @param timeType 搜索时间类型
     * @param page 当前页
@ -44,8 +45,39 @@ public class PrescriptionCodeController extends BaseController{
            @RequestParam(value = "page",required = true) Integer page,
            @RequestParam(value = "pagesize",required = true) Integer pagesize) {
        //getUID()
        JSONArray result = prescriptionDispensaryCodeService.findByStatusAndTime(timeType,getUID(),status,page,pagesize,2);
        return result.toString();
        try{
            JSONArray result = prescriptionDispensaryCodeService.findByStatusAndTime(timeType,getUID(),status,page,pagesize,2);
            return result.toString();
        }catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
    /**
     * 判断医生端是否有待取的药的接口
     * @return
     */
    @RequestMapping(value = "/whetherHaveCode", method = RequestMethod.GET)
    @ResponseBody
    @ObserverRequired
    public String whetherHaveCode() {
        try{
            JSONObject json = new JSONObject();
//        String patientCode = getUID();
            int count = prescriptionDispensaryCodeService.dispensaryCodeCount(getUID(),2);
            if (count > 0) {
                json.put("data", true);
                return json.toString();
            }
            json.put("data", false);
            return json.toString();
        }catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
    /**

+ 18 - 8
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionController.java

@ -111,8 +111,13 @@ public class PatientPrescriptionController extends WeixinBaseController {
            @RequestParam(value = "page",required = true) Integer page,
            @RequestParam(value = "pagesize",required = true) Integer pagesize) {
        //getUID()"a663d0cf7f8c4d38a8327cedc921e65f"
        JSONArray result = prescriptionDispensaryCodeService.findByStatusAndTime(timeType,getUID(),status,page,pagesize,1);
        return result.toString();
        try {
            JSONArray result = prescriptionDispensaryCodeService.findByStatusAndTime(timeType,getUID(),status,page,pagesize,1);
            return result.toString();
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
    /**
@ -123,15 +128,20 @@ public class PatientPrescriptionController extends WeixinBaseController {
    @ResponseBody
    //@ObserverRequired
    public String whetherHaveCode() {
        JSONObject json = new JSONObject();
        try {
            JSONObject json = new JSONObject();
//        String patientCode = getUID();
        int count = prescriptionDispensaryCodeService.dispensaryCodeCount(getUID());
        if (count > 0) {
            json.put("data", true);
            int count = prescriptionDispensaryCodeService.dispensaryCodeCount(getUID(),1);
            if (count > 0) {
                json.put("data", true);
                return json.toString();
            }
            json.put("data", false);
            return json.toString();
        }catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
        json.put("data", false);
        return json.toString();
    }
    /**