소스 검색

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

chenweida 7 년 전
부모
커밋
10bb7cd773

+ 1 - 1
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/LogService.java

@ -60,7 +60,7 @@ public class LogService {
    }
    /**
     * 保存http调用日志    0开放api  1基卫接口  2市民健康网接口   3易联众接口
     * 保存http调用日志    0开放api  1基卫接口  2市民健康网接口   3易联众接口  4长处方接口
     **/
    public void saveHttpLog(Boolean isSuccess,String url,String content,String method,String header,String params,String response,String error,String type)
    {

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

@ -662,6 +662,9 @@ public class PrescriptionService extends ZysoftBaseService{
        String response = postSecond("getDispUnSettleFeeInfoList","查询处方结算结果列表",params,null,header,false,2);
        //添加日志到wlyy_zy_push_log表
        addZyPushLog(response,"getDispUnSettleFeeInfoList","查询处方结算结果列表",null  ,"POST","","2","");
        return response;
    }
@ -731,6 +734,10 @@ public class PrescriptionService extends ZysoftBaseService{
        String response = postSecond("executeSickSettle","院内结算确认接口",null,json,header,false,2);
        //添加日志到wlyy_zy_push_log表
        addZyPushLog(response,"executeSickSettle","院内结算确认接口",null  ,"POST","","3","");
        return response;
    }

+ 52 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/PrescriptionExecuteSickSettleJob.java

@ -0,0 +1,52 @@
package com.yihu.wlyy.job;
import com.yihu.wlyy.service.app.prescription.PrescriptionService;
import com.yihu.wlyy.service.third.jw.JwPrescriptionService;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
/**
 * 遍历长处方支付成功但是院内结算失败的记录,重新执行院内结算
 * @author huangwenjie
 * @date 2017/8/17 15:08
 */
public class PrescriptionExecuteSickSettleJob implements Job {
    private static final Logger logger = LoggerFactory.getLogger(PrescriptionExecuteSickSettleJob.class);
    @Autowired
    private PrescriptionService prescriptionService;
    @Autowired
    private JwPrescriptionService jwPrescriptionService;
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        logger.info("START=====开始执行长处方支付成功,院内结算失败,重新执行院内结算的JOB");
        try {
            //获取支付完成,院内结算失败的 处方CODE 集合
            List<String> prescriptionCodeList = prescriptionService.findCodesByPayStautsAndExecuteSickStatus();
            if(!prescriptionCodeList.isEmpty()){
                for (String code : prescriptionCodeList) {
                    try {
                        jwPrescriptionService.executeSickSettle(code);
                    }catch (Exception e){
                        logger.info("ERROR======重新执行院内结算的JOB,CODE:"+code+",message:" +e.getMessage());
                    }
                }
            }
        logger.info("END========执行长处方支付成功,院内结算失败,重新执行院内结算的JOB");
        }catch (Exception e){
            e.printStackTrace();
            logger.info("END===ERROE===执行长处方支付成功,院内结算失败,重新执行院内结算的JOB,message:"+e.getMessage());
        }
    }
}

+ 3 - 2
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/SFExpressJob.java

@ -20,19 +20,20 @@ import java.text.SimpleDateFormat;
import java.util.*;
/**
 *遍历顺丰快递下单失败的记录,重新下单
 *@author huangwenjie
 *@date 2017/8/12 14:11
 *遍历顺丰快递下单失败的记录,重新下单
 */
