Browse Source

删除PC版本的项目

chenweida 7 years ago
parent
commit
a94f63da6f

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

@ -12,6 +12,7 @@ import java.util.List;
 * Created by chenweida on 2017/7/27.
 */
public interface PrescriptionLogDao extends PagingAndSortingRepository<PrescriptionLog, Long>, JpaSpecificationExecutor<PrescriptionLog> {
    @Query("select l.status,l.createTime from PrescriptionLog l where l.prescriptionCode=?1 and l.type in ?2 order by createTime desc")
    List<PrescriptionLog> findPrescriptionLogsByPrescriptionCode(String prescriptionCode, Integer[] types);
}

+ 103 - 9
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionExpressageService.java

@ -42,12 +42,18 @@ public class PrescriptionExpressageService {
    /**
     * 确认配送成功
     *
     * @param code
     * @param code     编码code
     * @param userCode
     * @param type     1是患者 2是医生
     * @return 返回取药码或者配送码的类型  1 居民取药码 2 配送员(健管师)取药码 3 配送员(健管师)配送码
     * 前端根据这个类型去跳转
     */
    @Transactional
    public Integer expressage(String code, String userCode) throws Exception {
    public Integer expressage(String code, String userCode, Integer type) throws Exception {
        Integer returnStatus = -1;
        //获取根据wlyy_prescription_dispensary_code的code处方编码
        PrescriptionDispensaryCode prescriptionDispensaryCode = prescriptionDispensaryCodeDao.finByCode(code);
        if (prescriptionDispensaryCode == null) {
            //保存配送失败的日志
            PrescriptionLog prescriptionLog = new PrescriptionLog();
@ -61,11 +67,12 @@ public class PrescriptionExpressageService {
            prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing_error.getValue());
            prescriptionLog.setRemark("配送失败,处方编码不存在");
            prescriptionLogDao.save(prescriptionLog);
            return -1;
            return returnStatus;
        }
        //判断是否是取药码
        if (prescriptionDispensaryCode.getType() != 1 || prescriptionDispensaryCode.getType() != 2) {
            //保存取药失败的日志
        //判断患者不能扫描医生的二维码 医生也不能扫描患者的二维码
        if (!((type == 1 && prescriptionDispensaryCode.getType() == 1) ||
                (type == 2 && (prescriptionDispensaryCode.getType() == 2 || prescriptionDispensaryCode.getType() == 3)))) {
            //保存配送失败的日志
            PrescriptionLog prescriptionLog = new PrescriptionLog();
            prescriptionLog.setCode(UUID.randomUUID().toString());
            prescriptionLog.setPrescriptionCode(prescriptionDispensaryCode.getPrescriptionCode());
@ -75,11 +82,41 @@ public class PrescriptionExpressageService {
            prescriptionLog.setUserCode(userCode);
            prescriptionLog.setUserType(2);
            prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing_error.getValue());
            prescriptionLog.setRemark("配送失败,处方编码不是取药码");
            prescriptionLog.setRemark("患者不能扫描医生的二维码 医生也不能扫描患者的二维码");
            prescriptionLogDao.save(prescriptionLog);
            return -1;
            return returnStatus;
        }
        switch (prescriptionDispensaryCode.getType()) {
            case 1: {
                //判断是1 居民取药码
                returnStatus = dispensaryCode_1(userCode, prescriptionDispensaryCode);
                break;
            }
            case 2: {
                //判断是2 配送员(健管师)取药码
                returnStatus = dispensaryCode_2(userCode, prescriptionDispensaryCode);
                break;
            }
            case 3: {
                //判断是3 配送员(健管师)配送码
                returnStatus = dispensaryCode_3(userCode, prescriptionDispensaryCode);
                break;
            }
        }
        return returnStatus;
    }
    /**
     * 1 居民取药码 业务
     *
     * @param userCode
     * @param prescriptionDispensaryCode
     * @return
     */
    private Integer dispensaryCode_1(String userCode, PrescriptionDispensaryCode prescriptionDispensaryCode) {
        //修改处方状态为完成
        prescriptionDao.updateStatus(prescriptionDispensaryCode.getPrescriptionCode(), PrescriptionLog.PrescriptionLogStatus.finish.getValue());
@ -97,7 +134,64 @@ public class PrescriptionExpressageService {
        //修改取药码code为已经使用
        prescriptionDispensaryCode.setIsUse(1);
        return 1;
        return prescriptionDispensaryCode.getType();
    }
    /**
     * 配送员(健管师)取药码 业务
     *
     * @param userCode
     * @param prescriptionDispensaryCode
     * @return
     */
    private Integer dispensaryCode_2(String userCode, PrescriptionDispensaryCode prescriptionDispensaryCode) {
        //修改处方状态为配送中
        prescriptionDao.updateStatus(prescriptionDispensaryCode.getPrescriptionCode(), PrescriptionLog.PrescriptionLogStatus.expressageing.getValue());
        //保存配送成功的日志
        PrescriptionLog prescriptionLog = new PrescriptionLog();
        prescriptionLog.setPrescriptionCode(prescriptionDispensaryCode.getPrescriptionCode());
        prescriptionLog.setCode(UUID.randomUUID().toString());
        prescriptionLog.setType(PrescriptionLog.PrescriptionLogType.expressage.getValue());
        prescriptionLog.setCreateTime(new Date());
        prescriptionLog.setFlag(1);
        prescriptionLog.setUserCode(userCode);
        prescriptionLog.setUserType(2);
        prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing.getValue());
        prescriptionLogDao.save(prescriptionLog);
        //修改取药码code为已经使用
        prescriptionDispensaryCode.setIsUse(1);
        return prescriptionDispensaryCode.getType();
    }
    /**
     * 配送员(健管师)配送码
     *
     * @param userCode
     * @param prescriptionDispensaryCode
     * @return
     */
    private Integer dispensaryCode_3(String userCode, PrescriptionDispensaryCode prescriptionDispensaryCode) {
        //修改处方状态为完成
        prescriptionDao.updateStatus(prescriptionDispensaryCode.getPrescriptionCode(), PrescriptionLog.PrescriptionLogStatus.finish.getValue());
        //保存配送成功的日志
        PrescriptionLog prescriptionLog = new PrescriptionLog();
        prescriptionLog.setPrescriptionCode(prescriptionDispensaryCode.getPrescriptionCode());
        prescriptionLog.setCode(UUID.randomUUID().toString());
        prescriptionLog.setType(PrescriptionLog.PrescriptionLogType.expressage.getValue());
        prescriptionLog.setCreateTime(new Date());
        prescriptionLog.setFlag(1);
        prescriptionLog.setUserCode(userCode);
        prescriptionLog.setUserType(2);
        prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.expressage2hospital.getValue());
        prescriptionLogDao.save(prescriptionLog);
        //修改取药码code为已经使用
        prescriptionDispensaryCode.setIsUse(1);
        return prescriptionDispensaryCode.getType();
    }
    /**

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

@ -94,11 +94,11 @@ public class PrescriptionCodeController extends BaseController{
    public String expressage(
            @RequestParam(required = true) @ApiParam(value = "wlyy_prescription_dispensary_code的code", name = "code") String code) {
        try {
            Integer status = prescriptionExpressageService.expressage(code, getUID());
            Integer status = prescriptionExpressageService.expressage(code, getUID(),1);
            if (status == -1) {
                return error(-1, "取药码错误");
            }
            return write(200, "配送成功");
            return write(200, "配送成功","status",status);
        } catch (Exception e) {
            return error(-1, "失败");
        }

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionInfoController.java

@ -49,11 +49,11 @@ public class PrescriptionInfoController extends BaseController {
    public String expressage(
            @RequestParam(required = true) @ApiParam(value = "wlyy_prescription_dispensary_code的code", name = "code") String code) {
        try {
            Integer status = prescriptionExpressageService.expressage(code, getUID());
            Integer status = prescriptionExpressageService.expressage(code, getUID(),2);
            if (status == -1) {
                return error(-1, "编码不存在");
            }
            return write(200, "配送成功");
            return write(200, "配送成功","status",status);
        } catch (Exception e) {
            error(e);
            return error(-1, "失败");