Przeglądaj źródła

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

huangwenjie 7 lat temu
rodzic
commit
18f91ed1dd

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

@ -8,6 +8,7 @@ import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.util.HttpUtil;
import com.yihu.wlyy.util.QrcodeUtil;
import com.yihu.wlyy.util.fastdfs.FastDFSUtil;
import io.swagger.annotations.ApiParam;
import org.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@ -46,13 +47,17 @@ public class PrescriptionDispensaryCodeService extends BaseService {
    private PrescriptionExpressageLogDao prescriptionExpressageLogDao;
    @Autowired
    private PrescriptionExpressageService prescriptionExpressageService;
    
    @Autowired
    private com.yihu.wlyy.util.CommonUtil CommonUtil;
    @Value("${fastDFS.fastdfs_file_url}")
    private String fastdfs_file_url;
    @Value("${neiwang.enable}")
    private Boolean isneiwang = false;  //如果不是内网项目要转到到内网wlyy在上传
    private static Object obj = new Object();
    private static Object obj2 = new Object();
    @Value("${fastDFS.fastdfs_file_url}")
    String fastdfs_file_url;
    //获取居民端取药码列表
    public  JSONArray findByStatusAndTime(Integer timeType, String patientCode, Integer status, Integer page, Integer pagesize,Integer type) {
        // 分页信息
@ -172,12 +177,39 @@ public class PrescriptionDispensaryCodeService extends BaseService {
            }
        }
        // 生成二维码
//        InputStream ipt = QrcodeUtil.createQrcode(Base64.encode(code.getBytes()),300,"png");
        InputStream ipt = QrcodeUtil.createQrcode(code,300,"png");
        ObjectNode imgNode = FastDFSUtil.upload(ipt,"png","QRCode_"+System.currentTimeMillis());
//        Prescription类  取药类型:1 自取 2快递配送 3健管师配送
        String fileUrl = fastdfs_file_url + imgNode.get("groupName").toString().replaceAll("\"","")
                + "/" + imgNode.get("remoteFileName").toString().replaceAll("\"","");
    
        String fileUrl = "";
    
        if (isneiwang) {
            // 圖片列表
            List<String> tempPaths = new ArrayList<String>();
            try {
                ObjectNode imgNode = FastDFSUtil.upload(ipt,"png","QRCode_"+System.currentTimeMillis());
                com.alibaba.fastjson.JSONObject json = com.alibaba.fastjson.JSONObject.parseObject(imgNode.toString());
                tempPaths.add(json.getString("fid"));
                String urls = "";
                for (String image : tempPaths) {
                    if (urls.length() == 0) {
                        urls = image;
                    } else {
                        urls += "," + image;
                    }
                }
                fileUrl = fastdfs_file_url + urls;
            } catch (Exception e) {
                e.printStackTrace();
            }
        } else {
            try {
                fileUrl = fastdfs_file_url + CommonUtil.PrescriptionQRCodetoNeiWang(ipt);
            }catch (Exception e){
                e.printStackTrace();
            }
            
        }
        //新增居民处方取码记录
        PrescriptionDispensaryCode prescriptionDispensaryCode = new PrescriptionDispensaryCode();
@ -205,12 +237,39 @@ public class PrescriptionDispensaryCodeService extends BaseService {
        //String jgsID= "";//配送员用户ID后4位
//        String jgsCode = code+"1234";//code+jgsID.substring(jgsID.length()-4);
        // 生成二维码
//        InputStream ipt = QrcodeUtil.createQrcode(Base64.encode(jgsCode.getBytes()),300,"png");
        InputStream ipt = QrcodeUtil.createQrcode(jgsCode,300,"png");
        ObjectNode imgNode = FastDFSUtil.upload(ipt,"png","QRCode_"+System.currentTimeMillis());
        InputStream ipt = QrcodeUtil.createQrcode(code,300,"png");
//        Prescription类  取药类型:1 自取 2快递配送 3健管师配送
        String fileUrl = fastdfs_file_url + imgNode.get("groupName").toString().replaceAll("\"","")
                + "/" + imgNode.get("remoteFileName").toString().replaceAll("\"","");
    
        String fileUrl = "";
    
        if (isneiwang) {
            // 圖片列表
            List<String> tempPaths = new ArrayList<String>();
            try {
                ObjectNode imgNode = FastDFSUtil.upload(ipt,"png","QRCode_"+System.currentTimeMillis());
                com.alibaba.fastjson.JSONObject json = com.alibaba.fastjson.JSONObject.parseObject(imgNode.toString());
                tempPaths.add(json.getString("fid"));
                String urls = "";
                for (String image : tempPaths) {
                    if (urls.length() == 0) {
                        urls = image;
                    } else {
                        urls += "," + image;
                    }
                }
                fileUrl = fastdfs_file_url + urls;
            } catch (Exception e) {
                e.printStackTrace();
            }
        } else {
            try {
                fileUrl = fastdfs_file_url + CommonUtil.PrescriptionQRCodetoNeiWang(ipt);
            }catch (Exception e){
                e.printStackTrace();
            }
        
        }
        //新增配送员处方取码记录
        PrescriptionDispensaryCode prescriptionDispensaryCode = new PrescriptionDispensaryCode();
        prescriptionDispensaryCode.setCode(jgsCode);

+ 23 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/CommonUtil.java

@ -590,4 +590,27 @@ public class CommonUtil {
        System.out.println("aaa,aaa,".substring(0,"aaa,aaa,".length()-2));
    }
    
    
    /**
     * 长处方生成取药码,生成取药二维码
     * 如果是外网那是发送到内网的服务器
     * @param ipt
     * @return
     */
    public String PrescriptionQRCodetoNeiWang(InputStream ipt) throws FileNotFoundException {
        String filename = "QRCode_"+System.currentTimeMillis();
        String fileUrls = "";
        HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
        String returnStr = request(request, ipt,filename );
        logger.info("returnStr :" + returnStr);
        logger.info("fileName :" + filename);
        logger.info("result :" + returnStr.toString());
        if (returnStr != null) {
            //1.3.7去掉前缀
            fileUrls += returnStr+",";
        }
        
        return fileUrls.substring(0,fileUrls.length()-1);
    }
}

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/FileUploadController.java

@ -577,8 +577,8 @@ public class FileUploadController extends BaseController {
                return error(-1, "上传失败");
            }
        } else {
            String result  = CommonUtil.toNeiWang(request, response);
            logger.info("fastDFSImag reslt :" + result);
//            String result  = CommonUtil.toNeiWang(request, response);
//            logger.info("fastDFSImag reslt :" + result);
            return CommonUtil.toNeiWang(request, response);
        }
    }

