Explorar o código

部分日志入库

lighter %!s(int64=3) %!d(string=hai) anos
pai
achega
a7b99f3ddb

+ 9 - 0
src/main/java/thyyxxk/sizyfeeoprnsystm/dao/SiLogDao.java

@@ -0,0 +1,9 @@
+package thyyxxk.sizyfeeoprnsystm.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import thyyxxk.sizyfeeoprnsystm.pojo.SiLog;
+
+@Mapper
+public interface SiLogDao extends BaseMapper<SiLog> {
+}

+ 85 - 0
src/main/java/thyyxxk/sizyfeeoprnsystm/pojo/SiLog.java

@@ -0,0 +1,85 @@
+package thyyxxk.sizyfeeoprnsystm.pojo;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+@TableName("t_si_log")
+public class SiLog implements Serializable {
+
+	private static final long serialVersionUID =  3109706338397960444L;
+
+	/**
+	 * 报文ID
+	 */
+	@TableId(type=IdType.ASSIGN_UUID)
+	private String msgid;
+
+	/**
+	 * 功能号
+	 */
+	private String infno;
+
+	/**
+	 * 参保地医保区划
+	 */
+	private String insuplcAdmdvs;
+
+	/**
+	 * 经办人
+	 */
+	private String opter;
+
+	/**
+	 * 交易输入
+	 */
+	private String body;
+
+	/**
+	 * 交易输出
+	 */
+	private String result;
+
+	/**
+	 * 住院号/门诊号
+	 */
+	private String patNo;
+
+	/**
+	 * 住院/门诊次数
+	 */
+	private Integer times;
+
+	/**
+	 * 账页号
+	 */
+	private Integer ledgerSn;
+
+	/**
+	 * 日志类别:1-住院;2-门诊
+	 * */
+	private Integer logType;
+
+	private Integer infcode;
+
+	public SiLog(JSONObject input, JSONObject result, String patNo, Integer times, Integer ledgerSn, Integer infcode) {
+		if (null != result) {
+			setResult(result.toJSONString());
+		}
+		setBody(input.toJSONString());
+		setInfno(input.getString("infno"));
+		setInsuplcAdmdvs(input.getString("insuplc_admdvs"));
+		setMsgid(input.getString("msgid"));
+		setOpter(input.getString("opter"));
+		setPatNo(patNo);
+		setTimes(times);
+		setLedgerSn(ledgerSn);
+		setLogType(1);
+		setInfcode(infcode);
+	}
+}

+ 8 - 3
src/main/java/thyyxxk/sizyfeeoprnsystm/service/SiZyFeeService.java

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.client.RestTemplate;
+import thyyxxk.sizyfeeoprnsystm.dao.SiLogDao;
 import thyyxxk.sizyfeeoprnsystm.dao.SiZyDao;
 import thyyxxk.sizyfeeoprnsystm.dicts.MdtrtCertType;
 import thyyxxk.sizyfeeoprnsystm.dicts.PsnSetlWay;
@@ -30,13 +31,15 @@ public class SiZyFeeService {
     private static final String ERROR_MESSAGE = "err_msg";
     private static final String OUTPUT = "output";
     private final SiZyDao zyDao;
+    private final SiLogDao logDao;
     private final ExecService exec;
     @Value("${upld-notify-url}")
     private String upldNotifyUrl;
 
     @Autowired
-    public SiZyFeeService(SiZyDao zyDao, ExecService exec) {
+    public SiZyFeeService(SiZyDao zyDao, SiLogDao logDao, ExecService exec) {
         this.zyDao = zyDao;
+        this.logDao = logDao;
         this.exec = exec;
     }
 
@@ -243,10 +246,12 @@ public class SiZyFeeService {
         if (null == result) {
             return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
         }
-        if (null == result.getInteger(RESULT_CODE)) {
+        Integer infcode = result.getInteger(RESULT_CODE);
+        logDao.insert(new SiLog(input, result, p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn(), infcode));
+        if (null == infcode) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医保中心报错:" + result.getString("message"));
         }
-        if (result.getIntValue(RESULT_CODE) == 0) {
+        if (infcode == 0) {
             JSONObject setlinfo = result.getJSONObject(OUTPUT).getJSONObject("setlinfo");
             String fundPay = setlinfo.getString("fund_pay_sumamt");
             if (DecimalUtil.compare(fundPay, p.getTotalCharge()) == 1) {