diff --git a/pom.xml b/pom.xml
index 4a98ab4..508e587 100644
--- a/pom.xml
+++ b/pom.xml
@@ -111,6 +111,11 @@
fastjson2
2.0.24
+
+ com.alibaba
+ fastjson
+ 2.0.4
+
@@ -146,6 +151,11 @@
dom4j
2.1.3
+
+ com.glxp
+ yb
+ zephyr1.7.0
+
diff --git a/src/main/java/com/glxp/mipsdl/controller/YbApiController.java b/src/main/java/com/glxp/mipsdl/controller/YbApiController.java
new file mode 100644
index 0000000..5f007e8
--- /dev/null
+++ b/src/main/java/com/glxp/mipsdl/controller/YbApiController.java
@@ -0,0 +1,11 @@
+package com.glxp.mipsdl.controller;
+
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+public class YbApiController {
+
+
+// public void get
+
+}
diff --git a/src/main/java/com/glxp/mipsdl/entity/system/ThrYbSetup.java b/src/main/java/com/glxp/mipsdl/entity/system/ThrYbSetup.java
new file mode 100644
index 0000000..9bb88d5
--- /dev/null
+++ b/src/main/java/com/glxp/mipsdl/entity/system/ThrYbSetup.java
@@ -0,0 +1,86 @@
+package com.glxp.mipsdl.entity.system;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+
+import java.io.Serializable;
+
+import lombok.Data;
+
+@Data
+@TableName(value = "thr_yb_setup")
+public class ThrYbSetup implements Serializable {
+ @TableId(value = "id", type = IdType.INPUT)
+ private Integer id;
+
+ @TableField(value = "url")
+ private String url;
+
+ @TableField(value = "appId")
+ private String appId;
+
+ @TableField(value = "appSecret")
+ private String appSecret;
+
+ @TableField(value = "signKey")
+ private String signKey;
+
+ @TableField(value = "encKey")
+ private String encKey;
+ /**
+ * 就医地医保区划
+ */
+ @TableField(value = "mdtrtarea_admvs")
+ private String mdtrtarea_admvs;
+
+ /**
+ * 参保地医保区划
+ */
+ @TableField(value = "insuplc_admdvs")
+ private String insuplc_admdvs;
+
+ /**
+ * 操作人
+ */
+ @TableField(value = "opter")
+ private String opter;
+
+ /**
+ * 操作时间
+ */
+ @TableField(value = "opter_name")
+ private String opter_name;
+
+ /**
+ * 定点医药机构编号
+ */
+ @TableField(value = "fixmedins_code")
+ private String fixmedins_code;
+
+ /**
+ * 定点医药机构名称
+ */
+ @TableField(value = "fixmedins_name")
+ private String fixmedins_name;
+
+ /**
+ * 接口版本号
+ */
+ @TableField(value = "infver")
+ private String infver;
+
+ /**
+ * 接收方系统代码
+ */
+ @TableField(value = "recer_sys_code")
+ private String recer_sys_code;
+ /**
+ * 经办人类别
+ */
+ @TableField(value = "opter_type")
+ private String opter_type;
+
+ private static final long serialVersionUID = 1L;
+}
\ No newline at end of file
diff --git a/src/main/java/com/glxp/mipsdl/entity/system/ThrYbSetupMapper.java b/src/main/java/com/glxp/mipsdl/entity/system/ThrYbSetupMapper.java
new file mode 100644
index 0000000..0b4ef66
--- /dev/null
+++ b/src/main/java/com/glxp/mipsdl/entity/system/ThrYbSetupMapper.java
@@ -0,0 +1,8 @@
+package com.glxp.mipsdl.entity.system;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface ThrYbSetupMapper extends BaseMapper {
+}
\ No newline at end of file
diff --git a/src/main/java/com/glxp/mipsdl/req/yb/Kcbg3502Request.java b/src/main/java/com/glxp/mipsdl/req/yb/Kcbg3502Request.java
new file mode 100644
index 0000000..6cfbf43
--- /dev/null
+++ b/src/main/java/com/glxp/mipsdl/req/yb/Kcbg3502Request.java
@@ -0,0 +1,72 @@
+package com.glxp.mipsdl.req.yb;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 商品库存变更
+ */
+@Data
+public class Kcbg3502Request {
+
+ /**
+ * 医疗目录编码
+ */
+ private String med_list_codg;
+ /**
+ * 库存变更类型
+ */
+ private String inv_chg_type;
+ /**
+ * 定点医药机构目录编号
+ */
+ private String fixmedins_hilist_id;
+ /**
+ * 定点医药机构目录名称
+ */
+ private String fixmedins_hilist_name;
+ /**
+ * 定点医药机构批次流水号
+ */
+ private String fixmedins_bchno;
+ /**
+ * 单价
+ */
+ private BigDecimal pric;
+ /**
+ * 数量
+ */
+ private Integer cnt;
+ /**
+ * 处方药标志
+ */
+ private String rx_flag;
+ /**
+ * 库存变更时间
+ */
+ private Date inv_chg_time;
+ /**
+ * 库存变更经办人姓名
+ */
+ private String inv_chg_opter_name;
+ /**
+ * 备注
+ */
+ private String memo;
+ /**
+ * 拆零标志
+ */
+ private String trdn_flag;
+ /**
+ * 溯源码节点信息
+ */
+ private String drugtracinfo;
+ /**
+ * 药品追溯码
+ */
+ private String drug_trac_codg;
+
+
+}
diff --git a/src/main/java/com/glxp/mipsdl/req/yb/Pcsc3501Request.java b/src/main/java/com/glxp/mipsdl/req/yb/Pcsc3501Request.java
new file mode 100644
index 0000000..ecba8da
--- /dev/null
+++ b/src/main/java/com/glxp/mipsdl/req/yb/Pcsc3501Request.java
@@ -0,0 +1,64 @@
+package com.glxp.mipsdl.req.yb;
+
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 商品盘存上传
+ */
+
+@Data
+public class Pcsc3501Request {
+
+ /**
+ * 医疗目录编码
+ */
+ private String med_list_codg;
+ /**
+ * 定点医药机构目录编号
+ */
+ private String fixmedins_hilist_id;
+ /**
+ * 定点医药机构目录名称
+ */
+ private String fixmedins_hilist_name;
+ /**
+ * 处方药标志
+ */
+ private String rx_flag;
+ /**
+ * 盘存日期
+ */
+ private Date invdate;
+ /**
+ * 库存数量
+ */
+ private Integer inv_cnt;
+ /**
+ * 生产批号
+ */
+ private String manu_lotnum;
+ /**
+ * 定点医药机构批次流水号
+ */
+ private String fixmedins_bchno;
+ /**
+ * 生产日期
+ */
+ private Date manu_date;
+ /**
+ * 有效期止
+ */
+ private Date expy_end;
+ /**
+ * 备注
+ */
+ private String memo;
+ /**
+ * 溯源码节点信息
+ */
+ private String drugtracinfo;
+
+
+}
diff --git a/src/main/java/com/glxp/mipsdl/req/yb/Xsck3505Request.java b/src/main/java/com/glxp/mipsdl/req/yb/Xsck3505Request.java
new file mode 100644
index 0000000..050db93
--- /dev/null
+++ b/src/main/java/com/glxp/mipsdl/req/yb/Xsck3505Request.java
@@ -0,0 +1,204 @@
+package com.glxp.mipsdl.req.yb;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 药品销售
+ */
+@Data
+public class Xsck3505Request {
+
+
+ /**
+ * 医疗目录编码
+ */
+ private String med_list_codg;
+
+ /**
+ * 定点医药机构目录编号
+ */
+ private String fixmedins_hilist_id;
+
+ /**
+ * 定点医药机构目录名称
+ */
+ private String fixmedins_hilist_name;
+
+ /**
+ * 定点医药机构批次流水号
+ */
+ private String fixmedins_bchno;
+
+ /**
+ * 开方医师证件类型
+ */
+ private String prsc_dr_cert_type;
+
+ /**
+ * 开方医师证件号码
+ */
+ private String prsc_dr_certno;
+
+ /**
+ * 开方医师姓名
+ */
+ private String prsc_dr_name;
+
+ /**
+ * 药师证件类型
+ */
+ private String phar_cert_type;
+
+ /**
+ * 药师证件号码
+ */
+ private String phar_certno;
+
+ /**
+ * 药师姓名
+ */
+ private String phar_name;
+
+ /**
+ * 药师执业资格证号
+ */
+ private String phar_prac_cert_no;
+
+ /**
+ * 医保费用结算类型
+ */
+ private String hi_feesetl_type;
+
+ /**
+ * 结算ID
+ */
+ private String setl_id;
+
+ /**
+ * 就医流水号
+ */
+ private String mdtrt_sn;
+
+ /**
+ * 人员编号
+ */
+ private String psn_no;
+
+ /**
+ * 人员证件类型
+ */
+ private String psn_cert_type;
+
+ /**
+ * 证件号码
+ */
+ private String certno;
+
+ /**
+ * 人员姓名
+ */
+ private String psn_name;
+
+ /**
+ * 生产批号
+ */
+ private String manu_lotnum;
+
+ /**
+ * 生产日期
+ */
+ private Date manu_date;
+
+ /**
+ * 有效期止
+ */
+ private Date expy_end;
+
+ /**
+ * 处方药标志
+ */
+ private String rx_flag;
+
+ /**
+ * 拆零标志
+ */
+ private String trdn_flag;
+
+ /**
+ * 最终成交单价
+ */
+ private BigDecimal finl_trns_pric;
+
+ /**
+ * 处方号
+ */
+ private String rxno;
+
+ /**
+ * 外购处方标志
+ */
+ private String rx_circ_flag;
+
+ /**
+ * 零售单据号
+ */
+ private String rtal_docno;
+
+ /**
+ * 销售出库单据号
+ */
+ private String stoout_no;
+
+ /**
+ * 批次号
+ */
+ private String bchno;
+
+
+ /**
+ * 药品条形码
+ */
+ private String drug_prod_barc;
+
+ /**
+ * 货架位
+ */
+ private String shelf_posi;
+
+ /**
+ * 销售/退货数量
+ */
+ private Integer sel_retn_cnt;
+
+ /**
+ * 销售/退货时间
+ */
+ private Date sel_retn_time;
+
+ /**
+ * 销售/退货经办人姓名
+ */
+ private String sel_retn_opter_name;
+
+ /**
+ * 备注
+ */
+ private String memo;
+
+ /**
+ * 就诊结算类型
+ */
+ private String mdtrt_setl_type;
+
+ /**
+ * 溯源码节点信息
+ */
+ private String drugtracinfo;
+
+ private String drug_trac_codg;
+
+
+}
diff --git a/src/main/java/com/glxp/mipsdl/req/yb/Xsth3506Request.java b/src/main/java/com/glxp/mipsdl/req/yb/Xsth3506Request.java
new file mode 100644
index 0000000..3e441de
--- /dev/null
+++ b/src/main/java/com/glxp/mipsdl/req/yb/Xsth3506Request.java
@@ -0,0 +1,126 @@
+package com.glxp.mipsdl.req.yb;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 销售退货
+ */
+@Data
+public class Xsth3506Request {
+
+
+ /**
+ * 医疗目录编码
+ */
+ private String med_list_codg;
+
+ /**
+ * 定点医药机构目录编号
+ */
+ private String fixmedins_hilist_id;
+
+ /**
+ * 定点医药机构目录名称
+ */
+ private String fixmedins_hilist_name;
+
+ /**
+ * 定点医药机构批次流水号
+ */
+ private String fixmedins_bchno;
+
+ /**
+ * 结算ID
+ */
+ private String setl_id;
+
+ /**
+ * 人员编号
+ */
+ private String psn_no;
+
+ /**
+ * 人员证件类型
+ */
+ private String psn_cert_type;
+
+ /**
+ * 证件号码
+ */
+ private String certno;
+
+ /**
+ * 人员姓名
+ */
+ private String psn_name;
+
+ /**
+ * 生产批号
+ */
+ private String manu_lotnum;
+
+ /**
+ * 生产日期
+ */
+ private Date manu_date;
+
+ /**
+ * 有效期止
+ */
+ private Date expy_end;
+
+ /**
+ * 处方药标志
+ */
+ private String rx_flag;
+
+ /**
+ * 拆零标志
+ */
+ private String trdn_flag;
+
+ /**
+ * 最终成交单价
+ */
+ private BigDecimal finl_trns_pric;
+
+ /**
+ * 销售/退货数量
+ */
+ private BigDecimal sel_retn_cnt;
+
+ /**
+ * 销售/退货时间
+ */
+ private Date sel_retn_time;
+
+ /**
+ * 销售/退货经办人姓名
+ */
+ private String sel_retn_opter_name;
+
+ /**
+ * 备注
+ */
+ private String memo;
+
+ /**
+ * 商品销售流水号
+ */
+ private String medins_prod_sel_no;
+
+ /**
+ * 就医流水号
+ */
+ private String mdtrt_sn;
+
+ /**
+ * 溯源码节点信息
+ */
+ private String drugtracinfo;
+
+
+}
diff --git a/src/main/java/com/glxp/mipsdl/req/yb/Yljg1201Request.java b/src/main/java/com/glxp/mipsdl/req/yb/Yljg1201Request.java
new file mode 100644
index 0000000..c8d5783
--- /dev/null
+++ b/src/main/java/com/glxp/mipsdl/req/yb/Yljg1201Request.java
@@ -0,0 +1,24 @@
+package com.glxp.mipsdl.req.yb;
+
+import lombok.Data;
+
+@Data
+public class Yljg1201Request {
+
+ /**
+ * 定点医疗服务机构类型
+ */
+ private String fixmedins_type;
+
+ /**
+ * 定点医药机构名称
+ */
+ private String fixmedins_name;
+
+ /**
+ * 定点医药机构编号
+ */
+ private String fixmedins_code;
+
+
+}
diff --git a/src/main/java/com/glxp/mipsdl/res/yb/YbResponse.java b/src/main/java/com/glxp/mipsdl/res/yb/YbResponse.java
new file mode 100644
index 0000000..0e472b9
--- /dev/null
+++ b/src/main/java/com/glxp/mipsdl/res/yb/YbResponse.java
@@ -0,0 +1,54 @@
+package com.glxp.mipsdl.res.yb;
+
+import lombok.Data;
+
+@Data
+public class YbResponse {
+
+ /**
+ * 返回结果
+ */
+ private String retRslt;
+
+ /**
+ * 返回信息
+ */
+ private String msgRslt;
+
+ /**
+ * 医疗目录编码
+ */
+ private String med_list_codg;
+
+ /**
+ * 发票变更类型
+ */
+ private String inv_chg_type;
+
+ /**
+ * 定点医药机构目录编号
+ */
+ private String fixmedins_hilist_id;
+
+ /**
+ * 定点医药机构目录名称
+ */
+ private String fixmedins_hilist_name;
+
+ /**
+ * 定点医药机构批次流水号
+ */
+ private String fixmedins_bchno;
+
+ /**
+ * 备注
+ */
+ private String memo;
+
+ // Getters and Setters
+
+ // Getters and Setters
+
+ // Constructor, toString, equals, hashCode methods if necessary
+
+}
diff --git a/src/main/java/com/glxp/mipsdl/service/system/ThrYbSetupService.java b/src/main/java/com/glxp/mipsdl/service/system/ThrYbSetupService.java
new file mode 100644
index 0000000..f3e7173
--- /dev/null
+++ b/src/main/java/com/glxp/mipsdl/service/system/ThrYbSetupService.java
@@ -0,0 +1,24 @@
+package com.glxp.mipsdl.service.system;
+
+import cn.hutool.core.collection.CollUtil;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.glxp.mipsdl.entity.system.ThrYbSetup;
+import com.glxp.mipsdl.entity.system.ThrYbSetupMapper;
+
+@Service
+public class ThrYbSetupService extends ServiceImpl {
+
+ public ThrYbSetup getSetUp() {
+ List thrYbSetups = list();
+ if (CollUtil.isNotEmpty(thrYbSetups))
+ return thrYbSetups.get(0);
+ else
+ return null;
+ }
+
+}
diff --git a/src/main/java/com/glxp/mipsdl/service/yb/YbClient.java b/src/main/java/com/glxp/mipsdl/service/yb/YbClient.java
new file mode 100644
index 0000000..516356b
--- /dev/null
+++ b/src/main/java/com/glxp/mipsdl/service/yb/YbClient.java
@@ -0,0 +1,56 @@
+package com.glxp.mipsdl.service.yb;
+
+import cn.hsa.zephyr.apisdk.ZephyrMedicalClient;
+import cn.hsa.zephyr.apisdk.internal.exception.ZephyrApiException;
+import cn.hsa.zephyr.apisdk.internal.util.encrypt.EncryptionModeEnum;
+import cn.hsa.zephyr.apisdk.internal.util.encrypt.SignTypeEnum;
+import cn.hsa.zephyr.apisdk.request.ZephyrMedicalRequest;
+import cn.hsa.zephyr.apisdk.response.ChsMedicalResponse;
+import com.alibaba.fastjson.JSONObject;
+import com.glxp.mipsdl.entity.system.ThrYbSetup;
+import com.glxp.mipsdl.service.system.ThrYbSetupService;
+import com.glxp.mipsdl.util.DateUtil;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.Date;
+
+@Service
+public class YbClient {
+
+ @Resource
+ ThrYbSetupService thrYbSetupService;
+
+ public ChsMedicalResponse ybPost(String apiNo, JSONObject requestData) {
+
+
+ ThrYbSetup thrYbSetup = thrYbSetupService.getSetUp();
+ if (thrYbSetup == null)
+ throw new RuntimeException("未配置医保接口");
+ String infno = apiNo;
+ SignTypeEnum signType = SignTypeEnum.SM3;
+ EncryptionModeEnum encType = EncryptionModeEnum.SM4;
+ String msgId = thrYbSetup.getFixmedins_code() + DateUtil.formatYbDateTime(new Date()) + "0001";
+ try {
+ ZephyrMedicalClient client = new ZephyrMedicalClient(thrYbSetup.getUrl(), infno, thrYbSetup.getAppId(), thrYbSetup.getAppSecret(),
+ signType, thrYbSetup.getSignKey(), encType, thrYbSetup.getEncKey());
+ ZephyrMedicalRequest req = new ZephyrMedicalRequest();
+ req.setMsgid(msgId);
+ req.setMdtrtAreaAdmdvs(thrYbSetup.getMdtrtarea_admvs());
+ req.setInsuplcAdmdvs(thrYbSetup.getInsuplc_admdvs());
+ req.setOpter(thrYbSetup.getOpter());
+ req.setOpterType(thrYbSetup.getOpter_type());
+ req.setOpterName(thrYbSetup.getOpter_name());
+ req.setInfTime(DateUtil.formatDateTime(new Date()));
+ req.setFixmedinsCode(thrYbSetup.getFixmedins_code());
+ req.setFixmedinsName(thrYbSetup.getFixmedins_name());
+ req.setInput(requestData);
+ ChsMedicalResponse resp = client.execute(req);
+ return resp;
+ } catch (ZephyrApiException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+}
diff --git a/src/main/java/com/glxp/mipsdl/util/DateUtil.java b/src/main/java/com/glxp/mipsdl/util/DateUtil.java
index d34fbc5..a46c820 100644
--- a/src/main/java/com/glxp/mipsdl/util/DateUtil.java
+++ b/src/main/java/com/glxp/mipsdl/util/DateUtil.java
@@ -64,6 +64,14 @@ public class DateUtil {
return dateString;
}
+ public static String formatYbDateTime(Date date) {
+ Date currentTime = date;
+ SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
+ String dateString = formatter.format(currentTime);
+ return dateString;
+ }
+
+
/**
* 得到当前日期字符串 格式(yyyy-MM-dd)
*/
diff --git a/src/main/resources/mybatis/mapper/master/system/ThrYbSetupMapper.xml b/src/main/resources/mybatis/mapper/master/system/ThrYbSetupMapper.xml
new file mode 100644
index 0000000..4aa2236
--- /dev/null
+++ b/src/main/resources/mybatis/mapper/master/system/ThrYbSetupMapper.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id, url, appId, appSecret, signKey, encKey, insuplc_admdvs, opter, opter_name, fixmedins_code,
+ fixmedins_name, infver, recer_sys_code
+
+
\ No newline at end of file