Kaynağa Gözat

淮海配置

lighter 2 ay önce
ebeveyn
işleme
062e826d47

+ 426 - 426
src/main/java/thyyxxk/wxservice_server/controller/api/PowersiMiPayPlugin.java

@@ -1,426 +1,426 @@
-package thyyxxk.wxservice_server.controller.api;
-
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.MediaType;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.client.RestTemplate;
-import thyyxxk.wxservice_server.config.auth.PassToken;
-import thyyxxk.wxservice_server.config.exception.ExceptionEnum;
-import thyyxxk.wxservice_server.config.properties.ApiAddr;
-import thyyxxk.wxservice_server.dao.api.PowersiPluginDao;
-import thyyxxk.wxservice_server.entity.ResultVo;
-import thyyxxk.wxservice_server.entity.assessment.PushQuestionnaireVisit;
-import thyyxxk.wxservice_server.entity.medinsmobilepay.InsuinfoRequest;
-import thyyxxk.wxservice_server.entity.medinsmobilepay.frompowersiplugin.OrdState;
-import thyyxxk.wxservice_server.entity.medinsmobilepay.frompowersiplugin.request.CommonRequest;
-import thyyxxk.wxservice_server.entity.medinsmobilepay.frompowersiplugin.request.OrderQueryRequest;
-import thyyxxk.wxservice_server.entity.medinsmobilepay.frompowersiplugin.request.PowersiMipSetlinfo;
-import thyyxxk.wxservice_server.entity.medinsmobilepay.frompowersiplugin.request.RevokeSettleRequest;
-import thyyxxk.wxservice_server.entity.medinsmobilepay.frompowersiplugin.response.BillInfo;
-import thyyxxk.wxservice_server.entity.medinsmobilepay.frompowersiplugin.response.CommonResponse;
-import thyyxxk.wxservice_server.entity.medinsmobilepay.frompowersiplugin.response.Upload6201;
-import thyyxxk.wxservice_server.factory.thmz.ThmzService;
-import thyyxxk.wxservice_server.factory.thmz.model.QueryReceiptRequest;
-import thyyxxk.wxservice_server.factory.thmz.model.SaveMzPayRequest;
-import thyyxxk.wxservice_server.service.IdCardAnalyzeService;
-import thyyxxk.wxservice_server.service.PushWxMessageService;
-import thyyxxk.wxservice_server.utils.*;
-import thyyxxk.wxservice_server.utils.mip.DataHandler;
-
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.util.*;
-
-@Slf4j
-@RestController
-@RequestMapping("/api/mobilePayPlugin")
-public class PowersiMiPayPlugin {
-    private final PowersiPluginDao dao;
-    private final IdCardAnalyzeService idCardAnalyzeService;
-    private final ThmzService thmzService;
-    private final PushWxMessageService messageService;
-    private final RestTemplate template;
-    private final String hisMipApi;
-
-    private final DataHandler dataHandler = DataHandler.newInstance();
-
-    @Autowired
-    public PowersiMiPayPlugin(PowersiPluginDao dao, IdCardAnalyzeService idCardAnalyzeService, ThmzService thmzService, PushWxMessageService messageService, RestTemplate template, ApiAddr apiAddr) throws IOException {
-        this.dao = dao;
-        this.idCardAnalyzeService = idCardAnalyzeService;
-        this.thmzService = thmzService;
-        this.messageService = messageService;
-        this.template = template;
-        this.hisMipApi = apiAddr.getHisMipApi();
-    }
-
-    @PostMapping("/lockOrder")
-    public ResultVo<String> lockOrder(@RequestBody InsuinfoRequest request) {
-        String openid = TokenUtil.getInstance().getUserOpenid();
-        dao.lockOrder(request.getHisOrdNum(), openid,1);
-        return ResultVoUtil.success(openid);
-    }
-
-    @PostMapping("/lockYbOrder")
-    public ResultVo<String> lockYbOrder(@RequestBody InsuinfoRequest request) {
-        String openid = TokenUtil.getInstance().getUserOpenid();
-        dao.lockYbOrder(request.getHisOrdNum(), openid,1);
-        return ResultVoUtil.success(openid);
-    }
-
-    @PostMapping("/unlockOrder")
-    public ResultVo<String> unlockOrder(@RequestBody InsuinfoRequest request) {
-        dao.unlockOrder(request.getHisOrdNum(), null);
-        return ResultVoUtil.success("操作成功。");
-    }
-
-    private JSONObject decryptRequest(JSONObject body) throws Exception {
-        body.put("code", 0);
-        JSONObject decrypt = dataHandler.processRspData(body.toJSONString());
-        return decrypt.getJSONObject("data");
-    }
-
-    @PassToken
-    @PostMapping("/patientInquiry")
-    public CommonResponse patientInquiry(@RequestBody JSONObject body) throws Exception {
-        JSONObject request = decryptRequest(body);
-        List<String> patNos = dao.selectPatientCount(request.getString("idNo"));
-        if (patNos.isEmpty()) {
-            return new CommonResponse("未查询到建档信息。");
-        }
-        return new CommonResponse();
-    }
-
-    @PassToken
-    @PostMapping("/patientCreate")
-    public CommonResponse patientCreate(@RequestBody JSONObject body) throws Exception {
-        JSONObject request = decryptRequest(body);
-        return idCardAnalyzeService.createCardFromPowersiPlugin(request);
-    }
-
-    @PassToken
-    @PostMapping("/billListInquiry")
-    public JSONObject billListInquiry(@RequestBody JSONObject body) throws Exception {
-        JSONObject request = decryptRequest(body);
-        List<String> patNoList = dao.selectPatientCount(request.getString("idNo"));
-        if (patNoList.isEmpty()) {
-            JSONObject res = new JSONObject();
-            res.put("code", -1);
-            res.put("success", false);
-            res.put("message", "没有患者的建档信息。");
-            return res;
-        }
-        List<BillInfo> list = new ArrayList<>();
-        for (String patNo : patNoList) {
-            QueryReceiptRequest receiptRequest =
-                    QueryReceiptRequest.builder().patCardNo(patNo).build();
-            ResultVo<List<Map<String, Object>>> vo =
-                    thmzService.getMzChargeDetailForUnPaid(receiptRequest);
-            if (vo.getCode() != ExceptionEnum.SUCCESS.getCode()) {
-                continue;
-            }
-            List<Map<String, Object>> feeList = vo.getData();
-            for (Map<String, Object> billItem : feeList) {
-                BillInfo billInfo = new BillInfo(billItem);
-                if (billInfo.getVipFlag() != 0) {
-                    continue;
-                }
-                billInfo.setIdNo(request.getString("idNo"));
-                billInfo.setIdType(request.getString("idType"));
-                billInfo.setDeptId(dao.selectDeptId(billInfo.getDeptName()));
-                list.add(billInfo);
-            }
-        }
-        if (list.isEmpty()) {
-            JSONObject res = new JSONObject();
-            res.put("code", -1);
-            res.put("success", false);
-            res.put("message", "没有患者的待缴费信息。");
-            return res;
-        }
-        String listRef = JSONArray.toJSONString(list);
-        JSONObject temp = new JSONObject();
-        temp.put("billInfo", JSONArray.parseArray(listRef));
-        String raw = dataHandler.buildReqData(temp);
-        JSONObject response = JSONObject.parseObject(raw);
-        response.put("code", 0);
-        response.put("success", true);
-        response.put("message", "OK");
-        return response;
-    }
-
-    @PassToken
-    @PostMapping("/billDetailInquiry")
-    public JSONObject billDetailInquiry(@RequestBody JSONObject body) throws Exception {
-        JSONObject request = decryptRequest(body);
-        String bizId = request.getString("bizId");
-        bizId = null == bizId ? "" : bizId;
-        String[] arr = bizId.split("_");
-        if (arr.length != 3) {
-            JSONObject res = new JSONObject();
-            res.put("code", -1);
-            res.put("success", false);
-            res.put("message", "bizId[" + bizId + "]不正确!");
-            return res;
-        }
-
-        request.put("patNo", arr[0]);
-        request.put("times", Integer.parseInt(arr[1]));
-        Upload6201 upload6201 = template.postForObject(hisMipApi + "/getUpload6201", request, Upload6201.class);
-        if (null == upload6201) {
-            JSONObject res = new JSONObject();
-            res.put("code", -1);
-            res.put("success", false);
-            res.put("message", "网络异常,请稍后再试。");
-            return res;
-        }
-        upload6201.setIdNo(request.getString("idNo"));
-        upload6201.setIdType(request.getString("idType"));
-        upload6201.setUserName(request.getString("userName"));
-
-        String raw = dataHandler.buildReqData(JSONObject.toJSONString(upload6201));
-        JSONObject response = JSONObject.parseObject(raw);
-        response.put("code", 0);
-        response.put("success", true);
-        response.put("message", "OK");
-        return response;
-    }
-
-    @PassToken
-    @PostMapping("/settleNotify")
-    public CommonResponse settleNotify(@RequestBody JSONObject body) throws Exception {
-        JSONObject request = decryptRequest(body);
-        PowersiMipSetlinfo setlinfo = dao.selectById(request.getString("platformOrderId"));
-        if (null == setlinfo) {
-            setlinfo = JSONObject.parseObject(request.toJSONString(), PowersiMipSetlinfo.class);
-            JSONObject hiExtData = request.getJSONObject("hiExtData");
-            if (null != hiExtData) {
-                JSONObject clrObj = hiExtData.getJSONObject("setlinfo");
-                if (null != clrObj) {
-                    String clrOptins = clrObj.getString("clrOptins");
-                    String clrType = clrObj.getString("clrType");
-                    setlinfo.setClrOptins(clrOptins);
-                    setlinfo.setClrType(clrType);
-                }
-            }
-            int insert = dao.insert(setlinfo);
-            if (insert == 1) {
-                saveMzOrder(setlinfo);
-                return new CommonResponse();
-            }
-            return new CommonResponse("HIS业务处理失败。");
-        }
-        if (setlinfo.getMzSaved() == 0) {
-            saveMzOrder(setlinfo);
-            return new CommonResponse();
-        }
-        return new CommonResponse();
-    }
-
-    private void saveMzOrder(PowersiMipSetlinfo setlinfo) {
-        SaveMzPayRequest saveMzPayRequest = new SaveMzPayRequest.Builder()
-                .payTime(DateUtil.formatDatetime(setlinfo.getTraceTime()))
-                .patCardNo(setlinfo.getMedOrgOrd().split("_")[0])
-                .agtOrdNum(setlinfo.getThirdOrderId())
-                .payAmt(setlinfo.getFeeSumamt())
-                .fundpayAmt(setlinfo.getFundPay())
-                .acctpayAmt(setlinfo.getPsnAcctPay())
-                .couponAmt(BigDecimal.ZERO)
-                .cashpayAmt(setlinfo.getOwnpayAmt())
-                .hisOrdNum(setlinfo.getMedOrgOrd())
-                .psOrdNum(setlinfo.getPlatformOrderId())
-                .isNormalClinic(true).build();
-        ResultVo<String> res = thmzService.saveMzPay(saveMzPayRequest);
-        if (res.getCode() == ExceptionEnum.SUCCESS.getCode()) {
-            dao.updateMzSaved(setlinfo.getPlatformOrderId());
-        }
-        pushMessage(setlinfo.getMedOrgOrd(), setlinfo.getUserName());
-    }
-
-    private void pushMessage(String hisOrdNum, String userName) {
-        String[] arr = hisOrdNum.split("_");
-        int times = Integer.parseInt(arr[1]);
-        PushQuestionnaireVisit visit = dao.getVisit(arr[0], times, hisOrdNum);
-        String visitId = hisOrdNum.replaceAll("_", "AND") + "AND" + visit.getDoctorCode() + "AND" + visit.getDeptCode();
-        String url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxbde6b16acad84204&redirect_uri=" +
-                "https://staticweb.hnthyy.cn/wxserver/redirect/page2?to=doctorGradeByPush_" + visitId +
-                "&response_type=code&scope=snsapi_base&state=1#wechat_redirect";
-
-        String msgContent = "{\"touser\":\"" + visit.getOpenid() + "\",\"data\":" +
-                "{\"keyword1\":{\"color\":\"#173177\",\"value\":\"" + userName + "\"}," +
-                "\"keyword2\":{\"color\":\"#173177\",\"value\":\"沭阳铭和医院\"}," +
-                "\"keyword3\":{\"color\":\"#173177\",\"value\":\"" + visit.getDeptName() + "\"}," +
-                "\"keyword4\":{\"color\":\"#173177\",\"value\":\"" + visit.getDoctorName() + "\"}," +
-                "\"keyword5\":{\"color\":\"#173177\",\"value\":\"" + visit.getVisitDate() + "\"}," +
-                "\"remark\":{\"color\":\"#FF0000\",\"value\":\"特邀请您对医生服务作出评价。\"}," +
-                "\"first\":{\"color\":\"#FF0000\",\"value\":\"您曾在我院进行诊疗。\"}}," +
-                "\"template_id\":\"G4YAN56RmDjEPpNyP5fpCdr5TghyqspDeWlWaD5Eg2o\"," +
-                "\"url\":\"" + url + "\"}";
-        JSONObject message = JSONObject.parseObject(msgContent);
-        messageService.pushMessage2(message);
-    }
-
-    @PassToken
-    @GetMapping("/isMipOrder")
-    public ResultVo<String> isMipOrder(@RequestParam("hisOrdNum") String hisOrdNum) throws Exception {
-        PowersiMipSetlinfo setlinfo = getSetlinfo(hisOrdNum, null);
-        if (null == setlinfo) {
-            return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST);
-        }
-        return ResultVoUtil.success(setlinfo.getPlatformOrderId());
-    }
-
-    @PassToken
-    @GetMapping("/settleQuery")
-    public JSONObject settleQuery(@RequestParam("hisOrdNum") String hisOrdNum) throws Exception {
-        String patientId = hisOrdNum.split("_")[0];
-        OrderQueryRequest request = dao.getMzPatient(patientId);
-        request.setMedOrgOrd(hisOrdNum);
-
-        JSONObject raw = JSONObject.parseObject(JSONObject.toJSONString(request));
-        String body = dataHandler.buildReqData(raw);
-        String url = "http://webhis.thyy.cn:8077/powersiMipSettleQuery";
-        HttpHeaders headers = new HttpHeaders();
-        headers.setContentType(MediaType.APPLICATION_JSON);
-        HttpEntity<String> entity = new HttpEntity<>(body, headers);
-        String encRes = template.postForObject(url, entity, String.class);
-        return dataHandler.processRspData(encRes);
-    }
-
-    @PassToken
-    @PostMapping("/downloadBillData")
-    public void powersiMipDownloadBillData() {
-
-    }
-
-    @PassToken
-    @PostMapping("/revokeMipSettle")
-    public ResultVo<String> revokeMipSettle(@RequestBody CommonRequest request) throws Exception {
-        PowersiMipSetlinfo setlinfo = getRefundableSetl(request.getHisOrdNum());
-        if (null == setlinfo) {
-            setlinfo = getSetlinfo(request.getHisOrdNum(), OrdState.REFUND_SUCCEED);
-            if (null != setlinfo) {
-                return ResultVoUtil.success("医保移动支付退款成功");
-            }
-            return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "没有可以退款的结算交易。");
-        }
-        Date now = new Date();
-        RevokeSettleRequest refd = new RevokeSettleRequest();
-        if (StringUtil.notBlank(request.getRefdType())) {
-            refd.setRefdType(request.getRefdType());
-        }
-        refd.setMedOrgOrd(request.getHisOrdNum());
-        refd.setMedRefdId(SnowFlakeId.instance().nextId());
-        refd.setRefdTime(DateUtil.formatDatetime(now));
-        refd.setTotlRefdAmt(setlinfo.getFeeSumamt());
-        refd.setPsnAcctRefdAmt(setlinfo.getPsnAcctPay());
-        refd.setFundRefdAmt(setlinfo.getFundPay());
-        refd.setCashRefdAmt(setlinfo.getOwnpayAmt());
-        refd.setRefdReason(request.getRefundReason());
-        refd.setEcToken(request.getEcToken());
-        refd.setPlatformOrderId(setlinfo.getPlatformOrderId());
-        dao.updateMedRedfId(refd.getMedRefdId(), refd.getMedOrgOrd());
-        JSONObject raw = JSONObject.parseObject(JSONObject.toJSONString(refd));
-        String body = dataHandler.buildReqData(raw);
-        String url = "http://webhis.thyy.cn:8077/powersiMipRefund";
-        HttpHeaders headers = new HttpHeaders();
-        headers.setContentType(MediaType.APPLICATION_JSON);
-        HttpEntity<String> entity = new HttpEntity<>(body, headers);
-        String encRes = template.postForObject(url, entity, String.class);
-        JSONObject decRes = dataHandler.processRspData(encRes);
-        Integer code = decRes.getInteger("code");
-        if (null != code && code == 0) {
-            JSONObject data = decRes.getJSONObject("data");
-            OrdState state = OrdState.get(data.getString("refStatus"));
-            if (null == state) {
-                return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
-            }
-            String refId = data.getString("platformRefdId");
-            dao.updateRevokeInfo(request.getStaffId(), now, refId, setlinfo.getMedOrgOrd(), state);
-            if (state == OrdState.REFUND_SUCCEED) {
-                return ResultVoUtil.success("医保移动支付退款成功");
-            }
-            if (state == OrdState.REFUND_PROCEEDING) {
-                return ResultVoUtil.success("医保移动支付退款进行中,请稍后查询退款结果。");
-            }
-            if (state == OrdState.REFUND_ABNORMAL) {
-                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医保移动支付退款异常,请稍后查询退款结果。");
-            }
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, data.getString("failMsg"));
-        }
-        return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, decRes.getString("message"));
-    }
-
-    private PowersiMipSetlinfo getRefundableSetl(String id) {
-        PowersiMipSetlinfo setlinfo = getSetlinfo(id, OrdState.SETTLED);
-        if (null == setlinfo) {
-            setlinfo = getSetlinfo(id, OrdState.REFUND_FAILED);
-            if (null == setlinfo) {
-                setlinfo = getSetlinfo(id, OrdState.REFUND_ABNORMAL);
-            }
-        }
-        return setlinfo;
-    }
-
-    private PowersiMipSetlinfo getSetlinfo(String id, OrdState state) {
-        QueryWrapper<PowersiMipSetlinfo> wrapper = new QueryWrapper<>();
-        wrapper.eq("med_org_ord", id);
-        if (null == state) {
-            List<PowersiMipSetlinfo> list = dao.selectList(wrapper);
-            if (list == null || list.isEmpty()) {
-                return null;
-            }
-            return list.get(0);
-        }
-        wrapper.eq("ord_state", state);
-        return dao.selectOne(wrapper);
-    }
-
-    @PassToken
-    @GetMapping("/queryRefundState")
-    public ResultVo<String> queryRefundState(@RequestParam("hisOrdNum") String hisOrdNum) throws Exception {
-        QueryWrapper<PowersiMipSetlinfo> wrapper = new QueryWrapper<>();
-        wrapper.eq("med_org_ord", hisOrdNum);
-        PowersiMipSetlinfo setlinfo = dao.selectOne(wrapper);
-        if (null == setlinfo) {
-            return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST);
-        }
-        if (setlinfo.getOrdState() == OrdState.REFUND_SUCCEED) {
-            return ResultVoUtil.success(OrdState.REFUND_SUCCEED.toString());
-        }
-        JSONObject params = new JSONObject();
-        if (StringUtil.notBlank(setlinfo.getPlatformRefdId())) {
-            params.put("platformRefdId", setlinfo.getPlatformRefdId());
-        } else {
-            params.put("medRefdId", setlinfo.getMedRefdId());
-        }
-        params.put("orgCodg", "H43010500370");
-        JSONObject raw = JSONObject.parseObject(JSONObject.toJSONString(params));
-        String body = dataHandler.buildReqData(raw);
-        String url = "http://webhis.thyy.cn:8077/powersiMipRefundQuery";
-        HttpHeaders headers = new HttpHeaders();
-        headers.setContentType(MediaType.APPLICATION_JSON);
-        HttpEntity<String> entity = new HttpEntity<>(body, headers);
-        String encRes = template.postForObject(url, entity, String.class);
-        JSONObject decRes = dataHandler.processRspData(encRes);
-        Integer code = decRes.getInteger("code");
-        if (null != code && code == 0) {
-            JSONObject data = decRes.getJSONObject("data");
-            data.remove("hiExtData");
-            OrdState state = OrdState.get(data.getString("refdStatus"));
-            if (null == state) {
-                return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
-            }
-            String refId = data.getString("platformRefdId");
-            dao.updateRefundState(refId, state, hisOrdNum);
-            return ResultVoUtil.success(state.toString());
-        }
-        return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, decRes.getString("message"));
-    }
-}
+//package thyyxxk.wxservice_server.controller.api;
+//
+//import com.alibaba.fastjson.JSONArray;
+//import com.alibaba.fastjson.JSONObject;
+//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+//import lombok.extern.slf4j.Slf4j;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.http.HttpEntity;
+//import org.springframework.http.HttpHeaders;
+//import org.springframework.http.MediaType;
+//import org.springframework.web.bind.annotation.*;
+//import org.springframework.web.client.RestTemplate;
+//import thyyxxk.wxservice_server.config.auth.PassToken;
+//import thyyxxk.wxservice_server.config.exception.ExceptionEnum;
+//import thyyxxk.wxservice_server.config.properties.ApiAddr;
+//import thyyxxk.wxservice_server.dao.api.PowersiPluginDao;
+//import thyyxxk.wxservice_server.entity.ResultVo;
+//import thyyxxk.wxservice_server.entity.assessment.PushQuestionnaireVisit;
+//import thyyxxk.wxservice_server.entity.medinsmobilepay.InsuinfoRequest;
+//import thyyxxk.wxservice_server.entity.medinsmobilepay.frompowersiplugin.OrdState;
+//import thyyxxk.wxservice_server.entity.medinsmobilepay.frompowersiplugin.request.CommonRequest;
+//import thyyxxk.wxservice_server.entity.medinsmobilepay.frompowersiplugin.request.OrderQueryRequest;
+//import thyyxxk.wxservice_server.entity.medinsmobilepay.frompowersiplugin.request.PowersiMipSetlinfo;
+//import thyyxxk.wxservice_server.entity.medinsmobilepay.frompowersiplugin.request.RevokeSettleRequest;
+//import thyyxxk.wxservice_server.entity.medinsmobilepay.frompowersiplugin.response.BillInfo;
+//import thyyxxk.wxservice_server.entity.medinsmobilepay.frompowersiplugin.response.CommonResponse;
+//import thyyxxk.wxservice_server.entity.medinsmobilepay.frompowersiplugin.response.Upload6201;
+//import thyyxxk.wxservice_server.factory.thmz.ThmzService;
+//import thyyxxk.wxservice_server.factory.thmz.model.QueryReceiptRequest;
+//import thyyxxk.wxservice_server.factory.thmz.model.SaveMzPayRequest;
+//import thyyxxk.wxservice_server.service.IdCardAnalyzeService;
+//import thyyxxk.wxservice_server.service.PushWxMessageService;
+//import thyyxxk.wxservice_server.utils.*;
+//import thyyxxk.wxservice_server.utils.mip.DataHandler;
+//
+//import java.io.IOException;
+//import java.math.BigDecimal;
+//import java.util.*;
+//
+//@Slf4j
+//@RestController
+//@RequestMapping("/api/mobilePayPlugin")
+//public class PowersiMiPayPlugin {
+//    private final PowersiPluginDao dao;
+//    private final IdCardAnalyzeService idCardAnalyzeService;
+//    private final ThmzService thmzService;
+//    private final PushWxMessageService messageService;
+//    private final RestTemplate template;
+//    private final String hisMipApi;
+//
+//    private final DataHandler dataHandler = DataHandler.newInstance();
+//
+//    @Autowired
+//    public PowersiMiPayPlugin(PowersiPluginDao dao, IdCardAnalyzeService idCardAnalyzeService, ThmzService thmzService, PushWxMessageService messageService, RestTemplate template, ApiAddr apiAddr) throws IOException {
+//        this.dao = dao;
+//        this.idCardAnalyzeService = idCardAnalyzeService;
+//        this.thmzService = thmzService;
+//        this.messageService = messageService;
+//        this.template = template;
+//        this.hisMipApi = apiAddr.getHisMipApi();
+//    }
+//
+//    @PostMapping("/lockOrder")
+//    public ResultVo<String> lockOrder(@RequestBody InsuinfoRequest request) {
+//        String openid = TokenUtil.getInstance().getUserOpenid();
+//        dao.lockOrder(request.getHisOrdNum(), openid,1);
+//        return ResultVoUtil.success(openid);
+//    }
+//
+//    @PostMapping("/lockYbOrder")
+//    public ResultVo<String> lockYbOrder(@RequestBody InsuinfoRequest request) {
+//        String openid = TokenUtil.getInstance().getUserOpenid();
+//        dao.lockYbOrder(request.getHisOrdNum(), openid,1);
+//        return ResultVoUtil.success(openid);
+//    }
+//
+//    @PostMapping("/unlockOrder")
+//    public ResultVo<String> unlockOrder(@RequestBody InsuinfoRequest request) {
+//        dao.unlockOrder(request.getHisOrdNum(), null);
+//        return ResultVoUtil.success("操作成功。");
+//    }
+//
+//    private JSONObject decryptRequest(JSONObject body) throws Exception {
+//        body.put("code", 0);
+//        JSONObject decrypt = dataHandler.processRspData(body.toJSONString());
+//        return decrypt.getJSONObject("data");
+//    }
+//
+//    @PassToken
+//    @PostMapping("/patientInquiry")
+//    public CommonResponse patientInquiry(@RequestBody JSONObject body) throws Exception {
+//        JSONObject request = decryptRequest(body);
+//        List<String> patNos = dao.selectPatientCount(request.getString("idNo"));
+//        if (patNos.isEmpty()) {
+//            return new CommonResponse("未查询到建档信息。");
+//        }
+//        return new CommonResponse();
+//    }
+//
+//    @PassToken
+//    @PostMapping("/patientCreate")
+//    public CommonResponse patientCreate(@RequestBody JSONObject body) throws Exception {
+//        JSONObject request = decryptRequest(body);
+//        return idCardAnalyzeService.createCardFromPowersiPlugin(request);
+//    }
+//
+//    @PassToken
+//    @PostMapping("/billListInquiry")
+//    public JSONObject billListInquiry(@RequestBody JSONObject body) throws Exception {
+//        JSONObject request = decryptRequest(body);
+//        List<String> patNoList = dao.selectPatientCount(request.getString("idNo"));
+//        if (patNoList.isEmpty()) {
+//            JSONObject res = new JSONObject();
+//            res.put("code", -1);
+//            res.put("success", false);
+//            res.put("message", "没有患者的建档信息。");
+//            return res;
+//        }
+//        List<BillInfo> list = new ArrayList<>();
+//        for (String patNo : patNoList) {
+//            QueryReceiptRequest receiptRequest =
+//                    QueryReceiptRequest.builder().patCardNo(patNo).build();
+//            ResultVo<List<Map<String, Object>>> vo =
+//                    thmzService.getMzChargeDetailForUnPaid(receiptRequest);
+//            if (vo.getCode() != ExceptionEnum.SUCCESS.getCode()) {
+//                continue;
+//            }
+//            List<Map<String, Object>> feeList = vo.getData();
+//            for (Map<String, Object> billItem : feeList) {
+//                BillInfo billInfo = new BillInfo(billItem);
+//                if (billInfo.getVipFlag() != 0) {
+//                    continue;
+//                }
+//                billInfo.setIdNo(request.getString("idNo"));
+//                billInfo.setIdType(request.getString("idType"));
+//                billInfo.setDeptId(dao.selectDeptId(billInfo.getDeptName()));
+//                list.add(billInfo);
+//            }
+//        }
+//        if (list.isEmpty()) {
+//            JSONObject res = new JSONObject();
+//            res.put("code", -1);
+//            res.put("success", false);
+//            res.put("message", "没有患者的待缴费信息。");
+//            return res;
+//        }
+//        String listRef = JSONArray.toJSONString(list);
+//        JSONObject temp = new JSONObject();
+//        temp.put("billInfo", JSONArray.parseArray(listRef));
+//        String raw = dataHandler.buildReqData(temp);
+//        JSONObject response = JSONObject.parseObject(raw);
+//        response.put("code", 0);
+//        response.put("success", true);
+//        response.put("message", "OK");
+//        return response;
+//    }
+//
+//    @PassToken
+//    @PostMapping("/billDetailInquiry")
+//    public JSONObject billDetailInquiry(@RequestBody JSONObject body) throws Exception {
+//        JSONObject request = decryptRequest(body);
+//        String bizId = request.getString("bizId");
+//        bizId = null == bizId ? "" : bizId;
+//        String[] arr = bizId.split("_");
+//        if (arr.length != 3) {
+//            JSONObject res = new JSONObject();
+//            res.put("code", -1);
+//            res.put("success", false);
+//            res.put("message", "bizId[" + bizId + "]不正确!");
+//            return res;
+//        }
+//
+//        request.put("patNo", arr[0]);
+//        request.put("times", Integer.parseInt(arr[1]));
+//        Upload6201 upload6201 = template.postForObject(hisMipApi + "/getUpload6201", request, Upload6201.class);
+//        if (null == upload6201) {
+//            JSONObject res = new JSONObject();
+//            res.put("code", -1);
+//            res.put("success", false);
+//            res.put("message", "网络异常,请稍后再试。");
+//            return res;
+//        }
+//        upload6201.setIdNo(request.getString("idNo"));
+//        upload6201.setIdType(request.getString("idType"));
+//        upload6201.setUserName(request.getString("userName"));
+//
+//        String raw = dataHandler.buildReqData(JSONObject.toJSONString(upload6201));
+//        JSONObject response = JSONObject.parseObject(raw);
+//        response.put("code", 0);
+//        response.put("success", true);
+//        response.put("message", "OK");
+//        return response;
+//    }
+//
+//    @PassToken
+//    @PostMapping("/settleNotify")
+//    public CommonResponse settleNotify(@RequestBody JSONObject body) throws Exception {
+//        JSONObject request = decryptRequest(body);
+//        PowersiMipSetlinfo setlinfo = dao.selectById(request.getString("platformOrderId"));
+//        if (null == setlinfo) {
+//            setlinfo = JSONObject.parseObject(request.toJSONString(), PowersiMipSetlinfo.class);
+//            JSONObject hiExtData = request.getJSONObject("hiExtData");
+//            if (null != hiExtData) {
+//                JSONObject clrObj = hiExtData.getJSONObject("setlinfo");
+//                if (null != clrObj) {
+//                    String clrOptins = clrObj.getString("clrOptins");
+//                    String clrType = clrObj.getString("clrType");
+//                    setlinfo.setClrOptins(clrOptins);
+//                    setlinfo.setClrType(clrType);
+//                }
+//            }
+//            int insert = dao.insert(setlinfo);
+//            if (insert == 1) {
+//                saveMzOrder(setlinfo);
+//                return new CommonResponse();
+//            }
+//            return new CommonResponse("HIS业务处理失败。");
+//        }
+//        if (setlinfo.getMzSaved() == 0) {
+//            saveMzOrder(setlinfo);
+//            return new CommonResponse();
+//        }
+//        return new CommonResponse();
+//    }
+//
+//    private void saveMzOrder(PowersiMipSetlinfo setlinfo) {
+//        SaveMzPayRequest saveMzPayRequest = new SaveMzPayRequest.Builder()
+//                .payTime(DateUtil.formatDatetime(setlinfo.getTraceTime()))
+//                .patCardNo(setlinfo.getMedOrgOrd().split("_")[0])
+//                .agtOrdNum(setlinfo.getThirdOrderId())
+//                .payAmt(setlinfo.getFeeSumamt())
+//                .fundpayAmt(setlinfo.getFundPay())
+//                .acctpayAmt(setlinfo.getPsnAcctPay())
+//                .couponAmt(BigDecimal.ZERO)
+//                .cashpayAmt(setlinfo.getOwnpayAmt())
+//                .hisOrdNum(setlinfo.getMedOrgOrd())
+//                .psOrdNum(setlinfo.getPlatformOrderId())
+//                .isNormalClinic(true).build();
+//        ResultVo<String> res = thmzService.saveMzPay(saveMzPayRequest);
+//        if (res.getCode() == ExceptionEnum.SUCCESS.getCode()) {
+//            dao.updateMzSaved(setlinfo.getPlatformOrderId());
+//        }
+//        pushMessage(setlinfo.getMedOrgOrd(), setlinfo.getUserName());
+//    }
+//
+//    private void pushMessage(String hisOrdNum, String userName) {
+//        String[] arr = hisOrdNum.split("_");
+//        int times = Integer.parseInt(arr[1]);
+//        PushQuestionnaireVisit visit = dao.getVisit(arr[0], times, hisOrdNum);
+//        String visitId = hisOrdNum.replaceAll("_", "AND") + "AND" + visit.getDoctorCode() + "AND" + visit.getDeptCode();
+//        String url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxbde6b16acad84204&redirect_uri=" +
+//                "https://staticweb.hnthyy.cn/wxserver/redirect/page2?to=doctorGradeByPush_" + visitId +
+//                "&response_type=code&scope=snsapi_base&state=1#wechat_redirect";
+//
+//        String msgContent = "{\"touser\":\"" + visit.getOpenid() + "\",\"data\":" +
+//                "{\"keyword1\":{\"color\":\"#173177\",\"value\":\"" + userName + "\"}," +
+//                "\"keyword2\":{\"color\":\"#173177\",\"value\":\"沭阳铭和医院\"}," +
+//                "\"keyword3\":{\"color\":\"#173177\",\"value\":\"" + visit.getDeptName() + "\"}," +
+//                "\"keyword4\":{\"color\":\"#173177\",\"value\":\"" + visit.getDoctorName() + "\"}," +
+//                "\"keyword5\":{\"color\":\"#173177\",\"value\":\"" + visit.getVisitDate() + "\"}," +
+//                "\"remark\":{\"color\":\"#FF0000\",\"value\":\"特邀请您对医生服务作出评价。\"}," +
+//                "\"first\":{\"color\":\"#FF0000\",\"value\":\"您曾在我院进行诊疗。\"}}," +
+//                "\"template_id\":\"G4YAN56RmDjEPpNyP5fpCdr5TghyqspDeWlWaD5Eg2o\"," +
+//                "\"url\":\"" + url + "\"}";
+//        JSONObject message = JSONObject.parseObject(msgContent);
+//        messageService.pushMessage2(message);
+//    }
+//
+//    @PassToken
+//    @GetMapping("/isMipOrder")
+//    public ResultVo<String> isMipOrder(@RequestParam("hisOrdNum") String hisOrdNum) throws Exception {
+//        PowersiMipSetlinfo setlinfo = getSetlinfo(hisOrdNum, null);
+//        if (null == setlinfo) {
+//            return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST);
+//        }
+//        return ResultVoUtil.success(setlinfo.getPlatformOrderId());
+//    }
+//
+//    @PassToken
+//    @GetMapping("/settleQuery")
+//    public JSONObject settleQuery(@RequestParam("hisOrdNum") String hisOrdNum) throws Exception {
+//        String patientId = hisOrdNum.split("_")[0];
+//        OrderQueryRequest request = dao.getMzPatient(patientId);
+//        request.setMedOrgOrd(hisOrdNum);
+//
+//        JSONObject raw = JSONObject.parseObject(JSONObject.toJSONString(request));
+//        String body = dataHandler.buildReqData(raw);
+//        String url = "http://webhis.thyy.cn:8077/powersiMipSettleQuery";
+//        HttpHeaders headers = new HttpHeaders();
+//        headers.setContentType(MediaType.APPLICATION_JSON);
+//        HttpEntity<String> entity = new HttpEntity<>(body, headers);
+//        String encRes = template.postForObject(url, entity, String.class);
+//        return dataHandler.processRspData(encRes);
+//    }
+//
+//    @PassToken
+//    @PostMapping("/downloadBillData")
+//    public void powersiMipDownloadBillData() {
+//
+//    }
+//
+//    @PassToken
+//    @PostMapping("/revokeMipSettle")
+//    public ResultVo<String> revokeMipSettle(@RequestBody CommonRequest request) throws Exception {
+//        PowersiMipSetlinfo setlinfo = getRefundableSetl(request.getHisOrdNum());
+//        if (null == setlinfo) {
+//            setlinfo = getSetlinfo(request.getHisOrdNum(), OrdState.REFUND_SUCCEED);
+//            if (null != setlinfo) {
+//                return ResultVoUtil.success("医保移动支付退款成功");
+//            }
+//            return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "没有可以退款的结算交易。");
+//        }
+//        Date now = new Date();
+//        RevokeSettleRequest refd = new RevokeSettleRequest();
+//        if (StringUtil.notBlank(request.getRefdType())) {
+//            refd.setRefdType(request.getRefdType());
+//        }
+//        refd.setMedOrgOrd(request.getHisOrdNum());
+//        refd.setMedRefdId(SnowFlakeId.instance().nextId());
+//        refd.setRefdTime(DateUtil.formatDatetime(now));
+//        refd.setTotlRefdAmt(setlinfo.getFeeSumamt());
+//        refd.setPsnAcctRefdAmt(setlinfo.getPsnAcctPay());
+//        refd.setFundRefdAmt(setlinfo.getFundPay());
+//        refd.setCashRefdAmt(setlinfo.getOwnpayAmt());
+//        refd.setRefdReason(request.getRefundReason());
+//        refd.setEcToken(request.getEcToken());
+//        refd.setPlatformOrderId(setlinfo.getPlatformOrderId());
+//        dao.updateMedRedfId(refd.getMedRefdId(), refd.getMedOrgOrd());
+//        JSONObject raw = JSONObject.parseObject(JSONObject.toJSONString(refd));
+//        String body = dataHandler.buildReqData(raw);
+//        String url = "http://webhis.thyy.cn:8077/powersiMipRefund";
+//        HttpHeaders headers = new HttpHeaders();
+//        headers.setContentType(MediaType.APPLICATION_JSON);
+//        HttpEntity<String> entity = new HttpEntity<>(body, headers);
+//        String encRes = template.postForObject(url, entity, String.class);
+//        JSONObject decRes = dataHandler.processRspData(encRes);
+//        Integer code = decRes.getInteger("code");
+//        if (null != code && code == 0) {
+//            JSONObject data = decRes.getJSONObject("data");
+//            OrdState state = OrdState.get(data.getString("refStatus"));
+//            if (null == state) {
+//                return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
+//            }
+//            String refId = data.getString("platformRefdId");
+//            dao.updateRevokeInfo(request.getStaffId(), now, refId, setlinfo.getMedOrgOrd(), state);
+//            if (state == OrdState.REFUND_SUCCEED) {
+//                return ResultVoUtil.success("医保移动支付退款成功");
+//            }
+//            if (state == OrdState.REFUND_PROCEEDING) {
+//                return ResultVoUtil.success("医保移动支付退款进行中,请稍后查询退款结果。");
+//            }
+//            if (state == OrdState.REFUND_ABNORMAL) {
+//                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医保移动支付退款异常,请稍后查询退款结果。");
+//            }
+//            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, data.getString("failMsg"));
+//        }
+//        return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, decRes.getString("message"));
+//    }
+//
+//    private PowersiMipSetlinfo getRefundableSetl(String id) {
+//        PowersiMipSetlinfo setlinfo = getSetlinfo(id, OrdState.SETTLED);
+//        if (null == setlinfo) {
+//            setlinfo = getSetlinfo(id, OrdState.REFUND_FAILED);
+//            if (null == setlinfo) {
+//                setlinfo = getSetlinfo(id, OrdState.REFUND_ABNORMAL);
+//            }
+//        }
+//        return setlinfo;
+//    }
+//
+//    private PowersiMipSetlinfo getSetlinfo(String id, OrdState state) {
+//        QueryWrapper<PowersiMipSetlinfo> wrapper = new QueryWrapper<>();
+//        wrapper.eq("med_org_ord", id);
+//        if (null == state) {
+//            List<PowersiMipSetlinfo> list = dao.selectList(wrapper);
+//            if (list == null || list.isEmpty()) {
+//                return null;
+//            }
+//            return list.get(0);
+//        }
+//        wrapper.eq("ord_state", state);
+//        return dao.selectOne(wrapper);
+//    }
+//
+//    @PassToken
+//    @GetMapping("/queryRefundState")
+//    public ResultVo<String> queryRefundState(@RequestParam("hisOrdNum") String hisOrdNum) throws Exception {
+//        QueryWrapper<PowersiMipSetlinfo> wrapper = new QueryWrapper<>();
+//        wrapper.eq("med_org_ord", hisOrdNum);
+//        PowersiMipSetlinfo setlinfo = dao.selectOne(wrapper);
+//        if (null == setlinfo) {
+//            return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST);
+//        }
+//        if (setlinfo.getOrdState() == OrdState.REFUND_SUCCEED) {
+//            return ResultVoUtil.success(OrdState.REFUND_SUCCEED.toString());
+//        }
+//        JSONObject params = new JSONObject();
+//        if (StringUtil.notBlank(setlinfo.getPlatformRefdId())) {
+//            params.put("platformRefdId", setlinfo.getPlatformRefdId());
+//        } else {
+//            params.put("medRefdId", setlinfo.getMedRefdId());
+//        }
+//        params.put("orgCodg", "H43010500370");
+//        JSONObject raw = JSONObject.parseObject(JSONObject.toJSONString(params));
+//        String body = dataHandler.buildReqData(raw);
+//        String url = "http://webhis.thyy.cn:8077/powersiMipRefundQuery";
+//        HttpHeaders headers = new HttpHeaders();
+//        headers.setContentType(MediaType.APPLICATION_JSON);
+//        HttpEntity<String> entity = new HttpEntity<>(body, headers);
+//        String encRes = template.postForObject(url, entity, String.class);
+//        JSONObject decRes = dataHandler.processRspData(encRes);
+//        Integer code = decRes.getInteger("code");
+//        if (null != code && code == 0) {
+//            JSONObject data = decRes.getJSONObject("data");
+//            data.remove("hiExtData");
+//            OrdState state = OrdState.get(data.getString("refdStatus"));
+//            if (null == state) {
+//                return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
+//            }
+//            String refId = data.getString("platformRefdId");
+//            dao.updateRefundState(refId, state, hisOrdNum);
+//            return ResultVoUtil.success(state.toString());
+//        }
+//        return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, decRes.getString("message"));
+//    }
+//}

