浏览代码

每日推送,居民端接口BUG修改

huangwenjie 7 年之前
父节点
当前提交
269c06a698

+ 13 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/PrescriptionController.java

@ -113,6 +113,19 @@ public class PrescriptionController extends BaseController{
			return Result.error(e.getMessage());
		}
	}
	
	@RequestMapping(value = "offlinepay",method = RequestMethod.POST)
	@ApiOperation("接收线下支付消息")
	public Result offlinepay(@ApiParam(name="data",value="json串",defaultValue = "{}")
	                                 @RequestParam(value = "data",required = true) String data){
		try {
			
			return prescriptionService.offlinepay(data);
		}catch (Exception e){
			e.printStackTrace();
			return Result.error(e.getMessage());
		}
	}
	/***************************************获取im消息*****************************************************/
	@RequestMapping(value = "getLoglist",method = RequestMethod.GET)

+ 108 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/prescription/PrescriptionService.java

@ -1229,4 +1229,112 @@ public class PrescriptionService extends ZysoftBaseService{
    
        return response;
    }
    
    /**
     * 接收线下支付消息
     * 收到该消息,直接修改出访卫已支付,已结算、等待发药状态
     * @param data
     * @return
     * @throws Exception
     */
    public Result offlinepay(String data)  throws Exception{
        String error = null;
        String status = "1";
        String errMsg = null;
        try{
            JSONObject json = JSONObject.parseObject(data);
            Integer code = json.getInteger("CODE");
            if(code==1){
                String orderNo = json.getString("ORDER_NO");//挂号编号
                String recipeNo = json.getString("RECIPE_NO");//处方编号
            
                Prescription prescription = prescriptionDao.findByVisitNoAndRecipeNo(orderNo,recipeNo);
                if(prescription.getStatus().equals(PrescriptionLog.PrescriptionLogStatus.pay_success.getValue())){
                
                    if(2 == prescription.getDispensaryType()){//如果是快递配送,则直接修改成配送中
                        prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing.getValue());
                    } else{
                        prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.wait_expressage.getValue());
                    }
                
                    prescription.setDrugDeliveryTime(new Date());
                    prescriptionDao.save(prescription);
                
                    //新增log表
                    PrescriptionLog log = new PrescriptionLog();
                    log.setPrescriptionCode(prescription.getCode());
                    log.setCode(getCode());
                    log.setCreateTime(new Date());
                    log.setType(PrescriptionLog.PrescriptionLogType.zy.getValue());
                    log.setUserType(2);
                    log.setHospital(prescription.getHospital());
                    log.setHospitalName(prescription.getHospitalName());
                    log.setUserName(prescription.getDoctorName());
                    log.setFlag(1);
                    log.setUserCode(prescription.getDoctor());
                    if(2 == prescription.getDispensaryType()){//如果是快递配送,则直接修改成配送中
                        log.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing.getValue());
                        log.setRemark("快递配送:配药成功,配送中");
                        prescriptionLogDao.save(log);
                    } else{
                        log.setStatus(PrescriptionLog.PrescriptionLogStatus.wait_expressage.getValue());
                        log.setRemark("配药成功");
                        prescriptionLogDao.save(log);
                    
                        //健管师配送
                        PrescriptionExpressage expressage = prescriptionExpressageDao.findByPrescriptionCode(prescription.getCode());
                        if(StringUtils.isNotBlank(expressage.getExpressageCode())){
                            Message message = new Message();
                            message.setCzrq(new Date());
                            message.setCreateTime(new Date());
                            message.setRead(1);//设置未读
                            message.setOver("1");
                            message.setReceiver(expressage.getExpressageCode());
                            message.setSender("system");
                            message.setCode(getCode());
                            message.setSenderName("系统");
                            message.setTitle("居民"+prescription.getPatientName()+"的续方订单待取药");
                            message.setContent("您有一条新的续方订单待取药!");
                            message.setType(7);//续方订单待取药
                            message.setReadonly(1);//是否只读消息
                            message.setDel("1");
                            message.setRelationCode(prescription.getCode());
                            message.setPrescriptionStatus("0");//待取药
                            message.setData(prescription.getAdminTeamId()+"");
                            messageDao.save(message);
                        }
                    
                        //判断提示健管师有续方代配送,居民待取药
                        JSONObject message = new JSONObject();
                        message.put("title","dispensingComplete");
                        message.put("state",1);
                        message.put("prescription",prescription.getCode());
                        message.put("mes","success");
//                redisTemplate.convertAndSend(channelTopic,message.toString());
//                redisTemplate.watch(channelTopic);
                        redisTemplate.opsForList().leftPush(channelTopic,message.toString());
//                redisTemplate.unwatch();
                    }
                
                }else {
                    error = "code:"+prescription.getCode()+",status:"+prescription.getStatus();
                }
            }else{
                error = "code:"+code;
            }
        
        }catch (JSONException ex){
            ex.printStackTrace();
            error = ex.getMessage();
            errMsg = ex.getMessage();
            status = "0";
        }catch (Exception e){
            e.printStackTrace();
            error = e.getMessage();
            status = "0";
        }
        //添加日志
        return addZyPushLog(data,"offlinepay","接收线下支付消息",error,"POST",status,"1",errMsg);
        
    }
}