public class SFExpressJob implements Job {
    private static final Logger logger = LoggerFactory.getLogger(SFExpressJob.class);
    @Autowired
    private PrescriptionExpressageService prescriptionExpressageService;
    @Autowired
    private SFExpressService sfexpressService;
    private static final Logger logger = LoggerFactory.getLogger(SFExpressJob.class);
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {

+ 3 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionPayDao.java

@ -14,4 +14,7 @@ import java.util.List;
public interface PrescriptionPayDao extends PagingAndSortingRepository<PrescriptionPay, Long>, JpaSpecificationExecutor<PrescriptionPay> {
    @Query("from PrescriptionPay p where p.prescriptionCode=?1 ")
    PrescriptionPay findByPrescriptionPay(String prescriptionCode);
    @Query(value = "select p.prescription_code from wlyy_prescription_pay p LEFT JOIN  wlyy_prescription a on a.code = p.prescription_code where p.trade_status = 1 and a.jw_pay_status = 0")
    List<String> findCodesByPayStautsAndExecuteSickStatus();
}

+ 16 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionService.java

@ -2,9 +2,13 @@ package com.yihu.wlyy.service.app.prescription;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
import com.yihu.wlyy.repository.prescription.PrescriptionPayDao;
import com.yihu.wlyy.service.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
 * Created by huangwenjie on 2017/8/12.
 */
@ -13,6 +17,9 @@ public class PrescriptionService extends BaseService {
    @Autowired
    private PrescriptionDao prescriptionDao;
    @Autowired
    private PrescriptionPayDao prescriptionPayDao;
    /**
     *  获取处方信息
     * @param prescriptionCode 处方code
@ -22,4 +29,13 @@ public class PrescriptionService extends BaseService {
        return prescriptionDao.findByCode(prescriptionCode);
    }
    /**
     * 获取支付完成,院内结算失败的 处方CODE 集合
     *@author huangwenjie
     *@date 2017/8/17 19:27
     */
    public List<String> findCodesByPayStautsAndExecuteSickStatus() {
        return prescriptionPayDao.findCodesByPayStautsAndExecuteSickStatus();
    }
}

+ 99 - 27
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/third/jw/JwPrescriptionService.java

@ -1,14 +1,23 @@
package com.yihu.wlyy.service.third.jw;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
import com.yihu.wlyy.util.HttpClientUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
 * 基位长处方接口
@ -17,11 +26,16 @@ import java.util.List;
@Service
public class JwPrescriptionService {
    private static final Logger logger = LoggerFactory.getLogger(JwPrescriptionService.class);
    //基卫服务地址
    @Value("${sign.check_upload}")
    private String jwUrl;
    @Autowired
    private HttpClientUtil httpClientUtil;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private PrescriptionDao prescriptionDao;
    /**
     * 获取字典列表
@ -41,18 +55,14 @@ public class JwPrescriptionService {
    /**
     * 获取处方模板
     * @param deptCode 科室编码
     * @param staffCode 人员code
     * @param hospital 医院code
     * @param doctor 医生code
     * @return
     * @throws Exception
     */
    public String getRecipeTemplate(String deptCode,String staffCode, String hospital) throws Exception{
    public String getRecipeTemplate(String doctor) throws Exception{
        String url = jwUrl + "/third/prescription/getRecipeTemplate";
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("deptCode", deptCode));
        params.add(new BasicNameValuePair("staffCode", staffCode));
        params.add(new BasicNameValuePair("hospital", hospital));
        params.add(new BasicNameValuePair("doctor", doctor));
        String response = httpClientUtil.post(url, params, "UTF-8");
@ -77,27 +87,57 @@ public class JwPrescriptionService {
        params.add(new BasicNameValuePair("applyTimeFrom", applyTimeFrom));
        params.add(new BasicNameValuePair("applyTimeEnd", applyTimeEnd));
        String response = httpClientUtil.post(url, params, "UTF-8");
//        String response = httpClientUtil.post(url, params, "UTF-8");
        String sql = "SELECT h.response from wlyy_http_log h WHERE h.id = 806287";
        List<Map<String ,Object>> list = jdbcTemplate.queryForList(sql);
        String response = list.get(0).get("response").toString();
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("status",200);
        jsonObject.put("data",response);
        response = jsonObject.toString();
        return response;
    }
    /**
     * 处方开方接口
     * @param prescriptionCode 续方code
     * 获取单条历史处方
     * @param recipeNo
     * @param cardNo
     * @return
     * @throws Exception
     */
    public String saveRecipe(String prescriptionCode) throws Exception{
        String url = jwUrl + "/third/prescription/saveRecipe";
    public String getRecipe(String recipeNo,String cardNo){
        String url = jwUrl + "/third/prescription/getRecipe";
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("prescriptionCode", prescriptionCode));
        params.add(new BasicNameValuePair("recipeNo", recipeNo));
        params.add(new BasicNameValuePair("cardNo", cardNo));
        String response = httpClientUtil.post(url, params, "UTF-8");
        return response;
    }
    /**
     * 处方开方接口
     * @param prescriptionCode 续方code
     * @return
     * @throws Exception
     */
    public String saveRecipe(String prescriptionCode){
        String response = null;
        try {
            String url = jwUrl + "/third/prescription/saveRecipe";
            List<NameValuePair> params = new ArrayList<>();
            params.add(new BasicNameValuePair("prescriptionCode", prescriptionCode));
            response = httpClientUtil.post(url, params, "UTF-8");
            return response;
        }catch (Exception e){
            logger.info("处方开方接口saveRecipe:"+response);
            throw e;
        }
    }
    /**
     * 待结算费用列表接口
     * @param cardNo
@ -116,33 +156,65 @@ public class JwPrescriptionService {
        return response;
    }
    public String executeSickSettle(String dictName) throws Exception{
    /**
     * 院内结算确认接口
     * @param prescriptionCode 处方CODE
     * @return
     * @throws Exception
     */
    public String executeSickSettle(String prescriptionCode) throws Exception{
        String url = jwUrl + "/third/prescription/executeSickSettle";
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("dictName", dictName));
        params.add(new BasicNameValuePair("prescriptionCode", prescriptionCode));
        String response = httpClientUtil.post(url, params, "UTF-8");
        return response;
    }
    /**
     * 挂号作废处方接口
     * @param visitNo 挂号号
     * @param fadeDept 作废科室编码
     * @param fadeOperator 作废人员编码
     * @param prescriptionCode 续方号码
     * @return
     * @throws Exception
     */
    public String fadeRecipe(String visitNo,String fadeDept,String fadeOperator)throws Exception{
        String url = jwUrl + "/third/prescription/fadeRecipe";
    public String fadeRecipe(String prescriptionCode)throws Exception{
        Prescription prescription = prescriptionDao.findByCode(prescriptionCode);
        if(StringUtils.isNotBlank(prescription.getVisitNo())){
            String url = jwUrl + "/third/prescription/fadeRecipe";
            List<NameValuePair> params = new ArrayList<>();
            params.add(new BasicNameValuePair("visitNo", prescription.getVisitNo()));//挂号号
            params.add(new BasicNameValuePair("fadeDept", prescription.getJwDeptCode()));//作废科室编码
            params.add(new BasicNameValuePair("fadeOperator", prescription.getJwDoctorCode()));//作废人员编码
            String response = httpClientUtil.post(url, params, "UTF-8");
            if(StringUtils.isNotBlank(response)){
                JSONObject reobj =  JSON.parseObject(response);
                Integer status = reobj.getInteger("status");
                String errmsg = reobj.getString("msg");
                if(-1 == status){
                    throw new Exception("基卫接口(挂号作废)请求失败,"+errmsg);
                }
            }else{
                throw new Exception("基卫接口(挂号作废)请求失败,无数据返回!");
            }
            return response;
        }
        return "";
    }
    /**
     * ca认证接口
     * @param code 续方code
     * @return
     */
    public String affirmCARecipe(String code){
        String url = jwUrl + "/third/prescription/affirmCARecipe";
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("visitNo", visitNo));//挂号号
        params.add(new BasicNameValuePair("fadeDept", fadeDept));//作废科室编码
        params.add(new BasicNameValuePair("fadeOperator", fadeOperator));//作废人员编码
        params.add(new BasicNameValuePair("code", code));//续方code
        String response = httpClientUtil.post(url, params, "UTF-8");
        return response;
    }
}