|
@ -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;
|
|
|
}
|
|
|
|
|
|
//生成居民端取药码
|