Bläddra i källkod

Merge branch 'dev' of http://192.168.1.220:10080/Amoy/patient-co-management into dev-1.3.6.1

trick9191 7 år sedan
förälder
incheckning
7c98a82d6e

+ 4 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/prescription/PrescriptionDao.java

@ -30,4 +30,8 @@ public interface PrescriptionDao extends PagingAndSortingRepository<Prescription
    @Query("from Prescription p where p.visitNo=?1 and p.recipeNo=?2")
    Prescription findByVisitNoAndRecipeNo(String visitNo,String recipeNo);
    @Modifying
    @Query("update Prescription p set p.jwPayStatus=1 where p.code=?1")
    void updatejwPayStatus(String prescriptionCode);
}

+ 14 - 1
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/prescription/PrescriptionService.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.service.service.prescription;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.JSONObject;
@ -905,10 +906,22 @@ public class PrescriptionService extends ZysoftBaseService{
        String response = postSecond("executeSickSettle","院内结算确认接口",null,json,header,false,2);
        //添加日志到wlyy_zy_push_log表
        addZyPushLog(response,"executeSickSettle","院内结算确认接口",null  ,"POST","","3","");
        if(StringUtils.isNotBlank(response)){
            JSONObject reobj =  JSON.parseObject(response);
            Integer code = reobj.getInteger("CODE");
            String errmsg = reobj.getString("MESSAGE");
            if(1 != code){
                throw new Exception("基卫接口(院内结算确认接口)请求失败,"+errmsg);
            }else{
                prescriptionDao.updatejwPayStatus(prescriptionCode);
            }
        }else{
            throw new Exception("基卫接口(院内结算确认接口)请求失败,无数据返回!");
        }
        return response;
    }

+ 1 - 3
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/third/jw/JwPrescriptionService.java

@ -172,10 +172,8 @@ public class JwPrescriptionService {
            JSONObject reobj =  JSON.parseObject(response);
            Integer status = reobj.getInteger("status");
            String errmsg = reobj.getString("msg");
            if(-1 == status){
            if(200 != status){
                throw new Exception("基卫接口(院内结算确认接口)请求失败,"+errmsg);
            }else{
                prescriptionDao.updatejwPayStatus(prescriptionCode);
            }
        }else{
            throw new Exception("基卫接口(院内结算确认接口)请求失败,无数据返回!");

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

@ -42,4 +42,5 @@ public interface PrescriptionDispensaryCodeDao extends PagingAndSortingRepositor
    void updateToUse(String prescriptionCode, Integer type);
    PrescriptionDispensaryCode findByCodeAndIsUse(String code, Integer isUse);
    PrescriptionDispensaryCode findByPrescriptionCodeAndIsUseAndType(String prescriptionCode, Integer isUse,Integer type);
}

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

@ -114,28 +114,38 @@ public class PrescriptionDispensaryCodeService extends BaseService {
        return false;
    }
    public boolean saveQRCode(String token,String prescriptionCode) throws Exception {
    @Transactional
    public void saveQRCode(String token,String prescriptionCode) throws Exception {
        Prescription prescription = prescriptionDao.findByCode(prescriptionCode);
        //取药类型:1 自取 2快递配送 3健管师配送
        Integer type = prescription.getDispensaryType();
        PrescriptionDispensaryCode p1 = savePatientQRCode(token,prescriptionCode);
        PrescriptionDispensaryCode p1 = prescriptionDispensaryCodeDao.findByPrescriptionCodeAndIsUseAndType(prescriptionCode,0,1);
        if(p1==null){
            p1 = savePatientQRCode(token,prescriptionCode);
        }
        if(p1==null){
            throw new Exception("二维码生成失败!");
        }
        if(type==3){
            if(p1!=null){
            PrescriptionDispensaryCode p2 = prescriptionDispensaryCodeDao.findByPrescriptionCodeAndIsUseAndType(prescriptionCode,0,2);
            if(p2==null){
                PrescriptionDispensaryCode p2 = saveQRCode(p1.getCode(),token,prescriptionCode,2);
                if(p2!=null){
                    PrescriptionDispensaryCode p3 = saveQRCode(p1.getCode(),token,prescriptionCode,3);
                    if(p3==null){
                        return false;
                    }
                }else{
                    return false;
                }
            }else{
                return false;
                p2 = saveQRCode(p1.getCode(),token,prescriptionCode,2);
            }
            if(p2==null){
                throw new Exception("二维码生成失败!");
            }
            PrescriptionDispensaryCode p3 = prescriptionDispensaryCodeDao.findByPrescriptionCodeAndIsUseAndType(prescriptionCode,0,3);
            if(p3==null){
                p3 = saveQRCode(p1.getCode(),token,prescriptionCode,3);
            }
            if(p3==null){
                throw new Exception("二维码生成失败!");
            }
        }
        return true;
    }
    //生成居民端取药码

+ 0 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/JwPrescriptionService.java

@ -238,8 +238,6 @@ public class JwPrescriptionService {
            String errmsg = reobj.getString("msg");
            if(200 != status){
                throw new Exception("基卫接口(院内结算确认接口)请求失败,"+errmsg);
            }else{
                prescriptionDao.updatejwPayStatus(prescriptionCode);
            }
        }else{
            throw new Exception("基卫接口(院内结算确认接口)请求失败,无数据返回!");

+ 2 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionController.java

@ -53,12 +53,8 @@ public class PatientPrescriptionController extends WeixinBaseController {
            @ApiParam(required = true, name = "prescriptionCode", value = "处方code") @RequestParam(value = "prescriptionCode", required = true) String prescriptionCode) {
        try {
            boolean b = prescriptionDispensaryCodeService.saveQRCode(getAccessToken(), prescriptionCode);
            if (b) {
                return write(200, "生成二维码成功!");
            } else {
                return error(-1, "生成二维码失败!");
            }
            prescriptionDispensaryCodeService.saveQRCode(getAccessToken(), prescriptionCode);
            return write(200, "生成二维码成功!");
        } catch (Exception e) {
            error(e);
            return error(-1, "生成二维码失败!");