Browse Source

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

liuwenbin 7 years ago
parent
commit
5ba6478c3c

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

@ -43,6 +43,8 @@ public class PrescriptionDispensaryCodeService extends BaseService {
    private PrescriptionLogDao prescriptionLogDao;
    @Autowired
    private PrescriptionExpressageLogDao prescriptionExpressageLogDao;
    @Autowired
    private PrescriptionExpressageService prescriptionExpressageService;
    private static Object obj = new Object();
    private static Object obj2 = new Object();
@ -232,58 +234,29 @@ public class PrescriptionDispensaryCodeService extends BaseService {
    }
    @Transactional
    public PrescriptionDispensaryCode scanQrcode(String code) throws Exception{
    public PrescriptionDispensaryCode scanQrcode(String code,String userCode) throws Exception{
        PrescriptionDispensaryCode prescriptionDispensaryCode = prescriptionDispensaryCodeDao.findByCodeAndIsUse(code,0);
        if(prescriptionDispensaryCode!=null){
            prescriptionDispensaryCode.setIsUse(1);
            prescriptionDispensaryCodeDao.save(prescriptionDispensaryCode);
            //新增log表
//            PrescriptionLog log = new PrescriptionLog();
        if(prescriptionDispensaryCode!=null){
            Prescription prescription = prescriptionDao.findByCode(prescriptionDispensaryCode.getPrescriptionCode());
            if(prescriptionDispensaryCode.getType()==1){
                prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.finish.getValue());
//                log.setRemark("配送到患者手中/已完成");
//                log.setType(PrescriptionLog.PrescriptionLogType.finish.getValue());
//                log.setStatus(PrescriptionLog.PrescriptionLogStatus.finish.getValue());
            }else if(prescription.getDispensaryType()==2){
                prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing.getValue());
//                log.setRemark("配送中");
//                log.setType(PrescriptionLog.PrescriptionLogType.expressage.getValue());
//                log.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing.getValue());
            }else{
                prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.expressage2hospital.getValue());
//                log.setRemark("配送到服务站");
//                log.setType(PrescriptionLog.PrescriptionLogType.expressage.getValue());
//                log.setStatus(PrescriptionLog.PrescriptionLogStatus.expressage2hospital.getValue());
            }
            if(prescription.getDispensaryType()==3){
                //健管师配送
                //修改系统的续方消息的审核状态
                messageDao.updatePreScriptionMessage(prescription.getCode(), "1", 7);
//                log.setUserType(2);
            }
//            else{
//                log.setUserType(1);
//            }
//            log.setPrescriptionCode(prescription.getCode());
//            log.setCode(getCode());
//            log.setCreateTime(new Date());
//            log.setHospital(prescription.getHospital());
//            log.setHospitalName(prescription.getHospitalName());
//            log.setUserName(prescription.getDoctorName());
//            log.setFlag(1);
//            log.setUserCode(prescription.getDoctor());
//            prescriptionLogDao.save(log);
        }else{
            throw new Exception("二维码输入错误或者已过期!");
            throw new Exception("取药码错误!");
        }
        Integer status =  prescriptionExpressageService.expressage(code, userCode);
        if (status == -1) {
            throw new Exception("取药码错误!");
        } else if (status == -2) {
            throw new Exception("编码已使用!");
        } else if (status == -3) {
            throw new Exception("编码类型错误!");
        }
        return prescriptionDispensaryCode;
    }

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

@ -171,7 +171,7 @@ public class PrescriptionCodeController extends BaseController{
    public String scanQrcode(
            @RequestParam(value = "code",required = true) String code){
        try {
            PrescriptionDispensaryCode prescriptionDispensaryCode = prescriptionDispensaryCodeService.scanQrcode(code);
            PrescriptionDispensaryCode prescriptionDispensaryCode = prescriptionDispensaryCodeService.scanQrcode(code,getUID());
            return write(200, "扫码成功!", "data", prescriptionDispensaryCode);
        } catch (Exception e) {
            error(e);