Explorar o código

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

liuwenbin %!s(int64=8) %!d(string=hai) anos
pai
achega
2ab79bf55d

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

@ -2,9 +2,11 @@ package com.yihu.wlyy.service.app.prescription;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionDispensaryCode;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionInfo;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionLog;
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
import com.yihu.wlyy.repository.prescription.PrescriptionDispensaryCodeDao;
import com.yihu.wlyy.repository.prescription.PrescriptionInfoDao;
import com.yihu.wlyy.service.BaseService;
@ -51,6 +53,8 @@ public class PrescriptionDispensaryCodeService extends BaseService {
    private PrescriptionInfoDao prescriptionInfoDao;
    @Autowired
    private HttpUtil httpUtil;
    @Autowired
    private PrescriptionDao prescriptionDao;
    private static Object obj = new Object();
    private static Object obj2 = new Object();
@ -116,6 +120,30 @@ public class PrescriptionDispensaryCodeService extends BaseService {
        return false;
    }
    public boolean saveQRCode(String token,String prescriptionCode) throws Exception {
        Prescription prescription = prescriptionDao.findByCode(prescriptionCode);
        //取药类型:1 自取 2快递配送 3健管师配送
        Integer type = prescription.getDispensaryType();
        PrescriptionDispensaryCode prescriptionDispensaryCode = savePatientQRCode(token,prescriptionCode);
        if(type==3){
            if(prescriptionDispensaryCode!=null){
                prescriptionDispensaryCode = saveQRCode(prescriptionDispensaryCode.getCode(),token,prescriptionCode,2);
                if(prescriptionDispensaryCode!=null){
                    prescriptionDispensaryCode = saveQRCode(prescriptionDispensaryCode.getCode(),token,prescriptionCode,3);
                    if(prescriptionDispensaryCode==null){
                        return false;
                    }
                }else{
                    return false;
                }
            }else{
                return false;
            }
        }
        return true;
    }
    //生成居民端取药码
    @Transactional
    public PrescriptionDispensaryCode savePatientQRCode(String token,String prescriptionCode) throws Exception {

+ 20 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionController.java

@ -43,7 +43,27 @@ public class PatientPrescriptionController extends WeixinBaseController {
    @Autowired
    private PrescriptionExpressageService prescriptionExpressageService;
    /**
     * 生成取药码
     */
    @RequestMapping(value = "/dispensaryCode/saveQRCode",method = RequestMethod.POST)
    @ResponseBody
    @ObserverRequired
    public String saveQRCode2(
            @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, "生成二维码失败!");
           }
        }catch (Exception e) {
            error(e);
            return error(-1, "生成二维码失败!");
        }
    }
    /**
     *生成居民取药码