+ 63 - 63
src/main/java/thyyxxk/wxservice_server/dao/api/PowersiPluginDao.java

@@ -1,63 +1,63 @@
-package thyyxxk.wxservice_server.dao.api;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Select;
-import org.apache.ibatis.annotations.Update;
-import thyyxxk.wxservice_server.entity.assessment.PushQuestionnaireVisit;
-import thyyxxk.wxservice_server.entity.medinsmobilepay.frompowersiplugin.OrdState;
-import thyyxxk.wxservice_server.entity.medinsmobilepay.frompowersiplugin.request.OrderQueryRequest;
-import thyyxxk.wxservice_server.entity.medinsmobilepay.frompowersiplugin.request.PowersiMipSetlinfo;
-
-import java.util.Date;
-import java.util.List;
-
-@Mapper
-public interface PowersiPluginDao extends BaseMapper<PowersiMipSetlinfo> {
-
-    @Update("update mz_order_lock set lock_flag=#{flag},update_time=getdate(), " +
-            "openid=#{openid} where his_order_num=#{hisOrdNum}")
-    void lockOrder(String hisOrdNum, String openid, int flag);
-
-    @Update("update mz_order_lock set lock_flag=0,update_time=getdate(), " +
-            "openid=#{openid},ybzf=0 where his_order_num=#{hisOrdNum}")
-    void unlockOrder(String hisOrdNum, String openid);
-
-    @Update("update mz_order_lock set lock_flag=#{flag},update_time=getdate(), " +
-            "openid=#{openid},ybzf=1 where his_order_num=#{hisOrdNum}")
-    void lockYbOrder(String hisOrdNum, String openid, int flag);
-
-    @Select("select top 2 patient_id from mz_patient_mi where social_no=#{id} order by lv_date desc")
-    List<String> selectPatientCount(String id);
-
-    @Select("select top 1 rtrim(code) from zd_unit_code " +
-            "where name=#{name} and isnull(del_flag,'0')!='1'")
-    String selectDeptId(String name);
-
-    @Update("update powersi_mip_setlinfo set revoke_staff=#{staff}, " +
-            "revoke_datetime=#{time},platform_refd_id=#{refdId}, " +
-            "ord_state=#{state} where med_org_ord=#{id}")
-    void updateRevokeInfo(String staff, Date time, String refdId, String id, OrdState state);
-
-    @Update("update powersi_mip_setlinfo set med_refd_id=#{medRefdId} where med_org_ord=#{id}")
-    void updateMedRedfId(String medRefdId, String id);
-
-    @Update("update powersi_mip_setlinfo set ord_state=#{state}, " +
-            "platform_refd_id=#{refdId} where med_org_ord=#{hisOrdNum}")
-    void updateRefundState(String refdId, OrdState state, String hisOrdNum);
-
-    @Update("update powersi_mip_setlinfo set mz_saved=1 where platform_order_id=#{id}")
-    void updateMzSaved(String id);
-
-    @Select("select rtrim(social_no) as idNo,rtrim(name) as userName " +
-            "from mz_patient_mi where patient_id=#{patientId}")
-    OrderQueryRequest getMzPatient(String patientId);
-    
-    @Select("select b.openid,visit_date=convert(varchar(19),a.visit_date,21), " +
-            "deptName=(select rtrim(d.name) from zd_unit_code d where d.code=a.visit_dept_code), " +
-            "doctorName=(select rtrim(d.name) from a_employee_mi d where d.code=a.doctor_code), " +
-            "doctorCode=rtrim(a.doctor_code),deptCode=rtrim(a.visit_dept_code) " +
-            "from mz_visit_table a, mz_order_lock b " +
-            "where a.patient_id=#{patNo} and a.times=#{times} and b.his_order_num=#{hisOrdNum}")
-    PushQuestionnaireVisit getVisit(String patNo, int times, String hisOrdNum);
-}
+//package thyyxxk.wxservice_server.dao.api;
+//
+//import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+//import org.apache.ibatis.annotations.Mapper;
+//import org.apache.ibatis.annotations.Select;
+//import org.apache.ibatis.annotations.Update;
+//import thyyxxk.wxservice_server.entity.assessment.PushQuestionnaireVisit;
+//import thyyxxk.wxservice_server.entity.medinsmobilepay.frompowersiplugin.OrdState;
+//import thyyxxk.wxservice_server.entity.medinsmobilepay.frompowersiplugin.request.OrderQueryRequest;
+//import thyyxxk.wxservice_server.entity.medinsmobilepay.frompowersiplugin.request.PowersiMipSetlinfo;
+//
+//import java.util.Date;
+//import java.util.List;
+//
+//@Mapper
+//public interface PowersiPluginDao extends BaseMapper<PowersiMipSetlinfo> {
+//
+//    @Update("update mz_order_lock set lock_flag=#{flag},update_time=getdate(), " +
+//            "openid=#{openid} where his_order_num=#{hisOrdNum}")
+//    void lockOrder(String hisOrdNum, String openid, int flag);
+//
+//    @Update("update mz_order_lock set lock_flag=0,update_time=getdate(), " +
+//            "openid=#{openid},ybzf=0 where his_order_num=#{hisOrdNum}")
+//    void unlockOrder(String hisOrdNum, String openid);
+//
+//    @Update("update mz_order_lock set lock_flag=#{flag},update_time=getdate(), " +
+//            "openid=#{openid},ybzf=1 where his_order_num=#{hisOrdNum}")
+//    void lockYbOrder(String hisOrdNum, String openid, int flag);
+//
+//    @Select("select top 2 patient_id from mz_patient_mi where social_no=#{id} order by lv_date desc")
+//    List<String> selectPatientCount(String id);
+//
+//    @Select("select top 1 rtrim(code) from zd_unit_code " +
+//            "where name=#{name} and isnull(del_flag,'0')!='1'")
+//    String selectDeptId(String name);
+//
+//    @Update("update powersi_mip_setlinfo set revoke_staff=#{staff}, " +
+//            "revoke_datetime=#{time},platform_refd_id=#{refdId}, " +
+//            "ord_state=#{state} where med_org_ord=#{id}")
+//    void updateRevokeInfo(String staff, Date time, String refdId, String id, OrdState state);
+//
+//    @Update("update powersi_mip_setlinfo set med_refd_id=#{medRefdId} where med_org_ord=#{id}")
+//    void updateMedRedfId(String medRefdId, String id);
+//
+//    @Update("update powersi_mip_setlinfo set ord_state=#{state}, " +
+//            "platform_refd_id=#{refdId} where med_org_ord=#{hisOrdNum}")
+//    void updateRefundState(String refdId, OrdState state, String hisOrdNum);
+//
+//    @Update("update powersi_mip_setlinfo set mz_saved=1 where platform_order_id=#{id}")
+//    void updateMzSaved(String id);
+//
+//    @Select("select rtrim(social_no) as idNo,rtrim(name) as userName " +
+//            "from mz_patient_mi where patient_id=#{patientId}")
+//    OrderQueryRequest getMzPatient(String patientId);
+//
+//    @Select("select b.openid,visit_date=convert(varchar(19),a.visit_date,21), " +
+//            "deptName=(select rtrim(d.name) from zd_unit_code d where d.code=a.visit_dept_code), " +
+//            "doctorName=(select rtrim(d.name) from a_employee_mi d where d.code=a.doctor_code), " +
+//            "doctorCode=rtrim(a.doctor_code),deptCode=rtrim(a.visit_dept_code) " +
+//            "from mz_visit_table a, mz_order_lock b " +
+//            "where a.patient_id=#{patNo} and a.times=#{times} and b.his_order_num=#{hisOrdNum}")
+//    PushQuestionnaireVisit getVisit(String patNo, int times, String hisOrdNum);
+//}