+ 27 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/booking/PatientBookingController.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.web.patient.booking;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.PatientReservation;
import com.yihu.wlyy.service.app.reservation.PatientReservationService;
@ -129,4 +130,30 @@ public class PatientBookingController extends WeixinBaseController{
            return error(-1, e.getMessage());
        }
    }
    
    //-----------------计划免疫预约相关接口--------------START
    
    @RequestMapping(value = "getChildrenInfo", method = RequestMethod.POST)
    @ResponseBody
    @ObserverRequired
    @ApiOperation("根据条形编码获取儿童信息")
    public String getChildrenInfo (@ApiParam(name = "barCode", value = "条形编码", defaultValue = "")
                                   @RequestParam(value = "barCode", required = true) String barCode){
    
        try{
            return "";
//            String
////            PatientReservation obj = patientReservationService.findById(orderId);
//            if(obj != null){
//
//            }else{
//                return error(-1, "该条码对应的儿童信息不存在");
//            }
        }catch (Exception e){
            error(e);
            return error(-1, e.getMessage());
        }
    }
    
    //-----------------计划免疫预约相关接口--------------END
}

+ 34 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/family/FamilyMemberController.java

@ -204,7 +204,12 @@ public class FamilyMemberController extends WeixinBaseController {
            } else  {
                result = familyMemberService.getPatientFamilyMembers(getUID(), "",null);
            }
            return write(200, "查询成功", "data", result);
            
            JSONObject data = new JSONObject();
            data.put("normalmembers",result);//家人关系
            data.put("immunemembers","");//免疫关系
            
            return write(200, "查询成功", "data", data);
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "查询失败");
@ -456,4 +461,32 @@ public class FamilyMemberController extends WeixinBaseController {
        String loginPassword = MD5.GetMD5Code(pw + "1");
        return write(200,loginPassword);
    }
    
    @RequestMapping(value = "/addImmuneMenberByBarCode", method = RequestMethod.POST)
    @ApiOperation(value = "根据儿童编码绑定家人免疫关系")
    public String addImmuneMenberByBarCode(@ApiParam(name = "barCode", value = "条形编码", defaultValue = "")
                                        @RequestParam(value = "barCode", required = true) String barCode){
        try {
            
            int result = 0;
            
            if(result==0){
                return error(-1, "不能添加自己");
            }else if(result==-1){
                return error(-1, "居民信息查询失败");
            }else if(result==-2){
                return error(-1, "该成员未注册");
            }else if (result == -4) {
                return error(-1, "该家庭成员已存在");
            }else if(result==-5){
                return error(-1, "该家庭关系已存在成员");
            }else if(result ==2) {
                return write(200, "拒绝成功");
            }else{
                return write(200, "添加成功");
            }
        } catch (Exception e) {
            return error(-1, "绑定失败");
        }
    }
}