+ 5 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/jimeiJkEdu/JMJkEduArticleService.java

@ -101,7 +101,7 @@ public class JMJkEduArticleService extends BaseService {
        com.alibaba.fastjson.JSONObject article = null;
        Doctor doctor = null;
        for (HealthEduArticlePatient one : esList) {
            article = thirdJkEduArticleService.getArticalById(one.getArticleId());
            article = thirdJkEduArticleService.getArticalById(one.getArticleId(),"");
            if (result.get(one.getArticleId()) != null) {
                heapm = result.get(one.getArticleId());
@ -289,7 +289,7 @@ public class JMJkEduArticleService extends BaseService {
        //通过文章id 获取文章详情
        JSONObject article = thirdJkEduArticleService.getArticalById(articleId);
        JSONObject article = thirdJkEduArticleService.getArticalById(articleId,"");
        healthEduArticlePatient.setArticleId(article.get("articleId") + "");
        healthEduArticlePatient.setAttachedTitle(article.get("articleTitle") + "");
@ -362,7 +362,7 @@ public class JMJkEduArticleService extends BaseService {
//    }
    public JSONObject pushArticleConfirm(String articleId, String labelUnit, String labelSex, String labelServe, String labelDisease, String labelHealth,String userCode) throws Exception {
        JSONObject article = thirdJkEduArticleService.getArticalById(articleId);
        JSONObject article = thirdJkEduArticleService.getArticalById(articleId,"");
        Set<String> patientSet = new HashSet<>();
        initPatient(patientSet, labelUnit, labelSex, labelServe, labelDisease, labelHealth,userCode);
        long num = patientSet.size();
@ -597,7 +597,7 @@ public class JMJkEduArticleService extends BaseService {
    }
    public JSONObject pushArticleConfirm(String articleId,String labelType, String condition, String groupType,Long teamId,String doctorCode) throws Exception{
        JSONObject article = thirdJkEduArticleService.getArticalById(articleId);
        JSONObject article = thirdJkEduArticleService.getArticalById(articleId,"");
        Set<String> patientSet = new HashSet<>();
        initPatients(patientSet,labelType,condition,groupType,teamId,doctorCode);
        long num = patientSet.size();
@ -731,7 +731,7 @@ public class JMJkEduArticleService extends BaseService {
        List<HealthEduArticlePatientModel> result = new ArrayList<>();
        Doctor doctor = null;
        for (HealthEduArticlePatient one : esList) {
            article = thirdJkEduArticleService.getArticalById(one.getArticleId());
            article = thirdJkEduArticleService.getArticalById(one.getArticleId(),"");
            heapm = new HealthEduArticlePatientModel();
            heapm.setSendName(one.getSendName());
            heapm.setSendCode(one.getDoctorCode());

+ 2 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jkEduArticle/ThirdJkEduArticleService.java

@ -334,12 +334,13 @@ public class ThirdJkEduArticleService extends BaseService {
     * @param articleId 文章id
     * @return
     */
    public JSONObject getArticalById(String articleId) throws Exception {
    public JSONObject getArticalById(String articleId,String userId) throws Exception {
        JSONObject re = new JSONObject();
        JSONObject json = null;
        try {
            JSONObject param = new JSONObject();
            param.put("articleId", articleId);
            param.put("userId", userId);
            String response = httpClientUtil.httpPost(articleBaseUrl+"/WsPlatform/rest", getParamsMap(getArticalById, param.toString(), "1"));
            json = JSON.parseObject(response);
        } catch (Exception e) {

+ 52 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/health/HealthEduArticleController.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.web.patient.health;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.education.HealthEduArticle;
import com.yihu.wlyy.entity.education.HealthEduArticleOpHistory;
@ -54,6 +55,9 @@ public class HealthEduArticleController extends BaseController {
    private DoctorService doctorService;
    @Autowired
    private ThirdJkEduArticleService healthEducationArticleService;
    
    @Autowired
    private ThirdJkEduArticleService thirdJkEduArticleService;
    /**
     * 查询文章列表
@ -263,5 +267,53 @@ public class HealthEduArticleController extends BaseController {
            return error(-1,"查询失败!");
        }
    }
    
    @RequestMapping(value = "saveArticleCollection",method = RequestMethod.POST)
    @ApiOperation("收藏文章")
    @ObserverRequired
    public String saveArticleCollection(@ApiParam(name = "articleId", value = "文章id")
                                        @RequestParam(value = "articleId", required = true) String articleId,
                                        @ApiParam(name = "articleCategoryId", value = "文章类别ID")
                                        @RequestParam(value = "articleCategoryId", required = false,defaultValue = "1") String articleCategoryId,
                                        @ApiParam(name = "articleCategoryName", value = "文章类别名称")
                                        @RequestParam(value = "articleCategoryName", required = false) String articleCategoryName){
        try {
            thirdJkEduArticleService.saveArticleCollection(articleId,articleCategoryId,articleCategoryName,getRepUID(),2);
//            thirdJkEduArticleService.saveArticleCollection(articleId,articleCategoryId,articleCategoryName,"0de7295862dd11e69faffa163e8aee56",1);
            
            return success("收藏成功!");
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"收藏失败!");
        }
    }
    
    @RequestMapping(value = "cancelArticleCollection",method = RequestMethod.POST)
    @ApiOperation("取消收藏文章")
    @ObserverRequired
    public String cancelArticleCollection(@ApiParam(name = "articleId", value = "文章id",defaultValue = "1")
                                          @RequestParam(value = "articleId", required = true) String articleId){
        try {
            thirdJkEduArticleService.cancelArticleCollection(articleId,getRepUID(),2);
//            thirdJkEduArticleService.cancelArticleCollection(articleId,"0de7295862dd11e69faffa163e8aee56",1);
            return success("取消成功!");
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"取消失败!");
        }
    }
    
    @RequestMapping(value = "getArticalById",method = RequestMethod.GET)
    @ApiOperation("获取文章详情")
    public String getArticalById(@ApiParam(name = "articleId", value = "文章id",defaultValue = "1")
                                 @RequestParam(value = "articleId", required = true) String articleId){
        try {
            com.alibaba.fastjson.JSONObject response = thirdJkEduArticleService.getArticalById(articleId,getRepUID());
            return write(200,"查询成功!","data",response);
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"查询失败!");
        }
    }
}

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkEduArticle/ThirdJkEduArticleController.java

@ -106,7 +106,7 @@ public class ThirdJkEduArticleController extends BaseController {
    public String getArticalById(@ApiParam(name = "articleId", value = "文章id",defaultValue = "1")
                                 @RequestParam(value = "articleId", required = true) String articleId){
        try {
            com.alibaba.fastjson.JSONObject response = thirdJkEduArticleService.getArticalById(articleId);
            com.alibaba.fastjson.JSONObject response = thirdJkEduArticleService.getArticalById(articleId,"");
            return write(200,"查询成功!","data",response);
        }catch (Exception e){
            e.printStackTrace();