+ 10 - 9
src/main/resources/application-8083.yml

@@ -8,9 +8,9 @@ spring:
   thymeleaf:
     cache: false
   datasource:
-    url: "jdbc:sqlserver://172.16.32.168:1433;databaseName=thxyhisdb"
+    url: "jdbc:sqlserver://130.150.161.71:1433;databaseName=hisdb"
     username: "sa"
-    password:
+    password: "Symhyy@123"
     driver-class-name: "com.microsoft.sqlserver.jdbc.SQLServerDriver"
     druid:
       initial-size: 40
@@ -37,12 +37,13 @@ spring:
     format:
       date: yyyy-MM-dd
       date-time: yyyy-MM-dd HH:mm:ss
+
 mybatis-plus:
   configuration:
     map-underscore-to-camel-case: true
 management:
   server:
-    port: 9091
+    port: 9092
   endpoints:
     web:
       base-path: /actuator
@@ -81,13 +82,13 @@ management:
 
 thyy:
   api-addr:
-    his-mip-api: http://172.16.32.166:1100/mobilePayApi
-    thmz-api: http://172.16.32.160:81/thmz
-    chronic-api: http://172.16.32.160:8077/chronicDisease
-    physical-check-api: http://172.16.32.183:8888/bdp/dataservice/api
-    add-face-api: http://172.16.32.167:20923/thyy/api/haikang/door/addFaceRecognition
+    his-mip-api: http://130.150.161.72:1100/mobilePayApi
+    thmz-api: http://130.150.161.72:8089/thmz
+    chronic-api: http://130.150.161.72:8077/chronicDisease
+    physical-check-api: http://130.150.161.72:8888/bdp/dataservice/api
+    add-face-api: http://130.150.161.72:20923/thyy/api/haikang/door/addFaceRecognition
   config:
-    dzfpdir: /home/dzfp
+    dzfpdir: D:\wx-business\files\dzfp
     dzfpurl: https://staticweb.hnthyy.cn/dzfp
 
 production: true

+ 8 - 8
src/main/resources/application-8085.yml

@@ -8,9 +8,9 @@ spring:
   thymeleaf:
     cache: false
   datasource:
-    url: "jdbc:sqlserver://172.16.32.168:1433;databaseName=thxyhisdb"
+    url: "jdbc:sqlserver://130.150.161.71:1433;databaseName=hisdb"
     username: "sa"
-    password:
+    password: "Symhyy@123"
     driver-class-name: "com.microsoft.sqlserver.jdbc.SQLServerDriver"
     druid:
       initial-size: 40
@@ -82,13 +82,13 @@ management:
 
 thyy:
   api-addr:
-    his-mip-api: http://172.16.32.166:1100/mobilePayApi
-    thmz-api: http://172.16.32.160:81/thmz
-    chronic-api: http://172.16.32.160:8077/chronicDisease
-    physical-check-api: http://172.16.32.183:8888/bdp/dataservice/api
-    add-face-api: http://172.16.32.167:20923/thyy/api/haikang/door/addFaceRecognition
+    his-mip-api: http://130.150.161.72:1100/mobilePayApi
+    thmz-api: http://130.150.161.72:8089/thmz
+    chronic-api: http://130.150.161.72:8077/chronicDisease
+    physical-check-api: http://130.150.161.72:8888/bdp/dataservice/api
+    add-face-api: http://130.150.161.72:20923/thyy/api/haikang/door/addFaceRecognition
   config:
-    dzfpdir: /home/dzfp
+    dzfpdir: D:\wx-business\files\dzfp
     dzfpurl: https://staticweb.hnthyy.cn/dzfp
 
 production: true

+ 49 - 10
src/main/resources/application-dev.yml

@@ -4,13 +4,13 @@ server:
     context-path: /wxserver
 spring:
   application:
-    name: wxservice-server-dev
+    name: wxservice-server
   thymeleaf:
     cache: false
   datasource:
-    url: "jdbc:sqlserver://172.16.32.179:1433;databaseName=thxyhisdb"
+    url: "jdbc:sqlserver://130.150.161.71:1433;databaseName=hisdb"
     username: "sa"
-    password:
+    password: "Symhyy@123"
     driver-class-name: "com.microsoft.sqlserver.jdbc.SQLServerDriver"
     druid:
       initial-size: 40
@@ -37,19 +37,58 @@ spring:
     format:
       date: yyyy-MM-dd
       date-time: yyyy-MM-dd HH:mm:ss
+
 mybatis-plus:
   configuration:
     map-underscore-to-camel-case: true
+management:
+  server:
+    port: 9092
+  endpoints:
+    web:
+      base-path: /actuator
+      exposure:
+        include: '*'
+  metrics:
+    export:
+      simple:
+        enabled: true
+      jmx:
+        enabled: true
+      prometheus:
+        enabled: true
+    distribution:
+      percentiles-histogram:
+        http:
+          server:
+            requests: false
+      minimum-expected-value:
+        http:
+          server:
+            requests: 20ms
+      maximum-expected-value:
+        http:
+          server:
+            requests: 200ms
+  endpoint:
+    metrics:
+      enabled: true
+    health:
+      show-details: always
+      probes:
+        enabled: true
+    prometheus:
+      enabled: true
 
 thyy:
   api-addr:
-    his-mip-api: http://172.16.30.26:1100/mobilePayApi
-    thmz-api: http://demo.hnthyy.cn:8089//thmz
-    chronic-api: http://172.16.32.160:8077/chronicDisease
-    physical-check-api: http://172.16.32.183:8888/bdp/dataservice/api
-    add-face-api: http://172.16.30.66:20923/thyy/api/haikang/door/addFaceRecognition
+    his-mip-api: http://130.150.161.72:1100/mobilePayApi
+    thmz-api: http://130.150.161.72:8089/thmz
+    chronic-api: http://130.150.161.72:8077/chronicDisease
+    physical-check-api: http://130.150.161.72:8888/bdp/dataservice/api
+    add-face-api: http://130.150.161.72:20923/thyy/api/haikang/door/addFaceRecognition
   config:
-    dzfpdir: D:\\
+    dzfpdir: D:\wx-business\files\dzfp
     dzfpurl: https://staticweb.hnthyy.cn/dzfp
 
-production: false
+production: false

+ 48 - 9
src/main/resources/application-prod.yml

@@ -4,13 +4,13 @@ server:
     context-path: /wxserver
 spring:
   application:
-    name: wxservice-server-dev
+    name: wxservice-server
   thymeleaf:
     cache: false
   datasource:
-    url: "jdbc:sqlserver://172.16.32.168:1433;databaseName=thxyhisdb"
+    url: "jdbc:sqlserver://130.150.161.71:1433;databaseName=hisdb"
     username: "sa"
-    password:
+    password: "Symhyy@123"
     driver-class-name: "com.microsoft.sqlserver.jdbc.SQLServerDriver"
     druid:
       initial-size: 40
@@ -37,19 +37,58 @@ spring:
     format:
       date: yyyy-MM-dd
       date-time: yyyy-MM-dd HH:mm:ss
+
 mybatis-plus:
   configuration:
     map-underscore-to-camel-case: true
+management:
+  server:
+    port: 9092
+  endpoints:
+    web:
+      base-path: /actuator
+      exposure:
+        include: '*'
+  metrics:
+    export:
+      simple:
+        enabled: true
+      jmx:
+        enabled: true
+      prometheus:
+        enabled: true
+    distribution:
+      percentiles-histogram:
+        http:
+          server:
+            requests: false
+      minimum-expected-value:
+        http:
+          server:
+            requests: 20ms
+      maximum-expected-value:
+        http:
+          server:
+            requests: 200ms
+  endpoint:
+    metrics:
+      enabled: true
+    health:
+      show-details: always
+      probes:
+        enabled: true
+    prometheus:
+      enabled: true
 
 thyy:
   api-addr:
-    his-mip-api: http://172.16.32.166:1100/mobilePayApi
-    thmz-api: http://172.16.32.160:81/thmz
-    chronic-api: http://172.16.32.160:8077/chronicDisease
-    physical-check-api: http://172.16.32.183:8888/bdp/dataservice/api
-    add-face-api: http://172.16.32.167:20923/thyy/api/haikang/door/addFaceRecognition
+    his-mip-api: http://130.150.161.72:1100/mobilePayApi
+    thmz-api: http://130.150.161.72:8089/thmz
+    chronic-api: http://130.150.161.72:8077/chronicDisease
+    physical-check-api: http://130.150.161.72:8888/bdp/dataservice/api
+    add-face-api: http://130.150.161.72:20923/thyy/api/haikang/door/addFaceRecognition
   config:
-    dzfpdir: D:\\
+    dzfpdir: D:\wx-business\files\dzfp
     dzfpurl: https://staticweb.hnthyy.cn/dzfp
 
 production: false

+ 0 - 11
src/main/resources/logback-spring.xml

@@ -3,15 +3,6 @@
     <!-- 不包含base.xml,因为我们自定义所有appender -->
     <!-- <include resource="org/springframework/boot/logging/logback/base.xml" /> -->
 
-<!--    <springProperty scope="context" name="serviceName" source="spring.application.name" defaultValue="web-server"/>-->
-<!--    <appender name="LOGSTASH" class="net.logstash.logback.appender.LogstashTcpSocketAppender">-->
-<!--        <destination>172.16.32.134:5044</destination>-->
-<!--        <encoder charset="UTF-8" class="net.logstash.logback.encoder.LogstashEncoder">-->
-<!--            <customFields>{"service":"${serviceName}"}</customFields>-->
-<!--            <includeContext>false</includeContext>-->
-<!--        </encoder>-->
-<!--    </appender>-->
-
     <springProperty name="application_name" scope="context" source="spring.application.name"/>
     <springProperty scope="context" name="LOG_HOME" source="logging.path" defaultValue="logs"/>
 
@@ -108,7 +99,5 @@
         <!-- 本地文件输出 -->
         <appender-ref ref="FILE_ALL"/>
         <appender-ref ref="FILE_ERROR"/>
-        <!-- Logstash输出 -->
-        <appender-ref ref="LOGSTASH"/>
     </root>
 </configuration>