diff --git a/health_common/.project b/health_common/.project new file mode 100644 index 0000000..7152944 --- /dev/null +++ b/health_common/.project @@ -0,0 +1,52 @@ + + + health_common + + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.wst.validation.validationbuilder + + + + + com.genuitec.eclipse.j2eedt.core.DeploymentDescriptorValidator + + + + + com.genuitec.eclipse.springframework.springbuilder + + + + + org.springframework.ide.eclipse.boot.validation.springbootbuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + com.genuitec.eclipse.springframework.springnature + org.eclipse.jem.workbench.JavaEMFNature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + + diff --git a/health_common/pom.xml b/health_common/pom.xml new file mode 100644 index 0000000..c691b79 --- /dev/null +++ b/health_common/pom.xml @@ -0,0 +1,152 @@ + + + + + cn.health.service + health-parent + 1.0.2 + + 4.0.0 + health_common + health_common + http://maven.apache.org + + + + UTF-8 + utf-8 + + + + + + + com.alibaba + fastjson + + + + + + org.springframework + spring-context + + + + + org.springframework.boot + spring-boot-starter-security + + + + + + org.apache.commons + commons-lang3 + + + + + + javax.servlet + javax.servlet-api + + + + + + + + org.apache.httpcomponents + httpclient + + + + + + dom4j + dom4j + + + + + org.springframework + spring-webmvc + + + + + + + io.springfox + springfox-swagger2 + + + + + com.github.pagehelper + pagehelper-spring-boot-starter + + + + org.springframework.boot + spring-boot-starter-data-redis + + + + + + + + + org.apache.commons + commons-pool2 + + + + + + + + com.fasterxml.jackson.core + jackson-databind + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + true + + + + + diff --git a/health_common/src/main/java/cn/card/health/bean/hospital/YcHospital.java b/health_common/src/main/java/cn/card/health/bean/hospital/YcHospital.java new file mode 100644 index 0000000..6a76bc2 --- /dev/null +++ b/health_common/src/main/java/cn/card/health/bean/hospital/YcHospital.java @@ -0,0 +1,117 @@ +package cn.card.health.bean.hospital; + +import java.io.Serializable; +import java.util.Date; + +/** + * 医院信息表 + * + * @author xinggm + * @email + * @date 2021-08-16 10:07:33 + */ +public class YcHospital implements Serializable { + private static final long serialVersionUID = 1L; + + /** 医院主键 */ +private Long hospid; + /** 医院名称 */ +private String hospname; + /** 腾讯健康医院标识 */ +private String wechathospid; + /** his医院编码 */ +private String hospcode; + /** */ +private Integer delFlag; + /** 创建时间 */ +private Date createtime; + /** 创建人 */ +private String createby; + /** 修改时间 */ +private Date updatetime; + /** 修改人 */ +private String updateby; + + + public Long getHospid() { + return hospid; + } + + public void setHospid(Long hospid) { + this.hospid = hospid; + } + + + public String getHospname() { + return hospname; + } + + public void setHospname(String hospname) { + this.hospname = hospname; + } + + + public String getWechathospid() { + return wechathospid; + } + + public void setWechathospid(String wechathospid) { + this.wechathospid = wechathospid; + } + + + public String getHospcode() { + return hospcode; + } + + public void setHospcode(String hospcode) { + this.hospcode = hospcode; + } + + + public Integer getDelFlag() { + return delFlag; + } + + public void setDelFlag(Integer delFlag) { + this.delFlag = delFlag; + } + + + public Date getCreatetime() { + return createtime; + } + + public void setCreatetime(Date createtime) { + this.createtime = createtime; + } + + + public String getCreateby() { + return createby; + } + + public void setCreateby(String createby) { + this.createby = createby; + } + + + public Date getUpdatetime() { + return updatetime; + } + + public void setUpdatetime(Date updatetime) { + this.updatetime = updatetime; + } + + + public String getUpdateby() { + return updateby; + } + + public void setUpdateby(String updateby) { + this.updateby = updateby; + } + + +} diff --git a/health_common/src/main/java/cn/card/health/bean/hospital/YcPatient.java b/health_common/src/main/java/cn/card/health/bean/hospital/YcPatient.java new file mode 100644 index 0000000..8094179 --- /dev/null +++ b/health_common/src/main/java/cn/card/health/bean/hospital/YcPatient.java @@ -0,0 +1,193 @@ +package cn.card.health.bean.hospital; + +import com.alibaba.fastjson.JSONObject; +import sun.applet.Main; + +import java.io.Serializable; + +/** + * HIS病人健康卡对照表 + * + * @author xinggm + * @email + * @date 2021-07-14 09:05:22 + */ +public class YcPatient implements Serializable { + private static final long serialVersionUID = 1L; + + /** 主键 */ + private Long patientid; + /** 患者姓名 */ + private String patientName; + /** 患者性别 */ + private String patientSex; + /** */ + private String oppatno; + /** HIS卡号 */ + private String hiscardno; + /** 卡号 */ + private String cardno; + /** 卡类型 */ + private String cardtype; + /** 手机号 */ + private String phone; + /** 家庭住址 */ + private String address; + /** 微信健康卡主键 */ + private String cardid; + /** 医院主键 */ + private Long hospid; + /** 医院标志 */ + private String hisid; + /** openid */ + private String openid; + /** 渠道 */ + private String channel; + /** 是否新用户 */ + private String isnew; + /** 删除标志 */ + private Integer delFlag; + + public YcPatient() { + } + public static YcPatient getInstance(JSONObject params){ + YcPatient patient = new YcPatient(); + patient.patientName = params.getString("name"); + patient.cardno = params.getString("idcard"); + patient.address = params.getString("address"); + patient.phone = params.getString("phone"); + patient.patientSex = params.getString("sex"); + patient.channel = params.getString("nation"); +// patient.isnew = params.getString("") + return patient; + } + + public Long getPatientid() { + return patientid; + } + + public void setPatientid(Long patientid) { + this.patientid = patientid; + } + + public String getPatientName() { + return patientName; + } + + public String getPatientSex() { + return patientSex; + } + + public void setPatientSex(String patientSex) { + this.patientSex = patientSex; + } + + public void setPatientName(String patientName) { + this.patientName = patientName; + } + + public String getHisid() { + return hisid; + } + + public void setHisid(String hisid) { + this.hisid = hisid; + } + + public String getOppatno() { + return oppatno; + } + + public void setOppatno(String oppatno) { + this.oppatno = oppatno; + } + + public String getHiscardno() { + return hiscardno; + } + + public void setHiscardno(String hiscardno) { + this.hiscardno = hiscardno; + } + + public String getCardno() { + return cardno; + } + + public void setCardno(String cardno) { + this.cardno = cardno; + } + + public String getCardtype() { + return cardtype; + } + + public void setCardtype(String cardtype) { + this.cardtype = cardtype; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public String getCardid() { + return cardid; + } + + public void setCardid(String cardid) { + this.cardid = cardid; + } + + public Long getHospid() { + return hospid; + } + + public void setHospid(Long hospid) { + this.hospid = hospid; + } + + public String getOpenid() { + return openid; + } + + public void setOpenid(String openid) { + this.openid = openid; + } + + public String getChannel() { + return channel; + } + + public void setChannel(String channel) { + this.channel = channel; + } + + public String getIsnew() { + return isnew; + } + + public void setIsnew(String isnew) { + this.isnew = isnew; + } + + public Integer getDelFlag() { + return delFlag; + } + + public void setDelFlag(Integer delFlag) { + this.delFlag = delFlag; + } + +} diff --git a/health_common/src/main/java/cn/card/health/bean/user/LoginUser.java b/health_common/src/main/java/cn/card/health/bean/user/LoginUser.java new file mode 100644 index 0000000..31f7d3a --- /dev/null +++ b/health_common/src/main/java/cn/card/health/bean/user/LoginUser.java @@ -0,0 +1,195 @@ +package cn.card.health.bean.user; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.userdetails.UserDetails; + +import java.util.Collection; +import java.util.Set; + +public class LoginUser implements UserDetails { + + private static final long serialVersionUID = 1L; + + private String username; + /** + * 用户唯一标识 + */ + private String token; + /** + * 医院配置 + */ + private String hisid; + /** + * 登录时间 + */ + private Long loginTime; + /** + * 过期时间 + */ + private Long expireTime; + /** + * 微信登录专用 + */ + private String code; + /** + * 平台 + */ + private String platform; + + private Long userid; + /** + * 用户 + */ + private YcUser user; + /** + * 医院id + */ + private Long hospitalid; + + public LoginUser(YcUser user) { + this.user = user; + } + + public LoginUser() { + + } + public LoginUser(Long userid, Long deptId, YcUser user, Set permissions) + { + this.userid = userid; +// this.deptId = deptId; + this.user = user; +// this.permissions = permissions; + } + + public LoginUser(Long userid, YcUser user) + { + this.userid = userid; + this.user = user; + } + + public String getToken() { + return token; + } + + public void setToken(String token) { + this.token = token; + } + + @Override + public Collection getAuthorities() { + return null; + } + + @Override + public String getPassword() { + return null; + } + + @Override + public String getUsername() { + return username; + } + + @Override + public boolean isAccountNonExpired() { + return false; + } + + @Override + public boolean isAccountNonLocked() { + return false; + } + + @Override + public boolean isCredentialsNonExpired() { + return false; + } + + @Override + public boolean isEnabled() { + return false; + } + + public void setUsername(String username) { + this.username = username; + } + + public Long getLoginTime() { + return loginTime; + } + + public void setLoginTime(Long loginTime) { + this.loginTime = loginTime; + } + + public Long getExpireTime() { + return expireTime; + } + + public void setExpireTime(Long expireTime) { + this.expireTime = expireTime; + } + + public String getPlatform() { + return platform; + } + + public void setPlatform(String platform) { + this.platform = platform; + } + + public YcUser getUser() { + return user; + } + + public void setUser(YcUser user) { + this.user = user; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getHisid() { + return hisid; + } + + public void setHisid(String hisid) { + this.hisid = hisid; + } + + public Long getHospitalid() { + return hospitalid; + } + + public void setHospitalid(Long hospitalid) { + this.hospitalid = hospitalid; + } + + public Long getUserid() { + return userid; + } + + public void setUserid(Long userid) { + this.userid = userid; + } + + @Override + public String toString() { + + ObjectMapper objectMapper = new ObjectMapper(); + try { + return objectMapper.writeValueAsString(this); + } catch (JsonProcessingException e) { + e.printStackTrace(); + return null; + } + } + +} diff --git a/health_common/src/main/java/cn/card/health/bean/user/YcAuthority.java b/health_common/src/main/java/cn/card/health/bean/user/YcAuthority.java new file mode 100644 index 0000000..e3557ed --- /dev/null +++ b/health_common/src/main/java/cn/card/health/bean/user/YcAuthority.java @@ -0,0 +1,51 @@ +package cn.card.health.bean.user; + +import java.io.Serializable; +import java.util.Date; + +/** + * 授权表 + * + * @author xinggm + * @email + * @date 2021-08-30 17:59:54 + */ +public class YcAuthority implements Serializable { + private static final long serialVersionUID = 1L; + + /** 主键 */ +private Long authorityid; + /** 权限 */ +private String authority; + /** 备注 */ +private String remark; + + + public Long getAuthorityid() { + return authorityid; + } + + public void setAuthorityid(Long authorityid) { + this.authorityid = authorityid; + } + + + public String getAuthority() { + return authority; + } + + public void setAuthority(String authority) { + this.authority = authority; + } + + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + +} diff --git a/health_common/src/main/java/cn/card/health/bean/user/YcInhospPatient.java b/health_common/src/main/java/cn/card/health/bean/user/YcInhospPatient.java new file mode 100644 index 0000000..c1de13f --- /dev/null +++ b/health_common/src/main/java/cn/card/health/bean/user/YcInhospPatient.java @@ -0,0 +1,327 @@ +package cn.card.health.bean.user; + +import java.io.Serializable; +import java.util.Date; + +/** + * 住院病人信息 + * + * @author user + * @email + * @date 2021-09-06 09:02:37 + */ +public class YcInhospPatient implements Serializable { + private static final long serialVersionUID = 1L; + + /** */ + private Long patientid; + /** 用户主键 */ + private Long userid; + /** 第三方标志 */ + private String openid; + /** 医院标志 */ + private Long hospid; + /** 患者主索引 */ + private String patid; + /** 住院病人id */ + private String ippatid; + /** 住院病人号 */ + private String ippatno; + /** 身份证号 */ + private String idcardno; + /** 卡类型 */ + private String cardtype; + /** 患者诊疗卡号 */ + private String patmedno; + /** 患者姓名 */ + private String patname; + /** HIS当前住院就诊流水号 */ + private String visitid; + /** 性别 */ + private String patsex; + /** 生日 */ + private String birthday; + /** 手机号 */ + private String phone; + /** 家庭住址 */ + private String address; + /** 人员 */ + private String contactperson; + /** 关系 */ + private String contactrelation; + /** 手机号 */ + private String contactphone; + /** 区域名称 */ + private String areaname; + /** 床号 */ + private String bedno; + /** 入住日期 */ + private String admitdate; + /** 总金额 */ + private Long totalamount; + /** */ + private String totaldeposit; + /** 金额 */ + private Long closedamount; + /** */ + private String uncovereddeposit; + /** 状态 */ + private String patstate; + /** HIS医院标志 */ + private String hospitalid; + /** 删除标志 */ + private Integer delFlag; + /** 创建时间 */ + private Date createtime; + /** 创建人 */ + private String createby; + + public Long getPatientid() { + return patientid; + } + + public void setPatientid(Long patientid) { + this.patientid = patientid; + } + + public Long getHospid() { + return hospid; + } + + public void setHospid(Long hospid) { + this.hospid = hospid; + } + + public String getPatid() { + return patid; + } + + public void setPatid(String patid) { + this.patid = patid; + } + + public String getIppatid() { + return ippatid; + } + + public void setIppatid(String ippatid) { + this.ippatid = ippatid; + } + + public String getIppatno() { + return ippatno; + } + + public void setIppatno(String ippatno) { + this.ippatno = ippatno; + } + + public String getIdcardno() { + return idcardno; + } + + public void setIdcardno(String idcardno) { + this.idcardno = idcardno; + } + + public String getCardtype() { + return cardtype; + } + + public void setCardtype(String cardtype) { + this.cardtype = cardtype; + } + + public String getPatmedno() { + return patmedno; + } + + public void setPatmedno(String patmedno) { + this.patmedno = patmedno; + } + + public String getPatname() { + return patname; + } + + public void setPatname(String patname) { + this.patname = patname; + } + + public Long getUserid() { + return userid; + } + + public void setUserid(Long userid) { + this.userid = userid; + } + + public String getOpenid() { + return openid; + } + + public void setOpenid(String openid) { + this.openid = openid; + } + + public String getVisitid() { + return visitid; + } + + public void setVisitid(String visitid) { + this.visitid = visitid; + } + + public String getPatsex() { + return patsex; + } + + public void setPatsex(String patsex) { + this.patsex = patsex; + } + + public String getBirthday() { + return birthday; + } + + public void setBirthday(String birthday) { + this.birthday = birthday; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public String getContactperson() { + return contactperson; + } + + public void setContactperson(String contactperson) { + this.contactperson = contactperson; + } + + public String getContactrelation() { + return contactrelation; + } + + public void setContactrelation(String contactrelation) { + this.contactrelation = contactrelation; + } + + public String getContactphone() { + return contactphone; + } + + public void setContactphone(String contactphone) { + this.contactphone = contactphone; + } + + public String getAreaname() { + return areaname; + } + + public void setAreaname(String areaname) { + this.areaname = areaname; + } + + public String getBedno() { + return bedno; + } + + public void setBedno(String bedno) { + this.bedno = bedno; + } + + public String getAdmitdate() { + return admitdate; + } + + public void setAdmitdate(String admitdate) { + this.admitdate = admitdate; + } + + public Long getTotalamount() { + return totalamount; + } + + public void setTotalamount(Long totalamount) { + this.totalamount = totalamount; + } + + public String getTotaldeposit() { + return totaldeposit; + } + + public void setTotaldeposit(String totaldeposit) { + this.totaldeposit = totaldeposit; + } + + public Long getClosedamount() { + return closedamount; + } + + public void setClosedamount(Long closedamount) { + this.closedamount = closedamount; + } + + public String getUncovereddeposit() { + return uncovereddeposit; + } + + public void setUncovereddeposit(String uncovereddeposit) { + this.uncovereddeposit = uncovereddeposit; + } + + public String getPatstate() { + return patstate; + } + + public void setPatstate(String patstate) { + this.patstate = patstate; + } + + public String getHospitalid() { + return hospitalid; + } + + public void setHospitalid(String hospitalid) { + this.hospitalid = hospitalid; + } + + public Integer getDelFlag() { + return delFlag; + } + + public void setDelFlag(Integer delFlag) { + this.delFlag = delFlag; + } + + public Date getCreatetime() { + return createtime; + } + + public void setCreatetime(Date createtime) { + this.createtime = createtime; + } + + public String getCreateby() { + return createby; + } + + public void setCreateby(String createby) { + this.createby = createby; + } + +} diff --git a/health_common/src/main/java/cn/card/health/bean/user/YcOAuth.java b/health_common/src/main/java/cn/card/health/bean/user/YcOAuth.java new file mode 100644 index 0000000..0107e3c --- /dev/null +++ b/health_common/src/main/java/cn/card/health/bean/user/YcOAuth.java @@ -0,0 +1,87 @@ +package cn.card.health.bean.user; + +import java.io.Serializable; +import java.util.Date; + +/** + * 用户表 + * + * @author xinggm + * @email + * @date 2021-08-24 15:41:43 + */ +public class YcOAuth implements Serializable { + private static final long serialVersionUID = 1L; + + /** 主键 */ + private Long authid; + /** 用户主键 */ + private Long userid; + /** 授权类型 */ + private String authType; + /** APPID */ + private String appid; + /** 微信openid */ + private String openid; + /** 创建时间 */ + private Date createtime; + /** 修改时间 */ + private Date updatetime; + + public Long getAuthid() { + return authid; + } + + public void setAuthid(Long authid) { + this.authid = authid; + } + + public String getAppid() { + return appid; + } + + public void setAppid(String appid) { + this.appid = appid; + } + + public String getOpenid() { + return openid; + } + + public void setOpenid(String openid) { + this.openid = openid; + } + + public Long getUserid() { + return userid; + } + + public void setUserid(Long userid) { + this.userid = userid; + } + + public String getAuthType() { + return authType; + } + + public void setAuthType(String authType) { + this.authType = authType; + } + + public Date getCreatetime() { + return createtime; + } + + public void setCreatetime(Date createtime) { + this.createtime = createtime; + } + + public Date getUpdatetime() { + return updatetime; + } + + public void setUpdatetime(Date updatetime) { + this.updatetime = updatetime; + } + +} diff --git a/health_common/src/main/java/cn/card/health/bean/user/YcUser.java b/health_common/src/main/java/cn/card/health/bean/user/YcUser.java new file mode 100644 index 0000000..ee965df --- /dev/null +++ b/health_common/src/main/java/cn/card/health/bean/user/YcUser.java @@ -0,0 +1,145 @@ +package cn.card.health.bean.user; + +import java.io.Serializable; +import java.util.Date; + +/** + * 用户表 + * + * @author xinggm + * @email + * @date 2021-08-28 10:47:55 + */ +public class YcUser implements Serializable { + + private static final long serialVersionUID = 1L; + + /** 主键 */ + private Long userid; + /** 用户名 */ + private String username; + /** 用户类型 */ + private String userType; + /** 激活码 */ + private String activeKey; + /** 是否可用 */ + private boolean isActivated; + /** 密码 */ + private String password; + /** 手机号 */ + private String phonenum; + /** 邮件 */ + private String email; + /** 创建时间 */ + private Date createtime; + /** 更新时间 */ + private Date updatetime; + /** 说明 */ + private String remark; + /** 授权 */ + private YcOAuth auth; + + public YcOAuth getAuth() { + return auth; + } + + public void setAuth(YcOAuth auth) { + this.auth = auth; + } + + public Long getUserid() { + return userid; + } + + public void setUserid(Long userid) { + this.userid = userid; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getUserType() { + return userType; + } + + public void setUserType(String userType) { + this.userType = userType; + } + + public String getActiveKey() { + return activeKey; + } + + public void setActiveKey(String activeKey) { + this.activeKey = activeKey; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getPhonenum() { + return phonenum; + } + + public boolean isActivated() { + return isActivated; + } + + public void setActivated(boolean isActivated) { + this.isActivated = isActivated; + } + + public void setPhonenum(String phonenum) { + this.phonenum = phonenum; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public Date getCreatetime() { + return createtime; + } + + public void setCreatetime(Date createtime) { + this.createtime = createtime; + } + + public Date getUpdatetime() { + return updatetime; + } + + public void setUpdatetime(Date updatetime) { + this.updatetime = updatetime; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + @Override + public String toString() { + return "YcUser [userid=" + userid + ", username=" + username + ", userType=" + userType + ", activeKey=" + + activeKey + ", isActivated=" + isActivated + ", password=" + password + ", phonenum=" + phonenum + + ", email=" + email + ", createtime=" + createtime + ", updatetime=" + updatetime + ", remark=" + + remark + ", auth=" + auth + "]"; + } + +} diff --git a/health_common/src/main/java/cn/card/health/common/constant/Constants.java b/health_common/src/main/java/cn/card/health/common/constant/Constants.java new file mode 100644 index 0000000..f5c6234 --- /dev/null +++ b/health_common/src/main/java/cn/card/health/common/constant/Constants.java @@ -0,0 +1,139 @@ +package cn.card.health.common.constant; + +/** + * 通用常量信息 + * + * @author yc + */ +public class Constants { + /** + * UTF-8 字符集 + */ + public static final String UTF8 = "UTF-8"; + + /** + * GBK 字符集 + */ + public static final String GBK = "GBK"; + + /** + * http请求 + */ + public static final String HTTP = "http://"; + + /** + * https请求 + */ + public static final String HTTPS = "https://"; + + /** + * 通用成功标识 + */ + public static final String SUCCESS = "0"; + + /** + * 通用失败标识 + */ + public static final String FAIL = "1"; + + /** + * 登录成功 + */ + public static final String LOGIN_SUCCESS = "Success"; + + /** + * 注销 + */ + public static final String LOGOUT = "Logout"; + + /** + * 登录失败 + */ + public static final String LOGIN_FAIL = "Error"; + + /** + * 验证码 redis key + */ + public static final String CAPTCHA_CODE_KEY = "captcha_codes:"; + + /** + * 登录用户 redis key + */ + public static final String LOGIN_TOKEN_KEY = "login_tokens:"; + + /** + * 防重提交 redis key + */ + public static final String REPEAT_SUBMIT_KEY = "repeat_submit:"; + + /** + * 验证码有效期(分钟) + */ + public static final Integer CAPTCHA_EXPIRATION = 2; + + /** + * 令牌 + */ + public static final String TOKEN = "token"; + + /** + * 令牌前缀 + */ + public static final String TOKEN_PREFIX = "yc_health "; + + /** + * 令牌前缀 + */ + public static final String LOGIN_USER_KEY = "login_user_key"; + + /** + * 用户ID + */ + public static final String JWT_USERID = "userid"; + + /** + * 用户名称 + */ + public static final String JWT_USERNAME = "sub"; + + /** + * 用户头像 + */ + public static final String JWT_AVATAR = "avatar"; + + /** + * 创建时间 + */ + public static final String JWT_CREATED = "created"; + + /** + * 用户权限 + */ + public static final String JWT_AUTHORITIES = "authorities"; + + /** + * 参数管理 cache key + */ + public static final String SYS_CONFIG_KEY = "sys_config:"; + + /** + * 字典管理 cache key + */ + public static final String SYS_DICT_KEY = "sys_dict:"; + + /** + * 医院类 cache key + */ + public static final String HOSP_KEY = "hosp_key_"; + + /** + * 资源映射路径 前缀 + */ + public static final String RESOURCE_PREFIX = "/profile"; + /** 是否腾讯用户 */ + public static final String PATIENT_ISQQ = "PATIENT_ISQQ"; + + /** 服务地址 */ +// public static final String SERVER_URL = "https://zhyy.bjbhkj.top";// TODO 正式服务地址 + public static final String SERVER_URL = "https://www.hbyctr.com"; +} diff --git a/health_common/src/main/java/cn/card/health/common/core/ApplicationContextUtil.java b/health_common/src/main/java/cn/card/health/common/core/ApplicationContextUtil.java new file mode 100644 index 0000000..09efeae --- /dev/null +++ b/health_common/src/main/java/cn/card/health/common/core/ApplicationContextUtil.java @@ -0,0 +1,26 @@ +package cn.card.health.common.core; + +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.stereotype.Component; + +@Component +public class ApplicationContextUtil implements ApplicationContextAware { + private static ApplicationContext applicationContext; + + public static ApplicationContext getApplicationContext() { + return applicationContext; + } + + @Override + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + ApplicationContextUtil.applicationContext = applicationContext; + + } + + + public static T getBean(String beanName) { + return (T) applicationContext.getBean(beanName); + } +} diff --git a/health_common/src/main/java/cn/card/health/common/core/ServletUtils.java b/health_common/src/main/java/cn/card/health/common/core/ServletUtils.java new file mode 100644 index 0000000..2909cb2 --- /dev/null +++ b/health_common/src/main/java/cn/card/health/common/core/ServletUtils.java @@ -0,0 +1,120 @@ +package cn.card.health.common.core; + +import java.io.IOException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import org.springframework.web.context.request.RequestAttributes; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import cn.card.health.common.utils.Convert; +import cn.card.health.common.utils.StringUtils; + +/** + * 客户端工具类 + * + * @author yc + */ +public class ServletUtils { + /** + * 获取String参数 + */ + public static String getParameter(String name) { + return getRequest().getParameter(name); + } + + /** + * 获取String参数 + */ + public static String getParameter(String name, String defaultValue) { + return Convert.toStr(getRequest().getParameter(name), defaultValue); + } + + /** + * 获取Integer参数 + */ + public static Integer getParameterToInt(String name) { + return Convert.toInt(getRequest().getParameter(name)); + } + + /** + * 获取Integer参数 + */ + public static Integer getParameterToInt(String name, Integer defaultValue) { + return Convert.toInt(getRequest().getParameter(name), defaultValue); + } + + /** + * 获取request + */ + public static HttpServletRequest getRequest() { + return getRequestAttributes().getRequest(); + } + + /** + * 获取response + */ + public static HttpServletResponse getResponse() { + return getRequestAttributes().getResponse(); + } + + /** + * 获取session + */ + public static HttpSession getSession() { + return getRequest().getSession(); + } + + public static ServletRequestAttributes getRequestAttributes() { + RequestAttributes attributes = RequestContextHolder.getRequestAttributes(); + return (ServletRequestAttributes) attributes; + } + + /** + * 将字符串渲染到客户端 + * + * @param response 渲染对象 + * @param string 待渲染的字符串 + * @return null + */ + public static String renderString(HttpServletResponse response, String string) { + try { + response.setStatus(200); + response.setContentType("application/json"); + response.setCharacterEncoding("utf-8"); + response.getWriter().print(string); + } catch (IOException e) { + e.printStackTrace(); + } + return null; + } + + /** + * 是否是Ajax异步请求 + * + * @param request + */ + public static boolean isAjaxRequest(HttpServletRequest request) { + String accept = request.getHeader("accept"); + if (accept != null && accept.indexOf("application/json") != -1) { + return true; + } + + String xRequestedWith = request.getHeader("X-Requested-With"); + if (xRequestedWith != null && xRequestedWith.indexOf("XMLHttpRequest") != -1) { + return true; + } + + String uri = request.getRequestURI(); + if (StringUtils.inStringIgnoreCase(uri, ".json", ".xml")) { + return true; + } + + String ajax = request.getParameter("__ajax"); + if (StringUtils.inStringIgnoreCase(ajax, "json", "xml")) { + return true; + } + return false; + } +} diff --git a/health_common/src/main/java/cn/card/health/common/core/SqlUtil.java b/health_common/src/main/java/cn/card/health/common/core/SqlUtil.java new file mode 100644 index 0000000..b2c9d41 --- /dev/null +++ b/health_common/src/main/java/cn/card/health/common/core/SqlUtil.java @@ -0,0 +1,38 @@ +package cn.card.health.common.core; + +import cn.card.health.common.utils.StringUtils; + +/** + * sql操作工具类 + * + * @author yc + */ +public class SqlUtil +{ + /** + * 仅支持字母、数字、下划线、空格、逗号、小数点(支持多个字段排序) + */ + public static String SQL_PATTERN = "[a-zA-Z0-9_\\ \\,\\.]+"; + + /** + * 检查字符,防止注入绕过 + */ + public static String escapeOrderBySql(String value) + { + if (StringUtils.isNotEmpty(value) && !isValidOrderBySql(value)) + { + //TODO 抛出异常 + return null; +// throw new BaseException("参数不符合规范,不能进行查询"); + } + return value; + } + + /** + * 验证 order by 语法是否符合规范 + */ + public static boolean isValidOrderBySql(String value) + { + return value.matches(SQL_PATTERN); + } +} diff --git a/health_common/src/main/java/cn/card/health/common/enums/EnumMethod.java b/health_common/src/main/java/cn/card/health/common/enums/EnumMethod.java new file mode 100644 index 0000000..893939a --- /dev/null +++ b/health_common/src/main/java/cn/card/health/common/enums/EnumMethod.java @@ -0,0 +1,5 @@ +package cn.card.health.common.enums; + +public enum EnumMethod { + GET, POST; +} diff --git a/health_common/src/main/java/cn/card/health/common/exception/base/BaseException.java b/health_common/src/main/java/cn/card/health/common/exception/base/BaseException.java new file mode 100644 index 0000000..b018160 --- /dev/null +++ b/health_common/src/main/java/cn/card/health/common/exception/base/BaseException.java @@ -0,0 +1,97 @@ +package cn.card.health.common.exception.base; + +import cn.card.health.common.utils.MessageUtils; +import cn.card.health.common.utils.StringUtils; + +/** + * 基础异常 + * + * @author ruoyi + */ +public class BaseException extends RuntimeException +{ + private static final long serialVersionUID = 1L; + + /** + * 所属模块 + */ + private String module; + + /** + * 错误码 + */ + private String code; + + /** + * 错误码对应的参数 + */ + private Object[] args; + + /** + * 错误消息 + */ + private String defaultMessage; + + public BaseException(String module, String code, Object[] args, String defaultMessage) + { + this.module = module; + this.code = code; + this.args = args; + this.defaultMessage = defaultMessage; + } + + public BaseException(String module, String code, Object[] args) + { + this(module, code, args, null); + } + + public BaseException(String module, String defaultMessage) + { + this(module, null, null, defaultMessage); + } + + public BaseException(String code, Object[] args) + { + this(null, code, args, null); + } + + public BaseException(String defaultMessage) + { + this(null, null, null, defaultMessage); + } + + @Override + public String getMessage() + { + String message = null; + if (!StringUtils.isEmpty(code)) + { + message = MessageUtils.message(code, args); + } + if (message == null) + { + message = defaultMessage; + } + return message; + } + + public String getModule() + { + return module; + } + + public String getCode() + { + return code; + } + + public Object[] getArgs() + { + return args; + } + + public String getDefaultMessage() + { + return defaultMessage; + } +} diff --git a/health_common/src/main/java/cn/card/health/common/exception/base/ServiceException.java b/health_common/src/main/java/cn/card/health/common/exception/base/ServiceException.java new file mode 100644 index 0000000..03d217d --- /dev/null +++ b/health_common/src/main/java/cn/card/health/common/exception/base/ServiceException.java @@ -0,0 +1,73 @@ +package cn.card.health.common.exception.base; + +/** + * 业务异常 + * + * @author ruoyi + */ +public final class ServiceException extends RuntimeException +{ + private static final long serialVersionUID = 1L; + + /** + * 错误码 + */ + private Integer code; + + /** + * 错误提示 + */ + private String message; + + /** + * 错误明细,内部调试错误 + * + * 和 {@link CommonResult#getDetailMessage()} 一致的设计 + */ + private String detailMessage; + + /** + * 空构造方法,避免反序列化问题 + */ + public ServiceException() + { + } + + public ServiceException(String message) + { + this.message = message; + } + + public ServiceException(String message, Integer code) + { + this.message = message; + this.code = code; + } + + public String getDetailMessage() + { + return detailMessage; + } + + public String getMessage() + { + return message; + } + + public Integer getCode() + { + return code; + } + + public ServiceException setMessage(String message) + { + this.message = message; + return this; + } + + public ServiceException setDetailMessage(String detailMessage) + { + this.detailMessage = detailMessage; + return this; + } +} \ No newline at end of file diff --git a/health_common/src/main/java/cn/card/health/common/page/PageDomain.java b/health_common/src/main/java/cn/card/health/common/page/PageDomain.java new file mode 100644 index 0000000..134c6fc --- /dev/null +++ b/health_common/src/main/java/cn/card/health/common/page/PageDomain.java @@ -0,0 +1,72 @@ +package cn.card.health.common.page; + +import cn.card.health.common.utils.StringUtils; + +/** + * 分页数据 + * + * @author yc + */ +public class PageDomain +{ + /** 当前记录起始索引 */ + private Integer pageNum; + + /** 每页显示记录数 */ + private Integer pageSize; + + /** 排序列 */ + private String orderByColumn; + + /** 排序的方向desc或者asc */ + private String isAsc = "asc"; + + public String getOrderBy() + { + if (StringUtils.isEmpty(orderByColumn)) + { + return ""; + } + return StringUtils.toUnderScoreCase(orderByColumn) + " " + isAsc; + } + + public Integer getPageNum() + { + return pageNum; + } + + public void setPageNum(Integer pageNum) + { + this.pageNum = pageNum; + } + + public Integer getPageSize() + { + return pageSize; + } + + public void setPageSize(Integer pageSize) + { + this.pageSize = pageSize; + } + + public String getOrderByColumn() + { + return orderByColumn; + } + + public void setOrderByColumn(String orderByColumn) + { + this.orderByColumn = orderByColumn; + } + + public String getIsAsc() + { + return isAsc; + } + + public void setIsAsc(String isAsc) + { + this.isAsc = isAsc; + } +} diff --git a/health_common/src/main/java/cn/card/health/common/page/TableDataInfo.java b/health_common/src/main/java/cn/card/health/common/page/TableDataInfo.java new file mode 100644 index 0000000..0afa7be --- /dev/null +++ b/health_common/src/main/java/cn/card/health/common/page/TableDataInfo.java @@ -0,0 +1,85 @@ +package cn.card.health.common.page; + +import java.io.Serializable; +import java.util.List; + +/** + * 表格分页数据对象 + * + * @author yc + */ +public class TableDataInfo implements Serializable +{ + private static final long serialVersionUID = 1L; + + /** 总记录数 */ + private long total; + + /** 列表数据 */ + private List rows; + + /** 消息状态码 */ + private int code; + + /** 消息内容 */ + private String msg; + + /** + * 表格数据对象 + */ + public TableDataInfo() + { + } + + /** + * 分页 + * + * @param list 列表数据 + * @param total 总记录数 + */ + public TableDataInfo(List list, int total) + { + this.rows = list; + this.total = total; + } + + public long getTotal() + { + return total; + } + + public void setTotal(long total) + { + this.total = total; + } + + public List getRows() + { + return rows; + } + + public void setRows(List rows) + { + this.rows = rows; + } + + public int getCode() + { + return code; + } + + public void setCode(int code) + { + this.code = code; + } + + public String getMsg() + { + return msg; + } + + public void setMsg(String msg) + { + this.msg = msg; + } +} diff --git a/health_common/src/main/java/cn/card/health/common/page/TableSupport.java b/health_common/src/main/java/cn/card/health/common/page/TableSupport.java new file mode 100644 index 0000000..bf94775 --- /dev/null +++ b/health_common/src/main/java/cn/card/health/common/page/TableSupport.java @@ -0,0 +1,49 @@ +package cn.card.health.common.page; + +import cn.card.health.common.core.ServletUtils; + +/** + * 表格数据处理 + * + * @author yc + */ +public class TableSupport +{ + /** + * 当前记录起始索引 + */ + public static final String PAGE_NUM = "pageNum"; + + /** + * 每页显示记录数 + */ + public static final String PAGE_SIZE = "pageSize"; + + /** + * 排序列 + */ + public static final String ORDER_BY_COLUMN = "orderByColumn"; + + /** + * 排序的方向 "desc" 或者 "asc". + */ + public static final String IS_ASC = "isAsc"; + + /** + * 封装分页对象 + */ + public static PageDomain getPageDomain() + { + PageDomain pageDomain = new PageDomain(); + pageDomain.setPageNum(ServletUtils.getParameterToInt(PAGE_NUM)); + pageDomain.setPageSize(ServletUtils.getParameterToInt(PAGE_SIZE)); + pageDomain.setOrderByColumn(ServletUtils.getParameter(ORDER_BY_COLUMN)); + pageDomain.setIsAsc(ServletUtils.getParameter(IS_ASC)); + return pageDomain; + } + + public static PageDomain buildPageRequest() + { + return getPageDomain(); + } +} diff --git a/health_common/src/main/java/cn/card/health/common/redis/FastJson2JsonRedisSerializer.java b/health_common/src/main/java/cn/card/health/common/redis/FastJson2JsonRedisSerializer.java new file mode 100644 index 0000000..f1046f7 --- /dev/null +++ b/health_common/src/main/java/cn/card/health/common/redis/FastJson2JsonRedisSerializer.java @@ -0,0 +1,73 @@ +package cn.card.health.common.redis; + +import java.nio.charset.Charset; + +import org.springframework.data.redis.serializer.RedisSerializer; +import org.springframework.data.redis.serializer.SerializationException; +import org.springframework.util.Assert; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.parser.ParserConfig; +import com.alibaba.fastjson.serializer.SerializerFeature; +import com.fasterxml.jackson.databind.JavaType; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.type.TypeFactory; + +/** + * Redis使用FastJson序列化 + * + * @author yc + */ +public class FastJson2JsonRedisSerializer implements RedisSerializer +{ + @SuppressWarnings("unused") + private ObjectMapper objectMapper = new ObjectMapper(); + + public static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8"); + + private Class clazz; + + static + { + ParserConfig.getGlobalInstance().setAutoTypeSupport(true); + } + + public FastJson2JsonRedisSerializer(Class clazz) + { + super(); + this.clazz = clazz; + } + + @Override + public byte[] serialize(T t) throws SerializationException + { + if (t == null) + { + return new byte[0]; + } + return JSON.toJSONString(t, SerializerFeature.WriteClassName).getBytes(DEFAULT_CHARSET); + } + + @Override + public T deserialize(byte[] bytes) throws SerializationException + { + if (bytes == null || bytes.length <= 0) + { + return null; + } + String str = new String(bytes, DEFAULT_CHARSET); + + return JSON.parseObject(str, clazz); + } + + public void setObjectMapper(ObjectMapper objectMapper) + { + Assert.notNull(objectMapper, "'objectMapper' must not be null"); + this.objectMapper = objectMapper; + } + + protected JavaType getJavaType(Class clazz) + { + return TypeFactory.defaultInstance().constructType(clazz); + } +} \ No newline at end of file diff --git a/health_common/src/main/java/cn/card/health/common/redis/RedisAutoConfiguration.java b/health_common/src/main/java/cn/card/health/common/redis/RedisAutoConfiguration.java new file mode 100644 index 0000000..1f6930a --- /dev/null +++ b/health_common/src/main/java/cn/card/health/common/redis/RedisAutoConfiguration.java @@ -0,0 +1,51 @@ +//package cn.card.health.common.redis; +// +//import java.rmi.UnknownHostException; +// +//import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +//import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +//import org.springframework.boot.autoconfigure.data.redis.RedisProperties; +//import org.springframework.boot.context.properties.EnableConfigurationProperties; +//import org.springframework.context.annotation.Bean; +//import org.springframework.context.annotation.Configuration; +//import org.springframework.context.annotation.Import; +//import org.springframework.data.redis.connection.RedisConnectionFactory; +//import org.springframework.data.redis.core.RedisOperations; +//import org.springframework.data.redis.core.RedisTemplate; +//import org.springframework.data.redis.core.StringRedisTemplate; +// +//@Configuration +//@ConditionalOnClass(RedisOperations.class) +//@EnableConfigurationProperties(RedisProperties.class) +////@Import({ LettuceConnectionConfiguration.class, JedisConnectionConfiguration.class }) +//public class RedisAutoConfiguration { +// +// @Bean +//// @ConditionalOnMissingBean(name = "redisTemplate") +// public RedisTemplate redisTemplate( +// +// RedisConnectionFactory redisConnectionFactory) throws UnknownHostException { +// +// RedisTemplate template = new RedisTemplate<>(); +// +// template.setConnectionFactory(redisConnectionFactory); +// +// return template; +// +// } +// +// @Bean +// @ConditionalOnMissingBean +// public StringRedisTemplate stringRedisTemplate( +// +// RedisConnectionFactory redisConnectionFactory) throws UnknownHostException { +// +// StringRedisTemplate template = new StringRedisTemplate(); +// +// template.setConnectionFactory(redisConnectionFactory); +// +// return template; +// +// } +// +//} \ No newline at end of file diff --git a/health_common/src/main/java/cn/card/health/common/redis/RedisCache.java b/health_common/src/main/java/cn/card/health/common/redis/RedisCache.java new file mode 100644 index 0000000..91ffbbc --- /dev/null +++ b/health_common/src/main/java/cn/card/health/common/redis/RedisCache.java @@ -0,0 +1,234 @@ +package cn.card.health.common.redis; + +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.TimeUnit; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.BoundSetOperations; +import org.springframework.data.redis.core.HashOperations; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.core.ValueOperations; +import org.springframework.stereotype.Component; + +/** + * spring redis 工具类 + * + * @author yc + **/ +@SuppressWarnings(value = { "unchecked", "rawtypes" }) +@Component +public class RedisCache +{ + @Autowired + public RedisTemplate redisTemplate; + + /** + * 缓存基本的对象,Integer、String、实体类等 + * + * @param key 缓存的键值 + * @param value 缓存的值 + */ + public void setCacheObject(final String key, final T value) + { + redisTemplate.opsForValue().set(key, value); + } + + /** + * 缓存基本的对象,Integer、String、实体类等 + * + * @param key 缓存的键值 + * @param value 缓存的值 + * @param timeout 时间 + * @param timeUnit 时间颗粒度 + */ + public void setCacheObject(final String key, final T value, final Integer timeout, final TimeUnit timeUnit) + { + redisTemplate.opsForValue().set(key, value, timeout, timeUnit); + } + + /** + * 设置有效时间 + * + * @param key Redis键 + * @param timeout 超时时间 + * @return true=设置成功;false=设置失败 + */ + public boolean expire(final String key, final long timeout) + { + return expire(key, timeout, TimeUnit.SECONDS); + } + + /** + * 设置有效时间 + * + * @param key Redis键 + * @param timeout 超时时间 + * @param unit 时间单位 + * @return true=设置成功;false=设置失败 + */ + public boolean expire(final String key, final long timeout, final TimeUnit unit) + { + return redisTemplate.expire(key, timeout, unit); + } + + /** + * 获得缓存的基本对象。 + * + * @param key 缓存键值 + * @return 缓存键值对应的数据 + */ + public T getCacheObject(final String key) + { + ValueOperations operation = redisTemplate.opsForValue(); + return operation.get(key); + } + + /** + * 删除单个对象 + * + * @param key + */ + public boolean deleteObject(final String key) + { + return redisTemplate.delete(key); + } + + /** + * 删除集合对象 + * + * @param collection 多个对象 + * @return + */ + public long deleteObject(final Collection collection) + { + return redisTemplate.delete(collection); + } + + /** + * 缓存List数据 + * + * @param key 缓存的键值 + * @param dataList 待缓存的List数据 + * @return 缓存的对象 + */ + public long setCacheList(final String key, final List dataList) + { + Long count = redisTemplate.opsForList().rightPushAll(key, dataList); + return count == null ? 0 : count; + } + + /** + * 获得缓存的list对象 + * + * @param key 缓存的键值 + * @return 缓存键值对应的数据 + */ + public List getCacheList(final String key) + { + return redisTemplate.opsForList().range(key, 0, -1); + } + + /** + * 缓存Set + * + * @param key 缓存键值 + * @param dataSet 缓存的数据 + * @return 缓存数据的对象 + */ + public BoundSetOperations setCacheSet(final String key, final Set dataSet) + { + BoundSetOperations setOperation = redisTemplate.boundSetOps(key); + Iterator it = dataSet.iterator(); + while (it.hasNext()) + { + setOperation.add(it.next()); + } + return setOperation; + } + + /** + * 获得缓存的set + * + * @param key + * @return + */ + public Set getCacheSet(final String key) + { + return redisTemplate.opsForSet().members(key); + } + + /** + * 缓存Map + * + * @param key + * @param dataMap + */ + public void setCacheMap(final String key, final Map dataMap) + { + if (dataMap != null) { + redisTemplate.opsForHash().putAll(key, dataMap); + } + } + + /** + * 获得缓存的Map + * + * @param key + * @return + */ + public Map getCacheMap(final String key) + { + return redisTemplate.opsForHash().entries(key); + } + + /** + * 往Hash中存入数据 + * + * @param key Redis键 + * @param hKey Hash键 + * @param value 值 + */ + public void setCacheMapValue(final String key, final String hKey, final T value) + { + redisTemplate.opsForHash().put(key, hKey, value); + } + + /** + * 获取Hash中的数据 + * + * @param key Redis键 + * @param hKey Hash键 + * @return Hash中的对象 + */ + public T getCacheMapValue(final String key, final String hKey) + { + HashOperations opsForHash = redisTemplate.opsForHash(); + return opsForHash.get(key, hKey); + } + + /** + * 获取多个Hash中的数据 + * + * @param key Redis键 + * @param hKeys Hash键集合 + * @return Hash对象集合 + */ + public List getMultiCacheMapValue(final String key, final Collection hKeys) + { + return redisTemplate.opsForHash().multiGet(key, hKeys); + } + + /** + * 获得缓存的基本对象列表 + * + * @param pattern 字符串前缀 + * @return 对象列表 + */ + public Collection keys(final String pattern) + { + return redisTemplate.keys(pattern); + } +} diff --git a/health_common/src/main/java/cn/card/health/common/redis/RedisConfig.java b/health_common/src/main/java/cn/card/health/common/redis/RedisConfig.java new file mode 100644 index 0000000..c485432 --- /dev/null +++ b/health_common/src/main/java/cn/card/health/common/redis/RedisConfig.java @@ -0,0 +1,115 @@ +package cn.card.health.common.redis; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.redis.connection.RedisConnectionFactory; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.serializer.StringRedisSerializer; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.PropertyAccessor; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator; + + +/** + * redis配置类 + * + * @author ZENG.XIAO.YAN + * @date 2018年6月6日 + * + */ +@Configuration +public class RedisConfig { + +// @Bean +// @ConfigurationProperties(prefix = "spring.redis.pool") +// public JedisPoolConfig getRedisConfig() { +// JedisPoolConfig config = new JedisPoolConfig(); +// return config; +// } +// +// @Bean +// @ConfigurationProperties(prefix = "spring.redis") +// public JedisConnectionFactory getConnectionFactory() { +// JedisConnectionFactory factory = new JedisConnectionFactory(); +// factory.setUsePool(true); +// JedisPoolConfig config = getRedisConfig(); +// factory.setPoolConfig(config); +// return factory; +// } +// +// @Bean +// public RedisTemplate getRedisTemplate() { +// JedisConnectionFactory factory = getConnectionFactory(); +// RedisTemplate template = new StringRedisTemplate(factory); +// return template; +// } +// +// @Bean +// public RedisTemplate redisTemplate(RedisConnectionFactory redisConnectionFactory) { +// RedisTemplate template = new RedisTemplate<>(); +// template.setConnectionFactory(redisConnectionFactory); +// Jackson2JsonRedisSerializer ser = new Jackson2JsonRedisSerializer<>(Object.class); +// template.setDefaultSerializer(ser); +// return template; +// } + + + @Bean + @SuppressWarnings(value = { "unchecked", "rawtypes" }) + public RedisTemplate redisTemplate(RedisConnectionFactory connectionFactory) + { + RedisTemplate template = new RedisTemplate<>(); + template.setConnectionFactory(connectionFactory); + + FastJson2JsonRedisSerializer serializer = new FastJson2JsonRedisSerializer(Object.class); + + ObjectMapper mapper = new ObjectMapper(); + mapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); + mapper.activateDefaultTyping(LaissezFaireSubTypeValidator.instance, ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.PROPERTY); + serializer.setObjectMapper(mapper); + + template.setValueSerializer(serializer); + // 使用StringRedisSerializer来序列化和反序列化redis的key值 + template.setKeySerializer(new StringRedisSerializer()); + template.afterPropertiesSet(); + return template; + } + +// @Bean +// @SuppressWarnings("all") +// public RedisTemplate redisTemplate(RedisConnectionFactory factory) { +// +// RedisTemplate template = new RedisTemplate(); +// +// template.setConnectionFactory(factory); +// +// Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class); +// +// ObjectMapper om = new ObjectMapper(); +// +// om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); +// +// om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL); +// +// jackson2JsonRedisSerializer.setObjectMapper(om); +// +// StringRedisSerializer stringRedisSerializer = new StringRedisSerializer(); +// +// // key采用String的序列化方式 +// template.setKeySerializer(stringRedisSerializer); +// +// // hash的key也采用String的序列化方式 +// template.setHashKeySerializer(stringRedisSerializer); +// +// // value序列化方式采用jackson +// template.setValueSerializer(jackson2JsonRedisSerializer); +// +// // hash的value序列化方式采用jackson +// template.setHashValueSerializer(jackson2JsonRedisSerializer); +// template.afterPropertiesSet(); +// return template; +// } +} \ No newline at end of file diff --git a/health_common/src/main/java/cn/card/health/common/redis/RedisConfig3.java b/health_common/src/main/java/cn/card/health/common/redis/RedisConfig3.java new file mode 100644 index 0000000..dfc8bcb --- /dev/null +++ b/health_common/src/main/java/cn/card/health/common/redis/RedisConfig3.java @@ -0,0 +1,49 @@ +package cn.card.health.common.redis; +//package cn.card.health.common.redis; +// +//import org.springframework.cache.annotation.CachingConfigurerSupport; +//import org.springframework.cache.annotation.EnableCaching; +//import org.springframework.context.annotation.Bean; +//import org.springframework.context.annotation.Configuration; +//import org.springframework.data.redis.connection.RedisConnectionFactory; +//import org.springframework.data.redis.core.RedisTemplate; +//import org.springframework.data.redis.serializer.RedisSerializer; +//import org.springframework.data.redis.serializer.StringRedisSerializer; +// +//import com.alibaba.fastjson.support.spring.FastJsonRedisSerializer; +//import com.fasterxml.jackson.annotation.JsonAutoDetect; +//import com.fasterxml.jackson.annotation.JsonTypeInfo; +//import com.fasterxml.jackson.annotation.PropertyAccessor; +//import com.fasterxml.jackson.databind.ObjectMapper; +//import com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator; +// +///** +// * redis配置 +// * +// * @author yc +// */ +//@Configuration +//@EnableCaching +//public class RedisConfig extends CachingConfigurerSupport +//{ +// @Bean +// @SuppressWarnings(value = { "unchecked", "rawtypes" }) +// public RedisTemplate redisTemplate(RedisConnectionFactory connectionFactory) +// { +// RedisTemplate template = new RedisTemplate<>(); +// template.setConnectionFactory(connectionFactory); +// +// RedisSerializer serializer = new FastJsonRedisSerializer(Object.class); +// +// ObjectMapper mapper = new ObjectMapper(); +// mapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); +// mapper.activateDefaultTyping(LaissezFaireSubTypeValidator.instance, ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.PROPERTY); +//// serializer.setObjectMapper(mapper); +// +// template.setValueSerializer(serializer); +// // 使用StringRedisSerializer来序列化和反序列化redis的key值 +// template.setKeySerializer(new StringRedisSerializer()); +// template.afterPropertiesSet(); +// return template; +// } +//} diff --git a/health_common/src/main/java/cn/card/health/common/redis/RedisUtil.java b/health_common/src/main/java/cn/card/health/common/redis/RedisUtil.java new file mode 100644 index 0000000..fd1077d --- /dev/null +++ b/health_common/src/main/java/cn/card/health/common/redis/RedisUtil.java @@ -0,0 +1,875 @@ +package cn.card.health.common.redis; + +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.TimeUnit; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.HashOperations; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.core.ValueOperations; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; + +/** + * Redis工具类 + * + * @author ZENG.XIAO.YAN + * @date 2018年6月7日 + */ +@Component +public final class RedisUtil { + + @Autowired + + private RedisTemplate redisTemplate; + + // =============================common============================ + + /** + * + * 指定缓存失效时间 + * + * @param key 键 + * + * @param time 时间(秒) + * + * @return + * + */ + public boolean expire(String key, long time) { + + try { + if (time > 0) { + redisTemplate.expire(key, time, TimeUnit.SECONDS); + } + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + * + * 根据key 获取过期时间 + * + * @param key 键 不能为null + * + * @return 时间(秒) 返回0代表为永久有效 + * + */ + public long getExpire(String key) { + + return redisTemplate.getExpire(key, TimeUnit.SECONDS); + + } + + /** + * + * 判断key是否存在 + * + * @param key 键 + * + * @return true 存在 false不存在 + * + */ + public boolean hasKey(String key) { + + try { + return redisTemplate.hasKey(key); + } catch (Exception e) { + + e.printStackTrace(); + return false; + } + } + + /** + * + * 删除缓存 + * + * @param key 可以传一个值 或多个 + * + */ + @SuppressWarnings("unchecked") + public void del(String... key) { + + if (key != null && key.length > 0) { + + if (key.length == 1) { + + redisTemplate.delete(key[0]); + + } else { + + redisTemplate.delete(CollectionUtils.arrayToList(key)); + + } + } + } + +// ============================String============================= + + /** + * + * 普通缓存获取 + * + * @param key 键 + * + * @return 值 + * + */ + public Object get(String key) { + + return key == null ? null : redisTemplate.opsForValue().get(key); + + } + + /** + * + * 普通缓存放入 + * + * @param key 键 + * + * @param value 值 + * + * @return true成功 false失败 + * + */ + public boolean set(String key, Object value) { + + try { + + redisTemplate.opsForValue().set(key, value); + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + + } + + } + + /** + * + * 普通缓存放入并设置时间 + * + * @param key 键 + * + * @param value 值 + * + * @param time 时间(秒) time要大于0 如果time小于等于0 将设置无限期 + * + * @return true成功 false 失败 + * + */ + public boolean set(String key, Object value, long time) { + + try { + + if (time > 0) { + + redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS); + + } else { + + set(key, value); + } + return true; + } catch (Exception e) { + + e.printStackTrace(); + + return false; + } + + } + + /** + * + * 递增 + * + * @param key 键 + * + * @param delta 要增加几(大于0) + * + * @return + * + */ + public long incr(String key, long delta) { + + if (delta < 0) { + + throw new RuntimeException("递增因子必须大于0"); + } + return redisTemplate.opsForValue().increment(key, delta); + + } + + /** + * + * 递减 + * + * @param key 键 + * + * @param delta 要减少几(小于0) + * + * @return + * + */ + public long decr(String key, long delta) { + + if (delta < 0) { + + throw new RuntimeException("递减因子必须大于0"); + + } + return redisTemplate.opsForValue().increment(key, -delta); + + } + +// ================================Map================================= + + /** + * + * HashGet + * + * @param key 键 不能为null + * + * @param item 项 不能为null + * + * @return 值 + * + */ + public T hget(String key, String item) { + +// return redisTemplate.opsForHash().get(key, item); + + HashOperations operation = redisTemplate.opsForHash(); + return operation.get(key, item); + } + + /** + * + * 获取hashKey对应的所有键值 + * + * @param key 键 + * + * @return 对应的多个键值 + * + */ + public Map hmget(String key) { + + return redisTemplate.opsForHash().entries(key); + } + + /** + * + * HashSet + * + * @param key 键 + * + * @param map 对应多个键值 + * + * @return true 成功 false 失败 + * + */ + public boolean hmset(String key, Map map) { + + try { + + redisTemplate.opsForHash().putAll(key, map); + + return true; + } catch (Exception e) { + + e.printStackTrace(); + + return false; + } + } + + /** + * + * HashSet 并设置时间 + * + * @param key 键 + * + * @param map 对应多个键值 + * + * @param time 时间(秒) + * + * @return true成功 false失败 + * + */ + public boolean hmset(String key, Map map, long time) { + + try { + + redisTemplate.opsForHash().putAll(key, map); + + if (time > 0) { + + expire(key, time); + + } + return true; + } catch (Exception e) { + + e.printStackTrace(); + + return false; + } + } + + /** + * + * 向一张hash表中放入数据,如果不存在将创建 + * + * @param key 键 + * + * @param item 项 + * + * @param value 值 + * + * @return true 成功 false失败 + * + */ + public boolean hset(String key, String item, T value) { + + try { + + redisTemplate.opsForHash().put(key, item, value); + + return true; + } catch (Exception e) { + + e.printStackTrace(); + + return false; + } + } + + /** + * + * 向一张hash表中放入数据,如果不存在将创建 + * + * @param key 键 + * + * @param item 项 + * + * @param value 值 + * + * @param time 时间(秒) 注意:如果已存在的hash表有时间,这里将会替换原有的时间 + * + * @return true 成功 false失败 + * + */ + public boolean hset(String key, String item, Object value, long time) { + + try { + + redisTemplate.opsForHash().put(key, item, value); + + if (time > 0) { + + expire(key, time); + } + + return true; + } catch (Exception e) { + + e.printStackTrace(); + + return false; + } + } + + /** + * + * 删除hash表中的值 + * + * @param key 键 不能为null + * + * @param item 项 可以使多个 不能为null + * + */ + public void hdel(String key, Object... item) { + + redisTemplate.opsForHash().delete(key, item); + } + + /** + * + * 判断hash表中是否有该项的值 + * + * @param key 键 不能为null + * + * @param item 项 不能为null + * + * @return true 存在 false不存在 + * + */ + public boolean hHasKey(String key, String item) { + + return redisTemplate.opsForHash().hasKey(key, item); + } + + /** + * + * hash递增 如果不存在,就会创建一个 并把新增后的值返回 + * + * @param key 键 + * + * @param item 项 + * + * @param by 要增加几(大于0) + * + * @return + * + */ + public double hincr(String key, String item, double by) { + + return redisTemplate.opsForHash().increment(key, item, by); + } + + /** + * + * hash递减 + * + * @param key 键 + * + * @param item 项 + * + * @param by 要减少记(小于0) + * + * @return + * + */ + public double hdecr(String key, String item, double by) { + + return redisTemplate.opsForHash().increment(key, item, -by); + } + +// ============================set============================= + + /** + * + * 根据key获取Set中的所有值 + * + * @param key 键 + * + * @return + * + */ + public Set sGet(String key) { + + try { + + return redisTemplate.opsForSet().members(key); + + } catch (Exception e) { + + e.printStackTrace(); + + return null; + } + } + + /** + * + * 根据value从一个set中查询,是否存在 + * + * @param key 键 + * + * @param value 值 + * + * @return true 存在 false不存在 + * + */ + public boolean sHasKey(String key, Object value) { + + try { + + return redisTemplate.opsForSet().isMember(key, value); + + } catch (Exception e) { + + e.printStackTrace(); + + return false; + } + } + + /** + * + * 将数据放入set缓存 + * + * @param key 键 + * + * @param values 值 可以是多个 + * + * @return 成功个数 + * + */ + public long sSet(String key, Object... values) { + + try { + + return redisTemplate.opsForSet().add(key, values); + + } catch (Exception e) { + + e.printStackTrace(); + + return 0; + } + } + + /** + * + * 将set数据放入缓存 + * + * @param key 键 + * + * @param time 时间(秒) + * + * @param values 值 可以是多个 + * + * @return 成功个数 + * + */ + public long sSetAndTime(String key, long time, Object... values) { + + try { + + Long count = redisTemplate.opsForSet().add(key, values); + + if (time > 0) + + expire(key, time); + + return count; + + } catch (Exception e) { + + e.printStackTrace(); + + return 0; + + } + } + + /** + * + * 获取set缓存的长度 + * + * @param key 键 + * + * @return + * + */ + public long sGetSetSize(String key) { + + try { + + return redisTemplate.opsForSet().size(key); + + } catch (Exception e) { + + e.printStackTrace(); + + return 0; + } + } + + /** + * + * 移除值为value的 + * + * @param key 键 + * + * @param values 值 可以是多个 + * + * @return 移除的个数 + * + */ + public long setRemove(String key, Object... values) { + + try { + + Long count = redisTemplate.opsForSet().remove(key, values); + + return count; + + } catch (Exception e) { + + e.printStackTrace(); + + return 0; + } + } + +// ===============================list================================= + + /** + * + * 获取list缓存的内容 + * + * @param key 键 + * + * @param start 开始 + * + * @param end 结束 0 到 -1代表所有值 + * + * @return + * + */ + public List lGet(String key, long start, long end) { + + try { + + return redisTemplate.opsForList().range(key, start, end); + + } catch (Exception e) { + + e.printStackTrace(); + + return null; + } + } + + /** + * + * 获取list缓存的长度 + * + * @param key 键 + * + * @return + * + */ + public long lGetListSize(String key) { + + try { + + return redisTemplate.opsForList().size(key); + + } catch (Exception e) { + + e.printStackTrace(); + + return 0; + } + } + + /** + * + * 通过索引 获取list中的值 + * + * @param key 键 + * + * @param index 索引 index>=0时, 0 表头,1 第二个元素,依次类推;index<0时,-1,表尾,-2倒数第二个元素,依次类推 + * + * @return + * + */ + public Object lGetIndex(String key, long index) { + + try { + + return redisTemplate.opsForList().index(key, index); + + } catch (Exception e) { + + e.printStackTrace(); + + return null; + } + } + + /** + * + * 将list放入缓存 + * + * @param key 键 + * + * @param value 值 + * + * @param time 时间(秒) + * + * @return + * + */ + public boolean lSet(String key, Object value) { + + try { + + redisTemplate.opsForList().rightPush(key, value); + + return true; + + } catch (Exception e) { + + e.printStackTrace(); + + return false; + } + } + + /** + * + * 将list放入缓存 + * + * @param key 键 + * + * @param value 值 + * + * @param time 时间(秒) + * + * @return + * + */ + public boolean lSet(String key, Object value, long time) { + + try { + + redisTemplate.opsForList().rightPush(key, value); + + if (time > 0) + + expire(key, time); + + return true; + + } catch (Exception e) { + + e.printStackTrace(); + + return false; + } + } + + /** + * + * 将list放入缓存 + * + * @param key 键 + * + * @param value 值 + * + * @param time 时间(秒) + * + * @return + * + */ + public boolean lSet(String key, List value) { + + try { + + redisTemplate.opsForList().rightPushAll(key, value); + + return true; + + } catch (Exception e) { + + e.printStackTrace(); + + return false; + } + } + + /** + * + * 将list放入缓存 + * + * + * + * @param key 键 + * + * @param value 值 + * + * @param time 时间(秒) + * + * @return + * + */ + public boolean lSet(String key, List value, long time) { + + try { + + redisTemplate.opsForList().rightPushAll(key, value); + + if (time > 0) + + expire(key, time); + + return true; + + } catch (Exception e) { + + e.printStackTrace(); + + return false; + } + } + + /** + * + * 根据索引修改list中的某条数据 + * + * @param key 键 + * + * @param index 索引 + * + * @param value 值 + * + * @return + * + */ + public boolean lUpdateIndex(String key, long index, Object value) { + + try { + + redisTemplate.opsForList().set(key, index, value); + + return true; + + } catch (Exception e) { + + e.printStackTrace(); + + return false; + } + } + + /** + * + * 移除N个值为value + * + * @param key 键 + * + * @param count 移除多少个 + * + * @param value 值 + * + * @return 移除的个数 + * + */ + public long lRemove(String key, long count, Object value) { + + try { + + Long remove = redisTemplate.opsForList().remove(key, count, value); + + return remove; + + } catch (Exception e) { + + e.printStackTrace(); + + return 0; + } + } + +} \ No newline at end of file diff --git a/health_common/src/main/java/cn/card/health/common/utils/BaseResultJSON.java b/health_common/src/main/java/cn/card/health/common/utils/BaseResultJSON.java new file mode 100644 index 0000000..567ef29 --- /dev/null +++ b/health_common/src/main/java/cn/card/health/common/utils/BaseResultJSON.java @@ -0,0 +1,161 @@ +package cn.card.health.common.utils; + +import com.alibaba.fastjson.JSONObject; + +/** + * 返回类型 + * + * @author xinggm + * @date 2021年5月27日 + */ +public class BaseResultJSON extends JSONObject { + private static final long serialVersionUID = 1L; + + /** 状态码 */ + public static final String CODE_TAG = "code"; + + /** 返回内容 */ + public static final String MSG_TAG = "msg"; + + /** 数据对象 */ + public static final String DATA_TAG = "data"; + + /** + * 初始化一个新创建的 BaseResultJSON 对象,使其表示一个空消息。 + */ + public BaseResultJSON() + { + } + + /** + * 初始化一个新创建的 BaseResultJSON 对象 + * + * @param code 状态码 + * @param msg 返回内容 + */ + public BaseResultJSON(int code, String msg) + { + super.put(CODE_TAG, code); + super.put(MSG_TAG, msg); + } + + /** + * 初始化一个新创建的 BaseResultJSON 对象 + * + * @param code 状态码 + * @param msg 返回内容 + * @param data 数据对象 + */ + public BaseResultJSON(int code, String msg, Object data) + { + super.put(CODE_TAG, code); + super.put(MSG_TAG, msg); + if (StringUtils.isNotNull(data)) + { + super.put(DATA_TAG, data); + } + } + + /** + * 返回成功消息 + * + * @return 成功消息 + */ + public static BaseResultJSON success() + { + return BaseResultJSON.success("操作成功"); + } + + /** + * 返回成功数据 + * + * @return 成功消息 + * @throws Exception + */ + public static BaseResultJSON success(Object data) + { + if(data == null){ + return BaseResultJSON.error(HttpStatus.NO_CONTENT, "未查到数据"); + } + return BaseResultJSON.success("操作成功", data); + } + + /** + * 返回成功消息 + * + * @param msg 返回内容 + * @return 成功消息 + */ + public static BaseResultJSON success(String msg) + { + return BaseResultJSON.success(msg, null); + } + + /** + * 返回成功消息 + * + * @param msg 返回内容 + * @param data 数据对象 + * @return 成功消息 + */ + public static BaseResultJSON success(String msg, Object data) + { + return new BaseResultJSON(HttpStatus.SUCCESS, msg, data); + } + + /** + * 返回错误消息 + * + * @return + */ + public static BaseResultJSON error() + { + return BaseResultJSON.error("操作失败"); + } + + /** + * 返回错误消息 + * + * @param msg 返回内容 + * @return 警告消息 + */ + public static BaseResultJSON error(String msg) + { + return BaseResultJSON.error(msg, null); + } + + /** + * 返回错误消息 + * + * @param data 返回内容 + * @return 警告消息 + */ + public static BaseResultJSON error(Object data) + { + return BaseResultJSON.error("", data); + } + + /** + * 返回错误消息 + * + * @param msg 返回内容 + * @param data 数据对象 + * @return 警告消息 + */ + public static BaseResultJSON error(String msg, Object data) + { + return new BaseResultJSON(HttpStatus.ERROR, msg, data); + } + + /** + * 返回错误消息 + * + * @param code 状态码 + * @param msg 返回内容 + * @return 警告消息 + */ + public static BaseResultJSON error(int code, String msg) + { + return new BaseResultJSON(code, msg, null); + } +} diff --git a/health_common/src/main/java/cn/card/health/common/utils/CharsetKit.java b/health_common/src/main/java/cn/card/health/common/utils/CharsetKit.java new file mode 100644 index 0000000..0d0c537 --- /dev/null +++ b/health_common/src/main/java/cn/card/health/common/utils/CharsetKit.java @@ -0,0 +1,77 @@ +package cn.card.health.common.utils; + +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; + +/** + * 字符集工具类 + * + * @author yc + */ +public class CharsetKit { + /** ISO-8859-1 */ + public static final String ISO_8859_1 = "ISO-8859-1"; + /** UTF-8 */ + public static final String UTF_8 = "UTF-8"; + /** GBK */ + public static final String GBK = "GBK"; + + /** ISO-8859-1 */ + public static final Charset CHARSET_ISO_8859_1 = Charset.forName(ISO_8859_1); + /** UTF-8 */ + public static final Charset CHARSET_UTF_8 = Charset.forName(UTF_8); + /** GBK */ + public static final Charset CHARSET_GBK = Charset.forName(GBK); + + /** + * 转换为Charset对象 + * + * @param charset 字符集,为空则返回默认字符集 + * @return Charset + */ + public static Charset charset(String charset) { + return StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset); + } + + /** + * 转换字符串的字符集编码 + * + * @param source 字符串 + * @param srcCharset 源字符集,默认ISO-8859-1 + * @param destCharset 目标字符集,默认UTF-8 + * @return 转换后的字符集 + */ + public static String convert(String source, String srcCharset, String destCharset) { + return convert(source, Charset.forName(srcCharset), Charset.forName(destCharset)); + } + + /** + * 转换字符串的字符集编码 + * + * @param source 字符串 + * @param srcCharset 源字符集,默认ISO-8859-1 + * @param destCharset 目标字符集,默认UTF-8 + * @return 转换后的字符集 + */ + public static String convert(String source, Charset srcCharset, Charset destCharset) { + if (null == srcCharset) { + srcCharset = StandardCharsets.ISO_8859_1; + } + + if (null == destCharset) { + destCharset = StandardCharsets.UTF_8; + } + + if (StringUtils.isEmpty(source) || srcCharset.equals(destCharset)) { + return source; + } + return new String(source.getBytes(srcCharset), destCharset); + } + + /** + * @return 系统字符集编码 + */ + public static String systemCharset() { + return Charset.defaultCharset().name(); + } +} diff --git a/health_common/src/main/java/cn/card/health/common/utils/Convert.java b/health_common/src/main/java/cn/card/health/common/utils/Convert.java new file mode 100644 index 0000000..3f491b1 --- /dev/null +++ b/health_common/src/main/java/cn/card/health/common/utils/Convert.java @@ -0,0 +1,1004 @@ +package cn.card.health.common.utils; + +import java.math.BigDecimal; +import java.math.BigInteger; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.text.NumberFormat; +import java.util.Set; +import org.apache.commons.lang3.ArrayUtils; + +/** + * 类型转换器 + * + * @author yc + */ +public class Convert +{ + /** + * 转换为字符串
+ * 如果给定的值为null,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static String toStr(Object value, String defaultValue) + { + if (null == value) + { + return defaultValue; + } + if (value instanceof String) + { + return (String) value; + } + return value.toString(); + } + + /** + * 转换为字符串
+ * 如果给定的值为null,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static String toStr(Object value) + { + return toStr(value, null); + } + + /** + * 转换为字符
+ * 如果给定的值为null,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Character toChar(Object value, Character defaultValue) + { + if (null == value) + { + return defaultValue; + } + if (value instanceof Character) + { + return (Character) value; + } + + final String valueStr = toStr(value, null); + return StringUtils.isEmpty(valueStr) ? defaultValue : valueStr.charAt(0); + } + + /** + * 转换为字符
+ * 如果给定的值为null,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Character toChar(Object value) + { + return toChar(value, null); + } + + /** + * 转换为byte
+ * 如果给定的值为null,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Byte toByte(Object value, Byte defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof Byte) + { + return (Byte) value; + } + if (value instanceof Number) + { + return ((Number) value).byteValue(); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + return Byte.parseByte(valueStr); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为byte
+ * 如果给定的值为null,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Byte toByte(Object value) + { + return toByte(value, null); + } + + /** + * 转换为Short
+ * 如果给定的值为null,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Short toShort(Object value, Short defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof Short) + { + return (Short) value; + } + if (value instanceof Number) + { + return ((Number) value).shortValue(); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + return Short.parseShort(valueStr.trim()); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为Short
+ * 如果给定的值为null,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Short toShort(Object value) + { + return toShort(value, null); + } + + /** + * 转换为Number
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Number toNumber(Object value, Number defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof Number) + { + return (Number) value; + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + return NumberFormat.getInstance().parse(valueStr); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为Number
+ * 如果给定的值为空,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Number toNumber(Object value) + { + return toNumber(value, null); + } + + /** + * 转换为int
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Integer toInt(Object value, Integer defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof Integer) + { + return (Integer) value; + } + if (value instanceof Number) + { + return ((Number) value).intValue(); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + return Integer.parseInt(valueStr.trim()); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为int
+ * 如果给定的值为null,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Integer toInt(Object value) + { + return toInt(value, null); + } + + /** + * 转换为Integer数组
+ * + * @param str 被转换的值 + * @return 结果 + */ + public static Integer[] toIntArray(String str) + { + return toIntArray(",", str); + } + + /** + * 转换为Long数组
+ * + * @param str 被转换的值 + * @return 结果 + */ + public static Long[] toLongArray(String str) + { + return toLongArray(",", str); + } + + /** + * 转换为Integer数组
+ * + * @param split 分隔符 + * @param split 被转换的值 + * @return 结果 + */ + public static Integer[] toIntArray(String split, String str) + { + if (StringUtils.isEmpty(str)) + { + return new Integer[] {}; + } + String[] arr = str.split(split); + final Integer[] ints = new Integer[arr.length]; + for (int i = 0; i < arr.length; i++) + { + final Integer v = toInt(arr[i], 0); + ints[i] = v; + } + return ints; + } + + /** + * 转换为Long数组
+ * + * @param split 分隔符 + * @param str 被转换的值 + * @return 结果 + */ + public static Long[] toLongArray(String split, String str) + { + if (StringUtils.isEmpty(str)) + { + return new Long[] {}; + } + String[] arr = str.split(split); + final Long[] longs = new Long[arr.length]; + for (int i = 0; i < arr.length; i++) + { + final Long v = toLong(arr[i], null); + longs[i] = v; + } + return longs; + } + + /** + * 转换为String数组
+ * + * @param str 被转换的值 + * @return 结果 + */ + public static String[] toStrArray(String str) + { + return toStrArray(",", str); + } + + /** + * 转换为String数组
+ * + * @param split 分隔符 + * @param split 被转换的值 + * @return 结果 + */ + public static String[] toStrArray(String split, String str) + { + return str.split(split); + } + + /** + * 转换为long
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Long toLong(Object value, Long defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof Long) + { + return (Long) value; + } + if (value instanceof Number) + { + return ((Number) value).longValue(); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + // 支持科学计数法 + return new BigDecimal(valueStr.trim()).longValue(); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为long
+ * 如果给定的值为null,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Long toLong(Object value) + { + return toLong(value, null); + } + + /** + * 转换为double
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Double toDouble(Object value, Double defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof Double) + { + return (Double) value; + } + if (value instanceof Number) + { + return ((Number) value).doubleValue(); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + // 支持科学计数法 + return new BigDecimal(valueStr.trim()).doubleValue(); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为double
+ * 如果给定的值为空,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Double toDouble(Object value) + { + return toDouble(value, null); + } + + /** + * 转换为Float
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Float toFloat(Object value, Float defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof Float) + { + return (Float) value; + } + if (value instanceof Number) + { + return ((Number) value).floatValue(); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + return Float.parseFloat(valueStr.trim()); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为Float
+ * 如果给定的值为空,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Float toFloat(Object value) + { + return toFloat(value, null); + } + + /** + * 转换为boolean
+ * String支持的值为:true、false、yes、ok、no,1,0 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Boolean toBool(Object value, Boolean defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof Boolean) + { + return (Boolean) value; + } + String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + valueStr = valueStr.trim().toLowerCase(); + switch (valueStr) + { + case "true": + return true; + case "false": + return false; + case "yes": + return true; + case "ok": + return true; + case "no": + return false; + case "1": + return true; + case "0": + return false; + default: + return defaultValue; + } + } + + /** + * 转换为boolean
+ * 如果给定的值为空,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Boolean toBool(Object value) + { + return toBool(value, null); + } + + /** + * 转换为Enum对象
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * + * @param clazz Enum的Class + * @param value 值 + * @param defaultValue 默认值 + * @return Enum + */ + public static > E toEnum(Class clazz, Object value, E defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (clazz.isAssignableFrom(value.getClass())) + { + @SuppressWarnings("unchecked") + E myE = (E) value; + return myE; + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + return Enum.valueOf(clazz, valueStr); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为Enum对象
+ * 如果给定的值为空,或者转换失败,返回默认值null
+ * + * @param clazz Enum的Class + * @param value 值 + * @return Enum + */ + public static > E toEnum(Class clazz, Object value) + { + return toEnum(clazz, value, null); + } + + /** + * 转换为BigInteger
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static BigInteger toBigInteger(Object value, BigInteger defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof BigInteger) + { + return (BigInteger) value; + } + if (value instanceof Long) + { + return BigInteger.valueOf((Long) value); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + return new BigInteger(valueStr); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为BigInteger
+ * 如果给定的值为空,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static BigInteger toBigInteger(Object value) + { + return toBigInteger(value, null); + } + + /** + * 转换为BigDecimal
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static BigDecimal toBigDecimal(Object value, BigDecimal defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof BigDecimal) + { + return (BigDecimal) value; + } + if (value instanceof Long) + { + return new BigDecimal((Long) value); + } + if (value instanceof Double) + { + return new BigDecimal((Double) value); + } + if (value instanceof Integer) + { + return new BigDecimal((Integer) value); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + return new BigDecimal(valueStr); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为BigDecimal
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static BigDecimal toBigDecimal(Object value) + { + return toBigDecimal(value, null); + } + + /** + * 将对象转为字符串
+ * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法 + * + * @param obj 对象 + * @return 字符串 + */ + public static String utf8Str(Object obj) + { + return str(obj, CharsetKit.CHARSET_UTF_8); + } + + /** + * 将对象转为字符串
+ * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法 + * + * @param obj 对象 + * @param charsetName 字符集 + * @return 字符串 + */ + public static String str(Object obj, String charsetName) + { + return str(obj, Charset.forName(charsetName)); + } + + /** + * 将对象转为字符串
+ * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法 + * + * @param obj 对象 + * @param charset 字符集 + * @return 字符串 + */ + public static String str(Object obj, Charset charset) + { + if (null == obj) + { + return null; + } + + if (obj instanceof String) + { + return (String) obj; + } + else if (obj instanceof byte[]) + { + return str((byte[]) obj, charset); + } + else if (obj instanceof Byte[]) + { + byte[] bytes = ArrayUtils.toPrimitive((Byte[]) obj); + return str(bytes, charset); + } + else if (obj instanceof ByteBuffer) + { + return str((ByteBuffer) obj, charset); + } + return obj.toString(); + } + + /** + * 将byte数组转为字符串 + * + * @param bytes byte数组 + * @param charset 字符集 + * @return 字符串 + */ + public static String str(byte[] bytes, String charset) + { + return str(bytes, StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset)); + } + + /** + * 解码字节码 + * + * @param data 字符串 + * @param charset 字符集,如果此字段为空,则解码的结果取决于平台 + * @return 解码后的字符串 + */ + public static String str(byte[] data, Charset charset) + { + if (data == null) + { + return null; + } + + if (null == charset) + { + return new String(data); + } + return new String(data, charset); + } + + /** + * 将编码的byteBuffer数据转换为字符串 + * + * @param data 数据 + * @param charset 字符集,如果为空使用当前系统字符集 + * @return 字符串 + */ + public static String str(ByteBuffer data, String charset) + { + if (data == null) + { + return null; + } + + return str(data, Charset.forName(charset)); + } + + /** + * 将编码的byteBuffer数据转换为字符串 + * + * @param data 数据 + * @param charset 字符集,如果为空使用当前系统字符集 + * @return 字符串 + */ + public static String str(ByteBuffer data, Charset charset) + { + if (null == charset) + { + charset = Charset.defaultCharset(); + } + return charset.decode(data).toString(); + } + + // ----------------------------------------------------------------------- 全角半角转换 + /** + * 半角转全角 + * + * @param input String. + * @return 全角字符串. + */ + public static String toSBC(String input) + { + return toSBC(input, null); + } + + /** + * 半角转全角 + * + * @param input String + * @param notConvertSet 不替换的字符集合 + * @return 全角字符串. + */ + public static String toSBC(String input, Set notConvertSet) + { + char c[] = input.toCharArray(); + for (int i = 0; i < c.length; i++) + { + if (null != notConvertSet && notConvertSet.contains(c[i])) + { + // 跳过不替换的字符 + continue; + } + + if (c[i] == ' ') + { + c[i] = '\u3000'; + } + else if (c[i] < '\177') + { + c[i] = (char) (c[i] + 65248); + + } + } + return new String(c); + } + + /** + * 全角转半角 + * + * @param input String. + * @return 半角字符串 + */ + public static String toDBC(String input) + { + return toDBC(input, null); + } + + /** + * 替换全角为半角 + * + * @param text 文本 + * @param notConvertSet 不替换的字符集合 + * @return 替换后的字符 + */ + public static String toDBC(String text, Set notConvertSet) + { + char c[] = text.toCharArray(); + for (int i = 0; i < c.length; i++) + { + if (null != notConvertSet && notConvertSet.contains(c[i])) + { + // 跳过不替换的字符 + continue; + } + + if (c[i] == '\u3000') + { + c[i] = ' '; + } + else if (c[i] > '\uFF00' && c[i] < '\uFF5F') + { + c[i] = (char) (c[i] - 65248); + } + } + String returnString = new String(c); + + return returnString; + } + + /** + * 数字金额大写转换 先写个完整的然后将如零拾替换成零 + * + * @param n 数字 + * @return 中文大写数字 + */ + public static String digitUppercase(double n) + { + String[] fraction = { "角", "分" }; + String[] digit = { "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" }; + String[][] unit = { { "元", "万", "亿" }, { "", "拾", "佰", "仟" } }; + + String head = n < 0 ? "负" : ""; + n = Math.abs(n); + + String s = ""; + for (int i = 0; i < fraction.length; i++) + { + s += (digit[(int) (Math.floor(n * 10 * Math.pow(10, i)) % 10)] + fraction[i]).replaceAll("(零.)+", ""); + } + if (s.length() < 1) + { + s = "整"; + } + int integerPart = (int) Math.floor(n); + + for (int i = 0; i < unit[0].length && integerPart > 0; i++) + { + String p = ""; + for (int j = 0; j < unit[1].length && n > 0; j++) + { + p = digit[integerPart % 10] + unit[1][j] + p; + integerPart = integerPart / 10; + } + s = p.replaceAll("(零.)*零$", "").replaceAll("^$", "零") + unit[0][i] + s; + } + return head + s.replaceAll("(零.)*零元", "元").replaceFirst("(零.)+", "").replaceAll("(零.)+", "零").replaceAll("^整$", "零元整"); + } +} diff --git a/health_common/src/main/java/cn/card/health/common/utils/DateUtils.java b/health_common/src/main/java/cn/card/health/common/utils/DateUtils.java new file mode 100644 index 0000000..a26cf6d --- /dev/null +++ b/health_common/src/main/java/cn/card/health/common/utils/DateUtils.java @@ -0,0 +1,171 @@ +package cn.card.health.common.utils; + +import java.lang.management.ManagementFactory; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.util.Date; + +import org.apache.commons.lang3.time.DateFormatUtils; + +/** + * 时间工具类 + * + * @author yc + */ +public class DateUtils extends org.apache.commons.lang3.time.DateUtils { + public static String YYYY = "yyyy"; + + public static String YYYY_MM = "yyyy-MM"; + + public static String YYYY_MM_DD = "yyyy-MM-dd"; + + public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss"; + public static String YYYYMMDDHHMMSSsss = "yyyyMMddHHmmssSSS"; + + public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss"; + + public static String YYYY_MM_DD_HH_MM = "yyyy-MM-dd HH:mm"; + + private static String[] parsePatterns = { "yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM", + "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM", "yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", + "yyyy.MM.dd HH:mm", "yyyy.MM" }; + + /** + * 获取当前Date型日期 + * + * @return Date() 当前日期 + */ + public static Date getNowDate() { + return new Date(); + } + + /** + * 获取当前日期, 默认格式为yyyy-MM-dd + * + * @return String + */ + public static String getDate() { + return dateTimeNow(YYYY_MM_DD); + } + + public static final String getTime() { + return dateTimeNow(YYYY_MM_DD_HH_MM_SS); + } + public static final String getDateTimes() { + return dateTimeNow(YYYYMMDDHHMMSSsss); + } + + public static final String dateTimeNow() { + return dateTimeNow(YYYYMMDDHHMMSS); + } + + public static final String dateTimeNow(final String format) { + return parseDateToStr(format, new Date()); + } + + public static final String dateTime(final Date date) { + return parseDateToStr(YYYY_MM_DD, date); + } + + public static final String dateTimeHMS(final Date date) { + return parseDateToStr(YYYY_MM_DD_HH_MM_SS, date); + } + + public static final String parseDateToStr(final String format, final Date date) { + return new SimpleDateFormat(format).format(date); + } + + public static final Date dateTime(final String format, final String ts) { + try { + return new SimpleDateFormat(format).parse(ts); + } catch (ParseException e) { + throw new RuntimeException(e); + } + } + + /** + * 日期路径 即年/月/日 如2018/08/08 + */ + public static final String datePath() { + Date now = new Date(); + return DateFormatUtils.format(now, "yyyy/MM/dd"); + } + + /** + * 日期路径 即年/月/日 如20180808 + */ + public static final String dateTime() { + Date now = new Date(); + return DateFormatUtils.format(now, "yyyyMMdd"); + } + + /** + * 日期型字符串转化为日期 格式 + */ + public static Date parseDate(Object str) { + if (str == null) { + return null; + } + try { + return parseDate(str.toString(), parsePatterns); + } catch (ParseException e) { + return null; + } + } + + /** + * 获取服务器启动时间 + */ + public static Date getServerStartDate() { + long time = ManagementFactory.getRuntimeMXBean().getStartTime(); + return new Date(time); + } + + /** + * 计算两个时间差 + */ + public static String getDatePoor(Date endDate, Date nowDate) { + long nd = 1000 * 24 * 60 * 60; + long nh = 1000 * 60 * 60; + long nm = 1000 * 60; + // long ns = 1000; + // 获得两个时间的毫秒时间差异 + long diff = endDate.getTime() - nowDate.getTime(); + // 计算差多少天 + long day = diff / nd; + // 计算差多少小时 + long hour = diff % nd / nh; + // 计算差多少分钟 + long min = diff % nd % nh / nm; + // 计算差多少秒//输出结果 + // long sec = diff % nd % nh % nm / ns; + return day + "天" + hour + "小时" + min + "分钟"; + } + + /** + * 返回轨迹rangeid + * + * @param rangetime + * @return + * @throws ParseException + */ + public static int getDateRangeid(String rangetime) throws ParseException { + String[] ranges = rangetime.split(","); + int rangeid = 1; + long now = System.currentTimeMillis(); + String yyyyMMdd = LocalDate.now().getYear() + "-" + LocalDate.now().getMonthValue() + "-" + + LocalDate.now().getDayOfMonth() + " "; + for (String range : ranges) { + String[] rangeHours = range.split("-"); + long begin = parseDate(yyyyMMdd + rangeHours[0], YYYY_MM_DD_HH_MM).getTime(); + long end = parseDate(yyyyMMdd + rangeHours[1], YYYY_MM_DD_HH_MM).getTime(); + if (now > begin && now < end) { + break; + } else { + rangeid++; + } + } + return rangeid; + } +} diff --git a/health_common/src/main/java/cn/card/health/common/utils/ExceptionUtil.java b/health_common/src/main/java/cn/card/health/common/utils/ExceptionUtil.java new file mode 100644 index 0000000..90bddce --- /dev/null +++ b/health_common/src/main/java/cn/card/health/common/utils/ExceptionUtil.java @@ -0,0 +1,40 @@ +package cn.card.health.common.utils; + +import java.io.PrintWriter; +import java.io.StringWriter; +import org.apache.commons.lang3.exception.ExceptionUtils; + +/** + * 错误信息处理类。 + * + * @author yc + */ +public class ExceptionUtil +{ + /** + * 获取exception的详细错误信息。 + */ + public static String getExceptionMessage(Throwable e) + { + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw, true)); + String str = sw.toString(); + return str; + } + + public static String getRootErrorMseeage(Exception e) + { + Throwable root = ExceptionUtils.getRootCause(e); + root = (root == null ? e : root); + if (root == null) + { + return ""; + } + String msg = root.getMessage(); + if (msg == null) + { + return "null"; + } + return StringUtils.defaultString(msg); + } +} diff --git a/health_common/src/main/java/cn/card/health/common/utils/HttpStatus.java b/health_common/src/main/java/cn/card/health/common/utils/HttpStatus.java new file mode 100644 index 0000000..52d2e25 --- /dev/null +++ b/health_common/src/main/java/cn/card/health/common/utils/HttpStatus.java @@ -0,0 +1,60 @@ +package cn.card.health.common.utils; + +/** + * 返回状态码 + * + * @author yc + */ +public class HttpStatus +{ + /** 操作成功 */ + public static final int SUCCESS = 200; + + /** 对象创建成功 */ + public static final int CREATED = 201; + + /** 请求已经被接受 */ + public static final int ACCEPTED = 202; + + /** 操作已经执行成功,但是没有返回数据 */ + public static final int NO_CONTENT = 204; + + /** 资源已被移除 */ + public static final int MOVED_PERM = 301; + + /** 重定向 */ + public static final int SEE_OTHER = 303; + + /** 资源没有被修改 */ + public static final int NOT_MODIFIED = 304; + + /** 参数列表错误(缺少,格式不匹配)*/ + public static final int BAD_REQUEST = 400; + + /** 未授权 */ + public static final int UNAUTHORIZED = 401; + + /** 访问受限,授权过期 */ + public static final int FORBIDDEN = 403; + + /** 资源,服务未找到 */ + public static final int NOT_FOUND = 404; + + /** 不允许的http方法 */ + public static final int BAD_METHOD = 405; + + /** 资源冲突,或者资源被锁 */ + public static final int CONFLICT = 409; + + /** 不支持的数据,媒体类型 */ + public static final int UNSUPPORTED_TYPE = 415; + + /** 系统内部错误 */ + public static final int ERROR = 500; + + /** 接口未实现 */ + public static final int NOT_IMPLEMENTED = 501; + + /** 自定义错误 */ + public static final int ERROR_CUSTOM = 503; +} diff --git a/health_common/src/main/java/cn/card/health/common/utils/HttpUtils.java b/health_common/src/main/java/cn/card/health/common/utils/HttpUtils.java new file mode 100644 index 0000000..d847507 --- /dev/null +++ b/health_common/src/main/java/cn/card/health/common/utils/HttpUtils.java @@ -0,0 +1,360 @@ +package cn.card.health.common.utils; + +import java.io.*; +import java.net.ConnectException; +import java.net.SocketTimeoutException; +import java.net.URL; +import java.net.URLConnection; +import java.security.cert.X509Certificate; + +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSession; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; + +import org.apache.http.HttpEntity; +import org.apache.http.HttpResponse; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.StringEntity; +import org.apache.http.util.EntityUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 通用http发送方法 + * + * @author yc + */ +public class HttpUtils { + private static final Logger log = LoggerFactory.getLogger(HttpUtils.class); + + /** + * 向指定 URL 发送GET方法的请求 + * + * @param url 发送请求的 URL + * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。 + * @return 所代表远程资源的响应结果 + */ + public static String sendGet(String url, String param) { + return sendGet(url, param, "utf-8"); + } + + /** + * 向指定 URL 发送GET方法的请求 + * + * @param url 发送请求的 URL + * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。 + * @param contentType 编码类型 + * @return 所代表远程资源的响应结果 + */ + public static String sendGet(String url, String param, String contentType) { + StringBuilder result = new StringBuilder(); + BufferedReader in = null; + try { + String urlNameString = url + "?" + param; + log.info("sendGet - {}", urlNameString); + URL realUrl = new URL(urlNameString); + URLConnection connection = realUrl.openConnection(); + connection.setRequestProperty("accept", "*/*"); + connection.setRequestProperty("connection", "Keep-Alive"); + connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); + connection.connect(); + in = new BufferedReader(new InputStreamReader(connection.getInputStream(), contentType)); + String line; + while ((line = in.readLine()) != null) { + result.append(line); + } + log.info("recv - {}", result); + } catch (ConnectException e) { + log.error("调用HttpUtils.sendGet ConnectException, url=" + url + ",param=" + param, e); + } catch (SocketTimeoutException e) { + log.error("调用HttpUtils.sendGet SocketTimeoutException, url=" + url + ",param=" + param, e); + } catch (IOException e) { + log.error("调用HttpUtils.sendGet IOException, url=" + url + ",param=" + param, e); + } catch (Exception e) { + log.error("调用HttpsUtil.sendGet Exception, url=" + url + ",param=" + param, e); + } finally { + try { + if (in != null) { + in.close(); + } + } catch (Exception ex) { + log.error("调用in.close Exception, url=" + url + ",param=" + param, ex); + } + } + return result.toString(); + } + + /** + * 向指定 URL 发送POST方法的请求 + * + * @param url 发送请求的 URL + * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。 + * @return 所代表远程资源的响应结果 + */ + public static String sendPost(String url, String param) { + PrintWriter out = null; + BufferedReader in = null; + StringBuilder result = new StringBuilder(); + try { + String urlNameString = url; + log.info("sendPost - {}", urlNameString); + URL realUrl = new URL(urlNameString); + URLConnection conn = realUrl.openConnection(); + conn.setRequestProperty("accept", "*/*"); + conn.setRequestProperty("connection", "Keep-Alive"); + conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); + conn.setRequestProperty("Accept-Charset", "utf-8"); + conn.setRequestProperty("contentType", "utf-8"); + conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8"); + conn.setDoOutput(true); + conn.setDoInput(true); + out = new PrintWriter(conn.getOutputStream()); + out.print(param); + out.flush(); + in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8")); + String line; + while ((line = in.readLine()) != null) { + result.append(line); + } + log.info("recv - {}", result); + } catch (ConnectException e) { + log.error("调用HttpUtils.sendPost ConnectException, url=" + url + ",param=" + param, e); + } catch (SocketTimeoutException e) { + log.error("调用HttpUtils.sendPost SocketTimeoutException, url=" + url + ",param=" + param, e); + } catch (IOException e) { + log.error("调用HttpUtils.sendPost IOException, url=" + url + ",param=" + param, e); + } catch (Exception e) { + log.error("调用HttpsUtil.sendPost Exception, url=" + url + ",param=" + param, e); + } finally { + try { + if (out != null) { + out.close(); + } + if (in != null) { + in.close(); + } + } catch (IOException ex) { + log.error("调用in.close Exception, url=" + url + ",param=" + param, ex); + } + } + return result.toString(); + } + + /** + * 向指定 URL 发送POST方法的请求 + * + * @param url 发送请求的 URL + * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。 + * @return 所代表远程资源的响应结果 + */ + public static String sendWeChatPost(String url, String sign, String param) { + PrintWriter out = null; + BufferedReader in = null; + StringBuilder result = new StringBuilder(); + try { + String urlNameString = url; + log.info("sendPost - {}", urlNameString); + URL realUrl = new URL(urlNameString); + URLConnection conn = realUrl.openConnection(); +// conn.setRequestProperty("connection", "Keep-Alive"); + conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); +// conn.setRequestProperty("Accept-Charset", "utf-8"); + conn.setRequestProperty("Accept", "application/json"); + conn.setRequestProperty("contentType", "utf-8"); + conn.setRequestProperty("User-Agent", "Windows 10-Chrome 8"); + conn.setRequestProperty("Authorization", sign); + conn.setRequestProperty("Content-type", "application/json"); + conn.setRequestProperty("Accept-Language", "zh-CN"); + conn.setDoOutput(true); + conn.setDoInput(true); + out = new PrintWriter(conn.getOutputStream()); + out.print(param); + out.flush(); + in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8")); + String line; + while ((line = in.readLine()) != null) { + result.append(line); + } + log.info("recv - {}", result); + } catch (ConnectException e) { + log.error("调用HttpUtils.sendPost ConnectException, url=" + url + ",param=" + param, e); + } catch (SocketTimeoutException e) { + log.error("调用HttpUtils.sendPost SocketTimeoutException, url=" + url + ",param=" + param, e); + } catch (IOException e) { + log.error("调用HttpUtils.sendPost IOException, url=" + url + ",param=" + param, e); + } catch (Exception e) { + log.error("调用HttpsUtil.sendPost Exception, url=" + url + ",param=" + param, e); + } finally { + try { + if (out != null) { + out.close(); + } + if (in != null) { + in.close(); + } + } catch (IOException ex) { + log.error("调用in.close Exception, url=" + url + ",param=" + param, ex); + } + } + return result.toString(); + } + + public static String sendSSLPost(String url, String param) { + StringBuilder result = new StringBuilder(); + String urlNameString = url + "?" + param; + try { + log.info("sendSSLPost - {}", urlNameString); + SSLContext sc = SSLContext.getInstance("SSL"); + sc.init(null, new TrustManager[] { new TrustAnyTrustManager() }, new java.security.SecureRandom()); + URL console = new URL(urlNameString); + HttpsURLConnection conn = (HttpsURLConnection) console.openConnection(); + conn.setRequestProperty("accept", "*/*"); + conn.setRequestProperty("connection", "Keep-Alive"); + conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); + conn.setRequestProperty("Accept-Charset", "utf-8"); + conn.setRequestProperty("contentType", "utf-8"); + conn.setDoOutput(true); + conn.setDoInput(true); + + conn.setSSLSocketFactory(sc.getSocketFactory()); + conn.setHostnameVerifier(new TrustAnyHostnameVerifier()); + conn.connect(); + InputStream is = conn.getInputStream(); + BufferedReader br = new BufferedReader(new InputStreamReader(is)); + String ret = ""; + while ((ret = br.readLine()) != null) { + if (ret != null && !"".equals(ret.trim())) { + result.append(new String(ret.getBytes("ISO-8859-1"), "utf-8")); + } + } + log.info("recv - {}", result); + conn.disconnect(); + br.close(); + } catch (ConnectException e) { + log.error("调用HttpUtils.sendSSLPost ConnectException, url=" + url + ",param=" + param, e); + } catch (SocketTimeoutException e) { + log.error("调用HttpUtils.sendSSLPost SocketTimeoutException, url=" + url + ",param=" + param, e); + } catch (IOException e) { + log.error("调用HttpUtils.sendSSLPost IOException, url=" + url + ",param=" + param, e); + } catch (Exception e) { + log.error("调用HttpsUtil.sendSSLPost Exception, url=" + url + ",param=" + param, e); + } + return result.toString(); + } + + private static class TrustAnyTrustManager implements X509TrustManager { + @Override + public void checkClientTrusted(X509Certificate[] chain, String authType) { + } + + @Override + public void checkServerTrusted(X509Certificate[] chain, String authType) { + } + + @Override + public X509Certificate[] getAcceptedIssuers() { + return new X509Certificate[] {}; + } + } + + private static class TrustAnyHostnameVerifier implements HostnameVerifier { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + } + + public String doPost(String url, String params, String token) { + org.apache.http.client.HttpClient httpClient = null; + HttpPost httpPost = null; + String result = null; + try { + httpClient = new SSLClient(); + httpPost = new HttpPost(url); + // 设置参数 + httpPost.addHeader("Accept", "application/json"); + httpPost.addHeader("User-Agent", "Windows 10-Chrome 8"); +// httpPost.addHeader("Authorization", token); + httpPost.addHeader("Content-Type", "application/json;charset=UTF-8"); + StringEntity stringEntity = new StringEntity(params); + stringEntity.setContentEncoding("UTF-8"); + stringEntity.setContentType("application/json"); + httpPost.setEntity(stringEntity); + HttpResponse response = httpClient.execute(httpPost); + if (response != null) { + HttpEntity resEntity = response.getEntity(); + if (resEntity != null) { + result = EntityUtils.toString(resEntity, "utf-8"); + } + } + } catch (Exception ex) { + ex.printStackTrace(); + } + return result; + } + + /** + * 向指定 URL 发送POST方法的请求 + * + * @param url 发送请求的 URL + * @param param 请求参数,请求参数应该是json格式 + * @return 所代表远程资源的响应结果 + */ + public static String sendJSONPost(String url, String param) { + PrintWriter out = null; + BufferedReader in = null; + StringBuilder result = new StringBuilder(); + try { + String urlNameString = url; + log.info("sendPost - {}", urlNameString); + URL realUrl = new URL(urlNameString); + URLConnection conn = realUrl.openConnection(); + conn.setRequestProperty("accept", "*/*"); + conn.setRequestProperty("connection", "Keep-Alive"); + conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); + conn.setRequestProperty("Accept-Charset", "UTF-8"); + conn.setRequestProperty("Content-Type", "application/json;charset=UTF-8"); + conn.setRequestProperty("contentType", "UTF-8"); + + conn.setDoOutput(true); + conn.setDoInput(true); +// out = new PrintWriter(conn.getOutputStream()); +// 定义请求数据utf-8编码 + out = new PrintWriter(new OutputStreamWriter(conn.getOutputStream(), "UTF-8")); + out.print(param); + out.flush(); +// in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8")); +// 定义返回数据 utf-8编码 + in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8")); + String line; + while ((line = in.readLine()) != null) { + result.append(line); + } +// log.info("recv - {}", result); + } catch (ConnectException e) { + log.error("调用HttpUtils.sendPost ConnectException, url=" + url + ",param=" + param, e); + } catch (SocketTimeoutException e) { + log.error("调用HttpUtils.sendPost SocketTimeoutException, url=" + url + ",param=" + param, e); + } catch (IOException e) { + log.error("调用HttpUtils.sendPost IOException, url=" + url + ",param=" + param, e); + } catch (Exception e) { + log.error("调用HttpsUtil.sendPost Exception, url=" + url + ",param=" + param, e); + } finally { + try { + if (out != null) { + out.close(); + } + if (in != null) { + in.close(); + } + } catch (IOException ex) { + log.error("调用in.close Exception, url=" + url + ",param=" + param, ex); + } + } + return result.toString(); + } + +} diff --git a/health_common/src/main/java/cn/card/health/common/utils/JSONUtils.java b/health_common/src/main/java/cn/card/health/common/utils/JSONUtils.java new file mode 100644 index 0000000..0dca21c --- /dev/null +++ b/health_common/src/main/java/cn/card/health/common/utils/JSONUtils.java @@ -0,0 +1,209 @@ +package cn.card.health.common.utils; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** + * @Author: 维斯 + * @Date: 2022/6/30 14:55 + * @Description: Json排序工具 + * @Version: v1.0 + */ +public class JSONUtils { + + /** + * 对单词列表进行冒泡排序 + * 直接操作对象地址 无需返回 + * + * @param words ["name","age"] + */ + private static void wordSort(ArrayList words) { + for (int i = words.size() - 1; i > 0; i--) { + for (int j = 0; j < i; j++) { + if (words.get(j).compareToIgnoreCase(words.get(j + 1)) > 0) { + String temp = words.get(j); + words.set(j, words.get(j + 1)); + words.set(j + 1, temp); + } + } + } + } + + /** + * 对单层json排序 + * + * @param json + */ + private static JSONObject getAloneKeys(JSONObject json) { + ArrayList aloneKeys = new ArrayList<>(); + for (String key : json.keySet()) { + aloneKeys.add(key); + } + // 排序 + JSONUtils.wordSort(aloneKeys); + // 整理排序后的json + JSONObject newJson = new JSONObject(new LinkedHashMap<>()); + for (String key : aloneKeys) { + newJson.put(key, json.get(key)); + } + return newJson; + } + + /** + * 递归每一层(当前是判断下一层是JSONObject类型的场景) + * + * @param json + * @return + */ + private static JSONObject getAloneKeysRec(JSONObject json) { + JSONObject newJson = getAloneKeys(json); + + for (Map.Entry entry : newJson.entrySet()) { + // JSONObject类型 +// System.out.println(entry); + if (entry.getValue() == null) { + continue; + } + if (entry.getValue().getClass().equals(JSONObject.class)) { + newJson.put(entry.getKey(), getAloneKeysRec((JSONObject) entry.getValue())); + } + } + + return newJson; + } + + /** + * 对JSONObject的key根据首字母排序 若首字母相同对比下一个字母 依次类推 + * 备注:当前未覆盖JSONArray的场景 + * + * @param json + * @return 排序后的新json + */ + public static JSONObject startSort(JSONObject json) { + // 第1层 + JSONObject jsonAlone = getAloneKeys(json); + // 第2-n层 + for (Map.Entry entry : jsonAlone.entrySet()) { + // 这里仅判断JSONObject类型的场景(若需要覆盖JSONArray场景 对应添加即可) + if (entry.getValue() == null || StringUtils.isBlank(entry.getValue().toString())) { + continue; + } + if (entry.getValue().getClass().equals(JSONObject.class)) { + jsonAlone.put(entry.getKey(), getAloneKeysRec((JSONObject) entry.getValue())); + } else if (entry.getValue().getClass().equals(JSONArray.class)) { + JSONArray jsonArray = new JSONArray(); + JSONArray array = (JSONArray) entry.getValue(); + for (int i = 0; i < array.size(); i++) { + JSONObject jOb = new JSONObject(); + JSONObject jData = array.getJSONObject(i); + jOb = startSort(jData); + jsonArray.add(jOb); + } + jsonAlone.put(entry.getKey(), jsonArray); + } + } + return jsonAlone; + } + + + private Object traverseJson(Object json) { + // check null + if (json == null) { + return null; + } + + try { + + if (json instanceof JSONObject) {// if json is a Map + + JSONObject jsonObj = (JSONObject) json; + List + + keyList = new ArrayList(); + for (String k : jsonObj.keySet()) { + String value = jsonObj.get(k).toString(); + if (StringUtils.isEmpty(value)) { + keyList.add(k); + //jsonObj.remove(k); + } else { + if (isJsonObj(value)) { + jsonObj.put(k, traverseJson(JSONObject.parseObject(value))); + } else { + if (isJsonArr(value)) { + //value=; + jsonObj.put(k, traverseJson(JSONArray.parseArray(value))); + } + + } + + } + } + for (Object k : keyList) { + jsonObj.remove(k); + } + + return jsonObj; + + } else if (json instanceof JSONArray) {// if json is an Array + + JSONArray jsonArr = (JSONArray) json; + int len = jsonArr.size(); + for (int i = 0; i < len; ++i) { + // TODO: do something here + jsonArr.set(i, traverseJson(jsonArr.get(i))); + } +// return retArr; +// +// } else {// if json is just a raw element +// +// // TODO: do something here +// return json; + return jsonArr; +// + } + + } catch (Exception e) { + e.printStackTrace();// deal Exception or throw it + } + + return null; + } + + public boolean isJsonObj(Object o) { + try { + JSONObject js = JSONObject.parseObject(o.toString()); + return true; + + } catch (Exception e) { + return false; + } + } + + public boolean isJsonArr(Object o) { + try { + JSONArray js = JSONArray.parseArray(o.toString()); + return true; + + } catch (Exception e) { + return false; + } + } + + public static String toKeyValue(JSONObject params) { + StringBuffer sbf = new StringBuffer(); + for (Map.Entry entry : params.entrySet()) { + sbf.append(entry.getKey()); + sbf.append("="); + sbf.append(entry.getValue()); + sbf.append("&"); + } + return sbf.substring(0, sbf.length() - 2); +// return sbf.toString(); + } + +} diff --git a/health_common/src/main/java/cn/card/health/common/utils/LogUtils.java b/health_common/src/main/java/cn/card/health/common/utils/LogUtils.java new file mode 100644 index 0000000..af12a45 --- /dev/null +++ b/health_common/src/main/java/cn/card/health/common/utils/LogUtils.java @@ -0,0 +1,18 @@ +package cn.card.health.common.utils; + +/** + * 处理并记录日志文件 + * + * @author yc + */ +public class LogUtils +{ + public static String getBlock(Object msg) + { + if (msg == null) + { + msg = ""; + } + return "[" + msg.toString() + "]"; + } +} diff --git a/health_common/src/main/java/cn/card/health/common/utils/MapUtils.java b/health_common/src/main/java/cn/card/health/common/utils/MapUtils.java new file mode 100644 index 0000000..343b98c --- /dev/null +++ b/health_common/src/main/java/cn/card/health/common/utils/MapUtils.java @@ -0,0 +1,269 @@ +package cn.card.health.common.utils; + +import java.beans.PropertyDescriptor; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 描述:MapUtils
+ * 版本:0.1
+ * 作者:tancheng
+ * 修改日期:2015年11月3日 上午10:55:08 + */ +public class MapUtils { + + private static final String Splitor = "\\.|/|\\\\|->"; + + public static boolean isExpression(String exp) { + return exp.split(Splitor).length > 0; + } + + /** + * 描述:使用类似EL表达式形式获得Map中的值
+ * 举例:MapUtils.getValue(xml2Map, "response.returnresult.returncode")
+ * 作者:tancheng
+ * 修改日期:2015年11月3日 上午11:52:52 + * + * @param map Map + * @param expression 表达式(支持".","/","\","->") + */ + public static Object getValue(Map map, String expression) { + return getValue(map, expression, ""); + } + + /** + * 描述:使用类似EL表达式形式获得Map中的值
+ * 举例:MapUtils.getValue(xml2Map, "response.returnresult.returncode")
+ * 作者:tancheng
+ * 修改日期:2015年11月3日 上午11:52:52 + * + * @param map Map + * @param expression 表达式(支持".","/","\","->") + */ + @SuppressWarnings({ "unchecked", "rawtypes" }) + public static Object getValue(Map map, String expression, Class clazz) { + + Object o = getValue(map, expression, ""); + if (o == null || "".equals(o)) { + return null; + } else if (o instanceof List) { + return o; + } else if (clazz.getName().equals(List.class.getName())) { + List list = new ArrayList(); + list.add(o); + return list; + } else { + return o; + } + } + + /** + * 描述:使用类似EL表达式形式获得Map中的值
+ * 举例:MapUtils.getValue(xml2Map, "response.returnresult.returncode")
+ * 作者:tancheng
+ * 修改日期:2015年11月3日 上午11:52:52 + * + * @param map Map + * @param defaultValue 默认值 + * @param expression 表达式(支持".","/","\","->") + */ + @SuppressWarnings("unchecked") + public static Object getValue(Map map, String expression, Object defaultValue) { + Object value = null; + String[] props = expression.split(Splitor); + for (int i = 0; i < props.length; i++) { + String prop = props[i]; + if (i == 0) { + value = map.get(prop); + } else { + if (value instanceof Map) { + value = ((Map) value).get(prop); + } else { + value = null; + break; + } + } + } + if (value == null) { + value = defaultValue; + } + return value; + } + + /** + * 描述:使用类似EL表达式形式获得Map中的值
+ * 举例:MapUtils.getValue(xml2Map, "response.returnresult.returncode") + * + * @author cheng.li 2016年3月18日 + * @param map + * @param expression + * @param defaultValue + * @return + */ + public static String getStringValue(Map map, String expression, String defaultValue) { + Object value = getValue(map, expression, defaultValue); + if (defaultValue == null && value == null) { + return null; + } else { + return value.toString(); + } + } + + /** + * 描述:使用类似EL表达式形式向Map中传值
+ * 举例:MapUtils.putValue(xml2Map, "response.returnresult.returncode", "1")
+ * 作者:tancheng
+ * 修改日期:2015年11月3日 上午11:52:52 + * + * @param map Map + * @param expression 表达式(以"."分割) + * @param value 值 + */ + @SuppressWarnings({ "unchecked" }) + public static Map putValue(Map map, String expression, Object value) { + int index = expression.indexOf("."); + if (index == -1) { + String prop = expression; + map.put(prop, value); + } else { + String prop = expression.substring(0, index); + Object sub_map = map.get(prop); + if (sub_map == null) { + map.put(prop, new HashMap()); + map = putValue((Map) map.get(prop), expression.substring(index + 1), value); + } else if (sub_map instanceof Map) { + map = putValue((Map) sub_map, expression.substring(index + 1), value); + } else { + // TODO + return map; + } + } + return map; + } + + /** + * 描述:实体类转换Map
+ * 作者:tancheng
+ * 修改日期:2015年11月5日 下午3:04:55 + */ + public static Map BeanToMap(Object bean) { + Map result = new HashMap(); + if (bean == null) { + return result; + } + Class clazz = bean.getClass(); + Field[] fields = clazz.getDeclaredFields(); + for (Field field : fields) { + String name = field.getName(); + Object value = null; + try { + PropertyDescriptor propertyDescriptor = new PropertyDescriptor(name, clazz); + value = propertyDescriptor.getReadMethod().invoke(bean); + } catch (Exception e) { + continue; + } + if (value != null) { + if (!isComplexType(field)) { + result.put(name, value); + } else { + result.put(name, MapUtils.BeanToMap(value)); + } + } + } + return result; + } + + /** + * bean 追加参数添加到 map + * + * @author cheng.li 2016年6月24日 + * @param bean + * @param result + * @return + */ + public static Map BeanAddToMap(Object bean, Map result) { + if (bean == null || result == null) { + return result; + } + Class clazz = bean.getClass(); + Field[] fields = clazz.getDeclaredFields(); + for (Field field : fields) { + String name = field.getName(); + Object value = null; + try { + PropertyDescriptor propertyDescriptor = new PropertyDescriptor(name, clazz); + value = propertyDescriptor.getReadMethod().invoke(bean); + } catch (Exception e) { + continue; + } + if (value != null) { + if (!isComplexType(field)) { + result.put(name, value); + } else { + result.put(name, MapUtils.BeanToMap(value)); + } + } + } + return result; + } + + /** + * 方法名称: isComplexType
+ * 描述:判断是否为复合类型
+ * 作者: wanhonghui
+ * 修改日期:2013年8月15日下午2:25:52
+ * + * @param field
+ * @return false:基本类型 true:复合类型 + */ + private static boolean isComplexType(Field field) { + Class clazz = field.getType(); + if (byte.class.isAssignableFrom(clazz) || Byte.class.isAssignableFrom(clazz) + || char.class.isAssignableFrom(clazz) || Character.class.isAssignableFrom(clazz) + || short.class.isAssignableFrom(clazz) || Short.class.isAssignableFrom(clazz) + || int.class.isAssignableFrom(clazz) || Integer.class.isAssignableFrom(clazz) + || long.class.isAssignableFrom(clazz) || Long.class.isAssignableFrom(clazz) + || float.class.isAssignableFrom(clazz) || Float.class.isAssignableFrom(clazz) + || double.class.isAssignableFrom(clazz) || Double.class.isAssignableFrom(clazz) + || boolean.class.isAssignableFrom(clazz) || Boolean.class.isAssignableFrom(clazz) + || String.class.isAssignableFrom(clazz)) { + return false; + } + return true; + } + + /** + * 自定义拼接,返回一个设定的Map集合 + * + * @author xinggm 2016年11月15日 + * @param reqMap + * @return + */ + public static Map comboMap(Map reqMap, String... keys) { + Map params = new HashMap(); + if (reqMap == null || keys == null || keys.length == 0) { + return null; + } + for (String key : keys) { + params.put(key, reqMap.get(key)); + } + return params; + } + +// /** +// * 自定义拼接,返回一个设定的Map集合 +// * @author xinggm +// * 2016年11月15日 +// * @param reqMap +// * @return +// */ +// public static MapUtils putValue(Map reqMap, String key, String value) +// { +// reqMap.put(key, value); +// return new MapUtils(); +// } + +} diff --git a/health_common/src/main/java/cn/card/health/common/utils/Md5Utils.java b/health_common/src/main/java/cn/card/health/common/utils/Md5Utils.java new file mode 100644 index 0000000..671ccf6 --- /dev/null +++ b/health_common/src/main/java/cn/card/health/common/utils/Md5Utils.java @@ -0,0 +1,92 @@ +package cn.card.health.common.utils; + +import java.security.MessageDigest; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Md5加密方法 + * + * @author yc + */ +public class Md5Utils +{ + private static final Logger log = LoggerFactory.getLogger(Md5Utils.class); + + private static byte[] md5(String s) + { + MessageDigest algorithm; + try + { + algorithm = MessageDigest.getInstance("MD5"); + algorithm.reset(); + algorithm.update(s.getBytes("UTF-8")); + byte[] messageDigest = algorithm.digest(); + return messageDigest; + } + catch (Exception e) + { + log.error("MD5 Error...", e); + } + return null; + } + + private static final String toHex(byte hash[]) + { + if (hash == null) + { + return null; + } + StringBuffer buf = new StringBuffer(hash.length * 2); + int i; + + for (i = 0; i < hash.length; i++) + { + if ((hash[i] & 0xff) < 0x10) + { + buf.append("0"); + } + buf.append(Long.toString(hash[i] & 0xff, 16)); + } + return buf.toString(); + } + + public static String getMD5(String s) + { + try + { + return new String(toHex(md5(s)).getBytes("UTF-8"), "UTF-8"); + } + catch (Exception e) + { + log.error("not supported charset...{}", e); + return s; + } + } + + public static String getMD5(Long l) + { + try + { + return new String(toHex(md5(l+"")).getBytes(), "UTF-8"); + } + catch (Exception e) + { + log.error("not supported charset...{}", e); + return null; + } + } + + public static String hash(String s) + { + try + { + return new String(toHex(md5(s)).getBytes("UTF-8"), "UTF-8"); + } + catch (Exception e) + { + log.error("not supported charset...{}", e); + return s; + } + } +} diff --git a/health_common/src/main/java/cn/card/health/common/utils/MessageUtils.java b/health_common/src/main/java/cn/card/health/common/utils/MessageUtils.java new file mode 100644 index 0000000..da48411 --- /dev/null +++ b/health_common/src/main/java/cn/card/health/common/utils/MessageUtils.java @@ -0,0 +1,21 @@ +package cn.card.health.common.utils; + +import cn.card.health.common.utils.spring.SpringUtils; +import org.springframework.context.MessageSource; +import org.springframework.context.i18n.LocaleContextHolder; + +public class MessageUtils +{ + /** + * 根据消息键和参数 获取消息 委托给spring messageSource + * + * @param code 消息键 + * @param args 参数 + * @return 获取国际化翻译值 + */ + public static String message(String code, Object... args) + { + MessageSource messageSource = SpringUtils.getBean(MessageSource.class); + return messageSource.getMessage(code, args, LocaleContextHolder.getLocale()); + } +} \ No newline at end of file diff --git a/health_common/src/main/java/cn/card/health/common/utils/MyX509TrustManager.java b/health_common/src/main/java/cn/card/health/common/utils/MyX509TrustManager.java new file mode 100644 index 0000000..5977ed1 --- /dev/null +++ b/health_common/src/main/java/cn/card/health/common/utils/MyX509TrustManager.java @@ -0,0 +1,23 @@ +package cn.card.health.common.utils; + +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; + +import javax.net.ssl.X509TrustManager; + +/** + * 证书信任管理器(用于HTTPS请求) + * + */ +public class MyX509TrustManager implements X509TrustManager { + + public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { + } + + public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { + } + + public X509Certificate[] getAcceptedIssuers() { + return null; + } +} \ No newline at end of file diff --git a/health_common/src/main/java/cn/card/health/common/utils/SSLClient.java b/health_common/src/main/java/cn/card/health/common/utils/SSLClient.java new file mode 100644 index 0000000..891e8f4 --- /dev/null +++ b/health_common/src/main/java/cn/card/health/common/utils/SSLClient.java @@ -0,0 +1,83 @@ +package cn.card.health.common.utils; + +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.NoSuchProviderException; +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; + +import javax.net.ssl.SSLContext; +import javax.net.ssl.TrustManager; +import javax.net.ssl.TrustManagerFactory; +import javax.net.ssl.X509TrustManager; + +import org.apache.http.conn.ClientConnectionManager; +import org.apache.http.conn.scheme.Scheme; +import org.apache.http.conn.scheme.SchemeRegistry; +import org.apache.http.conn.ssl.SSLSocketFactory; +import org.apache.http.impl.client.DefaultHttpClient; + +public class SSLClient extends DefaultHttpClient { + + @SuppressWarnings("deprecation") + public SSLClient() throws Exception { + super(); + // 传输协议需要根据自己的判断 + SSLContext ctx = SSLContext.getInstance("TLS"); + X509TrustManager tm = new X509TrustManager() { + X509TrustManager sunJSSEX509TrustManager; + public void X509TrustManager () throws Exception { + try { + // create a "default" JSSE X509TrustManager. + KeyStore ks = KeyStore.getInstance("JKS"); + ks.load(new FileInputStream("trustedCerts"), "passphrase".toCharArray()); + TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509", "SunJSSE"); + tmf.init(ks); + TrustManager tms[] = tmf.getTrustManagers(); + /* + * Iterate over the returned trustmanagers, look for an instance of + * X509TrustManager. If found, use that as our "default" trust manager. + */ + for (int i = 0; i < tms.length; i++) { + if (tms[i] instanceof X509TrustManager) { + sunJSSEX509TrustManager = (X509TrustManager) tms[i]; + return; + } + } + } catch (Exception e) { + /* + * Find some other way to initialize, or else we have to fail the constructor. + */ + throw new Exception("Couldn't initialize"); + } + } + @Override + public void checkClientTrusted(X509Certificate[] chain, String authType) { + } + + @Override + public void checkServerTrusted(X509Certificate[] chain, String authType) { + try { + sunJSSEX509TrustManager.checkServerTrusted(chain, authType); + } catch (java.security.cert.CertificateException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + @Override + public X509Certificate[] getAcceptedIssuers() { + return null; + } + }; + ctx.init(null, new TrustManager[] { tm }, null); + SSLSocketFactory ssf = new SSLSocketFactory(ctx, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); + ClientConnectionManager ccm = this.getConnectionManager(); + SchemeRegistry sr = ccm.getSchemeRegistry(); + sr.register(new Scheme("https", 443, ssf)); + } +} diff --git a/health_common/src/main/java/cn/card/health/common/utils/StrFormatter.java b/health_common/src/main/java/cn/card/health/common/utils/StrFormatter.java new file mode 100644 index 0000000..cea9576 --- /dev/null +++ b/health_common/src/main/java/cn/card/health/common/utils/StrFormatter.java @@ -0,0 +1,91 @@ +package cn.card.health.common.utils; + + +/** + * 字符串格式化 + * + * @author yc + */ +public class StrFormatter +{ + public static final String EMPTY_JSON = "{}"; + public static final char C_BACKSLASH = '\\'; + public static final char C_DELIM_START = '{'; + public static final char C_DELIM_END = '}'; + + /** + * 格式化字符串
+ * 此方法只是简单将占位符 {} 按照顺序替换为参数
+ * 如果想输出 {} 使用 \\转义 { 即可,如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可
+ * 例:
+ * 通常使用:format("this is {} for {}", "a", "b") -> this is a for b
+ * 转义{}: format("this is \\{} for {}", "a", "b") -> this is \{} for a
+ * 转义\: format("this is \\\\{} for {}", "a", "b") -> this is \a for b
+ * + * @param strPattern 字符串模板 + * @param argArray 参数列表 + * @return 结果 + */ + public static String format(final String strPattern, final Object... argArray) + { + if (StringUtils.isEmpty(strPattern) || StringUtils.isEmpty(argArray)) + { + return strPattern; + } + final int strPatternLength = strPattern.length(); + + // 初始化定义好的长度以获得更好的性能 + StringBuilder sbuf = new StringBuilder(strPatternLength + 50); + + int handledPosition = 0; + int delimIndex;// 占位符所在位置 + for (int argIndex = 0; argIndex < argArray.length; argIndex++) + { + delimIndex = strPattern.indexOf(EMPTY_JSON, handledPosition); + if (delimIndex == -1) + { + if (handledPosition == 0) + { + return strPattern; + } + else + { // 字符串模板剩余部分不再包含占位符,加入剩余部分后返回结果 + sbuf.append(strPattern, handledPosition, strPatternLength); + return sbuf.toString(); + } + } + else + { + if (delimIndex > 0 && strPattern.charAt(delimIndex - 1) == C_BACKSLASH) + { + if (delimIndex > 1 && strPattern.charAt(delimIndex - 2) == C_BACKSLASH) + { + // 转义符之前还有一个转义符,占位符依旧有效 + sbuf.append(strPattern, handledPosition, delimIndex - 1); + sbuf.append(Convert.utf8Str(argArray[argIndex])); + handledPosition = delimIndex + 2; + } + else + { + // 占位符被转义 + argIndex--; + sbuf.append(strPattern, handledPosition, delimIndex - 1); + sbuf.append(C_DELIM_START); + handledPosition = delimIndex + 1; + } + } + else + { + // 正常占位符 + sbuf.append(strPattern, handledPosition, delimIndex); + sbuf.append(Convert.utf8Str(argArray[argIndex])); + handledPosition = delimIndex + 2; + } + } + } + // 加入最后一个占位符后所有的字符 + sbuf.append(strPattern, handledPosition, strPattern.length()); + + return sbuf.toString(); + } +} diff --git a/health_common/src/main/java/cn/card/health/common/utils/StringUtils.java b/health_common/src/main/java/cn/card/health/common/utils/StringUtils.java new file mode 100644 index 0000000..707de89 --- /dev/null +++ b/health_common/src/main/java/cn/card/health/common/utils/StringUtils.java @@ -0,0 +1,458 @@ +package cn.card.health.common.utils; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * 字符串工具类 + * + * @author yc + */ +public class StringUtils extends org.apache.commons.lang3.StringUtils +{ + /** 空字符串 */ + private static final String NULLSTR = ""; + + /** 下划线 */ + private static final char SEPARATOR = '_'; + + /** + * 获取参数不为空值 + * + * @param value defaultValue 要判断的value + * @return value 返回值 + */ + public static T nvl(T value, T defaultValue) + { + return value != null ? value : defaultValue; + } + + /** + * * 判断一个Collection是否为空, 包含List,Set,Queue + * + * @param coll 要判断的Collection + * @return true:为空 false:非空 + */ + public static boolean isEmpty(Collection coll) + { + return isNull(coll) || coll.isEmpty(); + } + + /** + * * 判断一个Collection是否非空,包含List,Set,Queue + * + * @param coll 要判断的Collection + * @return true:非空 false:空 + */ + public static boolean isNotEmpty(Collection coll) + { + return !isEmpty(coll); + } + + /** + * * 判断一个对象数组是否为空 + * + * @param objects 要判断的对象数组 + ** @return true:为空 false:非空 + */ + public static boolean isEmpty(Object[] objects) + { + return isNull(objects) || (objects.length == 0); + } + + /** + * * 判断一个对象数组是否非空 + * + * @param objects 要判断的对象数组 + * @return true:非空 false:空 + */ + public static boolean isNotEmpty(Object[] objects) + { + return !isEmpty(objects); + } + + /** + * * 判断一个Map是否为空 + * + * @param map 要判断的Map + * @return true:为空 false:非空 + */ + public static boolean isEmpty(Map map) + { + return isNull(map) || map.isEmpty(); + } + + /** + * * 判断一个Map是否为空 + * + * @param map 要判断的Map + * @return true:非空 false:空 + */ + public static boolean isNotEmpty(Map map) + { + return !isEmpty(map); + } + + /** + * * 判断一个字符串是否为空串 + * + * @param str String + * @return true:为空 false:非空 + */ + public static boolean isEmpty(String str) + { + return isNull(str) || NULLSTR.equals(str.trim()); + } + + /** + * * 判断一个字符串是否为非空串 + * + * @param str String + * @return true:非空串 false:空串 + */ + public static boolean isNotEmpty(String str) + { + return !isEmpty(str); + } + + /** + * * 判断一个对象是否为空 + * + * @param object Object + * @return true:为空 false:非空 + */ + public static boolean isNull(Object object) + { + return object == null; + } + + /** + * * 判断一个对象是否非空 + * + * @param object Object + * @return true:非空 false:空 + */ + public static boolean isNotNull(Object object) + { + return !isNull(object); + } + + /** + * * 判断一个对象是否是数组类型(Java基本型别的数组) + * + * @param object 对象 + * @return true:是数组 false:不是数组 + */ + public static boolean isArray(Object object) + { + return isNotNull(object) && object.getClass().isArray(); + } + + /** + * 去空格 + */ + public static String trim(String str) + { + return (str == null ? "" : str.trim()); + } + + /** + * 截取字符串 + * + * @param str 字符串 + * @param start 开始 + * @return 结果 + */ + public static String substring(final String str, int start) + { + if (str == null) + { + return NULLSTR; + } + + if (start < 0) + { + start = str.length() + start; + } + + if (start < 0) + { + start = 0; + } + if (start > str.length()) + { + return NULLSTR; + } + + return str.substring(start); + } + + /** + * 截取字符串 + * + * @param str 字符串 + * @param start 开始 + * @param end 结束 + * @return 结果 + */ + public static String substring(final String str, int start, int end) + { + if (str == null) + { + return NULLSTR; + } + + if (end < 0) + { + end = str.length() + end; + } + if (start < 0) + { + start = str.length() + start; + } + + if (end > str.length()) + { + end = str.length(); + } + + if (start > end) + { + return NULLSTR; + } + + if (start < 0) + { + start = 0; + } + if (end < 0) + { + end = 0; + } + + return str.substring(start, end); + } + + /** + * 格式化文本, {} 表示占位符
+ * 此方法只是简单将占位符 {} 按照顺序替换为参数
+ * 如果想输出 {} 使用 \\转义 { 即可,如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可
+ * 例:
+ * 通常使用:format("this is {} for {}", "a", "b") -> this is a for b
+ * 转义{}: format("this is \\{} for {}", "a", "b") -> this is \{} for a
+ * 转义\: format("this is \\\\{} for {}", "a", "b") -> this is \a for b
+ * + * @param template 文本模板,被替换的部分用 {} 表示 + * @param params 参数值 + * @return 格式化后的文本 + */ + public static String format(String template, Object... params) + { + if (isEmpty(params) || isEmpty(template)) + { + return template; + } + return StrFormatter.format(template, params); + } + + /** + * 字符串转set + * + * @param str 字符串 + * @param sep 分隔符 + * @return set集合 + */ + public static final Set str2Set(String str, String sep) + { + return new HashSet(str2List(str, sep, true, false)); + } + + /** + * 字符串转list + * + * @param str 字符串 + * @param sep 分隔符 + * @param filterBlank 过滤纯空白 + * @param trim 去掉首尾空白 + * @return list集合 + */ + public static final List str2List(String str, String sep, boolean filterBlank, boolean trim) + { + List list = new ArrayList(); + if (StringUtils.isEmpty(str)) + { + return list; + } + + // 过滤空白字符串 + if (filterBlank && StringUtils.isBlank(str)) + { + return list; + } + String[] split = str.split(sep); + for (String string : split) + { + if (filterBlank && StringUtils.isBlank(string)) + { + continue; + } + if (trim) + { + string = string.trim(); + } + list.add(string); + } + + return list; + } + + /** + * 下划线转驼峰命名 + */ + public static String toUnderScoreCase(String str) + { + if (str == null) + { + return null; + } + StringBuilder sb = new StringBuilder(); + // 前置字符是否大写 + boolean preCharIsUpperCase = true; + // 当前字符是否大写 + boolean curreCharIsUpperCase = true; + // 下一字符是否大写 + boolean nexteCharIsUpperCase = true; + for (int i = 0; i < str.length(); i++) + { + char c = str.charAt(i); + if (i > 0) + { + preCharIsUpperCase = Character.isUpperCase(str.charAt(i - 1)); + } + else + { + preCharIsUpperCase = false; + } + + curreCharIsUpperCase = Character.isUpperCase(c); + + if (i < (str.length() - 1)) + { + nexteCharIsUpperCase = Character.isUpperCase(str.charAt(i + 1)); + } + + if (preCharIsUpperCase && curreCharIsUpperCase && !nexteCharIsUpperCase) + { + sb.append(SEPARATOR); + } + else if ((i != 0 && !preCharIsUpperCase) && curreCharIsUpperCase) + { + sb.append(SEPARATOR); + } + sb.append(Character.toLowerCase(c)); + } + + return sb.toString(); + } + + /** + * 是否包含字符串 + * + * @param str 验证字符串 + * @param strs 字符串组 + * @return 包含返回true + */ + public static boolean inStringIgnoreCase(String str, String... strs) + { + if (str != null && strs != null) + { + for (String s : strs) + { + if (str.equalsIgnoreCase(trim(s))) + { + return true; + } + } + } + return false; + } + + /** + * 将下划线大写方式命名的字符串转换为驼峰式。如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。 例如:HELLO_WORLD->HelloWorld + * + * @param name 转换前的下划线大写方式命名的字符串 + * @return 转换后的驼峰式命名的字符串 + */ + public static String convertToCamelCase(String name) + { + StringBuilder result = new StringBuilder(); + // 快速检查 + if (name == null || name.isEmpty()) + { + // 没必要转换 + return ""; + } + else if (!name.contains("_")) + { + // 不含下划线,仅将首字母大写 + return name.substring(0, 1).toUpperCase() + name.substring(1); + } + // 用下划线将原始字符串分割 + String[] camels = name.split("_"); + for (String camel : camels) + { + // 跳过原始字符串中开头、结尾的下换线或双重下划线 + if (camel.isEmpty()) + { + continue; + } + // 首字母大写 + result.append(camel.substring(0, 1).toUpperCase()); + result.append(camel.substring(1).toLowerCase()); + } + return result.toString(); + } + + /** + * 驼峰式命名法 例如:user_name->userName + */ + public static String toCamelCase(String s) + { + if (s == null) + { + return null; + } + s = s.toLowerCase(); + StringBuilder sb = new StringBuilder(s.length()); + boolean upperCase = false; + for (int i = 0; i < s.length(); i++) + { + char c = s.charAt(i); + + if (c == SEPARATOR) + { + upperCase = true; + } + else if (upperCase) + { + sb.append(Character.toUpperCase(c)); + upperCase = false; + } + else + { + sb.append(c); + } + } + return sb.toString(); + } + + @SuppressWarnings("unchecked") + public static T cast(Object obj) + { + return (T) obj; + } +} diff --git a/health_common/src/main/java/cn/card/health/common/utils/XMLUtils.java b/health_common/src/main/java/cn/card/health/common/utils/XMLUtils.java new file mode 100644 index 0000000..84efee6 --- /dev/null +++ b/health_common/src/main/java/cn/card/health/common/utils/XMLUtils.java @@ -0,0 +1,248 @@ +package cn.card.health.common.utils; + +import java.io.IOException; +import java.io.StringReader; +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import org.dom4j.Document; +import org.dom4j.DocumentException; +import org.dom4j.DocumentHelper; +import org.dom4j.Element; +import org.dom4j.Namespace; +import org.dom4j.QName; +import org.dom4j.io.OutputFormat; +import org.dom4j.io.SAXReader; +import org.dom4j.io.XMLWriter; + +/** + * 描述:XMLUtils
+ * 版本:0.1
+ * 作者:tancheng
+ * 修改日期:2015年11月2日 下午6:00:05 + */ +public class XMLUtils +{ + + /** + * 描述:检测
+ * 作者:tancheng
+ * 修改日期:2016年1月14日 下午2:12:10 + */ + public static boolean isXML(String xml) + { + return xml.startsWith(" + * 作者:tancheng
+ * 修改日期:2015年11月2日 下午9:32:32 + */ + public static Map Xml2Map(String xml) + { + Map map = null; + Document doc; + try + { + doc = DocumentHelper.parseText(xml); + Element rootElement = doc.getRootElement(); + if (rootElement.hasContent()) + { + map = new HashMap(); + map.put(rootElement.getName(), Xml2Map(rootElement)); + } + } + catch (DocumentException e) + { + e.printStackTrace(); + } + return map; + } + + /** + * 描述:XML转Map
+ * 作者:xuelianbobo
+ * 原文:http://xuelianbobo.iteye.com/blog/2153384?utm_source=tuicool&utm_medium=referral
+ * 修改日期:2015年11月2日 下午9:32:08 + */ + @SuppressWarnings("unchecked") + private static Object Xml2Map(Element element) + { + Map map = new HashMap(); + List elements = element.elements(); + if (elements.size() == 0) + { + map.put(element.getName(), element.getText()); + if (!element.isRootElement()) + { + return element.getText(); + } + } + else if (elements.size() == 1) + { + map.put(elements.get(0).getName(), Xml2Map(elements.get(0))); + } + else if (elements.size() > 1) + { + // 多个子节点的话就得考虑list的情况了,比如多个子节点有节点名称相同的 + // 构造一个map用来去重 + Map tempMap = new HashMap(); + for (Element ele : elements) + { + tempMap.put(ele.getName(), ele); + } + Set keySet = tempMap.keySet(); + for (String string : keySet) + { + Namespace namespace = tempMap.get(string).getNamespace(); + List elements2 = element.elements(new QName(string, namespace)); + // 如果同名的数目大于1则表示要构建list + if (elements2.size() > 1) + { + List list = new ArrayList(); + for (Element ele : elements2) + { + list.add(Xml2Map(ele)); + } + map.put(string, list); + } + else + { + // 同名的数量不大于1则直接递归去 + map.put(string, Xml2Map(elements2.get(0))); + } + } + } + return map; + } + + /** + * XML格式化 记录日志用 + * @author cheng.li + * 2016年3月30日 + * @param inputXML + * @return + * @throws Exception + */ + public static String formatXML(String inputXML) + { + SAXReader reader = new SAXReader(); + XMLWriter writer = null; + String requestXML = null; + try + { + Document document = reader.read(new StringReader(inputXML)); + if (document != null) + { + StringWriter stringWriter = new StringWriter(); + OutputFormat format = new OutputFormat(" ", true); + writer = new XMLWriter(stringWriter, format); + writer.write(document); + writer.flush(); + requestXML = stringWriter.getBuffer().toString(); + } + } + catch (Exception e) + { + // TODO: handle exception + } + finally + { + if (writer != null) + { + try + { + writer.close(); + } + catch (IOException e) + { + } + } + } + return requestXML; + } + + /** + * 根据定义的文档返回一个map,满足下面格式才能用 + * @author cheng.li + * 2016年6月12日 + * @param xmlMap + * @return + */ + public static Map getHisResult(Map xmlMap) + { + @SuppressWarnings("unchecked") + Map returnresult = (Map) MapUtils.getValue(xmlMap, "response.returnresult"); + @SuppressWarnings("unchecked") + Map outputvalues = (Map) MapUtils.getValue(xmlMap, "response.outputvalues"); + Map hisResult = new HashMap(); + hisResult.put("returncode", returnresult.get("returncode")); + hisResult.put("errormsg", returnresult.get("errormsg")); + if (outputvalues == null) + { + hisResult.put("hasResult", false); + } + else + { + hisResult.put("hasResult", true); + //单层map复制,对应循环嵌套的使用MapUtils.getValue等方法自取需要的值 + for (Entry entry : outputvalues.entrySet()) + { + hisResult.put(entry.getKey(), entry.getValue()); + } + } + return hisResult; + } + + // public static void main(String[] args) { + // String xml = "返回代码出错信息当期页码总行数总页数当前页的行数医院代码拼音输入码医院名称医院级别代码医院级别名称医院图片(小)医院图片(中)医院图片(大)医院地址医院简介邮政编码省份代码省份名称城市代码城市名称公司电话公司网站字段代码字段名称 字段类型 字段格式 排序数字创建时间修改时间医院代码拼音输入码医院名称医院级别代码医院级别名称医院图片(小)医院图片(中)医院图片(大)医院地址医院简介邮政编码省份代码省份名称城市代码城市名称公司电话公司网站字段代码字段名称 字段类型 字段格式 排序数字创建时间修改时间医院代码拼音输入码医院名称医院级别代码医院级别名称医院图片(小)医院图片(中)医院图片(大)医院地址医院简介邮政编码省份代码省份名称城市代码城市名称公司电话公司网站字段代码字段名称 字段类型 字段格式 排序数字创建时间修改时间"; + // + // // Gson sGson = new Gson(); + // + // Map xml2Map = XMLUtils.Xml2Map(xml); + // // System.out.println(sGson.toJson(xml2Map)); + // + // // Bean <-> Xml 映射 + // @SuppressWarnings("serial") + // Map mapper = new HashMap() { + // { + // this.put("hospitalId", new UserCustomConvertor("hospitalid") { + // @Override + // public Object convert(Object sourceValue) { + // return "c1001zhyc-" + (String) sourceValue; + // } + // }); + // + // // this.put("areaid", value); + // this.put("hospitalname", "hospitalname"); + // this.put("hospitallevel", "hospitallevel"); + // this.put("hospitallevelname", "hospitallevelname"); + // this.put("hospitalsmallpicurl", "hospitalsmallpicurl"); + // this.put("hospitalmiddlepicurl", "hospitalmiddlepicurl"); + // this.put("hospitalbigpicurl", "hospitalbigpicurl"); + // this.put("hospitaladdr", "hospitaladdr"); + // // this.put("hospitaldes", value); + // this.put("zipcode", "zipcode"); + // this.put("phone", "phone"); + // this.put("website", "website"); + // // this.put("ordernum", value); + // // this.put("ghinfo", value); + // this.put("createTime", new Date()); + // this.put("modifyTime", new Date()); + // this.put("dr", 2); + // } + // }; + // List sources = (List) MapUtils.getValue(xml2Map, "response->data->data_row"); + // for (Map source : sources) { + // Object obj = ConvertUtils.convertByMap(Hospital.class, mapper, source); + // System.out.println(obj); + // } + // // System.out.println(sources); + // } +} diff --git a/health_common/src/main/java/cn/card/health/common/utils/http/HttpRequestUtil.java b/health_common/src/main/java/cn/card/health/common/utils/http/HttpRequestUtil.java new file mode 100644 index 0000000..7e08f72 --- /dev/null +++ b/health_common/src/main/java/cn/card/health/common/utils/http/HttpRequestUtil.java @@ -0,0 +1,160 @@ +package cn.card.health.common.utils.http; + +import java.io.BufferedReader; +import java.io.ByteArrayOutputStream; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.net.ConnectException; +import java.net.HttpURLConnection; +import java.net.URL; +import java.net.UnknownHostException; +import java.security.SecureRandom; + +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSocketFactory; +import javax.net.ssl.TrustManager; + +import cn.card.health.common.enums.EnumMethod; +import cn.card.health.common.utils.MyX509TrustManager; + +public class HttpRequestUtil { + + /** + * 发起https请求并获取结果 + * + * @param requestUrl 请求地址 + * @param requestMethod 请求方式(GET、POST) + * @param outputStr 提交的数据 + * @return JSONObject(通过JSONObject.get(key)的方式获取json对象的属性值) + */ + public static String httpRequest(String requestUrl, String requestMethod, String outputStr) { + + System.err.println(requestMethod + "\toutputStr=" + outputStr); + +// JSONObject jsonObject = null; + StringBuffer buffer = new StringBuffer(); + try { + // 创建SSLContext对象,并使用我们指定的信任管理器初始化 + TrustManager[] tm = { new MyX509TrustManager() }; + SSLContext sslContext = SSLContext.getInstance("SSL", "SunJSSE"); + sslContext.init(null, tm, new SecureRandom()); + // 从上述SSLContext对象中得到SSLSocketFactory对象 + SSLSocketFactory ssf = sslContext.getSocketFactory(); + + URL url = new URL(requestUrl); + HttpsURLConnection httpUrlConn = (HttpsURLConnection) url.openConnection(); + httpUrlConn.setSSLSocketFactory(ssf); + + httpUrlConn.setDoOutput(true); + httpUrlConn.setDoInput(true); + httpUrlConn.setUseCaches(false); + // 设置请求方式(GET/POST) + httpUrlConn.setRequestMethod(requestMethod); + + if ("GET".equalsIgnoreCase(requestMethod)) + httpUrlConn.connect(); + + // 当有数据需要提交时 + if (null != outputStr) { + OutputStream outputStream = httpUrlConn.getOutputStream(); + // 注意编码格式,防止中文乱码 + outputStream.write(outputStr.getBytes("UTF-8")); + outputStream.close(); + } + + // 将返回的输入流转换成字符串 + InputStream inputStream = httpUrlConn.getInputStream(); + InputStreamReader inputStreamReader = new InputStreamReader(inputStream, "utf-8"); + BufferedReader bufferedReader = new BufferedReader(inputStreamReader); + + String str = null; + while ((str = bufferedReader.readLine()) != null) { + buffer.append(str); + } + bufferedReader.close(); + inputStreamReader.close(); + // 释放资源 + inputStream.close(); + inputStream = null; + httpUrlConn.disconnect(); + + // System.out.println("jsonObject="+jsonObject); + } catch (ConnectException ce) { + ce.printStackTrace(); + System.out.println("网络链接失败!"); + } catch (UnknownHostException uhe) { + uhe.printStackTrace(); + System.out.println("微信API无法访问....!"); + // httpRequest(requestUrl, requestMethod, outputStr); + } catch (Exception e) { + e.printStackTrace(); + } + return buffer.toString(); + } + + /** + * 发起https请求并获取字节数组结果 + * + * @param requestUrl + * @param requestMethod + * @param data + * @return + */ + public static byte[] httpRequest_byte(String requestUrl, String requestMethod, byte[] data) { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + try { + if (requestMethod == EnumMethod.GET.name() && data != null && data.length > 0) { + if (requestUrl.indexOf('?') > 0) { + requestUrl += '&'; + } else { + requestUrl += '?'; + } + requestUrl += new String(data); + } + URL url = new URL(requestUrl); + HttpURLConnection httpUrlConn = (HttpURLConnection) url.openConnection(); + if (httpUrlConn instanceof HttpsURLConnection) { + // 创建SSLContext对象,并使用我们指定的信任管理器初始化 + TrustManager[] tm = { new MyX509TrustManager() }; + SSLContext sslContext = SSLContext.getInstance("SSL", "SunJSSE"); + sslContext.init(null, tm, new SecureRandom()); + // 从上述SSLContext对象中得到SSLSocketFactory对象 + SSLSocketFactory ssf = sslContext.getSocketFactory(); + ((HttpsURLConnection) httpUrlConn).setSSLSocketFactory(ssf); + } + boolean truePost = requestMethod == EnumMethod.POST.name() && data != null && data.length > 0; + httpUrlConn.setDoOutput(truePost); + httpUrlConn.setDoInput(true); + httpUrlConn.setUseCaches(false); + // 设置请求方式(GET/POST) + httpUrlConn.setRequestMethod(requestMethod); + + if (requestMethod == EnumMethod.GET.name()) { + httpUrlConn.connect(); + } else if (truePost) { + // 提交数据 + OutputStream outputStream = httpUrlConn.getOutputStream(); + outputStream.write(data); + outputStream.close(); + } + + // 读取返回数据 + InputStream inputStream = httpUrlConn.getInputStream(); + byte[] buf = new byte[1024 * 2]; + int len; + while ((len = inputStream.read(buf)) != -1) { + out.write(buf, 0, len); + } + // 释放资源 + out.close(); + inputStream.close(); + inputStream = null; + httpUrlConn.disconnect(); + } catch (ConnectException ce) { + } catch (Exception e) { + } + return out.toByteArray(); + } +} diff --git a/health_common/src/main/java/cn/card/health/common/utils/http/Https.java b/health_common/src/main/java/cn/card/health/common/utils/http/Https.java new file mode 100644 index 0000000..9e1ba3f --- /dev/null +++ b/health_common/src/main/java/cn/card/health/common/utils/http/Https.java @@ -0,0 +1,33 @@ +package cn.card.health.common.utils.http; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; + +public class Https { + + public static String https(String url, String method) throws IOException { + URL serverUrl = new URL(url); + HttpURLConnection conn = (HttpURLConnection) serverUrl.openConnection(); + conn.setRequestMethod(method); + conn.setRequestProperty("Content-type", "application/json"); + // 必须设置false,否则会自动redirect到重定向后的地址 + conn.setInstanceFollowRedirects(false); + conn.connect(); + StringBuffer buffer = new StringBuffer(); + // 将返回的输入流转换成字符串 + try (InputStream inputStream = conn.getInputStream(); + InputStreamReader inputStreamReader = new InputStreamReader(inputStream); + BufferedReader bufferedReader = new BufferedReader(inputStreamReader);) { + String str = null; + while ((str = bufferedReader.readLine()) != null) { + buffer.append(str); + } + String result = buffer.toString(); + return result; + } + } +} diff --git a/health_common/src/main/java/cn/card/health/common/utils/sign/AESHelper.java b/health_common/src/main/java/cn/card/health/common/utils/sign/AESHelper.java new file mode 100644 index 0000000..76f5956 --- /dev/null +++ b/health_common/src/main/java/cn/card/health/common/utils/sign/AESHelper.java @@ -0,0 +1,227 @@ +package cn.card.health.common.utils.sign; + +import java.nio.charset.StandardCharsets; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; + +import javax.crypto.Cipher; +import javax.crypto.KeyGenerator; +import javax.crypto.NoSuchPaddingException; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; + +/** + * AES加密 + * by poplar created on 2020/1/26 + */ +public class AESHelper { + +// private static final String _KEY = "C6EE3AFB0AE8715615A7C4B15386F0B2"; + private static final String _KEY = "EFB19D8AD100E310404A9A34AF01E7BC"; +// private static final String _KEY = AbandonConfig.getAESSecretKey(); + // private static final String ARITHMETIC = "AES/ECB/PKCS5Padding"; + private static final String ARITHMETIC = "AES/ECB/PKCS5Padding"; + private static Cipher cipherEncrypt; + private static Cipher cipherDecrypt; + static{ +// String key = _KEY.substring(6, 6+16); + String key = _KEY; + try { + // 1.构造密钥生成器,指定为AES算法,不区分大小写 + KeyGenerator kgen = KeyGenerator.getInstance("AES"); + // 2.根据ecnodeRules规则初始化密钥生成器 + // 生成一个128位的随机源,根据传入的字节数组 + kgen.init(128); + cipherEncrypt = Cipher.getInstance(ARITHMETIC); + cipherEncrypt.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(key.getBytes(), + "AES")); + cipherDecrypt = Cipher.getInstance(ARITHMETIC); + cipherDecrypt.init(Cipher.DECRYPT_MODE, new SecretKeySpec(key.getBytes(), + "AES")); + + + } catch (InvalidKeyException e) { + e.printStackTrace(); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } catch (NoSuchPaddingException e) { + e.printStackTrace(); + } + } + public static String encrypt(String content) { + try { + byte[] encrypted = cipherEncrypt.doFinal(content + .getBytes(StandardCharsets.UTF_8)); + return Base64.encode(encrypted); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + public static String encrypt(byte[] bytes) { + try { +// // 1.构造密钥生成器,指定为AES算法,不区分大小写 +// KeyGenerator kgen = KeyGenerator.getInstance("AES"); +// // 2.根据ecnodeRules规则初始化密钥生成器 +// // 生成一个128位的随机源,根据传入的字节数组 +// kgen.init(128); +// Cipher cipher = Cipher.getInstance(ARITHMETIC); +// cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(_KEY.getBytes(), +// "AES")); + byte[] encrypted = cipherEncrypt.doFinal(bytes); + return Base64.encode(encrypted); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + public static String decrypt(String encrypted) { + try { +// // 1.构造密钥生成器,指定为AES算法,不区分大小写 +// KeyGenerator kgen = KeyGenerator.getInstance("AES"); +// // 2.根据ecnodeRules规则初始化密钥生成器 +// // 生成一个128位的随机源,根据传入的字节数组 +// kgen.init(128); +// Cipher cipher = Cipher.getInstance(ARITHMETIC); +// cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(_KEY.getBytes(), +// "AES")); + // 采用base64算法进行转码,避免出现中文乱码 + byte[] encrypt = Base64.decode(encrypted); + byte[] decryptBytes = cipherDecrypt.doFinal(encrypt); + return new String(decryptBytes, StandardCharsets.UTF_8); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + /** + * 微信手机号解密 + * @param encrypted + * @param session_key + * @return + */ + public static String decrypt_wechat(String encrypted, String session_key, String iv_key) { + try { +// Security.addProvider(new BouncyCastleProvider()); + // 1.构造密钥生成器,指定为AES算法,不区分大小写 +// KeyGenerator kgen = KeyGenerator.getInstance("AES"); +// // 2.根据ecnodeRules规则初始化密钥生成器 +// // 生成一个128位的随机源,根据传入的字节数组 +// kgen.init(128); + Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); + IvParameterSpec IV = new IvParameterSpec(Base64.decode(iv_key)); + cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(Base64.decode(session_key), + "AES"), IV); + // 采用base64算法进行转码,避免出现中文乱码 + byte[] encrypt = Base64.decode(encrypted); + byte[] decryptBytes = cipher.doFinal(encrypt); + return new String(decryptBytes, StandardCharsets.UTF_8); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + +// /** +// * 解密工具直接放进去即可 +// */ +// public static String decryptS5(String sSrc, String encodingFormat, String sKey, String ivParameter) throws Exception { +// try { +//// BASE64Decoder decoder = new BASE64Decoder(); +//// byte[] raw = decoder.decodeBuffer(sKey); +// Base64 decoder = new Base64(); +// byte[] raw = decoder.decode(sKey); +// SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); +//// IvParameterSpec iv = new IvParameterSpec(decoder.decodeBuffer(ivParameter)); +// IvParameterSpec iv = new IvParameterSpec(decoder.decode(ivParameter)); +// Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); +// cipher.init(Cipher.DECRYPT_MODE, skeySpec, iv); +// byte[] myendicod = decoder.decode(sSrc); +//// byte[] myendicod = decoder.decodeBuffer(sSrc); +// byte[] original = cipher.doFinal(myendicod); +// String originalString = new String(original, encodingFormat); +// return originalString; +// } catch (Exception ex) { +// return null; +// } +// } + + +// public static void main(String[] args) { +// String text = "dVnYjCxTSRkx54Zd4It5jldn238zSaVEjfVgHLolDD3JwqAzkXkZ+epL8wGPR/ifBeqQH3lo90dRKCArsTu7zvTnQqMbKfj00NVhr4bGZbgvaq4PmrBzxKMwQpRxICosEaPKS5u2a6CFIPKBBs2lrKvRsQs/QZZu4uqKJepQp4FNYzqO+/vOvYU9PCC4+bNhHXPmdCUvF+ST2gvnuYWpHA=="; +// String session_key="EIU73GaUaFffHvVdVnCl3Q=="; +// String iv_key="aq8zLWK2gmrS3+PUYmI7aQ=="; +// String phone = AESHelper.decrypt_wechat(text, session_key, iv_key); +//// String phone; +// try { +//// phone = AESHelper.decryptS5(text, "utf-8",session_key,iv_key); +// System.out.println(phone); +// } catch (Exception e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } +// +// // String str = "{\"hospid\":\"103\",\"errtype\":2}"; +// // // +// // String content = ""; +// // // // for (int i = 0; i < 20; i++) { +// // // // content += str; +// // // // } +// // content = str; +// // // content = "123"; +// // System.out.println("加密前: " + content); +// // System.out.println("压缩后: " + content); +// // String content = "aaa"; +// // content = GZIPUtils.compress(content); +// // String encryptContent = encrypt(content); +// // String encryptContent = +// // "RS2pBJWokiCT6qWlv+vj5aKToElvcMA/GCNqj4LVNAf0CqblZCuVA1Mjax56sMCJDFNpftTi3EYnkTGr4ydb2g=="; +// // "aE9gkp2MJ3cOXc7n8sOMho4BnsCxl3BE7HZvULJPNw8diCo+OizCNVvzr8lhYcO1QSCKo4M7tlx7RkadtzmFvYquAYBczw+fY2REi1xNElo="; +// +// // System.out.println("加密后:" + encryptContent); +// // // +// // String decryptContent = decrypt(encryptContent); +// // System.out.println("解密后:" + decryptContent); +// // decryptContent = GZIPUtils.unCompress(decryptContent); +// // System.out.println("解缩后:" + decryptContent); +// // +//// String content = "{\"hospid\":\"103\",\"errtype\":好好学习,天天向上}"; +//// content = GZIPUtils.compress(content); +////// byte[] bytes = GZIPUtils.compressBytes(content); +//// System.out.println("压缩后:" + content); +//// String encryptContent = encrypt(content); +//// System.out.println("加密后:" + encryptContent); +// // encryptContent = "AA" + encryptContent + "YC"; +// // encryptContent = encryptContent.substring(2, +// // encryptContent.length()-2); +// // // encryptContent = +// // "pc8jUHKcM5HmbsVQrCkDvPGqGEuruOov411cbEQVHpG5VjooH0ZPmspQ2PR2AmNbVDwv39uRU1SbChp6syZYSg=="; +// +// // String ctext = "FwWKGN5hcyb62X_kEHIYybV5lk_fABHgG52udowS0-0="; +// // String encryptContent = ctext; +// // System.out.println("解密前:" + encryptContent); +// // String encryptContent = +// // "RS2pBJWokiCT6qWlv+vj5aKToElvcMA/GCNqj4LVNAegp3eKR1uZB86DSHyZZBcwL3/TJqh0y8ZsA2NoYQObKg=="; +//// String decryptContent = decrypt(encryptContent); +//// System.out.println("解密后:" + decryptContent); +//// decryptContent = GZIPUtils.unCompress(decryptContent); +//// System.out.println("解压后:" + decryptContent); +// +// // System.out.println(KEY); +// // String content = "102"; +// // content = encrypt(content); +// // System.out.println(content); +// } + +// public static void main(String args[]) { +// String content = "D+SLU8Bvp7LfTAAxF8Z/98U2vVmxdbYQ28YOYAUEJlzXxfoNL1e25wNE2xlIZ2iE5wYBzetY2OacscW/nHGBiFo1efLbhCjBIym5x0xGPR8AEZxZrYNZ5ZgtBgt+tj6GZAvIUCnGn2AkZVDRp6lNGpPveldug5SIYI7gVezWa0Ue/CoplZFbzpsXzAQ9iiJY4W+tqp0GMDUfLHjEsx+WoqA6jbw7AKgenOiZVdgFs+GeuSFmHXa+ccaJg3DEe43xvwhddfduHSrIBUnYcC0VmNzm5WSUzlyY4jm4OunEgozwcAARR/u0efXOEGjhTYm9aYhd/s8fvkc1SeZ+VmQuqzzXQrP+n+KfRgK8ZrEvn0FWj65zXi/D4a6b2XeLpdD9hwbE+l1D5ayn5zcpKsQ/0V2DM/QyySqQ2FbSI6rjQ+rfIMGvhjt7EdRZNodUTUuHgWJZ2ZOOHHHvCg9t57e+3suI7boCDNs3ktsEnlyPaqqW7uAcXeSZ/Kw3YEBlGuI9fyK7X9qEZUeVfVXJBZkmuI5GA/w05UuhuJ96/wAn4CluyNemScRnR5xoJ96+HVQfIIvKfGvzBJoa0QB9AHEeGowmnUYRKbIK9x3/ReAbrVWFaSqh2Bmp+8exwvcRnNqk23jtc7cZtpyLgAkEXaozdRtTje4L7wGs/AzerZ17TvJnOJN9HMd1eWOZ6rBtN2A3tNavkEDRY9stVLEexFG+jnLvEfGMkGiEP1bT/H+Cwe8jMubCDGQV7Q+DCBFmqpghxrTl84UD7SFgmCS7O5MFM0lhbKVnWf3o7VcKlbxjrjVvzpfmhsk/rZIPocyVUiD2HbKHx1yDjUBH4xGM/PRqQm57p0L+ho3sW548e6Rl9olntnMgw7zYnRM1W/8fU+w9GQKm4HpF/27IEiJBA31rpNTBA2af51W41hup8xuUVvbba171Zw5C9Jdqp+eIKuWCZX4WnHZfTyMZzY48eUlRekDQsizDYOSVyW/Z2ojRsE6vBU/6sojGZrHXqft5SO52Wng3vTEdswvrTgom2bDG0s2xE/VyUQlI6WbThNDZX1JNvvPhIr1bkVjBvsgRZLQK+hD/BtjWzYZxFeBAU85LQwDsNyxCNGIOqxpmosagIYWG625QLqgsdo+EEu+hvN1cuk9O+aMt2zKYiwuilEjV3o2rKKwua1NrpptJQval5SaFbYgSVeskEZzXt/uZ6BlLoUwxdrEptpYc5YG476silhRDCnzsN3ZRK125JXj35nbLhbWFmAVsSEunL747yWMgUO5KvBQ539Sx2qEmEOmfGblY7QSsHXDaHA17DU/seUtWX63iE13DxaCe3ZY9cbuR2H12BEcEwSyBNNG4df2MpPI6FXgCH1NwfcjOHlZCouiXHKj4m5FqpLadcsSdT2XMU9gXhsU9royssA0Hus7YAmIcWgLLgpWOl8IOukc5omDJHdioI0GaUFM9IDO3KwpkLh/HqoJCy21sgKUHN/+UvNmpb6Jlw++d1MulsqsabNO1TGN1RP6+7fJwY/xQBE9WkW14Z4T9NpRO0TaZxoylBLYCzDROlGARPLZgeaWgzHebZKQTl48qMLxUdDKaNHXMueX/Or/hCwZvLa70XHEGdHbeSkL1lR+sWvta8iu2xijkfd3HWIwJoq7R2CKdU9w8irRzP8QWvAGJOBQcuMH13Q6LYcNIYjSSiUTtlWb5dAnfVbX4I0zIcBo0//UopYtRhkGIpUjavop70j1KEOR2dW+s8WdihNHvf4YUUUO6WJ0+RfHHgQd7UZgnsXMsdNLS3WZZZnHd6/WK9mi13CzVeSk+/7PNRu4Bkx1wRZkzOdFtmfXcD+tXRcTBuC6uMOuwYyqMeLnM0uRDQx45hC+BW3ACVogFbw=="; +//// System.out.println(content); +// System.out.println(_KEY.length()); +// System.out.println(decrypt(content)); +// } + + +} diff --git a/health_common/src/main/java/cn/card/health/common/utils/sign/AESUtil.java b/health_common/src/main/java/cn/card/health/common/utils/sign/AESUtil.java new file mode 100644 index 0000000..5cc15c6 --- /dev/null +++ b/health_common/src/main/java/cn/card/health/common/utils/sign/AESUtil.java @@ -0,0 +1,53 @@ +//package cn.card.health.common.utils.sign; +// +//import java.io.IOException; +//import java.security.GeneralSecurityException; +//import java.security.InvalidAlgorithmParameterException; +//import java.security.InvalidKeyException; +//import java.security.NoSuchAlgorithmException; +// +//import javax.crypto.Cipher; +//import javax.crypto.NoSuchPaddingException; +//import javax.crypto.spec.GCMParameterSpec; +//import javax.crypto.spec.SecretKeySpec; +//import java.util.Base64; +// +//public class AESUtil +//{ +// static final int KEY_LENGTH_BYTE = 32; +// static final int TAG_LENGTH_BIT = 128; +// private final byte[] aesKey; +// +// public AESUtil(byte[] key) +// { +// if (key.length != 32) { +// throw new IllegalArgumentException("无效的ApiV3Key,长度必须为32个字节"); +// } +// this.aesKey = key; +// } +// +// public String decryptToString(byte[] associatedData, byte[] nonce, String ciphertext) +// throws GeneralSecurityException, IOException +// { +// try +// { +// Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding"); +// +// SecretKeySpec key = new SecretKeySpec(this.aesKey, "AES"); +// GCMParameterSpec spec = new GCMParameterSpec(128, nonce); +// +// cipher.init(2, key, spec); +// cipher.updateAAD(associatedData); +// +// return new String(cipher.doFinal(Base64.getDecoder().decode(ciphertext)), "utf-8"); +// } +// catch (NoSuchAlgorithmException|NoSuchPaddingException e) +// { +// throw new IllegalStateException(e); +// } +// catch (InvalidKeyException|InvalidAlgorithmParameterException e) +// { +// throw new IllegalArgumentException(e); +// } +// } +//} \ No newline at end of file diff --git a/health_common/src/main/java/cn/card/health/common/utils/sign/Base64.java b/health_common/src/main/java/cn/card/health/common/utils/sign/Base64.java new file mode 100644 index 0000000..20d3b4d --- /dev/null +++ b/health_common/src/main/java/cn/card/health/common/utils/sign/Base64.java @@ -0,0 +1,291 @@ +package cn.card.health.common.utils.sign; + +/** + * Base64工具类 + * + * @author yc + */ +public final class Base64 +{ + static private final int BASELENGTH = 128; + static private final int LOOKUPLENGTH = 64; + static private final int TWENTYFOURBITGROUP = 24; + static private final int EIGHTBIT = 8; + static private final int SIXTEENBIT = 16; + static private final int FOURBYTE = 4; + static private final int SIGN = -128; + static private final char PAD = '='; + static final private byte[] base64Alphabet = new byte[BASELENGTH]; + static final private char[] lookUpBase64Alphabet = new char[LOOKUPLENGTH]; + + static + { + for (int i = 0; i < BASELENGTH; ++i) + { + base64Alphabet[i] = -1; + } + for (int i = 'Z'; i >= 'A'; i--) + { + base64Alphabet[i] = (byte) (i - 'A'); + } + for (int i = 'z'; i >= 'a'; i--) + { + base64Alphabet[i] = (byte) (i - 'a' + 26); + } + + for (int i = '9'; i >= '0'; i--) + { + base64Alphabet[i] = (byte) (i - '0' + 52); + } + + base64Alphabet['+'] = 62; + base64Alphabet['/'] = 63; + + for (int i = 0; i <= 25; i++) + { + lookUpBase64Alphabet[i] = (char) ('A' + i); + } + + for (int i = 26, j = 0; i <= 51; i++, j++) + { + lookUpBase64Alphabet[i] = (char) ('a' + j); + } + + for (int i = 52, j = 0; i <= 61; i++, j++) + { + lookUpBase64Alphabet[i] = (char) ('0' + j); + } + lookUpBase64Alphabet[62] = (char) '+'; + lookUpBase64Alphabet[63] = (char) '/'; + } + + private static boolean isWhiteSpace(char octect) + { + return (octect == 0x20 || octect == 0xd || octect == 0xa || octect == 0x9); + } + + private static boolean isPad(char octect) + { + return (octect == PAD); + } + + private static boolean isData(char octect) + { + return (octect < BASELENGTH && base64Alphabet[octect] != -1); + } + + /** + * Encodes hex octects into Base64 + * + * @param binaryData Array containing binaryData + * @return Encoded Base64 array + */ + public static String encode(byte[] binaryData) + { + if (binaryData == null) + { + return null; + } + + int lengthDataBits = binaryData.length * EIGHTBIT; + if (lengthDataBits == 0) + { + return ""; + } + + int fewerThan24bits = lengthDataBits % TWENTYFOURBITGROUP; + int numberTriplets = lengthDataBits / TWENTYFOURBITGROUP; + int numberQuartet = fewerThan24bits != 0 ? numberTriplets + 1 : numberTriplets; + char encodedData[] = null; + + encodedData = new char[numberQuartet * 4]; + + byte k = 0, l = 0, b1 = 0, b2 = 0, b3 = 0; + + int encodedIndex = 0; + int dataIndex = 0; + + for (int i = 0; i < numberTriplets; i++) + { + b1 = binaryData[dataIndex++]; + b2 = binaryData[dataIndex++]; + b3 = binaryData[dataIndex++]; + + l = (byte) (b2 & 0x0f); + k = (byte) (b1 & 0x03); + + byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0); + byte val2 = ((b2 & SIGN) == 0) ? (byte) (b2 >> 4) : (byte) ((b2) >> 4 ^ 0xf0); + byte val3 = ((b3 & SIGN) == 0) ? (byte) (b3 >> 6) : (byte) ((b3) >> 6 ^ 0xfc); + + encodedData[encodedIndex++] = lookUpBase64Alphabet[val1]; + encodedData[encodedIndex++] = lookUpBase64Alphabet[val2 | (k << 4)]; + encodedData[encodedIndex++] = lookUpBase64Alphabet[(l << 2) | val3]; + encodedData[encodedIndex++] = lookUpBase64Alphabet[b3 & 0x3f]; + } + + // form integral number of 6-bit groups + if (fewerThan24bits == EIGHTBIT) + { + b1 = binaryData[dataIndex]; + k = (byte) (b1 & 0x03); + byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0); + encodedData[encodedIndex++] = lookUpBase64Alphabet[val1]; + encodedData[encodedIndex++] = lookUpBase64Alphabet[k << 4]; + encodedData[encodedIndex++] = PAD; + encodedData[encodedIndex++] = PAD; + } + else if (fewerThan24bits == SIXTEENBIT) + { + b1 = binaryData[dataIndex]; + b2 = binaryData[dataIndex + 1]; + l = (byte) (b2 & 0x0f); + k = (byte) (b1 & 0x03); + + byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0); + byte val2 = ((b2 & SIGN) == 0) ? (byte) (b2 >> 4) : (byte) ((b2) >> 4 ^ 0xf0); + + encodedData[encodedIndex++] = lookUpBase64Alphabet[val1]; + encodedData[encodedIndex++] = lookUpBase64Alphabet[val2 | (k << 4)]; + encodedData[encodedIndex++] = lookUpBase64Alphabet[l << 2]; + encodedData[encodedIndex++] = PAD; + } + return new String(encodedData); + } + + /** + * Decodes Base64 data into octects + * + * @param encoded string containing Base64 data + * @return Array containind decoded data. + */ + public static byte[] decode(String encoded) + { + if (encoded == null) + { + return null; + } + + char[] base64Data = encoded.toCharArray(); + // remove white spaces + int len = removeWhiteSpace(base64Data); + + if (len % FOURBYTE != 0) + { + return null;// should be divisible by four + } + + int numberQuadruple = (len / FOURBYTE); + + if (numberQuadruple == 0) + { + return new byte[0]; + } + + byte decodedData[] = null; + byte b1 = 0, b2 = 0, b3 = 0, b4 = 0; + char d1 = 0, d2 = 0, d3 = 0, d4 = 0; + + int i = 0; + int encodedIndex = 0; + int dataIndex = 0; + decodedData = new byte[(numberQuadruple) * 3]; + + for (; i < numberQuadruple - 1; i++) + { + + if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++])) + || !isData((d3 = base64Data[dataIndex++])) || !isData((d4 = base64Data[dataIndex++]))) + { + return null; + } // if found "no data" just return null + + b1 = base64Alphabet[d1]; + b2 = base64Alphabet[d2]; + b3 = base64Alphabet[d3]; + b4 = base64Alphabet[d4]; + + decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4); + decodedData[encodedIndex++] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf)); + decodedData[encodedIndex++] = (byte) (b3 << 6 | b4); + } + + if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++]))) + { + return null;// if found "no data" just return null + } + + b1 = base64Alphabet[d1]; + b2 = base64Alphabet[d2]; + + d3 = base64Data[dataIndex++]; + d4 = base64Data[dataIndex++]; + if (!isData((d3)) || !isData((d4))) + {// Check if they are PAD characters + if (isPad(d3) && isPad(d4)) + { + if ((b2 & 0xf) != 0)// last 4 bits should be zero + { + return null; + } + byte[] tmp = new byte[i * 3 + 1]; + System.arraycopy(decodedData, 0, tmp, 0, i * 3); + tmp[encodedIndex] = (byte) (b1 << 2 | b2 >> 4); + return tmp; + } + else if (!isPad(d3) && isPad(d4)) + { + b3 = base64Alphabet[d3]; + if ((b3 & 0x3) != 0)// last 2 bits should be zero + { + return null; + } + byte[] tmp = new byte[i * 3 + 2]; + System.arraycopy(decodedData, 0, tmp, 0, i * 3); + tmp[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4); + tmp[encodedIndex] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf)); + return tmp; + } + else + { + return null; + } + } + else + { // No PAD e.g 3cQl + b3 = base64Alphabet[d3]; + b4 = base64Alphabet[d4]; + decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4); + decodedData[encodedIndex++] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf)); + decodedData[encodedIndex++] = (byte) (b3 << 6 | b4); + + } + return decodedData; + } + + /** + * remove WhiteSpace from MIME containing encoded Base64 data. + * + * @param data the byte array of base64 data (with WS) + * @return the new length + */ + private static int removeWhiteSpace(char[] data) + { + if (data == null) + { + return 0; + } + + // count characters that's not whitespace + int newSize = 0; + int len = data.length; + for (int i = 0; i < len; i++) + { + if (!isWhiteSpace(data[i])) + { + data[newSize++] = data[i]; + } + } + return newSize; + } +} diff --git a/health_common/src/main/java/cn/card/health/common/utils/spring/SecurityUtils.java b/health_common/src/main/java/cn/card/health/common/utils/spring/SecurityUtils.java new file mode 100644 index 0000000..0422fed --- /dev/null +++ b/health_common/src/main/java/cn/card/health/common/utils/spring/SecurityUtils.java @@ -0,0 +1,105 @@ +package cn.card.health.common.utils.spring; + +import cn.card.health.bean.user.LoginUser; +import cn.card.health.common.exception.base.ServiceException; +import cn.card.health.common.utils.HttpStatus; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; + +/** + * 安全服务工具类 + * + * @author ruoyi + */ +public class SecurityUtils +{ + /** + * 用户ID + **/ + public static Long getUserId() + { + try + { + return getLoginUser().getUserid(); + } + catch (Exception e) + { + throw new ServiceException("获取用户ID异常", HttpStatus.UNAUTHORIZED); + } + } + + /** + * 获取用户账户 + **/ + public static String getUsername() + { + try + { + return getLoginUser().getUsername(); + } + catch (Exception e) + { + throw new ServiceException("获取用户账户异常", HttpStatus.UNAUTHORIZED); + } + } + + /** + * 获取用户 + **/ + public static LoginUser getLoginUser() + { + try + { + return (LoginUser) getAuthentication().getPrincipal(); + } + catch (Exception e) + { + throw new ServiceException("获取用户信息异常", HttpStatus.UNAUTHORIZED); + } + } + + /** + * 获取Authentication + */ + public static Authentication getAuthentication() + { + return SecurityContextHolder.getContext().getAuthentication(); + } + + /** + * 生成BCryptPasswordEncoder密码 + * + * @param password 密码 + * @return 加密字符串 + */ + public static String encryptPassword(String password) + { + BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); + return passwordEncoder.encode(password); + } + + /** + * 判断密码是否相同 + * + * @param rawPassword 真实密码 + * @param encodedPassword 加密后字符 + * @return 结果 + */ + public static boolean matchesPassword(String rawPassword, String encodedPassword) + { + BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); + return passwordEncoder.matches(rawPassword, encodedPassword); + } + + /** + * 是否为管理员 + * + * @param userId 用户ID + * @return 结果 + */ + public static boolean isAdmin(Long userId) + { + return userId != null && 1L == userId; + } +} diff --git a/health_common/src/main/java/cn/card/health/common/utils/spring/SpringUtils.java b/health_common/src/main/java/cn/card/health/common/utils/spring/SpringUtils.java new file mode 100644 index 0000000..c7daf27 --- /dev/null +++ b/health_common/src/main/java/cn/card/health/common/utils/spring/SpringUtils.java @@ -0,0 +1,146 @@ +package cn.card.health.common.utils.spring; + +import cn.card.health.common.utils.StringUtils; +import org.springframework.aop.framework.AopContext; +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.NoSuchBeanDefinitionException; +import org.springframework.beans.factory.config.BeanFactoryPostProcessor; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.stereotype.Component; + +/** + * spring工具类 方便在非spring管理环境中获取bean + * + * @author ruoyi + */ +@Component +public final class SpringUtils implements BeanFactoryPostProcessor, ApplicationContextAware +{ + /** Spring应用上下文环境 */ + private static ConfigurableListableBeanFactory beanFactory; + + private static ApplicationContext applicationContext; + + @Override + public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException + { + SpringUtils.beanFactory = beanFactory; + } + + @Override + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException + { + SpringUtils.applicationContext = applicationContext; + } + + /** + * 获取对象 + * + * @param name + * @return Object 一个以所给名字注册的bean的实例 + * @throws BeansException + * + */ + @SuppressWarnings("unchecked") + public static T getBean(String name) throws BeansException + { + return (T) beanFactory.getBean(name); + } + + /** + * 获取类型为requiredType的对象 + * + * @param clz + * @return + * @throws BeansException + * + */ + public static T getBean(Class clz) throws BeansException + { + T result = (T) beanFactory.getBean(clz); + return result; + } + + /** + * 如果BeanFactory包含一个与所给名称匹配的bean定义,则返回true + * + * @param name + * @return boolean + */ + public static boolean containsBean(String name) + { + return beanFactory.containsBean(name); + } + + /** + * 判断以给定名字注册的bean定义是一个singleton还是一个prototype。 如果与给定名字相应的bean定义没有被找到,将会抛出一个异常(NoSuchBeanDefinitionException) + * + * @param name + * @return boolean + * @throws NoSuchBeanDefinitionException + * + */ + public static boolean isSingleton(String name) throws NoSuchBeanDefinitionException + { + return beanFactory.isSingleton(name); + } + + /** + * @param name + * @return Class 注册对象的类型 + * @throws NoSuchBeanDefinitionException + * + */ + public static Class getType(String name) throws NoSuchBeanDefinitionException + { + return beanFactory.getType(name); + } + + /** + * 如果给定的bean名字在bean定义中有别名,则返回这些别名 + * + * @param name + * @return + * @throws NoSuchBeanDefinitionException + * + */ + public static String[] getAliases(String name) throws NoSuchBeanDefinitionException + { + return beanFactory.getAliases(name); + } + + /** + * 获取aop代理对象 + * + * @param invoker + * @return + */ + @SuppressWarnings("unchecked") + public static T getAopProxy(T invoker) + { + return (T) AopContext.currentProxy(); + } + + /** + * 获取当前的环境配置,无配置返回null + * + * @return 当前的环境配置 + */ + public static String[] getActiveProfiles() + { + return applicationContext.getEnvironment().getActiveProfiles(); + } + + /** + * 获取当前的环境配置,当有多个环境配置时,只获取第一个 + * + * @return 当前的环境配置 + */ + public static String getActiveProfile() + { + final String[] activeProfiles = getActiveProfiles(); + return StringUtils.isNotEmpty(activeProfiles) ? activeProfiles[0] : null; + } +} diff --git a/health_common/src/main/java/cn/card/health/common/utils/wechat/AESUtils.java b/health_common/src/main/java/cn/card/health/common/utils/wechat/AESUtils.java new file mode 100644 index 0000000..5df8a34 --- /dev/null +++ b/health_common/src/main/java/cn/card/health/common/utils/wechat/AESUtils.java @@ -0,0 +1,78 @@ +package cn.card.health.common.utils.wechat; + +import javax.crypto.Cipher; +import javax.crypto.NoSuchPaddingException; +import javax.crypto.spec.GCMParameterSpec; +import javax.crypto.spec.SecretKeySpec; +import java.io.IOException; +import java.security.GeneralSecurityException; +import java.security.InvalidAlgorithmParameterException; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; +import java.util.Base64; + +public class AESUtils { + static final int KEY_LENGTH_BYTE = 32; + static final int TAG_LENGTH_BIT = 128; + private final byte[] aesKey; + + private final static String keyv3 = "BE3F4E196937F9308899D7CA4C8664AA"; +//private final static String keyv3 = WechatConfig.service_app_secret_v3; + + public AESUtils(byte[] key) { + if (key.length != 32) { + throw new IllegalArgumentException("无效的ApiV3Key,长度必须为32个字节"); + } + this.aesKey = key; + } + + public AESUtils() { + this.aesKey = keyv3.getBytes(); + } + + public String decryptToString(byte[] associatedData, byte[] nonce, String ciphertext) + throws GeneralSecurityException, IOException { + try { + Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding"); + + SecretKeySpec key = new SecretKeySpec(this.aesKey, "AES"); + GCMParameterSpec spec = new GCMParameterSpec(128, nonce); +// Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider()); + cipher.init(2, key, spec); + cipher.updateAAD(associatedData); + + return new String(cipher.doFinal(Base64.getDecoder().decode(ciphertext)), "utf-8"); + } catch (NoSuchAlgorithmException | NoSuchPaddingException e) { + throw new IllegalStateException(e); + } catch (InvalidKeyException | InvalidAlgorithmParameterException e) { + throw new IllegalArgumentException(e); + } + } + +// public static void main(String[] args) { +//// System.out.println("11"); +// String associatedData = "transaction"; +// String nonce = "60wDrk25d4fo"; +// String ciphertext = "G9zwQQvWMRUO27R+ko8c3bhGupbL0c/9OUPHPiH6bF9xXYJG0yXbnl25v6kC/Il+k0qOnDXFa5ifsVOVN2UCpDFK/EdoAsFMvm7+xOQV4Ala0oFgiaOQyy63WGeCH6KODDvpJS7ujVJ+Z3rmt+up3dgrhzv57wc0MOqNI0xvzBIAPoYwSI8P3FLdzS28+8/WfeoC4cbLfDZGAkmjmdsxIdLDbWfFL2RYa4B3PnBrcp2dTwfGLjb0V1phY4jwBxI5McKChFY3spp7GKLpmJ1cBYZ5E3vbpZEARXXTPS0Ql6cqeMBL9vizkECAe4AxH38MbO+c+kL/+ofvdLJvJe0XBOfpGFjM8squ66oi3y7BlNw3vOx5sdnQ0WggZWEzsFaKDmcGoDe9xD+4NYe7lvcgYCBpmYRdjQWa9nlQ36q9ind4FJwdGVZiBx8DnVabGtPlpnyrKpE+soucF9Z0Ne+B68zCzBnhXL9i2rH24D07ul+ah1Wdna9ioaZG1P1Rszp2MFqA//Yxbs3fHQbq/jZ917Qjh8vUPu9EYpsMgDiIyrcU5V2+HodJnKnYZib1D3uNjfw5PugBD37jkSfZIEs4dA=="; +// AESUtils aes = new AESUtils(keyv3.getBytes()); +// String content; +// try { +// content = aes.decryptToString(associatedData.getBytes(), nonce.getBytes(), ciphertext); +// System.out.println(content); +// } catch (GeneralSecurityException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } catch (IOException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } +// +//// String content = "鏀粯鎴愬姛"; +//// try { +//// System.out.println(new String(content.getBytes("GBK"), "utf-8")); +//// } catch (UnsupportedEncodingException e) { +//// // TODO Auto-generated catch block +//// e.printStackTrace(); +//// } +// } +} \ No newline at end of file diff --git a/health_common/src/main/java/cn/card/health/common/utils/wechat/ResponseWechatJSON.java b/health_common/src/main/java/cn/card/health/common/utils/wechat/ResponseWechatJSON.java new file mode 100644 index 0000000..626b6c0 --- /dev/null +++ b/health_common/src/main/java/cn/card/health/common/utils/wechat/ResponseWechatJSON.java @@ -0,0 +1,161 @@ +package cn.card.health.common.utils.wechat; + +import com.alibaba.fastjson.JSONObject; + +import cn.card.health.common.utils.BaseResultJSON; + +/** + * 用来接收微信返回参数 + * + * @author xinggm + * @date 2021年5月27日 + */ +public class ResponseWechatJSON { + /** 返回json */ + private JSONObject jsonResp; + /** 返回commonOutjson */ + private JSONObject jsonCommonOut; + /** 返回json */ + private JSONObject jsonRsp; + /** 请求requestId */ + private String requestId; + /** 返回值 */ + private int resultCode = -1; + + private BaseResultJSON baseResultJSON; + /** 错误消息 */ + private String errMsg; + + ResponseWechatJSON() { + } + + ResponseWechatJSON(JSONObject json) { + this.jsonResp = json; + if (this.jsonResp == null || !this.jsonResp.containsKey("commonOut")) { + JSONObject retJson = new JSONObject(); + this.jsonCommonOut = retJson; + this.baseResultJSON = new BaseResultJSON(resultCode, "微信返回数据为空"); + return; + } + this.setJsonCommonOut(this.jsonResp.getJSONObject("commonOut")); + this.setJsonRsp(this.getJsonResp().getJSONObject("rsp")); + this.baseResultJSON.putAll(this.getJsonRsp()); + } + + ResponseWechatJSON(JSONObject json, String[] keys) { + this.jsonResp = json; + if (this.jsonResp == null || !this.jsonResp.containsKey("commonOut")) { + JSONObject retJson = new JSONObject(); + this.jsonCommonOut = retJson; + this.baseResultJSON = new BaseResultJSON(resultCode, "微信返回数据为空"); + return; + } + this.setJsonCommonOut(this.jsonResp.getJSONObject("commonOut")); + if (this.resultCode == 0) { + this.setJsonRsp(this.getJsonResp().getJSONObject("rsp")); + JSONObject retJson = this.getJsonRsp(keys); + this.getBaseResultJSON().putAll(retJson); + } + } + + /** 初始化 */ + public static ResponseWechatJSON getInstance() { + return new ResponseWechatJSON(); + } + + /** 初始化 */ + public static ResponseWechatJSON getInstance(JSONObject json) { + return new ResponseWechatJSON(json); + } + + /** 初始化 */ + public static ResponseWechatJSON getInstance(JSONObject json, String... keys) { + return new ResponseWechatJSON(json, keys); + } + + /** 获得公共参数 */ + public void getCommonOut(JSONObject json) { + if (json != null) { + } + } + + /** 获得公共参数 */ + public void getCommonOut() { + + } + + public String getRequestId() { + return requestId; + } + + public void setRequestId(String requestId) { + this.requestId = requestId; + } + + public int getResultCode() { + return resultCode; + } + + public void setResultCode(int resultCode) { + this.resultCode = resultCode; + } + + public String getErrMsg() { + return errMsg; + } + + public void setErrMsg(String errMsg) { + this.errMsg = errMsg; + } + + public JSONObject getJsonResp() { + return jsonResp; + } + + public void setJsonResp(JSONObject jsonResp) { + this.jsonResp = jsonResp; + } + + public JSONObject getJsonCommonOut() { + return jsonCommonOut; + } + + public void setJsonCommonOut(JSONObject jsonCommonOut) { + this.jsonCommonOut = jsonCommonOut; + if (this.jsonCommonOut != null) { + this.resultCode = jsonCommonOut.getIntValue("resultCode"); + this.requestId = jsonCommonOut.getString("requestId"); + this.errMsg = jsonCommonOut.getString("errMsg"); + } + this.baseResultJSON = new BaseResultJSON(this.resultCode, this.errMsg); + } + + public JSONObject getJsonRsp(String... keys) { + if (keys == null || keys.length == 0) + return jsonRsp; + else { + JSONObject retJson = this.jsonRsp; + for (String key : keys) { + retJson = retJson.getJSONObject(key); + } + return retJson; + } + + } + + public void setJsonRsp(JSONObject jsonRsp) { + this.jsonRsp = jsonRsp; +// if (this.jsonResp == null) { +// this.baseResultJSON = BaseResultJSON.error(this.resultCode, "微信返回错误"); +// return; +// } +// if (this.jsonResp.containsKey("commonOut")) { +// this.setJsonCommonOut(jsonResp.getJSONObject("commonOut")); +// } + } + + public BaseResultJSON getBaseResultJSON() { + return baseResultJSON; + } + +} diff --git a/health_common/target/classes/cn/card/health/bean/hospital/YcHospital.class b/health_common/target/classes/cn/card/health/bean/hospital/YcHospital.class new file mode 100644 index 0000000..3b823c0 Binary files /dev/null and b/health_common/target/classes/cn/card/health/bean/hospital/YcHospital.class differ diff --git a/health_common/target/classes/cn/card/health/bean/hospital/YcPatient.class b/health_common/target/classes/cn/card/health/bean/hospital/YcPatient.class new file mode 100644 index 0000000..232f951 Binary files /dev/null and b/health_common/target/classes/cn/card/health/bean/hospital/YcPatient.class differ diff --git a/health_common/target/classes/cn/card/health/bean/user/LoginUser.class b/health_common/target/classes/cn/card/health/bean/user/LoginUser.class new file mode 100644 index 0000000..b12df5d Binary files /dev/null and b/health_common/target/classes/cn/card/health/bean/user/LoginUser.class differ diff --git a/health_common/target/classes/cn/card/health/bean/user/YcAuthority.class b/health_common/target/classes/cn/card/health/bean/user/YcAuthority.class new file mode 100644 index 0000000..0d8b251 Binary files /dev/null and b/health_common/target/classes/cn/card/health/bean/user/YcAuthority.class differ diff --git a/health_common/target/classes/cn/card/health/bean/user/YcInhospPatient.class b/health_common/target/classes/cn/card/health/bean/user/YcInhospPatient.class new file mode 100644 index 0000000..d17fb71 Binary files /dev/null and b/health_common/target/classes/cn/card/health/bean/user/YcInhospPatient.class differ diff --git a/health_common/target/classes/cn/card/health/bean/user/YcOAuth.class b/health_common/target/classes/cn/card/health/bean/user/YcOAuth.class new file mode 100644 index 0000000..e92bd5f Binary files /dev/null and b/health_common/target/classes/cn/card/health/bean/user/YcOAuth.class differ diff --git a/health_common/target/classes/cn/card/health/bean/user/YcUser.class b/health_common/target/classes/cn/card/health/bean/user/YcUser.class new file mode 100644 index 0000000..7599240 Binary files /dev/null and b/health_common/target/classes/cn/card/health/bean/user/YcUser.class differ diff --git a/health_common/target/classes/cn/card/health/common/constant/Constants.class b/health_common/target/classes/cn/card/health/common/constant/Constants.class new file mode 100644 index 0000000..47e497f Binary files /dev/null and b/health_common/target/classes/cn/card/health/common/constant/Constants.class differ diff --git a/health_common/target/classes/cn/card/health/common/core/ApplicationContextUtil.class b/health_common/target/classes/cn/card/health/common/core/ApplicationContextUtil.class new file mode 100644 index 0000000..fb91e55 Binary files /dev/null and b/health_common/target/classes/cn/card/health/common/core/ApplicationContextUtil.class differ diff --git a/health_common/target/classes/cn/card/health/common/core/ServletUtils.class b/health_common/target/classes/cn/card/health/common/core/ServletUtils.class new file mode 100644 index 0000000..0af82d0 Binary files /dev/null and b/health_common/target/classes/cn/card/health/common/core/ServletUtils.class differ diff --git a/health_common/target/classes/cn/card/health/common/core/SqlUtil.class b/health_common/target/classes/cn/card/health/common/core/SqlUtil.class new file mode 100644 index 0000000..34b5d39 Binary files /dev/null and b/health_common/target/classes/cn/card/health/common/core/SqlUtil.class differ diff --git a/health_common/target/classes/cn/card/health/common/enums/EnumMethod.class b/health_common/target/classes/cn/card/health/common/enums/EnumMethod.class new file mode 100644 index 0000000..258951d Binary files /dev/null and b/health_common/target/classes/cn/card/health/common/enums/EnumMethod.class differ diff --git a/health_common/target/classes/cn/card/health/common/exception/base/BaseException.class b/health_common/target/classes/cn/card/health/common/exception/base/BaseException.class new file mode 100644 index 0000000..0889978 Binary files /dev/null and b/health_common/target/classes/cn/card/health/common/exception/base/BaseException.class differ diff --git a/health_common/target/classes/cn/card/health/common/exception/base/ServiceException.class b/health_common/target/classes/cn/card/health/common/exception/base/ServiceException.class new file mode 100644 index 0000000..9c8bf40 Binary files /dev/null and b/health_common/target/classes/cn/card/health/common/exception/base/ServiceException.class differ diff --git a/health_common/target/classes/cn/card/health/common/page/PageDomain.class b/health_common/target/classes/cn/card/health/common/page/PageDomain.class new file mode 100644 index 0000000..53bb451 Binary files /dev/null and b/health_common/target/classes/cn/card/health/common/page/PageDomain.class differ diff --git a/health_common/target/classes/cn/card/health/common/page/TableDataInfo.class b/health_common/target/classes/cn/card/health/common/page/TableDataInfo.class new file mode 100644 index 0000000..4d77f32 Binary files /dev/null and b/health_common/target/classes/cn/card/health/common/page/TableDataInfo.class differ diff --git a/health_common/target/classes/cn/card/health/common/page/TableSupport.class b/health_common/target/classes/cn/card/health/common/page/TableSupport.class new file mode 100644 index 0000000..0394ecc Binary files /dev/null and b/health_common/target/classes/cn/card/health/common/page/TableSupport.class differ diff --git a/health_common/target/classes/cn/card/health/common/redis/FastJson2JsonRedisSerializer.class b/health_common/target/classes/cn/card/health/common/redis/FastJson2JsonRedisSerializer.class new file mode 100644 index 0000000..52d4d7f Binary files /dev/null and b/health_common/target/classes/cn/card/health/common/redis/FastJson2JsonRedisSerializer.class differ diff --git a/health_common/target/classes/cn/card/health/common/redis/RedisCache.class b/health_common/target/classes/cn/card/health/common/redis/RedisCache.class new file mode 100644 index 0000000..f8e85bb Binary files /dev/null and b/health_common/target/classes/cn/card/health/common/redis/RedisCache.class differ diff --git a/health_common/target/classes/cn/card/health/common/redis/RedisConfig.class b/health_common/target/classes/cn/card/health/common/redis/RedisConfig.class new file mode 100644 index 0000000..0bb79b7 Binary files /dev/null and b/health_common/target/classes/cn/card/health/common/redis/RedisConfig.class differ diff --git a/health_common/target/classes/cn/card/health/common/redis/RedisUtil.class b/health_common/target/classes/cn/card/health/common/redis/RedisUtil.class new file mode 100644 index 0000000..58fe9b3 Binary files /dev/null and b/health_common/target/classes/cn/card/health/common/redis/RedisUtil.class differ diff --git a/health_common/target/classes/cn/card/health/common/utils/BaseResultJSON.class b/health_common/target/classes/cn/card/health/common/utils/BaseResultJSON.class new file mode 100644 index 0000000..757d863 Binary files /dev/null and b/health_common/target/classes/cn/card/health/common/utils/BaseResultJSON.class differ diff --git a/health_common/target/classes/cn/card/health/common/utils/CharsetKit.class b/health_common/target/classes/cn/card/health/common/utils/CharsetKit.class new file mode 100644 index 0000000..f0f7ccb Binary files /dev/null and b/health_common/target/classes/cn/card/health/common/utils/CharsetKit.class differ diff --git a/health_common/target/classes/cn/card/health/common/utils/Convert.class b/health_common/target/classes/cn/card/health/common/utils/Convert.class new file mode 100644 index 0000000..cdf29e0 Binary files /dev/null and b/health_common/target/classes/cn/card/health/common/utils/Convert.class differ diff --git a/health_common/target/classes/cn/card/health/common/utils/DateUtils.class b/health_common/target/classes/cn/card/health/common/utils/DateUtils.class new file mode 100644 index 0000000..e470584 Binary files /dev/null and b/health_common/target/classes/cn/card/health/common/utils/DateUtils.class differ diff --git a/health_common/target/classes/cn/card/health/common/utils/ExceptionUtil.class b/health_common/target/classes/cn/card/health/common/utils/ExceptionUtil.class new file mode 100644 index 0000000..e59eeea Binary files /dev/null and b/health_common/target/classes/cn/card/health/common/utils/ExceptionUtil.class differ diff --git a/health_common/target/classes/cn/card/health/common/utils/HttpStatus.class b/health_common/target/classes/cn/card/health/common/utils/HttpStatus.class new file mode 100644 index 0000000..8fa1fd2 Binary files /dev/null and b/health_common/target/classes/cn/card/health/common/utils/HttpStatus.class differ diff --git a/health_common/target/classes/cn/card/health/common/utils/HttpUtils$1.class b/health_common/target/classes/cn/card/health/common/utils/HttpUtils$1.class new file mode 100644 index 0000000..ed1401a Binary files /dev/null and b/health_common/target/classes/cn/card/health/common/utils/HttpUtils$1.class differ diff --git a/health_common/target/classes/cn/card/health/common/utils/HttpUtils$TrustAnyHostnameVerifier.class b/health_common/target/classes/cn/card/health/common/utils/HttpUtils$TrustAnyHostnameVerifier.class new file mode 100644 index 0000000..3d8e967 Binary files /dev/null and b/health_common/target/classes/cn/card/health/common/utils/HttpUtils$TrustAnyHostnameVerifier.class differ diff --git a/health_common/target/classes/cn/card/health/common/utils/HttpUtils$TrustAnyTrustManager.class b/health_common/target/classes/cn/card/health/common/utils/HttpUtils$TrustAnyTrustManager.class new file mode 100644 index 0000000..f1976e9 Binary files /dev/null and b/health_common/target/classes/cn/card/health/common/utils/HttpUtils$TrustAnyTrustManager.class differ diff --git a/health_common/target/classes/cn/card/health/common/utils/HttpUtils.class b/health_common/target/classes/cn/card/health/common/utils/HttpUtils.class new file mode 100644 index 0000000..ec12a62 Binary files /dev/null and b/health_common/target/classes/cn/card/health/common/utils/HttpUtils.class differ diff --git a/health_common/target/classes/cn/card/health/common/utils/JSONUtils.class b/health_common/target/classes/cn/card/health/common/utils/JSONUtils.class new file mode 100644 index 0000000..21f573c Binary files /dev/null and b/health_common/target/classes/cn/card/health/common/utils/JSONUtils.class differ diff --git a/health_common/target/classes/cn/card/health/common/utils/LogUtils.class b/health_common/target/classes/cn/card/health/common/utils/LogUtils.class new file mode 100644 index 0000000..b305e08 Binary files /dev/null and b/health_common/target/classes/cn/card/health/common/utils/LogUtils.class differ diff --git a/health_common/target/classes/cn/card/health/common/utils/MapUtils.class b/health_common/target/classes/cn/card/health/common/utils/MapUtils.class new file mode 100644 index 0000000..1be8976 Binary files /dev/null and b/health_common/target/classes/cn/card/health/common/utils/MapUtils.class differ diff --git a/health_common/target/classes/cn/card/health/common/utils/Md5Utils.class b/health_common/target/classes/cn/card/health/common/utils/Md5Utils.class new file mode 100644 index 0000000..e296ef9 Binary files /dev/null and b/health_common/target/classes/cn/card/health/common/utils/Md5Utils.class differ diff --git a/health_common/target/classes/cn/card/health/common/utils/MessageUtils.class b/health_common/target/classes/cn/card/health/common/utils/MessageUtils.class new file mode 100644 index 0000000..1af6e35 Binary files /dev/null and b/health_common/target/classes/cn/card/health/common/utils/MessageUtils.class differ diff --git a/health_common/target/classes/cn/card/health/common/utils/MyX509TrustManager.class b/health_common/target/classes/cn/card/health/common/utils/MyX509TrustManager.class new file mode 100644 index 0000000..1eca4fd Binary files /dev/null and b/health_common/target/classes/cn/card/health/common/utils/MyX509TrustManager.class differ diff --git a/health_common/target/classes/cn/card/health/common/utils/SSLClient$1.class b/health_common/target/classes/cn/card/health/common/utils/SSLClient$1.class new file mode 100644 index 0000000..0de4189 Binary files /dev/null and b/health_common/target/classes/cn/card/health/common/utils/SSLClient$1.class differ diff --git a/health_common/target/classes/cn/card/health/common/utils/SSLClient.class b/health_common/target/classes/cn/card/health/common/utils/SSLClient.class new file mode 100644 index 0000000..b092482 Binary files /dev/null and b/health_common/target/classes/cn/card/health/common/utils/SSLClient.class differ diff --git a/health_common/target/classes/cn/card/health/common/utils/StrFormatter.class b/health_common/target/classes/cn/card/health/common/utils/StrFormatter.class new file mode 100644 index 0000000..f6adb87 Binary files /dev/null and b/health_common/target/classes/cn/card/health/common/utils/StrFormatter.class differ diff --git a/health_common/target/classes/cn/card/health/common/utils/StringUtils.class b/health_common/target/classes/cn/card/health/common/utils/StringUtils.class new file mode 100644 index 0000000..8dcdab2 Binary files /dev/null and b/health_common/target/classes/cn/card/health/common/utils/StringUtils.class differ diff --git a/health_common/target/classes/cn/card/health/common/utils/XMLUtils.class b/health_common/target/classes/cn/card/health/common/utils/XMLUtils.class new file mode 100644 index 0000000..01a4753 Binary files /dev/null and b/health_common/target/classes/cn/card/health/common/utils/XMLUtils.class differ diff --git a/health_common/target/classes/cn/card/health/common/utils/http/HttpRequestUtil.class b/health_common/target/classes/cn/card/health/common/utils/http/HttpRequestUtil.class new file mode 100644 index 0000000..8949fbf Binary files /dev/null and b/health_common/target/classes/cn/card/health/common/utils/http/HttpRequestUtil.class differ diff --git a/health_common/target/classes/cn/card/health/common/utils/http/Https.class b/health_common/target/classes/cn/card/health/common/utils/http/Https.class new file mode 100644 index 0000000..ebc5ca6 Binary files /dev/null and b/health_common/target/classes/cn/card/health/common/utils/http/Https.class differ diff --git a/health_common/target/classes/cn/card/health/common/utils/sign/AESHelper.class b/health_common/target/classes/cn/card/health/common/utils/sign/AESHelper.class new file mode 100644 index 0000000..66c45d9 Binary files /dev/null and b/health_common/target/classes/cn/card/health/common/utils/sign/AESHelper.class differ diff --git a/health_common/target/classes/cn/card/health/common/utils/sign/Base64.class b/health_common/target/classes/cn/card/health/common/utils/sign/Base64.class new file mode 100644 index 0000000..195595d Binary files /dev/null and b/health_common/target/classes/cn/card/health/common/utils/sign/Base64.class differ diff --git a/health_common/target/classes/cn/card/health/common/utils/spring/SecurityUtils.class b/health_common/target/classes/cn/card/health/common/utils/spring/SecurityUtils.class new file mode 100644 index 0000000..9076d18 Binary files /dev/null and b/health_common/target/classes/cn/card/health/common/utils/spring/SecurityUtils.class differ diff --git a/health_common/target/classes/cn/card/health/common/utils/spring/SpringUtils.class b/health_common/target/classes/cn/card/health/common/utils/spring/SpringUtils.class new file mode 100644 index 0000000..2c808cf Binary files /dev/null and b/health_common/target/classes/cn/card/health/common/utils/spring/SpringUtils.class differ diff --git a/health_common/target/classes/cn/card/health/common/utils/wechat/AESUtils.class b/health_common/target/classes/cn/card/health/common/utils/wechat/AESUtils.class new file mode 100644 index 0000000..8852487 Binary files /dev/null and b/health_common/target/classes/cn/card/health/common/utils/wechat/AESUtils.class differ diff --git a/health_common/target/classes/cn/card/health/common/utils/wechat/ResponseWechatJSON.class b/health_common/target/classes/cn/card/health/common/utils/wechat/ResponseWechatJSON.class new file mode 100644 index 0000000..c0e0cb7 Binary files /dev/null and b/health_common/target/classes/cn/card/health/common/utils/wechat/ResponseWechatJSON.class differ diff --git a/health_common/target/health_common.jar b/health_common/target/health_common.jar new file mode 100644 index 0000000..1e4ff2b Binary files /dev/null and b/health_common/target/health_common.jar differ diff --git a/health_common/target/maven-archiver/pom.properties b/health_common/target/maven-archiver/pom.properties new file mode 100644 index 0000000..7a8de09 --- /dev/null +++ b/health_common/target/maven-archiver/pom.properties @@ -0,0 +1,3 @@ +version=1.0.2 +groupId=cn.health.service +artifactId=health_common diff --git a/health_common/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/health_common/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 0000000..b1af1cd --- /dev/null +++ b/health_common/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1,50 @@ +cn/card/health/common/utils/StrFormatter.class +cn/card/health/common/page/TableSupport.class +cn/card/health/common/utils/HttpUtils$1.class +cn/card/health/common/constant/Constants.class +cn/card/health/common/core/ServletUtils.class +cn/card/health/bean/hospital/YcHospital.class +cn/card/health/common/redis/RedisCache.class +cn/card/health/common/utils/ExceptionUtil.class +cn/card/health/common/utils/spring/SecurityUtils.class +cn/card/health/common/utils/http/HttpRequestUtil.class +cn/card/health/common/utils/wechat/ResponseWechatJSON.class +cn/card/health/common/utils/MyX509TrustManager.class +cn/card/health/common/utils/http/Https.class +cn/card/health/common/utils/SSLClient.class +cn/card/health/bean/user/YcAuthority.class +cn/card/health/common/page/TableDataInfo.class +cn/card/health/common/page/PageDomain.class +cn/card/health/common/utils/HttpUtils$TrustAnyHostnameVerifier.class +cn/card/health/common/utils/HttpUtils.class +cn/card/health/common/redis/RedisUtil.class +cn/card/health/common/utils/LogUtils.class +cn/card/health/common/utils/CharsetKit.class +cn/card/health/common/utils/HttpStatus.class +cn/card/health/common/utils/SSLClient$1.class +cn/card/health/bean/user/YcInhospPatient.class +cn/card/health/common/utils/spring/SpringUtils.class +cn/card/health/bean/user/YcUser.class +cn/card/health/common/utils/sign/AESHelper.class +cn/card/health/common/utils/Md5Utils.class +cn/card/health/common/utils/XMLUtils.class +cn/card/health/common/utils/DateUtils.class +cn/card/health/common/redis/RedisConfig.class +cn/card/health/common/utils/MapUtils.class +cn/card/health/common/exception/base/ServiceException.class +cn/card/health/common/utils/JSONUtils.class +cn/card/health/common/utils/BaseResultJSON.class +cn/card/health/common/exception/base/BaseException.class +cn/card/health/common/core/ApplicationContextUtil.class +cn/card/health/common/utils/sign/Base64.class +cn/card/health/bean/user/LoginUser.class +cn/card/health/common/core/SqlUtil.class +cn/card/health/bean/user/YcOAuth.class +cn/card/health/common/redis/FastJson2JsonRedisSerializer.class +cn/card/health/common/utils/Convert.class +cn/card/health/bean/hospital/YcPatient.class +cn/card/health/common/enums/EnumMethod.class +cn/card/health/common/utils/wechat/AESUtils.class +cn/card/health/common/utils/MessageUtils.class +cn/card/health/common/utils/StringUtils.class +cn/card/health/common/utils/HttpUtils$TrustAnyTrustManager.class diff --git a/health_common/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/health_common/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 0000000..04d8c06 --- /dev/null +++ b/health_common/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1,49 @@ +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/common/exception/base/BaseException.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/common/utils/Convert.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/common/utils/spring/SecurityUtils.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/common/core/SqlUtil.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/common/utils/XMLUtils.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/bean/user/LoginUser.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/bean/user/YcOAuth.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/common/utils/CharsetKit.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/common/utils/ExceptionUtil.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/common/page/TableDataInfo.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/common/constant/Constants.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/common/utils/http/HttpRequestUtil.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/common/utils/sign/Base64.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/common/page/TableSupport.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/common/utils/JSONUtils.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/bean/hospital/YcPatient.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/common/redis/RedisAutoConfiguration.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/common/utils/spring/SpringUtils.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/common/utils/BaseResultJSON.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/common/redis/RedisConfig.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/bean/user/YcUser.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/common/utils/http/Https.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/common/utils/MessageUtils.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/common/utils/HttpUtils.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/common/utils/sign/AESHelper.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/bean/user/YcInhospPatient.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/common/redis/RedisUtil.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/common/utils/StrFormatter.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/common/utils/DateUtils.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/common/redis/RedisConfig3.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/common/core/ServletUtils.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/bean/hospital/YcHospital.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/common/exception/base/ServiceException.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/bean/user/YcAuthority.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/common/utils/sign/AESUtil.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/common/utils/SSLClient.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/common/utils/LogUtils.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/common/utils/MyX509TrustManager.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/common/enums/EnumMethod.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/common/page/PageDomain.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/common/utils/StringUtils.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/common/utils/HttpStatus.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/common/redis/FastJson2JsonRedisSerializer.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/common/utils/wechat/ResponseWechatJSON.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/common/redis/RedisCache.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/common/utils/wechat/AESUtils.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/common/core/ApplicationContextUtil.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/common/utils/Md5Utils.java +/Users/circlexing/work_java/1/health_parent/health_common/src/main/java/cn/card/health/common/utils/MapUtils.java diff --git a/health_framework/.DS_Store b/health_framework/.DS_Store new file mode 100644 index 0000000..bda045d Binary files /dev/null and b/health_framework/.DS_Store differ diff --git a/health_framework/pom.xml b/health_framework/pom.xml new file mode 100644 index 0000000..6e98e51 --- /dev/null +++ b/health_framework/pom.xml @@ -0,0 +1,142 @@ + + + 4.0.0 + + cn.health.service + health-parent + 1.0.2 + + health_framework + health_framework + http://maven.apache.org + + UTF-8 + + + + + javax.servlet + javax.servlet-api + + + + com.squareup.okhttp3 + okhttp + + + + + + + + org.bouncycastle + bcprov-jdk15on + + + + com.alibaba + druid-spring-boot-starter + + + + org.springframework.boot + spring-boot + + + + + com.alipay.sdk + alipay-sdk-java + + + + + + + + + + + + + + + cn.health.service + health_his + + + + + + + + + + + io.jsonwebtoken + jjwt + 0.9.1 + + + com.tencent + open-platform-sdk-1.6-jdk + + + + + icbc-api-sdk-cop + icbc-api-sdk-cop + 1.0 + + system + ${project.basedir}/src/main/resources/jar/icbc-api-sdk-cop.jar + + + icbc-api-sdk-cop-io + icbc-api-sdk-cop-io + 1.0 + + system + ${project.basedir}/src/main/resources/jar/icbc-api-sdk-cop-io.jar + + + hsm-software-share + hsm-software-share + 1.0.5 + + system + ${project.basedir}/src/main/resources/jar/hsm-software-share-1.0.5.jar + + + icbc-ca.ja + icbc-ca.ja + 1.0 + + system + ${project.basedir}/src/main/resources/jar/icbc-ca.jar + + + InfosecCrypto_Java1_02_JDK14 + InfosecCrypto_Java1_02_JDK14 + 1.0 + + system + ${project.basedir}/src/main/resources/jar/InfosecCrypto_Java1_02_JDK14+.jar + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + true + + + + + diff --git a/health_framework/src/.DS_Store b/health_framework/src/.DS_Store new file mode 100644 index 0000000..23ea0b7 Binary files /dev/null and b/health_framework/src/.DS_Store differ diff --git a/health_framework/src/main/.DS_Store b/health_framework/src/main/.DS_Store new file mode 100644 index 0000000..5c06836 Binary files /dev/null and b/health_framework/src/main/.DS_Store differ diff --git a/health_framework/src/main/java/cn/card/health/alipay/config/AlipayAppletConfig.java b/health_framework/src/main/java/cn/card/health/alipay/config/AlipayAppletConfig.java new file mode 100644 index 0000000..5de78a4 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/alipay/config/AlipayAppletConfig.java @@ -0,0 +1,129 @@ +package cn.card.health.alipay.config; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +/** + * 支付宝小程序配置 + * + * @author xl + */ +@Component +public class AlipayAppletConfig { + + public static String appid = "2021003162675444"; + public static String app_private_key = "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQC5JmQ4tzgPZZW6WsQLTO60ZDJn2OgtAJb9MNbCIzXbGvnQVYqzdbq+LctiBw52swOgI4rSjPQWKoxnpEBnYbubYCCxldWC7LXATTEXw8HigDADg5V/1+kydGZfzlov48NesryolYgev++9G2qVs7nIc8HaDCqW7JFB7ZWkYYViykujjcrBz8ZOQKZbRwYbm2KoqIXDFEjH0pf3uamqgUqWfRg4KISV/e8zZ0RqYnruN1zVUVU6FVylsYzVF4qQSjpoB1CowXzaNPiBbdCm4GwqZ8hGNGxsqpa1TJJ83G3smp13rUni+6lpk2i+y+D1q67X0crVNUAcI55CDREySmY3AgMBAAECggEAEuT4FVGdRvT28q2QlBalxYL0IeTgzLbisbPqNqWhOVrnY3tXTDkXdZD20Gon77UVCaKW6CW6QwjUiz8X03UF0DVfIMBJqbK+WYGHIQW5I4QxYiprd0Bxa9S1HdHRIlH7/g3/crTPz1OHA6Vomx5cNziY78eOERjTOgck3kGVex89WuhcwqPDhC/V1bbQyANSOBo9/xSjmpK9mviwMP14f1S1xjkMCP/kCK+ZBA+LEAMhGoAR53UY9Q4kWVoaWJkIAkk16nLpgn+ggPLQtcZx+Opyf70o7200vOaD5TJByJBBBz3kdeowgy8xX4Lp7OdfJ1SzHKlbeHapW/4Q5dR6AQKBgQDk+k94qHmUixvhF7OcQTyy96u5F5mS2BVww6ikkIWDO+qCYI5RiLAJ+a4ZIdIeuFNX2hUteUTtgpdA/kWt0kW65mYJYKqEriEwMfqrej8NIdaL2hUscUR4q3GOa7RsxN1ow0bu/yOb4Mp3u4ygQHfzbK8ZHtC3B9VzEV7kyZGSDwKBgQDO//24kVrbt2EEvs31iMIfVKT8sh2EW+Xfoq1gmNkecVb7s4Nz5G0+UD6dq3Ob69rKRyH1PrV4jCuycTbF+oUWWIzBBGIl5ejL9oTXrZTTa+tws8pmskiPkMYplwuQqhxhIDsJSixS1zBE93JWJnQwcbmRM3c1t77Jteh5bWpxWQKBgFS1eXMEuL3IXM8ACrVSuRboY0H9RhY6FGx8JcaDpLDxGIeVGvF05NM76Dlp9qbgwAxvJIiHJYXMWxJzPunYMW28UKFFfq/JD4QZ6UdI2UyNaSahzlV7rb4Kht8OX1gh2FsqavJ9tvmyxpRW8OZUE0wduAVODh64KjIAih+PpmfnAoGAEGIcb7Y5bbhm2lxLqspHKvmlEUb7pRUs7XVPqZyPWqR30PYVSl/i8ZKiUhJW1RlmuKnGm0V6UW8uqjHhtuusCue5RDGXnw5CTZpWS0e2xsD84m+oblZf/dTkijglNy7vjhRh98tCFNBpRpwbFYx3l7n4iPB81+iSFh7qpmmtigkCgYBObJuGChOOn5INcbUK/z99Jx8+Qi4s/YPTfH7sG9ZDX1pofhMLS2KuIt/1K/AS+khRlaRlxcrXHbMNNqTw03t17OTQaM4EQV653qjhSnqK758u+4iAbtIp85XLUnA028p/MtmmWsO+QqHO/IAFCCeMoXv6EM4/WQQ1Cqvnfy5AbQ=="; + public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmXO0GOwHf8ikGcXobNlHb7aCQXk1Is6mKapbw8RjLlZu45FMhZMA14iCFJNfMjzcrg/7K0OFjXok2ze1Sc5d8jg+DbqwsgitJaV8eXHBPEK9Q02B1r0V0F9ns1xrByJ/Xvh6AbTCzExdHqNLJ+k+XPtjKd1DJOeck97Jp9JvmRh/pPPycPCuzrNYc2Fc9K/Lc3ubIGG6dbVf5s4EkR59guYZW6akidSR+H5aLnd1fyHqA1IVNbYhKcf3eufQN/OUhpHyC0a3BhxYKZTUITkv90TEdD+F80wyQvBrwhW2imor9OaBZ1O+0sJF4H9c9CMiCL9DOuBAJPccW8+JTMyU3QIDAQAB"; + public static String notify_url = ""; + public static String notify_insure_url = ""; + + /** 定点医药机构在移动支付中心申请的应用Id */ + public static final String org_app_id = "1GI1ID7O302G3F60C80A000072E7D954"; + /** 定点医药机构编码 */ + public static String org_no = "H13040207288"; + /** 机构渠道认证编码 */ + public static String org_chnl_crtf_code = "BqK1kMStlhVDgN2uHf4EsP9BQzovPtfTZGwRsyhqMMYAPlh8CUlCz1bMGY9466pv"; + /** 合作伙伴返佣pid 启乾康年 */ + public static String sys_service_provider_id = "2088231470958092"; + /** 医药机构名称 */ + public static String org_name = "邯郸中西医结合医院"; + /** 医保应用id */ + public static String in_appid = "1GI1ID7O302G3F60C80A000072E7D954"; + /** 医保应用密钥 */ + public static String in_app_secret = "1GI1ID7O802H3F60C80A00004577BF86"; + /** 医保应用私钥 */ + public static String in_app_private_key = "f1zWciLuLwbFTXABJHVvlqWq+eLmWE7cPBiww7cLBHM="; + /** 医保平台公钥 */ + public static String in_app_public_key = "BMt9tdobkT3LLFrJptGJ/J4YHb9BB6OwLiRedD8yKxRj3S+8K1woa6NL2sEk5HyJCiW1yLskyxFoYFbl581yAms="; + /** 医保服务地址 */ + public static String in_url = "https://test.pub.ylbzj.yhwch.com:8089/pmc"; + + @Value("${alipay.appid}") + public void setAppId(String appid) { + AlipayAppletConfig.appid = appid; + } + + @Value("${alipay.app_private_key}") + public void setAppPrivateKey(String app_private_key) { + AlipayAppletConfig.app_private_key = app_private_key; + } + + @Value("${alipay.alipay_public_key}") + public void setAliPayPublicKey(String alipay_public_key) { + AlipayAppletConfig.alipay_public_key = alipay_public_key; + } + + @Value("${alipay.notify_url}") + public void setNotifyUrl(String notify_url) { + AlipayAppletConfig.notify_url = notify_url; + } + + @Value("${alipay.appid}") + public void setAppid(String appid) { + AlipayAppletConfig.appid = appid; + } + + @Value("${alipay.app_private_key}") + public void setApp_private_key(String app_private_key) { + AlipayAppletConfig.app_private_key = app_private_key; + } + + @Value("${alipay.alipay_public_key}") + public void setAlipay_public_key(String alipay_public_key) { + AlipayAppletConfig.alipay_public_key = alipay_public_key; + } + + @Value("${alipay.insurance.test.org_no}") + public void setOrg_no(String org_no) { + AlipayAppletConfig.org_no = org_no; + } + + @Value("${alipay.insurance.test.org_chnl_crtf_code}") + public void setOrg_chnl_crtf_code(String org_chnl_crtf_code) { + AlipayAppletConfig.org_chnl_crtf_code = org_chnl_crtf_code; + } + +// @Value("${alipay.sys_service_provider_id}") +// public void setSys_service_provider_id(String sys_service_provider_id) { +// AlipayAppletConfig.sys_service_provider_id = sys_service_provider_id; +// } + + @Value("${alipay.insurance.test.org_name}") + public void setOrg_name(String org_name) { + AlipayAppletConfig.org_name = org_name; + } + + @Value("${alipay.notify_url}") + public void setNotify_url(String notify_url) { + AlipayAppletConfig.notify_url = notify_url; + } + + @Value("${alipay.insurance.test.in_appid}") + public void setIn_appid(String in_appid) { + AlipayAppletConfig.in_appid = in_appid; + } + @Value("${alipay.insurance.test.in_app_secret}") + public void setIn_app_secret(String in_app_secret) { + AlipayAppletConfig.in_app_secret = in_app_secret; + } + @Value("${alipay.insurance.test.in_app_private_key}") + public void setIn_app_private_key(String in_app_private_key) { + AlipayAppletConfig.in_app_private_key = in_app_private_key; + } + @Value("${alipay.insurance.test.in_app_public_key}") + public void setIn_app_public_key(String in_app_public_key) { + AlipayAppletConfig.in_app_public_key = in_app_public_key; + } + @Value("${alipay.insurance.test.in_url}") + public void setIn_url(String in_url) { + AlipayAppletConfig.in_url = in_url; + } + + public static String getNotify_insure_url() { + return notify_insure_url; + } + @Value("${alipay.notify_insure_url}") + public void setNotify_insure_url(String notify_insure_url) { + AlipayAppletConfig.notify_insure_url = notify_insure_url; + } +} diff --git a/health_framework/src/main/java/cn/card/health/alipay/domain/AlipayOAuthTokenDto.java b/health_framework/src/main/java/cn/card/health/alipay/domain/AlipayOAuthTokenDto.java new file mode 100644 index 0000000..2975637 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/alipay/domain/AlipayOAuthTokenDto.java @@ -0,0 +1,69 @@ +package cn.card.health.framework.service.alipay.domain; + +/** + * 小程序授权返回信息 + * @author xl + * + */ +public class AlipayOAuthTokenDto { + + /** 用户标志 */ + private String userid; + /** 访问令牌 */ + private String accessToken; + /** 刷新令牌 */ + private String refreshToken; + /** 是否成功 */ + private boolean isSuccess; + /** 失败原因 */ + private String msg; + /** 失败代码 */ + private String code; + + public AlipayOAuthTokenDto() { + this.setSuccess(false); + } + public String getUserid() { + return userid; + } + public void setUserid(String userid) { + this.userid = userid; + } + public String getAccessToken() { + return accessToken; + } + public void setAccessToken(String accessToken) { + this.accessToken = accessToken; + } + public String getRefreshToken() { + return refreshToken; + } + public void setRefreshToken(String refreshToken) { + this.refreshToken = refreshToken; + } + + public boolean isSuccess() { + return isSuccess; + } + public void setSuccess(boolean isSuccess) { + this.isSuccess = isSuccess; + } + public String getMsg() { + return msg; + } + public void setMsg(String msg) { + this.msg = msg; + } + public String getCode() { + return code; + } + public void setCode(String code) { + this.code = code; + } + @Override + public String toString() { + return "AlipayOAuthTokenDto [userid=" + userid + ", accessToken=" + accessToken + ", refreshToken=" + + refreshToken + ", isSuccess=" + isSuccess + ", msg=" + msg + ", code=" + code + "]"; + } + +} diff --git a/health_framework/src/main/java/cn/card/health/alipay/pay/AlipayPayService.java b/health_framework/src/main/java/cn/card/health/alipay/pay/AlipayPayService.java new file mode 100644 index 0000000..ebf5102 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/alipay/pay/AlipayPayService.java @@ -0,0 +1,215 @@ +//package cn.card.health.alipay.pay; +// +//import cn.card.health.common.exception.base.BaseException; +//import cn.card.health.alipay.config.AlipayAppletConfig; +////import com.alibaba.druid.support.json.JSONUtils; +//import com.alibaba.fastjson.JSONObject; +//import com.alipay.api.AlipayApiException; +//import com.alipay.api.AlipayClient; +//import com.alipay.api.DefaultAlipayClient; +//import com.alipay.api.request.AlipayTradeCreateRequest; +//import com.alipay.api.request.AlipayTradeFastpayRefundQueryRequest; +//import com.alipay.api.request.AlipayTradeQueryRequest; +//import com.alipay.api.request.AlipayTradeRefundApplyRequest; +//import com.alipay.api.response.AlipayTradeCreateResponse; +//import com.alipay.api.response.AlipayTradeFastpayRefundQueryResponse; +//import com.alipay.api.response.AlipayTradeQueryResponse; +//import com.alipay.api.response.AlipayTradeRefundApplyResponse; +//import org.slf4j.Logger; +//import org.slf4j.LoggerFactory; +//import org.springframework.stereotype.Service; +// +//import java.math.BigDecimal; +// +///** +// * 支付宝支付服务端 +// * +// * @author xinggm +// * @date 2021年7月27日 +// */ +//@Service +//public class AlipayPayService { +// private static final Logger logger = LoggerFactory.getLogger(AlipayPayService.class); +// +// /** +// * 小程序支付 +// * +// * @param subject 商品名称 +// * @param outTradeNo 商户订单号 +// * @param totalAmount 支付金额(分) +// * @param userid 小程序用户userid +// */ +// public String appletTradePay(String subject, String outTradeNo, Integer totalAmount, String userid) { +// //支付金额,由分转为元 也可直接用元 +// double amount = new BigDecimal(totalAmount / 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); +// AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", AlipayAppletConfig.appid, AlipayAppletConfig.app_private_key, "json", "UTF-8", AlipayAppletConfig.alipay_public_key, "RSA2"); +// AlipayTradeCreateRequest request = new AlipayTradeCreateRequest(); +// request.setNotifyUrl(AlipayAppletConfig.notifyUrl); +// JSONObject bizContent = new JSONObject(); +// bizContent.put("out_trade_no", "amp01" + outTradeNo); +// bizContent.put("total_amount", amount); +// bizContent.put("subject", subject); +// bizContent.put("buyer_id", userid); +// bizContent.put("timeout_express", "10m"); +// +// request.setBizContent(bizContent.toString()); +// try { +// AlipayTradeCreateResponse response = alipayClient.execute(request); +// if (response.isSuccess()) { +// //第三方交易流水号 +// String tradeNo = response.getTradeNo(); +// return tradeNo; +// } +// } catch (AlipayApiException e) { +// e.printStackTrace(); +// throw new BaseException(e.getMessage()); +// } +// +// return ""; +// } +// +// /** +// * 查询订单信息 通过商户订单号查询订单 +// * +// * @param outTradeNo 商户订单号 +// */ +// public static void appletTradeQuery(String outTradeNo) { +// AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", AlipayAppletConfig.appid, AlipayAppletConfig.app_private_key, "json", "GBK", AlipayAppletConfig.alipay_public_key, "RSA2"); +// AlipayTradeQueryRequest request = new AlipayTradeQueryRequest(); +// +// JSONObject bizContent = new JSONObject(); +// bizContent.put("out_trade_no", outTradeNo); +// request.setBizContent(bizContent.toString()); +// try { +// AlipayTradeQueryResponse response = alipayClient.execute(request); +// if (response.isSuccess()) { +// //支付状态 +// String tradeStatus = response.getTradeStatus(); +// //支付金额 +// String totalAmount = response.getTotalAmount(); +// System.out.println("调用成功"); +// } else { +// System.out.println("调用失败"); +// } +// } catch (AlipayApiException e) { +// e.printStackTrace(); +// } +// } +// +// +// /** +// * 小程序退款——自费 +// * +// * @param outTradeNo 商户订单号 +// * @param refundAmount 退款金额(分) +// * @param outRequestNo 标识一次退款请求 +// */ +// public boolean appletTradeRefund(String outTradeNo, Integer refundAmount, String outRequestNo, String reason) { +// AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", AlipayAppletConfig.appid, AlipayAppletConfig.app_private_key, "json", "GBK", AlipayAppletConfig.alipay_public_key, "RSA2"); +// AlipayTradeRefundApplyRequest request = new AlipayTradeRefundApplyRequest(); +// float refundMoney = new BigDecimal(refundAmount / 100).setScale(2, BigDecimal.ROUND_HALF_UP).floatValue(); +// JSONObject bizContent = new JSONObject(); +// //商户订单号 +// bizContent.put("out_trade_no", "amp01" + outTradeNo); +// //退款金额 +// bizContent.put("refund_amount", refundMoney); +// //退款原因 +// bizContent.put("refund_reason", reason); +// //退款请求号 +// bizContent.put("out_request_no", "amp01" + outRequestNo); +// JSONObject extendParams = new JSONObject(); +// extendParams.put("", ""); +// request.setBizContent(bizContent.toString()); +// try { +// AlipayTradeRefundApplyResponse response = alipayClient.execute(request); +//// logger.info("ALIPAY退款返回:{}", JSONUtils.toJSONString(response)); +// if (response.isSuccess()) { +// //退款状态 +// String refundStatus = response.getRefundStatus(); +// // REFUND_PROCESSING 退款处理中;REFUND_SUCCESS 退款处理成功;REFUND_FAIL 退款失败 +// return true; +// } +// } catch (AlipayApiException e) { +// e.printStackTrace(); +// } +// return false; +// } +// +// +// /** +// * 小程序退款——医保 +// * +// * @param outTradeNo 商户订单号 +// * @param refundAmount 退款金额(分) +// * @param outRequestNo 标识一次退款请求 +// * @param refundAsset 1自费部分;2医保部分 +// * @param cancelBillno +// * @param cancelSerialno +// */ +// public static void appletTradeRefund(String outTradeNo, Integer refundAmount, String outRequestNo, String refundAsset, String cancelBillno, String cancelSerialno) { +// AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", "app_id", "your private_key", "json", "GBK", "alipay_public_key", "RSA2"); +// AlipayTradeRefundApplyRequest request = new AlipayTradeRefundApplyRequest(); +// float refundMoney = (float) refundAmount / 100; +// JSONObject bizContent = new JSONObject(); +// //商户订单号 +// bizContent.put("out_trade_no", outTradeNo); +// //退款金额 +// bizContent.put("refund_amount", refundMoney); +// //退款原因 +// bizContent.put("refund_reason", "正常退款"); +// //退款请求号 +// bizContent.put("out_request_no", outRequestNo); +// JSONObject extendParams = new JSONObject(); +// //1自费部分,2医保部分 +// if ("1".equals(refundAsset)) { +// // INNER_ASSET 表示只退自费部分, +// extendParams.put("DESIGNATED_REFUND_ASSET", "INNER_ASSET"); +// } else if ("2".equals(refundAsset)) { +// // OUTSIDE_ASSET 只退医保部分 +// extendParams.put("DESIGNATED_REFUND_ASSET", "OUTSIDE_ASSET"); +// extendParams.put("cancel_bill_no", cancelBillno); +// extendParams.put("cancel_serial_no", cancelSerialno); +// } +// bizContent.put("extend_params", extendParams); +// request.setBizContent(bizContent.toString()); +// try { +// AlipayTradeRefundApplyResponse response = alipayClient.execute(request); +// if (response.isSuccess()) { +// //退款状态 +// String refundStatus = response.getRefundStatus(); +// // REFUND_PROCESSING 退款处理中;REFUND_SUCCESS 退款处理成功;REFUND_FAIL 退款失败 +// System.out.println("调用成功"); +// } else { +// System.out.println("调用失败"); +// } +// } catch (AlipayApiException e) { +// e.printStackTrace(); +// } +// } +// +// /** +// * 小程序退款订单查询 +// * +// * @param outTradeNo 商户订单号 +// * @param outRequestNo 退款标识号 +// */ +// public static void appletTradeRefundQuery(String outTradeNo, String outRequestNo) { +// AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", "app_id", "your private_key", "json", "GBK", "alipay_public_key", "RSA2"); +// AlipayTradeFastpayRefundQueryRequest request = new AlipayTradeFastpayRefundQueryRequest(); +// JSONObject bizContent = new JSONObject(); +// bizContent.put("trade_no", "2021081722001419121412730660"); +// bizContent.put("out_request_no", "HZ01RF001"); +// request.setBizContent(bizContent.toString()); +// try { +// AlipayTradeFastpayRefundQueryResponse response = alipayClient.execute(request); +// if (response.isSuccess()) { +// response.getRefundStatus(); // REFUND_PROCESSING 退款处理中;REFUND_SUCCESS 退款处理成功;REFUND_FAIL 退款失败 +// System.out.println("调用成功"); +// } else { +// System.out.println("调用失败"); +// } +// } catch (AlipayApiException e) { +// e.printStackTrace(); +// } +// } +//} diff --git a/health_framework/src/main/java/cn/card/health/alipay/pay/MkAlipayInsuranceService.java b/health_framework/src/main/java/cn/card/health/alipay/pay/MkAlipayInsuranceService.java new file mode 100644 index 0000000..269979d --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/alipay/pay/MkAlipayInsuranceService.java @@ -0,0 +1,604 @@ +package cn.card.health.alipay.pay; + +import cn.card.health.bean.insurance.MkAppletRequest; +import cn.card.health.bean.insurance.MkInsurancePay; +import cn.card.health.common.exception.base.BaseException; +import cn.card.health.common.utils.HttpUtils; +import cn.card.health.framework.service.alipay.AlipayAppletService; +import cn.card.health.insurance.HealthInsuranceService; +import cn.card.health.service.insurance.IMkAppletRequestService; +import cn.card.health.service.insurance.IMkInsurancePayService; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import cn.card.health.alipay.config.AlipayAppletConfig; + +/** + * 支付宝医保小程序 + */ +@Service +public class MkAlipayInsuranceService { + + @Autowired + private HealthInsuranceService healthInsuranceService; + @Autowired + private IMkAppletRequestService appletRequestService; + @Autowired + private AlipayAppletService alipayAppletService; + @Autowired + private IMkInsurancePayService insurancePayService; + + private Logger logger = LoggerFactory.getLogger(MkAlipayInsuranceService.class); + + /** + * [6201] 费用明细上传 + * + * @param params + * @return + */ + public JSONObject uldFeeInfo(JSONObject params) { + + //费用类型11门诊;12挂号 + String medType = params.getString("medType"); + if("11".equals(medType)) { + String mdtrtid = getMdtrtID(params); + params.put("mdtrtId", mdtrtid); + JSONArray array = params.getJSONArray("feedetailList"); + for(int i = 0; i < array.size(); i++) { + JSONObject feeddDetail = array.getJSONObject(i); + feeddDetail.put("mdtrtId", mdtrtid); + } + } + + MkAppletRequest appletRequest = new MkAppletRequest(params); + appletRequest.setMkRequestMethod("[6201] 费用明细上传"); + MkInsurancePay insurancePay = new MkInsurancePay(params); + try { + JSONObject resData = healthInsuranceService.uldFeeInfo(params, appletRequest); + if ("0".equals(resData.getString("code"))) { + JSONObject data = resData.getJSONObject("data"); + insurancePay.setPayordid(data.getString("payOrdId")); + insurancePay.setPaytoken(data.getString("payToken")); + } else { + insurancePay.setOrdstas("-1"); + appletRequest.setMkAppletResponseData(resData.getString("message")); + } + return resData; + } catch (Exception e) { + String errMsg = "[6201] 费用明细上传 发生异常"; + appletRequest.setMkAppletResponseData(errMsg); + insurancePay.setOrdstas("-1"); + throw new BaseException(errMsg); + } finally { + insurancePayService.insertMkInsurancePay(insurancePay); + appletRequestService.insertMkAppletRequest(appletRequest); + } + + } + + + /** + * [6202] 支付下单 + * + * @param params + * @return + */ + public JSONObject payOrder(JSONObject params) { + MkAppletRequest appletRequest = new MkAppletRequest(params); + appletRequest.setMkRequestMethod("[6202] 支付下单"); + MkInsurancePay insurancePay = new MkInsurancePay(); + insurancePay.setPayordid(params.getString("payOrdId")); + insurancePay.setMdtrtid(params.getString("mdtrtId")); + insurancePay.setPaytoken(params.getString("payToken")); + MkInsurancePay inpay = insurancePayService.selectMkInsurancePayInfo(insurancePay); + try { + JSONObject resData = healthInsuranceService.payOrder(params, appletRequest); + if (!"0".equals(resData.getString("code"))) { + appletRequest.setMkAppletResponseData(resData.getString("message")); + } else { + //TODO 下单成功,更新mk_insurance_pay + if (inpay != null) { + JSONObject conData = resData.getJSONObject("data"); + inpay.setOrdstas(conData.getString("ordStas")); + inpay.setFeesumamt(conData.getFloat("feeSumamt")); + inpay.setFundpay(conData.getFloat("fundPay")); + inpay.setOwnpayamt(conData.getFloat("ownPayAmt")); + inpay.setPsnacctpay(conData.getFloat("psnAcctPay")); + inpay.setOthFeeAmt(conData.getFloat("othFeeAmt")); + insurancePayService.updateMkInsurancePayAsyc(inpay); + } + } + return resData; + } catch (Exception e) { + String errMsg = "[6202] 支付下单 发生异常"; + appletRequest.setMkAppletResponseData(errMsg); + e.printStackTrace(); +// throw new BaseException(errMsg); + JSONObject json = new JSONObject(); + json.put("error", e.getMessage()); + return json; + } finally { + appletRequestService.insertMkAppletRequest(appletRequest); + + } + } + + /** + * [6203] 医保退费 + * + * @param params + * @return + */ + public JSONObject refundOrder(JSONObject params) { + params.put("refdType", "HI"); + MkAppletRequest appletRequest = new MkAppletRequest(params); + appletRequest.setMkRequestMethod("[6203] 医保退费"); + try { + JSONObject resData = healthInsuranceService.refundOrder(params, appletRequest); + logger.info(resData.toJSONString()); + + if (!"0".equals(resData.getString("code"))) { + appletRequest.setMkAppletResponseData(resData.getString("message")); + } else { + JSONObject insureData = resData.getJSONObject("data"); + if(insureData.containsKey("refStatus")&& "SUCC".equals(insureData.getString("refStatus"))){ + MkInsurancePay insurancePay = new MkInsurancePay(); + insurancePay.setPayordid(params.getString("payOrdId")); + insurancePay = insurancePayService.selectMkInsurancePayInfo(insurancePay); + insurancePay.setOrdstas("7"); + insurancePayService.updateMkInsurancePay(insurancePay); + return resData; + } + MkInsurancePay insurancePay = new MkInsurancePay(); + insurancePay.setPayordid(params.getString("payOrdId")); + insurancePay = insurancePayService.selectMkInsurancePayInfo(insurancePay); + insurancePay.setOrdstas("7"); + insurancePayService.updateMkInsurancePay(insurancePay); + } + return resData; + } catch (Exception e) { + String errMsg = "[6203] 医保退费 发生异常"; + appletRequest.setMkAppletResponseData(errMsg); + e.printStackTrace(); + throw new BaseException(errMsg); + } finally { + appletRequestService.insertMkAppletRequest(appletRequest); + } + } + + /** + * [6204] 医保订单信息同步 + * + * @param params + * @return + */ + public JSONObject orderNotify(JSONObject params) { + MkAppletRequest appletRequest = new MkAppletRequest(params); + appletRequest.setMkRequestMethod(" [6204] 医保订单信息同步"); + try { + JSONObject resData = healthInsuranceService.orderNotify(params, appletRequest); + if (!"0".equals(resData.getString("code"))) { + appletRequest.setMkAppletResponseData(resData.getString("message")); + } + return resData; + } catch (Exception e) { + String errMsg = "[6204] 医保订单信息同步 发生异常"; + appletRequest.setMkAppletResponseData(errMsg); + throw new BaseException(errMsg); + } finally { + appletRequestService.insertMkAppletRequest(appletRequest); + } + } + + /** + * [6205]银行卡支付下单 + * + * @param params + * @return + */ + public JSONObject medBankPay(JSONObject params) { + MkAppletRequest appletRequest = new MkAppletRequest(params); + appletRequest.setMkRequestMethod(" [6205]银行卡支付下单"); + try { + JSONObject resData = healthInsuranceService.medBankPay(params, appletRequest); + if (!"0".equals(resData.getString("code"))) { + appletRequest.setMkAppletResponseData(resData.getString("message")); + } + return resData; + } catch (Exception e) { + String errMsg = "[6205]银行卡支付下单 发生异常"; + appletRequest.setMkAppletResponseData(errMsg); + throw new BaseException(errMsg); + } finally { + appletRequestService.insertMkAppletRequest(appletRequest); + } + } + + /** + * [6301] 医保订单结算结果查询 + * + * @param params + * @return + */ + public JSONObject queryOrderInfo(JSONObject params) { + MkAppletRequest appletRequest = new MkAppletRequest(params); + appletRequest.setMkRequestMethod(" [6301] 医保订单结算结果查询"); + MkInsurancePay insurancePay = new MkInsurancePay(); + insurancePay.setPayordid(params.getString("payOrdId")); + insurancePay.setPaytoken(params.getString("payToken")); + MkInsurancePay inPay = insurancePayService.selectMkInsurancePayInfo(insurancePay); + try { + JSONObject resData = healthInsuranceService.queryOrderInfo(params, appletRequest); + if (!"0".equals(resData.getString("code"))) { + appletRequest.setMkAppletResponseData(resData.getString("message")); + } else { + if (inPay != null && "1".equals(inPay.getOrdstas())) { + inPay.setOrdstas(resData.getJSONObject("data").getString("ordStas")); + insurancePayService.updateMkInsurancePayAsyc(inPay); + } + } + return resData; + } catch (Exception e) { + String errMsg = "[6301] 医保订单结算结果查询 发生异常"; + appletRequest.setMkAppletResponseData(errMsg); + throw new BaseException(errMsg); + } finally { + appletRequestService.insertMkAppletRequest(appletRequest); + } + } + + /** + * [6302] 医保结算结果通知 + * + * @param params + * @return + */ + public JSONObject SettleNotify(JSONObject params) { + MkAppletRequest appletRequest = new MkAppletRequest(params); + appletRequest.setMkRequestMethod("[6302] 医保结算结果通知"); + try { +// JSONObject resData = healthInsuranceService.SettleNotify(params, appletRequest); + JSONObject data = new JSONObject(); + data.put("success", true); + data.put("message", "成功"); +// return resData; + JSONObject result = healthInsuranceService.before(data, AlipayAppletConfig.in_appid, AlipayAppletConfig.in_app_secret, AlipayAppletConfig.in_app_private_key); + data.put("code", 0); + result.putAll(data); + return result; + } catch (Exception e) { + String errMsg = "[6302] 医保结算结果通知 发生异常"; + appletRequest.setMkAppletResponseData(errMsg); + throw new BaseException(errMsg); + } finally { + appletRequestService.insertMkAppletRequest(appletRequest); + } + } + + /** + * [6401]费用明细上传撤销 + * + * @param params + * @return + */ + public JSONObject revokeOrder(JSONObject params) { + MkAppletRequest appletRequest = new MkAppletRequest(params); + appletRequest.setMkRequestMethod("[6401]费用明细上传撤销"); + try { + JSONObject resData = healthInsuranceService.revokeOrder(params, appletRequest); + if (!"0".equals(resData.getString("code"))) { + appletRequest.setMkAppletResponseData(resData.getString("message")); + } + return resData; + } catch (Exception e) { + String errMsg = "[6401]费用明细上传撤销 发生异常"; + appletRequest.setMkAppletResponseData(errMsg); + throw new BaseException(errMsg); + } finally { + appletRequestService.insertMkAppletRequest(appletRequest); + } + } + + /** + * 【6206】 6201+6202 + * + * @param params + * @return + */ + public JSONObject uldFeeInfoPayOrder(JSONObject params) { + String requestid = params.getString("requestid"); + + //费用类型11门诊;12挂号 + String medType = params.getString("medType"); + if("11".equals(medType)) { + String mdtrtid = getMdtrtID(params); + params.put("mdtrtId", mdtrtid); + JSONArray array = params.getJSONArray("feedetailList"); + for(int i = 0; i < array.size(); i++) { + JSONObject feeddDetail = array.getJSONObject(i); + feeddDetail.put("mdtrtId", mdtrtid); + } + } + + MkAppletRequest appletRequest = new MkAppletRequest(params); + JSONObject paramsP = new JSONObject(); + paramsP.put("orgCodg", params.getString("orgCodg")); + paramsP.put("chrgBchno", params.getString("chrgBchno")); + paramsP.put("payAuthNo", params.getString("payAuthNo")); + paramsP.put("feeType", params.getString("feeType")); + paramsP.put("mdtrtId", params.getString("mdtrtId")); + paramsP.put("orgBizSer", params.getString("orgBizSer")); + paramsP.put("sign", params.getString("sign")); + + appletRequest.setMkRequestMethod("[6201] 费用明细上传"); + MkInsurancePay insurancePay = new MkInsurancePay(params); + params.remove("orgBizSer"); + String payOrderId = ""; + String payToken = ""; + JSONObject uldJSON; + try { + JSONObject resData = healthInsuranceService.uldFeeInfo(params, appletRequest); + + if ("0".equals(resData.getString("code"))) { + uldJSON = resData.getJSONObject("data"); + payOrderId = uldJSON.getString("payOrdId"); + payToken = uldJSON.getString("payToken"); + insurancePay.setPayordid(uldJSON.getString("payOrdId")); + insurancePay.setPaytoken(uldJSON.getString("payToken")); + } else { + appletRequest.setMkAppletResponseData(resData.getString("message")); + return resData; + } + } catch (Exception e) { + String errMsg = "[6201] 费用明细上传 发生异常"; + appletRequest.setMkAppletResponseData(errMsg); + insurancePay.setOrdstas("-1"); + e.printStackTrace(); + throw new BaseException(errMsg); + } finally { + insurancePayService.insertMkInsurancePay(insurancePay); + appletRequestService.insertMkAppletRequest(appletRequest); + } + + paramsP.put("payOrdId", payOrderId); + paramsP.put("payToken", payToken); + paramsP.put("requestid", requestid); + MkAppletRequest appletRequestP = new MkAppletRequest(paramsP); + appletRequestP.setMkRequestMethod("[6202] 支付下单"); + try { + JSONObject resData = healthInsuranceService.payOrder(paramsP, appletRequestP); + if ("0".equals(resData.getString("code"))) { + JSONObject orderJSON = resData.getJSONObject("data"); + orderJSON.putAll(uldJSON); + resData.put("data", orderJSON); + resData.put("payToken", payToken); + + MkInsurancePay inPay = new MkInsurancePay(); + inPay.setMkId(insurancePay.getMkId()); + JSONObject conData = resData.getJSONObject("data"); + inPay.setOrdstas(conData.getString("ordStas")); + inPay.setFeesumamt(conData.getFloat("feeSumamt")); + inPay.setFundpay(conData.getFloat("fundPay")); + inPay.setOwnpayamt(conData.getFloat("ownPayAmt")); + inPay.setPsnacctpay(conData.getFloat("psnAcctPay")); + inPay.setOthFeeAmt(conData.getFloat("othFeeAmt")); + insurancePayService.updateMkInsurancePayAsyc(inPay); + } + return resData; + } catch (Exception e) { + String errMsg = "[6202] 支付下单 发生异常"; + appletRequest.setMkAppletResponseData(errMsg); + e.printStackTrace(); + throw new BaseException(errMsg); + } finally { + appletRequestService.insertMkAppletRequest(appletRequestP); + } + } + + /** + * 获取人员参保信息 + * + * @param params + * @return + */ + public JSONObject getPersonInsuranceInfo(JSONObject params) { +// try { +// JSONObject retJSON = new JSONObject(); +// retJSON.put("retcode", -1); + String accessToken = params.getString("accessToken"); + logger.info("===9001 开始签到===="); + String insureUrl = "http://192.168.20.50:9000/medical/getPsnInfo"; + String signin = "{\n" + + " \"cainfo\": \"\",\n" + + " \"dev_no\": \"\",\n" + + " \"dev_safe_info\": \"\",\n" + + " \"infno\": \"9001\",\n" + + " \"infver\": \"V1.0\",\n" + + " \"input\": {\n" + + " \"signIn\": {\n" + + " \"ip\": \"10.1.10.83\",\n" + + " \"mac\": \"6C4B9020ED3E\",\n" + + " \"opter_no\": \"ZQSL1\"\n" + + " }\n" + + " },\n" + + " \"opter\": \"ZQSL1\",\n" + + " \"opter_name\": \"管理员\",\n" + + " \"opter_type\": \"1\",\n" + + " \"recer_sys_code\": \"MBS_LOCAL\",\n" + + " \"sign_no\": \"\",\n" + + " \"signtype\": \"\"\n" + + "}"; + logger.info(signin); + String retData = HttpUtils.sendJSONPost(insureUrl, signin); + logger.info(retData); + JSONObject retSign = JSONObject.parseObject(retData); + if (0 != retSign.getInteger("infcode")) { +// retJSON.put("retmsg", "9001签到失败|" + retSign.getString("err_msg")); + throw new BaseException("9001签到失败|" + retSign.getString("err_msg")); +// return retJSON; + } + String signno = retSign.getJSONObject("output").getJSONObject("signinoutb").getString("sign_no"); +// JSONObject retSign = new JSONObject(); +// String signno = ""; + logger.info("===医保地查询 ====="); + JSONObject dataInsurace = alipayAppletService.medicalCardAuthQuery(accessToken); + logger.info(dataInsurace.toJSONString()); + if (!"1".equals(dataInsurace.getString("retcode"))) { +// retJSON.put("retmsg", "调用参保地接口失败|" + dataInsurace.getString("retmsg")); + throw new BaseException("调用参保地接口失败|" + dataInsurace.getString("retmsg")); +// return retJSON; + } + String insuplc_admdvs = dataInsurace.getJSONObject("data").getString("ins_city_code"); + logger.info("===实名授权 ====="); + JSONObject dataShare = alipayAppletService.getInfoShare(accessToken); + logger.info(dataShare.toJSONString()); + if (!"1".equals(dataShare.getString("retcode"))) { +// retJSON.put("retmsg", "调用实名授权接口失败|" + dataShare.getString("retmsg")); +// return retJSON; + throw new BaseException("调用实名授权接口失败|" + dataShare.getString("retmsg")); + } + String certNo = dataShare.getJSONObject("data").getString("certNo"); + String userName = dataShare.getJSONObject("data").getString("userName"); + String psninfo = "{\n" + + " \"cainfo\": \"\",\n" + + " \"dev_no\": \"\",\n" + + " \"dev_safe_info\": \"\",\n" + + " \"infno\": \"1101\",\n" + + " \"infver\": \"V1.0\",\n" + + " \"input\": {\n" + + " \"data\": {\n" + + " \"card_sn\": \"\",\n" + + " \"certno\": \"\",\n" + + " \"mdtrt_cert_no\": \"" + certNo + "\",\n" + + " \"mdtrt_cert_type\": \"02\",\n" + + " \"psn_cert_type\": \"\",\n" + + " \"psn_name\": \"" + userName + "\",\n" + + " \"qry_date\": \"\"\n" + + " }\n" + + " },\n" + + " \"insuplc_admdvs\": \"" + insuplc_admdvs + "\",\n" + + " \"mdtrtarea_admvs\": \"130481\",\n" + + " \"opter\": \"171\",\n" + + " \"opter_name\": \"李如献\",\n" + + " \"opter_type\": \"1\",\n" + + " \"recer_sys_code\": \"MBS_LOCAL\",\n" + + " \"sign_no\": \"" + signno + "\",\n" + + " \"signtype\": \"\"\n" + + "}"; + + logger.info("===1101人员信息===="); + logger.info(psninfo); + String retPsnInfo = HttpUtils.sendJSONPost(insureUrl, psninfo); + logger.info(retPsnInfo); + JSONObject retPsn = JSONObject.parseObject(retPsnInfo); + if (0 != retSign.getInteger("infcode")) { +// retJSON.put("retmsg", "11|" + retSign.getString("err_msg")); + throw new BaseException("1101人员编码失败|" + retSign.getString("err_msg")); +// return retJSON; + } + JSONObject output = retPsn.getJSONObject("output"); + JSONObject psnDataInfo = new JSONObject(); + psnDataInfo.put("psn_no", output.getJSONObject("baseinfo").getString("psn_no")); + + JSONArray insuinfos = output.getJSONArray("insuinfo"); + for(int i=0; i { + private static final long serialVersionUID = -1185015143654744140L; + + /** + * SecureRandom 的单例 + * + */ + private static class Holder { + static final SecureRandom numberGenerator = getSecureRandom(); + } + + /** 此UUID的最高64有效位 */ + private final long mostSigBits; + + /** 此UUID的最低64有效位 */ + private final long leastSigBits; + + /** + * 私有构造 + * + * @param data 数据 + */ + private UUID(byte[] data) { + long msb = 0; + long lsb = 0; + assert data.length == 16 : "data must be 16 bytes in length"; + for (int i = 0; i < 8; i++) { + msb = (msb << 8) | (data[i] & 0xff); + } + for (int i = 8; i < 16; i++) { + lsb = (lsb << 8) | (data[i] & 0xff); + } + this.mostSigBits = msb; + this.leastSigBits = lsb; + } + + /** + * 使用指定的数据构造新的 UUID。 + * + * @param mostSigBits 用于 {@code UUID} 的最高有效 64 位 + * @param leastSigBits 用于 {@code UUID} 的最低有效 64 位 + */ + public UUID(long mostSigBits, long leastSigBits) { + this.mostSigBits = mostSigBits; + this.leastSigBits = leastSigBits; + } + + /** + * 获取类型 4(伪随机生成的)UUID 的静态工厂。 使用加密的本地线程伪随机数生成器生成该 UUID。 + * + * @return 随机生成的 {@code UUID} + */ + public static UUID fastUUID() { + return randomUUID(false); + } + + /** + * 获取类型 4(伪随机生成的)UUID 的静态工厂。 使用加密的强伪随机数生成器生成该 UUID。 + * + * @return 随机生成的 {@code UUID} + */ + public static UUID randomUUID() { + return randomUUID(true); + } + + /** + * 获取类型 4(伪随机生成的)UUID 的静态工厂。 使用加密的强伪随机数生成器生成该 UUID。 + * + * @param isSecure 是否使用{@link SecureRandom}如果是可以获得更安全的随机码,否则可以得到更好的性能 + * @return 随机生成的 {@code UUID} + */ + public static UUID randomUUID(boolean isSecure) { + final Random ng = isSecure ? Holder.numberGenerator : getRandom(); + + byte[] randomBytes = new byte[16]; + ng.nextBytes(randomBytes); + randomBytes[6] &= 0x0f; /* clear version */ + randomBytes[6] |= 0x40; /* set to version 4 */ + randomBytes[8] &= 0x3f; /* clear variant */ + randomBytes[8] |= 0x80; /* set to IETF variant */ + return new UUID(randomBytes); + } + + /** + * 根据指定的字节数组获取类型 3(基于名称的)UUID 的静态工厂。 + * + * @param name 用于构造 UUID 的字节数组。 + * + * @return 根据指定数组生成的 {@code UUID} + */ + public static UUID nameUUIDFromBytes(byte[] name) { + MessageDigest md; + try { + md = MessageDigest.getInstance("MD5"); + } catch (NoSuchAlgorithmException nsae) { + throw new InternalError("MD5 not supported"); + } + byte[] md5Bytes = md.digest(name); + md5Bytes[6] &= 0x0f; /* clear version */ + md5Bytes[6] |= 0x30; /* set to version 3 */ + md5Bytes[8] &= 0x3f; /* clear variant */ + md5Bytes[8] |= 0x80; /* set to IETF variant */ + return new UUID(md5Bytes); + } + + /** + * 根据 {@link #toString()} 方法中描述的字符串标准表示形式创建{@code UUID}。 + * + * @param name 指定 {@code UUID} 字符串 + * @return 具有指定值的 {@code UUID} + * @throws IllegalArgumentException 如果 name 与 {@link #toString} + * 中描述的字符串表示形式不符抛出此异常 + * + */ + public static UUID fromString(String name) { + String[] components = name.split("-"); + if (components.length != 5) { + throw new IllegalArgumentException("Invalid UUID string: " + name); + } + for (int i = 0; i < 5; i++) { + components[i] = "0x" + components[i]; + } + + long mostSigBits = Long.decode(components[0]).longValue(); + mostSigBits <<= 16; + mostSigBits |= Long.decode(components[1]).longValue(); + mostSigBits <<= 16; + mostSigBits |= Long.decode(components[2]).longValue(); + + long leastSigBits = Long.decode(components[3]).longValue(); + leastSigBits <<= 48; + leastSigBits |= Long.decode(components[4]).longValue(); + + return new UUID(mostSigBits, leastSigBits); + } + + /** + * 返回此 UUID 的 128 位值中的最低有效 64 位。 + * + * @return 此 UUID 的 128 位值中的最低有效 64 位。 + */ + public long getLeastSignificantBits() { + return leastSigBits; + } + + /** + * 返回此 UUID 的 128 位值中的最高有效 64 位。 + * + * @return 此 UUID 的 128 位值中最高有效 64 位。 + */ + public long getMostSignificantBits() { + return mostSigBits; + } + + /** + * 与此 {@code UUID} 相关联的版本号. 版本号描述此 {@code UUID} 是如何生成的。 + *

+ * 版本号具有以下含意: + *

    + *
  • 1 基于时间的 UUID + *
  • 2 DCE 安全 UUID + *
  • 3 基于名称的 UUID + *
  • 4 随机生成的 UUID + *
+ * + * @return 此 {@code UUID} 的版本号 + */ + public int version() { + // Version is bits masked by 0x000000000000F000 in MS long + return (int) ((mostSigBits >> 12) & 0x0f); + } + + /** + * 与此 {@code UUID} 相关联的变体号。变体号描述 {@code UUID} 的布局。 + *

+ * 变体号具有以下含意: + *

    + *
  • 0 为 NCS 向后兼容保留 + *
  • 2 IETF RFC 4122(Leach-Salz), + * 用于此类 + *
  • 6 保留,微软向后兼容 + *
  • 7 保留供以后定义使用 + *
+ * + * @return 此 {@code UUID} 相关联的变体号 + */ + public int variant() { + // This field is composed of a varying number of bits. + // 0 - - Reserved for NCS backward compatibility + // 1 0 - The IETF aka Leach-Salz variant (used by this class) + // 1 1 0 Reserved, Microsoft backward compatibility + // 1 1 1 Reserved for future definition. + return (int) ((leastSigBits >>> (64 - (leastSigBits >>> 62))) & (leastSigBits >> 63)); + } + + /** + * 与此 UUID 相关联的时间戳值。 + * + *

+ * 60 位的时间戳值根据此 {@code UUID} 的 time_low、time_mid 和 time_hi 字段构造。
+ * 所得到的时间戳以 100 毫微秒为单位,从 UTC(通用协调时间) 1582 年 10 月 15 日零时开始。 + * + *

+ * 时间戳值仅在在基于时间的 UUID(其 version 类型为 1)中才有意义。
+ * 如果此 {@code UUID} 不是基于时间的 UUID,则此方法抛出 UnsupportedOperationException。 + * + * @throws UnsupportedOperationException 如果此 {@code UUID} 不是 version 为 1 的 UUID。 + */ + public long timestamp() throws UnsupportedOperationException { + checkTimeBase(); + return (mostSigBits & 0x0FFFL) << 48// + | ((mostSigBits >> 16) & 0x0FFFFL) << 32// + | mostSigBits >>> 32; + } + + /** + * 与此 UUID 相关联的时钟序列值。 + * + *

+ * 14 位的时钟序列值根据此 UUID 的 clock_seq 字段构造。clock_seq 字段用于保证在基于时间的 UUID 中的时间唯一性。 + *

+ * {@code clockSequence} 值仅在基于时间的 UUID(其 version 类型为 1)中才有意义。 如果此 UUID 不是基于时间的 + * UUID,则此方法抛出 UnsupportedOperationException。 + * + * @return 此 {@code UUID} 的时钟序列 + * + * @throws UnsupportedOperationException 如果此 UUID 的 version 不为 1 + */ + public int clockSequence() throws UnsupportedOperationException { + checkTimeBase(); + return (int) ((leastSigBits & 0x3FFF000000000000L) >>> 48); + } + + /** + * 与此 UUID 相关的节点值。 + * + *

+ * 48 位的节点值根据此 UUID 的 node 字段构造。此字段旨在用于保存机器的 IEEE 802 地址,该地址用于生成此 UUID 以保证空间唯一性。 + *

+ * 节点值仅在基于时间的 UUID(其 version 类型为 1)中才有意义。
+ * 如果此 UUID 不是基于时间的 UUID,则此方法抛出 UnsupportedOperationException。 + * + * @return 此 {@code UUID} 的节点值 + * + * @throws UnsupportedOperationException 如果此 UUID 的 version 不为 1 + */ + public long node() throws UnsupportedOperationException { + checkTimeBase(); + return leastSigBits & 0x0000FFFFFFFFFFFFL; + } + + /** + * 返回此{@code UUID} 的字符串表现形式。 + * + *

+ * UUID 的字符串表示形式由此 BNF 描述: + * + *

+	 * {@code
+	 * UUID                   = ----
+	 * time_low               = 4*
+	 * time_mid               = 2*
+	 * time_high_and_version  = 2*
+	 * variant_and_sequence   = 2*
+	 * node                   = 6*
+	 * hexOctet               = 
+	 * hexDigit               = [0-9a-fA-F]
+	 * }
+	 * 
+ * + * + * + * @return 此{@code UUID} 的字符串表现形式 + * @see #toString(boolean) + */ + @Override + public String toString() { + return toString(false); + } + + /** + * 返回此{@code UUID} 的字符串表现形式。 + * + *

+ * UUID 的字符串表示形式由此 BNF 描述: + * + *

+	 * {@code
+	 * UUID                   = ----
+	 * time_low               = 4*
+	 * time_mid               = 2*
+	 * time_high_and_version  = 2*
+	 * variant_and_sequence   = 2*
+	 * node                   = 6*
+	 * hexOctet               = 
+	 * hexDigit               = [0-9a-fA-F]
+	 * }
+	 * 
+ * + * + * + * @param isSimple 是否简单模式,简单模式为不带'-'的UUID字符串 + * @return 此{@code UUID} 的字符串表现形式 + */ + public String toString(boolean isSimple) { + final StringBuilder builder = new StringBuilder(isSimple ? 32 : 36); + // time_low + builder.append(digits(mostSigBits >> 32, 8)); + if (false == isSimple) { + builder.append('-'); + } + // time_mid + builder.append(digits(mostSigBits >> 16, 4)); + if (false == isSimple) { + builder.append('-'); + } + // time_high_and_version + builder.append(digits(mostSigBits, 4)); + if (false == isSimple) { + builder.append('-'); + } + // variant_and_sequence + builder.append(digits(leastSigBits >> 48, 4)); + if (false == isSimple) { + builder.append('-'); + } + // node + builder.append(digits(leastSigBits, 12)); + + return builder.toString(); + } + + /** + * 返回此 UUID 的哈希码。 + * + * @return UUID 的哈希码值。 + */ + @Override + public int hashCode() { + long hilo = mostSigBits ^ leastSigBits; + return ((int) (hilo >> 32)) ^ (int) hilo; + } + + /** + * 将此对象与指定对象比较。 + *

+ * 当且仅当参数不为 {@code null}、而是一个 UUID 对象、具有与此 UUID 相同的 + * varriant、包含相同的值(每一位均相同)时,结果才为 {@code true}。 + * + * @param obj 要与之比较的对象 + * + * @return 如果对象相同,则返回 {@code true};否则返回 {@code false} + */ + @Override + public boolean equals(Object obj) { + if ((null == obj) || (obj.getClass() != UUID.class)) { + return false; + } + UUID id = (UUID) obj; + return (mostSigBits == id.mostSigBits && leastSigBits == id.leastSigBits); + } + + // Comparison Operations + + /** + * 将此 UUID 与指定的 UUID 比较。 + * + *

+ * 如果两个 UUID 不同,且第一个 UUID 的最高有效字段大于第二个 UUID 的对应字段,则第一个 UUID 大于第二个 UUID。 + * + * @param val 与此 UUID 比较的 UUID + * + * @return 在此 UUID 小于、等于或大于 val 时,分别返回 -1、0 或 1。 + * + */ + @Override + public int compareTo(UUID val) { + // The ordering is intentionally set up so that the UUIDs + // can simply be numerically compared as two numbers + return (this.mostSigBits < val.mostSigBits ? -1 : // + (this.mostSigBits > val.mostSigBits ? 1 : // + (this.leastSigBits < val.leastSigBits ? -1 : // + (this.leastSigBits > val.leastSigBits ? 1 : // + 0)))); + } + + // ------------------------------------------------------------------------------------------------------------------- + // Private method start + /** + * 返回指定数字对应的hex值 + * + * @param val 值 + * @param digits 位 + * @return 值 + */ + private static String digits(long val, int digits) { + long hi = 1L << (digits * 4); + return Long.toHexString(hi | (val & (hi - 1))).substring(1); + } + + /** + * 检查是否为time-based版本UUID + */ + private void checkTimeBase() { + if (version() != 1) { + throw new UnsupportedOperationException("Not a time-based UUID"); + } + } + + /** + * 获取{@link SecureRandom},类提供加密的强随机数生成器 (RNG) + * + * @return {@link SecureRandom} + */ + public static SecureRandom getSecureRandom() { + try { + return SecureRandom.getInstance("SHA1PRNG"); + } catch (NoSuchAlgorithmException e) { + throw new RuntimeException(e); + } + } + + /** + * 获取随机数生成器对象
+ * ThreadLocalRandom是JDK 7之后提供并发产生随机数,能够解决多个线程发生的竞争争夺。 + * + * @return {@link ThreadLocalRandom} + */ + public static ThreadLocalRandom getRandom() { + return ThreadLocalRandom.current(); + } +} diff --git a/health_framework/src/main/java/cn/card/health/base/controller/BaseController.java b/health_framework/src/main/java/cn/card/health/base/controller/BaseController.java new file mode 100644 index 0000000..870a29d --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/base/controller/BaseController.java @@ -0,0 +1,180 @@ +package cn.card.health.base.controller; + +import java.beans.PropertyEditorSupport; +import java.io.BufferedReader; +import java.io.IOException; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import javax.servlet.http.HttpServletRequest; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.web.bind.WebDataBinder; +import org.springframework.web.bind.annotation.InitBinder; + +import com.alibaba.fastjson.JSONObject; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; + +import cn.card.health.common.core.ServletUtils; +import cn.card.health.common.core.SqlUtil; +import cn.card.health.common.page.PageDomain; +import cn.card.health.common.page.TableDataInfo; +import cn.card.health.common.page.TableSupport; +import cn.card.health.common.utils.DateUtils; +import cn.card.health.common.utils.HttpStatus; +import cn.card.health.common.utils.StringUtils; + +/** + * web层通用数据处理 + * + * @author yc + */ +public class BaseController { + protected final Logger logger = LoggerFactory + .getLogger(BaseController.class); + + /** + * 将前台传递过来的日期格式的字符串,自动转化为Date类型 + */ + @InitBinder + public void initBinder(WebDataBinder binder) { + // Date 类型转换 + binder.registerCustomEditor(Date.class, new PropertyEditorSupport() { + @Override + public void setAsText(String text) { + setValue(DateUtils.parseDate(text)); + } + }); + } + + /** + * 设置请求分页数据 + */ + protected void startPage() { + PageDomain pageDomain = TableSupport.buildPageRequest(); + Integer pageNum = pageDomain.getPageNum(); + Integer pageSize = pageDomain.getPageSize(); + if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) { + String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy()); + PageHelper.startPage(pageNum, pageSize, orderBy); + } + } + + /** + * 响应请求分页数据 + */ + @SuppressWarnings({"rawtypes", "unchecked"}) + protected TableDataInfo getDataTable(List list) { + TableDataInfo rspData = new TableDataInfo(); + rspData.setCode(HttpStatus.SUCCESS); + rspData.setMsg("查询成功"); + rspData.setRows(list); + rspData.setTotal(new PageInfo(list).getTotal()); + return rspData; + } + +// /** +// * 响应返回结果 +// * +// * @param rows +// * 影响行数 +// * @return 操作结果 +// */ +// protected AjaxResult toAjax(int rows) { +// return rows > 0 ? AjaxResult.success() : AjaxResult.error(); +// } + + /** + * 页面跳转 + */ + public String redirect(String url) { + return StringUtils.format("redirect:{}", url); + } + + /** + * 取前端在JSON中的数据 + * + * @return JSONObject + * @author xinggm + */ + public JSONObject getJSONParams() { + HttpServletRequest request = ServletUtils.getRequest(); + try { + BufferedReader br = request.getReader(); + String str = ""; + String lsStr = ""; + while ((str = br.readLine()) != null) { + lsStr += str; + } + JSONObject paramsJSON = JSONObject.parseObject(lsStr); + return paramsJSON; + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + return new JSONObject(); + } + } + + /** + * 用于方便的获取request中的参数 + * + * @return + * @author cheng.li 2017年1月5日 + */ + public Map getRequestParams() { + Map map = new HashMap(); + HttpServletRequest request = ServletUtils.getRequest(); + try { + BufferedReader br = request.getReader(); + String str = ""; + String lsStr = ""; + while ((str = br.readLine()) != null) { + lsStr += str; + } + logger.info("====字节流参数:===={}", lsStr); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + Set> set = request.getParameterMap().entrySet(); + Iterator> it = set.iterator(); + while (it.hasNext()) { + Entry entry = it.next(); + StringBuffer value = new StringBuffer(); + for (String i : entry.getValue()) { + value.append(i + ","); + } + value.deleteCharAt(value.length() - 1); + map.put(entry.getKey(), value.toString()); + } + return map; + } + + public Map getParams(){ + //获取支付宝POST过来反馈信息 + Map params = new HashMap(); + HttpServletRequest request = ServletUtils.getRequest(); + Map requestParams = request.getParameterMap(); + for (Iterator iter = requestParams.keySet().iterator(); iter.hasNext();) { + String name = (String) iter.next(); + String[] values = (String[]) requestParams.get(name); + String valueStr = ""; + for (int i = 0; i < values.length; i++) { + valueStr = (i == values.length - 1) ? valueStr + values[i] + : valueStr + values[i] + ","; + } + //乱码解决,这段代码在出现乱码时使用。 + //valueStr = new String(valueStr.getBytes("ISO-8859-1"), "utf-8"); + params.put(name, valueStr); + } + + return params; + } +} diff --git a/health_framework/src/main/java/cn/card/health/bean/insurance/MkAppletRequest.java b/health_framework/src/main/java/cn/card/health/bean/insurance/MkAppletRequest.java new file mode 100644 index 0000000..d6f6d2d --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/bean/insurance/MkAppletRequest.java @@ -0,0 +1,178 @@ +package cn.card.health.bean.insurance; + +import cn.card.health.common.utils.Md5Utils; +import cn.card.health.insurance.HealthInsuranceConfig; +import com.alibaba.fastjson.JSONObject; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import java.util.Date; + +/** + * 支付宝小程序请求对象 mk_applet_request + * + * @author ruoyi + * @date 2022-10-15 + */ +public class MkAppletRequest +{ + private static final long serialVersionUID = 1L; + + /** 主键 */ + private Long mkId; + + /** 请求号 */ + private String mkRequestid; + + /** 请求方法 */ + private String mkRequestMethod; + + /** 小程序请求数据 */ + private String mkAppletRequestData; + + /** 小程序返回数据 */ + private String mkAppletResponseData; + + /** 医保请求数据 */ + private String mkInsuranceRequestData; + + /** 医保返回数据 */ + private String mkInsuranceResponseData; + /** 签名 */ + private String mkSign; + + /** 验签结果 */ + private Boolean mkValidate; + + /** + * 创建时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createTime; + + /** + * 更新时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date updateTime; + + public MkAppletRequest() { + } + public MkAppletRequest(JSONObject params) { + this.mkAppletRequestData = params.toJSONString(); +// this.mkRequestid = params.getString("requestid"); +// this.mkSign = params.getString("sign"); +// String md5Sign = Md5Utils.hash(mkRequestid + HealthInsuranceConfig.REQUEST_KEY); +// this.mkValidate = md5Sign.equals(mkSign); + } + + public void setMkId(Long mkId) + { + this.mkId = mkId; + } + + public Long getMkId() + { + return mkId; + } + public void setMkRequestid(String mkRequestid) + { + this.mkRequestid = mkRequestid; + } + + public String getMkRequestid() + { + return mkRequestid; + } + public void setMkAppletRequestData(String mkAppletRequestData) + { + this.mkAppletRequestData = mkAppletRequestData; + } + + public String getMkAppletRequestData() + { + return mkAppletRequestData; + } + public void setMkAppletResponseData(String mkAppletResponseData) + { + this.mkAppletResponseData = mkAppletResponseData; + } + + public String getMkAppletResponseData() + { + return mkAppletResponseData; + } + public void setMkInsuranceRequestData(String mkInsuranceRequestData) + { + this.mkInsuranceRequestData = mkInsuranceRequestData; + } + + public String getMkInsuranceRequestData() + { + return mkInsuranceRequestData; + } + public void setMkInsuranceResponseData(String mkInsuranceResponseData) + { + this.mkInsuranceResponseData = mkInsuranceResponseData; + } + + public String getMkInsuranceResponseData() + { + return mkInsuranceResponseData; + } + + public String getMkRequestMethod() { + return mkRequestMethod; + } + + public void setMkRequestMethod(String mkRequestMethod) { + this.mkRequestMethod = mkRequestMethod; + } + + public String getMkSign() { + return mkSign; + } + + public void setMkSign(String mkSign) { + this.mkSign = mkSign; + } + + public Boolean getMkValidate() { + return mkValidate; + } + + public void setMkValidate(Boolean mkValidate) { + this.mkValidate = mkValidate; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + @Override + public String toString() { + + ObjectMapper objectMapper = new ObjectMapper(); + try { + return objectMapper.writeValueAsString(this); + } catch (JsonProcessingException e) { + e.printStackTrace(); + return null; + } + } +} diff --git a/health_framework/src/main/java/cn/card/health/bean/insurance/MkInsurancePay.java b/health_framework/src/main/java/cn/card/health/bean/insurance/MkInsurancePay.java new file mode 100644 index 0000000..d603d8a --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/bean/insurance/MkInsurancePay.java @@ -0,0 +1,463 @@ +package cn.card.health.bean.insurance; + +import cn.card.health.common.utils.DateUtils; +import com.alibaba.fastjson.JSONObject; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import java.util.Date; + +/** + * 医保支付对象 mk_insurance_pay + * + * @author ruoyi + * @date 2022-10-24 + */ +public class MkInsurancePay { + private static final long serialVersionUID = 1L; + + public MkInsurancePay() { + } + + public MkInsurancePay(JSONObject params) { + this.idno = params.getString("idNo"); + this.idtype = params.getString("idType"); + this.username = params.getString("userName"); + this.psnno = params.getString("psnNo"); + this.medorgord = params.getString("medOrgOrd"); + this.medtype = params.getString("medType"); + this.feetype = params.getString("feeType"); + this.psnsetlway = params.getString("psnSetlway"); + this.mdtrtcerttype = params.getString("mdtrtCertType"); + this.paytoken = params.getString("payAuthNo"); + this.chrgbchno = params.getString("chrgBchno"); + this.mdtrtid = params.getString("mdtrtId"); + this.ordstas = "0"; + this.applytime = DateUtils.getNowDate(); +// this.approvedtime = params.getString(""); + this.userid = params.getString("userid"); + this.feesumamt = params.getFloat("medfeeSumamt"); + } + + + /** + * 主键 + */ + private Long mkId; + + /** + * 订单ID + */ + private Long orderid; + + /** + * 证件号码 + */ + private String idno; + + /** + * 用户姓名 + */ + private String username; + + /** + * 证件类别 + */ + private String idtype; + + /** + * 人员编号 + */ + private String psnno; + + /** + * 医疗机构订单号 + */ + private String medorgord; + + /** + * 医疗类别 + */ + private String medtype; + + /** + * 个人结算方式 + */ + private String feetype; + + /** + * 个人结算方式 + */ + private String psnsetlway; + + /** + * 就诊凭证类型 + */ + private String mdtrtcerttype; + + /** + * 支付订单号 + */ + private String payordid; + + /** + * 支付token + */ + private String paytoken; + + /** + * payAuthNo + */ + private String payAuthNo; + + /** + * 收费批次号 + */ + private String chrgbchno; + + /** + * 就诊ID + */ + private String mdtrtid; + + /** + * 订单状态 + */ + private String ordstas; + + /** + * 费用总金额 + */ + private Float feesumamt; + + /** + * 现金支付 + */ + private Float ownpayamt; + + /** + * 个人账户支出 + */ + private Float psnacctpay; + + /** + * 医保基金支付 + */ + private Float fundpay; + + /** + * 其他金额支付 + */ + private Float othFeeAmt; + + /** + * 上传时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + private Date applytime; + + /** + * 结算时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + private Date approvedtime; + + /** + * 用户标志 + */ + private String userid; + + /** + * 商户订单号 + */ + private String outTradeNo; + + /** + * 交易流水号 + */ + private String tradeno; + /** + * + */ + private String medinsSetlId; + + /** + * 原因 + */ + private String reason; + + /** + * 创建时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createTime; + + /** + * 更新时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date updateTime; + + public void setMkId(Long mkId) { + this.mkId = mkId; + } + + public Long getMkId() { + return mkId; + } + + public Long getOrderid() { + return orderid; + } + + public void setOrderid(Long orderid) { + this.orderid = orderid; + } + + public void setIdno(String idno) { + this.idno = idno; + } + + public String getIdno() { + return idno; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getUsername() { + return username; + } + + public void setIdtype(String idtype) { + this.idtype = idtype; + } + + public String getIdtype() { + return idtype; + } + + public void setPsnno(String psnno) { + this.psnno = psnno; + } + + public String getPsnno() { + return psnno; + } + + public void setMedorgord(String medorgord) { + this.medorgord = medorgord; + } + + public String getMedorgord() { + return medorgord; + } + + public void setMedtype(String medtype) { + this.medtype = medtype; + } + + public String getMedtype() { + return medtype; + } + + public void setFeetype(String feetype) { + this.feetype = feetype; + } + + public String getFeetype() { + return feetype; + } + + public void setPsnsetlway(String psnsetlway) { + this.psnsetlway = psnsetlway; + } + + public String getPsnsetlway() { + return psnsetlway; + } + + public void setMdtrtcerttype(String mdtrtcerttype) { + this.mdtrtcerttype = mdtrtcerttype; + } + + public String getMdtrtcerttype() { + return mdtrtcerttype; + } + + public void setPayordid(String payordid) { + this.payordid = payordid; + } + + public String getPayordid() { + return payordid; + } + + public void setPaytoken(String paytoken) { + this.paytoken = paytoken; + } + + public String getPaytoken() { + return paytoken; + } + + public void setChrgbchno(String chrgbchno) { + this.chrgbchno = chrgbchno; + } + + public String getChrgbchno() { + return chrgbchno; + } + + public void setMdtrtid(String mdtrtid) { + this.mdtrtid = mdtrtid; + } + + public String getMdtrtid() { + return mdtrtid; + } + + public void setOrdstas(String ordstas) { + this.ordstas = ordstas; + } + + public String getOrdstas() { + return ordstas; + } + + public void setFeesumamt(Float feesumamt) { + this.feesumamt = feesumamt; + } + + public Float getFeesumamt() { + return feesumamt; + } + + public void setOwnpayamt(Float ownpayamt) { + this.ownpayamt = ownpayamt; + } + + public Float getOwnpayamt() { + return ownpayamt; + } + + public void setPsnacctpay(Float psnacctpay) { + this.psnacctpay = psnacctpay; + } + + public Float getPsnacctpay() { + return psnacctpay; + } + + public void setFundpay(Float fundpay) { + this.fundpay = fundpay; + } + + public Float getFundpay() { + return fundpay; + } + + public void setApplytime(Date applytime) { + this.applytime = applytime; + } + + public Date getApplytime() { + return applytime; + } + + public void setApprovedtime(Date approvedtime) { + this.approvedtime = approvedtime; + } + + public Date getApprovedtime() { + return approvedtime; + } + + public void setUserid(String userid) { + this.userid = userid; + } + + public Float getOthFeeAmt() { + return othFeeAmt; + } + + public void setOthFeeAmt(Float othFeeAmt) { + this.othFeeAmt = othFeeAmt; + } + + public String getUserid() { + return userid; + } + + public String getOutTradeNo() { + return outTradeNo; + } + + public void setOutTradeNo(String outTradeNo) { + this.outTradeNo = outTradeNo; + } + + public String getTradeno() { + return tradeno; + } + + public void setTradeno(String tradeno) { + this.tradeno = tradeno; + } + + public String getReason() { + return reason; + } + + public void setReason(String reason) { + this.reason = reason; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + public String getPayAuthNo() { + return payAuthNo; + } + + public void setPayAuthNo(String payAuthNo) { + this.payAuthNo = payAuthNo; + } + + public String getMedinsSetlId() { + return medinsSetlId; + } + + public void setMedinsSetlId(String medinsSetlId) { + this.medinsSetlId = medinsSetlId; + } + + @Override + public String toString() { + + ObjectMapper objectMapper = new ObjectMapper(); + try { + return objectMapper.writeValueAsString(this); + } catch (JsonProcessingException e) { + e.printStackTrace(); + return null; + } + } +} diff --git a/health_framework/src/main/java/cn/card/health/bean/order/YcMsg.java b/health_framework/src/main/java/cn/card/health/bean/order/YcMsg.java new file mode 100644 index 0000000..1fad31a --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/bean/order/YcMsg.java @@ -0,0 +1,107 @@ +package cn.card.health.bean.order; + +import java.io.Serializable; +import java.util.Date; + +/** + * 消息发送 + * + * @author xinggm + * @email + * @date 2021-07-22 10:30:48 + */ +public class YcMsg implements Serializable { + private static final long serialVersionUID = 1L; + + /** 消息主键 */ + private Long msgid; + /** openid */ + private String touser; + /** 微信模板标志 */ + private String temlateid; + /** 跳转连接 */ + private String msgurl; + /** 消息内容 */ + private String content; + /** 消息状态 */ + private Integer msgStatus; + /** 创建时间 */ + private Date createDate; + /** 更新时间 */ + private Date updateTime; + /** 第三方消息标志 */ + private String tmsgid; + + public Long getMsgid() { + return msgid; + } + + public void setMsgid(Long msgid) { + this.msgid = msgid; + } + + public String getTouser() { + return touser; + } + + public void setTouser(String touser) { + this.touser = touser; + } + + public String getTemlateid() { + return temlateid; + } + + public void setTemlateid(String temlateid) { + this.temlateid = temlateid; + } + + public String getMsgurl() { + return msgurl; + } + + public void setMsgurl(String msgurl) { + this.msgurl = msgurl; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public Integer getMsgStatus() { + return msgStatus; + } + + public void setMsgStatus(Integer msgStatus) { + this.msgStatus = msgStatus; + } + + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + public String getTmsgid() { + return tmsgid; + } + + public void setTmsgid(String tmsgid) { + this.tmsgid = tmsgid; + } + +} diff --git a/health_framework/src/main/java/cn/card/health/bean/order/YcPayCallback.java b/health_framework/src/main/java/cn/card/health/bean/order/YcPayCallback.java new file mode 100644 index 0000000..38330a3 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/bean/order/YcPayCallback.java @@ -0,0 +1,101 @@ +package cn.card.health.bean.order; + +import java.io.Serializable; +import java.util.Date; + +import io.swagger.annotations.ApiModelProperty; + +/** + * 微信调用 + * + * @author tt + * @date 2021-07-06 12:15:47 + */ +public class YcPayCallback implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * + */ + @ApiModelProperty(value = "") + private Integer id; + + /** + * + */ + @ApiModelProperty(value = "支付内容") + private String content; + + + @ApiModelProperty(value = "解密结果") + private String descContent; + + + /** + * 支付方式 + */ + @ApiModelProperty(value = "支付方式") + private String paytype; + + /** + * 支付名称 + */ + @ApiModelProperty(value = "支付名称") + private String payname; + + /** + * + */ + @ApiModelProperty(value = "") + private Date createtime; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public String getPaytype() { + return paytype; + } + + public void setPaytype(String paytype) { + this.paytype = paytype; + } + + public String getPayname() { + return payname; + } + + public void setPayname(String payname) { + this.payname = payname; + } + + public String getDescContent() { + return descContent; + } + + public void setDescContent(String descContent) { + this.descContent = descContent; + } + + public Date getCreatetime() { + return createtime; + } + + public void setCreatetime(Date createtime) { + this.createtime = createtime; + } + + } \ No newline at end of file diff --git a/health_framework/src/main/java/cn/card/health/config/DataSourceConfig.java b/health_framework/src/main/java/cn/card/health/config/DataSourceConfig.java new file mode 100644 index 0000000..77b64b6 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/config/DataSourceConfig.java @@ -0,0 +1,19 @@ +package cn.card.health.config; + + +import javax.sql.DataSource; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.jdbc.DataSourceBuilder; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class DataSourceConfig { + @Bean(name = "dataSource") + @ConfigurationProperties(prefix = "spring.datasource") // application.properteis中对应属性的前缀 + public DataSource dataSource() { + return DataSourceBuilder.create().build(); + } + +} diff --git a/health_framework/src/main/java/cn/card/health/config/HealthCardConfig.java b/health_framework/src/main/java/cn/card/health/config/HealthCardConfig.java new file mode 100644 index 0000000..d702ffc --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/config/HealthCardConfig.java @@ -0,0 +1,11 @@ +package cn.card.health.config; + +/** + * 项目配置 + * @author xinggm + * @date 2021年5月26日 + */ +public class HealthCardConfig { + /** 服务器地址 */ + public static final String serverUrl = "http://www.hbyctr.com/healht_service"; +} diff --git a/health_framework/src/main/java/cn/card/health/config/MybatisPubConfig.java b/health_framework/src/main/java/cn/card/health/config/MybatisPubConfig.java new file mode 100644 index 0000000..12db3f7 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/config/MybatisPubConfig.java @@ -0,0 +1,58 @@ +package cn.card.health.config; + +import javax.sql.DataSource; + +import org.apache.ibatis.session.SqlSessionFactory; +import org.mybatis.spring.SqlSessionFactoryBean; +import org.mybatis.spring.SqlSessionTemplate; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.io.support.PathMatchingResourcePatternResolver; + +@Configuration +@MapperScan(basePackages = { "cn.card.health.mapper" }, sqlSessionFactoryRef = "sqlSessionFactory") +public class MybatisPubConfig { + @Autowired + @Qualifier("dataSource") + private DataSource dataSource; + + @Bean + public SqlSessionFactory sqlSessionFactory() throws Exception { + SqlSessionFactoryBean factoryBean = new SqlSessionFactoryBean(); + factoryBean.setDataSource(dataSource); + + // 获取PathMatchingResourcePatternResolver对象为扫描mapper文件做准备 + PathMatchingResourcePatternResolver path = new PathMatchingResourcePatternResolver(); + // 设置mapper文件位置 + factoryBean.setMapperLocations(path.getResources("classpath*:mapper/**/*Mapper.xml")); + // 为javaBean对象设置别名 + factoryBean.setTypeAliasesPackage("cn.card.health.bean"); + return factoryBean.getObject(); + } + + @Bean + public SqlSessionTemplate sqlSessionTemplate() throws Exception { + SqlSessionTemplate template = new SqlSessionTemplate(sqlSessionFactory()); + return template; + } + +// // 配置sqlSessionFactory +// @Bean +// public SqlSessionFactory sqlSessionFactoryBean() throws Exception { +// // 在spring和Mybatis整合中采用mybatis提供的SQLSessionFactoryBean对象 +// SqlSessionFactoryBean sqlSessionFactoryBean = sqlSessionFactory(); +// // 为sqlSessionFatoryBean设置连接池属性 +// sqlSessionFactoryBean.setDataSource(dataSource); +// // 获取PathMatchingResourcePatternResolver对象为扫描mapper文件做准备 +// PathMatchingResourcePatternResolver path = new PathMatchingResourcePatternResolver(); +// // 设置mapper文件位置 +// sqlSessionFactoryBean.setMapperLocations(path.getResources("classpath*:mapper/**/*Mapper.xml")); +// // 为javaBean对象设置别名 +// sqlSessionFactoryBean.setTypeAliasesPackage("cn.card.health"); +// // 返回SqlSessionFactory对象 +// return sqlSessionFactoryBean.getObject(); +// } +} diff --git a/health_framework/src/main/java/cn/card/health/config/Swagger2Config.java b/health_framework/src/main/java/cn/card/health/config/Swagger2Config.java new file mode 100644 index 0000000..65d2b17 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/config/Swagger2Config.java @@ -0,0 +1,74 @@ +package cn.card.health.config; + +import java.util.ArrayList; +import java.util.List; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import io.swagger.annotations.ApiOperation; +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.PathSelectors; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.service.ApiKey; +import springfox.documentation.service.AuthorizationScope; +import springfox.documentation.service.SecurityReference; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spi.service.contexts.SecurityContext; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +/** + * Swagger2配置 + */ +@Configuration +@EnableSwagger2 +public class Swagger2Config { + private boolean enabled = true; + @Bean + public Docket createRestApi() { + return new Docket(DocumentationType.SWAGGER_2).enable(enabled).apiInfo(apiInfo()).select() // 返回一个ApiSelectorBuilder实例用来控制哪些接口暴露给Swagger来展现 + .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) // 采用指定扫描的包路径来定义,Swagger会扫描该包下所有Controller定义的API,并产生文档内容(除了被@ApiIgnore指定的请求) + .apis(RequestHandlerSelectors.basePackage("cn.card.health")).apis(RequestHandlerSelectors.any()) + .paths(PathSelectors.any()).build().securitySchemes(securitySchemes()) + .securityContexts(securityContexts()); + } +// public Docket createRestApi() { +// return new Docket(DocumentationType.SWAGGER_2).enable(enabled).apiInfo(apiInfo()).select() // 返回一个ApiSelectorBuilder实例用来控制哪些接口暴露给Swagger来展现 +// .apis(RequestHandlerSelectors.basePackage("cn.card.health.**.web")) // 采用指定扫描的包路径来定义,Swagger会扫描该包下所有Controller定义的API,并产生文档内容(除了被@ApiIgnore指定的请求) +// .paths(PathSelectors.any()).build().securitySchemes(securitySchemes()) +// .securityContexts(securityContexts()); +// } + + /** + * 来创建该Api的基本信息(这些基本信息会展现在文档页面中) + */ + private ApiInfo apiInfo() { + return new ApiInfoBuilder().title("健康卡模块api").description("健康卡模块api").termsOfServiceUrl("localhost:2023") + .version("0.1").build(); + } + + private List securitySchemes() { + List apiKeys = new ArrayList<>(); + apiKeys.add(new ApiKey("Authorization", "Authorization", "header")); + return apiKeys; + } + + private List securityContexts() { + List securityContexts = new ArrayList<>(); + securityContexts.add(SecurityContext.builder().securityReferences(defaultAuth()) + .forPaths(PathSelectors.regex("^(?!auth).*$")).build()); + return securityContexts; + } + + private List defaultAuth() { + AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); + AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; + authorizationScopes[0] = authorizationScope; + List securityReferences = new ArrayList<>(); + securityReferences.add(new SecurityReference("Authorization", authorizationScopes)); + return securityReferences; + } + +} diff --git a/health_framework/src/main/java/cn/card/health/config/XBasicDataSource.java b/health_framework/src/main/java/cn/card/health/config/XBasicDataSource.java new file mode 100644 index 0000000..ab28111 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/config/XBasicDataSource.java @@ -0,0 +1,21 @@ +//package cn.card.health.config; +// +//import java.sql.DriverManager; +//import java.sql.SQLException; +// +//import org.apache.commons.dbcp2.BasicDataSource; +// +//import com.mysql.cj.jdbc.AbandonedConnectionCleanupThread; +// +////import com.mysql.jdbc.AbandonedConnectionCleanupThread; +// +////import com.mysql.cj.jdbc.AbandonedConnectionCleanupThread; +// +//public class XBasicDataSource extends BasicDataSource { +// @Override +// public synchronized void close() throws SQLException { +// DriverManager.deregisterDriver(DriverManager.getDriver(getUrl())); +// AbandonedConnectionCleanupThread.checkedShutdown(); +// super.close(); +// } +//} diff --git a/health_framework/src/main/java/cn/card/health/entity/HealthCardInfoEntity.java b/health_framework/src/main/java/cn/card/health/entity/HealthCardInfoEntity.java new file mode 100644 index 0000000..ebb7eaa --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/entity/HealthCardInfoEntity.java @@ -0,0 +1,184 @@ +package cn.card.health.entity; + +/** + * 健康卡实体类 + * + * @author 郭彬 + * @date 2021年5月26日 + */ +public class HealthCardInfoEntity { + + /** 姓名 */ + private String name; + /** 性别 男;女 */ + private String gender; + /** 民族 */ + private String nation; + /** 生日 */ + private String birthday; + /** 卡号 */ + private String idNumber; + /** 地址 */ + private String address; + /** 手机号1 */ + private String phone1; + /** 手机号2 */ + private String phone2; + /** 二维码内容 */ + private String qrCodeText; + /** 微信用户标志openid */ + private String openId; + /** + * 卡类型 01 居民身份证, 02 居民户口簿, 03 护照 ,04 军官证, 05 驾驶证, 06 港澳居民来往内地通行证,07 台湾居民来往内地通行证, + * 08 出生医学证明, 09 医保, 10 就诊卡, 11 健康卡 ,99 其他法定有效证件 + */ + private String idType; + /** 健康卡 主索引 */ + private String phid; + /** 院内 ID,院内用户唯一标识 */ + private String patid; + /** 健康卡ID */ + private String healthCardId; + /** 微信身份码 */ + private String wechatCode; + /** 健康卡授权码 */ + private String healthCode; + /** 主键 */ + private Long id; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getGender() { + return gender; + } + + public void setGender(String gender) { + this.gender = gender; + } + + public String getNation() { + return nation; + } + + public void setNation(String nation) { + this.nation = nation; + } + + public String getBirthday() { + return birthday; + } + + public void setBirthday(String birthday) { + this.birthday = birthday; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public String getIdNumber() { + return idNumber; + } + + public void setIdNumber(String idNumber) { + this.idNumber = idNumber; + } + + public String getPhone1() { + return phone1; + } + + public void setPhone1(String phone1) { + this.phone1 = phone1; + } + + public String getPhone2() { + return phone2; + } + + public void setPhone2(String phone2) { + this.phone2 = phone2; + } + + public String getQrCodeText() { + return qrCodeText; + } + + public void setQrCodeText(String qrCodeText) { + this.qrCodeText = qrCodeText; + } + + public String getOpenId() { + return openId; + } + + public void setOpenId(String openId) { + this.openId = openId; + } + + public String getIdType() { + return idType; + } + + public void setIdType(String idType) { + this.idType = idType; + } + + public String getPhid() { + return phid; + } + + public void setPhid(String phid) { + this.phid = phid; + } + + public String getPatid() { + return patid; + } + + public void setPatid(String patid) { + this.patid = patid; + } + + public String getHealthCardId() { + return healthCardId; + } + + public void setHealthCardId(String healthCardId) { + this.healthCardId = healthCardId; + } + + public String getWechatCode() { + return wechatCode; + } + + public void setWechatCode(String wechatCode) { + this.wechatCode = wechatCode; + } + + public String getHealthCode() { + return healthCode; + } + + public void setHealthCode(String healthCode) { + this.healthCode = healthCode; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } +} diff --git a/health_framework/src/main/java/cn/card/health/entity/Image.java b/health_framework/src/main/java/cn/card/health/entity/Image.java new file mode 100644 index 0000000..d057df3 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/entity/Image.java @@ -0,0 +1,14 @@ +package cn.card.health.entity; + +public class Image { + /** */ + private String imageContent; + + public String getImageContent() { + return imageContent; + } + + public void setImageContent(String imageContent) { + this.imageContent = imageContent; + } +} diff --git a/health_framework/src/main/java/cn/card/health/entity/Phone.java b/health_framework/src/main/java/cn/card/health/entity/Phone.java new file mode 100644 index 0000000..cddeff6 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/entity/Phone.java @@ -0,0 +1,48 @@ +package cn.card.health.entity; + +public class Phone { + /** + * + */ + private String phone; + /** + * + */ + private String openId; + + private String idNumber; + + private String client; + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getOpenId() { + return openId; + } + + public void setOpenId(String openId) { + this.openId = openId; + } + + public void setIdNumber(String idNumber) { + this.idNumber = idNumber; + } + + public String getIdNumber() { + return this.idNumber; + } + + public void setClient(String client) { + this.client = client; + } + + public String getClient() { + return this.client; + } +} diff --git a/health_framework/src/main/java/cn/card/health/entity/Unbing.java b/health_framework/src/main/java/cn/card/health/entity/Unbing.java new file mode 100644 index 0000000..f34b416 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/entity/Unbing.java @@ -0,0 +1,14 @@ +package cn.card.health.entity; + +public class Unbing { + /** */ + private String qrText; + + public String getCode() { + return qrText; + } + + public void setCode(String qrText) { + this.qrText = qrText; + } +} diff --git a/health_framework/src/main/java/cn/card/health/framework/ScheduleRegistResource.java b/health_framework/src/main/java/cn/card/health/framework/ScheduleRegistResource.java new file mode 100644 index 0000000..e4b5d5b --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/framework/ScheduleRegistResource.java @@ -0,0 +1,31 @@ +package cn.card.health.framework; + +import org.springframework.scheduling.annotation.EnableScheduling; +import org.springframework.stereotype.Component; +import cn.card.health.common.core.ApplicationContextUtil; + +/** + * 号源同步定时任务 + * @author xinggm + * @date 2021年8月14日 + */ +@Component +@EnableScheduling +public class ScheduleRegistResource { + + private int count = 0; + +// @Scheduled(cron="*/5 * * * * ?") +// @Scheduled(initialDelay = 10000, fixedRate = 3000) +// public void test() { +// +// System.out.println(count++); +// } +// + + public void print() { + + ApplicationContextUtil.getBean(""); + + } +} diff --git a/health_framework/src/main/java/cn/card/health/framework/UserLoginService.java b/health_framework/src/main/java/cn/card/health/framework/UserLoginService.java new file mode 100644 index 0000000..21bf6a8 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/framework/UserLoginService.java @@ -0,0 +1,54 @@ +package cn.card.health.framework; + +import javax.annotation.Resource; + +import cn.card.health.common.exception.base.BaseException; +import cn.card.health.common.redis.RedisCache; +import cn.card.health.framework.service.alipay.TokenService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Service; + +import cn.card.health.bean.user.LoginUser; +import cn.card.health.service.user.IYcUserService; + +@Service +public class UserLoginService { + + @Autowired + private TokenService tokenService; + @Resource + private AuthenticationManager authenticationManager; + + @Autowired + private IYcUserService userService; + + /** + * 登录验证 + * + * @param username 用户名 + * @return 结果 + */ + public String login(String username ) { + + // 用户验证 + Authentication authentication = null; + try { + // 该方法会去调用UserDetailsServiceImpl.loadUserByUsername + authentication = authenticationManager + .authenticate(new UsernamePasswordAuthenticationToken(username, "")); + } catch (Exception e) { + e.printStackTrace(); + throw new BaseException(e.getMessage()); + } + LoginUser loginUser = (LoginUser) authentication.getPrincipal(); + // 生成token + return tokenService.createToken(loginUser); + } + + + + +} diff --git a/health_framework/src/main/java/cn/card/health/framework/config/ApplicationConfig.java b/health_framework/src/main/java/cn/card/health/framework/config/ApplicationConfig.java new file mode 100644 index 0000000..20a9836 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/framework/config/ApplicationConfig.java @@ -0,0 +1,39 @@ +//package cn.card.health.framework.config; +// +//import org.apache.ibatis.session.SqlSessionFactory; +//import org.mybatis.spring.annotation.MapperScan; +//import org.springframework.boot.autoconfigure.SpringBootApplication; +//import org.springframework.context.annotation.ComponentScan; +//import org.springframework.context.annotation.Configuration; +//import org.springframework.context.annotation.EnableAspectJAutoProxy; +// +///** +// * +// * @author xinggm +// * @date 2021年5月27日 +// */ +//@SpringBootApplication +//@Configuration +////表示通过aop框架暴露该代理对象,AopContext能够访问 +//@EnableAspectJAutoProxy(exposeProxy = true) +////指定要扫描的Mapper类的包的路径 +//@MapperScan("cn.card.health.mapper") +//@ComponentScan(basePackages="cn.card.health") +//public class ApplicationConfig { +// //配置sqlSessionFactory +// @Bean +// public SqlSessionFactory sqlSessionFactoryBean() throws Exception { +// //在spring和Mybatis整合中采用mybatis提供的SQLSessionFactoryBean对象 +// SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean(); +// //为sqlSessionFatoryBean设置连接池属性 +// sqlSessionFactoryBean.setDataSource(dataSource()); +// //获取PathMatchingResourcePatternResolver对象为扫描mapper文件做准备 +// PathMatchingResourcePatternResolver path = new PathMatchingResourcePatternResolver(); +// //设置mapper文件位置 +// sqlSessionFactoryBean.setMapperLocations(path.getResources("classpath*:com/hello/mapper/**/*.xml")); +// //为javaBean对象设置别名 +// sqlSessionFactoryBean.setTypeAliasesPackage("com.hello.bean"); +// //返回SqlSessionFactory对象 +// return sqlSessionFactoryBean.getObject(); +// } +//} diff --git a/health_framework/src/main/java/cn/card/health/framework/config/JwtAuthenticationTokenFilter.java b/health_framework/src/main/java/cn/card/health/framework/config/JwtAuthenticationTokenFilter.java new file mode 100644 index 0000000..fabe663 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/framework/config/JwtAuthenticationTokenFilter.java @@ -0,0 +1,45 @@ +package cn.card.health.framework.config; + +import java.io.IOException; +import javax.servlet.FilterChain; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import cn.card.health.bean.user.LoginUser; +import cn.card.health.common.utils.StringUtils; +import cn.card.health.common.utils.spring.SecurityUtils; +import cn.card.health.framework.service.alipay.TokenService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.web.authentication.WebAuthenticationDetailsSource; +import org.springframework.stereotype.Component; +import org.springframework.web.filter.OncePerRequestFilter; + +/** + * token过滤器 验证token有效性 + * + * @author ruoyi + */ +@Component +public class JwtAuthenticationTokenFilter extends OncePerRequestFilter +{ + @Autowired + private TokenService tokenService; + + @Override + protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) + throws ServletException, IOException + { + LoginUser loginUser = tokenService.getLoginUser(request); + if (StringUtils.isNotNull(loginUser) && StringUtils.isNull(SecurityUtils.getAuthentication())) + { + tokenService.verifyToken(loginUser); + UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(loginUser, null, loginUser.getAuthorities()); + authenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request)); + SecurityContextHolder.getContext().setAuthentication(authenticationToken); + } + chain.doFilter(request, response); + } +} diff --git a/health_framework/src/main/java/cn/card/health/framework/config/ResourcesConfig.java b/health_framework/src/main/java/cn/card/health/framework/config/ResourcesConfig.java new file mode 100644 index 0000000..ab7729e --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/framework/config/ResourcesConfig.java @@ -0,0 +1,62 @@ +package cn.card.health.framework.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.cors.CorsConfiguration; +import org.springframework.web.cors.UrlBasedCorsConfigurationSource; +import org.springframework.web.filter.CorsFilter; +//import org.springframework.web.servlet.config.annotation.InterceptorRegistry; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +/** + * 通用配置 + * + * @author yc + */ +@Configuration +public class ResourcesConfig implements WebMvcConfigurer { +// @Autowired +// private RepeatSubmitInterceptor repeatSubmitInterceptor; + + @Override + public void addResourceHandlers(ResourceHandlerRegistry registry) { + /** 本地文件上传路径 */ + registry.addResourceHandler("/healthService" + "/**") + .addResourceLocations("file:" + "/healthService" + "/"); + + /** swagger配置 */ + registry.addResourceHandler("swagger-ui.html").addResourceLocations( + "classpath:/META-INF/resources/"); + registry.addResourceHandler("/webjars/**").addResourceLocations( + "classpath:/META-INF/resources/webjars/"); + } + +// /** +// * 自定义拦截规则 +// */ +// @Override +// public void addInterceptors(InterceptorRegistry registry) { +// registry.addInterceptor(repeatSubmitInterceptor).addPathPatterns("/**"); +//// registry.addInterceptor(gzipInterceptor).addPathPatterns("/**"); +// } + + /** + * 跨域配置 + */ + @Bean + public CorsFilter corsFilter() { + UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); + CorsConfiguration config = new CorsConfiguration(); + config.setAllowCredentials(true); + // 设置访问源地址 + config.addAllowedOrigin("*"); + // 设置访问源请求头 + config.addAllowedHeader("*"); + // 设置访问源请求方法 + config.addAllowedMethod("*"); + // 对接口配置跨域设置 + source.registerCorsConfiguration("/**", config); + return new CorsFilter(source); + } +} diff --git a/health_framework/src/main/java/cn/card/health/framework/config/SecurityConfig.java b/health_framework/src/main/java/cn/card/health/framework/config/SecurityConfig.java new file mode 100644 index 0000000..32181c7 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/framework/config/SecurityConfig.java @@ -0,0 +1,141 @@ +package cn.card.health.framework.config; + +import cn.card.health.framework.security.handle.AuthenticationEntryPointImpl; +import cn.card.health.framework.security.handle.LogoutSuccessHandlerImpl; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.http.HttpMethod; +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; +import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.config.http.SessionCreationPolicy; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; +import org.springframework.security.web.authentication.logout.LogoutFilter; +import org.springframework.web.filter.CorsFilter; + +/** + * spring security配置 + * + * @author ruoyi + */ +@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true) +public class SecurityConfig extends WebSecurityConfigurerAdapter { + /** + * 自定义用户认证逻辑 + */ + @Autowired + private UserDetailsService userDetailsService; + + /** + * 认证失败处理类 + */ + @Autowired + private AuthenticationEntryPointImpl unauthorizedHandler; + + /** + * 退出处理类 + */ + @Autowired + private LogoutSuccessHandlerImpl logoutSuccessHandler; + + /** + * token认证过滤器 + */ + @Autowired + private JwtAuthenticationTokenFilter authenticationTokenFilter; + + /** + * 跨域过滤器 + */ + @Autowired + private CorsFilter corsFilter; + + /** + * 解决 无法直接注入 AuthenticationManager + * + * @return + * @throws Exception + */ + @Bean + @Override + public AuthenticationManager authenticationManagerBean() throws Exception { + return super.authenticationManagerBean(); + } + + /** + * anyRequest | 匹配所有请求路径 + * access | SpringEl表达式结果为true时可以访问 + * anonymous | 匿名可以访问 + * denyAll | 用户不能访问 + * fullyAuthenticated | 用户完全认证可以访问(非remember-me下自动登录) + * hasAnyAuthority | 如果有参数,参数表示权限,则其中任何一个权限可以访问 + * hasAnyRole | 如果有参数,参数表示角色,则其中任何一个角色可以访问 + * hasAuthority | 如果有参数,参数表示权限,则其权限可以访问 + * hasIpAddress | 如果有参数,参数表示IP地址,如果用户IP和参数匹配,则可以访问 + * hasRole | 如果有参数,参数表示角色,则其角色可以访问 + * permitAll | 用户可以任意访问 + * rememberMe | 允许通过remember-me登录的用户访问 + * authenticated | 用户登录后可访问 + */ + @Override + protected void configure(HttpSecurity httpSecurity) throws Exception { + httpSecurity + // CSRF禁用,因为不使用session + .csrf().disable() + // 认证失败处理类 + .exceptionHandling().authenticationEntryPoint(unauthorizedHandler).and() + // 基于token,所以不需要session + .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and() + // 过滤请求 + .authorizeRequests() + // 对于登录login 注册register 验证码captchaImage 允许匿名访问 + .antMatchers("/login", "/register", "/oauth/openidLogin", "/oauth/alipayLogin", "/hisQuery/*").permitAll() + .antMatchers("/captcha/get", "/captcha/check").permitAll() + .antMatchers("/thirdpay/*", "/insurance/**", "/alipay/**").permitAll() + .antMatchers( + HttpMethod.GET, + "/", + "/*.html", + "/**/*.html", + "/**/*.css", + "/**/*.js", + "/profile/**" + ).permitAll() + .antMatchers("/swagger-ui.html").anonymous() + .antMatchers("/swagger-resources/**").anonymous() + .antMatchers("/webjars/**").anonymous() + .antMatchers("/*/api-docs").anonymous() + .antMatchers("/druid/**").anonymous() + // 除上面外的所有请求全部需要鉴权认证 + .anyRequest().authenticated() + .and() + .headers().frameOptions().disable(); +// httpSecurity.antMatcher("/hisQuery/*").anonymous(); + httpSecurity.logout().logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler); + // 添加JWT filter + httpSecurity.addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class); + // 添加CORS filter + httpSecurity.addFilterBefore(corsFilter, JwtAuthenticationTokenFilter.class); + httpSecurity.addFilterBefore(corsFilter, LogoutFilter.class); + } + + /** + * 强散列哈希加密实现 + */ + @Bean + public BCryptPasswordEncoder bCryptPasswordEncoder() { + return new BCryptPasswordEncoder(); + } + + /** + * 身份认证接口 + */ + @Override + protected void configure(AuthenticationManagerBuilder auth) throws Exception { + auth.userDetailsService(userDetailsService).passwordEncoder(bCryptPasswordEncoder()); + } +} diff --git a/health_framework/src/main/java/cn/card/health/framework/security/handle/AuthenticationEntryPointImpl.java b/health_framework/src/main/java/cn/card/health/framework/security/handle/AuthenticationEntryPointImpl.java new file mode 100644 index 0000000..1466c33 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/framework/security/handle/AuthenticationEntryPointImpl.java @@ -0,0 +1,35 @@ +package cn.card.health.framework.security.handle; + +import java.io.IOException; +import java.io.Serializable; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import cn.card.health.common.core.ServletUtils; +import cn.card.health.common.utils.BaseResultJSON; +import cn.card.health.common.utils.HttpStatus; +import cn.card.health.common.utils.StringUtils; +import org.springframework.security.core.AuthenticationException; +import org.springframework.security.web.AuthenticationEntryPoint; +import org.springframework.stereotype.Component; +import com.alibaba.fastjson.JSON; + +/** + * 认证失败处理类 返回未授权 + * + * @author ruoyi + */ +@Component +public class AuthenticationEntryPointImpl implements AuthenticationEntryPoint, Serializable +{ + private static final long serialVersionUID = -8970718410437077606L; + + @Override + public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e) + throws IOException + { + int code = HttpStatus.UNAUTHORIZED; + String msg = StringUtils.format("请求访问:{},认证失败,无法访问系统资源", request.getRequestURI()); + ServletUtils.renderString(response, JSON.toJSONString(BaseResultJSON.error(code, msg))); + } +} \ No newline at end of file diff --git a/health_framework/src/main/java/cn/card/health/framework/security/handle/LogoutSuccessHandlerImpl.java b/health_framework/src/main/java/cn/card/health/framework/security/handle/LogoutSuccessHandlerImpl.java new file mode 100644 index 0000000..677fd2e --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/framework/security/handle/LogoutSuccessHandlerImpl.java @@ -0,0 +1,49 @@ +package cn.card.health.framework.security.handle; + +import cn.card.health.bean.user.LoginUser; +import cn.card.health.common.core.ServletUtils; +import cn.card.health.common.utils.BaseResultJSON; +import cn.card.health.common.utils.HttpStatus; +import cn.card.health.common.utils.StringUtils; +import cn.card.health.framework.service.alipay.TokenService; +import com.alibaba.fastjson.JSON; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.core.Authentication; +import org.springframework.security.web.authentication.logout.LogoutSuccessHandler; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * 自定义退出处理类 返回成功 + * + * @author ruoyi + */ +@Configuration +public class LogoutSuccessHandlerImpl implements LogoutSuccessHandler +{ + @Autowired + private TokenService tokenService; + + /** + * 退出处理 + * + * @return + */ + @Override + public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) + throws IOException, ServletException + { + LoginUser loginUser = tokenService.getLoginUser(request); + if (StringUtils.isNotNull(loginUser)) + { + String userName = loginUser.getUsername(); + // 删除用户缓存记录 + tokenService.delLoginUser(loginUser.getToken()); + } + ServletUtils.renderString(response, JSON.toJSONString(BaseResultJSON.error(HttpStatus.SUCCESS, "退出成功"))); + } +} \ No newline at end of file diff --git a/health_framework/src/main/java/cn/card/health/framework/service/GetHeatlhCardService.java b/health_framework/src/main/java/cn/card/health/framework/service/GetHeatlhCardService.java new file mode 100644 index 0000000..243e32e --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/framework/service/GetHeatlhCardService.java @@ -0,0 +1,433 @@ +//package cn.card.health.framework.service; +// +//import cn.card.health.common.utils.BaseResultJSON; +//import cn.card.health.common.utils.wechat.ResponseWechatJSON; +//import cn.card.health.helper.InitCommonIn; +//import cn.card.health.service.HealthCardApptokenService; +//import cn.card.health.service.HealthCardInfoService; +//import cn.card.health.service.user.IYcPatientService; +//import com.alibaba.fastjson.JSON; +//import com.alibaba.fastjson.JSONArray; +//import com.alibaba.fastjson.JSONObject; +//import com.alipay.api.domain.HealthCardInfo; +//import com.tencent.healthcard.HealthCardServer; +//import com.tencent.healthcard.impl.HealthCardServerImpl; +//import com.tencent.healthcard.model.CommonIn; +//import com.tencent.healthcard.model.HealthCardInfo; +//import com.tencent.healthcard.model.ReportHISData; +//import org.slf4j.Logger; +//import org.slf4j.LoggerFactory; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.stereotype.Service; +//import org.springframework.transaction.annotation.Transactional; +// +//import java.util.ArrayList; +//import java.util.List; +// +//@Service +//public class GetHeatlhCardService { +// private Logger log = LoggerFactory.getLogger(GetHeatlhCardService.class); +// +// @Autowired +// private HealthCardInfoService healthCardInfoService; +// @Autowired +// private HealthCardApptokenService healthCardApptokenService; +// @Autowired +// private IYcPatientService ycPatientService; +// +// /** +// * 注册电子健康卡 +// * +// * @param healthCardInfoReq +// * @return +// */ +// @Transactional +// public JSONObject getHeathCard(HealthCardInfo healthCardInfoReq) { +// /** +// * 接口:注册健康卡接口 +// */ +// HealthCardInfo cardInfo = healthCardInfoService.findHealthCardInfoByIdNumber(healthCardInfoReq.getIdNumber(), +// healthCardInfoReq.getOpenId()); +// JSONObject result = new JSONObject(); +// if (cardInfo == null) { +// CommonIn commonIn = InitCommonIn.getCommonIn(getApptoken()); +// String idCard = healthCardInfoReq.getIdNumber(); +// int i = Integer.valueOf(idCard.substring(16, 17)); +// if (i % 2 == 1) { +// healthCardInfoReq.setGender("男"); +// } else { +// healthCardInfoReq.setGender("女"); +// } +// String year = idCard.substring(6, 10); +// String month = idCard.substring(10, 12); +// String day = idCard.substring(12, 14); +// healthCardInfoReq.setBirthday(year + "-" + month + "-" + day); +// JSONObject healthCardInfoRsp = InitCommonIn.getHealthCard().registerHealthCard(commonIn, healthCardInfoReq); +// +// result = ResponseWechatJSON.getInstance(healthCardInfoRsp).getBaseResultJSON(); +// +// if (result.getIntValue("retcode") != 0) { +// result.put("retcode", 0); +// result.put("retmsg", result.getString("retmsg")); +// } else { +// System.out.println(JSON.toJSONString(healthCardInfoRsp)); +// JSONObject rsp = healthCardInfoRsp.getJSONObject("rsp"); +// String qrCodeText = rsp.getString("qrCodeText"); +// String healthCardId = rsp.getString("healthCardId"); +// String adminExt = rsp.getString("adminExt"); +// healthCardInfoReq.setQrCodeText(qrCodeText); +// healthCardInfoReq.setOpenId(healthCardInfoReq.getOpenId()); +// healthCardInfoReq.setHealthCardId(healthCardId); +// int r = healthCardInfoService.insertHealthCardInfo(healthCardInfoReq); +//// YcPatient patient = new YcPatient(healthCardInfoReq); +//// int r = ycPatientService.addPatient(patient); +// if (r != 1) { +// result = BaseResultJSON.error(-1, "HIS建卡失败"); +// } +// } +// } else if (cardInfo.getPatid() == null || "".equals(cardInfo.getPatid())) { +// //没有拿到HIS返回的patId +// int r = healthCardInfoService.insertHealthCardInfo(cardInfo); +// if (r != 1) { +// result = BaseResultJSON.error(-1, "HIS建卡失败"); +// } +// } else { +//// result.put("retcode", -1); +//// result.put("retmsg", "此号码您已注册,不可重复注册"); +// result = BaseResultJSON.error(-1, "此号码您已注册,不可重复注册"); +// } +// +// /* +// if (result.getIntValue("retcode") != -1) { +// //绑定健康卡和院内ID关系接口 +// ThreadUtil.execute(() -> { +// HealthCardInfo info = healthCardInfoService.findHealthCardInfoByIdNumber(healthCardInfoReq.getIdNumber(), +// healthCardInfoReq.getOpenId()); +// String patId = info.getPatid(); +// String qrCodeText = info.getQrCodeText(); +// if (!StrUtil.isBlank(patId) && !StrUtil.isBlank(qrCodeText)) { +// JSONObject bindResult = bindCardRelation(patId, qrCodeText); +// log.info("微信健康卡与院内ID关系绑定结果,健康卡{},院内卡{},绑定结果:{}", qrCodeText, patId, bindResult.toJSONString()); +// } +// }); +// } +// */ +// +// return result; +// } +// +// /** +// * 注册电子健康卡 +// * +// * @param healthCardInfoReq +// * @return +// */ +// @Transactional +// public JSONObject getHospitalCard(HealthCardInfo healthCardInfoReq) { +// HealthCardInfo cardInfo = healthCardInfoService.findHealthCardInfoByIdNumber(healthCardInfoReq.getIdNumber(), +// healthCardInfoReq.getOpenId()); +// if (cardInfo == null) { +// int r = healthCardInfoService.insertHealthCardInfo(healthCardInfoReq); +// if (r != 1) { +// log.info("患者:{},HIS建卡失败!", healthCardInfoReq.getOpenId()); +// return BaseResultJSON.error(-1, "HIS建卡失败"); +// } +// } else if (cardInfo.getPatid() == null || "".equals(cardInfo.getPatid())) { +// //没有拿到HIS返回的patId +// int r = healthCardInfoService.insertHealthCardInfo(cardInfo); +// if (r != 1) { +// log.info("患者:{},HIS建卡失败!", healthCardInfoReq.getOpenId()); +// return BaseResultJSON.error(-1, "HIS建卡失败"); +// } +// } else { +// log.info("患者:{},此号码您已注册,不可重复注册!", healthCardInfoReq.getOpenId()); +// return BaseResultJSON.error(-1, "此号码您已注册,不可重复注册"); +// } +// log.info("患者:{},建卡成功!", healthCardInfoReq.getOpenId()); +// +// return BaseResultJSON.success("成功"); +// } +// +// /** +// * 注册电子健康卡 +// * +// * @param openid +// * @param healthCode +// * @return +// */ +// public JSONObject relatedHeathCardByHealthCode(String openid, String healthCode) { +// CommonIn commonIn = InitCommonIn.getCommonIn(getApptoken()); +// //根据用户和HealthCode查询健康卡 +// JSONObject response = InitCommonIn.getHealthCard().getHealthCardByHealthCode(commonIn, healthCode); +// log.info("根据healthCode:{}获取用户的健康卡信息:{}", healthCode, response.toJSONString()); +// +// if (response.getJSONObject("commonOut").getIntValue("resultCode") != 0) { +// return BaseResultJSON.error("获取健康卡失败!错误信息:" + response.getJSONObject("commonOut").getString("errMsg")); +// } else { +// JSONObject cardInfoObj = response.getJSONObject("rsp").getJSONObject("card"); +// HealthCardInfo cardInfo = new HealthCardInfo(); +// cardInfo.setQrCodeText(cardInfoObj.getString("qrCodeText")); +// cardInfo.setName(cardInfoObj.getString("name")); +// cardInfo.setGender(cardInfoObj.getString("gender")); +// cardInfo.setNation(cardInfoObj.getString("nation")); +// cardInfo.setBirthday(cardInfoObj.getString("birthday")); +// cardInfo.setIdNumber(cardInfoObj.getString("idNumber")); +// cardInfo.setIdType(cardInfoObj.getString("idType")); +// cardInfo.setAddress(cardInfoObj.getString("address")); +// cardInfo.setPhone1(cardInfoObj.getString("phone1")); +// cardInfo.setPhone2(cardInfoObj.getString("phone2")); +// cardInfo.setHealthCardId(cardInfoObj.getString("healthCardId")); +// +// cardInfo.setOpenId(openid); +// +// HealthCardInfo cardInfo1 = healthCardInfoService.findHealthCardInfoByIdNumber(cardInfo.getIdNumber(), openid); +// if (cardInfo1 != null) { +// log.info("{}卡已存在,无须重复绑卡!", cardInfo.getName()); +// return BaseResultJSON.error("卡已存在,无须重复绑卡!"); +// } else { +// //使用数据库进行加锁,防止并发产生数据库死锁 +// int lock = ycPatientService.registerLock(cardInfo.getIdNumber()); +// if (lock < 1) { +// return BaseResultJSON.error("操作正在执行!"); +// } +// +// int r = healthCardInfoService.insertHealthCardInfo(cardInfo); +// +// //解锁 +// ycPatientService.registerUnlock(cardInfo.getIdNumber()); +// +// JSONObject result; +// if (r == 1) { +// result = BaseResultJSON.success("绑卡成功!"); +// } else { +// result = BaseResultJSON.error(-1, "HIS建卡失败"); +// } +// return result; +// } +// } +// } +// +// /** +// * 批量升级健康卡 +// * +// * @param healthCardInfoReqs +// * @return +// */ +// public JSONObject upgradeHeathCards(HealthCardInfo[] healthCardInfoReqs) { +// /** +// * 接口:批量健康卡接口 +// */ +// String wechatCode = "73EFA6796D3869FF82FAE7E81E9814B7"; +// String wechatUrl = "https://www.hbyctr.com/health_service/api/templateActiveHealthCard?openId="; +// +// BaseResultJSON result; +// List healthCardItems = new ArrayList<>(); +// +// // 遍历请求,获取注册信息 +// for (HealthCardInfo healthCardInfoReq : healthCardInfoReqs) { +// HealthCardInfo cardInfo = healthCardInfoService.findHealthCardInfoByIdNumber(healthCardInfoReq.getIdNumber(), +// healthCardInfoReq.getOpenId()); +// if (cardInfo == null) { +// String idCard = healthCardInfoReq.getIdNumber(); +// int i = Integer.valueOf(idCard.substring(16, 17)); +// if (i % 2 == 1) { +// healthCardInfoReq.setGender("男"); +// } else { +// healthCardInfoReq.setGender("女"); +// } +// String year = idCard.substring(6, 10); +// String month = idCard.substring(10, 12); +// String day = idCard.substring(12, 14); +// healthCardInfoReq.setBirthday(year + "-" + month + "-" + day); +// healthCardInfoReq.setIdType("01"); +// +// // 离线WeChatcode +// healthCardInfoReq.setWechatCode(wechatCode); +// // 模版消息跳转url +// healthCardInfoReq.setWechatUrl(wechatUrl + healthCardInfoReq.getOpenId()); +// +// healthCardItems.add(healthCardInfoReq); +// } else { +// // 已注册健康卡,忽略?? +// } +// } +// +// // 升级健康卡 +// CommonIn commonIn = InitCommonIn.getCommonIn(getApptoken()); +// JSONObject healthCardInfoRsp = InitCommonIn.getHealthCard().registerBatchHealthCard(commonIn, healthCardItems); +// +//// result.put("retcode", healthCardInfoRsp.getJSONObject("commonOut").getIntValue("resultCode")); +//// result.put("retmsg", healthCardInfoRsp.getJSONObject("commonOut").getString("errMsg")); +// ResponseWechatJSON responseWechatJson = ResponseWechatJSON.getInstance(healthCardInfoRsp); +// result = responseWechatJson.getBaseResultJSON(); +// +// if (responseWechatJson.getResultCode() == 0) { +//// result.put("retcode", -1); +//// result.put("retmsg", result.getString("retmsg")); +// return result; +// } +// System.out.println(JSON.toJSONString(healthCardInfoRsp)); +// JSONObject rsp = responseWechatJson.getJsonResp(); +// JSONArray items = rsp.getJSONArray("rspItems"); +// JSONObject item = null; +// +// List failItems = new ArrayList<>(); +// for (int i = 0; i < items.size(); i++) { +// item = items.getJSONObject(i); +// +// String qrCodeText = item.getString("qrCodeText"); +// String healthCardId = item.getString("healthCardId"); +// String idNumber = item.getString("idNumber"); +// +// // 判断是否升级成功,成功则加入数据库 +// for (HealthCardInfo healthCardInfoReq : healthCardInfoReqs) { +// String idCard = healthCardInfoReq.getIdNumber(); +// +// if (idCard == idNumber) { +// if (qrCodeText.length() > 0) { +// healthCardInfoReq.setQrCodeText(qrCodeText); +// healthCardInfoReq.setOpenId(healthCardInfoReq.getOpenId()); +// healthCardInfoReq.setHealthCardId(healthCardId); +// healthCardInfoService.insertHealthCardInfo(healthCardInfoReq); +// } else { +// // qrCodeText 为空,升级失败 +// failItems.add(idNumber); +// } +// } +// } +// } +//// result.put("failItems", failItems); +// result = BaseResultJSON.success(failItems); +// +// // 打印返回结果 +// System.out.println(result); +// return result; +// } +// +// /** +// * 通过二维码获取健康卡信息 +// * +// * @param qrCodeText +// * @return +// */ +// public JSONObject getHealthCardByCode(String qrCodeText) { +// HealthCardServer healthCardService = InitCommonIn.getHealthCard(); +// String token = getApptoken(); +// CommonIn commonIn = InitCommonIn.getCommonIn(token); +// // 调用接口 +// JSONObject healthCardInfoRsp = healthCardService.getHealthCardByQRCode(commonIn, qrCodeText); +// +// // 解析json生成 +// ResponseWechatJSON responseWechatJSON = ResponseWechatJSON.getInstance(healthCardInfoRsp, "card"); +// // 响应请求 +// return responseWechatJSON.getBaseResultJSON(); +// } +// +// /** +// * 通过健康卡授权码获取健康卡信息 +// * +// * @param healthCode +// * @return +// */ +// public JSONObject getHealthCardByHealthCode(String healthCode) { +// HealthCardServerImpl healthCard = InitCommonIn.getHealthCard(); +// // 调用接口 +// JSONObject healthCardInfoRsp = healthCard.getHealthCardByHealthCode(InitCommonIn.getCommonIn(getApptoken()), +// healthCode); +// // 解析json生成 +// ResponseWechatJSON responseWechatJSON = ResponseWechatJSON.getInstance(healthCardInfoRsp, "card"); +// return responseWechatJSON.getBaseResultJSON(); +// } +// +// public String getApptoken() { +// String apptoken1; +// Long expiresIn = healthCardApptokenService.findHealthCardExpiresIn(); +// Long dateTime = System.currentTimeMillis(); +// if (expiresIn == null || dateTime - expiresIn > 3600000 || dateTime - expiresIn < 0) { +// apptoken1 = InitCommonIn.getApptoken(); +// Long expiresIn2 = System.currentTimeMillis(); +// healthCardApptokenService.updateHealthCardApptoken(apptoken1, expiresIn2); +// +// } else { +// apptoken1 = healthCardApptokenService.findHealthCardApptoken(); +// } +// +// return apptoken1; +// } +// +// /** +// * 接口:用卡数据监测接口 +// */ +// public JSONObject bindCardRelation(String patId, String qrCodeText) { +// // 调用接口 +// CommonIn commonIn = InitCommonIn.getCommonIn(getApptoken()); +// JSONObject reportHISDataRsp = InitCommonIn.getHealthCard().bindCardRelation(commonIn, patId, qrCodeText); +// return ResponseWechatJSON.getInstance(reportHISDataRsp).getBaseResultJSON(); +// } +// +// /** +// * 接口:用卡数据监测接口 +// */ +// public JSONObject reportHISData(ReportHISData reportHISData) { +// // 调用接口 +// CommonIn commonIn = InitCommonIn.getCommonIn(getApptoken()); +// try { +// JSONObject reportHISDataRsp = InitCommonIn.getHealthCard().reportHISData(commonIn, reportHISData); +// // 打印响应 +// log.info("微信用卡数据监测上报结果:{}", JSON.toJSONString(reportHISDataRsp)); +// return ResponseWechatJSON.getInstance(reportHISDataRsp).getBaseResultJSON(); +// } catch (Exception e) { +// log.info("微信用卡数据监测上报异常:{}", e.getMessage()); +// return BaseResultJSON.error("微信用卡数据上报异常!"); +// } +// +// } +// +// /** +// * 接口:获取卡包订单ID接口 +// */ +// public String getOrderId(String qrCodeText) { +// // 调用接口 +// CommonIn commonIn = InitCommonIn.getCommonIn(getApptoken()); +// JSONObject orderIdObj = InitCommonIn.getHealthCard().getOrderIdByOutAppId(commonIn, InitCommonIn.appId, +// qrCodeText); +// // 打印响应 +// String orderId = orderIdObj.getJSONObject("rsp").getString("orderId"); +// log.info("放入卡包orderId:{}", orderId); +// return orderId; +// +// } +// +// /** +// * 接口:身份证照片OCR接口 +// */ +// public JSONObject registerByOcr(String imageContent) { +// // 调用接口 +// CommonIn commonIn = InitCommonIn.getCommonIn(getApptoken()); +// HealthCardServerImpl healthCard = InitCommonIn.getHealthCard(); +// JSONObject idCardInfo = healthCard.ocrInfo(commonIn, imageContent); +// // 打印响应 +// System.out.println(JSON.toJSONString(idCardInfo)); +// return idCardInfo; +// +// } +// +// /** +// * 获取动态二维码 +// * +// * @param healthCardId +// * @param idType +// * @param idNumber +// * @return +// */ +// public JSONObject getDynamicQRCode(String healthCardId, String idType, String idNumber) { +// HealthCardServerImpl healthCard = InitCommonIn.getHealthCard(); +// // 调用接口 +// JSONObject healthCardInfoRsp = healthCard.getDynamicQRCode(InitCommonIn.getCommonIn(getApptoken()), +// healthCardId, idType, idNumber, "0"); +// // 解析json生成 +// ResponseWechatJSON responseWechatJSON = ResponseWechatJSON.getInstance(healthCardInfoRsp, null); +// return responseWechatJSON.getBaseResultJSON(); +// } +// +//} diff --git a/health_framework/src/main/java/cn/card/health/framework/service/HisCallService.java b/health_framework/src/main/java/cn/card/health/framework/service/HisCallService.java new file mode 100644 index 0000000..c030091 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/framework/service/HisCallService.java @@ -0,0 +1,78 @@ +//package cn.card.health.framework.service; +// +//import java.util.ArrayList; +//import java.util.Collections; +//import java.util.Comparator; +//import java.util.Date; +//import java.util.HashMap; +//import java.util.List; +//import java.util.Map; +// +//import org.springframework.stereotype.Service; +// +//import cn.card.health.bean.order.YcOrderRegist; +//import cn.card.health.common.utils.DateUtils; +//import cn.card.health.common.utils.MapUtils; +//import cn.card.health.common.utils.Md5Utils; +//import cn.card.health.common.utils.XMLUtils; +//import cn.card.healthconfig.WechatConfig; +//import cn.his.service.HisWebClient; +// +///** +// * 调用his 服务 +// * @author xinggm +// * @date 2021年7月13日 +// */ +//public interface HisCallService { +// +// // 4.2 患者信息匹配002 +// @SuppressWarnings({ "unchecked" }) +// public Map getPatientInfo(Map params); +// +// // 4.7 患者信息绑定003 +// @SuppressWarnings({ "unchecked" }) +// public Map bindPatientInfo(Map params) ; +// +// // 4.7 患者信息绑定003 +// public Map registCard(Map params) ; +// +// // 5.1.1 科室挂号信息查询接口001 +// public List> getDeptList(Map params); +// +// // 5.1.2 医生挂号信息查询接口001 +// public List> getDoctorList(Map params) ; +// +// // 5.1.3 医生挂号班别信息查询接口001 +// public Map getDoctorRegScheduleListByDept(Map params) ; +// +// // 5.1.4 医生挂号班别信息查询接口002 +// public List> getDoctorRegScheduleListByDr(Map params) ; +// +// //5.1.5 医生挂号分时号源信息接口001 +// public List> getDoctorRegTimeList(Map params) ; +// +// // 5.2.1 生成预约挂号订单接口001 +// public Map lockPreRegOrder(YcOrderRegist orderRegist) ; +// +// // 5.2.2 取消预约挂号订单接口001 +// public Map cancelPreRegOrder(Map params) ; +// +// // 5.2.3 预约挂号订单支付接口001 +// public Map payPreRegOrder(Map params) ; +// +// // 5.2.4 预约挂号订单退费接口001 +// public Map refundPreReg(Map params) ; +// +// // 5.3.1 当天挂号号源锁定接口001 +// public Map lockRegSeqToday(Map params) ; +// +// // 5.3.2 当天挂号解除锁定接口001 +// public Map unlockRegSeqToday(Map params) ; +// +// // 5.3.3 当天挂号接口001 +// public Map addRegOrder(Map params) ; +// +// // 5.1.7 挂号订单查询接口001 +// public List> getRegOrderInfo(Map params) ; +// +//} diff --git a/health_framework/src/main/java/cn/card/health/framework/service/HisCardService.java b/health_framework/src/main/java/cn/card/health/framework/service/HisCardService.java new file mode 100644 index 0000000..82b3054 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/framework/service/HisCardService.java @@ -0,0 +1,142 @@ +package cn.card.health.framework.service; + +import cn.card.health.bean.order.YcOrder; +import cn.card.health.bean.order.YcOrderInhosp; +import cn.card.health.bean.order.YcOrderSerialpay; +import cn.card.health.bean.user.LoginUser; +import cn.card.health.common.utils.DateUtils; +import cn.card.health.common.utils.spring.SecurityUtils; +import cn.card.health.framework.service.alipay.AlipayAppletService; +import cn.card.health.framework.service.bank.BankService; +import cn.card.health.his.service.HisResult; +import cn.card.health.his.service.IHisCallService; +import cn.card.health.service.order.IYcOrderInhospService; +import cn.card.health.service.order.IYcOrderSerialpayService; +import cn.card.health.service.order.IYcOrderService; +import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.RandomUtil; +import com.alibaba.fastjson.JSONObject; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class HisCardService { + private Logger logger = LoggerFactory.getLogger(HisCardService.class); + + @Autowired + private IYcOrderService orderService; + @Autowired + private IYcOrderSerialpayService orderSerialpayService; + @Autowired + private IYcOrderInhospService orderInhospService; + @Autowired + private AlipayAppletService alipayAppletService; + @Autowired + private IHisCallService hisCallService; + @Autowired + private BankService bankService; + + + /** + * 就诊卡充值 + * @param params + * @return + */ + public Long preCharge(JSONObject params){ + YcOrder order = new YcOrder(); + order.setPatientid(params.getLong("patientid")); + LoginUser loginUser = SecurityUtils.getLoginUser(); + order.setUserid(loginUser.getUser().getUserid()); + order.setOrdertype("INCARD"); + order.setReceiptId(params.getString("memberid")); + order.setOpenid(loginUser.getUsername()); + order.setTotalmoney(params.getFloat("payMoney").intValue()); + order.setOrderno(IdUtil.getSnowflake().nextIdStr()); + order.setOrderStatus(1); + orderService.insertYcOrder(order); + + YcOrderInhosp orderInhosp = new YcOrderInhosp(); + orderInhosp.setOrderid(order.getOrderid()); + orderInhosp.setOrderno(params.getString("memberid")); + orderInhosp.setPatientid(order.getPatientid()); + orderInhosp.setOpenid(order.getOpenid()); + orderInhosp.setTotalmoney((Integer) params.get("payMoney")); + orderInhosp.setHisOrderid(order.getHisOrderId()); + orderInhospService.insertYcOrderInhosp(orderInhosp); + return order.getOrderid(); + } + + /** + * 充值支付 + * @param orderid + * @return + */ + public JSONObject payCharge(Long orderid){ + JSONObject result = new JSONObject(); + String outTradeNo = YcOrderSerialpay.getOuttradeno("alipay", "card"); + YcOrder order = orderService.selectYcOrderById(orderid); + YcOrderSerialpay orderSerialpay = new YcOrderSerialpay(); + orderSerialpay.setOrderid(order.getOrderid()); + orderSerialpay.setPatientid(order.getPatientid()); + orderSerialpay.setMoney(order.getTotalmoney()); + orderSerialpay.setPaystatus(1); + orderSerialpay.setPaytime(DateUtils.getNowDate()); + orderSerialpay.setOuttradeno(outTradeNo); + orderSerialpay.setOpenid(order.getOpenid()); + orderSerialpay.setTotalmoney(order.getTotalmoney()); + orderSerialpay.setPaymoney(order.getTotalmoney()); + orderSerialpay.setPaytype("ALIPAY"); + + YcOrderInhosp orderInhosp = new YcOrderInhosp(); + orderInhosp.setOrderid(order.getOrderid()); + orderInhosp = orderInhospService.selectYcOrderInhosp(orderInhosp); + JSONObject res = alipayAppletService.appletTradePay( "就诊卡充值", outTradeNo, order.getTotalmoney(), order.getOpenid()); +// //TODO 切换支付方式 +// JSONObject res = bankService.toPay(outTradeNo, "就诊卡充值测试", 1, order.getOpenid()); +// result.put("trade_no", res.getString("zfb_data_package")); +// result.put("out_trade_no", outTradeNo); + orderSerialpayService.insertYcOrderSerialpay(orderSerialpay); + result.putAll(res); + //TODO 支付查询 +// threadServcie.checkAliPay(orderInhosp, orderSerialpay); + return result; + } + + public List chargeList(String memberid){ + JSONObject hParams = new JSONObject(); + hParams.put("memberId", memberid); + HisResult hisrResult = hisCallService.chargeList(hParams); + if(hisrResult.isSucess()){ + return hisrResult.getListData(); + }else{ + return null; + } + } + + + + void confirmCardOrderPay(YcOrderInhosp orderInhosp){ + + YcOrder order = new YcOrder(); + order.setOrderid(orderInhosp.getOrderid()); + JSONObject hParmas = new JSONObject(); + hParmas.put("memberId", orderInhosp.getOrderno()); + hParmas.put("cashPay", orderInhosp.getTotalmoney()/100+""); + HisResult hisResult = hisCallService.cardCharge(hParmas); + if(hisResult.isSucess()){ + order.setOrderStatus(5); + String hisOrderid = hisResult.getRetData().get("id")+""; + orderInhosp.setHisOrderid(hisOrderid); + order.setHisOrderId(hisOrderid); + orderInhospService.updateYcOrderInhosp(orderInhosp); + }else{ + order.setOrderStatus(-5); + } + orderService.updateYcOrder(order); + } + +} diff --git a/health_framework/src/main/java/cn/card/health/framework/service/HisClinicHealthService.java b/health_framework/src/main/java/cn/card/health/framework/service/HisClinicHealthService.java new file mode 100644 index 0000000..dc14ae1 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/framework/service/HisClinicHealthService.java @@ -0,0 +1,245 @@ +package cn.card.health.framework.service; + +import cn.card.health.bean.order.YcOrder; +import cn.card.health.bean.order.YcOrderClinic; +import cn.card.health.bean.order.YcOrderClinicDetail; +import cn.card.health.common.utils.BaseResultJSON; +import cn.card.health.common.utils.Convert; +import cn.card.health.his.service.HisResult; +import cn.card.health.his.service.IHisCallService; +import cn.card.health.service.order.IYcOrderClinicDetailService; +import cn.card.health.service.order.IYcOrderClinicService; +import cn.card.health.service.order.IYcOrderService; +import cn.card.health.service.user.IYcPatientService; +import cn.hutool.core.util.IdUtil; +import com.alibaba.fastjson.JSONObject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * 门诊缴费 + * + * @author xinggm + * @date 2021年8月13日 + */ +@Service +public class HisClinicHealthService { + + private IHisCallService hisCallService; + @Autowired + private IYcOrderService orderService; + @Autowired + private IYcOrderClinicService orderClinicService; + @Autowired + private IYcOrderClinicDetailService orderClinicDetailService; + @Autowired + private IYcPatientService patientService; + + @Autowired + public HisClinicHealthService(@Qualifier("hdzxyHisCallService") IHisCallService hisCallService) { + this.hisCallService = hisCallService; + } + + + /** + * 查询未缴费项列表 + * + * @param params + * @return + */ + public JSONObject getWaitClinicList(Map params) { +// Long id = Long.parseLong(params.get("patientid")); +// YcPatient patient = patientService.selectYcPatientById(id); +// params.put("", patient.getCardno()); +// hisCallService = ApplicationContextUtil.getBean(params.get("hisid") + "HisCallService"); + HisResult hisResult = hisCallService.getWaitClinicList(params); + if (hisResult.isSucess()) { + return BaseResultJSON.success(hisResult.getListData()); + } else { + return BaseResultJSON.error("未查到缴费项"); + } + } + + /** + * 查询未缴费项详情 + * + * @param params + * @return + */ + public JSONObject getWaitClinicDetailList(Map params) { + HisResult hisResult = hisCallService.getWaitClinicDetail(params); + if (hisResult.isSucess()) { + return BaseResultJSON.success(hisResult.getRetData()); + } else { + return BaseResultJSON.error("未查到缴费项"); + } + } + + /** + * 查询未缴费项详情 + * + * @param params + * @return + */ + public JSONObject getPayClinicInfo(Map params) { + HisResult hisResult = hisCallService.getPayClinicInfo(params); + if (hisResult.isSucess()) { + return BaseResultJSON.success(hisResult.getRetData()); + } else { + return BaseResultJSON.error("未查到缴费项"); + } + } + + /** + * 查询未缴费项详情 + * + * @param params + * @return + */ + public JSONObject getPayClinicDetail(Map params) { + HisResult hisResult = hisCallService.getPayClinicDetail(params); + if (hisResult.isSucess()) { + return BaseResultJSON.success(hisResult.getListData()); + } else { + return BaseResultJSON.error("未查到缴费项"); + } + } + + /** + * 门诊缴费锁号 + * + * @param params + * @return + */ + public JSONObject lockClinicOrder(Map params) { + YcOrderClinic orderClinic = new YcOrderClinic(); + YcOrderClinicDetail orderClinicDetail = new YcOrderClinicDetail(); + YcOrder order = new YcOrder(); + order.setOpenid(""); + order.setOrderno(""); + order.setPatientid(1L); + order.setOrderStatus(1); + order.setOrdertype("CLINIC"); + orderService.insertYcOrder(order); + + orderClinic.setOrderid(order.getOrderid()); + orderClinic.setOrderno(order.getOrderno()); + orderClinic.setDeptname(""); + orderClinic.setDeptno(""); + orderClinic.setDoctorno(""); + orderClinic.setDoctorname(""); + orderClinic.setTotalmoney(0L); + + orderClinicDetail.setClinicOrderid(0L); + orderClinicDetail.setDetailamount(""); + orderClinicDetail.setDetailcount(""); + orderClinicDetail.setDetailfee(""); + orderClinicDetail.setDetailid(""); + orderClinicDetail.setDetailname(""); + orderClinicDetail.setDetailprice(""); + orderClinicDetail.setDetailspec(""); + orderClinicDetail.setDetailtypeid(""); + orderClinicDetail.setDetailunit(""); + orderClinicDetail.setOrderid(order.getOrderid()); + JSONObject result; + + HisResult hisResult = hisCallService.lockClinicOrder(params); + if (hisResult.isSucess()) { + order.setOrderStatus(3); + result = BaseResultJSON.success(hisResult.getRetData()); + } else { + order.setOrderStatus(2); + result = BaseResultJSON.error("未查到缴费项"); + } + + return result; + } + + /** + * 门诊缴费 + * + * @return + */ + public JSONObject payClinicOrder(Map params) { + + HisResult result = hisCallService.payClinicOrder(params); + return null; + } + + /** + * 门诊缴费创建订单 + * + * @param params + * @return + */ + public JSONObject prepayClinicOrder(Map params) { + HisResult orderResult = hisCallService.getWaitClinicList(params); + Map orderMap = null; + if (orderResult.isSucess()) { + List> list = orderResult.getListData(); + for (int i = 0; i < list.size(); i++) { + Map map = list.get(i); + if (map.get("visitId").equals(params.get("visitId"))) { + orderMap = map; + } + } + if (orderMap == null) { + return BaseResultJSON.error("缴费信息不存在!"); + } + + //生成订单 + YcOrder order = new YcOrder(); + order.setOpenid(Convert.toStr(params.get("openid"), "")); + order.setOrderno(IdUtil.getSnowflake().nextIdStr()); + order.setPatientid(Long.parseLong(params.get("patId")+"")); + order.setOrderStatus(1); + order.setOrdertype("CLINIC"); + order.setCreatetime(new Date()); + order.setTotalmoney(Integer.parseInt((String) orderMap.get("payAmount"))); + orderService.insertYcOrder(order); + + YcOrderClinic orderClinic = new YcOrderClinic(); + orderClinic.setOrderid(order.getOrderid()); + orderClinic.setOrderno(order.getOrderno()); + orderClinic.setDeptname(orderMap.get("deptName") + ""); + orderClinic.setDeptno((String) orderMap.get("deptId")); + orderClinic.setPatientid(order.getPatientid()); + orderClinic.setOpenid(order.getOpenid()); + orderClinic.setHisPatientid(""); + orderClinic.setDoctorno(orderMap.get("doctorId") + ""); + orderClinic.setHisOrderid(""); + orderClinic.setDoctorname(orderMap.get("doctorName") + ""); + orderClinic.setTotalmoney(Long.parseLong(orderMap.get("payAmount") + "")); + orderClinic.setVisitid(orderMap.get("visitId") + ""); + orderClinic.setCreatetime(new Date()); + orderClinic.setUpdatetime(new Date()); + orderClinicService.insertYcOrderClinic(orderClinic); + params.put("visitid", orderMap.get("visitId") + ""); + HisResult clinicResult = hisCallService.getWaitClinicDetail(params); + if (clinicResult.isSucess()) { + for (Map clinicMap : clinicResult.getListData()) { + //生成门诊缴费单据 + YcOrderClinicDetail detail = new YcOrderClinicDetail(); + detail.setOrderid(order.getOrderid()); + detail.setClinicOrderid(orderClinic.getClinicOrderid()); + detail.setDetailfee(clinicMap.get("detailFee") + ""); + detail.setDetailid(clinicMap.get("detailId") + ""); + detail.setDetailname(clinicMap.get("detailName") + ""); + detail.setDetailcount(clinicMap.get("detailCount") + ""); + detail.setDetailunit(clinicMap.get("detailUnit") + ""); + detail.setDetailamount(clinicMap.get("detailAmount") + ""); + detail.setDetailtypeid(clinicMap.get("detailTypeId") + ""); + orderClinicDetailService.insertYcOrderClinicDetail(detail); + } + return BaseResultJSON.success(orderClinic); + } + } + + return BaseResultJSON.error(""); + } +} diff --git a/health_framework/src/main/java/cn/card/health/framework/service/HisInPatientService.java b/health_framework/src/main/java/cn/card/health/framework/service/HisInPatientService.java new file mode 100644 index 0000000..f1f2d28 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/framework/service/HisInPatientService.java @@ -0,0 +1,165 @@ +package cn.card.health.framework.service; + +import cn.card.health.bean.order.YcOrder; +import cn.card.health.bean.order.YcOrderInhosp; +import cn.card.health.common.core.ApplicationContextUtil; +import cn.card.health.common.utils.BaseResultJSON; +import cn.card.health.his.service.HisResult; +import cn.card.health.his.service.IHisCallService; +import cn.card.health.service.order.IYcOrderInhospService; +import cn.card.health.service.order.IYcOrderSerialpayService; +import cn.card.health.service.order.IYcOrderService; +import cn.card.health.service.user.IYcInhospPatientService; +import cn.hutool.core.util.IdUtil; +import com.alibaba.fastjson.JSONObject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Service; + +import java.io.IOException; +import java.util.*; + +/** + * HIS住院服务 + * + * @author xinggm + * @date 2021年8月14日 + */ +@Service +public class HisInPatientService { + + private IHisCallService hisCallService; + @Autowired + private IYcInhospPatientService inHospPatientService; + @Autowired + private IYcOrderService orderService; + @Autowired + private IYcOrderSerialpayService orderSerialpayService; + @Autowired + private IYcOrderInhospService orderInhospService; + + @Autowired + public HisInPatientService(@Qualifier("hdzxyHisCallService") IHisCallService hisCallService) { + this.hisCallService = hisCallService; + } + + /** + * 获取患者信息 + * + * @param params + * @return + */ + public JSONObject getInPatientInfo(Map params) { + HisResult result = hisCallService.getInPatientInfo(params); + if (result.isSucess()) { + Map retData = result.getRetData(); + retData.put("birthday", ((String) retData.get("birthday")).substring(0, 10)); + retData.remove("patIdCard"); + return BaseResultJSON.success(retData); + } else { + return BaseResultJSON.error(result.getReturnMsg()); + } + } + + /** + * 住院 一日清单接口查询 + * + * @param params + * @return + */ + public JSONObject getInPatientDayInfo(Map params) { + hisCallService = ApplicationContextUtil.getBean(params.get("hisid") + "HisCallService"); + HisResult result = hisCallService.getIpDayExpenseList(params); + if (result.isSucess()) { + return BaseResultJSON.success(result.getRetData()); + } else { + return BaseResultJSON.error(); + } + } + + /** + * 住院 一日清单分类查询 + * + * @param params + * @return + */ + public JSONObject getInPatientDayItem(Map params) { + hisCallService = ApplicationContextUtil.getBean(params.get("hisid") + "HisCallService"); + HisResult result = hisCallService.getIpDayExpenseItemTotal(params); + if (result.isSucess()) { + return BaseResultJSON.success(result.getListData()); + } else { + return BaseResultJSON.error(); + } + } + + /** + * 住院当前费用情况查询接口002 + * + * @param params + * @return + */ + public JSONObject getInPatientExpenseTotal(Map params) { + hisCallService = ApplicationContextUtil.getBean(params.get("hisid") + "HisCallService"); + HisResult result = hisCallService.getIpChgInfo002(params); + if (result.isSucess()) { + return BaseResultJSON.success(result.getListData()); + } else { + return BaseResultJSON.error(); + } + } + + /** + * 住院押金明细查询接口002 + * 梁超飞 + * + * @param params + * @return + */ + public JSONObject getInPatientChargeList(Map params) { + HisResult result = hisCallService.getIpDepositDetail001(params); + if (result.isSucess()) { + return BaseResultJSON.success(result.getListData()); + } else { + return BaseResultJSON.error(result.getReturnMsg()); + } + } + + /** + * 住院金充值 + * + * @param params + * @return + * @throws IOException + */ + public String payInPatientCharge(Map params) { + YcOrder order = new YcOrder(); + order.setOrderno(IdUtil.getSnowflake().nextIdStr()); + order.setOpenid((String) params.get("openid")); + order.setPatientid(Long.parseLong(params.get("patId") + "")); + order.setHisOrderId((String) params.get("visitId")); + order.setOrderStatus(1); + order.setOrdertype("INHOSP"); + order.setTotalmoney((Integer) params.get("payMoney")); + order.setCreatetime(new Date()); + orderService.insertYcOrder(order); + + YcOrderInhosp orderInhosp = new YcOrderInhosp(); + orderInhosp.setOrderid(order.getOrderid()); + orderInhosp.setOrderno(order.getOrderno()); + orderInhosp.setPatientid(order.getPatientid()); + orderInhosp.setOpenid(order.getOpenid()); + orderInhosp.setTotalmoney((Integer) params.get("payMoney")); + orderInhosp.setCreatetime(new Date()); + orderInhosp.setUpdatetime(new Date()); + orderInhosp.setHisOrderid(order.getHisOrderId()); + orderInhospService.insertYcOrderInhosp(orderInhosp); + + return order.getOrderno(); + } + + public HisResult pay(Map params) { + return hisCallService.payIpDeposit(params); + } + +} diff --git a/health_framework/src/main/java/cn/card/health/framework/service/HisReportService.java b/health_framework/src/main/java/cn/card/health/framework/service/HisReportService.java new file mode 100644 index 0000000..d040d25 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/framework/service/HisReportService.java @@ -0,0 +1,115 @@ +package cn.card.health.framework.service; + +import cn.card.health.bean.hospital.YcPatient; +import cn.card.health.common.core.ApplicationContextUtil; +import cn.card.health.common.utils.BaseResultJSON; +import cn.card.health.his.service.HisResult; +import cn.card.health.his.service.IHisCallService; +import cn.card.health.service.user.IYcPatientService; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; + +@Service +public class HisReportService { + + private IHisCallService hisCallService; + @Autowired + private IYcPatientService patientService; + + @Autowired + public HisReportService(@Qualifier("hdzxyHisCallService") IHisCallService hisCallService) { + this.hisCallService = hisCallService; + } + +// /** +// * 检验报告列表 +// */ +// public HisResult getLisReportList(String patId, String month) { +//// return hisCallService.getLisReportList(patId, month); +// return null; +// } + + /** + * 核酸检验报告列表 + */ + public HisResult getNuclReportList(String patId, String month) { + return hisCallService.getNuclReportList(patId, month); + } + +// /** +// * 检验报告详情 +// */ +// public HisResult getLisReportDetail(String openid, String reportId) { +//// return hisCallService.getLisReportDetail(openid, reportId); +// return null; +// } + + /** + * 检查报告列表 + */ + public JSONObject getPacsReportList(Map params) { + hisCallService = ApplicationContextUtil.getBean(params.get("hisid") + "HisCallService"); + return BaseResultJSON.success(hisCallService.getPacsReportList(params)); + } + + /** + * 检查报告详情 + */ + public JSONObject getPacsReportDetail(Map params) { + hisCallService = ApplicationContextUtil.getBean(params.get("hisid") + "HisCallService"); + return BaseResultJSON.success(hisCallService.getPacsReportDetail(params)); + } + + /** + * 查询住院病例 + * + * @param patName + * @param idNumber + * @return + */ + public Map getIpPatientInfo(String patName, String idNumber) { + return hisCallService.getIpPatientInfo(patName, idNumber); + } + + public List getListReportList(JSONObject params) { + JSONObject hParams = new JSONObject(); + if(params.containsKey("patientid")){ + YcPatient patient = patientService.selectYcPatientById(params.getLong("patientid")); + hParams.put("idcard", patient.getCardno()); + } + if (params.containsKey("idcard") ) { + hParams.put("idcard", params.getString("idcard")); + } + if (params.containsKey("begdate")) { + hParams.put("begdate", params.getString("begdate")); + } + if (params.containsKey("enddate")) { + hParams.put("enddate", params.getString("enddate")); + } + if (params.containsKey("chkkind")) { + hParams.put("chkkind", params.getString("chkkind")); + } + HisResult hisResult = hisCallService.getLisReportList(hParams); + return hisResult.getListData(); + } + + public List getListReportInfo(JSONObject params) { + JSONObject hParams = new JSONObject(); + hParams.put("chkAppId", params.getString("chkAppId")); + hParams.put("type", params.getString("type")); + HisResult hisResult = hisCallService.getLisReportDetail(hParams); + if(hisResult.isSucess()){ + return hisResult.getListData(); + }else { + return null; + } + } + + +} diff --git a/health_framework/src/main/java/cn/card/health/framework/service/MyUserDetailsService.java b/health_framework/src/main/java/cn/card/health/framework/service/MyUserDetailsService.java new file mode 100644 index 0000000..6fa57e0 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/framework/service/MyUserDetailsService.java @@ -0,0 +1,28 @@ +//package cn.card.health.framework.service; +// +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.security.core.userdetails.User; +//import org.springframework.security.core.userdetails.UserDetails; +//import org.springframework.security.core.userdetails.UserDetailsService; +//import org.springframework.security.core.userdetails.UsernameNotFoundException; +//import org.springframework.security.crypto.password.PasswordEncoder; +//import org.springframework.stereotype.Service; +// +//@Service +//public class MyUserDetailsService implements UserDetailsService { +// @Autowired +// private PasswordEncoder passwordEncoder; +// +// @Override +// public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { +// // 为了演示方便,使用内存定义用户的真实账密及其访问权限 +// return User +// .withUsername("zhangxun") +// .password() +// // 设置当前用户可以拥有的权限信息,授权码模式下,用户输入账密后就拥有该权限 +// .authorities("user:query") +// .build(); +// +// User.withDefaultPasswordEncoder().build(). +// } +//} \ No newline at end of file diff --git a/health_framework/src/main/java/cn/card/health/framework/service/RegistHealthService.java b/health_framework/src/main/java/cn/card/health/framework/service/RegistHealthService.java new file mode 100644 index 0000000..7dc1e2c --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/framework/service/RegistHealthService.java @@ -0,0 +1,1521 @@ +package cn.card.health.framework.service; + +import cn.card.health.alipay.config.AlipayAppletConfig; +import cn.card.health.bean.hospital.YcPatient; +import cn.card.health.bean.insurance.MkAppletRequest; +import cn.card.health.bean.insurance.MkInsurancePay; +import cn.card.health.bean.order.YcOrder; +import cn.card.health.bean.order.YcOrderRefundpay; +import cn.card.health.bean.order.YcOrderRegist; +import cn.card.health.bean.order.YcOrderSerialpay; +import cn.card.health.bean.user.LoginUser; +import cn.card.health.common.exception.base.BaseException; +import cn.card.health.common.utils.BaseResultJSON; +import cn.card.health.common.utils.DateUtils; +import cn.card.health.common.utils.spring.SecurityUtils; +import cn.card.health.framework.service.alipay.AlipayAppletService; +import cn.card.health.framework.service.bank.BankService; +import cn.card.health.his.service.HisResult; +import cn.card.health.his.service.IHisCallService; +import cn.card.health.insurance.HealthInsuranceService; +import cn.card.health.service.insurance.IMkAppletRequestService; +import cn.card.health.service.insurance.IMkInsurancePayService; +import cn.card.health.service.order.IYcOrderRefundpayService; +import cn.card.health.service.order.IYcOrderRegistService; +import cn.card.health.service.order.IYcOrderSerialpayService; +import cn.card.health.service.order.IYcOrderService; +import cn.card.health.service.user.IYcPatientService; +import cn.hutool.core.util.IdUtil; +import com.alibaba.fastjson.JSONObject; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Service +public class RegistHealthService { + + @Autowired + private IHisCallService hisCallService; + @Autowired + private IYcOrderRegistService ycOrderRegistService; + @Autowired + private IYcOrderService ycOrderService; + @Autowired + private IYcPatientService ycPatientService; + @Autowired + private AlipayAppletService alipayAppletService; + @Autowired + private IYcOrderSerialpayService orderSerialpayService; + @Autowired + private IYcOrderRefundpayService orderRefundpayService; + @Autowired + private HealthInsuranceService healthInsuranceService; + @Autowired + private IMkInsurancePayService insurancePayService; + @Autowired + private IMkAppletRequestService appletRequestService; + @Autowired + private ThreadOrderService threadService; + @Autowired + private BankService bankService; + + private Logger logger = LoggerFactory.getLogger(RegistHealthService.class); + + @Autowired + public RegistHealthService(@Qualifier("hdzxyHisCallService") IHisCallService hisCallService) { + this.hisCallService = hisCallService; + } + + /** + * 查询科室 + * + * @param params + * @return + */ + public List> getDeptList(Map params) { + //hisCallService = ApplicationContextUtil.getBean(params.get("hisid") + "HisCallService"); + return hisCallService.getDeptList(params); + } + + /** + * 查询医生 + * + * @param params + * @return + */ + public List> getDoctorList(Map params) { + //hisCallService = ApplicationContextUtil.getBean(params.get("hisid") + "HisCallService"); + return hisCallService.getDoctorList(params); + } + + /** + * 根据科室查询医生信息 + * + * @param params + * @return + */ + public List> getDoctorRegScheduleByDept(Map params) { + return hisCallService.getDoctorRegScheduleListByDept(params); + } + + /** + * 根据医生查询信息 + * + * @param params + * @return + */ + public List> getDoctorRegScheduleByDr(Map params) { + //hisCallService = ApplicationContextUtil.getBean(params.get("hisid") + "HisCallService"); + return hisCallService.getDoctorRegScheduleListByDr(params); + } + + /** + * 查询医生号源信息 + * + * @param params + * @return + */ + public List> getDoctorRegTimeList(Map params) { + return hisCallService.getDoctorRegTimeList(params); + } + + /** + * 预约挂号锁号 + * + * @param orderRegist + * @return + */ + public Map lockPreRegOrder(YcOrderRegist orderRegist) { + Map resultMap = new HashMap(); + + //hisCallService = ApplicationContextUtil.getBean(orderRegist.getHisid() + "HisCallService"); + YcPatient patient = ycPatientService.selectYcPatientById(orderRegist.getPatientid()); + if (patient == null) { + throw new BaseException("就诊人不存在 " + orderRegist.getPatientid()); + } + LoginUser loginUser = SecurityUtils.getLoginUser(); + logger.info("login username: " + loginUser.getUsername()); + logger.info("alipay userid: " + patient.getOpenid()); + if (!loginUser.getUsername().equals(patient.getOpenid())) { + throw new BaseException("请使用自己的就诊人 " + orderRegist.getPatientid()); + } + orderRegist.setPatient(patient); + YcOrder order = new YcOrder(); + order.setUserid(orderRegist.getOrderid()); + order.setOrderno(DateUtils.getDateTimes()); + order.setOrdertype("PREREGIST"); + order.setOrderStatus(1); + order.setPayStatus(1); + order.setHisStatus(1); + order.setInsureStatus(0); + order.setPatientid(orderRegist.getPatientid()); + order.setOpenid(orderRegist.getOpenid()); + orderRegist.setOrdertype(order.getOrdertype()); + orderRegist.setOrderno(order.getOrderno()); + orderRegist.setOrderstatus("1"); + order.setTotalmoney(orderRegist.getTotalmoney()); +// HisResult result = hisCallService.lockPreRegOrder(orderRegist); +// HisResult result = new HisResult(); +// result.setReturnCode("1"); +// if (result.isSucess()) { +// String hisOrderId = (String) result.getRetData().get("hisOrderId"); +// orderRegist.setHisOrderid(hisOrderId); +// order.setHisOrderId(hisOrderId); + Date now = DateUtils.getNowDate(); + order.setCreatetime(now); + ycOrderService.insertYcOrder(order); + orderRegist.setOrderid(order.getOrderid()); + orderRegist.setCreatetime(now); + ycOrderRegistService.insertYcOrderRegist(orderRegist); + resultMap.put("success", true); +// } else { +// order.setOrderStatus(2); +// order.setReason("HIS锁号失败"); +// ycOrderService.insertYcOrder(order); +// resultMap.put("success", false); +// resultMap.put("message", result.getReturnMsg()); +// } + resultMap.put("result", orderRegist); + return resultMap; + } + + /** + * 取消预约锁号 + * + * @param orderRegist + * @return + */ + public JSONObject cancelLockPreRegOrder(YcOrderRegist orderRegist) { + YcOrder order = ycOrderService.selectYcOrderById(orderRegist.getOrderid()); + orderRegist.setYcOrder(order); + if (order.getOrderStatus() == 1) { + HisResult result = hisCallService.cancelPreRegOrder(orderRegist); + if (result.isSucess()) { + order.setOrderStatus(2);// 取消预约挂号 + order.setReason(orderRegist.getRemark()); + ycOrderService.updateYcOrder(order); + + orderRegist.setOrderstatus("2"); + orderRegist.setUpdatetime(new Date()); + ycOrderRegistService.updateYcOrderRegist(orderRegist); + return BaseResultJSON.success(result.getReturnMsg()); + } else { + return BaseResultJSON.error(result.getReturnMsg()); + } + } else { + return BaseResultJSON.error("订单状态不符合取消条件"); + } + } + + /** + * 确认预约挂号 + * + * @param orderRegist + * @return + */ + public JSONObject confirmPreRegOrder(YcOrderRegist orderRegist) { + + JSONObject result = new JSONObject(); + JSONObject hParams = new JSONObject(); + YcOrder order = orderRegist.getYcOrder(); + + Integer orderStatus = order.getOrderStatus(); + Integer hisStatus = order.getHisStatus(); + if ((hisStatus & 10) == 3) { + result.put("code", 1); + result.put("msg", "挂号预约已经成功 " + order.getOrderid()); + return result; + } + YcPatient patient = ycPatientService.selectYcPatientById(orderRegist.getPatientid()); + String outTradeNo; + YcOrderSerialpay orderSerialpay = new YcOrderSerialpay(); + orderSerialpay.setOrderid(order.getOrderid()); + orderSerialpay.setPatientid(order.getPatientid()); + orderSerialpay.setMoney(order.getTotalmoney()); + orderSerialpay.setPaystatus(1); + orderSerialpay.setPaytime(DateUtils.getNowDate()); + + orderSerialpay.setOpenid(order.getOpenid()); + orderSerialpay.setTotalmoney(order.getTotalmoney()); + orderSerialpay.setPaymoney(order.getTotalmoney()); + + result.put("isAlipay", order.isAlipay()); + + //支付宝支付 + if (order.isAlipay()) { + outTradeNo = YcOrderSerialpay.getOuttradeno("alipay", "regist"); + orderSerialpay.setOuttradeno(outTradeNo); + //等待支付 + order.setPayStatus(2); +// String subject, String outTradeNo, Integer totalAmount, String userid + JSONObject res = alipayAppletService.appletTradePay(orderRegist.getDeptname() + "挂号", outTradeNo, order.getTotalmoney(), order.getOpenid()); + orderSerialpay.setPaytype("ALIPAY"); + orderSerialpayService.insertYcOrderSerialpay(orderSerialpay); + result.putAll(res); + //TODO 支付查询 + threadService.checkAliPay(orderRegist, orderSerialpay); + return result; + } + //余额支付 + else { + outTradeNo = YcOrderSerialpay.getOuttradeno("yue", "regist"); + orderSerialpay.setOuttradeno(outTradeNo); + orderSerialpay.setPaytype("ACCOUNT"); + hParams.put("reglevel_id", ""); + hParams.put("idcard", patient.getCardno()); + hParams.put("departId", orderRegist.getDeptno()); + hParams.put("doctorId", orderRegist.getDoctorno()); + hParams.put("clinicroom", ""); + hParams.put("userid", ""); + hParams.put("taskdate", orderRegist.getRegdate()); + hParams.put("memberId", orderRegist.getHisPatientid()); + hParams.put("amount", ""); + + hParams.put("memberPay", (float) order.getTotalmoney() / 100 + ""); + hParams.put("accountPay", "0"); + hParams.put("insurancePay", "0"); + hParams.put("cashPay", "0"); + hParams.put("ybpay", "N"); + HisResult hisResult = hisCallService.payPreRegOrder(hParams); + if (hisResult.isSucess()) { + // TODO 订单状态修改 + orderRegist.setOrderstatus("5"); + String hisOrderid = hisResult.getRetData().get("regid") + ""; + orderRegist.setHisOrderid(hisOrderid); + order.setHisOrderPayId(hisOrderid); + order.setHisOrderId(hisOrderid); + orderRegist.getYcOrder().setOrderStatus(5); + + order.setHisStatus(3); + ycOrderRegistService.updateYcOrderRegist(orderRegist); + ycOrderService.updateYcOrder(order); + // 余额支付记录 + orderSerialpay.setOuttradeno(order.getOrderno()); + orderSerialpay.setPaystatus(3); + orderSerialpay.setPaytime(DateUtils.getNowDate()); + orderSerialpayService.insertYcOrderSerialpay(orderSerialpay); + + result.put("code", 1); + result.put("regid", hisOrderid); + return result; + } else { + orderRegist.setOrderstatus("2"); + orderRegist.setUpdatetime(new Date()); + ycOrderRegistService.updateYcOrderRegist(orderRegist); + YcOrder ycOrder = orderRegist.getYcOrder(); + ycOrder.setOrderStatus(-5); + order.setHisStatus(2); + ycOrder.setReason(hisResult.getReturnMsg()); + ycOrderService.updateYcOrder(orderRegist.getYcOrder()); + orderSerialpayService.insertYcOrderSerialpay(orderSerialpay); + + result.put("code", -1); + result.put("msg", hisResult.getReturnMsg()); + return result; + } + + } + } + + /** + * 确认预约挂号 + * + * @param orderRegist + * @return + */ + public JSONObject preRegOrderInsurance(YcOrderRegist orderRegist, String acctUsedFlag) { + + //判断订单状态 + JSONObject result = new JSONObject(); + YcOrder order = orderRegist.getYcOrder(); +// Integer orderStatus = order.getOrderStatus(); + Integer insureStatus = order.getInsureStatus(); + //已预结算 直接返回信息 + if ((insureStatus & 10) == 2) { + MkInsurancePay insPay = new MkInsurancePay(); + insPay.setOrderid(order.getOrderid()); + insPay = insurancePayService.selectMkInsurancePayInfo(insPay); + result.put("isAuth", 1); + result.put("orderid", order.getOrderid()); + result.put("psnAcctPay", insPay.getPsnacctpay()); + result.put("hospPartAmt", 0.00); + result.put("othFeeAmt", 0.00); + result.put("selfAcctPay", insPay.getPsnacctpay()); + result.put("feeSumamt", insPay.getFeesumamt()); + result.put("fundPay", insPay.getFundpay()); + result.put("ownPayAmt", insPay.getOwnpayamt()); + return result; + } + order.setInsureStatus(2); + if (insureStatus > 2) { + throw new BaseException(order.getOrderid() + " 已预结算完成"); + } + //医保+支付宝支付 + order.setHospid(4L + 1L); + order.setReceiptId("INS"); + YcPatient patient = ycPatientService.selectYcPatientById(orderRegist.getPatientid()); + result.put("orderid", orderRegist.getOrderid()); + + YcOrderSerialpay orderSerialpay = new YcOrderSerialpay(); + orderSerialpay.setOrderid(order.getOrderid()); + orderSerialpay.setPatientid(order.getPatientid()); +// orderSerialpay.setMoney(order.getTotalmoney()); + orderSerialpay.setPaystatus(1); + orderSerialpay.setPaytime(DateUtils.getNowDate()); + orderSerialpay.setOpenid(order.getOpenid()); + orderSerialpay.setTotalmoney(order.getTotalmoney()); + orderSerialpay.setPaymoney(order.getTotalmoney()); + + LoginUser loginuser = SecurityUtils.getLoginUser(); + //医保流程 +// String authResult = "a222"; + String authResult = alipayAppletService.medicalAuthInfoAuthQuery(loginuser.getUsername(), loginuser.getUser().getPassword(), "m" + System.currentTimeMillis()); + if (!authResult.startsWith("AUTH")) { + result.put("auth_url", authResult); + result.put("isAuth", 0); + return result; + } + String medicalCardId = authResult.split(",")[1]; + authResult = authResult.split(",")[0]; + result.put("isAuth", 1); + JSONObject inAdmdvs = alipayAppletService.medicalCardAuthQuery(loginuser.getUser().getPassword()); + logger.info("insuplc_admdvsData: "); + String insuplc_admdvs = "130402"; + if (!"1".equals(inAdmdvs.getString("retcode"))) { + result.putAll(inAdmdvs); + + return result; + } + //TODO 正式环境启用 + insuplc_admdvs = inAdmdvs.getJSONObject("data").getString("ins_city_code"); + insuplc_admdvs = "130402"; + + if (StringUtils.isBlank(orderRegist.getDoctorname())) { + orderRegist.setDoctorname("普通医生"); + } + logger.info("install_admdvs: " + insuplc_admdvs); + JSONObject pParams = new JSONObject(); + pParams.put("mdtrt_cert_no", patient.getCardno()); + pParams.put("mdtrt_cert_type", "02"); + pParams.put("insuplc_admdvs", insuplc_admdvs); + pParams.put("idNo", patient.getCardno()); + pParams.put("dept_code", orderRegist.getDeptno()); + pParams.put("dept_name", orderRegist.getDeptname()); + + HisResult hisResult = hisCallService.getPsnInfo(pParams); + if (!hisResult.isSucess()) { + throw new BaseException("获取医保人员信息失败 " + hisResult.getReturnMsg()); + } + String insutype = "310"; + pParams = new JSONObject(); + insutype = hisResult.getRetData().get("insutype") + ""; + pParams.put("insutype", insutype); + pParams.put("idNo", patient.getCardno()); + pParams.put("psnNo", hisResult.getRetData().get("psn_no")); + pParams.put("userName", patient.getPatientName()); + pParams.put("payAuthNo", authResult); + pParams.put("insuplcAdmdvs", insuplc_admdvs); + pParams.put("deptCode", orderRegist.getDeptno()); + pParams.put("deptName", orderRegist.getDeptname()); + pParams.put("atddrNo", orderRegist.getDoctorno()); + pParams.put("drName", orderRegist.getDoctorname()); + pParams.put("iptOtpNo", orderRegist.getHisPatientid()); + pParams.put("medfeeSumamt", orderRegist.getTotalmoney() / 100 + ""); + String serialno = System.currentTimeMillis() + ""; + pParams.put("medOrgOrd", serialno); + pParams.put("orgBizSer", serialno); + pParams.put("chrgBchno", serialno); + pParams.put("mdtrtId", hisResult.getRetData().get("mdtrt_id")); + //TODO 使用医保账户余额 +// pParams.put("acctUsedFlag", "1"); + pParams.put("acctUsedFlag", acctUsedFlag); + + JSONObject pubParams = healthInsuranceService.getRegistInfo(pParams); + + JSONObject detailData = new JSONObject(); + detailData.put("diseCodg", pubParams.getString("diseCodg")); + detailData.put("diseName", pubParams.getString("diseName")); + detailData.put("diseinfoList", pubParams.getJSONArray("diseinfoList")); + detailData.put("feedetailList", pubParams.getJSONArray("feedetailList")); + + MkAppletRequest appletRequest = new MkAppletRequest(pubParams); + appletRequest.setMkRequestMethod("[6201] 费用明细上传"); + MkInsurancePay insurancePay = new MkInsurancePay(pParams); + insurancePay.setPayAuthNo(authResult); + insurancePay.setOrderid(order.getOrderid()); + insurancePay.setMedtype("12"); + insurancePay.setUserid(loginuser.getUsername()); + insurancePay.setApprovedtime(DateUtils.getNowDate()); + insurancePay.setMdtrtcerttype(medicalCardId); + insurancePay.setIdtype("01"); + //银行+挂号 + String outTradeNo = YcOrderSerialpay.getOuttradeno("bank", "regist"); + orderSerialpay.setOuttradeno(outTradeNo); + insurancePay.setOutTradeNo(outTradeNo); + try { + JSONObject resData = healthInsuranceService.uldFeeInfo(pubParams, appletRequest); + if ("0".equals(resData.getString("code"))) { + JSONObject data = resData.getJSONObject("data"); + insurancePay.setPayordid(data.getString("payOrdId")); + insurancePay.setPaytoken(data.getString("payToken")); + insurancePay.setMdtrtid(data.getJSONObject("extData").getString("mdtrtId")); + + } else { + order.setInsureStatus(-1); + insurancePay.setOrdstas("-1"); + appletRequest.setMkAppletResponseData(resData.getString("message")); + result.put("code", -1); + + } + } catch (Exception e) { + String errMsg = "[6201] 费用明细上传 发生异常"; + appletRequest.setMkAppletResponseData(errMsg); + insurancePay.setOrdstas("-1"); + throw new BaseException(errMsg); + } finally { + insurancePayService.insertMkInsurancePay(insurancePay); + appletRequestService.insertMkAppletRequest(appletRequest); + + if (StringUtils.isNotBlank(insurancePay.getPayordid())) { + JSONObject payJSON = new JSONObject(); + payJSON.put("chrgBchno", serialno); + payJSON.put("feeType", "01"); + payJSON.put("mdtrtId", ""); + payJSON.put("orgBizSer", serialno); + payJSON.put("orgCodg", AlipayAppletConfig.org_no); + payJSON.put("payAuthNo", authResult); + payJSON.put("payOrdId", insurancePay.getPayordid()); + payJSON.put("payToken", insurancePay.getPaytoken()); + JSONObject retPay = payOrder(payJSON); + if (!"0".equals(retPay.getString("code"))) { + result.put("code", -1); + order.setOrderStatus(-2); + order.setInsureStatus(2); + } else { + JSONObject conData = retPay.getJSONObject("data"); + BigDecimal b100 = new BigDecimal(100); + orderSerialpay.setTotalmoney((conData.getBigDecimal("ownPayAmt").multiply(b100)).intValue()); + orderSerialpay.setPaymoney((conData.getBigDecimal("ownPayAmt").multiply(b100)).intValue()); + orderSerialpayService.insertYcOrderSerialpay(orderSerialpay); + detailData.put("deposit", conData.getFloat("deposit")); + detailData.put("hospPartAmt", conData.getFloat("hospPartAmt")); + result.putAll(detailData); + order.setOrderStatus(2); + order.setInsureStatus(-2); + result.putAll(conData); + } + } + ycOrderService.updateYcOrder(order); + + } + return result; + } + + public JSONObject preRegOrderInsurancePay(YcOrder order) { + MkInsurancePay insurancePay = new MkInsurancePay(); + insurancePay.setOrderid(order.getOrderid()); + insurancePay = insurancePayService.selectMkInsurancePayInfo(insurancePay); + MkAppletRequest appletRequest = new MkAppletRequest(); + appletRequest.setMkRequestMethod("医保支付"); + //非0自费流程+银行接口 + if (insurancePay.getOwnpayamt() > 0) { + + YcOrderSerialpay serial = new YcOrderSerialpay(); + serial.setOrderid(order.getOrderid()); + YcOrderSerialpay orderSerialPay = orderSerialpayService.selectYcOrderSerialpay(serial); + serial.setSerialpayid(orderSerialPay.getSerialpayid()); + JSONObject bankResult = bankService.toPay(orderSerialPay.getOuttradeno(), "医保支付", orderSerialPay.getTotalmoney(), order.getOpenid()); + if (!"0".equals(bankResult.getString("returnCode"))) { +// throw new BaseException("银行接口失败 " + order.getOrderid()); + } else { + serial.setTransactionid(bankResult.getString("zfb_data_package")); + orderSerialPay.setTransactionid(bankResult.getString("zfb_data_package")); + orderSerialpayService.updateYcOrderSerialpay(serial); + } +// BigDecimal b100 = new BigDecimal(100); +// bankResult.getString("order_id") + JSONObject medicalResult = alipayAppletService.medicalPaymentCreateAndPay(orderSerialPay.getOuttradeno(), orderSerialPay.getTransactionid(), insurancePay.getFeesumamt(), insurancePay.getFundpay(), insurancePay.getPsnacctpay(), insurancePay.getOwnpayamt(), order.getOpenid(), insurancePay.getMdtrtcerttype(), DateUtils.getTime(), insurancePay.getMedorgord(), insurancePay.getPayordid(), insurancePay.getPayAuthNo()); + appletRequest.setMkAppletRequestData(medicalResult.getString("request")); + + YcOrderRegist orderRegist = new YcOrderRegist(); + orderRegist.setOrderid(order.getOrderid()); + orderRegist = ycOrderRegistService.selectYcOrderRegist(orderRegist); + //TODO 支付查询 + threadService.checkBankPay(orderRegist, orderSerialPay ); + if (medicalResult.getBoolean("result")) { + appletRequest.setMkInsuranceResponseData(medicalResult.getString("data")); + if (insurancePay != null && !"6".equals(insurancePay.getOrdstas())) { + insurancePay.setTradeno(orderSerialPay.getTransactionid()); + insurancePay.setApprovedtime(DateUtils.getNowDate()); + insurancePayService.updateMkInsurancePayAsyc(insurancePay); + } + } else { + appletRequest.setMkAppletResponseData(medicalResult.getString("msg")); + } + appletRequestService.insertMkAppletRequest(appletRequest); + medicalResult.remove("data"); + medicalResult.remove("request"); + return medicalResult; + } else + //0自费流程 + { + +// BigDecimal b100 = new BigDecimal(100); + JSONObject medicalResult = alipayAppletService.medicalPaymentCreateAndPay(insurancePay.getOutTradeNo(), insurancePay.getTradeno(), insurancePay.getFeesumamt(), insurancePay.getFundpay(), insurancePay.getPsnacctpay(), 0, order.getOpenid(), insurancePay.getMdtrtcerttype(), DateUtils.getTime(), insurancePay.getMedorgord(), insurancePay.getPayordid(), insurancePay.getPayAuthNo()); + if (medicalResult.getBoolean("result")) { + appletRequest.setMkInsuranceResponseData(medicalResult.getString("data")); + if (insurancePay != null && !"6".equals(insurancePay.getOrdstas())) { + insurancePay.setTradeno(insurancePay.getTradeno()); + insurancePay.setApprovedtime(DateUtils.getNowDate()); + insurancePayService.updateMkInsurancePayAsyc(insurancePay); + } + } else { + appletRequest.setMkAppletResponseData(medicalResult.getString("msg")); + } + appletRequestService.insertMkAppletRequest(appletRequest); + medicalResult.remove("data"); + return medicalResult; + } + } + + /** + * 结算查询 + * + * @param order + * @return + */ + public JSONObject preRegOrderInsuranceInfo(YcOrder order) { + + logger.info("==========结算查询================================"); + logger.info(order.toString()); + Integer hisStatus = order.getInsureStatus(); + MkInsurancePay insurancePay = new MkInsurancePay(); + insurancePay.setOrderid(order.getOrderid()); + Integer times = 0; + while (hisStatus != 3) { + try{ + Thread.sleep(2000); + times++; + }catch (InterruptedException e){ + + } + order = ycOrderService.selectYcOrderById(order.getPatientid()); + if(times>=30){ + throw new BaseException("his订单失败"); + } + } + insurancePay = insurancePayService.selectMkInsurancePayInfo(insurancePay); + JSONObject data = new JSONObject(); + + data.put("acctMulaidPay", insurancePay.getFundpay()); + data.put("feeSumamt", insurancePay.getFeesumamt()); + data.put("fundPay", insurancePay.getFundpay()); + data.put("medOrgOrd", insurancePay.getMedorgord()); + data.put("ordStas", insurancePay.getOrdstas()); + data.put("ownPayAmt", insurancePay.getOwnpayamt()); + data.put("payOrdId", insurancePay.getPayordid()); + data.put("psnAcctPay", insurancePay.getPsnacctpay()); + data.put("selfAcctPay", insurancePay.getPsnacctpay()); + return data; + +// MkAppletRequest appletRequest = new MkAppletRequest(); +// appletRequest.setMkRequestMethod("6301 医保结算查询"); +// JSONObject params = new JSONObject(); +// params.put("payOrdId", insurancePay.getPayordid()); +// params.put("payToken", insurancePay.getPaytoken()); +// params.put("idNo", insurancePay.getIdno()); +// params.put("userName", insurancePay.getUsername()); +// params.put("idType", insurancePay.getIdtype()); +// appletRequest.setMkAppletRequestData(params.toJSONString()); +// JSONObject result = healthInsuranceService.queryOrderInfo(params, appletRequest); +// appletRequestService.insertMkAppletRequest(appletRequest); +// if (!"0".equals(result.getString("code"))) { +// return result; +// } +// JSONObject insuranceData = result.getJSONObject("data"); +// //his已经成功,不用再次请求 +//// if (orderStatus == 5) { +// insurancePay.setOrdstas(insuranceData.getString("ordStas")); +// +// YcOrderRegist orderRegist = new YcOrderRegist(); +// orderRegist.setOrderid(order.getOrderid()); +// orderRegist = ycOrderRegistService.selectYcOrderRegist(orderRegist); +// //医保挂号成功 +// if ("6".equals(insuranceData.getString("ordStas"))) { +// order.setOrderStatus(4); +// order.setInsureStatus(3); +// JSONObject setlInfo = insuranceData.getJSONObject("extData").getJSONObject("setlinfo"); +// String medinsSetlId = setlInfo.getString("medinsSetlId"); +// insurancePay.setMedinsSetlId(medinsSetlId); +// JSONObject hParams = new JSONObject(); +// hParams.put("reglevel_id", ""); +// hParams.put("idcard", insurancePay.getIdno()); +// hParams.put("departId", orderRegist.getDeptno()); +// hParams.put("doctorId", orderRegist.getDoctorno()); +// hParams.put("clinicroom", ""); +// hParams.put("userid", ""); +// hParams.put("mdtrtId", setlInfo.getString("mdtrtId")); +// hParams.put("taskdate", orderRegist.getRegdate()); +// hParams.put("memberId", orderRegist.getHisPatientid()); +// hParams.put("amount", insurancePay.getFeesumamt() + ""); +// hParams.put("memberPay", "0"); +// hParams.put("accountPay", insurancePay.getPsnacctpay() + ""); +// hParams.put("insurancePay", insurancePay.getFundpay() + ""); +// hParams.put("cashPay", insurancePay.getFeesumamt() + ""); +// hParams.put("ybpay", "Y"); +// +// hParams.put("psnNo", setlInfo.getString("psnNo")); +// hParams.put("setlId", setlInfo.getString("setlId")); +// hParams.put("psnName", setlInfo.getString("psnName")); +// hParams.put("psnCertType", setlInfo.getString("psnCertType")); +// hParams.put("certno", setlInfo.getString("certno")); +// hParams.put("gend", setlInfo.getString("gend")); +// hParams.put("naty", ""); +// hParams.put("brdy", setlInfo.getString("brdy")); +// hParams.put("age", setlInfo.getString("age")); +// hParams.put("insutype", setlInfo.getString("insutype")); +// hParams.put("psnType", setlInfo.getString("psnType")); +// hParams.put("cvlservFlag", setlInfo.getString("cvlservFlag")); +// hParams.put("setlTime", setlInfo.getString("setlTime")); +// hParams.put("mdtrtCertType", setlInfo.getString("mdtrtCertType")); +// hParams.put("medType", setlInfo.getString("medType")); +// hParams.put("medfeeSumamt", setlInfo.getString("medfeeSumamt")); +// hParams.put("fulamtOwnpayAmt", setlInfo.getString("fulamtOwnpayAmt")); +// hParams.put("overlmtSelfpay", setlInfo.getString("overlmtSelfpay")); +// hParams.put("preselfpayAmt", setlInfo.getString("preselfpayAmt")); +// hParams.put("inscpScpAmt", setlInfo.getString("inscpScpAmt")); +// hParams.put("actPayDedc", setlInfo.getString("actPayDedc")); +// hParams.put("hifpPay", setlInfo.getString("hifpPay")); +// hParams.put("poolPropSelfpay", setlInfo.getString("poolPropSelfpay")); +// hParams.put("cvlservPay", setlInfo.getString("cvlservPay")); +// hParams.put("hifesPay", setlInfo.getString("hifesPay")); +// hParams.put("hifmiPay", setlInfo.getString("hifmiPay")); +// hParams.put("hifobPay", setlInfo.getString("hifobPay")); +// hParams.put("mafPay", setlInfo.getString("mafPay")); +// hParams.put("othPay", setlInfo.getString("othPay")); +// hParams.put("fundPaySumamt", setlInfo.getString("fundPaySumamt")); +// hParams.put("psnPartAmt", setlInfo.getString("psnPartAmt")); +// hParams.put("acctPay", setlInfo.getString("acctPay")); +// hParams.put("psnCashPay", setlInfo.getString("psnCashPay")); +// hParams.put("hospPartAmt", setlInfo.getString("hospPartAmt")); +// hParams.put("balc", setlInfo.getString("balc")); +// hParams.put("acctMulaidPay", setlInfo.getString("acctMulaidPay")); +// hParams.put("medinsSetlId", setlInfo.getString("medinsSetlId")); +// hParams.put("clrOptins", setlInfo.getString("clrOptins")); +// hParams.put("clrWay", setlInfo.getString("clrWay")); +// hParams.put("clrType", setlInfo.getString("clrType")); +// hParams.put("insuplcAdmdvs", insuranceData.getJSONObject("extData").getString("insuplcAdmdvs")); +// +// HisResult hisResult = hisCallService.payPreRegOrder(hParams); +// if (hisResult.isSucess()) { +// // TODO 订单状态修改 +// orderRegist.setOrderstatus("5"); +// String hisOrderid = hisResult.getRetData().get("regid") + ""; +// orderRegist.setHisOrderid(hisOrderid); +// YcOrder ycOrder = new YcOrder(); +// ycOrder.setOrderid(order.getOrderid()); +// ycOrder.setHisOrderPayId(hisOrderid); +// ycOrder.setHisOrderId(hisOrderid); +// ycOrder.setOrderStatus(5); +// ycOrder.setInsureStatus(order.getInsureStatus()); +// ycOrder.setHisStatus(3); +// ycOrderRegistService.updateYcOrderRegist(orderRegist); +// ycOrderService.updateYcOrder(ycOrder); +// // 余额支付记录 +// } else { +// orderRegist.setOrderstatus("2"); +// orderRegist.setUpdatetime(DateUtils.getNowDate()); +// ycOrderRegistService.updateYcOrderRegist(orderRegist); +// YcOrder ycOrder = new YcOrder(); +// ycOrder.setOrderid(order.getOrderid()); +// ycOrder.setOrderStatus(-5); +// ycOrder.setInsureStatus(order.getInsureStatus()); +// ycOrder.setHisStatus(2); +// ycOrder.setReason(hisResult.getReturnMsg()); +// ycOrderService.updateYcOrder(ycOrder); +// } +//// } +// +// insurancePayService.updateMkInsurancePay(insurancePay); +// } else { +// order.setInsureStatus(-5); +// ycOrderService.updateYcOrder(order); +// } +// insuranceData.remove("extData"); +// return insuranceData; + + } + + + /** + * 结算查询 + * + * @param order + * @return + */ + @Transactional + public void preRegOrderInsurance(YcOrder order) { + + logger.info("==========结算查询================================"); + logger.info(order.toString()); + Integer hisStatus = order.getInsureStatus(); + MkInsurancePay insurancePay = new MkInsurancePay(); + insurancePay.setOrderid(order.getOrderid()); + insurancePay = insurancePayService.selectMkInsurancePayInfo(insurancePay); + MkAppletRequest appletRequest = new MkAppletRequest(); + appletRequest.setMkRequestMethod("6301 医保结算查询"); + JSONObject params = new JSONObject(); + params.put("payOrdId", insurancePay.getPayordid()); + params.put("payToken", insurancePay.getPaytoken()); + params.put("idNo", insurancePay.getIdno()); + params.put("userName", insurancePay.getUsername()); + params.put("idType", insurancePay.getIdtype()); + appletRequest.setMkAppletRequestData(params.toJSONString()); + JSONObject result = healthInsuranceService.queryOrderInfo(params, appletRequest); + appletRequestService.insertMkAppletRequest(appletRequest); + if (!"0".equals(result.getString("code"))) { + return; + } + JSONObject insuranceData = result.getJSONObject("data"); + //his已经成功,不用再次请求 +// if (orderStatus == 5) { + insurancePay.setOrdstas(insuranceData.getString("ordStas")); + + YcOrderRegist orderRegist = new YcOrderRegist(); + orderRegist.setOrderid(order.getOrderid()); + orderRegist = ycOrderRegistService.selectYcOrderRegist(orderRegist); + //医保挂号成功 + if ("6".equals(insuranceData.getString("ordStas"))) { + order.setOrderStatus(4); + order.setInsureStatus(3); + JSONObject setlInfo = insuranceData.getJSONObject("extData").getJSONObject("setlinfo"); + String medinsSetlId = setlInfo.getString("medinsSetlId"); + insurancePay.setMedinsSetlId(medinsSetlId); + JSONObject hParams = new JSONObject(); + hParams.put("reglevel_id", ""); + hParams.put("idcard", insurancePay.getIdno()); + hParams.put("departId", orderRegist.getDeptno()); + hParams.put("doctorId", orderRegist.getDoctorno()); + hParams.put("clinicroom", ""); + hParams.put("userid", ""); + hParams.put("mdtrtId", setlInfo.getString("mdtrtId")); + hParams.put("taskdate", orderRegist.getRegdate()); + hParams.put("memberId", orderRegist.getHisPatientid()); + hParams.put("amount", insurancePay.getFeesumamt() + ""); + hParams.put("memberPay", "0"); + hParams.put("accountPay", insurancePay.getPsnacctpay() + ""); + hParams.put("insurancePay", insurancePay.getFundpay() + ""); + hParams.put("cashPay", insurancePay.getFeesumamt() + ""); + hParams.put("ybpay", "Y"); + + hParams.put("psnNo", setlInfo.getString("psnNo")); + hParams.put("setlId", setlInfo.getString("setlId")); + hParams.put("psnName", setlInfo.getString("psnName")); + hParams.put("psnCertType", setlInfo.getString("psnCertType")); + hParams.put("certno", setlInfo.getString("certno")); + hParams.put("gend", setlInfo.getString("gend")); + hParams.put("naty", ""); + hParams.put("brdy", setlInfo.getString("brdy")); + hParams.put("age", setlInfo.getString("age")); + hParams.put("insutype", setlInfo.getString("insutype")); + hParams.put("psnType", setlInfo.getString("psnType")); + hParams.put("cvlservFlag", setlInfo.getString("cvlservFlag")); + hParams.put("setlTime", setlInfo.getString("setlTime")); + hParams.put("mdtrtCertType", setlInfo.getString("mdtrtCertType")); + hParams.put("medType", setlInfo.getString("medType")); + hParams.put("medfeeSumamt", setlInfo.getString("medfeeSumamt")); + hParams.put("fulamtOwnpayAmt", setlInfo.getString("fulamtOwnpayAmt")); + hParams.put("overlmtSelfpay", setlInfo.getString("overlmtSelfpay")); + hParams.put("preselfpayAmt", setlInfo.getString("preselfpayAmt")); + hParams.put("inscpScpAmt", setlInfo.getString("inscpScpAmt")); + hParams.put("actPayDedc", setlInfo.getString("actPayDedc")); + hParams.put("hifpPay", setlInfo.getString("hifpPay")); + hParams.put("poolPropSelfpay", setlInfo.getString("poolPropSelfpay")); + hParams.put("cvlservPay", setlInfo.getString("cvlservPay")); + hParams.put("hifesPay", setlInfo.getString("hifesPay")); + hParams.put("hifmiPay", setlInfo.getString("hifmiPay")); + hParams.put("hifobPay", setlInfo.getString("hifobPay")); + hParams.put("mafPay", setlInfo.getString("mafPay")); + hParams.put("othPay", setlInfo.getString("othPay")); + hParams.put("fundPaySumamt", setlInfo.getString("fundPaySumamt")); + hParams.put("psnPartAmt", setlInfo.getString("psnPartAmt")); + hParams.put("acctPay", setlInfo.getString("acctPay")); + hParams.put("psnCashPay", setlInfo.getString("psnCashPay")); + hParams.put("hospPartAmt", setlInfo.getString("hospPartAmt")); + hParams.put("balc", setlInfo.getString("balc")); + hParams.put("acctMulaidPay", setlInfo.getString("acctMulaidPay")); + hParams.put("medinsSetlId", setlInfo.getString("medinsSetlId")); + hParams.put("clrOptins", setlInfo.getString("clrOptins")); + hParams.put("clrWay", setlInfo.getString("clrWay")); + hParams.put("clrType", setlInfo.getString("clrType")); + hParams.put("insuplcAdmdvs", insuranceData.getJSONObject("extData").getString("insuplcAdmdvs")); + + HisResult hisResult = hisCallService.payPreRegOrder(hParams); + if (hisResult.isSucess()) { + // TODO 订单状态修改 + orderRegist.setOrderstatus("5"); + String hisOrderid = hisResult.getRetData().get("regid") + ""; + orderRegist.setHisOrderid(hisOrderid); + YcOrder ycOrder = new YcOrder(); + ycOrder.setOrderid(order.getOrderid()); + ycOrder.setHisOrderPayId(hisOrderid); + ycOrder.setHisOrderId(hisOrderid); + ycOrder.setOrderStatus(5); + ycOrder.setInsureStatus(order.getInsureStatus()); + ycOrder.setHisStatus(3); + ycOrderRegistService.updateYcOrderRegist(orderRegist); + ycOrderService.updateYcOrder(ycOrder); + // 余额支付记录 + } else { + orderRegist.setOrderstatus("2"); + orderRegist.setUpdatetime(DateUtils.getNowDate()); + ycOrderRegistService.updateYcOrderRegist(orderRegist); + YcOrder ycOrder = new YcOrder(); + ycOrder.setOrderid(order.getOrderid()); + ycOrder.setOrderStatus(-5); + ycOrder.setInsureStatus(order.getInsureStatus()); + ycOrder.setHisStatus(2); + ycOrder.setReason(hisResult.getReturnMsg()); + ycOrderService.updateYcOrder(ycOrder); + } + + insurancePayService.updateMkInsurancePay(insurancePay); + } else { + order.setInsureStatus(-5); + ycOrderService.updateYcOrder(order); + } + + } + + /** + * 确认预约挂号 + * + * @param orderRegist + * @return + */ + public void confirmPreRegOrderPay(YcOrderRegist orderRegist) { + + YcOrder order = orderRegist.getYcOrder(); + YcPatient patient = ycPatientService.selectYcPatientById(orderRegist.getPatientid()); + + Integer hisStatus = order.getHisStatus(); + //已经处理过his请求,不再处理 + if(hisStatus!=1){ + return; + } + JSONObject hParams = new JSONObject(); + hParams.put("reglevel_id", ""); + hParams.put("idcard", patient.getCardno()); + hParams.put("departId", orderRegist.getDeptno()); + hParams.put("doctorId", orderRegist.getDoctorno()); + hParams.put("clinicroom", ""); + hParams.put("userid", ""); + hParams.put("taskdate", orderRegist.getRegdate()); + hParams.put("memberId", orderRegist.getHisPatientid()); + hParams.put("amount", ""); + hParams.put("memberPay", "0"); + hParams.put("accountPay", "0"); + hParams.put("insurancePay", "0"); + hParams.put("cashPay", order.getTotalmoney() / 100 + ""); + hParams.put("ybpay", "N"); +// order.setReceiptId("ACCOUNT"); + HisResult hisResult = hisCallService.payPreRegOrder(hParams); + if (hisResult.isSucess()) { + // TODO 订单状态修改 + orderRegist.setOrderstatus("5"); + String hisOrderid = hisResult.getRetData().get("regid") + ""; + orderRegist.setHisOrderid(hisOrderid); + + YcOrder ycOrder = new YcOrder(); + ycOrder.setOrderid(order.getOrderid()); + ycOrder.setHisOrderPayId(hisOrderid); + ycOrder.setOrderStatus(5); + ycOrder.setHisStatus(3); + ycOrderRegistService.updateYcOrderRegist(orderRegist); + ycOrderService.updateYcOrder(ycOrder); + // 余额支付记录 + } else { + orderRegist.setOrderstatus("2"); + orderRegist.setUpdatetime(DateUtils.getNowDate()); + ycOrderRegistService.updateYcOrderRegist(orderRegist); + YcOrder ycOrder = new YcOrder(); + order.setOrderid(order.getOrderid()); + ycOrder.setOrderStatus(2); + ycOrder.setHisStatus(2); + ycOrder.setReason(hisResult.getReturnMsg()); + ycOrderService.updateYcOrder(ycOrder); + } + } + + /** + * 取消预约挂号 + * + * @param orderRegist + * @return + */ + public BaseResultJSON refundPreReg(YcOrderRegist orderRegist) { + //hisCallService = ApplicationContextUtil.getBean(orderRegist.getHisid() + "HisCallService"); + YcOrder order = ycOrderService.selectYcOrderById(orderRegist.getOrderid()); + logger.info("====订单支付状态:" + order.getPayStatus() + " ===订单his状态:" + order.getHisStatus()); + YcOrderSerialpay serialpay = new YcOrderSerialpay(); + serialpay.setOrderid(order.getOrderid()); + YcOrderSerialpay orderSerialpay = orderSerialpayService.selectYcOrderSerialpay(serialpay); + Date now = DateUtils.getNowDate(); + + //单边帐退费 + if (order.getHisStatus() == 2 && order.getPayStatus() == 3) { + String alipayRefundNo = "R" + orderSerialpay.getOuttradeno(); + + logger.info("=============支付宝退费==================="); + boolean flag = alipayAppletService.appletTradeRefund(orderSerialpay.getOuttradeno(), orderSerialpay.getMoney(), alipayRefundNo, "退号退费"); + if (flag) { + YcOrderRefundpay alipayRefundpay = new YcOrderRefundpay(); + alipayRefundpay.setPaytype("ALIPAY"); + alipayRefundpay.setOrderid(orderSerialpay.getOrderid()); + alipayRefundpay.setRefundstatus(1); + alipayRefundpay.setSerialpayid(orderSerialpay.getSerialpayid()); + alipayRefundpay.setOutrefundno(alipayRefundNo); + alipayRefundpay.setMoney(orderSerialpay.getPaymoney()); + alipayRefundpay.setRefundtime(now); + alipayRefundpay.setCreatetime(now); + order.setPayStatus(30 + order.getPayStatus()); + orderRefundpayService.insertYcOrderRefundpay(alipayRefundpay); + } else { + return BaseResultJSON.error("支付宝退费失败"); + } + } + + YcPatient patient = ycPatientService.selectYcPatientById(order.getPatientid()); + LoginUser loginUser = SecurityUtils.getLoginUser(); + JSONObject result = new JSONObject(); + String authResult = ""; + String payAuthNo = ""; + + //判断his订单状态 + JSONObject hisParams = new JSONObject(); + hisParams.put("memberid", orderRegist.getHisPatientid()); + hisParams.put("regid", orderRegist.getHisOrderid()); + List> listRegist = hisCallService.getRegOrderInfo(hisParams); + if (listRegist.size() == 0) { + return BaseResultJSON.error("未找到挂号记录"); + } + Map hisRegist = listRegist.get(0); + if (!"REG".equals(hisRegist.get("state")) || "00".equals(hisRegist.get("isarchives"))) { + return BaseResultJSON.error("已叫号,不允许退号;" + hisRegist.get("stus") + hisRegist.get("isarchive")); + } + + if (order.isInsure()) { + //医保流程 + authResult = alipayAppletService.medicalAuthInfoAuthQuery(loginUser.getUsername(), loginUser.getUser().getPassword(), System.currentTimeMillis() + ""); + if (!authResult.startsWith("AUTH")) { + result.put("auth_url", authResult); + result.put("isAuth", 0); + return BaseResultJSON.success(result); + } + payAuthNo = authResult.split(",")[0]; + } + result.put("isAuth", 1); + JSONObject hParams; + hisParams.put("regid", orderRegist.getHisOrderid()); + hisParams.put("cardId", patient.getCardno()); + hisParams.put("alipay", order.isAlipay() ? "Y" : "N"); + hisParams.put("ybpay", order.isInsure() ? "Y" : "N"); + + + boolean hasMoney = false; + + logger.info("==============是否医保 " + order.getOrderid() + "|" + order.isInsure()); + MkInsurancePay insurancePay = null; + if (order.isInsure()) { + + insurancePay = new MkInsurancePay(); + insurancePay.setOrderid(order.getOrderid()); + insurancePay = insurancePayService.selectMkInsurancePayInfo(insurancePay); + String outRefundNo = "R" + insurancePay.getOutTradeNo(); + MkAppletRequest appletRequest = new MkAppletRequest(); + appletRequest.setMkRequestMethod("[6203] 医保退费"); + refundPreRegOrder(order.getOrderid()); + hParams = new JSONObject(); + hParams.put("payOrdId", insurancePay.getPayordid()); + hParams.put("appRefdSn", outRefundNo); + hParams.put("appRefdTime", DateUtils.dateTimeNow()); + hParams.put("totlRefdAmt", insurancePay.getFeesumamt()); + hParams.put("cashRefdAmt", insurancePay.getOwnpayamt()); + hParams.put("psnAcctRefdAmt", insurancePay.getPsnacctpay()); + hParams.put("fundRefdAmt", insurancePay.getFundpay()); + hParams.put("refdType", "HI"); + hParams.put("payAuthNo", payAuthNo); + appletRequest.setMkAppletRequestData(hParams.toJSONString()); + JSONObject retRefund = healthInsuranceService.refundOrder(hParams, appletRequest); + appletRequestService.insertMkAppletRequest(appletRequest); + + if (insurancePay.getOwnpayamt() > 0) { + hasMoney = true; + } +// String data = "{ \"appId\": \"1GI1ID7O302G3F60C80A000072E7D954\", \"code\": 0, \"data\": { \"extData\": { \"setlInfo\": { \"acct_mulaid_pay\": 0, \"acct_pay\": -1, \"act_pay_dedc\": 0, \"age\": 36, \"balc\": 75, \"brdy\": \"1988-01-28\", \"certno\": \"131124198801283219\", \"clr_optins\": \"130499\", \"clr_type\": \"11\", \"clr_way\": \"1\", \"cvlserv_flag\": \"0\", \"cvlserv_pay\": 0, \"fulamt_ownpay_amt\": 0, \"fund_pay_sumamt\": -14, \"gend\": \"1\", \"hifdm_pay\": 0, \"hifes_pay\": 0, \"hifmi_pay\": 0, \"hifob_pay\": 0, \"hifp_pay\": -14, \"inscp_scp_amt\": -15, \"insutype\": \"310\", \"maf_pay\": 0, \"mdtrt_cert_type\": \"01\", \"mdtrt_id\": \"300229723\", \"med_type\": \"12\", \"medfee_sumamt\": -15, \"medins_setl_id\": \"H13040207288202406231645211312\", \"naty\": \"01\", \"oth_pay\": 0, \"overlmt_selfpay\": 0, \"pool_prop_selfpay\": -1, \"preselfpay_amt\": 0, \"psn_cash_pay\": 0, \"psn_cert_type\": \"01\", \"psn_name\": \"邢广冒\", \"psn_no\": \"13000000000000000500031580\", \"psn_type\": \"1101\", \"setl_id\": \"13049920240623000300144007\", \"setl_time\": \"2024-06-23 16:45:21\" }, \"setldetail\": [ { \"fund_pay_type\": \"310100\", \"fund_pay_type_name\": \"城镇职工基本医疗保险统筹基金\", \"fund_payamt\": -14, \"inscp_scp_amt\": -15 }, { \"fund_pay_type\": \"310200\", \"fund_pay_type_name\": \"城镇职工基本医疗保险个人账户基金\", \"fund_payamt\": -1, \"inscp_scp_amt\": -15 } ] }, \"hiFefdSn\": \"13049920240623000300144007\", \"hiTrnsDate\": \"20240623\", \"hiTrnsTime\": \"164521\", \"refStatus\": \"SUCC\", \"refdSn\": \"REF130100202406231645210000007\" }, \"encType\": \"SM4\", \"flag\": true, \"message\": \"成功-072-fbf24527115042339fb25fecde2503c2\", \"signData\": \"+jSYF8FAoCAQpcf5XIBjUMf9wPynsw08MUnx1wF4PRcXzypzC8pHAoZUNqpDv4n+lR1+TO9uMbu0BGMt8n9z9Q==\", \"signType\": \"SM2\", \"success\": true, \"timestamp\": \"1719132321960\", \"version\": \"2.0.1\" }"; +// JSONObject retRefund = JSONObject.parseObject(data); + // 医保退费成功 + if ("0".equals(retRefund.getString("code"))) { + insurancePay.setOrdstas("8"); + order.setInsureStatus(50+order.getInsureStatus()); + insurancePayService.updateMkInsurancePay(insurancePay); + + //医保退费流水 + YcOrderRefundpay refundpay = new YcOrderRefundpay(); + refundpay.setPaytype("INSURE"); + refundpay.setOrderid(orderSerialpay.getOrderid()); + refundpay.setRefundstatus(1); + refundpay.setSerialpayid(orderSerialpay.getSerialpayid()); + refundpay.setOutrefundno(outRefundNo); + refundpay.setMoney(orderSerialpay.getPaymoney()); + refundpay.setRefundtime(now); + refundpay.setCreatetime(now); + orderRefundpayService.insertYcOrderRefundpay(refundpay); + + logger.info("==============retRefund=================="); + logger.info(retRefund.toJSONString()); + JSONObject setlInfo = retRefund.getJSONObject("data").getJSONObject("extData").getJSONObject("setlInfo"); + logger.info("==============setlInfo=================="); + logger.info(setlInfo.toJSONString()); + String medinsSetlId = setlInfo.getString("medinsSetlId"); + hisParams.put("psnNo", setlInfo.getString("psn_no")); + hisParams.put("setlId", setlInfo.getString("setl_id")); + hisParams.put("psnName", setlInfo.getString("psn_name")); + hisParams.put("psnCertType", setlInfo.getString("psn_cert_type")); + hisParams.put("certno", setlInfo.getString("certno")); + hisParams.put("gend", setlInfo.getString("gend")); + hisParams.put("naty", ""); + hisParams.put("brdy", setlInfo.getString("brdy")); + hisParams.put("age", setlInfo.getString("age")); + hisParams.put("insutype", setlInfo.getString("insutype")); + hisParams.put("psnType", setlInfo.getString("psn_type")); + hisParams.put("cvlservFlag", setlInfo.getString("cvlserv_flag")); + hisParams.put("setlTime", setlInfo.getString("setl_time")); + hisParams.put("mdtrtCertType", setlInfo.getString("mdtrt_cert_type")); + hisParams.put("medType", setlInfo.getString("med_type")); + hisParams.put("medfeeSumamt", setlInfo.getString("medfee_sumamt")); + hisParams.put("fulamtOwnpayAmt", setlInfo.getString("fulamt_ownpay_amt")); + hisParams.put("overlmtSelfpay", setlInfo.getString("overlmt_selfpay")); + hisParams.put("preselfpayAmt", setlInfo.getString("preselfpay_amt")); + hisParams.put("inscpScpAmt", setlInfo.getString("inscp_scp_amt")); + hisParams.put("actPayDedc", setlInfo.getString("act_pay_dedc")); + hisParams.put("hifpPay", setlInfo.getString("hifp_pay")); + hisParams.put("poolPropSelfpay", setlInfo.getString("pool_prop_selfpay")); + hisParams.put("cvlservPay", setlInfo.getString("cvlserv_flag")); + hisParams.put("hifesPay", setlInfo.getString("hifes_pay")); + hisParams.put("hifmiPay", setlInfo.getString("hifmi_pay")); + hisParams.put("hifobPay", setlInfo.getString("hifob_pay")); + hisParams.put("mafPay", setlInfo.getString("maf_pay")); + hisParams.put("othPay", setlInfo.getString("oth_pay")); + hisParams.put("fundPaySumamt", setlInfo.getString("fund_pay_sumamt")); + hisParams.put("psnPartAmt", setlInfo.getString("psn_cash_pay")); + hisParams.put("acctPay", setlInfo.getString("acct_pay")); + hisParams.put("psnCashPay", setlInfo.getString("psn_cash_pay")); + hisParams.put("hospPartAmt", "0"); + hisParams.put("balc", setlInfo.getString("balc")); + hisParams.put("acctMulaidPay", setlInfo.getString("acct_mulaid_pay")); + hisParams.put("medinsSetlId", setlInfo.getString("medins_setl_id")); + hisParams.put("clrOptins", setlInfo.getString("clr_optins ")); + hisParams.put("clrWay", setlInfo.getString("clr_way")); + hisParams.put("clrType", setlInfo.getString("clr_type")); + hisParams.put("insuplcAdmdvs", "130402"); + + } else { + return BaseResultJSON.error("医保退费失败|" + retRefund.getString("message")); + } + } + HisResult resultRefund = hisCallService.refundPreReg(hisParams); + + logger.info("===========his退费结果====================="); + logger.info(resultRefund.toString()); + if (!resultRefund.isSucess()) { + order.setHisStatus(20+order.getHisStatus()); + return BaseResultJSON.error("his退费失败 | " + hisParams.getString("regid") + "|" + resultRefund.getReturnMsg()); + } + order.setHisStatus(30+order.getHisStatus()); + orderRegist.setOrderstatus("7"); + ycOrderRegistService.updateYcOrderRegist(orderRegist); + + logger.info("=====订单流水======"); + logger.info(JSONObject.toJSONString(orderSerialpay)); + if (order.isInsure()) { + // TODO银行退费 + if (insurancePay.getOwnpayamt() > 0) { + order.setPayStatus(3 + order.getPayStatus()); + logger.info("=====银行退费======" + orderSerialpay.getOuttradeno()); + //银行退费流水 + String bankRefundNo = "R" + orderSerialpay.getOuttradeno(); + YcOrderRefundpay bankRefundpay = new YcOrderRefundpay(); + bankRefundpay.setPaytype("BANK"); + bankRefundpay.setOrderid(orderSerialpay.getOrderid()); + bankRefundpay.setRefundstatus(1); + bankRefundpay.setSerialpayid(orderSerialpay.getSerialpayid()); + bankRefundpay.setOutrefundno(bankRefundNo); + bankRefundpay.setMoney(orderSerialpay.getPaymoney()); + bankRefundpay.setRefundtime(now); + bankRefundpay.setCreatetime(now); + JSONObject bankResult = bankService.toRefund(orderSerialpay.getOuttradeno(), bankRefundNo, orderSerialpay.getPaymoney()); + if ("0".equals(bankResult.getString("returnCode"))) { + bankRefundpay.setRefundstatus(3); + } else { + bankRefundpay.setRefundstatus(2); + return BaseResultJSON.error("银行退费失败"); + } + orderRefundpayService.insertYcOrderRefundpay(bankRefundpay); + } + } else { + logger.info("=============isAlipay===================" + order.isAlipay()); + logger.info("=============outtradeno===================" + orderSerialpay.getOuttradeno()); + if (order.isAlipay()) { + String alipayRefundNo = "R" + orderSerialpay.getOuttradeno(); + + logger.info("=============支付宝退费==================="); + boolean flag = alipayAppletService.appletTradeRefund(orderSerialpay.getOuttradeno(), orderSerialpay.getMoney(), alipayRefundNo, "退号退费"); + if (flag) { + order.setPayStatus(30 + order.getPayStatus()); + YcOrderRefundpay alipayRefundpay = new YcOrderRefundpay(); + alipayRefundpay.setPaytype("ALIPAY"); + alipayRefundpay.setOrderid(orderSerialpay.getOrderid()); + alipayRefundpay.setRefundstatus(1); + alipayRefundpay.setSerialpayid(orderSerialpay.getSerialpayid()); + alipayRefundpay.setOutrefundno(alipayRefundNo); + alipayRefundpay.setMoney(orderSerialpay.getPaymoney()); + alipayRefundpay.setRefundtime(now); + alipayRefundpay.setCreatetime(now); + orderRefundpayService.insertYcOrderRefundpay(alipayRefundpay); + } else { + return BaseResultJSON.error("支付宝退费失败"); + } + } + //账户退费 + else { + logger.info("=============账户余额退费==================="); + String accountRefundNo = "R" + orderSerialpay.getOuttradeno(); + YcOrderRefundpay accountRefundpay = new YcOrderRefundpay(); + accountRefundpay.setPaytype("ACCOUNT"); + accountRefundpay.setOrderid(orderSerialpay.getOrderid()); + accountRefundpay.setRefundstatus(1); + accountRefundpay.setSerialpayid(orderSerialpay.getSerialpayid()); + accountRefundpay.setOutrefundno(accountRefundNo); + accountRefundpay.setMoney(orderSerialpay.getPaymoney()); + accountRefundpay.setRefundtime(now); + accountRefundpay.setCreatetime(now); + orderRefundpayService.insertYcOrderRefundpay(accountRefundpay); + } + ycOrderService.updateYcOrder(order); + return BaseResultJSON.success(); + } + ycOrderService.updateYcOrder(order); + return BaseResultJSON.success(); + + } + + /** + * 当日挂号锁号 + * + * @param orderRegist + * @return + */ + public Map lockCurRegOrder(YcOrderRegist orderRegist) { + Map resultMap = new HashMap<>(); + + YcPatient patient = ycPatientService.selectYcPatientById(orderRegist.getPatientid()); + orderRegist.setPatient(patient); + YcOrder order = new YcOrder(); + order.setOrderno(IdUtil.getSnowflake().nextIdStr()); + order.setOrdertype("CURREGIST"); + order.setOrderStatus(1); + order.setPatientid(orderRegist.getPatientid()); + order.setOpenid(orderRegist.getOpenid()); + orderRegist.setOrdertype(order.getOrdertype()); + orderRegist.setOrderno(order.getOrderno()); + orderRegist.setOrderstatus("1"); + orderRegist.setTotalmoney(orderRegist.getFee() + orderRegist.getTreatfee()); + order.setTotalmoney(orderRegist.getTotalmoney()); + order.setCreatetime(new Date()); + HisResult result = hisCallService.lockRegSeqToday(orderRegist); + if (result.isSucess()) { + String hisOrderId = (String) result.getRetData().get("hisOrderId"); + order.setHisOrderId(hisOrderId); + ycOrderService.insertYcOrder(order); + orderRegist.setOrderid(order.getOrderid()); + orderRegist.setCreatetime(new Date()); + orderRegist.setUpdatetime(new Date()); + ycOrderRegistService.insertYcOrderRegist(orderRegist); + + resultMap.put("success", true); + } else { + order.setOrderStatus(2); + order.setReason("HIS锁号失败"); + ycOrderService.insertYcOrder(order); + + resultMap.put("success", false); + resultMap.put("message", result.getReturnMsg()); + } + resultMap.put("result", orderRegist); + return resultMap; + } + + /** + * 取消当日挂号锁号 + * + * @param orderRegist + * @return + */ + public JSONObject cancelLockCurRegOrder(YcOrderRegist orderRegist) { + YcOrder order = ycOrderService.selectYcOrderById(orderRegist.getOrderid()); + orderRegist.setYcOrder(order); + if (order.getOrderStatus() != null && order.getOrderStatus() == 1) { + orderRegist.setYcOrder(order); + HisResult result = hisCallService.unlockRegSeqToday(orderRegist); + if (result.isSucess()) { + order.setOrderStatus(2);// 取消挂号锁号 + order.setReason(orderRegist.getRemark()); + ycOrderService.updateYcOrder(order); + + orderRegist.setOrderstatus("2"); + orderRegist.setUpdatetime(new Date()); + ycOrderRegistService.updateYcOrderRegist(orderRegist); + + return BaseResultJSON.success(orderRegist); + } else { + return BaseResultJSON.error("取消失败"); + } + } else { + return BaseResultJSON.error("订单状态不符合取消条件"); + } + } + + /** + * 确认当日挂号 + * + * @param orderRegist + * @return + */ + public boolean confirmCurRegOrder(YcOrderRegist orderRegist) { + HisResult result = hisCallService.addRegOrder(orderRegist); + + YcOrder ycOrder = orderRegist.getYcOrder(); + if (result.isSucess()) { + orderRegist.setOrderstatus("5");// TODO 订单状态修改 + String hisOrderId = (String) result.getRetData().get("hisOrderId"); + String receiptId = (String) result.getRetData().get("receiptId"); + orderRegist.setHisOrderid(hisOrderId); + orderRegist.setUpdatetime(new Date()); + + ycOrder.setHisOrderId(hisOrderId); + ycOrder.setReceiptId(receiptId); + ycOrder.setOrderStatus(5); + + ycOrderRegistService.updateYcOrderRegist(orderRegist); + ycOrderService.updateYcOrder(ycOrder); + return true; + } else { + ycOrder.setOrderStatus(2); + ycOrder.setReason(result.getReturnMsg()); + orderRegist.setOrderstatus("2"); + orderRegist.setUpdatetime(new Date()); + ycOrderRegistService.updateYcOrderRegist(orderRegist); + ycOrderService.updateYcOrder(ycOrder); + return false; + } + } + + /** + * 查询挂号信息 + * + * @param params + * @return + */ + public List> getRegOrderInfo(Map params) { + //hisCallService = ApplicationContextUtil.getBean(params.get("hisid") + "HisCallService"); + return hisCallService.getRegOrderInfo(params); + } + + public List> getRegOrderList(Map params) { + return hisCallService.getRegOrderInfo(params); + } + + /** + * 查询科室 + * + * @param deptId + * @return + */ + public List> getDeptInfo(String deptId) { + return hisCallService.getDeptInfo(deptId); + } + + /** + * 查询科室 + * + * @param deptId + * @return + */ + public List> getDoctorInfo(String deptId, String doctorId) { + return hisCallService.getDoctorInfo(deptId, doctorId); + } + + /** + * 查询科室 + * + * @param hisCode + * @return + */ + public Map getNucl(String hisCode) { + return hisCallService.getNucl(hisCode); + } + + /** + * 创建核酸挂号订单 + * + * @param patientId + * @param hisCode + * @return + */ + public JSONObject createNuclOrder(Long patientId, String hisCode, String openid) { + YcPatient patient = ycPatientService.selectYcPatientById(patientId); + if (patient == null) { + return BaseResultJSON.error("患者信息不存在,请先解绑后重新绑定!"); + } + + YcOrderRegist orderRegist = new YcOrderRegist(); + YcOrder order = new YcOrder(); + order.setOrderno(IdUtil.getSnowflake().nextIdStr()); + order.setOrdertype("NUCL"); + order.setOrderStatus(1); + order.setPatientid(patientId); + if ("".equals(openid)) { + order.setOpenid(patient.getOpenid()); + } else { + order.setOpenid(openid); + } + orderRegist.setPatientid(patientId); + orderRegist.setOrdertype(order.getOrdertype()); + orderRegist.setOrderno(order.getOrderno()); + orderRegist.setOrderstatus("1"); + orderRegist.setDeptname("新冠病毒核酸检测"); + Map result = hisCallService.getNucl(hisCode); + if (result != null) { + int price = new Double(Double.valueOf((String) result.get("price")) * 100).intValue(); + orderRegist.setTotalmoney(price); + orderRegist.setHisOrderid(hisCode); + order.setTotalmoney(price); + order.setHisOrderId(hisCode); + order.setCreatetime(new Date()); + ycOrderService.insertYcOrder(order); + orderRegist.setOrderid(order.getOrderid()); + orderRegist.setCreatetime(new Date()); + orderRegist.setUpdatetime(new Date()); + ycOrderRegistService.insertYcOrderRegist(orderRegist); + + Map map = new HashMap<>(); + map.put("orderno", orderRegist.getOrderno()); + map.put("patId", orderRegist.getPatientid()); + return BaseResultJSON.success(map); + } else { + return BaseResultJSON.error("订单创建失败!"); + } + } + + /** + * 预约挂号退款 + * + * @param orderid + * @return + */ + public BaseResultJSON refundPreRegOrder(Long orderid) { + String outRequestNo = IdUtil.getSnowflake().nextIdStr(); + YcOrderSerialpay serialpay = new YcOrderSerialpay(); + serialpay.setDelFlag(1); + serialpay.setOrderid(orderid); + serialpay = orderSerialpayService.selectYcOrderSerialpay(serialpay); + YcOrderRefundpay refundpay = new YcOrderRefundpay(); + refundpay.setPaytype(serialpay.getPaytype()); + refundpay.setOrderid(serialpay.getOrderid()); + refundpay.setRefundstatus(1); + refundpay.setSerialpayid(serialpay.getSerialpayid()); + refundpay.setOutrefundno(outRequestNo); + refundpay.setMoney(serialpay.getPaymoney()); + int refundMoney = serialpay.getPaymoney(); + + try { + refundpay.setRefundtime(new Date()); + refundpay.setCreatetime(new Date()); + orderRefundpayService.insertYcOrderRefundpay(refundpay); + + boolean result = false; + String payType = serialpay.getPaytype(); + if ("ALIPAY".equals(payType)) { + result = alipayAppletService.appletTradeRefund(serialpay.getOuttradeno(), serialpay.getTotalmoney(), outRequestNo, "取消预约挂号"); + } else if ("ACCOUNT".equals(payType)) { + result = true; + } + if (result) { + return BaseResultJSON.success("取消退款成功!"); + } else { + return BaseResultJSON.error("取消退款失败!"); + } + } catch (Exception e) { + e.printStackTrace(); + return BaseResultJSON.error("未知错误"); + } + } + + /** + * [6202] 支付下单 + * + * @param params + * @return + */ + public JSONObject payOrder(JSONObject params) { + MkAppletRequest appletRequest = new MkAppletRequest(params); + appletRequest.setMkRequestMethod("[6202] 支付下单"); + MkInsurancePay insurancePay = new MkInsurancePay(); + insurancePay.setPayordid(params.getString("payOrdId")); + insurancePay.setMdtrtid(params.getString("mdtrtId")); + insurancePay.setPaytoken(params.getString("payToken")); + MkInsurancePay inpay = insurancePayService.selectMkInsurancePayInfo(insurancePay); + try { + JSONObject resData = healthInsuranceService.payOrder(params, appletRequest); + if (!"0".equals(resData.getString("code"))) { + appletRequest.setMkAppletResponseData(resData.getString("message")); + } else { + //TODO 下单成功,更新mk_insurance_pay + if (inpay != null) { + JSONObject conData = resData.getJSONObject("data"); + inpay.setOrdstas(conData.getString("ordStas")); + inpay.setFeesumamt(conData.getFloat("feeSumamt")); + inpay.setFundpay(conData.getFloat("fundPay")); + inpay.setOwnpayamt(conData.getFloat("ownPayAmt")); + inpay.setPsnacctpay(conData.getFloat("psnAcctPay")); + inpay.setOthFeeAmt(conData.getFloat("othFeeAmt")); + insurancePayService.updateMkInsurancePayAsyc(inpay); + } + } + return resData; + } catch (Exception e) { + String errMsg = "[6202] 支付下单 发生异常"; + appletRequest.setMkAppletResponseData(errMsg); + e.printStackTrace(); +// throw new BaseException(errMsg); + JSONObject json = new JSONObject(); + json.put("error", e.getMessage()); + return json; + } finally { + appletRequestService.insertMkAppletRequest(appletRequest); + + } + } + +} diff --git a/health_framework/src/main/java/cn/card/health/framework/service/ThreadOrderService.java b/health_framework/src/main/java/cn/card/health/framework/service/ThreadOrderService.java new file mode 100644 index 0000000..d53423e --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/framework/service/ThreadOrderService.java @@ -0,0 +1,246 @@ +package cn.card.health.framework.service; + +import cn.card.health.bean.hospital.YcPatient; +import cn.card.health.bean.order.YcOrder; +import cn.card.health.bean.order.YcOrderInhosp; +import cn.card.health.bean.order.YcOrderRegist; +import cn.card.health.bean.order.YcOrderSerialpay; +import cn.card.health.common.utils.DateUtils; +import cn.card.health.framework.service.alipay.AlipayAppletService; +import cn.card.health.framework.service.bank.BankService; +import cn.card.health.his.service.HisResult; +import cn.card.health.his.service.hdzxy.HisCallService; +import cn.card.health.service.order.IYcOrderInhospService; +import cn.card.health.service.order.IYcOrderRegistService; +import cn.card.health.service.order.IYcOrderSerialpayService; +import cn.card.health.service.order.IYcOrderService; +import cn.card.health.service.user.IYcPatientService; +import com.alibaba.fastjson.JSONObject; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Service; + +import java.math.BigDecimal; + +@Service +public class ThreadOrderService { + Logger logger = LoggerFactory.getLogger(ThreadOrderService.class); + + @Autowired + private AlipayAppletService alipayAppletService; + @Autowired + private IYcOrderSerialpayService orderSerialpayService; + @Autowired + HisCallService hisCallService; + @Autowired + IYcOrderInhospService orderInhospService; + @Autowired + IYcOrderService orderService; + @Autowired + IYcOrderRegistService orderRegistService; + @Autowired + IYcPatientService patientService; + @Autowired + BankService bankService; + + @Async + public void checkAliPay(YcOrderInhosp orderInhosp, YcOrderSerialpay orderSerialPay) { + logger.info("====支付查询== orderid: " + orderInhosp.getOrderid()); + for (int i = 0; i < 120; i++) { + JSONObject result = alipayAppletService.appletTradeQuery(orderSerialPay.getOuttradeno()); + logger.info("===========支付结果====================="); + logger.info(result.toJSONString()); + if ("TRADE_SUCCESS".equals(result.getString("tradeStatus"))) { + orderSerialPay.setPaystatus(3); + orderSerialPay.setPaytime(DateUtils.getNowDate()); + orderSerialPay.setTransactionid(result.getString("tradeno")); + BigDecimal money = new BigDecimal(result.getFloat("totalAmount")); + money = money.multiply(new BigDecimal(100)); + orderSerialPay.setMoney(money.intValue()); + orderSerialpayService.updateYcOrderSerialpay(orderSerialPay); + confirmCardOrderPay(orderInhosp); + break; + } else { + try { + Thread.sleep(5000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + } + + + @Async + void checkAliPay(YcOrderRegist orderRegist, YcOrderSerialpay orderSerialPay) { + logger.info("====支付查询== orderid: " + orderRegist.getOrderid()); + for (int i = 0; i < 120; i++) { + logger.info("===========支付结果==开始==================="); + JSONObject result = alipayAppletService.appletTradeQuery(orderSerialPay.getOuttradeno()); + logger.info(result.toJSONString()); + logger.info("===========支付结果===结束=================="); + if ("TRADE_SUCCESS".equals(result.getString("tradeStatus"))) { + orderSerialPay.setPaystatus(3); + orderSerialPay.setPaytime(DateUtils.getNowDate()); + orderSerialPay.setTransactionid(result.getString("tradeno")); + BigDecimal money = new BigDecimal(result.getFloat("totalAmount")); + money = money.multiply(new BigDecimal(100)); + orderSerialPay.setMoney(money.intValue()); + orderSerialpayService.updateYcOrderSerialpay(orderSerialPay); + confirmPreRegOrderPay(orderRegist); + break; + } else { + try { + Thread.sleep(5000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + } + + @Async + void checkBankPay(YcOrderRegist orderRegist, YcOrderSerialpay orderSerialPay) { + logger.info("====支付查询== orderid: " + orderRegist.getOrderid()); + + for (int i = 0; i < 120; i++) { + logger.info("===========支付结果==开始==================="); + JSONObject result = bankService.queryPay(orderSerialPay.getOuttradeno()); + logger.info(result.toJSONString()); + logger.info("===========支付结果===结束=================="); + if ("0".equals(result.getString("pay_status"))) { + orderSerialPay.setPaystatus(3); + orderSerialPay.setPaytime(DateUtils.getNowDate()); + orderSerialPay.setPrepayid(result.getString("order_id")); +// orderSerialPay.setTransactionid(result.getString("tradeno")); + orderSerialPay.setMoney(orderSerialPay.getTotalmoney()); + orderSerialpayService.updateYcOrderSerialpay(orderSerialPay); +// confirmPreRegOrderPay(orderRegist); + break; + } else if ("-1".equals(result.getString("pay_status"))) { + orderSerialPay.setPaystatus(2); + orderSerialPay.setPaytime(DateUtils.getNowDate()); + orderSerialpayService.updateYcOrderSerialpay(orderSerialPay); + break; + } else { + try { + Thread.sleep(5000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + } + + public void confirmCardOrderPay(YcOrderInhosp orderInhosp) { + + YcOrder order = new YcOrder(); + order.setOrderid(orderInhosp.getOrderid()); + JSONObject hParmas = new JSONObject(); + hParmas.put("memberId", orderInhosp.getOrderno()); + hParmas.put("cashPay", (float) orderInhosp.getTotalmoney() / 100 + ""); + HisResult hisResult = hisCallService.cardCharge(hParmas); + order.setPayStatus(3); + if (hisResult.isSucess()) { + order.setOrderStatus(5); + order.setHisStatus(3); + String hisOrderid = hisResult.getRetData().get("orderid") + ""; + orderInhosp.setHisOrderid(hisOrderid); + order.setHisOrderId(hisOrderid); + orderInhospService.updateYcOrderInhosp(orderInhosp); + } else { + order.setOrderStatus(-5); + order.setHisStatus(2); + } + orderService.updateYcOrder(order); + } + + public void confirmCardOrderPay(YcOrder order) { + + Integer hisStatus = order.getHisStatus(); + //已经处理过his请求,不再处理 + if(hisStatus!=1){ + return; + } + YcOrderInhosp orderInhosp1 = new YcOrderInhosp(); + orderInhosp1.setOrderid(order.getOrderid()); + + YcOrderInhosp orderInhosp = orderInhospService.selectYcOrderInhosp(orderInhosp1); + order.setOrderid(orderInhosp.getOrderid()); + JSONObject hParmas = new JSONObject(); + hParmas.put("memberId", orderInhosp.getOrderno()); + hParmas.put("cashPay", (float) orderInhosp.getTotalmoney() / 100 + ""); + HisResult hisResult = hisCallService.cardCharge(hParmas); + order.setPayStatus(3); + if (hisResult.isSucess()) { + order.setOrderStatus(5); + order.setHisStatus(3); + String hisOrderid = hisResult.getRetData().get("orderid") + ""; + orderInhosp.setHisOrderid(hisOrderid); + order.setHisOrderId(hisOrderid); + orderInhospService.updateYcOrderInhosp(orderInhosp); + } else { + order.setOrderStatus(-5); + order.setHisStatus(2); + } + orderService.updateYcOrder(order); + } + + + /** + * 确认预约挂号 + * + * @param orderRegist + * @return + */ + public void confirmPreRegOrderPay(YcOrderRegist orderRegist) { + + YcOrder order = orderRegist.getYcOrder(); + YcPatient patient = patientService.selectYcPatientById(orderRegist.getPatientid()); + + Integer orderStatus = order.getOrderStatus(); +// if (orderStatus == 5) { + JSONObject hParms = new JSONObject(); + hParms.put("reglevel_id", ""); + hParms.put("idcard", patient.getCardno()); + hParms.put("departId", orderRegist.getDeptno()); + hParms.put("doctorId", orderRegist.getDoctorno()); + hParms.put("clinicroom", ""); + hParms.put("userid", ""); + hParms.put("taskdate", orderRegist.getRegdate()); + hParms.put("memberId", orderRegist.getHisPatientid()); + hParms.put("amount", ""); + hParms.put("memberPay", "0"); + hParms.put("accountPay", "0"); + hParms.put("insurancePay", "0"); + hParms.put("cashPay", (float) order.getTotalmoney() / 100 + ""); + hParms.put("ybpay", "N"); + + HisResult hisResult = hisCallService.payPreRegOrder(hParms); + order.setPayStatus(3); + if (hisResult.isSucess()) { + // TODO 订单状态修改 + orderRegist.setOrderstatus("5"); + String hisOrderid = hisResult.getRetData().get("regid") + ""; + orderRegist.setHisOrderid(hisOrderid); + order.setHisOrderPayId(hisOrderid); + order.setHisOrderId(hisOrderid); + order.setOrderStatus(5); + orderRegistService.updateYcOrderRegist(orderRegist); + orderService.updateYcOrder(order); + // 余额支付记录 + } else { + orderRegist.setOrderstatus("2"); + orderRegist.setUpdatetime(DateUtils.getNowDate()); + orderRegistService.updateYcOrderRegist(orderRegist); + YcOrder ycOrder = new YcOrder(); + ycOrder.setOrderid(order.getOrderid()); + ycOrder.setOrderStatus(2); + ycOrder.setPayStatus(order.getPayStatus()); + ycOrder.setReason(hisResult.getReturnMsg()); + orderService.updateYcOrder(ycOrder); + } + } +} diff --git a/health_framework/src/main/java/cn/card/health/framework/service/alipay/AlipayAppletService.java b/health_framework/src/main/java/cn/card/health/framework/service/alipay/AlipayAppletService.java new file mode 100644 index 0000000..23f9140 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/framework/service/alipay/AlipayAppletService.java @@ -0,0 +1,779 @@ +package cn.card.health.framework.service.alipay; + +import cn.card.health.alipay.config.AlipayAppletConfig; +import cn.card.health.common.exception.base.BaseException; +import cn.card.health.common.utils.BaseResultJSON; +import cn.card.health.common.utils.HttpStatus; +import cn.card.health.framework.service.alipay.domain.AlipayOAuthTokenDto; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.alipay.api.AlipayApiException; +import com.alipay.api.AlipayClient; +import com.alipay.api.DefaultAlipayClient; +import com.alipay.api.domain.MedicalNationalPayAuthInfo; +import com.alipay.api.domain.MedicalOnlineCreateAndPayInfo; +import com.alipay.api.internal.util.AlipaySignature; +import com.alipay.api.request.*; +import com.alipay.api.response.*; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +import java.io.UnsupportedEncodingException; +import java.math.BigDecimal; +import java.util.Map; + +/** + * 支付宝小程序接口 + * x` + * + * @author xinggm + * @date 2022年9月20日 + */ +@Service +public class AlipayAppletService { + private static Logger logger = LoggerFactory.getLogger(AlipayAppletService.class); + + /** + * 换取授权访问令牌接口 + */ + public AlipayOAuthTokenDto getOauthToken(String authCode, String refreshToken) { + AlipayOAuthTokenDto dto = new AlipayOAuthTokenDto(); + AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", AlipayAppletConfig.appid, AlipayAppletConfig.app_private_key, "json", "GBK", AlipayAppletConfig.alipay_public_key, "RSA2"); + AlipaySystemOauthTokenRequest request = new AlipaySystemOauthTokenRequest(); + //如果有刷新令牌用 刷新令牌 + if (StringUtils.isNotBlank(refreshToken)) { + request.setGrantType("refresh_token"); + } else if (StringUtils.isNotBlank(authCode)) { + request.setGrantType("authorization_code"); + } else { + request.setGrantType("authorization_code"); + } + + request.setCode(authCode); + AlipaySystemOauthTokenResponse response; + try { + response = alipayClient.execute(request); + if (response.isSuccess()) { + dto.setSuccess(true); + dto.setAccessToken(response.getAccessToken()); + dto.setRefreshToken(response.getRefreshToken()); + dto.setUserid(response.getUserId()); + } else { + dto.setCode(response.getSubCode()); + dto.setMsg(response.getSubMsg()); + } + return dto; + } catch (AlipayApiException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + throw new RuntimeException("支付宝授权失败"); + } + } + + /** + * info.share(支付宝会员授权信息查询接口) 实名信息接口 + * + * @param accessToken 支付宝授权令牌 + */ + public JSONObject getInfoShare(String accessToken) { + JSONObject retJSON = new JSONObject(); + retJSON.put("retcode", -1); + AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", AlipayAppletConfig.appid, AlipayAppletConfig.app_private_key, "json", "UTF-8", AlipayAppletConfig.alipay_public_key, "RSA2"); + AlipayUserInfoShareRequest request = new AlipayUserInfoShareRequest(); + try { + AlipayUserInfoShareResponse response = alipayClient.execute(request, accessToken); + + +// String certType = "0"; //0:身份证1:护照2:军官证3:士兵证4:回乡证5:临时身份证6:户口簿7:警官证8:台胞证9:营业执照10:其它证件11:港澳居民来往内地通行证12:台湾居民来往大陆通行证 +// String certNo = "121242200010016728"; +// String userName = "章三"; +// String mobile = "13566661111"; + if (!response.isSuccess()) { + retJSON.put("retmsg", response.getMsg()); + } + if (!"10000".equals(response.getCode())) { + retJSON.put("retmsg", response.getSubMsg()); + } + JSONObject data = new JSONObject(); + retJSON.put("retcode", 1); + data.put("avatar", response.getAvatar()); + data.put("nick_name", response.getNickName()); + data.put("province", response.getProvince()); + data.put("certNo", response.getCertNo()); + data.put("userName", response.getUserName()); + retJSON.put("data", data); + + } catch (Exception e) { + e.printStackTrace(); + // TODO: handle exception + } + return retJSON; + } + + /** + * 挂号成功消息发送 + * + * @param userid 支付宝用户userid + * @param deptName 科室名称 + * @param doctorName 医生姓名 + * @param patientName 患者姓名 + * @param address 科室地址 + * @param regDate 就诊日期 + * @param orderId 订单标识 + */ + public void registerMsgSuccessSend(String userid, String deptName, String doctorName, String patientName, String address, String regDate, String orderId) { + try { + AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", AlipayAppletConfig.appid, AlipayAppletConfig.app_private_key, "json", "GBK", AlipayAppletConfig.alipay_public_key, "RSA2"); + AlipayOpenAppMiniTemplatemessageSendRequest request = new AlipayOpenAppMiniTemplatemessageSendRequest(); + JSONObject bizContent = new JSONObject(); + bizContent.put("to_user_id", userid); + bizContent.put("user_template_id", "eb044297d5cd4227bf49a8b44ba009e3"); + bizContent.put("page", "page/registOrder?orderid=" + orderId); + JSONObject data = new JSONObject(); + JSONObject keyValue = new JSONObject(); + keyValue.put("value", regDate); + data.put("keyworkd1", keyValue); + keyValue = new JSONObject(); + keyValue.put("value", deptName); + data.put("keyworkd2", keyValue); + keyValue = new JSONObject(); + keyValue.put("value", doctorName); + data.put("keyworkd3", keyValue); + keyValue = new JSONObject(); + keyValue.put("value", patientName); + data.put("keyworkd4", keyValue); + keyValue = new JSONObject(); + keyValue.put("value", address); + data.put("keyworkd5", keyValue); + + bizContent.put("data", data); + request.setBizContent(bizContent.toString()); + AlipayOpenAppMiniTemplatemessageSendResponse response = alipayClient.execute(request); + if (response.isSuccess()) { + logger.info("挂号成功,支付宝消息发送成功,订单号:{}", orderId); + } else { + logger.info("挂号成功,支付宝消息发送失败,参数:{}", keyValue); + } + } catch (AlipayApiException e) { + e.printStackTrace(); + } + + } + + + /** + * 门诊缴费成功消息发送 + * + * @param userid + * @param deptName + * @param doctorName + * @param patientName + * @param totalAmount + * @param clinicDate + * @param orderId + */ + public void clinicMsgSuccessSend(String userid, String deptName, String doctorName, String patientName, Integer totalAmount, String clinicDate, String orderId) { + try { + AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", AlipayAppletConfig.appid, AlipayAppletConfig.app_private_key, "json", "GBK", AlipayAppletConfig.alipay_public_key, "RSA2"); + AlipayOpenAppMiniTemplatemessageSendRequest request = new AlipayOpenAppMiniTemplatemessageSendRequest(); + JSONObject bizContent = new JSONObject(); + bizContent.put("to_user_id", userid); + bizContent.put("user_template_id", "d897c845c3da431e9bb6653594f7e87d"); + bizContent.put("page", "page/registOrder?orderid=" + orderId); + JSONObject data = new JSONObject(); + JSONObject keyValue = new JSONObject(); + keyValue.put("value", clinicDate); + data.put("keyworkd1", keyValue); + keyValue = new JSONObject(); + keyValue.put("value", deptName); + data.put("keyworkd2", keyValue); + keyValue = new JSONObject(); + keyValue.put("value", doctorName); + data.put("keyworkd3", keyValue); + keyValue = new JSONObject(); + keyValue.put("value", patientName); + data.put("keyworkd4", keyValue); + keyValue = new JSONObject(); + keyValue.put("value", (float) totalAmount / 100 + "元"); + data.put("keyworkd5", keyValue); + + bizContent.put("data", data); + request.setBizContent(bizContent.toString()); + AlipayOpenAppMiniTemplatemessageSendResponse response = alipayClient.execute(request); + if (response.isSuccess()) { + logger.info("门诊缴费成功,支付宝消息发送成功,订单号:{}", orderId); + } else { + logger.info("门诊缴费成功,支付宝消息发送失败,参数:{}", keyValue); + } + } catch (AlipayApiException e) { + e.printStackTrace(); + } + } + + /** + * + */ + public String medicalAuthInfoAuthQuery(String userid, String accessToken, String reqBizNo) { + AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", AlipayAppletConfig.appid, AlipayAppletConfig.app_private_key, "json", "GBK", AlipayAppletConfig.alipay_public_key, "RSA2"); + + AlipayCommerceMedicalAuthinfoAuthQueryRequest request = new AlipayCommerceMedicalAuthinfoAuthQueryRequest(); + request.setNotifyUrl(AlipayAppletConfig.notify_insure_url); + JSONObject bizContent = new JSONObject(); + //支付宝用户ID + bizContent.put("alipay_user_id", userid); + //业务请求唯一流水号(须保证唯一性) + bizContent.put("req_biz_no", reqBizNo); + //定点医药机构在移动支付中心申请的应用Id + bizContent.put("org_app_id", AlipayAppletConfig.org_app_id); + //医保电子凭证机构编码,默认NATHSA + bizContent.put("ins_code", "NATHSA"); + //定点医药机构编码 + bizContent.put("org_code", AlipayAppletConfig.org_no); + //机构渠道认证编码 + bizContent.put("org_chnl_crtf_code", AlipayAppletConfig.org_chnl_crtf_code); + //线上业务类型编码 + bizContent.put("ol_biz_type_code", "04107"); + //授权回跳地址 + bizContent.put("call_url", "alipays://platformapi/startapp?appld=2021003162675444&page=pages/registrationconfirm/registrationconfirm&query=key%3D1"); + //扩展参数,非必填 + JSONObject extendParams = new JSONObject(); + //合作伙伴返佣pid +// extendParams.put("sys_service_provider_id", AlipayAppletConfig.sys_service_provider_id); +// bizContent.put("extend_params", extendParams); + request.setBizContent(JSONObject.toJSONString(bizContent)); +// System.out.println("入参 == " + JSONObject.toJSONString(request)); + AlipayCommerceMedicalAuthinfoAuthQueryResponse response = new AlipayCommerceMedicalAuthinfoAuthQueryResponse(); + try { + //accessToken为用户授权token + response = alipayClient.execute(request, accessToken); + logger.info("返回:{}", response.getBody()); + if (!response.isSuccess()) { + logger.info("错误返回:{}", response.getSubMsg()); + throw new BaseException(HttpStatus.FORBIDDEN + "", response.getErrorMessage()); + } + MedicalNationalPayAuthInfo data = response.getData(); + String payAuthNo = data.getPayAuthNo(); + String medicalCardId = data.getMedicalCardId(); + if (StringUtils.isNotBlank(payAuthNo)) { + logger.info("===payAuthNo: {}", payAuthNo); + return payAuthNo + "," + medicalCardId; + } else { + return data.getAuthUrl(); + } + } catch (Exception e) { + e.printStackTrace(); + return ""; + } + } + + + /** + * alipay.commerce.medical.card.auth.query(查询用户的医保电子凭证或电子社保卡基础信息) + */ + public JSONObject medicalCardAuthQuery(String accessToken) { + AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", AlipayAppletConfig.appid, AlipayAppletConfig.app_private_key, "json", "UTF-8", AlipayAppletConfig.alipay_public_key, "RSA2"); + AlipayCommerceMedicalCardAuthQueryRequest request = new AlipayCommerceMedicalCardAuthQueryRequest(); + JSONObject bizContent = new JSONObject(); + //机构编码 + bizContent.put("ins_code", "NATHSA"); + //持卡人与当前用户的关系 + bizContent.put("relation_type", "00"); + request.setBizContent(bizContent.toJSONString()); + logger.info("入参 == " + JSONObject.toJSONString(request)); + JSONObject retJSON = new JSONObject(); + retJSON.put("retcode", -1); + try { + AlipayCommerceMedicalCardAuthQueryResponse response = alipayClient.execute(request, accessToken); + logger.info("======返回:" + response.getBody()); + if (!response.isSuccess()) { + logger.info("错误返回:" + response.getSubMsg()); + retJSON.put("retmsg", response.getSubMsg()); + return retJSON; + } + if (!"SUCCESS".equals(response.getResultCode())) { + retJSON.put("retmsg", response.getSubMsg()); + return retJSON; + } + String body = response.getBody(); + JSONObject alipayResponse = JSONObject.parseObject(body); + JSONObject alipay_commerce_medical_card_auth_query_response = alipayResponse.getJSONObject("alipay_commerce_medical_card_auth_query_response"); + JSONArray dataArray = alipay_commerce_medical_card_auth_query_response.getJSONArray("data"); + for (int i = 0; i < dataArray.size(); i++) { + JSONObject data = dataArray.getJSONObject(i); + if (!"BINDED".equals(data.getString("status")) || !"INSURED".equals(data.getString("insured_status"))) { + continue; + } + JSONArray cityArray = data.getJSONArray("insured_cities"); + for (int j = 0; j < cityArray.size(); j++) { + JSONObject city = cityArray.getJSONObject(j); + if ("Y".equals(city.getString("is_default_city"))) { + retJSON.put("data", city); + retJSON.put("retcode", 1); + break; + } + } + } + return retJSON; + } catch (Exception e) { + e.printStackTrace(); + retJSON.put("retmsg", e.getMessage()); + return retJSON; + } + } + + /** + * 5.2.2.4 国家医保局线上业务下单支付接口(alipay.commerce.medical.payment.createandpay) + * + * @param outTradeNo 商户订单号 + * @param tradeNo 支付宝订单号 + * // * @param orderid 支付URL使用 + * @param totalAmount 订单总金额(分) + * @param govAmount 医保基金支付金额(分) + * @param accountAmount 个人账户支付金额(分) + * @param realAmount 现金支付金额(分) + * @param userid 用户标志 + * @param medicalCardId 医保电子凭证授权码 + * @param gmtOutCreate 医疗机构下单时间 + * @param medOrgOrd 医院订单号 + * @param payOrderId 移动支付中心订单号 + * @param payAuthNo 移动支付中心返回授权编码 + */ + public JSONObject medicalPaymentCreateAndPay(String outTradeNo, String tradeNo, float totalAmount, float govAmount, float accountAmount, float realAmount, String userid, String medicalCardId, String gmtOutCreate, String medOrgOrd, String payOrderId, String payAuthNo) { + AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", AlipayAppletConfig.appid, AlipayAppletConfig.app_private_key, "json", "UTF-8", AlipayAppletConfig.alipay_public_key, "RSA2"); + AlipayCommerceMedicalPaymentCreateandpayRequest request = new AlipayCommerceMedicalPaymentCreateandpayRequest(); + request.setNotifyUrl(AlipayAppletConfig.notify_insure_url); + logger.info("===== notify_insure_url: " + request.getNotifyUrl()); + JSONObject bizContent = new JSONObject(); + bizContent.put("alipay_user_id", userid); + bizContent.put("out_trade_no", outTradeNo); + bizContent.put("med_org_ord", medOrgOrd); + //订单总金额 + bizContent.put("total_amount", totalAmount); + //医保基金支付金额 + bizContent.put("gov_amount", govAmount); + //个人账户支付金额 + bizContent.put("account_amount", accountAmount); + //现金支付金额 + bizContent.put("real_amount", realAmount); + //支付授权码(用户授权给定点医药机构线上业务时取得) + bizContent.put("pay_auth_no", payAuthNo); + //商户名称 + bizContent.put("merchant_name", AlipayAppletConfig.org_name); + //支付订单号(处方上传的出参订单号) + bizContent.put("pay_order_id", payOrderId); + //医保结算地国标城市编码 + bizContent.put("payment_city_code", "130402"); + if (StringUtils.isNotBlank(tradeNo)) { + bizContent.put("trade_no", tradeNo);//支付宝侧交易单号 + } + bizContent.put("org_no", AlipayAppletConfig.org_no); +// bizContent.put("org_no", AlipayAppletConfig.org_app_id); + bizContent.put("ol_biz_type_code ", "04107"); +// bizContent.put("org_code", AlipayAppletConfig.org_no); + bizContent.put("gmt_out_create", gmtOutCreate); + bizContent.put("call_url", "alipays://platformapi/startapp?appId=2021003162675444&page=pages/chssuccess/chssuccess"); +// bizContent.put("call_url", "alipays://platformapi/startapp?appId=2021003162675444&page=pages/chsconfirm/chsconfirm&query=key%3D2"); + JSONObject extendParams = new JSONObject(); +// extendParams.put("sys_service_provider_id", AlipayAppletConfig.sys_service_provider_id); +// extendParams.put("IS_INSURANCE_PAY", isUnsurancePay); //是否使用医保支付 +// extendParams.put("insurance_subsidy_mode", "involve"); //医保补充计算方式:involve - 包含 except - 去除(有补充金额时必填 + //医保电子凭证机构号 获取线上医保业务授权接口返回medicalCardInstId参数。 + extendParams.put("medical_ins_card_id", "NATHSA"); + //医保电子凭证授权码 获取线上医保业务授权接口返回medicalCardId参数。 + extendParams.put("medical_card_id", medicalCardId); + //医保电子凭证授权码 获取线上医保业务授权接口返回medicalCardId参数。 + extendParams.put("chinfo", "GUOBIAO_JIANLIAN"); + //医保参数透传体,没有需传空对象串 + JSONObject medicalRequesCotennt = new JSONObject(); + //医保扩展参数 + JSONObject medicalRequesExt = new JSONObject(); + //医保结算场景医保结算场景:OUTPATIENT - 门诊;INPATIENT - 住院;APPOINTMENT- 挂号;DRUGSTORE- 药店 + medicalRequesExt.put("feeType", "01"); + //医保结算地城市编码(国标) 330100 + medicalRequesExt.put("settleType", "01"); + extendParams.put("request_content", JSONObject.toJSONString(medicalRequesCotennt)); + bizContent.put("extend_params", extendParams); + request.setBizContent(JSONObject.toJSONString(bizContent)); + logger.info("入参 request== " + JSONObject.toJSONString(request)); + logger.info("入参 bizContent== " + bizContent.toJSONString()); + + JSONObject resultJSON = new JSONObject(); + resultJSON.put("request", JSONObject.toJSONString(request)); + try { + AlipayCommerceMedicalPaymentCreateandpayResponse response = alipayClient.execute(request); + logger.info("返回:" + response.getBody()); + resultJSON.put("data", response.getBody()); + resultJSON.put("result", response.isSuccess()); + if (response.isSuccess()) { + MedicalOnlineCreateAndPayInfo resData = response.getData(); + resultJSON.put("result", 1); + String resStatus = resData.getStatus(); + if ("SUCCESS_FINISHED".equals(resStatus)) { + resultJSON.put("msg", "医保结算已成功"); + } else if ("WAIT_PAY".equals(resStatus)) { + resultJSON.put("pay_url", resData.getPayUrl()); + } else { + resultJSON.put("msg", "医保结算异常|" + resData.getStatus()); + } + } else { + resultJSON.put("result", 0); + resultJSON.put("msg", response.getMsg()); + } + return resultJSON; +// logger.info("urlDecode: " + URLDecoder.decode(response.getBody(), "UTF-8")); + } catch (AlipayApiException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + resultJSON.put("result", 0); + resultJSON.put("msg", e.getMessage()); + return resultJSON; + } + } + + /** + * 小程序自费支付 + * + * @param subject 商品名称 + * @param outTradeNo 商户订单号 + * @param totalAmount 支付金额(分) + * @param userid 小程序用户userid + */ + public JSONObject appletTradePay(String subject, String outTradeNo, Integer totalAmount, String userid) { + //支付金额,由分转为元 也可直接用元 + float amount = (float) totalAmount / 100; +// String notifyUrl = "https://www.wadyyy.com/alipayCallBack"; + AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", AlipayAppletConfig.appid, AlipayAppletConfig.app_private_key, "json", "UTF-8", AlipayAppletConfig.alipay_public_key, "RSA2"); + AlipayTradeCreateRequest request = new AlipayTradeCreateRequest(); + request.setNotifyUrl(AlipayAppletConfig.notify_url); + logger.info("===== notify_url: " + request.getNotifyUrl()); + JSONObject bizContent = new JSONObject(); + bizContent.put("out_trade_no", outTradeNo); + bizContent.put("total_amount", amount); + bizContent.put("subject", subject); + bizContent.put("buyer_id", userid); + bizContent.put("timeout_express", "10m"); + + // 扩展信息,按需传入 + JSONObject extendParams = new JSONObject(); + extendParams.put("sys_service_provider_id", AlipayAppletConfig.sys_service_provider_id); + bizContent.put("extend_params", extendParams); + + request.setBizContent(bizContent.toString()); + + JSONObject respResult = new JSONObject(); + try { + AlipayTradeCreateResponse response = alipayClient.execute(request); + if (response.isSuccess()) { + logger.info("调用成功"); + //第三方交易流水号 + String tradeNo = response.getTradeNo(); + response.getOutTradeNo(); + respResult.put("out_trade_no", response.getOutTradeNo()); + respResult.put("trade_no", response.getTradeNo()); + respResult.put("success", true); + return respResult; + } else { + logger.info("调用失败"); + respResult.put("success", false); + respResult.put("msg", response.getSubMsg()); + return respResult; + } + + } catch (AlipayApiException e) { + e.printStackTrace(); + respResult.put("success", false); + respResult.put("msg", e.getMessage()); + return respResult; + } + + } +// +// /** +// * 小程序支付 +// * +// * @param subject 商品名称 +// * @param outTradeNo 商户订单号 +// * @param totalAmount 支付金额(分) +// * @param userid 小程序用户userid +// */ +// public String appletTradePay(String subject, String outTradeNo, Integer totalAmount, String userid) { +// //支付金额,由分转为元 也可直接用元 +// double amount = new BigDecimal(totalAmount / 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); +// AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", AlipayAppletConfig.appid, AlipayAppletConfig.app_private_key, "json", "UTF-8", AlipayAppletConfig.alipay_public_key, "RSA2"); +// AlipayTradeCreateRequest request = new AlipayTradeCreateRequest(); +// request.setNotifyUrl(AlipayAppletConfig.notifyUrl); +// JSONObject bizContent = new JSONObject(); +// bizContent.put("out_trade_no", "amp01" + outTradeNo); +// bizContent.put("total_amount", amount); +// bizContent.put("subject", subject); +// bizContent.put("buyer_id", userid); +// bizContent.put("timeout_express", "10m"); +// +// request.setBizContent(bizContent.toString()); +// try { +// AlipayTradeCreateResponse response = alipayClient.execute(request); +// if (response.isSuccess()) { +// //第三方交易流水号 +// String tradeNo = response.getTradeNo(); +// return tradeNo; +// } +// } catch (AlipayApiException e) { +// e.printStackTrace(); +// throw new BaseException(e.getMessage()); +// } +// +// return ""; +// } + + /** + * 查询订单信息 通过商户订单号查询订单 + */ + public JSONObject appletTradeQuery(String outTradeNo) { + AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", AlipayAppletConfig.appid, AlipayAppletConfig.app_private_key, "json", "GBK", AlipayAppletConfig.alipay_public_key, "RSA2"); + AlipayTradeQueryRequest request = new AlipayTradeQueryRequest(); + JSONObject result = new JSONObject(); + JSONObject bizContent = new JSONObject(); + bizContent.put("out_trade_no", outTradeNo); + request.setBizContent(bizContent.toString()); + try { + AlipayTradeQueryResponse response = alipayClient.execute(request); + if (response.isSuccess()) { + //支付状态 + String tradeStatus = response.getTradeStatus(); + //支付金额 + String totalAmount = response.getTotalAmount(); + result.put("tradeStatus", tradeStatus); + result.put("totalAmount", totalAmount); + result.put("tradeno", response.getTradeNo()); + logger.info("调用成功"); + } else { + logger.info("调用失败"); + result.put("tradeStatus", "fail"); + } + } catch (AlipayApiException e) { + e.printStackTrace(); + result.put("tradeStatus", "fail"); + } + return result; + } + + + /** + * 小程序退款——自费 + * + * @param outTradeNo 商户订单号 + * @param refundAmount 退款金额(分) + * @param outRequestNo 标识一次退款请求 + */ + public boolean appletTradeRefund(String outTradeNo, Integer refundAmount, String outRequestNo, String reason) { + AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", AlipayAppletConfig.appid, AlipayAppletConfig.app_private_key, "json", "GBK", AlipayAppletConfig.alipay_public_key, "RSA2"); + AlipayTradeRefundRequest request = new AlipayTradeRefundRequest(); + float refundMoney = new BigDecimal(refundAmount.floatValue() / 100).setScale(2, BigDecimal.ROUND_HALF_UP).floatValue(); + JSONObject bizContent = new JSONObject(); + //商户订单号 + bizContent.put("out_trade_no", outTradeNo); + //退款金额 + bizContent.put("refund_amount", refundMoney); +// bizContent.put("refund_fee", refundMoney); + //退款原因 + bizContent.put("refund_reason", reason); + //退款请求号 + bizContent.put("out_request_no", outRequestNo); + JSONObject extendParams = new JSONObject(); + extendParams.put("", ""); + request.setBizContent(bizContent.toString()); + try { + AlipayTradeRefundResponse response = alipayClient.execute(request); +// logger.info("ALIPAY退款返回:{}", JSONUtils.toJSONString(response)); + if (response.isSuccess()) { +// System.out.println(JSONObject.toJSONString(response)); + //退款状态 + String refundStatus = response.getFundChange(); + + logger.info("======退费结果:{}", refundStatus); + //Y 退款成功; N 退款失败 + // REFUND_PROCESSING 退款处理中;REFUND_SUCCESS 退款处理成功;REFUND_FAIL 退款失败 + return true; + } + } catch (AlipayApiException e) { + e.printStackTrace(); + } + return false; + } + + + /** + * 小程序退款——医保 + * + * @param outTradeNo 商户订单号 + * @param refundAmount 退款金额(分) + * @param outRequestNo 标识一次退款请求 + * @param refundAsset 1自费部分;2医保部分 + * @param cancelBillno + * @param cancelSerialno + */ + public static void appletTradeRefund(String outTradeNo, Integer refundAmount, String outRequestNo, String refundAsset, String cancelBillno, String cancelSerialno) { + AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", AlipayAppletConfig.appid, AlipayAppletConfig.app_private_key, "json", "GBK", AlipayAppletConfig.alipay_public_key, "RSA2"); + AlipayTradeRefundApplyRequest request = new AlipayTradeRefundApplyRequest(); + float refundMoney = (float) refundAmount / 100; + JSONObject bizContent = new JSONObject(); + //商户订单号 + bizContent.put("out_trade_no", outTradeNo); + //退款金额 + bizContent.put("refund_amount", refundMoney); + //退款原因 + bizContent.put("refund_reason", "正常退款"); + //退款请求号 + bizContent.put("out_request_no", outRequestNo); + JSONObject extendParams = new JSONObject(); + //1自费部分,2医保部分 + if ("1".equals(refundAsset)) { + // INNER_ASSET 表示只退自费部分, + extendParams.put("DESIGNATED_REFUND_ASSET", "INNER_ASSET"); + } else if ("2".equals(refundAsset)) { + // OUTSIDE_ASSET 只退医保部分 + extendParams.put("DESIGNATED_REFUND_ASSET", "OUTSIDE_ASSET"); + extendParams.put("cancel_bill_no", cancelBillno); + extendParams.put("cancel_serial_no", cancelSerialno); + } + bizContent.put("extend_params", extendParams); + request.setBizContent(bizContent.toString()); + try { + AlipayTradeRefundApplyResponse response = alipayClient.execute(request); + if (response.isSuccess()) { + //退款状态 + String refundStatus = response.getRefundStatus(); + // REFUND_PROCESSING 退款处理中;REFUND_SUCCESS 退款处理成功;REFUND_FAIL 退款失败 + System.out.println("调用成功"); + } else { + System.out.println("调用失败"); + } + } catch (AlipayApiException e) { + e.printStackTrace(); + } + } + + /** + * 小程序退款订单查询 + * + * @param outTradeNo 商户订单号 + * @param outRequestNo 退款标识号 + */ + public static void appletTradeRefundQuery(String outTradeNo, String outRequestNo) { + AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", AlipayAppletConfig.appid, AlipayAppletConfig.app_private_key, "json", "GBK", AlipayAppletConfig.alipay_public_key, "RSA2"); + AlipayTradeFastpayRefundQueryRequest request = new AlipayTradeFastpayRefundQueryRequest(); + JSONObject bizContent = new JSONObject(); + bizContent.put("trade_no", "2021081722001419121412730660"); + bizContent.put("out_request_no", "HZ01RF001"); + request.setBizContent(bizContent.toString()); + try { + AlipayTradeFastpayRefundQueryResponse response = alipayClient.execute(request); + if (response.isSuccess()) { + response.getRefundStatus(); // REFUND_PROCESSING 退款处理中;REFUND_SUCCESS 退款处理成功;REFUND_FAIL 退款失败 + System.out.println("调用成功"); + } else { + System.out.println("调用失败"); + } + } catch (AlipayApiException e) { + e.printStackTrace(); + } + } + + /** + * 支付宝回调验签 + * + * @param params + * @return + */ + public JSONObject toDecodeParent(Map params) { + JSONObject result = new JSONObject(); + try { + logger.info("==========开始验签============="); + boolean signVerified = AlipaySignature.rsaCheckV1(params, AlipayAppletConfig.alipay_public_key, "UTF-8", "RSA2"); + // String , String> param = StringUtils.getStrMap(decode); + logger.info("==========验签结果 {}=============", signVerified); +// TODO 未验签,后期加入验签 + if (signVerified) { + if ("TRADE_SUCCESS".equals(params.get("trade_status"))) { +// vo.setPayStatus(3); + result.put("trade_status", params.get("trade_status")); + } else { + result.put("trade_status", params.get("trade_status")); +// vo.setPayStatus(2); + } + } + result.put("signFlag", signVerified); +// vo.setTransactionid(params.get("trade_no")); + result.put("trade_no", params.get("trade_no")); + // 支付宝金额为元,要转成分 + Float amount = Float.parseFloat(params.get("total_amount")); + amount = amount * 100; +// vo.setPaymoney(amount.intValue()); + result.put("trade_amount", amount.intValue()); +// vo.setOuttradeno(params.get("out_trade_no")); + result.put("out_trade_no", params.get("out_trade_no")); + return result; + } catch (AlipayApiException e) { + logger.info("==========验签发生异常 {}", e.getMessage()); + e.printStackTrace(); + return null; + } + } + + /** + * 签名验证 + * @param params + * @return + */ + public boolean checkSignature(Map params){ + try { + logger.info("==========开始验签============="); + boolean signVerified = AlipaySignature.rsaCheckV1(params, AlipayAppletConfig.alipay_public_key, "UTF-8", "RSA2"); + logger.info("==========验签结果 {}=============", signVerified); + return signVerified; + } catch (AlipayApiException e) { + logger.info("==========验签发生异常 {}", e.getMessage()); + e.printStackTrace(); + return false; + } + } + + public static void main(String[] args) throws AlipayApiException { + + String authcode = "f19cb257bac84e6ba34def6d12d9CX47"; + //邢广茂 + String userid = "2088802265084476"; + //王凯 +// userid = "2088002528715772"; + //江明创 + userid = "2088432163618893"; + //李海群 + userid = "2088802564529320"; + //邢广茂 + String accessToken = "composeBd372e97bacab41aca3c932ba1bcd0X47"; +// accessToken = "composeBbe03a56e9b6c488495f9a2f9156afA77"; + accessToken = "composeB53ec07f4202348f298a8fbfa0a0c2E89"; +// accessToken = "composeBd372e97bacab41aca3c932ba1bcd0X47"; + + AlipayAppletService service = new AlipayAppletService(); +// service.getOauthToken(authcode, ""); +// service.getOauthToken(authcode, accessToken); +// System.out.println(service.getOauthToken(authcode, "")); +// 查询个人信息 +// System.out.println(service.getInfoShare(accessToken)); +// service.medicalAuthInfoAuthQuery(userid, accessToken, System.currentTimeMillis() + ""); +// JSONObject inadmin = service.medicalCardAuthQuery(accessToken); + System.out.println("================================================================"); +// System.out.println(inadmin); + String outtradeno = "da2024070212472725638"; +// String outtradeno = "2024062408220867603"; +// String outtradeno = "2024062408242203126"; +// service.appletTradeQuery(outtradeno); + String outRefundNo = "re" + outtradeno; + service.appletTradeRefund(outtradeno, 1, outRefundNo, "退费测试"); +// System.out.println("=============1/100===================="+1.00/100); + } + +} diff --git a/health_framework/src/main/java/cn/card/health/framework/service/alipay/HealthInsuranceService.java b/health_framework/src/main/java/cn/card/health/framework/service/alipay/HealthInsuranceService.java new file mode 100644 index 0000000..7303fc6 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/framework/service/alipay/HealthInsuranceService.java @@ -0,0 +1,281 @@ +package cn.card.health.framework.service.alipay; + +import com.alibaba.fastjson.JSONObject; + +import cn.card.health.common.utils.DateUtils; +import cn.card.health.common.utils.HttpUtils; + +/** + * 医保接口 + * @author xinggm + * @date 2022年9月20日 + */ + +public class HealthInsuranceService { + + static JSONObject pubParam = new JSONObject(); + + static { + pubParam.put("appId", "1GCQ6V2PR0223F60C80A00009DE5697"); //渠道id + pubParam.put("version", "2.0.1"); //版本号 + pubParam.put("timestamp", ""); //当前时间 + pubParam.put("encType", "SM4"); //加密方式 + pubParam.put("encData", ""); //加密数据 + pubParam.put("signType", "SM2"); //签名方式 + pubParam.put("signData", ""); //签名串 + } + + /** + * [6201] 费用明细上传 + */ + public void uldFeeInfo() { + String url = "https://test.pub.ylbzj.yhwch.com:8089/pmc/org/local/api/hos/uldFeeInfo"; + pubParam.put("timestamp", DateUtils.dateTimeNow()); //当前时间 yyyyMMddHHmmss + pubParam.put("encData", ""); //加密数据 + pubParam.put("signData", ""); //签名串 + + JSONObject dataParam = new JSONObject(); + dataParam.put("orgCodg", ""); //机构编码 + dataParam.put("orgId", ""); //电子凭证机构号 + dataParam.put("psnNo", ""); //人员编码 + dataParam.put("insutype", ""); //险种类型 + dataParam.put("medOrgOrd", ""); //医疗机构订单号 + dataParam.put("initRxOrd", ""); //要续费的原处方流水 + dataParam.put("rxCircFlag", ""); //电子处方流转标志 + dataParam.put("begntime", ""); //开始时间 + dataParam.put("idNo", ""); //证件号码 + dataParam.put("userName", ""); //用户姓名 + dataParam.put("idType", ""); //证件类型 + dataParam.put("ecToken", ""); //电子凭证授权enToken + dataParam.put("insuCode", ""); //参保地 + dataParam.put("iptOtpNo", ""); //住院/门诊号 + dataParam.put("atddrNo", ""); //医师编码 + dataParam.put("drName", ""); //医师姓名 + dataParam.put("deptCode", ""); //科室编码 + dataParam.put("deptName", ""); //科室名称 + dataParam.put("caty", ""); // 科别 + dataParam.put("mdtrtId", ""); //就诊ID + dataParam.put("medType", ""); //医疗类别 + dataParam.put("feeType", ""); //费用类型 + dataParam.put("medfeeSumamt", ""); //医疗费总额 + dataParam.put("acctUsedFlag", ""); //个人账户使用标志 + dataParam.put("mainCondDscr", ""); //主要病情描述 + dataParam.put("diseCodg", ""); //病种编码 + dataParam.put("diseName", ""); //病种名称 + dataParam.put("psnSetlway", ""); //个人结算方式 + dataParam.put("chrgBchno", ""); //收费批次号 + dataParam.put("pubHospRfomFlag", ""); //公立医院改革标志 + dataParam.put("invono", ""); //发票号 + dataParam.put("endtime", ""); //出院时间 + dataParam.put("fulamtOwnpayAmt", ""); //全自费金额 + dataParam.put("overlmtSelfpay", ""); //超限价金额 + dataParam.put("preselfpayAmt", ""); //先行自付金额 + dataParam.put("inscpScpAmt", ""); //符合政策范围金额 + dataParam.put("oprnOprtCode", ""); //手术操作代码 + dataParam.put("oprnOprtName", ""); //手术操作名称 + dataParam.put("fpscNo", ""); //计划生育服务证号 + dataParam.put("latechbFlag", ""); //晚生标志 + dataParam.put("gesoVal", ""); //孕周数 + dataParam.put("fetts", ""); //胎次 + dataParam.put("fetusCnt", ""); //胎儿数 + dataParam.put("pretFlag", ""); //早产标志 + dataParam.put("birctrlType", ""); //计划生育手术类别 + dataParam.put("birctrlMatnDate", ""); //计划生育手术或生育日期 + dataParam.put("copFlag", ""); //伴有并发症标志 + dataParam.put("dscgDeptCodg", ""); //出院科室编码 + dataParam.put("dscgDeptName", ""); //出院科室名称 + dataParam.put("dscgDed", ""); //出院床位 + dataParam.put("dscgWay", ""); //离院方式 + dataParam.put("dieDate", ""); //死亡日期 + dataParam.put("matnType", ""); //生育类别 + dataParam.put("expConten", ""); //扩展参数 + dataParam.put("diseinfoList", ""); //诊断或症状明细 + dataParam.put("feedetailList", ""); //费用明细 + dataParam.put("admDiagDscr", ""); //入院诊断描述 + dataParam.put("admDeptCodg", ""); //入院科室编码 + dataParam.put("admDeptName", ""); //入院科室名称 + dataParam.put("admBed", ""); //入院床位 + dataParam.put("payAuthNo", ""); //支付授权码 + dataParam.put("uldLatInt", ""); //经纬度 + dataParam.put("mdtrtCertType", ""); //就诊凭证类型 + JSONObject diseinfoList = new JSONObject(); + diseinfoList.put("diagType", ""); //诊断类别 + diseinfoList.put("diagSrtNo", ""); //诊断排序号 + diseinfoList.put("diagCode", ""); //诊断代码 + diseinfoList.put("diagName", ""); //诊断名称 + diseinfoList.put("diagDept", ""); //诊断科室 + diseinfoList.put("diseDorNo", ""); //诊断医生编码 + diseinfoList.put("diseDorName", ""); //诊断医生姓名 + diseinfoList.put("diagTime", ""); //诊断时间 + diseinfoList.put("valiFlag", ""); //有效标志 + JSONObject feedetailList = new JSONObject(); + feedetailList.put("feedetlSn", ""); //费用明细流水号 + feedetailList.put("mdtrtId", ""); //就诊ID + feedetailList.put("psnNo", ""); //人员编号 + feedetailList.put("chrgBchno", ""); //收费批次号 + feedetailList.put("diseCodg", ""); //病种编码 + feedetailList.put("rxno", ""); //处方号 + feedetailList.put("rxCircFlag", ""); //外购处方标志 + feedetailList.put("feeOcurTime", ""); //费用发生时间 + feedetailList.put("medListCodg", ""); //医疗目录编码 + feedetailList.put("medinsListCodg", ""); //医药机构目录编码 + feedetailList.put("detItemFeeSumamt", ""); //明细项目费用总额 + feedetailList.put("cnt", ""); //数量 + feedetailList.put("pric", ""); //单价 + feedetailList.put("sinDosDscr", ""); //单词剂量描述 + feedetailList.put("usedFrquDscr", ""); //使用频次描述 + feedetailList.put("prdDays", ""); //周期天数 + feedetailList.put("medcWayDscr", ""); //用药途经描述 + feedetailList.put("bilgDeptCodg", ""); //开单科室编码 + feedetailList.put("bilgDeptName", ""); //开单科室名称 + feedetailList.put("bilgDrCodg", ""); //开单医生编码 + feedetailList.put("bilgDrName", ""); //开单医生名称 + feedetailList.put("acordDeptCodg", ""); //受单科室编码 + feedetailList.put("acordDeptName", ""); //受单科室名称 + feedetailList.put("ordersDrCode", ""); //受单医生编码 + feedetailList.put("ordersDrName", ""); //受单医生名称 + feedetailList.put("hospApprFlag", ""); //医院审批标志 + feedetailList.put("tcmdrugUsedWay", ""); //中药使用方式 + feedetailList.put("etipFlag", ""); //外检标志 + feedetailList.put("etipHospCode", ""); //外检医生编码 + feedetailList.put("dscgTkdrugFlag", ""); //出院带药标志 + feedetailList.put("matnFeeFlag", ""); //生育费用标志 + feedetailList.put("initFeedetlSn", ""); //原费用流水号 + feedetailList.put("drorNo", ""); //医嘱号 + feedetailList.put("medType", ""); //医疗类别 + feedetailList.put("memo", ""); //备注 + feedetailList.put("expContent", ""); //扩展字段 + feedetailList.put("medListName", ""); //医疗目录名称 + feedetailList.put("medListSpc", ""); //医疗目录规格 + feedetailList.put("combNo", ""); //套组编号 +// HttpUtils.sendPost(url, param) + + } + + /** + * [6202] 支付下单 + */ + public void payOrder() { + String url = "https://test.pub.ylbzj.yhwch.com:8089/pmc/org/local/api/hos/pay_order"; + pubParam.put("timestamp", DateUtils.dateTimeNow()); //当前时间 yyyyMMddHHmmss + pubParam.put("encData", ""); //加密数据 + pubParam.put("signData", ""); //签名串 + + JSONObject dataParam = new JSONObject(); + dataParam.put("payAuthNo", ""); //支付授权码 + dataParam.put("payOrdId", ""); //待支付订单号 + dataParam.put("payToken", ""); //支付订单对应的token + dataParam.put("orgCodg", ""); //定点机构编码 + dataParam.put("orgBizSer", ""); //业务流水号 + dataParam.put("chrgBchno", ""); //收费批次号 + dataParam.put("deposit", ""); //住院押金 + dataParam.put("expContent", ""); //扩展数据 + } + + /** + * [6203] 医保退费 + */ + public void refundOrder() { + String url = "https://test.pub.ylbzj.yhwch.com:8089/pmc/org/local/api/hos/refund_Order"; + pubParam.put("timestamp", DateUtils.dateTimeNow()); //当前时间 yyyyMMddHHmmss + pubParam.put("encData", ""); //加密数据 + pubParam.put("signData", ""); //签名串 + + JSONObject dataParam = new JSONObject(); + dataParam.put("payOrdId", ""); //支付订单号 + dataParam.put("appRefdSn", ""); //应用退款流水号 + dataParam.put("appRefdTime", ""); //应用退款时间 + dataParam.put("totlRefdAmt", ""); //总退费金额 + dataParam.put("psnAcctRefdAmt", ""); //医保个人账户支付 + dataParam.put("fundRefdAmt", ""); //基金支付 + dataParam.put("cashRefdAmt", ""); //现金退费金额 + dataParam.put("ecToken", ""); //电子凭证授权Token + dataParam.put("refdType", ""); //退费类型 + dataParam.put("expContent", ""); //扩展数据 + dataParam.put("payAuthNo", ""); //支付授权码 + } + + + /** + * [6204] 医保订单信息同步 + */ + public void queryOrderInfo() { + String url = "https://test.pub.ylbzj.yhwch.com:8089/pmc/org/local/api/hos/query_order_info"; + pubParam.put("timestamp", DateUtils.dateTimeNow()); //当前时间 yyyyMMddHHmmss + pubParam.put("encData", ""); //加密数据 + pubParam.put("signData", ""); //签名串 + + JSONObject dataParam = new JSONObject(); + dataParam.put("payOrdId", ""); //支付订单号 + dataParam.put("medOrgOrd", ""); //医院订单号 + dataParam.put("feeSumamt", ""); //费用总金额 + dataParam.put("ownPayAmt", ""); //现金自付 + dataParam.put("psnAcctPay", ""); //个人账户支付 + dataParam.put("fundPay", ""); //医保基金支付 + dataParam.put("thdPayType", ""); //第三方支付类型 + dataParam.put("deposit", ""); //住院押金 + dataParam.put("extData", ""); //扩展数据 + } + + /** + * [6205]银行卡支付下单 + */ + public void medBankPay() { + String url = "https://test.pub.ylbzj.yhwch.com:8089/pmc/org/local/api/hos/medBankPay"; + pubParam.put("timestamp", DateUtils.dateTimeNow()); //当前时间 yyyyMMddHHmmss + pubParam.put("encData", ""); //加密数据 + pubParam.put("signData", ""); //签名串 + + JSONObject dataParam = new JSONObject(); + dataParam.put("payAuthNo", ""); //支付授权码 + dataParam.put("payOrdId", ""); //待支付订单号 + dataParam.put("payToken", ""); //支付订单对应的token + dataParam.put("orgCodg", ""); //订单机构编码 + dataParam.put("orgBizSer", ""); //业务流水号 + dataParam.put("expContent", ""); //扩展数据 + } + + /** + * [6401]费用明细上传撤销 + */ + public void revokeOrder() { + String url = "https://test.pub.ylbzj.yhwch.com:8089/pmc/org/local/api/hos/revoke_order"; + pubParam.put("timestamp", DateUtils.dateTimeNow()); //当前时间 yyyyMMddHHmmss + pubParam.put("encData", ""); //加密数据 + pubParam.put("signData", ""); //签名串 + + JSONObject dataParam = new JSONObject(); + dataParam.put("payOrderId", ""); //支付订单号 + dataParam.put("orgCodg", ""); //机构编号 + dataParam.put("payToken", ""); //支付token + dataParam.put("idNo", ""); //证件号码 + dataParam.put("userName", ""); //用户姓名 + dataParam.put("idType", ""); //证件类别 + dataParam.put("expContent", ""); //扩展数据 + } +// /** +// * [6204] 医保订单信息同步 +// */ +// public void queryOrderInfo() { +// String url = "https://test.pub.ylbzj.yhwch.com:8089/pmc/org/local/api/hos/query_order_info"; +// pubParam.put("timestamp", DateUtils.dateTimeNow()); //当前时间 yyyyMMddHHmmss +// pubParam.put("encData", ""); //加密数据 +// pubParam.put("signData", ""); //签名串 +// +// JSONObject dataParam = new JSONObject(); +// dataParam.put("", ""); // +// } +// /** +// * [6204] 医保订单信息同步 +// */ +// public void queryOrderInfo() { +// String url = "https://test.pub.ylbzj.yhwch.com:8089/pmc/org/local/api/hos/query_order_info"; +// pubParam.put("timestamp", DateUtils.dateTimeNow()); //当前时间 yyyyMMddHHmmss +// pubParam.put("encData", ""); //加密数据 +// pubParam.put("signData", ""); //签名串 +// +// JSONObject dataParam = new JSONObject(); +// dataParam.put("", ""); // +// } + +} diff --git a/health_framework/src/main/java/cn/card/health/framework/service/alipay/TokenService.java b/health_framework/src/main/java/cn/card/health/framework/service/alipay/TokenService.java new file mode 100644 index 0000000..1c6f714 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/framework/service/alipay/TokenService.java @@ -0,0 +1,192 @@ +package cn.card.health.framework.service.alipay; + +import cn.card.health.bean.user.LoginUser; +import cn.card.health.common.constant.Constants; +import cn.card.health.common.redis.RedisCache; +import cn.card.health.common.utils.StringUtils; +import cn.card.health.framework.service.alipay.utils.IdUtils; +import io.jsonwebtoken.Claims; +import io.jsonwebtoken.Jwts; +import io.jsonwebtoken.SignatureAlgorithm; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpServletRequest; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +/** + * token验证处理 + * + * @author yc + */ +@Component +public class TokenService { + // 令牌自定义标识 +// @Value("${token.header}") + private String header = "Authorization"; + + // 令牌秘钥 +// @Value("${token.secret}") + private String secret = "43979eaaa8ccc4e30c02d48b8277a9cf"; + + // 令牌有效期(默认30分钟) +// @Value("${token.expireTime}") + private int expireTime = 60 * 24 * 10; + + protected static final long MILLIS_SECOND = 1000; + + protected static final long MILLIS_MINUTE = 60 * MILLIS_SECOND; + + private static final Long MILLIS_MINUTE_TEN = 20 * 60 * 1000L; + + @Autowired + private RedisCache redisCache; + + /** + * 获取用户身份信息 + * + * @return 用户信息 + */ + public LoginUser getLoginUser(HttpServletRequest request) { + // 获取请求携带的令牌 + String token = getToken(request); + if (StringUtils.isNotEmpty(token)) { + Claims claims = parseToken(token); + // 解析对应的权限以及用户信息 + String uuid = (String) claims.get(Constants.LOGIN_USER_KEY); + String userKey = getTokenKey(uuid); + LoginUser user = redisCache.getCacheObject(userKey); + return user; + } + return null; + } + + /** + * 设置用户身份信息 + */ + public void setLoginUser(LoginUser loginUser) { + if (StringUtils.isNotNull(loginUser) && StringUtils.isNotEmpty(loginUser.getToken())) { + refreshToken(loginUser); + } + } + + /** + * 删除用户身份信息 + */ + public void delLoginUser(String token) { + if (StringUtils.isNotEmpty(token)) { + String userKey = getTokenKey(token); + redisCache.deleteObject(userKey); + } + } + + /** + * 创建令牌 + * + * @param loginUser 用户信息 + * @return 令牌 + */ + public String createToken(LoginUser loginUser) { + String token = IdUtils.fastUUID(); + loginUser.setToken(token); +// setUserAgent(loginUser); + refreshToken(loginUser); + Map claims = new HashMap<>(); + claims.put(Constants.LOGIN_USER_KEY, token); + return createToken(claims); + } + + /** + * 验证令牌有效期,相差不足20分钟,自动刷新缓存 + * + * @param loginUser + * @return 令牌 + */ + public void verifyToken(LoginUser loginUser) { + long expireTime = loginUser.getExpireTime(); + long currentTime = System.currentTimeMillis(); + if (expireTime - currentTime <= MILLIS_MINUTE_TEN) { + refreshToken(loginUser); + } + } + + /** + * 刷新令牌有效期 + * + * @param loginUser 登录信息 + */ + public void refreshToken(LoginUser loginUser) { + loginUser.setLoginTime(System.currentTimeMillis()); + loginUser.setExpireTime(loginUser.getLoginTime() + expireTime * MILLIS_MINUTE); + // 根据uuid将loginUser缓存 + String userKey = getTokenKey(loginUser.getToken()); + redisCache.setCacheObject(userKey, loginUser, expireTime, TimeUnit.MINUTES); + } +// +// /** +// * 设置用户代理信息 +// * +// * @param loginUser 登录信息 +// */ +// public void setUserAgent(LoginUser loginUser) +// { +// UserAgent userAgent = UserAgent.parseUserAgentString(ServletUtils.getRequest().getHeader("User-Agent")); +// String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); +// loginUser.setIpaddr(ip); +// loginUser.setLoginLocation(AddressUtils.getRealAddressByIP(ip)); +// loginUser.setBrowser(userAgent.getBrowser().getName()); +// loginUser.setOs(userAgent.getOperatingSystem().getName()); +// } + + /** + * 从数据声明生成令牌 + * + * @param claims 数据声明 + * @return 令牌 + */ + private String createToken(Map claims) { + String token = Jwts.builder().setClaims(claims).signWith(SignatureAlgorithm.HS512, secret).compact(); + return token; + } + + /** + * 从令牌中获取数据声明 + * + * @param token 令牌 + * @return 数据声明 + */ + private Claims parseToken(String token) { + return Jwts.parser().setSigningKey(secret).parseClaimsJws(token).getBody(); + } + + /** + * 从令牌中获取用户名 + * + * @param token 令牌 + * @return 用户名 + */ + public String getUsernameFromToken(String token) { + Claims claims = parseToken(token); + return claims.getSubject(); + } + + /** + * 获取请求token + * + * @param request + * @return token + */ + private String getToken(HttpServletRequest request) { + String token = request.getHeader(header); + if (StringUtils.isNotEmpty(token) && token.startsWith(Constants.TOKEN_PREFIX)) { + token = token.replace(Constants.TOKEN_PREFIX, ""); + } + return token; + } + + private String getTokenKey(String uuid) { + return Constants.LOGIN_TOKEN_KEY + uuid; + } +} diff --git a/health_framework/src/main/java/cn/card/health/framework/service/bank/BankConfig.java b/health_framework/src/main/java/cn/card/health/framework/service/bank/BankConfig.java new file mode 100644 index 0000000..1621fea --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/framework/service/bank/BankConfig.java @@ -0,0 +1,70 @@ +package cn.card.health.framework.service.bank; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +import javax.annotation.sql.DataSourceDefinition; + +@ConfigurationProperties(prefix = "alipay.bank") +@Component +public class BankConfig { + public String appid = "11000000000000020432"; +// public static String appid = "040590001167502"; + public String my_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCGgPgvjzrd/9hSUoWGAk2yLhbYnH7bSfcYwjn2MY9a8H3IHbNgZCKEo5+pQ6vXcIJ+LZnm51xK9y/nTaUCQWkNhbC107fMLyEyhZLYQdp94XDZnbpLx3sUQb48BBIK08JRZsI44BWznQ7Ssvg3QWBQF6LovNrrWbKvjh9KhKnZ2YFYJWmKJpRgiz7WUXCTbY0KRGuPwvW4BVyviKAkWlvdPzLseKf66RZWBUIUDNMzvSjBBBtft6x40u5OqohIB/dVhDeDFzA3Z8wxWncVyS4vXKEoHJXuC3LW84J5W5eOceNq4iYDXD6+7ujHQUXpCDbej9JKm7bPoOdNp752OD1jAgMBAAECggEAXeib37DT+/3OTiPZn+fp0VbGkrQpCfhJclrhVxfhLDAu0dKS0+D2DL+lEOvzhbbDFU/HXWT5lkmhg5A9fianL07BQyIv+HqLZhfGoADSiQMm5HlwgcokD8+a/5Ij+rVAvc7OGiGyZTZqDAfyr7mQgjsOfgqlmp6E2HeVN1UKtdNYcuJCO1rZmnlIPdXXzMk528LPnp34Us68ivxHjwSUOtLq4Ooka7BiNEWx22kyQdJTjPAx9Rg0KtpOr8IeWhmhV3MLRgtdjEp+0FSg4la7OX9PKuYnR8oO8skfj/xUOenZ1XvG8PZguLb16dTqF8ZnCAEzrknuO8/Njo1pu/E96QKBgQC/ZKPXlb91HTbeThmUKWHA/RSVS0PO4N+xAO3JP4O43+uuNJVBRxh5Ve+uyWEAqdM7lXHc07r7a2fSdfk1TCvunfWM9Je6nj/mLCEryGTST1beSNn0wKV2UhuQLJ/+bLh1RGuZRecRGeezyES4mRLv2siCrViqLs0RjtB28x0yvQKBgQCz6DNjXRSfMPZs9/e8WkkUH5niPlsduk+1MdkW5A3sPsjFDbTVggAJAPUnJlU0vPIup9DYRdPmDpXFgIDckyi2qeSH38ff8hQ0TxyKmgxT3LI7rzjFRm7fU4Z06LoTQMk8psO7nVHPVrEiLpZ7PMPpA8Qcz59kysbhiBuBiJVCnwKBgQC7q21UyYtwxPK2TRKby3AFEqQKOEEHLE1rfKOtQFBjCX5J1Vm9Jn+DCpb5ZpFtWxi7RjDd/edM/OZS4kc40bYKRm0uh+/3l5DEm+Tyz469AfsF/51odzZHrP9GAdvoWKcOpcZ0Bq0qgaJHEUsBT2fYNUmDiYJ1bWq7mrQizwSEaQKBgQCIH1H6hawbwx1BV+HPVvTiUALMJ2gjtxumOqBKbKWIMf0Q9Az2W1WRenMDe0KPE8Oev4UKjtMEx9ZUyKU3v/TXOPbcQ9rkvDLDXXR3/pUDQwJsnGi1A1TSj0012f0ooiVhScDhjOggnDSMa3map2CIRzw0nHe6+J7AeI5vVRuyewKBgAOPyOQA2RAY6csrrmoogdo21Kl2E1X7TswJLgmAfmPZj6yf7m3zbdyjsmOK/3nRfR5eoxEWskUYLntRsa62t8pRogD9b4wZqnwJzF/77xIV69we8z1Q44U6WhhtMqBboBnnx1jvvMpqH3Go+Syd1ZvASxc5lEMJKR3csRGxX5aE"; +// public static String my_private_key = "MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDH29fdblWKHFBObwWXVmdjmKHKq/ORulcCqRJ61D62pMPZmsNObcqW2W04sXiQXRcYQKi5wG9XAL9BmwFYo0gz9ddHybBPILyZwyaER8y5YO0Y52oSF/vfFfoxXtoZmz8SFUiqs/ofywYgno3Vt82zsJ1RQvYee3zuOsfgaQE5yTo2IMg+EQrx1sYP1NyAg8/hI6RJduhVWOSQyp3EaHS1kIn98PeDwWt2FTS8ke/vUAq3xmJvYtXsw0w9HpoetZrvZc7h6kvE3i97Mdifs4XkKTDD9nt+LkCpx0tXehsjw7yqs+Lx6e1mdX2lBfO9976SJr5vf2pWFtA1lNLg6CEjAgMBAAECggEBAKUN3py0vlgtQfVEoy104jXSm+uxTpqPdcRwtR5Toudb85MGyT1AVwt1zUoA5zzyZFxXKgEd99W2fD1GMjptvveKlJxo6P6wXpHuJSUh1uVSMv1aQLNos05t7A5R83UqTVA126l+sZcIKKtPxns2LN+1gHbYAkLyYR6t1Nx0W9rH6s0LPyGEthliqr4AMxBja922QHte6+zyoOqHohSSPVfz4VzLtBdbYkLHRyBhbJw1Pb81BVp2BgeYiD5TApqZjvs/eGsPLPh6aUiZBSofnPEGIbcBqUEwBwNcWVOnSWMUYln/zT0eAgm+kaVfYBm3cYPvJbvRn2OGCjrGHSVud6ECgYEA8DrqdmAfj4Vk4H+vw13+zl4uBt2me1dz63YoGAqIfDrVLrhcb7LuGRRJ5zZUCRXaHhLTGbLoBHH7s1J34nJ9+OFTrdg7KR1zQ4jy3uwxfOGyrn3MUT/BMI3XgZJUe84PxFTYUEPt0cmjQodJKOB7WXT6LAQYBJdZoRWY/27xANUCgYEA1Pp7ypuTCaaP4jE2Nx6XadQTiQSq8xM0Y20fERE+Y42zzSoCaTCBA6XNc11y3ykQshrwMpV9VQ6ke8Rclh7s80Dz5bG6rRb4VjP2JVVq4dMEZG7AAaEMIyUic43JGd2EkeTSg52HQ9FWw9kJLrecd5ntIH24lbg0e3YajTfT1hcCgYEAipwT6JVx4GfBWt+R1JIJkZ05xXBivMwq8HNOkwCQ280+cCSkATcmtoXEVoo8VrmrDqsh7rQRt27lIgS1c41ILjAlDiuzhvedKBx+ti1mKH45kQC4wTCeEZvl+rcp0/2Dj269GSL4t5E2iA5zIgjUYzthlcAO86c4af+CNfAXUrkCgYEAvJvOwRChWGyPA2s9bfbDdE8BtdfSZE1fmaVrW7v/mj5FOq23UNxJhKdymHXrYsGFLZU5njJQueCrvYeZzsA4avvcgk+w19R9vClsFIfejXpIa4DAvTCYBQ+/wMGRlDxeSK1x2GjK/z4GLo6n2R11jV1dZ+aubrigka13uhP0n6UCgYB4vtgtZX/8MclGdqLWMD7HBNOC4am9SR+rq+9fSgXkVjXANaIO1l8XCg04r9SRYGC5YzbUCOz00csmkmYuuaBODEjvM/RcfccelKfFH/C4Kw9dNWEkJWZ5tEjkn9NmoKgSJF7+ACrU1tp8NARj1o5IxBUToCWUsMsXvuMprcU48Q=="; + //测试 +// public static String apigw_public_key = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCwFgHD4kzEVPdOj03ctKM7KV+16bWZ5BMNgvEeuEQwfQYkRVwI9HFOGkwNTMn5hiJXHnlXYCX+zp5r6R52MY0O7BsTCLT7aHaxsANsvI9ABGx3OaTVlPB59M6GPbJh0uXvio0m1r/lTW3Z60RU6Q3oid/rNhP3CiNgg0W6O3AGqwIDAQAB"; + //正式 + public String apigw_public_key = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCMpjaWjngB4E3ATh+G1DVAmQnIpiPEFAEDqRfNGAVvvH35yDetqewKi0l7OEceTMN1C6NPym3zStvSoQayjYV+eIcZERkx31KhtFu9clZKgRTyPjdKMIth/wBtPKjL/5+PYalLdomM4ONthrPgnkN4x4R0+D4+EBpXo8gNiAFsNwIDAQAB"; + public String aes_key = "5LRxjy8EV2PDBYNWbMzrVw=="; + public String mer_id="040551010097"; + public String notify_url="040551010097"; + + public String getAppid() { + return appid; + } + + public void setAppid(String appid) { + this.appid = appid; + } + + public String getMy_private_key() { + return my_private_key; + } + + public void setMy_private_key(String my_private_key) { + this.my_private_key = my_private_key; + } + + public String getApigw_public_key() { + return apigw_public_key; + } + + public void setApigw_public_key(String apigw_public_key) { + this.apigw_public_key = apigw_public_key; + } + + public String getAes_key() { + return aes_key; + } + + public void setAes_key(String aes_key) { + this.aes_key = aes_key; + } + + public String getMer_id() { + return mer_id; + } + + public void setMer_id(String mer_id) { + this.mer_id = mer_id; + } + + public String getNotify_url() { + return notify_url; + } + + public void setNotify_url(String notify_url) { + this.notify_url = notify_url; + } +} diff --git a/health_framework/src/main/java/cn/card/health/framework/service/bank/BankService.java b/health_framework/src/main/java/cn/card/health/framework/service/bank/BankService.java new file mode 100644 index 0000000..226e081 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/framework/service/bank/BankService.java @@ -0,0 +1,256 @@ +package cn.card.health.framework.service.bank; + +import cn.card.health.bean.insurance.MkAppletRequest; +import cn.card.health.bean.order.MkHisParams; +import cn.card.health.common.utils.DateUtils; +import cn.card.health.service.insurance.IMkAppletRequestService; +import com.alibaba.fastjson.JSONObject; +import com.icbc.api.DefaultIcbcClient; +import com.icbc.api.IcbcApiException; +import com.icbc.api.IcbcConstants; +import com.icbc.api.request.CardbusinessAggregatepayB2cOnlineConsumepurchaseRequestV1; +import com.icbc.api.request.CardbusinessAggregatepayB2cOnlineMerrefundRequestV1; +import com.icbc.api.request.CardbusinessAggregatepayB2cOnlineOrderqryRequestV1; +import com.icbc.api.request.CardbusinessAggregatepayB2cOnlineRefundqryRequestV1; +import com.icbc.api.response.CardbusinessAggregatepayB2cOnlineConsumepurchaseResponseV1; +import com.icbc.api.response.CardbusinessAggregatepayB2cOnlineMerrefundResponseV1; +import com.icbc.api.response.CardbusinessAggregatepayB2cOnlineOrderqryResponseV1; +import com.icbc.api.response.CardbusinessAggregatepayB2cOnlineRefundqryResponseV1; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.net.InetAddress; + +@Service +public class BankService { + private Logger logger = LoggerFactory.getLogger(BankService.class); + + @Autowired + private BankConfig bankConfig; + @Autowired + private IMkAppletRequestService appletRequestService; + + public JSONObject toPay(String outtradeno, String subject, Integer amount, String userid) { + logger.info("=====================getMy_private_key==========================="); + logger.info(bankConfig.getMy_private_key()); + logger.info("=====================getApigw_public_key==========================="); + logger.info(bankConfig.getApigw_public_key()); + logger.info("=====================getAes_key==========================="); + logger.info(bankConfig.getAes_key()); + //签名类型为RSA时,需传入appid,私钥和网关公钥,签名类型使用定值IcbcConstants.SIGN_TYPE_RSA,其他参数使用缺省值 + DefaultIcbcClient client = new DefaultIcbcClient(bankConfig.getAppid(), IcbcConstants.SIGN_TYPE_RSA2, bankConfig.getMy_private_key().trim(), bankConfig.getApigw_public_key().trim()); + CardbusinessAggregatepayB2cOnlineConsumepurchaseRequestV1 request = new CardbusinessAggregatepayB2cOnlineConsumepurchaseRequestV1(); + //根据测试环境和生产环境替换相应ip和端口 + request.setServiceUrl("https://gw.open.icbc.com.cn/api/cardbusiness/aggregatepay/b2c/online/consumepurchase/V1"); + CardbusinessAggregatepayB2cOnlineConsumepurchaseRequestV1.CardbusinessAggregatepayB2cOnlineConsumepurchaseRequestV1Biz bizContent = new CardbusinessAggregatepayB2cOnlineConsumepurchaseRequestV1.CardbusinessAggregatepayB2cOnlineConsumepurchaseRequestV1Biz(); + request.setBizContent(bizContent); + //请对照接口文档用bizContent.setxxx()方法对业务上送数据进行赋值 + bizContent.setMer_id(bankConfig.getMer_id()); + bizContent.setOut_trade_no(outtradeno); + bizContent.setPay_mode("10"); + bizContent.setAccess_type("8"); + bizContent.setMer_prtcl_no("0405510100970201"); + bizContent.setOrig_date_time(DateUtils.dateTimeNow("yyyy-MM-dd'T'HH:mm:ss")); + bizContent.setDecive_info("013467007045764"); + bizContent.setBody(subject); + bizContent.setFee_type("001"); + try { + bizContent.setSpbill_create_ip(InetAddress.getLocalHost().getHostAddress()); + } catch (Exception e) { + bizContent.setSpbill_create_ip("127.0.0.1"); + } + bizContent.setTotal_fee(amount + ""); + bizContent.setMer_url(bankConfig.getNotify_url()); + logger.info("===notify_url={}===", bankConfig.getNotify_url()); + bizContent.setShop_appid("wx8888888888888888"); + bizContent.setIcbc_appid("10000000000000002889"); + bizContent.setOpen_id(""); + bizContent.setUnion_id(userid); + bizContent.setMer_acct("6212880200000038618"); + bizContent.setExpire_time("1200"); +// bizContent.setAttach("{ \"id\": \"SZTX001\", \"name\": \"腾大餐厅\", \"area_code\": \"440305\", \"address\": \"科技园中一路腾讯大厦\" }"); + bizContent.setNotify_type("HS"); + bizContent.setResult_type("0"); + bizContent.setPay_limit("no_credit"); + bizContent.setOrder_apd_inf(""); + bizContent.setDetail(""); + bizContent.setReturn_url(""); + bizContent.setQuit_url(""); + bizContent.setCust_name(""); + bizContent.setCust_cert_type(""); + bizContent.setCust_cert_no(""); + bizContent.setGoods_tag(""); + bizContent.setAcq_addn_data(""); + logger.info("==============bizContent=================="); + logger.info(JSONObject.toJSONString(bizContent)); + CardbusinessAggregatepayB2cOnlineConsumepurchaseResponseV1 response = null; + String result = "{}"; + try { + response = client.execute(request, "mp" + System.currentTimeMillis());//msgId消息通讯唯一编号,要求每次调用独立生成,APP级唯一 + result = JSONObject.toJSONString(response); + logger.info("sresponse:" + result); + MkAppletRequest appletRequest = new MkAppletRequest(); + appletRequest.setMkRequestMethod("工商银行-支付"); + appletRequest.setMkAppletRequestData(JSONObject.toJSONString(bizContent)); + appletRequest.setMkAppletResponseData(result); + appletRequestService.insertMkAppletRequest(appletRequest); + if (response.isSuccess()) { + // 6、业务成功处理,请根据接口文档用response.getxxx()获取同步返回的业务数据 + logger.info("sReturnCode:" + response.getReturnCode()); +// logger.info("sresponse:" + result); + } else { + // 失败 + logger.info("fReturnCode:" + response.getReturnCode()); +// logger.info("fresponse:" + result); + } + } catch (IcbcApiException e) { + e.printStackTrace(); + } finally { + return JSONObject.parseObject(result); + } + } + + public JSONObject queryPay(String outtradeno) { + //签名类型为RSA时,需传入appid,私钥和网关公钥,签名类型使用定值IcbcConstants.SIGN_TYPE_RSA,其他参数使用缺省值 + DefaultIcbcClient client = new DefaultIcbcClient(bankConfig.getAppid(), IcbcConstants.SIGN_TYPE_RSA2, bankConfig.getMy_private_key(), bankConfig.getApigw_public_key()); + CardbusinessAggregatepayB2cOnlineOrderqryRequestV1 request = new CardbusinessAggregatepayB2cOnlineOrderqryRequestV1(); + //根据测试环境和生产环境替换相应ip和端口 + request.setServiceUrl("https://gw.open.icbc.com.cn/api/cardbusiness/aggregatepay/b2c/online/orderqry/V1"); + CardbusinessAggregatepayB2cOnlineOrderqryRequestV1.CardbusinessAggregatepayB2cOnlineOrderqryRequestV1Biz bizContent = new CardbusinessAggregatepayB2cOnlineOrderqryRequestV1.CardbusinessAggregatepayB2cOnlineOrderqryRequestV1Biz(); + request.setBizContent(bizContent); + //请对照接口文档用bizContent.setxxx()方法对业务上送数据进行赋值 + bizContent.setMer_id(bankConfig.getMer_id()); + bizContent.setOut_trade_no(outtradeno); +// bizContent.setOrder_id("020001030558000611912230005002"); + bizContent.setDeal_flag("0"); + bizContent.setIcbc_appid("10000000000004095261"); + bizContent.setMer_prtcl_no("0405510100970201"); + CardbusinessAggregatepayB2cOnlineOrderqryResponseV1 response; + String result = "{}"; + try { + response = client.execute(request, "mq" + System.currentTimeMillis());//msgId消息通讯唯一编号,要求每次调用独立生成,APP级唯一 + result = JSONObject.toJSONString(response); + + MkAppletRequest appletRequest = new MkAppletRequest(); + appletRequest.setMkRequestMethod("工商银行-查询"); + appletRequest.setMkAppletRequestData(JSONObject.toJSONString(bizContent)); + appletRequest.setMkAppletResponseData(result); + appletRequestService.insertMkAppletRequest(appletRequest); + if (response.isSuccess()) { + // 6、业务成功处理,请根据接口文档用response.getxxx()获取同步返回的业务数据 + logger.info("ReturnCode:" + response.getReturnCode()); + logger.info("response:" + result); + } else { + // 失败 + logger.info("ReturnCode:" + response.getReturnCode()); + logger.info("response:" + result); + } + } catch (IcbcApiException e) { + e.printStackTrace(); + } finally { + return JSONObject.parseObject(result); + } + } + + public JSONObject toRefund(String outtradeno, String refundno, Integer refundamount) { + //签名类型为RSA2时,需传入appid,私钥和网关公钥,签名类型使用定值IcbcConstants.SIGN_TYPE_RSA2,其他参数使用缺省值 + DefaultIcbcClient client = new DefaultIcbcClient(bankConfig.getAppid(), IcbcConstants.SIGN_TYPE_RSA2, bankConfig.getMy_private_key(), bankConfig.getApigw_public_key()); + CardbusinessAggregatepayB2cOnlineMerrefundRequestV1 request = new CardbusinessAggregatepayB2cOnlineMerrefundRequestV1(); + //根据测试环境和生产环境替换相应ip和端口 + request.setServiceUrl("https://gw.open.icbc.com.cn/api/cardbusiness/aggregatepay/b2c/online/merrefund/V1"); + //请对照接口文档用bizContent.setxxx()方法对业务上送数据进行赋值 + CardbusinessAggregatepayB2cOnlineMerrefundRequestV1.CardbusinessAggregatepayB2cOnlineMerrefundRequestV1Biz bizContent = new CardbusinessAggregatepayB2cOnlineMerrefundRequestV1.CardbusinessAggregatepayB2cOnlineMerrefundRequestV1Biz(); + request.setBizContent(bizContent); +// bizContent.setOrder_id("020001021200000521909120010020");//消费工行订单号,工行订单号,商户订单号或行内订单号必须其中一个不为空 + bizContent.setMer_id(bankConfig.getMer_id());//商户编号-必输项 + bizContent.setOut_trade_no(outtradeno);//商户订单号,工行订单号,商户订单号或行内订单号必须其中一个不为空 + bizContent.setOuttrx_serial_no(refundno);//外部退货流水号-必输项 + bizContent.setRet_total_amt(refundamount + "");//退货总金额-必输项 + bizContent.setTrnsc_ccy("001");//交易币种-必输项 + bizContent.setOrder_apd_inf(""); + bizContent.setIcbc_appid("10000000000004095781"); + bizContent.setMer_acct(""); + bizContent.setMer_prtcl_no("0405510100970201"); + CardbusinessAggregatepayB2cOnlineMerrefundResponseV1 response; + String result = "{}"; + try { + response = client.execute(request,"mr" + System.currentTimeMillis());//msgId消息通讯唯一编号,要求每次调用独立生成,APP级唯一 + result = JSONObject.toJSONString(response); + + MkAppletRequest appletRequest = new MkAppletRequest(); + appletRequest.setMkRequestMethod("工商银行-退费"); + appletRequest.setMkAppletRequestData(JSONObject.toJSONString(bizContent)); + appletRequest.setMkAppletResponseData(result); + appletRequestService.insertMkAppletRequest(appletRequest); + if (response.isSuccess()) { + // 业务成功处理,请根据接口文档用response.getxxx()获取同步返回的业务数据 + logger.info("ReturnCode:" + response.getReturnCode()); + logger.info("response:" + result); + } else { + // 失败 + logger.info("ReturnCode:" + response.getReturnCode()); + logger.info("response:" + result); + } + } catch (IcbcApiException e) { + e.printStackTrace(); + } finally { + return JSONObject.parseObject(result); + } + } + + public JSONObject queryRefund(String outtradeno) { + // 签名类型为RSA时,需传入appid,私钥和网关公钥,签名类型使用定值IcbcConstants.SIGN_TYPE_RSA,其他参数使用缺省值 + DefaultIcbcClient client = new DefaultIcbcClient(bankConfig.getAppid(), IcbcConstants.SIGN_TYPE_RSA2, bankConfig.getMy_private_key(), + bankConfig.getApigw_public_key()); + CardbusinessAggregatepayB2cOnlineRefundqryRequestV1 request = new CardbusinessAggregatepayB2cOnlineRefundqryRequestV1(); + // 根据测试环境和生产环境替换相应ip和端口 + request.setServiceUrl("https://gw.open.icbc.com.cn/api/cardbusiness/aggregatepay/b2c/online/refundqry/V1"); + CardbusinessAggregatepayB2cOnlineRefundqryRequestV1.CardbusinessAggregatepayB2cOnlineRefundqryRequestV1Biz bizContent = new CardbusinessAggregatepayB2cOnlineRefundqryRequestV1.CardbusinessAggregatepayB2cOnlineRefundqryRequestV1Biz(); + request.setBizContent(bizContent); + // 请对照接口文档用bizContent.setxxx()方法对业务上送数据进行赋值 + bizContent.setMer_id(bankConfig.getMer_id()); + bizContent.setOut_trade_no(outtradeno); + bizContent.setOuttrx_serial_no("xxx"); +// bizContent.setOrder_id("xxx"); + bizContent.setMer_prtcl_no("0405510100970201");//协议编号,多协议退款时需要上送 + CardbusinessAggregatepayB2cOnlineRefundqryResponseV1 response; + String result = "{}"; + try { + response = client.execute(request, System.currentTimeMillis() + "");// msgId消息通讯唯一编号,要求每次调用独立生成,APP级唯一 + result = JSONObject.toJSONString(response); + + MkAppletRequest appletRequest = new MkAppletRequest(); + appletRequest.setMkRequestMethod("工商银行-支付"); + appletRequest.setMkAppletRequestData(JSONObject.toJSONString(bizContent)); + appletRequest.setMkAppletResponseData(result); + appletRequestService.insertMkAppletRequest(appletRequest); + if (response.getReturnCode() == 0) { + // 业务成功处理,请根据接口文档用response.getxxx()获取同步返回的业务数据 + logger.info("ReturnCode:" + response.getReturnCode()); + logger.info("response:" + JSONObject.toJSONString(response)); + } else { + // 失败 + logger.info("ReturnCode:" + response.getReturnCode()); + logger.info("response:" + JSONObject.toJSONString(response)); + } + } catch (IcbcApiException e) { + e.printStackTrace(); + + }finally { + return JSONObject.parseObject(result); + } + } + + public static void main(String[] args) { + BankService bankService = new BankService(); + String outtradeno = "rb202407031921378961"; +// String userid = "2088802265084476"; + String userid = "2088802564529320"; +// bankService.toPay(outtradeno, "支付测试", 1, userid); +// bankService.queryPay(outtradeno); + bankService.toRefund(outtradeno, "ref"+outtradeno, 100); + } + +} diff --git a/health_framework/src/main/java/cn/card/health/framework/service/wechat/HealthCardWechatServcie.java b/health_framework/src/main/java/cn/card/health/framework/service/wechat/HealthCardWechatServcie.java new file mode 100644 index 0000000..0bb5940 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/framework/service/wechat/HealthCardWechatServcie.java @@ -0,0 +1,13 @@ +package cn.card.health.framework.service.wechat; + +import org.springframework.stereotype.Service; + +/** + * 微信管理service + * @author xinggm + * @date 2021年5月27日 + */ +@Service +public class HealthCardWechatServcie { + +} diff --git a/health_framework/src/main/java/cn/card/health/helper/InitCommonIn.java b/health_framework/src/main/java/cn/card/health/helper/InitCommonIn.java new file mode 100644 index 0000000..643524b --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/helper/InitCommonIn.java @@ -0,0 +1,51 @@ +//package cn.card.health.helper; +// +//import cn.card.health.config.WechatConfig; +//import cn.card.health.service.HealthCardInfoService; +//import com.alibaba.fastjson.JSONObject; +//import com.tencent.healthcard.impl.HealthCardServerImpl; +//import com.tencent.healthcard.model.CommonIn; +//import org.springframework.beans.factory.annotation.Autowired; +// +//import java.util.UUID; +// +//public class InitCommonIn { +// @Autowired +// HealthCardInfoService healthCardService; +// +// static String appSecret = WechatConfig.appSecret; +// +// // 构造公共输入参数commonIn +//// static String appToken = "46_ngko2SJPfIp67zAYiTKWn1HRjCAKOvabv4QcwaE49J6vXBVVxtn4E4j3SChC5nohbb1n7zODjpL-eaD_bWtCtXhnNH_DdYyY35pD2Rdd4GYIR9kTIik00He_eEP16tfuaVexw62itH5y6iVmRSGdAHAHIW"; +// static String appToken = ""; +// static String requestId; +// static String hospitalId = WechatConfig.hospitalId; +// +// // 构造请求参数req +// public static String appId = WechatConfig.appId; +// +// public static CommonIn getCommonIn(String appToken) { +// int channelNum = 0; +// CommonIn commonIn2 = new CommonIn(appToken, getRequestId(), hospitalId, channelNum); +// return commonIn2; +// } +// +// public static HealthCardServerImpl getHealthCard() { +// HealthCardServerImpl healthCard = new HealthCardServerImpl(appSecret); +// return healthCard; +// } +// +// public static String getRequestId() { +// requestId = UUID.randomUUID().toString().replaceAll("-", "").toUpperCase(); +// return requestId; +// } +// +// public static String getApptoken() { +// HealthCardServerImpl healthCard = new HealthCardServerImpl(appSecret); +// int channelNum = 0; +// CommonIn commonIn = new CommonIn(appToken, getRequestId(), hospitalId, channelNum); +// JSONObject appTokenObj = healthCard.getAppToken(commonIn, appId); +// String apptoken1 = appTokenObj.getJSONObject("rsp").getString("appToken"); +// return apptoken1; +// } +//} diff --git a/health_framework/src/main/java/cn/card/health/helper/iniOpenId.java b/health_framework/src/main/java/cn/card/health/helper/iniOpenId.java new file mode 100644 index 0000000..80cf7a2 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/helper/iniOpenId.java @@ -0,0 +1,101 @@ +package cn.card.health.helper; + +import java.security.Security; +import java.util.UUID; + +import javax.crypto.Cipher; +import javax.crypto.spec.SecretKeySpec; + +import org.apache.commons.codec.binary.Base64; +import org.bouncycastle.jce.provider.BouncyCastleProvider; + +public class iniOpenId { +// public static void main(String[] args) { +// String uuid = UUID.randomUUID().toString().toUpperCase().replace("-", ""); +// String openId = ""; +// String hospitalId = "31956"; +// String secret = "fe495c53d250593b47ad27e0ada93e19"; +// String uoh = uuid + "&" + openId + "&" + hospitalId; +// byte[] contentBytes = uoh.getBytes(); +// byte[] keyBytes = secret.getBytes(); +// +// // 加密 +// String en = encrypt(contentBytes, keyBytes); +// System.out.println(en); +// +// // 解密,用于本地验证 +// byte[] enb = en.getBytes(); +// byte[] de = decrypt(enb, keyBytes); +// String str = new String(de); +// System.out.println(str); +// } + + public static String getEnOpenId(String openId) { + String uuid = UUID.randomUUID().toString().toUpperCase().replace("-", ""); + String hospitalId = "31956"; + String appId = "660a4a5aac415e24be8e636362a74f63"; + String secret = "fe495c53d250593b47ad27e0ada93e19"; + + String uoh = uuid + "&" + openId + "&" + hospitalId; + byte[] contentBytes = uoh.getBytes(); + byte[] keyBytes = secret.getBytes(); + + String enOpenId = appId + encrypt(contentBytes, keyBytes); + + return enOpenId; + } + + /** + * AES加密 + * + * @param contentBytes 由uuid&openid&hospitalId拼接的明文 + * @param keyBytes 开放平台分配的appSecret密钥 + * @return + */ + public static String encrypt(byte[] contentBytes, byte[] keyBytes) { + try { + // 添加一个安全管理器提供者 + Security.addProvider(new BouncyCastleProvider()); + // 根据一个字节数组构造一个 SecretKey + SecretKeySpec key = new SecretKeySpec(keyBytes, "AES"); + + // 设置加密类型 +// Cipher cipher = Cipher.getInstance("AES/ECB/PKCS7Padding", "BC"); + Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding", "BC"); + cipher.init(Cipher.ENCRYPT_MODE, key); // 用于将 Cipher 初始化为加密模式的常量。 + byte[] tmp = cipher.doFinal(contentBytes); // 操作加密或解密数据 + + // 返回Base64后的加密串 + return new String(Base64.encodeBase64(tmp)); + + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + /** + * AES解密 + * + * @param contentBytes 加密后的openId字符串 + * @param keyBytes 开放平台分配的appSecret密钥 + * @return + */ + public static byte[] decrypt(byte[] contentBytes, byte[] keyBytes) { + try { + Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider()); + SecretKeySpec key = new SecretKeySpec(keyBytes, "AES"); + + Cipher cipher = Cipher.getInstance("AES/ECB/PKCS7Padding", "BC"); + + cipher.init(Cipher.DECRYPT_MODE, key); + + byte[] tmp = cipher.doFinal(Base64.decodeBase64(contentBytes)); + return tmp; + + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } +} diff --git a/health_framework/src/main/java/cn/card/health/insurance/HealthInsuranceConfig.java b/health_framework/src/main/java/cn/card/health/insurance/HealthInsuranceConfig.java new file mode 100644 index 0000000..b3e4440 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/insurance/HealthInsuranceConfig.java @@ -0,0 +1,28 @@ +package cn.card.health.insurance; + +/** + * 调用医保接口的配置 + */ +public class HealthInsuranceConfig { + + /** 应用ID */ + public static final String APPID = "1GH0SOG7I06I76430B0A00004854A5E8"; + /** 安全key */ + public static final String APP_SECRET = "1GH0SOG7Q06J76430B0A000081C3056C"; + /** 平台私钥 */ + public static final String APP_PRIVATE_KEY = "Gimez6VnBU5lSbOUrfTuBGIKt1inuCAqhjRn9xmzJr4="; + /** 平台公钥 */ + public static final String APP_PUBLIC_KEY = "BAjWhvUa+B6xXWAZUmvAdR9z5FSyWYvKiKXsKj/fUlwUjnJtGzx/7G65JBBNDHAlabe9vHEQ+a9LFy4zdaq1gHM="; + /** 平台调用地址 */ + public static final String REPORT_URL = "https://pub.ylbzj.yhwch.com/pmc/"; + /** 版本 */ + public static final String APP_VERSION = "2.0.1"; + /** 字符编码 */ + public static final String APP_CHARSET = "UTF-8"; + /** 签名算法 */ + public static final String APP_SIGN_TYPE = "SM2"; + /** 加密算法 */ + public static final String APP_ENCRYPT_TYPE = "SM4"; + /** 小程序验证密钥 */ + public static String REQUEST_KEY = "6DFC2C13EC94AC170B9E40D416735D22"; +} diff --git a/health_framework/src/main/java/cn/card/health/insurance/HealthInsuranceService.java b/health_framework/src/main/java/cn/card/health/insurance/HealthInsuranceService.java new file mode 100644 index 0000000..72c1efe --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/insurance/HealthInsuranceService.java @@ -0,0 +1,611 @@ +package cn.card.health.insurance; + +import cn.card.health.bean.insurance.MkAppletRequest; +import cn.card.health.common.utils.DateUtils; +import cn.card.health.common.utils.HttpUtils; +import cn.card.health.common.utils.JSONUtils; +import cn.card.health.insurance.utils.SignAndEncodeUtil; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; +import cn.card.health.alipay.config.AlipayAppletConfig; +import javax.annotation.PostConstruct; + + +/** + * 医保接口 + * + * @author xinggm + * @date 2022年9月20日 + */ +@Service +public class HealthInsuranceService { + + private static Logger logger = LoggerFactory.getLogger(HealthInsuranceService.class); + + JSONObject pubParam = getPubParam(); + + @PostConstruct + void init() { + JSONObject pubParam = new JSONObject(); + //渠道id + pubParam.put("appId", AlipayAppletConfig.in_appid); + //版本号 + pubParam.put("version", "2.0.1"); + //加密方式 + pubParam.put("encType", "SM4"); + //签名方式 + pubParam.put("signType", "SM2"); + } + + static JSONObject getPubParam() { + JSONObject pubParam = new JSONObject(); + //渠道id + pubParam.put("appId", AlipayAppletConfig.in_appid); + //版本号 + pubParam.put("version", "2.0.1"); + //加密方式 + pubParam.put("encType", "SM4"); + //签名方式 + pubParam.put("signType", "SM2"); + return pubParam; + } + + /** + * [6201] 费用明细上传 + */ + public JSONObject uldFeeInfo(JSONObject dataParam) { + logger.info("================[6201] 费用明细上传 ========================"); + try { + dataParam.put("orgCodg", AlipayAppletConfig.org_no); + pubParam = before(dataParam); + String respContent = HttpUtils.sendJSONPost(AlipayAppletConfig.in_url + "/org/local/api/hos/uldFeeInfo", pubParam.toString()); + logger.info("================[6201] 费用明细上传 response param========================"); + logger.info(respContent); + return after(respContent); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + /** + * [6202] 支付下单 + */ + public JSONObject payOrder(JSONObject dataParam) { + + try { + pubParam = before(dataParam); + String respContent = HttpUtils.sendJSONPost(AlipayAppletConfig.in_url + "/org/local/api/hos/pay_order", pubParam.toString()); + JSONObject result = JSONObject.parseObject(respContent); + return after(respContent); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + /** + * [6203] 医保退费 + */ + public JSONObject refundOrder(JSONObject dataParam) { + + try { + pubParam = before(dataParam); + String respContent = HttpUtils.sendJSONPost(AlipayAppletConfig.in_url + "/org/local/api/hos/refund_Order", pubParam.toString()); + return after(respContent); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + /** + * [6204] 医保订单信息同步 + */ + public static JSONObject orderNotify(JSONObject dataParam) { + + try { + return after(dataParam.toJSONString()); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + + /** + * [6205]银行卡支付下单 + */ + public JSONObject medBankPay(JSONObject dataParam) { + try { + pubParam = before(dataParam); + String respContent = HttpUtils.sendJSONPost(AlipayAppletConfig.in_url + "/org/local/api/hos/medBankPay", pubParam.toString()); + return after(respContent); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + + } + + /** + * 3.1.3.1【6301】医保订单结算结果查询 + */ + public JSONObject queryOrderInfo(JSONObject dataParam) { + try { + pubParam = before(dataParam); + String respContent = HttpUtils.sendJSONPost(AlipayAppletConfig.in_url + "/org/local/api/hos/query_order_info", pubParam.toString()); + return after(respContent); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + + } + + /** + * 3.1.3.2【6302】医保结算结果通知 + */ + public static JSONObject SettleNotify(JSONObject dataParam) { + try { + return after(dataParam.toJSONString()); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + /** + * [6401]费用明细上传撤销 + */ + public JSONObject revokeOrder(JSONObject dataParam) { + try { + pubParam = before(dataParam); + String respContent = HttpUtils.sendJSONPost(AlipayAppletConfig.in_url + "/org/local/api/hos/revoke_order", pubParam.toString()); + return after(respContent); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + + /** + * [6201] 费用明细上传 + */ + public JSONObject uldFeeInfo(JSONObject dataParam, MkAppletRequest appletRequest) { + logger.info("================[6201] 费用明细上传 ========================"); + try { + pubParam = before(dataParam, appletRequest); + String respContent = HttpUtils.sendJSONPost(AlipayAppletConfig.in_url + "/org/local/api/hos/uldFeeInfo", pubParam.toString()); +// String respContent = ""; + logger.info("================[6201] 费用明细上传 response param========================"); + logger.info(respContent); + JSONObject respJSON = after(respContent); + appletRequest.setMkInsuranceResponseData(respJSON.toJSONString()); + return respJSON; + } catch (Exception e) { + e.printStackTrace(); + return new JSONObject(); + } +// String result = "{ \"appId\": \"1GI1ID7O302G3F60C80A000072E7D954\", \"code\": 0, \"data\": { \"cashierUrl\": \"https://test.pub.ylbzj.yhwch.com:8089/hicashier/#/selfInsuranceCheckPay?type=5&encData=af99fb613f73e4240b91ef8214306fa67e1e8923dbd4e557483fc9b0104bb3ebffd645d68d001e9ee72c7d30ddddc1be3d39f862376301ad434fffca236bf3924a4c2bf298ce7680b82fa596724bac63fffff2f77789f566acbb0a99d7d7ceb8986c6b3e3465df704a10127cb3aad0366b23e61c1e10fc93c272874fde4e0c36da18f75ca5d826a9ac1e22bb289345f71775d6bcad4c64999d7b44dc10633bcc5d22a9f0f1d0151c2f8e25f4e29acf8d2c0fd2d65ff1b8bc6dd21b2a9963ae18da4a8d4c135ccb774da5cfd140e8e23a6abe65d691d8bc2e27e7a2841560b05fac78d56cdc49fc637b41459461f0ce745be2f0b83b284436a808d3af804e5729\", \"extData\": { \"mdtrtId\": \"300228468\", \"register\": { \"iptOtpNo\": \"25805\", \"mdtrtId\": \"300228468\", \"psnNo\": \"10000000000000000044437811\" }, \"result\": [ { \"bas_medn_flag\": \"0\", \"chrgitm_lv\": \"01\", \"cnt\": 1, \"det_item_fee_sumamt\": 15, \"drt_reim_flag\": \"0\", \"feedetl_sn\": \"1718423443450\", \"fulamt_ownpay_amt\": 0, \"hi_nego_drug_flag\": \"0\", \"inscp_scp_amt\": 15, \"lmt_used_flag\": \"0\", \"med_chrgitm_type\": \"02\", \"memo\": \"\", \"overlmt_amt\": 0, \"preselfpay_amt\": 0, \"pric\": 15, \"pric_uplmt_amt\": 15, \"selfpay_prop\": 0 } ], \"upload\": [ { \"basMednFlag\": \"0\", \"chrgitmLv\": \"01\", \"cnt\": 1, \"detItemFeeSumamt\": 15, \"drtReimFlag\": \"0\", \"feedetlSn\": \"1718423443450\", \"fulamtOwnpayAmt\": 0, \"hiNegoDrugFlag\": \"0\", \"inscpScpAmt\": 15, \"lmtUsedFlag\": \"0\", \"medChrgitmType\": \"02\", \"memo\": \"\", \"overlmtAmt\": 0, \"preselfpayAmt\": 0, \"pric\": 15, \"pricUplmtAmt\": 15, \"selfpayProp\": 0 } ] }, \"payOrdId\": \"ORD130100202406151150440001482\", \"payToken\": \"TSN130100202406151150440001929\" }, \"encType\": \"SM4\", \"flag\": true, \"message\": \"成功-072-2444c33f0a66488db7e6ca69766f05cd\", \"signData\": \"duJu00xoKAh1ePw7Efr1mAC4Yc3kROKReVciDdfhT/iuMpYLnx+PH4aCMjGa8DsBXnnnjcAkkEpwztkSbex+ig==\", \"signType\": \"SM2\", \"success\": true, \"timestamp\": \"1718423445351\", \"version\": \"2.0.1\" }"; +// return JSONObject.parseObject(result); + } + + /** + * [6202] 支付下单 + */ + public JSONObject payOrder(JSONObject dataParam, MkAppletRequest appletRequest) { + logger.info("================ [6202] 支付下单 ========================"); + try { + pubParam = before(dataParam, appletRequest); + String respContent = HttpUtils.sendJSONPost(AlipayAppletConfig.in_url + "/org/local/api/hos/pay_order", pubParam.toString()); + JSONObject respJSON = after(respContent); + appletRequest.setMkInsuranceResponseData(respJSON.toJSONString()); + return respJSON; + } catch (Exception e) { + e.printStackTrace(); + return null; + } +// String result = "{ \"signData\": \"E6ZmrHcXEuy2AtNRMrPJSyds2Vg09QSyjjxCmvijxf9cuqrwAn+Gk8KFM76mBUq9i6wP8fZu/Fd4b2UgxhoA/A==\", \"encType\": \"SM4\", \"code\": 0, \"flag\": true, \"data\": { \"acctMulaidPay\": 0.00, \"deposit\": 0, \"extData\": { \"preSetl\": { \"acct_mulaid_pay\": 0, \"acct_pay\": 15.0, \"act_pay_dedc\": 0, \"age\": 35.0, \"balc\": 85.00, \"brdy\": \"1989-01-07\", \"certno\": \"13068119890107221X\", \"clr_type\": \"11\", \"cvlserv_flag\": \"0\", \"cvlserv_pay\": 0, \"fulamt_ownpay_amt\": 0, \"fund_pay_sumamt\": 0, \"gend\": \"1\", \"hifdm_pay\": 0, \"hifes_pay\": 0, \"hifmi_pay\": 0, \"hifob_pay\": 0, \"hifp_pay\": 0, \"hosp_part_amt\": 0, \"inscp_scp_amt\": 15.0, \"insutype\": \"310\", \"maf_pay\": 0, \"mdtrt_cert_type\": \"01\", \"mdtrt_id\": \"300228468\", \"med_type\": \"12\", \"medfee_sumamt\": 15.0, \"medins_setl_id\": \"H13040207288202406151150458464\", \"oth_pay\": 0, \"overlmt_selfpay\": 0, \"pool_prop_selfpay\": 0.00, \"preselfpay_amt\": 0, \"psn_cash_pay\": 0, \"psn_cert_type\": \"01\", \"psn_name\": \"李海群\", \"psn_no\": \"10000000000000000044437811\", \"psn_part_amt\": 15.0, \"psn_type\": \"1101\" } }, \"feeSumamt\": 15.00, \"fundPay\": 0.00, \"hospPartAmt\": 0.00, \"ordStas\": \"1\", \"othFeeAmt\": 0.00, \"ownPayAmt\": 0.00, \"payOrdId\": \"ORD130100202406151150440001482\", \"psnAcctPay\": 15.00, \"selfAcctPay\": 15.00 }, \"success\": true, \"appId\": \"1GI1ID7O302G3F60C80A000072E7D954\", \"signType\": \"SM2\", \"message\": \"成功-072-7e0e01cde4244f3db003a24bdd8cbf90\", \"version\": \"2.0.1\", \"timestamp\": \"1718423455339\" }"; +// return JSONObject.parseObject(result); + } + + /** + * [6203] 医保退费 + */ + public JSONObject refundOrder(JSONObject dataParam, MkAppletRequest appletRequest) { + logger.info("================[6203] 医保退费========================"); + try { + pubParam = before(dataParam, appletRequest); + String respContent = HttpUtils.sendJSONPost(AlipayAppletConfig.in_url + "/org/local/api/hos/refund_Order", pubParam.toString()); + JSONObject respJSON = after(respContent); + appletRequest.setMkInsuranceResponseData(respJSON.toJSONString()); + + if("360086".equals(respJSON.getString("code"))){ + respContent = HttpUtils.sendJSONPost(AlipayAppletConfig.in_url + "/org/local/api/hos/refund_Order", pubParam.toString()); + respJSON = after(respContent); + appletRequest.setMkInsuranceResponseData(appletRequest.getMkInsuranceResponseData() + respJSON.toJSONString()); + + if("360040".equals(respJSON.getString("code"))&&respJSON.getString("message").contains("054订单已医保全部退款")){ + respJSON.put("code","0"); + } + + } + return respJSON; + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + /** + * [6204] 医保订单信息同步 + */ + public JSONObject orderNotify(JSONObject dataParam, MkAppletRequest appletRequest) { + logger.info("================ [6204] 医保订单信息同步 ========================"); + try { + return after(dataParam.toJSONString()); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + + /** + * [6205]银行卡支付下单 + */ + public JSONObject medBankPay(JSONObject dataParam, MkAppletRequest appletRequest) { + try { + pubParam = before(dataParam, appletRequest); + String respContent = HttpUtils.sendJSONPost(AlipayAppletConfig.in_url + "/org/local/api/hos/medBankPay", pubParam.toString()); + JSONObject respJSON = after(respContent); + appletRequest.setMkInsuranceResponseData(respJSON.toJSONString()); + return respJSON; + } catch (Exception e) { + e.printStackTrace(); + return null; + } + + } + + /** + * 3.1.3.1【6301】医保订单结算结果查询 + */ + public JSONObject queryOrderInfo(JSONObject dataParam, MkAppletRequest appletRequest) { + logger.info("================【6301】医保订单结算结果查询========================"); + try { + dataParam.put("orgCodg", AlipayAppletConfig.org_no); + pubParam = before(dataParam, appletRequest); + String respContent = HttpUtils.sendJSONPost(AlipayAppletConfig.in_url + "/org/local/api/hos/query_order_info", pubParam.toString()); + JSONObject respJSON = after(respContent); + appletRequest.setMkInsuranceResponseData(respJSON.toJSONString()); + return respJSON; + } catch (Exception e) { + e.printStackTrace(); + return null; + } + + } + + /** + * 3.1.3.2【6302】医保结算结果通知 + */ + public JSONObject SettleNotify(JSONObject dataParam, MkAppletRequest appletRequest) { + try { + return after(dataParam.toJSONString()); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + /** + * [6401]费用明细上传撤销 + */ + public JSONObject revokeOrder(JSONObject dataParam, MkAppletRequest appletRequest) { + try { + pubParam = before(dataParam, appletRequest); + String respContent = HttpUtils.sendJSONPost(AlipayAppletConfig.in_url + "/org/local/api/hos/revoke_order", pubParam.toString()); + JSONObject respJSON = after(respContent); + appletRequest.setMkInsuranceResponseData(respJSON.toJSONString()); + return respJSON; + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + public static void main(String[] args) throws Exception { + + HealthInsuranceService s = new HealthInsuranceService(); + String content = "af99fb613f73e4240b91ef8214306fa6bf4c8a06304b9b5907b22216254b26140764fe043a57282159472df4a2f9f3173d39f862376301ad434fffca236bf39263e190526963ad613fef3905f32532ac96da8cf33da8585f47b20d7bc519237f986c6b3e3465df704a10127cb3aad036db30584e34e0cef5af1a05de33233d65e29c492dd15ebd1b1590c1678a7849a0abf48f3cf1a62f8a0c0217df1d3cdc92d86e235ab9a28030d807889e000a5d50ed3f6a39971cbdea7f402e26173f1c8e5f06aa2840eb1ceb72050fef6267a713"; + +// String url = "http://ylbzj.hebei.gov.cn/hicashier/#/indexselfInsuranceCheckPay?"; +// String params = "type=5&encData=af99fb613f73e4240b91ef8214306fa6bf4c8a06304b9b5907b22216254b26140764fe043a57282159472df4a2f9f3173d39f862376301ad434fffca236bf39263e190526963ad613fef3905f32532ac96da8cf33da8585f47b20d7bc519237f986c6b3e3465df704a10127cb3aad036db30584e34e0cef5af1a05de33233d65e29c492dd15ebd1b1590c1678a7849a0abf48f3cf1a62f8a0c0217df1d3cdc92d86e235ab9a28030d807889e000a5d50ed3f6a39971cbdea7f402e26173f1c8e5f06aa2840eb1ceb72050fef6267a713"; +// params += "&chnlAppId=" + AlipayAppletConfig.in_appid + "&chnlEncData= {\"payAuthNo\":\"AUTH130100202211111730040010801\",\"deposit\":6.6}"; +// //加密 +// String resultEncDataObj = SignAndEncodeUtil.encryptSm4ECB(params, AlipayAppletConfig.in_appid, AlipayAppletConfig.in_app_secret); +// System.out.println(resultEncDataObj); +// System.out.println(url + resultEncDataObj); +// String a = "閭㈠箍鍐�"; +// String b = new String(a.getBytes("GBK"), "UTF-8"); +// System.out.println(b); +// String resultEncData = "11afd97ce1775452b671b0f28b0d3563e9de2b1d60322de0eb6dfafffdad0695f8f6a4fb7ea93501e3fd6dd3337546556057e949fc1fc976e5ca9cc0b774b192c22395dbe0f10e80270e4f75182a8b4856d14d30051e6a1b59457ac383986b7adc248bb96c164703589f3eba8363a43bc77d0fe5b7c3dc11328c44b8f86408cf086a2446096c6e735bfe817c15297b12c64836f8def09c17b5f445549b1a4d185e83950bb700133ace8c3360965893983ff72146112b587750da7c19f970d88a635b4f0e2d77af22cd854f2a13efe14ce7f2a67d03df94ee1dc40ea990f98c45511786f3fc3190e809eb32edf45165c4c9f65fdf6e638b6e97c25d797093a14537e1e9283b46905be724464ddbc6263b23a7f14f4b0a204518a02f58b721e724ff02df1fba02ec706c649e153563089b58921ff4f34fcb547aa4e043f77ec4ec05cb99e7887751c68d07f0f55d6d665e492384830db413a7bebfd09c493ed384f053d95b6d930a30eecf78e9f076e2651166b9cdc867d109d612083307149ab89abd1b2d4fb0eed241ff89df1d9cebea2428ed90df6483ed1a497e30744a1fd549a309ac82c2fe8408efd591fc9c453dd5c6d7eaf7a0facfc3eb413d7c36a794cd7b100907fe37b18304a08cdc9a4211db9badb168ebea4f0c38c71fd14ae009b1e6b33b21ba940e76f9c18dd07604b110a429b67eeefbdc1ad3449f1bbcb0cfd20ba3cd1b5aed1569e83f4c8645137b0f3aede7d7a12ebdad4a7e7f878dc1a14d016f7a253fa3be4646e20972a85cbe66686f5267ab479a64c55b351b674d35605794993be3d49bdd070400c952303a2b305f305962c8ad69130638973fba41e1edfc97e0fb2f977ef5c07729151575074f1d7bea1403048fa9eedddc24c382846536b6065adb3e58a1f3d1f97669aecf0e6b227cca79ef393d7fc5660cecfe8d4524c73eb29ec07b6a29564d7818a8e2c77fa6c1f3a18d85b171a2ea5b6dcee3d1692b0e67a2731b42c68a1726b427b2f6537430727523b651ad9deebcda7811e4c53163b24d173aa3acd308c9c277f47d5d91772b9575a143c50846cd89a4f05c4213043c4f2bcfcd07823f03a7ae5b54fdb9514f30a9e35f61fb818080274db44f26630c00747f9d87435857db57bca6855d9768576f265fd4a1eeb09d5c0106670ce3972889829ec96d48615a335aa6caa9515f05eefb13bfb26e71f9483be4277e054ac9b923ae1f70038da4a28027a6543d6aa354a6562e25c4c26d60f4edd30a9d669c5949d2761f6a21d90700e81262b451396615c3a487fe8ebd0688a0b12c8ea4504f84c75d4796b76d9ff2c51264a40025b31d5e6e8aff38de2124b4d0b130e9c4d0045d62094e8048ece781fa8d761b7fe5fd2e8ce208f7614fdeadc1d3abd6e240926a3d99a85f5427d2907e159bb70d3b20a61a03b77b4543"; + + //解密 +// JSONObject resultEncDataObj = SignAndEncodeUtil.decryptSm4ECB(resultEncData, AlipayAppletConfig.in_appid, AlipayAppletConfig.in_app_secret); +// System.out.println(resultEncDataObj); + Long serialno = System.currentTimeMillis(); + content = "{ \"acctUsedFlag\": \"1\", \"atddrNo\": \"11\", \"begntime\": \"2024-06-12 18:01:28\", \"caty\": \"A50.09\", \"chrgBchno\": \""+serialno+"\", \"deptCode\": \"101\", \"deptName\": \"治未病科\", \"diseCodg\": \"Z00.001\", \"diseName\": \"健康检查\", \"diseinfoList\": [ { \"diagCode\": \"Z00.001\", \"diagDept\": \"101\", \"diagName\": \"健康检查\", \"diagSrtNo\": \"1\", \"diagTime\": \"2024-06-13 10:01:28\", \"diagType\": \"1\", \"diseDorName\": \"123345\", \"diseDorNo\": \"123345\", \"valiFlag\": \"1\" } ], \"drName\": \"123345\", \"feeType\": \"01\", \"feedetailList\": [ { \"acordDeptCodg\": \"\", \"acordDeptName\": \"\", \"bilgDeptCodg\": \"101\", \"bilgDeptName\": \"治未病科\", \"bilgDrCodg\": \"123345\", \"bilgDrName\": \"123345\", \"chrgBchno\": \""+serialno+"\", \"cnt\": \"1\", \"detItemFeeSumamt\": \"25\", \"diseCodg\": \"\", \"drordNo\": \""+serialno+"\", \"dscgTkdrugFlag\": \"\", \"etipFlag\": \"\", \"etipHospCode\": \"\", \"feeOcurTime\": \"2024-06-13 10:33:41\", \"expContent\": \"\", \"feedetlSn\": \""+serialno+"\", \"hospApprFlag\": \"1\", \"initFeedetlSn\": \"\", \"matnFeeFlag\": \"\", \"medListCodg\": \"001102000010000-11020000100\", \"medListName\": \"普通门诊诊察费\", \"medListSpc\": \"次\", \"medType\": \"12\", \"medinsListCodg\": \"y1\", \"memo\": \"\", \"ordersDrCode\": \"\", \"ordersDrName\": \"\", \"prdDays\": \"\", \"pric\": \"25\", \"psnNo\": \"13000000000000080588031058\", \"rxCircFlag\": \"0\", \"sinDosDscr\": \"\", \"tcmdrugUsedWay\": \"\", \"usedFrquDscr\": \"\" } ], \"idNo\": \"130681198803232232\", \"idType\": \"01\", \"insuCode\": \"130402\", \"insuplcAdmdvs\": \"130499\", \"insutype\": \"390\", \"iptOtpNo\": \"21000325\", \"mdtrtCertType\": \"02\", \"mdtrtId\": \"\", \"medOrgOrd\": \""+serialno+"\", \"medType\": \"12\", \"medfeeSumamt\": \"25\", \"mdtrtId\": \"\", \"orgCodg\": \"H13040207288\", \"payAuthNo\": \"AUTH130100202406151109130008717\", \"psnNo\": \"13000000000000080588031058\", \"psnSetlway\": \"01\", \"uldLatlnt\": \"0,0\", \"userName\": \"王凯\" }"; +// content = "{ \"acctUsedFlag\": \"1\", \"atddrNo\": \"11\", \"begntime\": \"2024-06-13 10:14:46\", \"caty\": \"A50.09\", \"chrgBchno\": \"8614101\", \"deptCode\": \"101\", \"deptName\": \"治未病科\", \"diseCodg\": \"\", \"diseName\": \"\", \"diseinfoList\": [ { \"diagCode\": \"Z00.001\", \"diagDept\": \"101\", \"diagName\": \"健康查体\", \"diagSrtNo\": \"1\", \"diagTime\": \"2024-06-13 10:14:46\", \"diagType\": \"1\", \"diseDorName\": \"123345\", \"diseDorNo\": \"123345\", \"valiFlag\": \"1\" } ], \"drName\": \"测试医师\", \"feeType\": \"01\", \"feedetailList\": [ { \"acordDeptCodg\": \"\", \"acordDeptName\": \"\", \"bilgDeptCodg\": \"101\", \"bilgDeptName\": \"治未病科\", \"bilgDrCodg\": \"D130481015012\", \"bilgDrName\": \"123345\", \"chrgBchno\": \"8614101\", \"cnt\": \"1\", \"detItemFeeSumamt\": \"10\", \"diseCodg\": \"\", \"drordNo\": \"8614101\", \"dscgTkdrugFlag\": \"\", \"etipFlag\": \"\", \"etipHospCode\": \"\", \"expContent\": \"-\", \"feeOcurTime\": \"2024-06-13 10:14:46\", \"feedetlSn\": \"25165723\", \"hospApprFlag\": \"1\", \"initFeedetlSn\": \"\", \"matnFeeFlag\": \"\", \"mdtrtId\": \"300228245\", \"medListCodg\": \"001102000010000-11020000100\", \"medListName\": \"普通门诊诊察费\", \"medListSpc\": \"次\", \"medType\": \"12\", \"medinsListCodg\": \"y1\", \"memo\": \"\", \"ordersDrCode\": \"\", \"ordersDrName\": \"\", \"prdDays\": \"\", \"pric\": \"25\", \"psnNo\": \"13000000000000080588031058\", \"rxCircFlag\": \"0\", \"sinDosDscr\": \"\", \"tcmdrugUsedWay\": \"\", \"usedFrquDscr\": \"\" } ], \"idNo\": \"130681198803232232\", \"idType\": \"01\", \"insuCode\": \"130400\", \"insuplcAdmdvs\": \"130400\", \"insutype\": \"310\", \"iptOtpNo\": \"21000325\", \"mdtrtCertType\": \"01\", \"mdtrtId\": \"300228245\", \"medOrgOrd\": \"1801075688690085888\", \"medType\": \"12\", \"medfeeSumamt\": \"25\", \"orgCodg\": \"H13040207288\", \"payAuthNo\": \"AUTH130100202406140904260008467\", \"psnNo\": \"13000000000000080588031058\", \"psnSetlway\": \"01\", \"uldLatlnt\": \"0,0\", \"userName\": \"王凯\" }"; + content = "{ \"acctUsedFlag\": \"1\", \"atddrNo\": \"11\", \"begntime\": \"2024-06-12 18:01:28\", \"caty\": \"A50.09\", \"chrgBchno\": \"1718353537373\", \"deptCode\": \"101\", \"deptName\": \"治未病科\", \"diseCodg\": \"Z00.001\", \"diseName\": \"健康检查\", \"diseinfoList\": [ { \"diagCode\": \"Z00.001\", \"diagDept\": \"101\", \"diagName\": \"健康检查\", \"diagSrtNo\": \"1\", \"diagTime\": \"2024-06-13 10:01:28\", \"diagType\": \"1\", \"diseDorName\": \"123345\", \"diseDorNo\": \"123345\", \"valiFlag\": \"1\" } ], \"drName\": \"123345\", \"feeType\": \"01\", \"feedetailList\": [ { \"acordDeptCodg\": \"\", \"acordDeptName\": \"\", \"bilgDeptCodg\": \"101\", \"bilgDeptName\": \"治未病科\", \"bilgDrCodg\": \"123345\", \"bilgDrName\": \"123345\", \"chrgBchno\": \"1718353537373\", \"cnt\": \"1\", \"detItemFeeSumamt\": \"25\", \"diseCodg\": \"\", \"drordNo\": \"1718353537373\", \"dscgTkdrugFlag\": \"\", \"etipFlag\": \"\", \"etipHospCode\": \"\", \"expContent\": \"\", \"feeOcurTime\": \"2024-06-13 10:33:41\", \"feedetlSn\": \"1718353537373\", \"hospApprFlag\": \"1\", \"initFeedetlSn\": \"\", \"matnFeeFlag\": \"\", \"medListCodg\": \"001102000010000-11020000100\", \"medListName\": \"普通门诊诊察费\", \"medListSpc\": \"次\", \"medType\": \"12\", \"medinsListCodg\": \"y1\", \"memo\": \"\", \"ordersDrCode\": \"\", \"ordersDrName\": \"\", \"prdDays\": \"\", \"pric\": \"25\", \"psnNo\": \"10000000000000000044437811\", \"rxCircFlag\": \"0\", \"sinDosDscr\": \"\", \"tcmdrugUsedWay\": \"\", \"usedFrquDscr\": \"\" } ], \"idNo\": \"13068119890107221X\", \"idType\": \"01\", \"insuCode\": \"130402\", \"insuplcAdmdvs\": \"130402\", \"insutype\": \"310\", \"iptOtpNo\": \"21000325\", \"mdtrtCertType\": \"02\", \"mdtrtId\": \"\", \"medOrgOrd\": \"1718353537373\", \"medType\": \"12\", \"medfeeSumamt\": \"25\", \"orgCodg\": \"H13040207288\", \"payAuthNo\": \"AUTH130100202406151144330008724\", \"psnNo\": \"10000000000000000044437811\", \"psnSetlway\": \"01\", \"uldLatlnt\": \"0,0\", \"userName\": \"李海群\" }"; + JSONObject params = JSONObject.parseObject(content); + JSONObject result ; + result = s.uldFeeInfo(params); + + System.out.println(result); + + } + + public JSONObject before(JSONObject dataParam) throws Exception { + pubParam.put("timestamp", DateUtils.dateTimeNow()); //当前时间 yyyyMMddHHmmss + dataParam = JSONUtils.startSort(dataParam); + pubParam.put("data", dataParam); + pubParam = JSONUtils.startSort(pubParam); + logger.info("================pubParam=============="); + logger.info(pubParam.toJSONString()); + + //签名 + String signData = SignAndEncodeUtil.createSignEncoderBase64(pubParam, AlipayAppletConfig.in_app_secret, AlipayAppletConfig.in_app_private_key); + //加密 + String encData = SignAndEncodeUtil.encryptSm4ECB(dataParam.toJSONString(), AlipayAppletConfig.in_appid, AlipayAppletConfig.in_app_secret); + +// //签名 +// String signData = SignAndEncodeUtil.createSignEncoderBase64(pubParam); +// //加密 +// String encData = SignAndEncodeUtil.encryptSm4ECB(dataParam.toJSONString()); + logger.info("================dataParam=============="); + logger.info(dataParam.toJSONString()); + pubParam.remove("data"); + pubParam.put("encData", encData); //加密数据 + pubParam.put("signData", signData); //签名串 + logger.info("================request param========================"); + logger.info(pubParam.toJSONString()); + return pubParam; + + } + + public JSONObject before(JSONObject dataParam, String in_appid, String in_app_secret, String in_app_private_key) throws Exception { + pubParam.put("timestamp", DateUtils.dateTimeNow()); //当前时间 yyyyMMddHHmmss + dataParam = JSONUtils.startSort(dataParam); + pubParam.put("data", dataParam); + pubParam = JSONUtils.startSort(pubParam); + logger.info("================pubParam=============="); + logger.info(pubParam.toJSONString()); + + //签名 + String signData = SignAndEncodeUtil.createSignEncoderBase64(pubParam, in_app_secret, in_app_private_key); + //加密 + String encData = SignAndEncodeUtil.encryptSm4ECB(dataParam.toJSONString(), in_appid, in_app_secret); + +// //签名 +// String signData = SignAndEncodeUtil.createSignEncoderBase64(pubParam); +// //加密 +// String encData = SignAndEncodeUtil.encryptSm4ECB(dataParam.toJSONString()); + logger.info("================dataParam=============="); + logger.info(dataParam.toJSONString()); + pubParam.remove("data"); + pubParam.put("encData", encData); //加密数据 + pubParam.put("signData", signData); //签名串 + logger.info("================request param========================"); + logger.info(pubParam.toJSONString()); + return pubParam; + + } + + + public JSONObject before(JSONObject dataParam, MkAppletRequest appletRequest) throws Exception { + String requestid = dataParam.getString("requestid"); + String sign = dataParam.getString("sign"); + dataParam.remove("requestid"); + dataParam.remove("sign"); + //当前时间 yyyyMMddHHmmss + pubParam.put("timestamp", DateUtils.dateTimeNow()); + dataParam = JSONUtils.startSort(dataParam); + pubParam.put("data", dataParam); + pubParam = JSONUtils.startSort(pubParam); + logger.info("================pubParam=============="); + logger.info(pubParam.toJSONString()); +// appletRequest.setMkInsuranceRequestData(dataParam.toJSONString()); + + +// logger.info("=======in_app_secret========="); +// logger.info(AlipayAppletConfig.in_app_secret); +// logger.info("=======in_app_private_key========="); +// logger.info(AlipayAppletConfig.in_app_private_key); +// logger.info("=======in_appid========="); +// logger.info(AlipayAppletConfig.in_appid); + //签名 + String signData = SignAndEncodeUtil.createSignEncoderBase64(pubParam, AlipayAppletConfig.in_app_secret, AlipayAppletConfig.in_app_private_key); + //加密 + String encData = SignAndEncodeUtil.encryptSm4ECB(dataParam.toJSONString(), AlipayAppletConfig.in_appid, AlipayAppletConfig.in_app_secret); + logger.info("================dataParam=============="); + logger.info(dataParam.toJSONString()); + pubParam.remove("data"); + pubParam.put("encData", encData); //加密数据 + pubParam.put("signData", signData); //签名串 + logger.info("================request param========================"); + logger.info(pubParam.toJSONString()); + return pubParam; + + } + + public static JSONObject after(String respContent) throws Exception { + JSONObject result = JSONObject.parseObject(respContent); + if (!"0".equals(result.getString("code"))) { + return result; + } + String resultEncData = result.getString("encData"); + //解密 + JSONObject resultEncDataObj = SignAndEncodeUtil.decryptSm4ECB(resultEncData, AlipayAppletConfig.in_appid, AlipayAppletConfig.in_app_secret); + //排序 + resultEncDataObj = JSONUtils.startSort(resultEncDataObj); + //验签 + String resultSignData = result.getString("signData"); + + JSONObject signJson = new JSONObject(); + signJson.put("appId", result.get("appId")); + signJson.put("code", result.get("code")); + signJson.put("data", resultEncDataObj);//参数必须按字母顺序排 + signJson.put("encType", "SM4"); + signJson.put("message", result.get("message")); + signJson.put("signData", resultSignData); + signJson.put("signType", "SM2"); + signJson.put("success", result.get("success")); + signJson.put("timestamp", result.get("timestamp")); + signJson.put("version", result.get("version")); + Boolean flag = SignAndEncodeUtil.validateSign(signJson); + logger.info("===验签结果====={}", flag); + signJson.put("flag", flag); +// signJson.put("data", resultEncDataObj); + return signJson; + } + + /** + * 获取医保挂号信息 + * @return + */ + public JSONObject getRegistInfo(JSONObject params){ + + JSONObject pubParam = new JSONObject(); + String datetime = DateUtils.getTime(); + pubParam.put("acctUsedFlag", params.getString("acctUsedFlag")); + pubParam.put("atddrNo", params.getString("atddrNo")); + pubParam.put("begntime", datetime); + pubParam.put("caty", "Z00.001"); + pubParam.put("chrgBchno", params.getString("chrgBchno")); + pubParam.put("deptCode", params.getString("deptCode")); + pubParam.put("deptName", params.getString("deptName")); + pubParam.put("diseCodg", "Z00.001"); + pubParam.put("diseName", "健康检查"); + pubParam.put("drName", params.getString("drName")); + pubParam.put("feeType", "01"); + pubParam.put("idType", "01"); + pubParam.put("insuCode", "130402"); + pubParam.put("insutype", params.getString("insutype")); + pubParam.put("iptOtpNo", params.getString("iptOtpNo")); + pubParam.put("mdtrtCertType", "01"); + pubParam.put("mdtrtId", ""); + pubParam.put("medOrgOrd", params.getString("medOrgOrd")); + pubParam.put("medType", "12"); + pubParam.put("medfeeSumamt", params.getString("medfeeSumamt")); +// pubParam.put("orgBizSer", params.getString("orgBizSer")); + pubParam.put("orgCodg", AlipayAppletConfig.org_no); + pubParam.put("idNo", params.getString("idNo")); + pubParam.put("psnNo", params.getString("psnNo")); + pubParam.put("userName", params.getString("userName")); + pubParam.put("payAuthNo", params.getString("payAuthNo")); + pubParam.put("insuplcAdmdvs", params.getString("insuplcAdmdvs")); + pubParam.put("psnSetlway", "01"); + pubParam.put("uldLatlnt", "0,0"); + JSONObject diseParam = new JSONObject(); + diseParam.put("diagCode", "Z00.001"); + diseParam.put("diagDept", params.getString("deptCode")); + diseParam.put("diagName", "健康检查"); + diseParam.put("diagSrtNo", "1"); + diseParam.put("diagTime", datetime); + diseParam.put("diagType", "1"); + diseParam.put("diseDorName", params.getString("drName")); + diseParam.put("diseDorNo", params.getString("atddrNo")); + diseParam.put("valiFlag", "1"); + JSONArray arrayDise = new JSONArray(); + arrayDise.add(diseParam); + pubParam.put("diseinfoList", arrayDise); + JSONObject feedParam = new JSONObject(); + feedParam.put("acordDeptCodg", ""); + feedParam.put("acordDeptName", ""); + feedParam.put("bilgDeptCodg", params.getString("deptCode")); + feedParam.put("bilgDeptName", params.getString("deptName")); + feedParam.put("bilgDrCodg", params.getString("atddrNo")); + feedParam.put("bilgDrName", params.getString("drName")); + feedParam.put("chrgBchno", params.getString("chrgBchno")); + feedParam.put("cnt", "1"); + feedParam.put("detItemFeeSumamt", params.getString("medfeeSumamt")); + feedParam.put("diseCodg", ""); + feedParam.put("drordNo", params.getString("chrgBchno")); + feedParam.put("dscgTkdrugFlag", ""); + feedParam.put("etipFlag", ""); + feedParam.put("etipHospCode", ""); + feedParam.put("expContent", ""); + feedParam.put("feeOcurTime", params.getString("feeOcurTime")); + feedParam.put("feedetlSn", params.getString("chrgBchno")); + feedParam.put("hospApprFlag", "1"); + feedParam.put("initFeedetlSn", ""); + feedParam.put("matnFeeFlag", ""); + feedParam.put("mdtrtId", ""); + feedParam.put("medListCodg", "001102000010000-11020000100"); + feedParam.put("medListName", "普通门诊诊察费"); + feedParam.put("medListSpc", "次"); + feedParam.put("medType", "12"); + feedParam.put("medinsListCodg", "y1"); + feedParam.put("memo", ""); + feedParam.put("ordersDrCode", ""); + feedParam.put("ordersDrName", ""); + feedParam.put("prdDays", ""); + feedParam.put("pric", params.getString("medfeeSumamt")); + feedParam.put("psnNo", params.getString("psnNo")); + feedParam.put("rxCircFlag", "0"); + feedParam.put("sinDosDscr", ""); + feedParam.put("tcmdrugUsedWay", ""); + feedParam.put("usedFrquDscr", ""); + + JSONArray feedDise = new JSONArray(); + feedDise.add(feedParam); + pubParam.put("feedetailList", feedDise); + return pubParam; + } + + //获得缴费信息 + public JSONObject getClinicInfo(JSONObject params){ + String data = "{ \"acctUsedFlag\": \"1\", \"atddrNo\": \"1722\", \"begntime\": \"2024-06-25 18:11:09\", \"caty\": \"A50\", \"chrgBchno\": \"3528508\", \"deptCode\": \"114\", \"deptName\": \"中医科\", \"diseCodg\": \"BNP020\", \"diseName\": \"胃痞病\", \"diseinfoList\": [ { \"diagCode\": \"BNP020\", \"diagDept\": \"A50\", \"diagName\": \"胃痞病(气滞血郁证)\", \"diagSrtNo\": \"1\", \"diagTime\": \"2024-05-26 17:56:55\", \"diagType\": \"3\", \"diseDorName\": \"冯瑞英\", \"diseDorNo\": \"D130481014891\", \"valiFlag\": \"1\" } ], \"drName\": \"冯瑞英\", \"feeType\": \"01\", \"feedetailList\": [ { \"acordDeptCodg\": \"\", \"acordDeptName\": \"\", \"bilgDeptCodg\": \"A50\", \"bilgDeptName\": \"中医科\", \"bilgDrCodg\": \"D130481014891\", \"bilgDrName\": \"冯瑞英\", \"chrgBchno\": \"3470977\", \"cnt\": \"200\", \"detItemFeeSumamt\": \"25\", \"diseCodg\": \"BNP020\", \"drordNo\": \"2151658\", \"dscgTkdrugFlag\": \"\", \"etipFlag\": \"\", \"etipHospCode\": \"\", \"expContent\": \"-\", \"feeOcurTime\": \"2024-05-26 18:11:09\", \"feedetlSn\": \"4892626\", \"hospApprFlag\": \"1\", \"initFeedetlSn\": \"\", \"matnFeeFlag\": \"\", \"mdtrtId\": \"1473273882\", \"medListCodg\": \"T001700782\", \"medListName\": \"仙茅\", \"medListSpc\": \"\", \"medType\": \"11\", \"medinsListCodg\": \"c127\", \"memo\": \"\", \"ordersDrCode\": \"\", \"ordersDrName\": \"\", \"prdDays\": \"\", \"pric\": \"0.5\", \"psnNo\": \"\", \"rxCircFlag\": \"0\", \"sinDosDscr\": \"10\", \"tcmdrugUsedWay\": \"\", \"usedFrquDscr\": \"bid\" } ], \"idNo\": \"\", \"idType\": \"01\", \"insuCode\": \"130402\", \"insutype\": \"310\", \"iptOtpNo\": \"\", \"mdtrtCertType\": \"01\", \"mdtrtId\": \"\", \"medOrgOrd\": \"\", \"medType\": \"11\", \"medfeeSumamt\": \"100\", \"orgBizSer\": \"\", \"orgCodg\": \"\", \"payAuthNo\": \"\", \"psnNo\": \"\", \"psnSetlway\": \"01\", \"uldLatlnt\": \"0,0\", \"userName\": \"\" }"; + JSONObject pubParam = JSONObject.parseObject(data); + JSONArray feedlist = pubParam.getJSONArray("feedetailList"); + JSONObject feedetail =feedlist.getJSONObject(0); + String datetime = DateUtils.getTime(); + feedetail.put("psnNo", params.getString("psnNo")); + feedetail.put("feeOcurTime", params.getString("feeOcurTime")); + feedetail.put("feedetlSn", params.getString("chrgBchno")); + feedetail.put("drordNo", params.getString("chrgBchno")); + pubParam.put("begntime", datetime); + pubParam.put("chrgBchno", params.getString("chrgBchno")); + pubParam.put("idNo", params.getString("idNo")); + pubParam.put("psnNo", params.getString("psnNo")); + pubParam.put("userName", params.getString("userName")); + pubParam.put("payAuthNo", params.getString("payAuthNo")); + pubParam.put("insuCode", "130402"); + pubParam.put("insutype", params.getString("insutype")); + pubParam.put("orgCodg", "H13040207288"); + pubParam.put("orgBizSer", params.getString("chrgBchno")); + pubParam.put("medOrgOrd", params.getString("chrgBchno")); + pubParam.put("mdtrtId", params.getString("mdtrtId")); + pubParam.put("iptOtpNo", params.getString("chrgBchno")); + feedlist = new JSONArray(); + feedlist.add(feedetail); + pubParam.put("feedetailList", feedlist); + return pubParam; + } + + + /** + * 获取门诊缴费信息 + * @return + */ + public JSONObject getClinicInfo(){ + return null; + } +} diff --git a/health_framework/src/main/java/cn/card/health/insurance/utils/BCUtils.java b/health_framework/src/main/java/cn/card/health/insurance/utils/BCUtils.java new file mode 100644 index 0000000..2842530 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/insurance/utils/BCUtils.java @@ -0,0 +1,42 @@ +package cn.card.health.insurance.utils; + +import org.bouncycastle.jce.provider.BouncyCastleProvider; + +import javax.crypto.Cipher; +import javax.crypto.NoSuchPaddingException; +import java.security.*; + +/** + * + */ +public class BCUtils { + + static { + if (Security.getProvider(BouncyCastleProvider.PROVIDER_NAME)==null){ + Security.addProvider(new BouncyCastleProvider()); + } + } + + public static Cipher getCipher(final String algorithm) { + try { + return Cipher.getInstance(algorithm, BouncyCastleProvider.PROVIDER_NAME); + } catch (final NoSuchAlgorithmException | NoSuchPaddingException | NoSuchProviderException e) { + throw new IllegalArgumentException(e); + } + } + + public static MessageDigest getMessageDigest(final String algorithm) { + try { + return MessageDigest.getInstance(algorithm, BouncyCastleProvider.PROVIDER_NAME); + } catch (final NoSuchAlgorithmException|NoSuchProviderException e) { + throw new IllegalArgumentException(e); + } + } + public static Signature getSignature(final String algorithm) { + try { + return Signature.getInstance(algorithm, BouncyCastleProvider.PROVIDER_NAME); + } catch (final NoSuchAlgorithmException|NoSuchProviderException e) { + throw new IllegalArgumentException(e); + } + } +} diff --git a/health_framework/src/main/java/cn/card/health/insurance/utils/EasyGmUtils.java b/health_framework/src/main/java/cn/card/health/insurance/utils/EasyGmUtils.java new file mode 100644 index 0000000..e8a9d88 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/insurance/utils/EasyGmUtils.java @@ -0,0 +1,330 @@ +package cn.card.health.insurance.utils; + + +import org.bouncycastle.asn1.ASN1EncodableVector; +import org.bouncycastle.asn1.ASN1Integer; +import org.bouncycastle.asn1.ASN1Sequence; +import org.bouncycastle.asn1.DERSequence; +import org.bouncycastle.asn1.gm.GMNamedCurves; +import org.bouncycastle.asn1.x9.X9ECParameters; +import org.bouncycastle.crypto.InvalidCipherTextException; +import org.bouncycastle.crypto.engines.SM2Engine; +import org.bouncycastle.crypto.params.ECDomainParameters; +import org.bouncycastle.crypto.params.ECPrivateKeyParameters; +import org.bouncycastle.crypto.params.ECPublicKeyParameters; +import org.bouncycastle.crypto.params.ParametersWithRandom; +import org.bouncycastle.jcajce.provider.asymmetric.ec.BCECPrivateKey; +import org.bouncycastle.jcajce.provider.asymmetric.ec.BCECPublicKey; +import org.bouncycastle.jcajce.spec.SM2ParameterSpec; +import org.bouncycastle.jce.provider.BouncyCastleProvider; +import org.bouncycastle.jce.spec.ECParameterSpec; +import org.bouncycastle.jce.spec.ECPrivateKeySpec; +import org.bouncycastle.jce.spec.ECPublicKeySpec; +import org.bouncycastle.util.BigIntegers; +import org.bouncycastle.util.encoders.Hex; + +import javax.crypto.Cipher; +import javax.crypto.spec.SecretKeySpec; +import java.io.IOException; +import java.math.BigInteger; +import java.security.*; +import java.util.Arrays; +import java.util.Base64; + +/** + * @Author: fuchengmu + * @Date: 2019-10-05 14:58 + *

+ * 用BC的注意点: + * 这个版本的BC对SM3withSM2的结果为asn1格式的r和s,如果需要直接拼接的r||s需要自己转换。下面rsAsn1ToPlainByteArray、rsPlainByteArrayToAsn1就在干这事。 + * 这个版本的BC对SM2的结果为C1||C2||C3,据说为旧标准,新标准为C1||C3||C2,用新标准的需要自己转换。下面changeC1C2C3ToC1C3C2、changeC1C3C2ToC1C2C3就在干这事。 + */ +public class EasyGmUtils { + private static X9ECParameters x9ECParameters = GMNamedCurves.getByName("sm2p256v1"); + private static ECDomainParameters ecDomainParameters = new ECDomainParameters(x9ECParameters.getCurve(), x9ECParameters.getG(), x9ECParameters.getN()); + private static ECParameterSpec ecParameterSpec = new ECParameterSpec(x9ECParameters.getCurve(), x9ECParameters.getG(), x9ECParameters.getN()); + + + public static byte[] signSm3WithSm2(byte[] msg, byte[] userId, byte[] privateKeyBytes) { + BCECPrivateKey bcecPrivateKey = getPrivatekeyFromD(BigIntegers.fromUnsignedByteArray(privateKeyBytes)); + return signSm3WithSm2(msg, userId, bcecPrivateKey); + + } + + /** + * @param msg + * @param userId + * @param privateKey + * @return r||s,直接拼接byte数组的rs + */ + public static byte[] signSm3WithSm2(byte[] msg, byte[] userId, PrivateKey privateKey) { + return rsAsn1ToPlainByteArray(signSm3WithSm2Asn1Rs(msg, userId, privateKey)); + } + + + /** + * @param msg + * @param userId + * @param privateKey + * @return rs in asn1 format + */ + public static byte[] signSm3WithSm2Asn1Rs(byte[] msg, byte[] userId, PrivateKey privateKey) { + try { + SM2ParameterSpec parameterSpec = new SM2ParameterSpec(userId); + Signature signer = BCUtils.getSignature("SM3withSM2"); +// signer.setParameter(parameterSpec); + signer.initSign(privateKey, new SecureRandom()); + signer.update(msg, 0, msg.length); + byte[] sig = signer.sign(); + return sig; + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public static boolean verifySm3WithSm2(byte[] msg, byte[] userId, byte[] rs, byte[] publicKeyBytes) { + if (publicKeyBytes.length != 64 && publicKeyBytes.length != 65) { + throw new RuntimeException("err key length"); + } + + BigInteger x, y; + if (publicKeyBytes.length > 64) { + x = BigIntegers.fromUnsignedByteArray(publicKeyBytes, 1, 32); + y = BigIntegers.fromUnsignedByteArray(publicKeyBytes, 33, 32); + } else { + x = BigIntegers.fromUnsignedByteArray(publicKeyBytes, 0, 32); + y = BigIntegers.fromUnsignedByteArray(publicKeyBytes, 32, 32); + } + BCECPublicKey bcecPublicKey = getPublickeyFromXY(x, y); + + return verifySm3WithSm2(msg, userId, rs, bcecPublicKey); + } + + /** + * @param msg + * @param userId + * @param rs r||s,直接拼接byte数组的rs + * @param publicKey + * @return + */ + public static boolean verifySm3WithSm2(byte[] msg, byte[] userId, byte[] rs, PublicKey publicKey) { + return verifySm3WithSm2Asn1Rs(msg, userId, rsPlainByteArrayToAsn1(rs), publicKey); + } + + /** + * @param msg + * @param userId + * @param rs in asn1 format + * @param publicKey + * @return + */ + public static boolean verifySm3WithSm2Asn1Rs(byte[] msg, byte[] userId, byte[] rs, PublicKey publicKey) { + try { + SM2ParameterSpec parameterSpec = new SM2ParameterSpec(userId); + Signature verifier = BCUtils.getSignature("SM3withSM2"); +// verifier.setParameter(parameterSpec); + verifier.initVerify(publicKey); + verifier.update(msg, 0, msg.length); + return verifier.verify(rs); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + /** + * bc加解密使用旧标c1||c2||c3,此方法在加密后调用,将结果转化为c1||c3||c2 + * + * @param c1c2c3 + * @return + */ + private static byte[] changeC1C2C3ToC1C3C2(byte[] c1c2c3) { + final int c1Len = (x9ECParameters.getCurve().getFieldSize() + 7) / 8 * 2 + 1; //sm2p256v1的这个固定65。可看GMNamedCurves、ECCurve代码。 + final int c3Len = 32; //new SM3Digest().getDigestSize(); + byte[] result = new byte[c1c2c3.length]; + System.arraycopy(c1c2c3, 0, result, 0, c1Len); //c1 + System.arraycopy(c1c2c3, c1c2c3.length - c3Len, result, c1Len, c3Len); //c3 + System.arraycopy(c1c2c3, c1Len, result, c1Len + c3Len, c1c2c3.length - c1Len - c3Len); //c2 + return result; + } + + + /** + * bc加解密使用旧标c1||c3||c2,此方法在解密前调用,将密文转化为c1||c2||c3再去解密 + * + * @param c1c3c2 + * @return + */ + private static byte[] changeC1C3C2ToC1C2C3(byte[] c1c3c2) { + final int c1Len = (x9ECParameters.getCurve().getFieldSize() + 7) / 8 * 2 + 1; //sm2p256v1的这个固定65。可看GMNamedCurves、ECCurve代码。 + final int c3Len = 32; //new SM3Digest().getDigestSize(); + byte[] result = new byte[c1c3c2.length]; + System.arraycopy(c1c3c2, 0, result, 0, c1Len); //c1: 0->65 + System.arraycopy(c1c3c2, c1Len + c3Len, result, c1Len, c1c3c2.length - c1Len - c3Len); //c2 + System.arraycopy(c1c3c2, c1Len, result, c1c3c2.length - c3Len, c3Len); //c3 + return result; + } + + private final static int RS_LEN = 32; + + private static byte[] bigIntToFixexLengthBytes(BigInteger rOrS) { + // for sm2p256v1, n is 00fffffffeffffffffffffffffffffffff7203df6b21c6052b53bbf40939d54123, + // r and s are the result of mod n, so they should be less than n and have length<=32 + byte[] rs = rOrS.toByteArray(); + if (rs.length == RS_LEN) { + return rs; + } else if (rs.length == RS_LEN + 1 && rs[0] == 0) { + return Arrays.copyOfRange(rs, 1, RS_LEN + 1); + } else if (rs.length < RS_LEN) { + byte[] result = new byte[RS_LEN]; + Arrays.fill(result, (byte) 0); + System.arraycopy(rs, 0, result, RS_LEN - rs.length, rs.length); + return result; + } else { + throw new RuntimeException("err rs: " + Hex.toHexString(rs)); + } + } + + /** + * BC的SM3withSM2签名得到的结果的rs是asn1格式的,这个方法转化成直接拼接r||s + * + * @param rsDer rs in asn1 format + * @return sign result in plain byte array + */ + private static byte[] rsAsn1ToPlainByteArray(byte[] rsDer) { + ASN1Sequence seq = ASN1Sequence.getInstance(rsDer); + byte[] r = bigIntToFixexLengthBytes(ASN1Integer.getInstance(seq.getObjectAt(0)).getValue()); + byte[] s = bigIntToFixexLengthBytes(ASN1Integer.getInstance(seq.getObjectAt(1)).getValue()); + byte[] result = new byte[RS_LEN * 2]; + System.arraycopy(r, 0, result, 0, r.length); + System.arraycopy(s, 0, result, RS_LEN, s.length); + return result; + } + + /** + * BC的SM3withSM2验签需要的rs是asn1格式的,这个方法将直接拼接r||s的字节数组转化成asn1格式 + * + * @param sign in plain byte array + * @return rs result in asn1 format + */ + private static byte[] rsPlainByteArrayToAsn1(byte[] sign) { + if (sign.length != RS_LEN * 2) { + throw new RuntimeException("err rs. "); + } + BigInteger r = new BigInteger(1, Arrays.copyOfRange(sign, 0, RS_LEN)); + BigInteger s = new BigInteger(1, Arrays.copyOfRange(sign, RS_LEN, RS_LEN * 2)); + ASN1EncodableVector v = new ASN1EncodableVector(); + v.add(new ASN1Integer(r)); + v.add(new ASN1Integer(s)); + try { + return new DERSequence(v).getEncoded("DER"); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public static BCECPrivateKey getPrivatekeyFromD(BigInteger d) { + ECPrivateKeySpec ecPrivateKeySpec = new ECPrivateKeySpec(d, ecParameterSpec); + return new BCECPrivateKey("EC", ecPrivateKeySpec, BouncyCastleProvider.CONFIGURATION); + } + + public static BCECPublicKey getPublickeyFromXY(BigInteger x, BigInteger y) { + ECPublicKeySpec ecPublicKeySpec = new ECPublicKeySpec(x9ECParameters.getCurve().createPoint(x, y), ecParameterSpec); + return new BCECPublicKey("EC", ecPublicKeySpec, BouncyCastleProvider.CONFIGURATION); + } + + /** + * c1||c3||c2 + * + * @param data + * @param key + * @return + */ + public static byte[] sm2Decrypt(byte[] data, PrivateKey key) { + return sm2DecryptOld(changeC1C3C2ToC1C2C3(data), key); + } + + /** + * c1||c3||c2 + * + * @param data + * @param key + * @return + */ + + public static byte[] sm2Encrypt(byte[] data, PublicKey key) { + return changeC1C2C3ToC1C3C2(sm2EncryptOld(data, key)); + } + + /** + * c1||c2||c3 + * + * @param data + * @param key + * @return + */ + public static byte[] sm2EncryptOld(byte[] data, PublicKey key) { + BCECPublicKey localECPublicKey = (BCECPublicKey) key; + ECPublicKeyParameters ecPublicKeyParameters = new ECPublicKeyParameters(localECPublicKey.getQ(), ecDomainParameters); + SM2Engine sm2Engine = new SM2Engine(); + sm2Engine.init(true, new ParametersWithRandom(ecPublicKeyParameters, new SecureRandom())); + try { + return sm2Engine.processBlock(data, 0, data.length); + } catch (InvalidCipherTextException e) { + throw new RuntimeException(e); + } + } + + /** + * c1||c2||c3 + * + * @param data + * @param key + * @return + */ + public static byte[] sm2DecryptOld(byte[] data, PrivateKey key) { + BCECPrivateKey localECPrivateKey = (BCECPrivateKey) key; + ECPrivateKeyParameters ecPrivateKeyParameters = new ECPrivateKeyParameters(localECPrivateKey.getD(), ecDomainParameters); + SM2Engine sm2Engine = new SM2Engine(); + sm2Engine.init(false, ecPrivateKeyParameters); + try { + return sm2Engine.processBlock(data, 0, data.length); + } catch (InvalidCipherTextException e) { + throw new RuntimeException(e); + } + } + + public static byte[] sm4Encrypt(byte[] keyBytes, byte[] plain) { + if (keyBytes.length != 16) { + throw new RuntimeException("err key length"); + } +// if (plain.length % 16 != 0) throw new RuntimeException("err data length"); + + try { + Key key = new SecretKeySpec(keyBytes, "SM4"); + + Cipher out = BCUtils.getCipher("SM4/ECB/PKCS7Padding"); + out.init(Cipher.ENCRYPT_MODE, key); + return out.doFinal(plain); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public static byte[] sm4Decrypt(byte[] keyBytes, byte[] cipher) { +// if (keyBytes.length != 16) throw new RuntimeException("err key length"); + if (cipher.length % 16 != 0) { + throw new RuntimeException("err data length"); + } + + try { + Key key = new SecretKeySpec(keyBytes, "SM4"); + Cipher in = BCUtils.getCipher("SM4/ECB/PKCS7Padding"); + in.init(Cipher.DECRYPT_MODE, key); + return in.doFinal(cipher); + + } catch (Exception e) { + throw new RuntimeException(e); + } + } + +} diff --git a/health_framework/src/main/java/cn/card/health/insurance/utils/SMSignUtil.java b/health_framework/src/main/java/cn/card/health/insurance/utils/SMSignUtil.java new file mode 100644 index 0000000..46293ee --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/insurance/utils/SMSignUtil.java @@ -0,0 +1,223 @@ +package cn.card.health.insurance.utils; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.github.pagehelper.util.StringUtil; + +import java.util.*; + + +public class SMSignUtil { + private static List ignoreSign = new ArrayList(); + + public static String getSignText(JSONObject jsonObject, String appSecret) { + Map signMap = new TreeMap(); + Set> entrys = jsonObject.entrySet(); + Iterator var4 = entrys.iterator(); + + while (var4.hasNext()) { + Map.Entry entry = (Map.Entry) var4.next(); + if(entry.getValue() == null){ + signMap.put(entry.getKey(), getValue(entry.getValue())); + continue; + } + if (!StringUtil.isEmpty(entry.getValue().toString()) && !ignoreSign.contains(entry.getKey())) { + signMap.put(entry.getKey(), getValue(entry.getValue())); + } + } + + ArrayList list = new ArrayList(); + Iterator var10 = signMap.entrySet().iterator(); + + while (var10.hasNext()) { + Map.Entry entry = (Map.Entry) var10.next(); + if (StringUtil.isNotEmpty(getObjString(entry.getValue()))) { + list.add((String) entry.getKey() + "=" + (String) entry.getValue() + "&"); + } + } + + int size = list.size(); + String[] arrayToSort = (String[]) list.toArray(new String[size]); + Arrays.sort(arrayToSort, String.CASE_INSENSITIVE_ORDER); + StringBuilder sb = new StringBuilder(); + + for (int i = 0; i < size; ++i) { + sb.append(arrayToSort[i]); + } + + String signText = sb.append("key=").append(appSecret).toString(); + return signText; + } + + public static String getObjString(Object object) { + return object == null ? "" : (String) object; + } + + private static String getValue(Object value) { + return value instanceof String ? getObjString(value) : treeJsonParam(value); + } + + private static String treeJsonParam(Object value) { + String jsonParam = null; + if (value instanceof Map) { + Map treeNestedMap = new TreeMap(); + Map nestedMap = (Map) value; + Iterator var4 = nestedMap.entrySet().iterator(); + + while (var4.hasNext()) { + Map.Entry nestedEntry = (Map.Entry) var4.next(); + treeNestedMap.put((String) nestedEntry.getKey(), nestedEntry.getValue()); + } + + jsonParam = JSONObject.toJSONString(treeParams(treeNestedMap)); + } else if (value instanceof ArrayList) { + ArrayList ar = (ArrayList) value; + jsonParam = JSONObject.toJSONString(treeList(ar)); + } else if (value instanceof JSONArray) { + JSONArray jarr = (JSONArray) value; + jsonParam = JSONObject.toJSONString(treeJsonArray(jarr)); + } else if(value == null) { + return null; + }else{ + jsonParam = value.toString(); + } + + return jsonParam; + } + + private static Map treeParams(Map params) { + if (params == null) { + return new TreeMap(); + } else { + Map treeParams = new TreeMap(); + Iterator var2 = params.entrySet().iterator(); + + while (true) { + while (var2.hasNext()) { + Map.Entry entry = (Map.Entry) var2.next(); + String key = (String) entry.getKey(); + Object value = entry.getValue(); + if (value instanceof Map) { + Map treeNestedMap = new TreeMap(); + Map nestedMap = (Map) value; + Iterator var8 = nestedMap.entrySet().iterator(); + + while (var8.hasNext()) { + Map.Entry nestedEntry = (Map.Entry) var8.next(); + treeNestedMap.put((String) nestedEntry.getKey(), nestedEntry.getValue()); + } + + treeParams.put(key, treeParams(treeNestedMap)); + } else if (value instanceof ArrayList) { + ArrayList ar = (ArrayList) value; + treeParams.put(key, treeList(ar)); + } else if (value instanceof JSONArray) { + JSONArray ar = (JSONArray) value; + treeParams.put(key, treeJsonArray(ar)); + } else if (!"".equals(value) && value != null) { + treeParams.put(key, value.toString()); + } + } + + return treeParams; + } + } + } + + private static JSONArray treeList(ArrayList list) { + if (list != null && list.size() != 0) { + JSONArray jsonArray = new JSONArray(); + int size = list.size(); + + for (int i = 0; i < size; ++i) { + jsonArray.add(i, list.get(i)); + } + + return treeJsonArray(jsonArray); + } else { + return null; + } + } + + private static JSONArray treeJsonArray(JSONArray jarr) { + if (jarr != null && jarr.size() != 0) { + JSONArray jsonArray = new JSONArray(); + int size = jarr.size(); + + for (int i = 0; i < size; ++i) { + Object value = jarr.get(i); + if (!(value instanceof Map)) { + if (value instanceof ArrayList) { + ArrayList ar = (ArrayList) value; + jsonArray.add(i, treeList(ar)); + } else if (value instanceof JSONArray) { + JSONArray ar = (JSONArray) value; + jsonArray.add(i, treeJsonArray(ar)); + } else if (!"".equals(value)) { + jsonArray.add(i, value.toString()); + } + } else { + Map treeNestedMap = new TreeMap(); + Map nestedMap = (Map) value; + Iterator var7 = nestedMap.entrySet().iterator(); + + while (var7.hasNext()) { + Map.Entry nestedEntry = (Map.Entry) var7.next(); + treeNestedMap.put((String) nestedEntry.getKey(), nestedEntry.getValue()); + } + + jsonArray.add(i, treeParams(treeNestedMap)); + } + } + + return jsonArray; + } else { + return null; + } + } + + static { + ignoreSign.add("signData"); + ignoreSign.add("encData"); + ignoreSign.add("extra"); + } + + /** + * 对单词列表进行冒泡排序 + * 直接操作对象地址 无需返回 + * + * @param words ["name","age"] + */ + private static void wordSort(ArrayList words) { + for (int i = words.size() - 1; i > 0; i--) { + for (int j = 0; j < i; j++) { + if (words.get(j).compareToIgnoreCase(words.get(j + 1)) > 0) { + String temp = words.get(j); + words.set(j, words.get(j + 1)); + words.set(j + 1, temp); + } + } + } + } + +// /** +// * 对单层json排序 +// * +// * @param json +// */ +// public static JSONObject getAloneKeys(JSONObject json) { +// ArrayList aloneKeys = new ArrayList<>(); +// for (String key : json.keySet()) { +// aloneKeys.add(key); +// } +// // 排序 +// wordSort(aloneKeys); +// // 整理排序后的json +// JSONObject newJson = new JSONObject(new LinkedHashMap<>()); +// for (String key : aloneKeys) { +// newJson.put(key, json.get(key)); +// } +// return newJson; +// } + +} diff --git a/health_framework/src/main/java/cn/card/health/insurance/utils/SignAndEncodeUtil.java b/health_framework/src/main/java/cn/card/health/insurance/utils/SignAndEncodeUtil.java new file mode 100644 index 0000000..3094996 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/insurance/utils/SignAndEncodeUtil.java @@ -0,0 +1,320 @@ +package cn.card.health.insurance.utils; + +import com.alibaba.fastjson.JSONObject; +import org.bouncycastle.util.encoders.Hex; +import org.springframework.stereotype.Component; +import org.springframework.util.StringUtils; +import cn.card.health.alipay.config.AlipayAppletConfig; + +import java.util.Base64; + +/** + * @description 与国家接口报文签名及加密处理工具 + * @author: cuijianglong + * @date: 2020-06-19 11:42 + */ +@Component +//@Slf4j +public class SignAndEncodeUtil { + + /** + * 字符集编码 + */ + private static final String charSetUtf8 = "UTF-8"; + + private static final String signDataParam = "signData"; + + + /** + * 验证签名 + * + * @param jsonObject + * @return + * @throws Exception + */ + public static Boolean validateSign(JSONObject jsonObject) throws Exception { + return validateSign(jsonObject, charSetUtf8); + } + /** + * 验证签名 + * + * @param jsonObject + * @return + * @throws Exception + */ + public static Boolean validateSign(JSONObject jsonObject, String inAppid, String inAppSecret, String inAppPublicKey) throws Exception { + return validateSign(jsonObject, charSetUtf8, inAppid, inAppSecret, inAppPublicKey); + } + + /** + * sm4ECB 加密 + * + * @param jsonString 明文 + * @throws Exception + * @return + */ + public static String encryptSm4ECB(String jsonString) throws Exception { + return encryptSm4ECB(jsonString, charSetUtf8); + } + /** + * sm4ECB 加密 + * + * @param jsonString 明文 + * @throws Exception + * @return + */ + public static String encryptSm4ECB(String jsonString, String ipAppid, String inAppSecret) throws Exception { + return encryptSm4ECB(jsonString, charSetUtf8, ipAppid, inAppSecret); + } + + /** + * sm4ECB 解密 + * + * @param jsonObject + * @return + * @throws Exception + */ + public static JSONObject decryptSm4ECB(String jsonObject) throws Exception { + return decryptSm4ECB(jsonObject, charSetUtf8); + } + + /** + * sm4ECB 解密 + * + * @param jsonObject + * @return + * @throws Exception + */ + public static JSONObject decryptSm4ECB(String jsonObject, String in_appid, String in_app_secret) throws Exception { + return decryptSm4ECB(jsonObject, charSetUtf8, in_appid, in_app_secret); + } + + /** + * 验证签名 + * + * @param jsonObject 待验签数据 + * @param charset 字符集 默认 UTF-8 + * @return + * @throws Exception + */ + public static Boolean validateSign(JSONObject jsonObject, String charset) throws Exception { + if (jsonObject == null) { + return false; + } + if (StringUtils.isEmpty(AlipayAppletConfig.in_appid)) { + throw new Exception("医院应用Id为空"); + } + if (StringUtils.isEmpty(AlipayAppletConfig.in_app_secret)) { + throw new Exception("ErrorCodeEnum.NOT_FUND_APP_SECRET"); + } + if (StringUtils.isEmpty(AlipayAppletConfig.in_app_private_key)) { + throw new Exception("ErrorCodeEnum.NOT_FUND_APP_PRIVATE_KEY"); + } + if (StringUtils.isEmpty(AlipayAppletConfig.in_app_public_key)) { + throw new Exception("ErrorCodeEnum.NOT_FUND_APP_PUBLIC_KEY"); + } + /** 不做验证签名*/ + if (StringUtils.isEmpty(jsonObject.getString(signDataParam))) { + return false; + } + /** 验签 */ + String signStr = SMSignUtil.getSignText(jsonObject, AlipayAppletConfig.in_app_secret); + System.out.println("待签名字符串:{}"); + System.out.println(signStr); + byte[] msg = signStr.getBytes(charset); + byte[] userIdDecode = AlipayAppletConfig.in_app_secret.getBytes(charset); + byte[] publicKey = Base64.getDecoder().decode(AlipayAppletConfig.in_app_public_key); + byte[] signData = Base64.getDecoder().decode(jsonObject.getString(signDataParam)); + if (!EasyGmUtils.verifySm3WithSm2(msg, userIdDecode, signData, publicKey)) { + return false; + } else { + return true; + } + } + + /** + * 验证签名 + * + * @param jsonObject 待验签数据 + * @param charset 字符集 默认 UTF-8 + * @return + * @throws Exception + */ + public static Boolean validateSign(JSONObject jsonObject, String charset, String inAppid, String inAppSecret, String inAppPublicKey) throws Exception { + if (jsonObject == null) { + return false; + } + /** 不做验证签名*/ + if (StringUtils.isEmpty(jsonObject.getString(signDataParam))) { + return false; + } + /** 验签 */ + String signStr = SMSignUtil.getSignText(jsonObject, inAppid); + System.out.println("待签名字符串:{}"); + System.out.println(signStr); + byte[] msg = signStr.getBytes(charset); + byte[] userIdDecode = inAppSecret.getBytes(charset); + byte[] publicKey = Base64.getDecoder().decode(inAppPublicKey); + byte[] signData = Base64.getDecoder().decode(jsonObject.getString(signDataParam)); + if (!EasyGmUtils.verifySm3WithSm2(msg, userIdDecode, signData, publicKey)) { + return false; + } else { + return true; + } + } + + /** + * 生成签名 + * + * @param jsonObject + * @return + * @throws Exception + */ + public static String createSignEncoderBase64(JSONObject jsonObject) throws Exception { + return createSignEncoderBase64(jsonObject, charSetUtf8); + } + + /** + * 生成签名 + * + * @param jsonObject + * @return + * @throws Exception + */ + public static String createSignEncoderBase64(JSONObject jsonObject, String inAppSecret, String inAppPrivateKey) throws Exception { + return createSignEncoderBase64(jsonObject, charSetUtf8, inAppSecret, inAppPrivateKey); + } + + /** + * 生成签名 + * + * @param jsonObject + * @param charset + * @return + * @throws Exception + */ + public static String createSignEncoderBase64(JSONObject jsonObject, String charset) throws Exception { + if (StringUtils.isEmpty(AlipayAppletConfig.in_app_secret)) { + throw new Exception("11"); + } + if (StringUtils.isEmpty(AlipayAppletConfig.in_app_private_key)) { + throw new Exception("ErrorCodeEnum.NOT_FUND_APP_PRIVATE_KEY"); + } + /** 获取签名串 */ + String signStr = SMSignUtil.getSignText(jsonObject, AlipayAppletConfig.in_app_secret); + byte[] signBytes = signStr.getBytes(charset); + byte[] userId = AlipayAppletConfig.in_app_secret.getBytes(); + byte[] privateKey = Base64.getDecoder().decode(AlipayAppletConfig.in_app_private_key); + String responseSign = Base64.getEncoder().encodeToString(EasyGmUtils.signSm3WithSm2(signBytes, userId, privateKey)); +// log.info("【 待签名数据: {} , 生成签名 :{} 】", signStr,responseSign); + return responseSign; + } + + /** + * 生成签名 + * + * @param jsonObject + * @param charset + * @return + * @throws Exception + */ + public static String createSignEncoderBase64(JSONObject jsonObject, String charset, String inAppSecret, String inAppPrivateKey) throws Exception { + /** 获取签名串 */ + String signStr = SMSignUtil.getSignText(jsonObject, inAppSecret); + byte[] signBytes = signStr.getBytes(charset); + byte[] userId = inAppSecret.getBytes(); + byte[] privateKey = Base64.getDecoder().decode(inAppPrivateKey); + String responseSign = Base64.getEncoder().encodeToString(EasyGmUtils.signSm3WithSm2(signBytes, userId, privateKey)); +// log.info("【 待签名数据: {} , 生成签名 :{} 】", signStr,responseSign); + return responseSign; + } + + + /** + * sm4ECB 加密 + * + * @param jsonString 明文 + * @param charSet + * @return + * @throws Exception + */ + public static String encryptSm4ECB(String jsonString, String charSet) throws Exception { + if (StringUtils.isEmpty(jsonString)|| StringUtils.isEmpty(charSet)) { + return null; + } + /** 用appId加密appSecret获取新秘钥 */ + byte[] appSecretEncData = EasyGmUtils.sm4Encrypt(AlipayAppletConfig.in_appid.substring(0, 16).getBytes(charSet), AlipayAppletConfig.in_app_secret.getBytes(charSet)); + /** 新秘钥串 */ + byte[] secKey = Hex.toHexString(appSecretEncData).toUpperCase().substring(0, 16).getBytes(charSet); + /** 加密0数据 */ + String encryptDataStr = Hex.toHexString(EasyGmUtils.sm4Encrypt(secKey, jsonString.getBytes(charSet))).toUpperCase(); +// log.info("加密key:{}", Hex.toHexString(appSecretEncData).toUpperCase().substring(0, 16)); +// log.info("明文:{} ", jsonString); +// log.info("加密数据:{}", encryptDataStr); + return encryptDataStr; + } + + + + /** + * sm4ECB 加密 + * + * @param jsonString 明文 + * @param charSet + * @return + * @throws Exception + */ + public static String encryptSm4ECB(String jsonString, String charSet, String inAppid, String inAppSecret) throws Exception { + if (StringUtils.isEmpty(jsonString)|| StringUtils.isEmpty(charSet)) { + return null; + } + /** 用appId加密appSecret获取新秘钥 */ + byte[] appSecretEncData = EasyGmUtils.sm4Encrypt(inAppid.substring(0, 16).getBytes(charSet), inAppSecret.getBytes(charSet)); + /** 新秘钥串 */ + byte[] secKey = Hex.toHexString(appSecretEncData).toUpperCase().substring(0, 16).getBytes(charSet); + /** 加密0数据 */ + String encryptDataStr = Hex.toHexString(EasyGmUtils.sm4Encrypt(secKey, jsonString.getBytes(charSet))).toUpperCase(); +// log.info("加密key:{}", Hex.toHexString(appSecretEncData).toUpperCase().substring(0, 16)); +// log.info("明文:{} ", jsonString); +// log.info("加密数据:{}", encryptDataStr); + return encryptDataStr; + } + + /** + * sm4ECB 解密 + * + * @param jsonObject 密文 + * @param charSet 字符集 + * @return + * @throws Exception + */ + public static JSONObject decryptSm4ECB(String jsonObject, String charSet) throws Exception { + /** 解密key */ + long start = System.currentTimeMillis(); + byte[] appSecretEncDataDecode = EasyGmUtils.sm4Encrypt(AlipayAppletConfig.in_appid.substring(0, 16).getBytes(charSet), AlipayAppletConfig.in_app_secret.getBytes(charSet)); + byte[] secKeyDecode = Hex.toHexString(appSecretEncDataDecode).toUpperCase().substring(0, 16).getBytes(charSet); + String rawDataStr = new String(EasyGmUtils.sm4Decrypt(secKeyDecode, Hex.decode(jsonObject))); + long end = System.currentTimeMillis(); +// log.info("解密key:{} ,密文数据:{} ,解密后数据:{} ,解密耗时:{}",Hex.toHexString(appId.substring(0, 16).getBytes(charSet)).toUpperCase().substring(0, 16),jsonObject,rawDataStr,end-start); + return JSONObject.parseObject(rawDataStr); + } + + /** + * sm4ECB 解密 + * + * @param jsonObject 密文 + * @param charSet 字符集 + * @return + * @throws Exception + */ + public static JSONObject decryptSm4ECB(String jsonObject, String charSet,String in_appid, String in_app_secret) throws Exception { + /** 解密key */ + long start = System.currentTimeMillis(); + byte[] appSecretEncDataDecode = EasyGmUtils.sm4Encrypt(in_appid.substring(0, 16).getBytes(charSet), in_app_secret.getBytes(charSet)); + byte[] secKeyDecode = Hex.toHexString(appSecretEncDataDecode).toUpperCase().substring(0, 16).getBytes(charSet); + String rawDataStr = new String(EasyGmUtils.sm4Decrypt(secKeyDecode, Hex.decode(jsonObject)), charSet); + long end = System.currentTimeMillis(); +// log.info("解密key:{} ,密文数据:{} ,解密后数据:{} ,解密耗时:{}",Hex.toHexString(appId.substring(0, 16).getBytes(charSet)).toUpperCase().substring(0, 16),jsonObject,rawDataStr,end-start); + return JSONObject.parseObject(rawDataStr); + } +} diff --git a/health_framework/src/main/java/cn/card/health/mapper/HealthCardApptokenMapper.java b/health_framework/src/main/java/cn/card/health/mapper/HealthCardApptokenMapper.java new file mode 100644 index 0000000..bc19e9d --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/mapper/HealthCardApptokenMapper.java @@ -0,0 +1,43 @@ +package cn.card.health.mapper; + +import org.apache.ibatis.annotations.Insert; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.annotations.Update; + +public interface HealthCardApptokenMapper { + /** + * 插入apptoekn + * + * @param apptoken + * @param expiresIn + * @return + */ + @Insert("INSERT INTO yc_healthCard_apptoken ( apptoken, expiresIn ) values" + "(#{apptoken}, #{expiresIn}) ") + int insertHealthCardApptoken(@Param("apptoken") String apptoken, @Param("expiresIn") Long expiresIn); + + /** + * 查询apptoken + * + * @return + */ + @Select("SELECT apptoken FROM yc_healthCard_apptoken where id=1") + String findHealthCardApptoken(); + + /** + * 查询expiresIn + * + * @return + */ + @Select("SELECT expiresIn FROM yc_healthCard_apptoken where id=1") + Long findHealthCardExpiresIn(); + + /** + * 更新apptoken + * + * @return + */ + @Update("UPDATE yc_healthCard_apptoken " + "SET apptoken=#{apptoken}," + "expiresIn=#{expiresIn} " + "where id=1") + int updateHealthCardApptoken(@Param("apptoken") String apptoken, @Param("expiresIn") Long expiresIn); + +} diff --git a/health_framework/src/main/java/cn/card/health/mapper/HealthCardInfoMapper.java b/health_framework/src/main/java/cn/card/health/mapper/HealthCardInfoMapper.java new file mode 100644 index 0000000..57b5d7a --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/mapper/HealthCardInfoMapper.java @@ -0,0 +1,129 @@ +//package cn.card.health.mapper; +// +//import com.tencent.healthcard.model.HealthCardInfo; +//import org.apache.ibatis.annotations.*; +// +//import java.util.List; +// +///** +// * 电子健康卡 +// * +// * @author xinggm +// * @date 2021年8月23日 +// */ +//@Mapper +//public interface HealthCardInfoMapper { +// /* +// * 插入电子健康卡个人基本信息 +// * +// * @return +// */ +// @Insert("INSERT INTO yc_healthCard_info (" + "name,\n" + "gender,\n" + "nation,\n" + "birthday,\n" + "idNumber,\n" +// + "address,\n" + "phone1,\n" + "phone2,\n" + "qrCodeText,\n" + "openId,\n" + "idType,\n" + "phid,\n" +// + "patid,\n" + "healthCardId,del_flag,createtime )" + "values" + "(#{name},\n" + "#{gender},\n" + "#{nation},\n" +// + "#{birthday},\n" + "#{idNumber},\n" + "#{address},\n" + "#{phone1},\n" + "#{phone2},\n" +// + "#{qrCodeText},\n" + "#{openId},\n" + "#{idType},\n" + "#{phid},\n" + "#{patid},\n" + "#{healthCardId}" + ",1,sysdate())") +// int insertHealthCardInfo(HealthCardInfo healthCardInfo); +// +// /** +// * 根据openId查询健康卡信息 +// * +// * @param openId +// * @return +// */ +// @Select("SELECT name, gender, nation, birthday, idNumber, address, phone1, phone2, qrCodeText, openId, idType, phid, patid, healthCardId, is_check as isCheck FROM yc_healthCard_info WHERE openId=#{openId} and del_flag=1") +// List findHealthCardInfoByOpenId(@Param("openId") String openId); +// +// /** +// * 根据idNumber查询健康卡是否已注册 +// * +// * @param idNumber +// * @return +// */ +// @Select("SELECT * FROM yc_healthCard_info WHERE idNumber=#{idNumber} AND openId=#{openId} and del_flag=1") +// HealthCardInfo findHealthCardInfoByIdNumber(@Param("idNumber") String idNumber, @Param("openId") String openId); +// +// /** +// * 根据idNumber查询健康卡是否已注册 +// * +// * @param idNumber +// * @return +// */ +// @Select("SELECT * FROM yc_healthCard_info WHERE idNumber=#{idNumber} AND openId=#{openId}") +// HealthCardInfo findHealthCardInfo(@Param("idNumber") String idNumber, @Param("openId") String openId); +// +// /** +// * 根据删除数据库中的健康卡 +// * +// * @param qrCodeText +// * @return +// */ +//// @Delete("DELETE FROM yc_healthCard_info WHERE qrCodeText=#{qrCodeText}") +// @Update("UPDATE yc_healthCard_info set del_flag=2, is_check=0 where openId=#{openId} and idNumber=#{idNumber}") +// Integer delHealthCardInfoByIdNumber(@Param("openId") String openId, @Param("idNumber") String idNumber); +// +// @Update("UPDATE yc_healthCard_info set del_flag=2, is_check=0 where id=#{id}") +// Integer deleteHealthCardById(@Param("id") Long id); +// +// @Update("UPDATE yc_healthCard_info set del_flag=1 where openId=#{openId} and idNumber=#{idNumber}") +// Integer recoveryHealthCardInfoByIdNumber(@Param("openId") String openId, @Param("idNumber") String idNumber); +// +// @Update("update yc_healthCard_info set patid=#{patId}, is_check=#{selected} where idNumber=#{idNumber} and openId=#{openId}") +// Integer updatePatId(@Param("openId") String openId, @Param("idNumber") String idNumber, @Param("patId") String patId, @Param("selected") int selected); +// +// /** +// * 根据QRCode查询健康卡 +// * +// * @param qrCode +// * @return +// */ +// @Select("SELECT * FROM yc_healthCard_info WHERE qrCodeText=#{qrCode} AND del_flag=1 limit 0, 1") +// HealthCardInfo findHealthCardInfoByQRCode(@Param("qrCode") String qrCode); +// +// /** +// * 根据PatId获取信息 +// * +// * @param patId +// * @return +// */ +// @Select("SELECT * FROM yc_healthCard_info WHERE patid=#{patId} limit 0, 1") +// HealthCardInfo findHealthCardInfoByPatientId(@Param("patId") String patId); +// +// /** +// * 根据PatId获取信息 +// * +// * @param patId +// * @return +// */ +// @Select("SELECT * FROM yc_healthCard_info WHERE patid=#{patId} and openid=#{openid} limit 0, 1") +// HealthCardInfo findHealthCardInfoByOpenidAndPatientId(@Param("openid") String openid, @Param("patId") String patId); +// +// /** +// * 更新默认健康卡 +// * +// * @param openid +// * @param patId +// * @return +// */ +// @Update("update yc_healthCard_info set is_check = 1 WHERE openId=#{openid} AND patid=#{patId}") +// Integer updateSelectedCard(@Param("openid") String openid, @Param("patId") String patId); +// +// /** +// * 重置默认健康卡 +// * +// * @param openid +// * @param patId +// * @return +// */ +// @Update("update yc_healthCard_info set is_check = 0 WHERE openId=#{openid} AND patid<>#{patId}") +// Integer resetSelectedCard(@Param("openid") String openid, @Param("patId") String patId); +// +// /** +// * 查询微信的科室代码 +// * +// * @param deptId +// * @return +// */ +// @Select("SELECT department FROM yc_department WHERE deptId=#{deptId} limit 0, 1") +// public String getWechatDepartment(@Param("deptId") String deptId); +//} diff --git a/health_framework/src/main/java/cn/card/health/mapper/HealthCardTempMapper.java b/health_framework/src/main/java/cn/card/health/mapper/HealthCardTempMapper.java new file mode 100644 index 0000000..41e2887 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/mapper/HealthCardTempMapper.java @@ -0,0 +1,85 @@ +//package cn.card.health.mapper; +// +//import com.tencent.healthcard.model.HealthCardInfo; +//import org.apache.ibatis.annotations.Insert; +//import org.apache.ibatis.annotations.Param; +//import org.apache.ibatis.annotations.Select; +//import org.apache.ibatis.annotations.Update; +// +///** +// * 健康卡临时数据 +// * +// * @author xinggm +// * @date 2021年5月27日 +// */ +//public interface HealthCardTempMapper { +// /** +// * 更新wechatCode +// * +// * @param wechatCode +// * @param openId +// * @return +// */ +// @Update("UPDATE yc_healthCard_temp " + "SET wechatCode=#{wechatCode} " + "WHERE openId=#{openId}") +// int updateHealthCardInfoWechatCode(@Param("wechatCode") String wechatCode, @Param("openId") String openId); +// +// /** +// * 添加wechatCode +// * +// * @param wechatCode +// * @param openId +// * @return +// */ +// @Insert("INSERT INTO yc_healthCard_temp " + "( wechatCode,openId) values" + "(#{wechatCode},#{openId}) ") +// int insertHealthCardInfoWechatCode(@Param("wechatCode") String wechatCode, @Param("openId") String openId); +// +// /** +// * 更新HealthCode +// * +// * @param healthCode +// * @param openId +// * @return +// */ +// @Update("UPDATE yc_healthCard_temp " + "SET healthCode=#{healthCode} " + "WHERE openId=#{openId}") +// int updateHealthCardInfoHealthCode(@Param("healthCode") String healthCode, @Param("openId") String openId); +// +// /** +// * 添加healthCode +// * +// * @param healthCode +// * @param openId +// * @return +// */ +// @Insert("INSERT INTO yc_healthCard_temp " + "( healthCode,openId) values" + "(#{healthCode},#{openId}) ") +// int insertHealthCardInfoHealthCode(@Param("healthCode") String healthCode, @Param("openId") String openId); +// +// /** +// * 添加临时信息 +// * +// * @param healthCardInfo +// * @return +// */ +// @Insert("INSERT INTO yc_healthCard_temp (name, idNumber, nation, openId, wechatCode, address, phone1, phone2, gender, relation, idType) values " + +// "(#{name},#{idNumber},#{nation},#{openId},#{wechatCode},#{address},#{phone1},#{phone2},#{gender},#{relation},#{idType})") +// int insertHealthCardTemp(HealthCardInfo healthCardInfo); +// +// /** +// * 跟新临时信息 +// * +// * @param healthCardInfo +// * @return +// */ +// @Update("UPDATE yc_healthCard_temp SET name=#{name},nation=#{nation},wechatCode=#{wechatCode},address=#{address},phone1=#{phone1},phone2=#{phone2},gender=#{gender},relation=#{relation},idType=#{idType}" +// + "WHERE openId=#{openId} and idNumber=#{idNumber}") +// int updateHealthCardTemp(HealthCardInfo healthCardInfo); +// +// /** +// * 查询临时信息 +// * +// * @param openId +// * @return +// */ +// @Select("SELECT * FROM yc_healthCard_temp WHERE openId=#{openId} and idNumber=#{idNumber}") +// HealthCardInfo findHealthCardTempByOpenId(@Param("openId") String openId, @Param("idNumber") String idNumber); +// +//} diff --git a/health_framework/src/main/java/cn/card/health/mapper/insurance/MkAppletRequestMapper.java b/health_framework/src/main/java/cn/card/health/mapper/insurance/MkAppletRequestMapper.java new file mode 100644 index 0000000..77d4987 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/mapper/insurance/MkAppletRequestMapper.java @@ -0,0 +1,62 @@ +package cn.card.health.mapper.insurance; + +import cn.card.health.bean.insurance.MkAppletRequest; + +import java.util.List; + +/** + * 支付宝小程序请求Mapper接口 + * + * @author ruoyi + * @date 2022-10-15 + */ +public interface MkAppletRequestMapper +{ + /** + * 查询支付宝小程序请求 + * + * @param mkId 支付宝小程序请求主键 + * @return 支付宝小程序请求 + */ + public MkAppletRequest selectMkAppletRequestByMkId(Long mkId); + + /** + * 查询支付宝小程序请求列表 + * + * @param mkAppletRequest 支付宝小程序请求 + * @return 支付宝小程序请求集合 + */ + public List selectMkAppletRequestList(MkAppletRequest mkAppletRequest); + + /** + * 新增支付宝小程序请求 + * + * @param mkAppletRequest 支付宝小程序请求 + * @return 结果 + */ + public Integer insertMkAppletRequest(MkAppletRequest mkAppletRequest); + + /** + * 修改支付宝小程序请求 + * + * @param mkAppletRequest 支付宝小程序请求 + * @return 结果 + */ + public int updateMkAppletRequest(MkAppletRequest mkAppletRequest); + + /** + * 删除支付宝小程序请求 + * + * @param mkId 支付宝小程序请求主键 + * @return 结果 + */ + public int deleteMkAppletRequestByMkId(Long mkId); + + /** + * 批量删除支付宝小程序请求 + * + * @param mkIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteMkAppletRequestByMkIds(Long[] mkIds); +} diff --git a/health_framework/src/main/java/cn/card/health/mapper/insurance/MkInsurancePayMapper.java b/health_framework/src/main/java/cn/card/health/mapper/insurance/MkInsurancePayMapper.java new file mode 100644 index 0000000..577af51 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/mapper/insurance/MkInsurancePayMapper.java @@ -0,0 +1,68 @@ +package cn.card.health.mapper.insurance; + +import cn.card.health.bean.insurance.MkInsurancePay; +import java.util.List; + +/** + * 医保支付Mapper接口 + * + * @author ruoyi + * @date 2022-10-24 + */ +public interface MkInsurancePayMapper +{ + /** + * 查询医保支付 + * + * @param mkId 医保支付主键 + * @return 医保支付 + */ + public MkInsurancePay selectMkInsurancePayByMkId(Long mkId); + + /** + * 查询医保支付列表 + * + * @param mkInsurancePay 医保支付 + * @return 医保支付集合 + */ + public List selectMkInsurancePayList(MkInsurancePay mkInsurancePay); + + /** + * 新增医保支付 + * + * @param mkInsurancePay 医保支付 + * @return 结果 + */ + public int insertMkInsurancePay(MkInsurancePay mkInsurancePay); + + /** + * 修改医保支付 + * + * @param mkInsurancePay 医保支付 + * @return 结果 + */ + public int updateMkInsurancePay(MkInsurancePay mkInsurancePay); + + /** + * 删除医保支付 + * + * @param mkId 医保支付主键 + * @return 结果 + */ + public int deleteMkInsurancePayByMkId(Long mkId); + + /** + * 批量删除医保支付 + * + * @param mkIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteMkInsurancePayByMkIds(Long[] mkIds); + + /** + * 查询单个记录 + * @param mkInsurancePay + * @return + */ + public MkInsurancePay selectMkInsurancePayInfo(MkInsurancePay mkInsurancePay); +} diff --git a/health_framework/src/main/java/cn/card/health/mapper/order/YcMsgMapper.java b/health_framework/src/main/java/cn/card/health/mapper/order/YcMsgMapper.java new file mode 100644 index 0000000..0e3d328 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/mapper/order/YcMsgMapper.java @@ -0,0 +1,33 @@ +package cn.card.health.mapper.order; + +import java.util.List; + +import cn.card.health.bean.order.YcMsg; + +/** + * 消息发送 + * + * @author xinggm + * @email + * @date 2021-07-22 10:10:34 + */ +public interface YcMsgMapper { + /** 新增 */ + public int insertYcMsg(YcMsg ycMsg); + + /** 删除 */ + public int deleteYcMsg(Long id); + + /** 更新 */ + public int updateYcMsg(YcMsg ycMsg); + + /** 根据主键查询 */ + public YcMsg selectYcMsgById(Long id); + + /** 查询单条 */ + public YcMsg selectYcMsg(YcMsg ycMsg); + + /** 查询列表 */ + public List selectListYcMsg(YcMsg ycMsg); + +} diff --git a/health_framework/src/main/java/cn/card/health/mapper/order/YcPayCallbackMapper.java b/health_framework/src/main/java/cn/card/health/mapper/order/YcPayCallbackMapper.java new file mode 100644 index 0000000..10b26f9 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/mapper/order/YcPayCallbackMapper.java @@ -0,0 +1,70 @@ +package cn.card.health.mapper.order; + +import cn.card.health.bean.order.YcPayCallback; +import org.apache.ibatis.annotations.Insert; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.Date; +import java.util.List; + +/** + * 微信调用 + * + * @author xinggm + * @email + * @date 2021-07-08 15:32:53 + */ +@Mapper +public interface YcPayCallbackMapper { + /** + * 新增 + */ + public int insertYcPayCallback(YcPayCallback ycPayCallback); + + /** + * 删除 + */ + public int deleteYcPayCallback(Long id); + + /** + * 更新 + */ + public int updateYcPayCallback(YcPayCallback ycPayCallback); + + /** + * 根据主键查询 + */ + public YcPayCallback selectYcPayCallbackById(Long id); + + /** + * 查询单条 + */ + public YcPayCallback selectYcPayCallback(YcPayCallback ycPayCallback); + + /** + * 查询列表 + */ + public List selectListYcPayCallback(YcPayCallback ycPayCallback); + + /** + * 查询微信的科室代码 + * + * @param deptId + * @return + */ + @Select("SELECT department FROM yc_department WHERE deptId=#{deptId} limit 0, 1") + public String getWechatDepartment(@Param("deptId") String deptId); + + /** + * 支付加锁 + * + * @param orderno + * @param createTime + * @return + */ + //@Insert("insert into yc_pay_lock select #{orderno}, #{payType}, #{createTime} from dual where not exists (select orderno from yc_pay_lock where orderno=#{orderno})") + @Insert("insert into yc_pay_lock(orderno, pay_type, create_time) values(#{orderno}, #{payType}, #{createTime})") + Integer payLock(String orderno, String payType, Date createTime); +} diff --git a/health_framework/src/main/java/cn/card/health/mapper/user/YcAuthorityMapper.java b/health_framework/src/main/java/cn/card/health/mapper/user/YcAuthorityMapper.java new file mode 100644 index 0000000..2e10c87 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/mapper/user/YcAuthorityMapper.java @@ -0,0 +1,32 @@ +package cn.card.health.mapper.user; + +import cn.card.health.bean.user.YcAuthority; +import java.util.List; + +/** + * 授权表 + * + * @author xinggm + * @email + * @date 2021-08-30 17:59:54 + */ +public interface YcAuthorityMapper { + /** 新增 */ + public int insertYcAuthority(YcAuthority ycAuthority); + + /** 删除 */ + public int deleteYcAuthority(Long id); + + /** 更新 */ + public int updateYcAuthority(YcAuthority ycAuthority); + + /** 根据主键查询 */ + public YcAuthority selectYcAuthorityById(Long id); + + /** 查询单条 */ + public YcAuthority selectYcAuthority(YcAuthority ycAuthority); + + /** 查询列表 */ + public List selectListYcAuthority(YcAuthority ycAuthority); + +} diff --git a/health_framework/src/main/java/cn/card/health/mapper/user/YcInhospPatientMapper.java b/health_framework/src/main/java/cn/card/health/mapper/user/YcInhospPatientMapper.java new file mode 100644 index 0000000..71c80ae --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/mapper/user/YcInhospPatientMapper.java @@ -0,0 +1,32 @@ +package cn.card.health.mapper.user; + +import cn.card.health.bean.user.YcInhospPatient; +import java.util.List; + +/** + * 住院病人信息 + * + * @author xinggm + * @email + * @date 2021-09-04 09:31:54 + */ +public interface YcInhospPatientMapper { + /** 新增 */ + public int insertYcInhospPatient(YcInhospPatient ycInhospPatient); + + /** 删除 */ + public int deleteYcInhospPatient(Long id); + + /** 更新 */ + public int updateYcInhospPatient(YcInhospPatient ycInhospPatient); + + /** 根据主键查询 */ + public YcInhospPatient selectYcInhospPatientById(Long id); + + /** 查询单条 */ + public YcInhospPatient selectYcInhospPatient(YcInhospPatient ycInhospPatient); + + /** 查询列表 */ + public List selectListYcInhospPatient(YcInhospPatient ycInhospPatient); + +} diff --git a/health_framework/src/main/java/cn/card/health/mapper/user/YcOAuthMapper.java b/health_framework/src/main/java/cn/card/health/mapper/user/YcOAuthMapper.java new file mode 100644 index 0000000..80f09a2 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/mapper/user/YcOAuthMapper.java @@ -0,0 +1,47 @@ +package cn.card.health.mapper.user; + +import cn.card.health.bean.user.YcOAuth; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 用户表 + * + * @author xinggm + * @email + * @date 2021-08-24 15:41:43 + */ +@Mapper +public interface YcOAuthMapper { + /** + * 新增 + */ + public int insertYcOAuth(YcOAuth auth); + + /** + * 删除 + */ + public int deleteYcOAuth(Long id); + + /** + * 更新 + */ + public int updateYcOAuth(YcOAuth auth); + + /** + * 根据主键查询 + */ + public YcOAuth selectYcOAuthById(Long id); + + /** + * 查询单条 + */ + public YcOAuth selectYcOAuth(YcOAuth auth); + + /** + * 查询列表 + */ + public List selectListYcOAuth(YcOAuth auth); + +} diff --git a/health_framework/src/main/java/cn/card/health/mapper/user/YcPatientMapper.java b/health_framework/src/main/java/cn/card/health/mapper/user/YcPatientMapper.java new file mode 100644 index 0000000..639304e --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/mapper/user/YcPatientMapper.java @@ -0,0 +1,61 @@ +package cn.card.health.mapper.user; + +import cn.card.health.bean.hospital.YcPatient; +import org.apache.ibatis.annotations.Delete; +import org.apache.ibatis.annotations.Insert; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * HIS病人健康卡对照表 + * + * @author xinggm + * @email + * @date 2021-07-14 09:05:22 + */ +public interface YcPatientMapper { + /** + * 新增 + */ + public int insertYcPatient(YcPatient ycPatient); + + /** + * 删除 + */ + public int deleteYcPatient(Long id); + + /** + * 更新 + */ + public int updateYcPatient(YcPatient ycPatient); + + /** + * 根据主键查询 + */ + public YcPatient selectYcPatientById(Long id); + + /** + * 查询单条 + */ + public YcPatient selectYcPatient(YcPatient ycPatient); + + /** + * 查询列表 + */ + public List selectListYcPatient(YcPatient ycPatient); + + /** + * 通过条件查询单条 + */ + public YcPatient selectYcPatientByMap(Map params); + + /*注册加锁*/ + @Insert("insert into yc_regist_lock select #{idNumber} from dual where not exists (select idNumber from yc_regist_lock where idNumber=#{idNumber})") + Integer registerLock(@Param("idNumber") String idNumber); + + /*注册删除锁*/ + @Delete("delete from yc_regist_lock where idNumber=#{idNumber}") + Integer registerUnlock(@Param("idNumber") String idNumber); +} diff --git a/health_framework/src/main/java/cn/card/health/mapper/user/YcUserMapper.java b/health_framework/src/main/java/cn/card/health/mapper/user/YcUserMapper.java new file mode 100644 index 0000000..1a60fb7 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/mapper/user/YcUserMapper.java @@ -0,0 +1,52 @@ +package cn.card.health.mapper.user; + +import cn.card.health.bean.user.YcUser; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 用户表 + * + * @author xinggm + * @email + * @date 2021-08-28 10:47:55 + */ +@Mapper +public interface YcUserMapper { + /** + * 新增 + */ + public int insertYcUser(YcUser ycUser); + + /** + * 删除 + */ + public int deleteYcUser(Long id); + + /** + * 更新 + */ + public int updateYcUser(YcUser ycUser); + + /** + * 根据主键查询 + */ + public YcUser selectYcUserById(Long id); + + /** + * 查询单条 + */ + public YcUser selectYcUser(YcUser ycUser); + + /** + * 查询列表 + */ + public List selectListYcUser(YcUser ycUser); + + /** + * 通过用户名查询 + */ + public YcUser loadUserByUsername(String username); + +} diff --git a/health_framework/src/main/java/cn/card/health/oauth/OAuth2Configuration.java b/health_framework/src/main/java/cn/card/health/oauth/OAuth2Configuration.java new file mode 100644 index 0000000..e8cf32f --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/oauth/OAuth2Configuration.java @@ -0,0 +1,101 @@ +//package cn.card.health.oauth; +// +//import javax.sql.DataSource; +// +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.beans.factory.annotation.Qualifier; +//import org.springframework.boot.context.properties.source.ConfigurationPropertySources; +//import org.springframework.context.EnvironmentAware; +//import org.springframework.context.annotation.Bean; +//import org.springframework.context.annotation.Configuration; +//import org.springframework.core.env.Environment; +//import org.springframework.security.authentication.AuthenticationManager; +//import org.springframework.security.config.annotation.web.builders.HttpSecurity; +//import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer; +//import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter; +//import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer; +//import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer; +//import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter; +//import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerEndpointsConfigurer; +//import org.springframework.security.oauth2.provider.token.TokenStore; +//import org.springframework.security.oauth2.provider.token.store.JdbcTokenStore; +//import org.springframework.security.web.util.matcher.AntPathRequestMatcher; +// +//import cn.card.health.oauth.security.CustomAuthenticationEntryPoint; +//import cn.card.health.oauth.security.CustomLogoutSuccessHandler; +// +//@Configuration +//public class OAuth2Configuration { +// +// @Configuration +// @EnableResourceServer +// protected static class ResourceServerConfiguration extends ResourceServerConfigurerAdapter { +// +// @Autowired +// private CustomAuthenticationEntryPoint customAuthenticationEntryPoint; +// @Autowired +// private CustomLogoutSuccessHandler customLogoutSuccessHandler; +// +// @Override +// public void configure(HttpSecurity http) throws Exception { +// +// http.exceptionHandling().authenticationEntryPoint(customAuthenticationEntryPoint).and().logout() +// .logoutUrl("/oauth/logout").logoutSuccessHandler(customLogoutSuccessHandler).and().csrf() +// .requireCsrfProtectionMatcher(new AntPathRequestMatcher("/oauth/authorize")).disable().headers() +// .frameOptions().disable() +//// .sessionCreationPolicy(SessionCreationPolicy.STATELESS) +// .and().authorizeRequests().antMatchers("/hello/").permitAll().antMatchers("/secure/**") +// .authenticated(); +// +// } +// +// @Configuration +// @EnableAuthorizationServer +// protected static class AuthorizationServerConfiguration extends AuthorizationServerConfigurerAdapter +// implements EnvironmentAware { +// +// private static final String ENV_OAUTH = "authentication.oauth."; +// private static final String PROP_CLIENTID = "clientid"; +// private static final String PROP_SECRET = "secret"; +// private static final String PROP_TOKEN_VALIDITY_SECONDS = "tokenValidityInSeconds"; +// +//// private RelaxedPropertyResolver propertyResolver; +// +// @Autowired +// private DataSource dataSource; +// +// @Bean +// public TokenStore tokenStore() { +// return new JdbcTokenStore(dataSource); +// } +// +// @Autowired +// @Qualifier("authenticationManagerBean") +// private AuthenticationManager authenticationManager; +// +// @Override +// public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception { +// endpoints.tokenStore(tokenStore()).authenticationManager(authenticationManager); +// } +// +// @Override +// public void configure(ClientDetailsServiceConfigurer clients) throws Exception { +//// clients +//// .inMemory() +//// .withClient(propertyResolver.getProperty(PROP_CLIENTID)) +//// .scopes("read", "write") +//// .authorities(Authorities.ROLE_ADMIN.name(), Authorities.ROLE_USER.name()) +//// .authorizedGrantTypes("password", "refresh_token") +//// .secret(propertyResolver.getProperty(PROP_SECRET)) +//// .accessTokenValiditySeconds(propertyResolver.getProperty(PROP_TOKEN_VALIDITY_SECONDS, Integer.class, 1800)); +// } +// +// @Override +// public void setEnvironment(Environment environment) { +//// this.propertyResolver = new RelaxedPropertyResolver(environment, ENV_OAUTH); +//// +//// new Binder(ConfigurationPropertySources.from(sources)).bind("") +// } +// } +// } +//} diff --git a/health_framework/src/main/java/cn/card/health/oauth/SecurityConfiguration.java b/health_framework/src/main/java/cn/card/health/oauth/SecurityConfiguration.java new file mode 100644 index 0000000..84aa67d --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/oauth/SecurityConfiguration.java @@ -0,0 +1,67 @@ +//package cn.card.health.oauth; +// +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.context.annotation.Bean; +//import org.springframework.context.annotation.Configuration; +//import org.springframework.security.access.expression.method.MethodSecurityExpressionHandler; +//import org.springframework.security.authentication.AuthenticationManager; +//import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; +//import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; +//import org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration; +//import org.springframework.security.config.annotation.web.builders.WebSecurity; +//import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +//import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +//import org.springframework.security.core.userdetails.UserDetailsService; +//import org.springframework.security.crypto.password.PasswordEncoder; +//import org.springframework.security.crypto.password.StandardPasswordEncoder; +//import org.springframework.security.oauth2.provider.expression.OAuth2MethodSecurityExpressionHandler; +// +//@Configuration +//@EnableWebSecurity +//public class SecurityConfiguration extends WebSecurityConfigurerAdapter { +// +// @Autowired +// private UserDetailsService userDetailsService; +// +// +// @Bean +// public PasswordEncoder passwordEncoder() { +// +// return new StandardPasswordEncoder(); +// } +// +// @Autowired +// public void configureGloble(AuthenticationManagerBuilder builder) throws Exception{ +// builder.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder()); +// } +// +// @Override +// public void configure(WebSecurity web) throws Exception { +// +// web +// .ignoring() +// .antMatchers("/h2console/**") +// .antMatchers("/api/register") +// .antMatchers("/api/activate") +// .antMatchers("/api/lostpassword") +// .antMatchers("/api/resetpassword") +// .antMatchers("/api/hello"); +// +// } +// +// @Override +// @Bean +// public AuthenticationManager authenticationManagerBean() throws Exception { +// return super.authenticationManagerBean(); +// } +// +// @EnableGlobalMethodSecurity(prePostEnabled = true, jsr250Enabled = true) +// private static class GlobalSecurityConfiguration extends GlobalMethodSecurityConfiguration { +// @Override +// protected MethodSecurityExpressionHandler createExpressionHandler() { +// return new OAuth2MethodSecurityExpressionHandler(); +// } +// +// } +// +//} diff --git a/health_framework/src/main/java/cn/card/health/oauth/security/CustomAuthenticationEntryPoint.java b/health_framework/src/main/java/cn/card/health/oauth/security/CustomAuthenticationEntryPoint.java new file mode 100644 index 0000000..dfc730a --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/oauth/security/CustomAuthenticationEntryPoint.java @@ -0,0 +1,28 @@ +//package cn.card.health.oauth.security; +// +//import java.io.IOException; +// +//import javax.servlet.ServletException; +//import javax.servlet.http.HttpServletRequest; +//import javax.servlet.http.HttpServletResponse; +// +//import org.slf4j.Logger; +//import org.slf4j.LoggerFactory; +//import org.springframework.security.core.AuthenticationException; +//import org.springframework.security.web.AuthenticationEntryPoint; +//import org.springframework.stereotype.Component; +// +//@Component +//public class CustomAuthenticationEntryPoint implements AuthenticationEntryPoint{ +// +// private final Logger log = LoggerFactory.getLogger(CustomAuthenticationEntryPoint.class); +// @Override +// public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) +// throws IOException, ServletException { +// +// log.info("Pre-authenticated entry point called. rejecting access"); +// response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Access Denied"); +// +// } +// +//} diff --git a/health_framework/src/main/java/cn/card/health/oauth/security/CustomLogoutSuccessHandler.java b/health_framework/src/main/java/cn/card/health/oauth/security/CustomLogoutSuccessHandler.java new file mode 100644 index 0000000..ac8e1b0 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/oauth/security/CustomLogoutSuccessHandler.java @@ -0,0 +1,61 @@ +//package cn.card.health.oauth.security; +// +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.security.core.Authentication; +//import org.springframework.security.core.token.Token; +//import org.springframework.security.core.token.TokenService; +//import org.springframework.security.oauth2.common.OAuth2AccessToken; +//import org.springframework.security.oauth2.provider.token.TokenStore; +//import org.springframework.security.oauth2.provider.token.store.JwtTokenStore; +//import org.springframework.security.web.authentication.AbstractAuthenticationTargetUrlRequestHandler; +//import org.springframework.security.web.authentication.logout.LogoutSuccessHandler; +//import org.springframework.stereotype.Component; +// +//import javax.servlet.ServletException; +//import javax.servlet.http.HttpServletRequest; +//import javax.servlet.http.HttpServletResponse; +//import java.io.IOException; +// +// +///** +// * Spring Security logout handler +// */ +//@Component +//public class CustomLogoutSuccessHandler +// extends AbstractAuthenticationTargetUrlRequestHandler +// implements LogoutSuccessHandler { +// +// +// private static final String BEARER_AUTHENTICATION = "yc_health "; +// private static final String HEADER_AUTHORIZATION = "authorization"; +// +//// @Autowired +//// private JwtTokenStore tokenStore; +// +// @Override +// public void onLogoutSuccess(HttpServletRequest request, +// HttpServletResponse response, +// Authentication authentication) +// throws IOException, ServletException { +// +// String token = request.getHeader(HEADER_AUTHORIZATION); +// +// if (token != null && token.startsWith(BEARER_AUTHENTICATION)) { +//// +//// Token tk = tokenService.verifyToken(token); +//// if(tk.getKey() != null) { +//// tokenService.toString(); +//// } +// OAuth2AccessToken oAuth2AccessToken = tokenStore.readAccessToken(token.split(" ")[0]); +// +// if (oAuth2AccessToken != null) { +// tokenStore.removeAccessToken(oAuth2AccessToken); +// } +// +// } +// +// response.setStatus(HttpServletResponse.SC_OK); +// +// } +// +//} diff --git a/health_framework/src/main/java/cn/card/health/oauth/security/SecurityConfiguration.java b/health_framework/src/main/java/cn/card/health/oauth/security/SecurityConfiguration.java new file mode 100644 index 0000000..76e6566 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/oauth/security/SecurityConfiguration.java @@ -0,0 +1,113 @@ +//package cn.card.health.oauth.security; +// +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.context.annotation.Configuration; +//import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; +//import org.springframework.security.config.annotation.web.builders.HttpSecurity; +//import org.springframework.security.config.annotation.web.builders.WebSecurity; +//import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +//import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +// +////@Configuration +//@EnableWebSecurity +//public class SecurityConfiguration extends WebSecurityConfigurerAdapter { +// +// public SecurityConfiguration() { +// super(); +// } +// +// @Autowired +// private UserDetailsServiceImpl userDetailsService; +// +// @Autowired +// public void configureGloble(AuthenticationManagerBuilder builder) throws Exception { +// builder.userDetailsService(userDetailsService); +// } +// +// @Override +// public void configure(WebSecurity web) throws Exception { +// +// web.ignoring().mvcMatchers(); +//// .antMatchers("/api/**") +//// .antMatchers("/service/login") +//// .antMatchers("/api/register") +//// .antMatchers("/api/activate") +//// .antMatchers("/api/lostpassword") +//// .antMatchers("/api/resetpassword") +//// .antMatchers("/api/hello"); +// +// } +// +// @Override +// protected void configure(HttpSecurity http) throws Exception { +// /** +// * 请求认证管理 +// */ +// http.authorizeRequests().antMatchers("**").permitAll() // url匹配路径 permitAll 运行 全部访问 不用认证 +// .accessDecisionManager(null) // 访问决策器 +// .filterSecurityInterceptorOncePerRequest(true) // 过滤每个请求一次的安全拦截器 ??? +// .anyRequest().authenticated() // 其他的请求 需要认证, +// .antMatchers("/admin/**").hasRole("ADMIN") // url匹配路径 具有怎样的角色 +// .antMatchers("/admin/**").access("hasRole('ROLE_ADMIN')") // url匹配路径 具有怎样的角色 或者是权限 +// ; +// /** +// * anonymous +// * +// * 匿名访问时 存在默认 用户名 annonymousUser +// */ +// http.anonymous().disable().csrf().disable(); // 禁止匿名 关闭csrf +// /** +// * 登出操作管理 +// */ +// http.logout() // 登出处理 +// .logoutUrl("/my/logout").logoutSuccessUrl("/my/index").logoutSuccessHandler(null) +// .invalidateHttpSession(true).addLogoutHandler(null).deleteCookies("cookieNamesToClear"); +// /** +// * session 会话管理 +// */ +// http.sessionManagement() // session管理 +// .maximumSessions(2) // 最大session 数量 --用户 +// .maxSessionsPreventsLogin(false) // 超过最大sessin数量后时候阻止登录 +// .expiredUrl("/") // 会话失效后跳转的url +// .expiredSessionStrategy(null) // 自定义session 过期错略 +// .sessionRegistry(null) // 自定义的session 注册 表 +// ; +// } +// +// @Override +// protected void configure(AuthenticationManagerBuilder auth) throws Exception { +// /** +// * 基础的配置 +// */ +// auth +// /** +// * 认证 时触发的事件 +// */ +// .authenticationEventPublisher(null) +// /** +// * 用户细节服务 +// * +// * 认证管理器数据的来源 吧 用户身份凭证信息和 权限信息 +// */ +// .userDetailsService(null) +// /** +// * 密码编辑器 对密码进行加密 +// */ +// .passwordEncoder(null); +// } +// +//// @Override +//// @Bean +//// public AuthenticationManager authenticationManagerBean() throws Exception { +//// return super.authenticationManagerBean(); +//// } +//// +//// @EnableGlobalMethodSecurity(prePostEnabled = true, jsr250Enabled = true) +//// public static class GlobalSecurityConfiguration extends GlobalMethodSecurityConfiguration { +//// @Override +//// protected MethodSecurityExpressionHandler createExpressionHandler() { +//// return new OAuth2MethodSecurityExpressionHandler(); +//// } +//// } +// +//} diff --git a/health_framework/src/main/java/cn/card/health/oauth/security/UserDetailsServiceImpl.java b/health_framework/src/main/java/cn/card/health/oauth/security/UserDetailsServiceImpl.java new file mode 100644 index 0000000..49a7a15 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/oauth/security/UserDetailsServiceImpl.java @@ -0,0 +1,47 @@ +package cn.card.health.oauth.security; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import cn.card.health.bean.user.LoginUser; +import cn.card.health.bean.user.YcUser; +import cn.card.health.service.user.IYcUserService; + +@Component("userDetailsService") +public class UserDetailsServiceImpl implements UserDetailsService { + + private final Logger log = LoggerFactory.getLogger(UserDetailsServiceImpl.class); + + @Autowired + private IYcUserService userService; + + @Override + @Transactional + public UserDetails loadUserByUsername(final String openid) { + + log.debug("Authenticating {}", openid); + LoginUser login; + YcUser userFromDatabase; + userFromDatabase = userService.loadUserByUsername(openid); +//// userFromDatabase = (YcUser) userService.loadUserByUsername(openid); +// +// if (userFromDatabase == null) { +// throw new UsernameNotFoundException("User " + openid + " was not found in the database"); +// } else if (!userFromDatabase.isActivated()) { +// throw new UsernameNotFoundException("User " + openid + " is not activated"); +// } + + return createLoginUser(userFromDatabase); + } + + public UserDetails createLoginUser(YcUser user) + { + return new LoginUser(user.getUserid(), user); + } + +} diff --git a/health_framework/src/main/java/cn/card/health/oauth/security/UserNotActivatedException.java b/health_framework/src/main/java/cn/card/health/oauth/security/UserNotActivatedException.java new file mode 100644 index 0000000..d9220e4 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/oauth/security/UserNotActivatedException.java @@ -0,0 +1,14 @@ +//package cn.card.health.oauth.security; +// +//import org.springframework.security.core.AuthenticationException; +// +//public class UserNotActivatedException extends AuthenticationException { +// +// public UserNotActivatedException(String msg, Throwable t) { +// super(msg, t); +// } +// +// public UserNotActivatedException(String msg) { +// super(msg); +// } +//} diff --git a/health_framework/src/main/java/cn/card/health/oauth/security/UserRepository.java b/health_framework/src/main/java/cn/card/health/oauth/security/UserRepository.java new file mode 100644 index 0000000..c6ede1e --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/oauth/security/UserRepository.java @@ -0,0 +1,25 @@ +//package cn.card.health.oauth.security; +// +//import org.springframework.data.repository.query.Param; +//import org.springframework.security.provisioning.UserDetailsManager; +// +//import cn.card.health.bean.user.YcUser; +// +//public interface UserRepository extends UserDetailsManager{ + +// @Query("SELECT u FROM User u WHERE LOWER(u.username) = LOWER(:username)") +// YcUser findByUsernameCaseInsensitive(@Param("username") String username); +// +// @Query +// YcUser findByEmail(String email); +// +// @Query +// YcUser findByEmailAndActivationKey(String email, String activationKey); +// +// @Query +// YcUser findByEmailAndResetPasswordKey(String email, String resetPasswordKey); +// +// @Query("select yu.* from yc_oauth yo, yc_user yu where yo.userid = yu.userid and yo.appid=(:appid) and yo.auth_type=(:authType) and yo.openid = (:openid)") +// YcUser findByOpenidAndType(@Param("appid") String appid, @Param("openid") String openid, @Param("authType") String authType); + +//} \ No newline at end of file diff --git a/health_framework/src/main/java/cn/card/health/order/controller/YcHealthcardApptokenController.java b/health_framework/src/main/java/cn/card/health/order/controller/YcHealthcardApptokenController.java new file mode 100644 index 0000000..69a0b43 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/order/controller/YcHealthcardApptokenController.java @@ -0,0 +1,59 @@ +//package cn.card.health.order.controller; +// +//import java.util.Arrays; +//import java.util.Map; +//import io.swagger.annotations.Api; +//import io.swagger.annotations.ApiOperation; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.web.bind.annotation.RestController; +//import org.springframework.web.bind.annotation.PostMapping; +//import org.springframework.web.bind.annotation.GetMapping; +//import org.springframework.web.bind.annotation.RequestMapping; +//import cn.card.health.order.bean.YcHealthcardApptoken; +//import cn.card.health.order.service.YcHealthcardApptokenService; +//import java.util.List; +// +///** +// * +// * +// * @author xinggm +// * @date 2021-07-08 15:32:53 +// */ +//@Api("order") +//@RestController +//@RequestMapping("order/ychealthcardapptoken") +//public class YcHealthcardApptokenController { +// +// @Autowired +// private YcHealthcardApptokenService ycHealthcardApptokenService; +// +// @ApiOperation("新增") +// @PostMapping("insert") +// public Object insert(YcHealthcardApptoken ycHealthcardApptoken){ +// return ycHealthcardApptokenService.insertYcHealthcardApptoken(ycHealthcardApptoken); +// } +// +// @ApiOperation("删除") +// @PostMapping(value = "delete") +// public int deleteYcHealthcardApptoken(Long id) { +// return ycHealthcardApptokenService.deleteYcHealthcardApptoken(id); +// } +// +// @ApiOperation( "根据主键更新") +// @PostMapping("update") +// public int update(YcHealthcardApptoken ycHealthcardApptoken) { +// return ycHealthcardApptokenService.updateYcHealthcardApptoken(ycHealthcardApptoken); +// } +// +// @ApiOperation("根据主键查询") +// @PostMapping("select") +// public YcHealthcardApptoken selectYcHealthcardApptoken(Long id) { +// return ycHealthcardApptokenService.selectYcHealthcardApptokenById(id); +// } +// +// @ApiOperation("条件查询") +// @PostMapping("selectList") +// public List selectList(YcHealthcardApptoken ycHealthcardApptoken) { +// return ycHealthcardApptokenService.selectListYcHealthcardApptoken(ycHealthcardApptoken); +// } +//} \ No newline at end of file diff --git a/health_framework/src/main/java/cn/card/health/order/controller/YcHealthcardInfoController.java b/health_framework/src/main/java/cn/card/health/order/controller/YcHealthcardInfoController.java new file mode 100644 index 0000000..ab88513 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/order/controller/YcHealthcardInfoController.java @@ -0,0 +1,59 @@ +//package cn.card.health.order.controller; +// +//import java.util.Arrays; +//import java.util.Map; +//import io.swagger.annotations.Api; +//import io.swagger.annotations.ApiOperation; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.web.bind.annotation.RestController; +//import org.springframework.web.bind.annotation.PostMapping; +//import org.springframework.web.bind.annotation.GetMapping; +//import org.springframework.web.bind.annotation.RequestMapping; +//import cn.card.health.order.bean.YcHealthcardInfo; +//import cn.card.health.order.service.YcHealthcardInfoService; +//import java.util.List; +// +///** +// * +// * +// * @author xinggm +// * @date 2021-07-08 15:32:53 +// */ +//@Api("order") +//@RestController +//@RequestMapping("order/ychealthcardinfo") +//public class YcHealthcardInfoController { +// +// @Autowired +// private YcHealthcardInfoService ycHealthcardInfoService; +// +// @ApiOperation("新增") +// @PostMapping("insert") +// public Object insert(YcHealthcardInfo ycHealthcardInfo){ +// return ycHealthcardInfoService.insertYcHealthcardInfo(ycHealthcardInfo); +// } +// +// @ApiOperation("删除") +// @PostMapping(value = "delete") +// public int deleteYcHealthcardInfo(Long id) { +// return ycHealthcardInfoService.deleteYcHealthcardInfo(id); +// } +// +// @ApiOperation( "根据主键更新") +// @PostMapping("update") +// public int update(YcHealthcardInfo ycHealthcardInfo) { +// return ycHealthcardInfoService.updateYcHealthcardInfo(ycHealthcardInfo); +// } +// +// @ApiOperation("根据主键查询") +// @PostMapping("select") +// public YcHealthcardInfo selectYcHealthcardInfo(Long id) { +// return ycHealthcardInfoService.selectYcHealthcardInfoById(id); +// } +// +// @ApiOperation("条件查询") +// @PostMapping("selectList") +// public List selectList(YcHealthcardInfo ycHealthcardInfo) { +// return ycHealthcardInfoService.selectListYcHealthcardInfo(ycHealthcardInfo); +// } +//} \ No newline at end of file diff --git a/health_framework/src/main/java/cn/card/health/order/controller/YcHealthcardTempController.java b/health_framework/src/main/java/cn/card/health/order/controller/YcHealthcardTempController.java new file mode 100644 index 0000000..c5f816b --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/order/controller/YcHealthcardTempController.java @@ -0,0 +1,59 @@ +//package cn.card.health.order.controller; +// +//import java.util.Arrays; +//import java.util.Map; +//import io.swagger.annotations.Api; +//import io.swagger.annotations.ApiOperation; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.web.bind.annotation.RestController; +//import org.springframework.web.bind.annotation.PostMapping; +//import org.springframework.web.bind.annotation.GetMapping; +//import org.springframework.web.bind.annotation.RequestMapping; +//import cn.card.health.order.bean.YcHealthcardTemp; +//import cn.card.health.order.service.YcHealthcardTempService; +//import java.util.List; +// +///** +// * +// * +// * @author xinggm +// * @date 2021-07-08 15:32:53 +// */ +//@Api("order") +//@RestController +//@RequestMapping("order/ychealthcardtemp") +//public class YcHealthcardTempController { +// +// @Autowired +// private YcHealthcardTempService ycHealthcardTempService; +// +// @ApiOperation("新增") +// @PostMapping("insert") +// public Object insert(YcHealthcardTemp ycHealthcardTemp){ +// return ycHealthcardTempService.insertYcHealthcardTemp(ycHealthcardTemp); +// } +// +// @ApiOperation("删除") +// @PostMapping(value = "delete") +// public int deleteYcHealthcardTemp(Long id) { +// return ycHealthcardTempService.deleteYcHealthcardTemp(id); +// } +// +// @ApiOperation( "根据主键更新") +// @PostMapping("update") +// public int update(YcHealthcardTemp ycHealthcardTemp) { +// return ycHealthcardTempService.updateYcHealthcardTemp(ycHealthcardTemp); +// } +// +// @ApiOperation("根据主键查询") +// @PostMapping("select") +// public YcHealthcardTemp selectYcHealthcardTemp(Long id) { +// return ycHealthcardTempService.selectYcHealthcardTempById(id); +// } +// +// @ApiOperation("条件查询") +// @PostMapping("selectList") +// public List selectList(YcHealthcardTemp ycHealthcardTemp) { +// return ycHealthcardTempService.selectListYcHealthcardTemp(ycHealthcardTemp); +// } +//} \ No newline at end of file diff --git a/health_framework/src/main/java/cn/card/health/order/mapper/YcHealthcardApptokenMapper.java b/health_framework/src/main/java/cn/card/health/order/mapper/YcHealthcardApptokenMapper.java new file mode 100644 index 0000000..07336f8 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/order/mapper/YcHealthcardApptokenMapper.java @@ -0,0 +1,30 @@ +//package cn.card.health.order.mapper; +// +//import org.apache.ibatis.annotations.Mapper; +///** +// * +// * +// * @author xinggm +// * @email +// * @date 2021-07-08 15:32:53 +// */ +//public interface YcHealthcardApptokenMapper { +// /** 新增 */ +// public int insertYcHealthcardApptoken(YcHealthcardApptoken ycHealthcardApptoken); +// +// /** 删除 */ +// public int deleteYcHealthcardApptoken(Long id); +// +// /** 更新 */ +// public int updateYcHealthcardApptoken(YcHealthcardApptoken ycHealthcardApptoken); +// +// /** 根据主键查询 */ +// public YcHealthcardApptoken selectYcHealthcardApptokenById(Long id); +// +// /** 查询单条 */ +// public YcHealthcardApptoken selectYcHealthcardApptoken(YcHealthcardApptoken ycHealthcardApptoken); +// +// /** 查询列表 */ +// public List selectListYcHealthcardApptoken(YcHealthcardApptoken ycHealthcardApptoken); +// +//} diff --git a/health_framework/src/main/java/cn/card/health/order/mapper/YcHealthcardInfoMapper.java b/health_framework/src/main/java/cn/card/health/order/mapper/YcHealthcardInfoMapper.java new file mode 100644 index 0000000..e37fee2 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/order/mapper/YcHealthcardInfoMapper.java @@ -0,0 +1,32 @@ +//package cn.card.health.mapper.order; +// +//import cn.card.health.bean.order.YcHealthcardInfo; +//import org.apache.ibatis.annotations.Mapper; +// +///** +// * +// * +// * @author xinggm +// * @email +// * @date 2021-07-08 15:32:53 +// */ +//public interface YcHealthcardInfoMapper { +// /** 新增 */ +// public int insertYcHealthcardInfo(YcHealthcardInfo ycHealthcardInfo); +// +// /** 删除 */ +// public int deleteYcHealthcardInfo(Long id); +// +// /** 更新 */ +// public int updateYcHealthcardInfo(YcHealthcardInfo ycHealthcardInfo); +// +// /** 根据主键查询 */ +// public YcHealthcardInfo selectYcHealthcardInfoById(Long id); +// +// /** 查询单条 */ +// public YcHealthcardInfo selectYcHealthcardInfo(YcHealthcardInfo ycHealthcardInfo); +// +// /** 查询列表 */ +// public List selectListYcHealthcardInfo(YcHealthcardInfo ycHealthcardInfo); +// +//} diff --git a/health_framework/src/main/java/cn/card/health/order/mapper/YcHealthcardTempMapper.java b/health_framework/src/main/java/cn/card/health/order/mapper/YcHealthcardTempMapper.java new file mode 100644 index 0000000..5360aeb --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/order/mapper/YcHealthcardTempMapper.java @@ -0,0 +1,32 @@ +//package cn.card.health.mapper.order; +// +//import cn.card.health.bean.order.YcHealthcardTemp; +//import org.apache.ibatis.annotations.Mapper; +// +///** +// * +// * +// * @author xinggm +// * @email +// * @date 2021-07-08 15:32:53 +// */ +//public interface YcHealthcardTempMapper { +// /** 新增 */ +// public int insertYcHealthcardTemp(YcHealthcardTemp ycHealthcardTemp); +// +// /** 删除 */ +// public int deleteYcHealthcardTemp(Long id); +// +// /** 更新 */ +// public int updateYcHealthcardTemp(YcHealthcardTemp ycHealthcardTemp); +// +// /** 根据主键查询 */ +// public YcHealthcardTemp selectYcHealthcardTempById(Long id); +// +// /** 查询单条 */ +// public YcHealthcardTemp selectYcHealthcardTemp(YcHealthcardTemp ycHealthcardTemp); +// +// /** 查询列表 */ +// public List selectListYcHealthcardTemp(YcHealthcardTemp ycHealthcardTemp); +// +//} diff --git a/health_framework/src/main/java/cn/card/health/order/service/IYcHealthcardApptokenService.java b/health_framework/src/main/java/cn/card/health/order/service/IYcHealthcardApptokenService.java new file mode 100644 index 0000000..1a0fd43 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/order/service/IYcHealthcardApptokenService.java @@ -0,0 +1,34 @@ +//package cn.card.health.order.service; +// +//import cn.card.health.bean.order.YcHealthcardApptoken; +// +//import java.util.Map; +// +///** +// * +// * +// * @author xinggm +// * @email +// * @date 2021-07-08 15:32:53 +// */ +//public interface IYcHealthcardApptokenService { +// +// /** 新增 */ +// public int insertYcHealthcardApptoken(YcHealthcardApptoken ycHealthcardApptoken); +// +// /** 删除 */ +// public int deleteYcHealthcardApptoken(Long id); +// +// /** 更新 */ +// public int updateYcHealthcardApptoken(YcHealthcardApptoken ycHealthcardApptoken); +// +// /** 根据主键查询 */ +// public YcHealthcardApptoken selectYcHealthcardApptokenById(Long id); +// +// /** 查询单条 */ +// public YcHealthcardApptoken selectYcHealthcardApptoken(YcHealthcardApptoken ycHealthcardApptoken); +// +// /** 查询列表 */ +// public List selectListYcHealthcardApptoken(YcHealthcardApptoken ycHealthcardApptoken); +//} +// diff --git a/health_framework/src/main/java/cn/card/health/order/service/IYcHealthcardInfoService.java b/health_framework/src/main/java/cn/card/health/order/service/IYcHealthcardInfoService.java new file mode 100644 index 0000000..b6842ba --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/order/service/IYcHealthcardInfoService.java @@ -0,0 +1,34 @@ +//package cn.card.health.order.service; +// +//import cn.card.health.bean.order.YcHealthcardInfo; +// +//import java.util.Map; +// +///** +// * +// * +// * @author xinggm +// * @email +// * @date 2021-07-08 15:32:53 +// */ +//public interface IYcHealthcardInfoService { +// +// /** 新增 */ +// public int insertYcHealthcardInfo(YcHealthcardInfo ycHealthcardInfo); +// +// /** 删除 */ +// public int deleteYcHealthcardInfo(Long id); +// +// /** 更新 */ +// public int updateYcHealthcardInfo(YcHealthcardInfo ycHealthcardInfo); +// +// /** 根据主键查询 */ +// public YcHealthcardInfo selectYcHealthcardInfoById(Long id); +// +// /** 查询单条 */ +// public YcHealthcardInfo selectYcHealthcardInfo(YcHealthcardInfo ycHealthcardInfo); +// +// /** 查询列表 */ +// public List selectListYcHealthcardInfo(YcHealthcardInfo ycHealthcardInfo); +//} +// diff --git a/health_framework/src/main/java/cn/card/health/order/service/IYcHealthcardTempService.java b/health_framework/src/main/java/cn/card/health/order/service/IYcHealthcardTempService.java new file mode 100644 index 0000000..cae2c01 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/order/service/IYcHealthcardTempService.java @@ -0,0 +1,34 @@ +//package cn.card.health.order.service; +// +//import cn.card.health.bean.order.YcHealthcardTemp; +// +//import java.util.Map; +// +///** +// * +// * +// * @author xinggm +// * @email +// * @date 2021-07-08 15:32:53 +// */ +//public interface IYcHealthcardTempService { +// +// /** 新增 */ +// public int insertYcHealthcardTemp(YcHealthcardTemp ycHealthcardTemp); +// +// /** 删除 */ +// public int deleteYcHealthcardTemp(Long id); +// +// /** 更新 */ +// public int updateYcHealthcardTemp(YcHealthcardTemp ycHealthcardTemp); +// +// /** 根据主键查询 */ +// public YcHealthcardTemp selectYcHealthcardTempById(Long id); +// +// /** 查询单条 */ +// public YcHealthcardTemp selectYcHealthcardTemp(YcHealthcardTemp ycHealthcardTemp); +// +// /** 查询列表 */ +// public List selectListYcHealthcardTemp(YcHealthcardTemp ycHealthcardTemp); +//} +// diff --git a/health_framework/src/main/java/cn/card/health/order/service/impl/YcHealthcardInfoServiceImpl.java b/health_framework/src/main/java/cn/card/health/order/service/impl/YcHealthcardInfoServiceImpl.java new file mode 100644 index 0000000..d35b90e --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/order/service/impl/YcHealthcardInfoServiceImpl.java @@ -0,0 +1,45 @@ +//package cn.card.health.service.order.impl; +// +//import org.springframework.stereotype.Service; +//import java.util.Map; +//import cn.card.health.mapper.order.YcHealthcardInfoMapper; +//import cn.card.health.bean.order.YcHealthcardInfo; +//import cn.card.health.service.order.IYcHealthcardInfoService; +// +// +//@Service +//public class YcHealthcardInfoServiceImpl implements IYcHealthcardInfoService { +// +// @Autowired +// private YcHealthcardInfoMapper ycHealthcardInfoMapper; +// /** 新增 */ +// public int insertYcHealthcardInfo(YcHealthcardInfo ycHealthcardInfo){ +// return ycHealthcardInfoMapper.insertYcHealthcardInfo(ycHealthcardInfo); +// } +// +// /** 删除 */ +// public int deleteYcHealthcardInfo(Long id){ +// return ycHealthcardInfoMapper.deleteYcHealthcardInfo(id); +// } +// +// /** 更新 */ +// public int updateYcHealthcardInfo(YcHealthcardInfo ycHealthcardInfo){ +// return ycHealthcardInfoMapper.updateYcHealthcardInfo(ycHealthcardInfo); +// } +// +// /** 根据主键查询 */ +// public YcHealthcardInfo selectYcHealthcardInfoBy(Long id){ +// return ycHealthcardInfoMapper.selectYcHealthcardInfo(id); +// } +// +// /** 查询单条 */ +// public YcHealthcardInfo selectYcHealthcardInfo(YcHealthcardInfo ycHealthcardInfo){ +// return ycHealthcardInfoMapper.selectYcHealthcardInfo(ycHealthcardInfo); +// } +// +// /** 查询列表 */ +// public List selectListYcHealthcardInfo(YcHealthcardInfo ycHealthcardInfo){ +// return ycHealthcardInfoMapper.selectListYcHealthcardInfo(ycHealthcardInfo); +// } +// +//} \ No newline at end of file diff --git a/health_framework/src/main/java/cn/card/health/order/service/impl/YcHealthcardTempServiceImpl.java b/health_framework/src/main/java/cn/card/health/order/service/impl/YcHealthcardTempServiceImpl.java new file mode 100644 index 0000000..989a5d7 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/order/service/impl/YcHealthcardTempServiceImpl.java @@ -0,0 +1,45 @@ +//package cn.card.health.service.order.impl; +// +//import org.springframework.stereotype.Service; +//import java.util.Map; +//import cn.card.health.mapper.order.YcHealthcardTempMapper; +//import cn.card.health.bean.order.YcHealthcardTemp; +//import cn.card.health.service.order.IYcHealthcardTempService; +// +// +//@Service +//public class YcHealthcardTempServiceImpl implements IYcHealthcardTempService { +// +// @Autowired +// private YcHealthcardTempMapper ycHealthcardTempMapper; +// /** 新增 */ +// public int insertYcHealthcardTemp(YcHealthcardTemp ycHealthcardTemp){ +// return ycHealthcardTempMapper.insertYcHealthcardTemp(ycHealthcardTemp); +// } +// +// /** 删除 */ +// public int deleteYcHealthcardTemp(Long id){ +// return ycHealthcardTempMapper.deleteYcHealthcardTemp(id); +// } +// +// /** 更新 */ +// public int updateYcHealthcardTemp(YcHealthcardTemp ycHealthcardTemp){ +// return ycHealthcardTempMapper.updateYcHealthcardTemp(ycHealthcardTemp); +// } +// +// /** 根据主键查询 */ +// public YcHealthcardTemp selectYcHealthcardTempBy(Long id){ +// return ycHealthcardTempMapper.selectYcHealthcardTemp(id); +// } +// +// /** 查询单条 */ +// public YcHealthcardTemp selectYcHealthcardTemp(YcHealthcardTemp ycHealthcardTemp){ +// return ycHealthcardTempMapper.selectYcHealthcardTemp(ycHealthcardTemp); +// } +// +// /** 查询列表 */ +// public List selectListYcHealthcardTemp(YcHealthcardTemp ycHealthcardTemp){ +// return ycHealthcardTempMapper.selectListYcHealthcardTemp(ycHealthcardTemp); +// } +// +//} \ No newline at end of file diff --git a/health_framework/src/main/java/cn/card/health/service/HealthCardApptokenService.java b/health_framework/src/main/java/cn/card/health/service/HealthCardApptokenService.java new file mode 100644 index 0000000..34dacff --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/service/HealthCardApptokenService.java @@ -0,0 +1,42 @@ +package cn.card.health.service; + +/** + * 健康卡apptoken service + * @author xinggm + * @date 2021年5月27日 + */ +public interface HealthCardApptokenService { + + /** + * 插入apptoekn + * + * @param apptoken + * @param expiresIn + * @return + */ + + int insertHealthCardApptoken(String apptoken, Long expiresIn); + + /** + * 查询apptoken + * + * @return + */ + + String findHealthCardApptoken(); + + /** + * 查询ExpiresIn + * + * @return + */ + Long findHealthCardExpiresIn(); + + /** + * 更新apptoken + * + * @return + */ + + int updateHealthCardApptoken(String apptoken, Long expiresIn); +} diff --git a/health_framework/src/main/java/cn/card/health/service/HealthCardInfoService.java b/health_framework/src/main/java/cn/card/health/service/HealthCardInfoService.java new file mode 100644 index 0000000..5a33a08 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/service/HealthCardInfoService.java @@ -0,0 +1,77 @@ +//package cn.card.health.service; +// +//import com.alipay.api.domain.HealthCardInfo; +//import com.tencent.healthcard.model.HealthCardInfo; +// +//import java.util.List; +// +///** +// * 健康卡Service +// * +// * @author guobin +// * @date 2021年5月26日 +// */ +//public interface HealthCardInfoService { +// /** +// * 插入电子健康卡个人基本信息 +// * +// * @return +// */ +// +// int insertHealthCardInfo(HealthCardInfo healthCardInfo); +// +// /** +// * 根据openId查询健康卡信息 +// * +// * @param openId +// * @return +// */ +// +// List findHealthCardInfoByOpenId(String openId); +// +// /** +// * 根据idNumber查询健康卡是否已注册 +// * +// * @param idNumber +// * @return +// */ +// HealthCardInfo findHealthCardInfoByIdNumber(String idNumber, String openId); +// +// /** +// * 根据idNumber查询健康卡是否已注册 +// * +// * @param idNumber +// * @return +// */ +// HealthCardInfo findHealthCardInfo(String idNumber, String openId); +// +// HealthCardInfo findHealthCardInfoByOpenidAndPatientId(String openid, String patientId); +// +// /** +// * 根据patId查询健康卡 +// * +// * @param patId +// * @return +// */ +// HealthCardInfo findHealthCardInfoByPatientId(String patId); +// +// /** +// * 根据QRCode查询 +// * +// * @param qrCode +// * @return +// */ +// HealthCardInfo findHealthCardInfoByQRCode(String qrCode); +// +// /** +// * 根据传入信息删除健康卡 +// * +// * @param map +// * @return +// */ +// Integer delHealthCardInfoByIdNumber(String openId, String idNumber); +// +// Integer updateSelectedCard(String openid, String patId); +// +// public String getWechatDepartment(String deptId); +//} diff --git a/health_framework/src/main/java/cn/card/health/service/HealthCardTempService.java b/health_framework/src/main/java/cn/card/health/service/HealthCardTempService.java new file mode 100644 index 0000000..e79e058 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/service/HealthCardTempService.java @@ -0,0 +1,72 @@ +//package cn.card.health.service; +// +//import com.tencent.healthcard.model.HealthCardInfo; +// +///** +// * 健康卡临时service +// * +// * @author xinggm +// * @date 2021年5月27日 +// */ +//public interface HealthCardTempService { +// +// /** +// * 添加临时信息 +// * +// * @param healthCardInfo +// * @return +// */ +// public int insertHealthCardTemp(HealthCardInfo healthCardInfo); +// +// /** +// * 跟新临时信息 +// * +// * @param healthCardInfo +// * @return +// */ +// public int updateHealthCardTemp(HealthCardInfo healthCardInfo); +// +// /** +// * 查询临时信息 +// * +// * @param openId +// * @return +// */ +// public HealthCardInfo findHealthCardTempByOpenId(String openId, String idNumber); +// +// /** +// * 跟新wechatCode +// * +// * @param wechatCode +// * @param openId +// * @return +// */ +// public int updateHealthCardInfoWechatCode(String wechatCode, String openId); +// +// /** +// * wechatCode +// * +// * @param wechatCode +// * @param openId +// * @return +// */ +// int insertHealthCardInfoWechatCode(String wechatCode, String openId); +// +// /** +// * 添加healthCode +// * +// * @param healthCode +// * @param openId +// * @return +// */ +// int insertHealthCardInfoHealthCode(String healthCode, String openId); +// +// /** +// * 跟新HealthCode +// * +// * @param healthCode +// * @param openId +// * @return +// */ +// int updateHealthCardInfoHealthCode(String healthCode, String openId); +//} diff --git a/health_framework/src/main/java/cn/card/health/service/Sign.java b/health_framework/src/main/java/cn/card/health/service/Sign.java new file mode 100644 index 0000000..d529e83 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/service/Sign.java @@ -0,0 +1,71 @@ +package cn.card.health.service; + +import java.io.UnsupportedEncodingException; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.Formatter; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +public class Sign { +// public static void main(String[] args) { +// String jsapi_ticket = JsapiTicketUtil.getWXJsapiTicket(); +// +// // 注意 URL 一定要动态获取,不能 hardcode +// String url = "http://www.hbyctr.com/wx/regist.html"; +// Map ret = sign(jsapi_ticket, url); +// for (@SuppressWarnings("rawtypes") Map.Entry entry : ret.entrySet()) { +// System.out.println(entry.getKey() + ", " + entry.getValue()); +// } +// } + + public static Map sign(String jsapi_ticket, String url) { + Map ret = new HashMap(); + String nonce_str = create_nonce_str(); + String timestamp = create_timestamp(); + String string1; + String signature = ""; + + // 注意这里参数名必须全部小写,且必须有序 + string1 = "jsapi_ticket=" + jsapi_ticket + "&noncestr=" + nonce_str + "×tamp=" + timestamp + "&url=" + url; + System.out.println(string1); + + try { + MessageDigest crypt = MessageDigest.getInstance("SHA-1"); + crypt.reset(); + crypt.update(string1.getBytes("UTF-8")); + signature = byteToHex(crypt.digest()); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + + ret.put("url", url); + ret.put("jsapi_ticket", jsapi_ticket); + ret.put("nonceStr", nonce_str); + ret.put("timestamp", timestamp); + ret.put("signature", signature); + + return ret; + } + + private static String byteToHex(final byte[] hash) { + Formatter formatter = new Formatter(); + for (byte b : hash) { + formatter.format("%02x", b); + } + String result = formatter.toString(); + formatter.close(); + return result; + } + + private static String create_nonce_str() { + return UUID.randomUUID().toString(); + } + + private static String create_timestamp() { + return Long.toString(System.currentTimeMillis() / 1000); + } +} diff --git a/health_framework/src/main/java/cn/card/health/service/impl/HealthCardApptokenServiceImpl.java b/health_framework/src/main/java/cn/card/health/service/impl/HealthCardApptokenServiceImpl.java new file mode 100644 index 0000000..051c34a --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/service/impl/HealthCardApptokenServiceImpl.java @@ -0,0 +1,35 @@ +package cn.card.health.service.impl; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import cn.card.health.mapper.HealthCardApptokenMapper; +import cn.card.health.service.HealthCardApptokenService; + +@Service +public class HealthCardApptokenServiceImpl implements HealthCardApptokenService { + @Autowired + private HealthCardApptokenMapper halthCardApptokenMapper; + @Override + public int insertHealthCardApptoken(String apptoken, Long expiresIn) { + return halthCardApptokenMapper.insertHealthCardApptoken(apptoken, expiresIn); + } + + @Override + public String findHealthCardApptoken() { + return halthCardApptokenMapper.findHealthCardApptoken(); + } + + @Override + public Long findHealthCardExpiresIn() { + Long l = halthCardApptokenMapper.findHealthCardExpiresIn(); + System.out.println(l); + return l; + } + + @Override + public int updateHealthCardApptoken(String apptoken, Long expiresIn) { + return halthCardApptokenMapper.updateHealthCardApptoken(apptoken, expiresIn); + } + +} diff --git a/health_framework/src/main/java/cn/card/health/service/impl/HealthCardInfoServiceImpl.java b/health_framework/src/main/java/cn/card/health/service/impl/HealthCardInfoServiceImpl.java new file mode 100644 index 0000000..566fb59 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/service/impl/HealthCardInfoServiceImpl.java @@ -0,0 +1,139 @@ +//package cn.card.health.service.impl; +// +//import cn.card.health.bean.hospital.YcPatient; +//import cn.card.health.mapper.HealthCardInfoMapper; +//import cn.card.health.service.HealthCardInfoService; +//import cn.card.health.service.user.IYcPatientService; +//import com.tencent.healthcard.model.HealthCardInfo; +//import org.slf4j.Logger; +//import org.slf4j.LoggerFactory; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.stereotype.Service; +// +//import java.util.List; +// +//@Service +//public class HealthCardInfoServiceImpl implements HealthCardInfoService { +// private final Logger logger = LoggerFactory.getLogger(HealthCardInfoServiceImpl.class); +// +// @Autowired +// HealthCardInfoMapper healthCardMapper; +// @Autowired +// IYcPatientService ycPatientService; +// +// // /** +//// * 初始化启动方法 +//// */ +//// @PostConstruct +//// public void init() { +//// System.out.println("======================="); +//// HealthCardInfo healthCardInfo = new HealthCardInfo(); +//// healthCardInfo.setAddress("test"); +//// healthCardInfo.setBirthday("test"); +//// healthCardInfo.setExt("test"); +//// healthCardInfo.setName("test"); +//// healthCardMapper.insertHealthCardInfo(healthCardInfo); +//// } +// /* +// * @Autowired JkglyDao jkglyDao; +// */ +// @Override +// public int insertHealthCardInfo(HealthCardInfo healthCardInfo) { +// HealthCardInfo cardInfo = this.findHealthCardInfo(healthCardInfo.getIdNumber(), healthCardInfo.getOpenId()); +// if (cardInfo == null) { +// //先保存数据,然后进入HIS,如果失败,微信健康卡信息存在 +// healthCardMapper.insertHealthCardInfo(healthCardInfo); +// } else { +// healthCardMapper.recoveryHealthCardInfoByIdNumber(healthCardInfo.getOpenId(), healthCardInfo.getIdNumber()); +// } +// +// YcPatient patient = new YcPatient(); +// patient.setCardno(healthCardInfo.getIdNumber()); +// patient = ycPatientService.selectYcPatient(patient); +// int r = 1; +// if (patient == null) { +// patient = getPatient(healthCardInfo); +// r = ycPatientService.addPatient(patient); +// } +// +// healthCardInfo.setPatid(patient.getPatientid() + ""); +// if (r > 0) { +// //如果只有一张卡设置为默认卡 +// int selected = 0; +// List cardInfoList = healthCardMapper.findHealthCardInfoByOpenId(healthCardInfo.getOpenId()); +// if (cardInfoList.size() == 1) { +// selected = 1; +// } +// r = healthCardMapper.updatePatId(healthCardInfo.getOpenId(), healthCardInfo.getIdNumber(), healthCardInfo.getPatid(), selected); +// } +// +// return r; +// } +// +// private YcPatient getPatient(HealthCardInfo healthCardInfo) { +// YcPatient patient = new YcPatient(); +// patient.setCardno(healthCardInfo.getIdNumber()); +// patient.setCardtype("1");// 卡类型 +// patient.setPhone(healthCardInfo.getPhone1()); +// patient.setAddress(healthCardInfo.getAddress()); +// patient.setCardid(healthCardInfo.getHealthCardId()); +// patient.setPatientName(healthCardInfo.getName()); +// patient.setPatientSex(healthCardInfo.getGender()); +// patient.setOpenid(healthCardInfo.getOpenId()); +// patient.setChannel("WECAHT"); +// patient.setIsnew("F"); +// patient.setDelFlag(1); +// return patient; +// } +// +// @Override +// public List findHealthCardInfoByOpenId(String openId) { +// return healthCardMapper.findHealthCardInfoByOpenId(openId); +// } +// +// @Override +// public HealthCardInfo findHealthCardInfoByIdNumber(String idNumber, String openId) { +// return healthCardMapper.findHealthCardInfoByIdNumber(idNumber, openId); +// } +// +// @Override +// public HealthCardInfo findHealthCardInfo(String idNumber, String openId) { +// return healthCardMapper.findHealthCardInfo(idNumber, openId); +// } +// +// @Override +// public HealthCardInfo findHealthCardInfoByPatientId(String patientId) { +// return healthCardMapper.findHealthCardInfoByPatientId(patientId); +// } +// +// @Override +// public HealthCardInfo findHealthCardInfoByOpenidAndPatientId(String openid, String patientId) { +// return healthCardMapper.findHealthCardInfoByOpenidAndPatientId(openid, patientId); +// } +// +// @Override +// public HealthCardInfo findHealthCardInfoByQRCode(String qrCode) { +// return healthCardMapper.findHealthCardInfoByQRCode(qrCode); +// } +// +// @Override +// public Integer delHealthCardInfoByIdNumber(String openId, String idNumber) { +// +// //ycPatientService.removeYcPatientByMap(map); +// return healthCardMapper.delHealthCardInfoByIdNumber(openId, idNumber); +// } +// +// @Override +// public Integer updateSelectedCard(String openid, String patId) { +// healthCardMapper.resetSelectedCard(openid, patId); +// +// Integer result = healthCardMapper.updateSelectedCard(openid, patId); +// return result; +// } +// +// @Override +// public String getWechatDepartment(String deptId) { +// return healthCardMapper.getWechatDepartment(deptId); +// } +// +//} diff --git a/health_framework/src/main/java/cn/card/health/service/impl/HealthCardTempServiceImpl.java b/health_framework/src/main/java/cn/card/health/service/impl/HealthCardTempServiceImpl.java new file mode 100644 index 0000000..4b13d4c --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/service/impl/HealthCardTempServiceImpl.java @@ -0,0 +1,50 @@ +//package cn.card.health.service.impl; +// +//import cn.card.health.mapper.HealthCardTempMapper; +//import cn.card.health.service.HealthCardTempService; +//import com.tencent.healthcard.model.HealthCardInfo; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.stereotype.Service; +// +//@Service +//public class HealthCardTempServiceImpl implements HealthCardTempService { +// +// @Autowired +// private HealthCardTempMapper healthCardTempMapper; +// +// @Override +// public int updateHealthCardInfoWechatCode(String wechatCode, String openId) { +// return healthCardTempMapper.updateHealthCardInfoWechatCode(wechatCode, openId); +// } +// +// @Override +// public int updateHealthCardInfoHealthCode(String healthCode, String openId) { +// return healthCardTempMapper.updateHealthCardInfoHealthCode(healthCode, openId); +// } +// +// @Override +// public int insertHealthCardTemp(HealthCardInfo healthCardInfo) { +// return healthCardTempMapper.insertHealthCardTemp(healthCardInfo); +// } +// +// @Override +// public int updateHealthCardTemp(HealthCardInfo healthCardInfo) { +// return healthCardTempMapper.updateHealthCardTemp(healthCardInfo); +// } +// +// @Override +// public HealthCardInfo findHealthCardTempByOpenId(String openId, String idNumber) { +// return healthCardTempMapper.findHealthCardTempByOpenId(openId, idNumber); +// } +// +// @Override +// public int insertHealthCardInfoWechatCode(String wechatCode, String openId) { +// return healthCardTempMapper.insertHealthCardInfoWechatCode(wechatCode, openId); +// } +// +// @Override +// public int insertHealthCardInfoHealthCode(String healthCode, String openId) { +// return healthCardTempMapper.insertHealthCardInfoHealthCode(healthCode, openId); +// } +// +//} diff --git a/health_framework/src/main/java/cn/card/health/service/impl/insurance/MkAppletRequestServiceImpl.java b/health_framework/src/main/java/cn/card/health/service/impl/insurance/MkAppletRequestServiceImpl.java new file mode 100644 index 0000000..4c29270 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/service/impl/insurance/MkAppletRequestServiceImpl.java @@ -0,0 +1,98 @@ +package cn.card.health.service.impl.insurance; + +import cn.card.health.bean.insurance.MkAppletRequest; +import cn.card.health.common.utils.DateUtils; +import cn.card.health.mapper.insurance.MkAppletRequestMapper; +import cn.card.health.service.insurance.IMkAppletRequestService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 支付宝小程序请求Service业务层处理 + * + * @author ruoyi + * @date 2022-10-15 + */ +@Service +public class MkAppletRequestServiceImpl implements IMkAppletRequestService +{ + @Autowired + private MkAppletRequestMapper mkAppletRequestMapper; + + /** + * 查询支付宝小程序请求 + * + * @param mkId 支付宝小程序请求主键 + * @return 支付宝小程序请求 + */ + @Override + public MkAppletRequest selectMkAppletRequestByMkId(Long mkId) + { + return mkAppletRequestMapper.selectMkAppletRequestByMkId(mkId); + } + + /** + * 查询支付宝小程序请求列表 + * + * @param mkAppletRequest 支付宝小程序请求 + * @return 支付宝小程序请求 + */ + @Override + public List selectMkAppletRequestList(MkAppletRequest mkAppletRequest) + { + return mkAppletRequestMapper.selectMkAppletRequestList(mkAppletRequest); + } + + /** + * 新增支付宝小程序请求 + * + * @param mkAppletRequest 支付宝小程序请求 + * @return 结果 + */ + @Override +// @Async + public Integer insertMkAppletRequest(MkAppletRequest mkAppletRequest) + { + mkAppletRequest.setCreateTime(DateUtils.getNowDate()); + Integer i= mkAppletRequestMapper.insertMkAppletRequest(mkAppletRequest); + return i; + } + + /** + * 修改支付宝小程序请求 + * + * @param mkAppletRequest 支付宝小程序请求 + * @return 结果 + */ + @Override + public int updateMkAppletRequest(MkAppletRequest mkAppletRequest) + { + return mkAppletRequestMapper.updateMkAppletRequest(mkAppletRequest); + } + + /** + * 批量删除支付宝小程序请求 + * + * @param mkIds 需要删除的支付宝小程序请求主键 + * @return 结果 + */ + @Override + public int deleteMkAppletRequestByMkIds(Long[] mkIds) + { + return mkAppletRequestMapper.deleteMkAppletRequestByMkIds(mkIds); + } + + /** + * 删除支付宝小程序请求信息 + * + * @param mkId 支付宝小程序请求主键 + * @return 结果 + */ + @Override + public int deleteMkAppletRequestByMkId(Long mkId) + { + return mkAppletRequestMapper.deleteMkAppletRequestByMkId(mkId); + } +} diff --git a/health_framework/src/main/java/cn/card/health/service/impl/insurance/MkInsurancePayServiceImpl.java b/health_framework/src/main/java/cn/card/health/service/impl/insurance/MkInsurancePayServiceImpl.java new file mode 100644 index 0000000..914076f --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/service/impl/insurance/MkInsurancePayServiceImpl.java @@ -0,0 +1,104 @@ +package cn.card.health.service.impl.insurance; + +import cn.card.health.bean.insurance.MkInsurancePay; +import cn.card.health.mapper.insurance.MkInsurancePayMapper; +import cn.card.health.service.insurance.IMkInsurancePayService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 医保支付Service业务层处理 + * + * @author ruoyi + * @date 2022-10-24 + */ +@Service +public class MkInsurancePayServiceImpl implements IMkInsurancePayService +{ + @Autowired + private MkInsurancePayMapper mkInsurancePayMapper; + + /** + * 查询医保支付 + * + * @param mkId 医保支付主键 + * @return 医保支付 + */ + @Override + public MkInsurancePay selectMkInsurancePayByMkId(Long mkId) + { + return mkInsurancePayMapper.selectMkInsurancePayByMkId(mkId); + } + + /** + * 查询医保支付列表 + * + * @param mkInsurancePay 医保支付 + * @return 医保支付 + */ + @Override + public List selectMkInsurancePayList(MkInsurancePay mkInsurancePay) + { + return mkInsurancePayMapper.selectMkInsurancePayList(mkInsurancePay); + } + + @Override + public MkInsurancePay selectMkInsurancePayInfo(MkInsurancePay mkInsurancePay) { + return mkInsurancePayMapper.selectMkInsurancePayInfo(mkInsurancePay); + } + + /** + * 新增医保支付 + * + * @param mkInsurancePay 医保支付 + * @return 结果 + */ + @Override + public int insertMkInsurancePay(MkInsurancePay mkInsurancePay) + { + return mkInsurancePayMapper.insertMkInsurancePay(mkInsurancePay); + } + + /** + * 修改医保支付 + * + * @param mkInsurancePay 医保支付 + * @return 结果 + */ + @Override + public int updateMkInsurancePay(MkInsurancePay mkInsurancePay) + { + return mkInsurancePayMapper.updateMkInsurancePay(mkInsurancePay); + } + + @Override + public void updateMkInsurancePayAsyc(MkInsurancePay mkInsurancePay) { + mkInsurancePayMapper.updateMkInsurancePay(mkInsurancePay); + } + + /** + * 批量删除医保支付 + * + * @param mkIds 需要删除的医保支付主键 + * @return 结果 + */ + @Override + public int deleteMkInsurancePayByMkIds(Long[] mkIds) + { + return mkInsurancePayMapper.deleteMkInsurancePayByMkIds(mkIds); + } + + /** + * 删除医保支付信息 + * + * @param mkId 医保支付主键 + * @return 结果 + */ + @Override + public int deleteMkInsurancePayByMkId(Long mkId) + { + return mkInsurancePayMapper.deleteMkInsurancePayByMkId(mkId); + } +} diff --git a/health_framework/src/main/java/cn/card/health/service/impl/order/YcMsgServiceImpl.java b/health_framework/src/main/java/cn/card/health/service/impl/order/YcMsgServiceImpl.java new file mode 100644 index 0000000..152f285 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/service/impl/order/YcMsgServiceImpl.java @@ -0,0 +1,48 @@ +package cn.card.health.service.impl.order; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import cn.card.health.bean.order.YcMsg; +import cn.card.health.mapper.order.YcMsgMapper; +import cn.card.health.service.order.IYcMsgService; + + +@Service +public class YcMsgServiceImpl implements IYcMsgService { + + @Autowired + private YcMsgMapper ycMsgMapper; + /** 新增 */ + public int insertYcMsg(YcMsg ycMsg){ + return ycMsgMapper.insertYcMsg(ycMsg); + } + + /** 删除 */ + public int deleteYcMsg(Long id){ + return ycMsgMapper.deleteYcMsg(id); + } + + /** 更新 */ + public int updateYcMsg(YcMsg ycMsg){ + return ycMsgMapper.updateYcMsg(ycMsg); + } + + /** 根据主键查询 */ + public YcMsg selectYcMsgById(Long id){ + return ycMsgMapper.selectYcMsgById(id); + } + + /** 查询单条 */ + public YcMsg selectYcMsg(YcMsg ycMsg){ + return ycMsgMapper.selectYcMsg(ycMsg); + } + + /** 查询列表 */ + public List selectListYcMsg(YcMsg ycMsg){ + return ycMsgMapper.selectListYcMsg(ycMsg); + } + +} \ No newline at end of file diff --git a/health_framework/src/main/java/cn/card/health/service/impl/order/YcPayCallbackServiceImpl.java b/health_framework/src/main/java/cn/card/health/service/impl/order/YcPayCallbackServiceImpl.java new file mode 100644 index 0000000..69924a0 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/service/impl/order/YcPayCallbackServiceImpl.java @@ -0,0 +1,847 @@ +package cn.card.health.service.impl.order; + +import cn.card.health.bean.hospital.YcPatient; +import cn.card.health.bean.order.*; +import cn.card.health.common.utils.DateUtils; +import cn.card.health.framework.service.RegistHealthService; +import cn.card.health.framework.service.ThreadOrderService; +import cn.card.health.framework.service.alipay.AlipayAppletService; +import cn.card.health.framework.service.bank.BankService; +import cn.card.health.his.service.HisResult; +import cn.card.health.his.service.IHisCallService; +import cn.card.health.mapper.order.YcPayCallbackMapper; +import cn.card.health.service.order.*; +import cn.card.health.service.user.IYcPatientService; +import cn.hutool.core.convert.Convert; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.thread.ThreadUtil; +import com.alibaba.fastjson.JSONObject; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.IOException; +import java.security.GeneralSecurityException; +import java.util.*; + +@Service +public class YcPayCallbackServiceImpl implements IYcPayCallbackService { + private static final Logger logger = LoggerFactory.getLogger(YcPayCallbackServiceImpl.class); + + @Autowired + private YcPayCallbackMapper ycPayCallbackMapper; + @Autowired + private IYcOrderSerialpayService ycOrderSerialpayService; + @Autowired + private IYcOrderRefundpayService ycOrderRefundPayService; + + @Autowired + private AlipayAppletService alipayAppletService; + @Autowired + private RegistHealthService registHealthService; + @Autowired + private IYcOrderService ycOrderService; + @Autowired + private IYcOrderRegistService ycOrderRegistService; + @Autowired + private IYcOrderClinicService ycOrderClinicService; + @Autowired + private ThreadOrderService threadOrderService; + @Autowired + private BankService bankService; + + @Autowired + private IYcPatientService patientService; + + @Autowired + private IMedicalRecordService medicalRecordService; + + private IHisCallService hisCallService; + + @Autowired + public YcPayCallbackServiceImpl(@Qualifier("hdzxyHisCallService") IHisCallService hisCallService) { + this.hisCallService = hisCallService; + } + + /** + * 新增 + */ + @SuppressWarnings("finally") + @Transactional + @Override + public int insertYcPayCallback(YcPayCallback ycPayCallback) { + JSONObject content = JSONObject.parseObject(ycPayCallback.getContent()); + try { +// JSONObject content = json.getJSONObject("resource"); + Long orderid = handlePay(ycPayCallback, content); + if (orderid != null) { + logger.info("支付支付订单处理订单号:{}", orderid); + return 0; + } + + YcOrder ycOrder = ycOrderService.selectYcOrderById(orderid); + String orderType = ycOrder.getOrdertype(); + switch (orderType) { + //预约挂号 + case "PREREGIST": + confirmPreRegOrder(ycOrder); + break; + //当日挂号 + case "CURREGIST": + confirmCurRegOrder(ycOrder); + break; + //就诊卡充值 + case "INCARD": + threadOrderService.confirmCardOrderPay(ycOrder); + break; + //自费病人门诊缴费 + case "CLINIC": + confirmClinicOrder(ycOrder); + break; + //核酸挂号 + case "NUCL": + confirmNUCLOrder(ycOrder); + break; + //住院缴费 + case "INHOSP": + confirmINHOSPOrder(ycOrder); + //病例复印 + case "RECORD": + confirmRecordOrder(ycOrder); + break; + } + //微信健康卡上报用卡监测数据 +// final YcOrder order = ycOrder; +// ThreadUtil.execute(() -> { +//// reportHISData(order); +// }); +// } + } catch (Exception es) { + es.printStackTrace(); + } finally { + ycPayCallbackMapper.insertYcPayCallback(ycPayCallback); + } + return 0; + } + + /** + * 新增 + */ + @SuppressWarnings("finally") + @Transactional + @Override + public int insertYcPayCallbackInsurance(YcPayCallback ycPayCallback, Map params) { + boolean signFlag = alipayAppletService.checkSignature(params); + try { + //签名验证错误,直接返回 + if (!signFlag) { + return 0; + } + JSONObject aliData = JSONObject.parseObject(params.get("biz_content")); + String outtradeno = aliData.getString("out_trade_no"); + YcOrderSerialpay serialpay = new YcOrderSerialpay(); + serialpay.setOuttradeno(outtradeno); + YcOrderSerialpay orderSerialpay = ycOrderSerialpayService.selectYcOrderSerialpay(serialpay); + Integer payStatus = orderSerialpay.getPaystatus(); + //支付已更新,无需处理 + if (payStatus == 3) { + } else { + serialpay.setSerialpayid(orderSerialpay.getSerialpayid()); + serialpay.setMoney(serialpay.getTotalmoney()); + ycOrderSerialpayService.updateYcOrderSerialpay(serialpay); + } + + YcOrder ycOrder = ycOrderService.selectYcOrderById(orderSerialpay.getOrderid()); + Integer insureStatus = ycOrder.getInsureStatus(); + //如果医保订单已更新,无需二次处理 + if(insureStatus == 3){ + return 0; + } + ycOrder.setPayStatus(3); + String orderType = ycOrder.getOrdertype(); + switch (orderType) { + //预约挂号 + case "PREREGIST": + confirmPreRegOrderInsurance(ycOrder); + break; + //当日挂号 + case "CURREGIST": + confirmPreRegOrderInsurance(ycOrder); + break; + //自费病人门诊缴费 + case "CLINIC": + confirmClinicOrder(ycOrder); + break; + //核酸挂号 + case "NUCL": + confirmNUCLOrder(ycOrder); + break; + //住院缴费 + case "INHOSP": + confirmINHOSPOrder(ycOrder); + //病例复印 + case "RECORD": + confirmRecordOrder(ycOrder); + break; + } + } catch (Exception es) { + es.printStackTrace(); + } finally { + ycPayCallbackMapper.insertYcPayCallback(ycPayCallback); + } + return 0; + } + + /** + * 新增 + */ + @SuppressWarnings("finally") + @Transactional + @Override + public int insertYcPayCallback(YcPayCallback ycPayCallback, Map params) { +// JSONObject content = JSONObject.parseObject(ycPayCallback.getContent()); + try { +// JSONObject content = json.getJSONObject("resource"); + + JSONObject content = alipayAppletService.toDecodeParent(params); + if (!content.getBoolean("signFlag")) { + return -1; + } + Long orderid = handlePay(ycPayCallback, content); + logger.info("支付支付订单处理订单号:{}", orderid); + if (orderid == null) { + return 0; + } + + YcOrder ycOrder = ycOrderService.selectYcOrderById(orderid); + String orderType = ycOrder.getOrdertype(); + switch (orderType) { + //预约挂号 + case "PREREGIST": + confirmPreRegOrder(ycOrder); + break; + //当日挂号 + case "CURREGIST": + confirmCurRegOrder(ycOrder); + break; + //就诊卡充值 + case "INCARD": + threadOrderService.confirmCardOrderPay(ycOrder); + break; + //自费病人门诊缴费 + case "CLINIC": + confirmClinicOrder(ycOrder); + break; + //核酸挂号 + case "NUCL": + confirmNUCLOrder(ycOrder); + break; + //住院缴费 + case "INHOSP": + confirmINHOSPOrder(ycOrder); + //病例复印 + case "RECORD": + confirmRecordOrder(ycOrder); + break; + } + } catch (Exception es) { + es.printStackTrace(); + } finally { + ycPayCallbackMapper.insertYcPayCallback(ycPayCallback); + } + return 0; + } + + + /** + * 新增 + */ + @SuppressWarnings("finally") + @Transactional + @Override + public int insertYcPayCallbackBank(YcPayCallback ycPayCallback, Map params) { +// JSONObject content = JSONObject.parseObject(ycPayCallback.getContent()); + try { +// JSONObject content = json.getJSONObject("resource"); + +// JSONObject content = bankService.s + JSONObject content = new JSONObject(); + if (!content.getBoolean("signFlag")) { + return -1; + } + Long orderid = handlePay(ycPayCallback, content); + logger.info("支付支付订单处理订单号:{}", orderid); + if (orderid == null) { + return 0; + } + + YcOrder ycOrder = ycOrderService.selectYcOrderById(orderid); + String orderType = ycOrder.getOrdertype(); + switch (orderType) { + //预约挂号 + case "PREREGIST": + confirmPreRegOrder(ycOrder); + break; + //当日挂号 + case "CURREGIST": + confirmCurRegOrder(ycOrder); + break; + //就诊卡充值 + case "INCARD": + threadOrderService.confirmCardOrderPay(ycOrder); + break; + //自费病人门诊缴费 + case "CLINIC": + confirmClinicOrder(ycOrder); + break; + //核酸挂号 + case "NUCL": + confirmNUCLOrder(ycOrder); + break; + //住院缴费 + case "INHOSP": + confirmINHOSPOrder(ycOrder); + //病例复印 + case "RECORD": + confirmRecordOrder(ycOrder); + break; + } + } catch (Exception es) { + es.printStackTrace(); + } finally { + ycPayCallbackMapper.insertYcPayCallback(ycPayCallback); + } + return 0; + } + + private String handRefund(YcPayCallback ycPayCallback, JSONObject content) + throws GeneralSecurityException, IOException { +// AESUtils aesUtils = new AESUtils(WechatConfig.service_app_secret_v3.getBytes(StandardCharsets.UTF_8)); +// String refundResult = aesUtils.decryptToString(content.getString("associated_data").getBytes(), +// content.getString("nonce").getBytes(), content.getString("ciphertext")); +// ycPayCallback.setDescContent(refundResult); +// JSONObject refundContent = JSONObject.parseObject(refundResult); +// logger.info("微信退款结果:{}", refundContent.toJSONString()); +// YcOrderRefundpay refund = new YcOrderRefundpay(); +// refund.setPaytype("WECHAT"); +// String refundNo = refundContent.getString("out_refund_no"); +// String orderno = refundContent.getString("out_trade_no"); +// if (orderno.startsWith("wmp01")) { +// orderno = orderno.substring(5); +// } +// refund.setOutrefundno(refundNo); +// refund.setRefundtime(new Date()); +// refund.setRefundid(refundContent.getString("refund_id")); +// if ("SUCCESS".equals(refundContent.getString("refund_status"))) { +// refund.setRefundstatus(0x3); +// } else { +// refund.setRefundstatus(0x2); +// } +// refund.setModifytime(new Date()); +// ycOrderRefundPayService.updateYcOrderRefundpayByOutRefundno(refund); +// return orderno; + return ""; + } + + private Long handlePay(YcPayCallback ycPayCallback, JSONObject content) { +// AESUtils aesUtils = new AESUtils(WechatConfig.service_app_secret_v3.getBytes(StandardCharsets.UTF_8)); +// String payResult = aesUtils.decryptToString(content.getString("associated_data").getBytes(), +// content.getString("nonce").getBytes(), content.getString("ciphertext")); +// ycPayCallback.setDescContent(payResult); +// JSONObject payContent = JSONObject.parseObject(payResult); + YcOrderSerialpay serialpay = new YcOrderSerialpay(); + String orderno = content.getString("out_trade_no"); + serialpay.setOuttradeno(orderno); + YcOrderSerialpay orderSerialpay = ycOrderSerialpayService.selectYcOrderSerialpay(serialpay); + serialpay.setSerialpayid(orderSerialpay.getSerialpayid()); + serialpay.setUpdatetime(new Date()); + serialpay.setTransactionid(content.getString("trade_no")); +// serialpay.setUserno(content.getString("buyer_logon_id")); + if ("TRADE_SUCCESS".equals(content.getString("trade_status"))) { + + /* + String url = "https://www.hbyctr.com/pro-icon/sunshang.png"; + JSONNode nodes = new JSONNode(); + nodes.putNode("first").put("value", "恭喜您挂号成功"); + nodes.putNode("keyword1").put("value", "邢广茂"); + nodes.putNode("keyword2").put("value", "131342134"); + nodes.putNode("keyword3").put("value", "翠园"); + nodes.putNode("keyword4").put("value", "2021-07-21"); + nodes.putNode("keyword5").put("value", "李志"); + nodes.putNode("remark").put("value", "祝您身体健康"); + String params = "grant_type=client_credential&appid=" + WechatConfig.service_appid + "&secret=" + + WechatConfig.service_secret + ""; + String token = HttpUtils.sendGet("https://api.weixin.qq.com/cgi-bin/token", params); + + WechatMsgTemplate template = WechatMsgTemplate.instance(serialpay.getUserno(), + WechatMsgTemplate.msg_pay_success, url, nodes); + WechatMsgSend.send(JSONObject.parseObject(token).getString("access_token"), template); + */ + serialpay.setPaystatus(0x3); + ycOrderSerialpayService.updateYcOrderSerialpay(serialpay); + return orderSerialpay.getOrderid(); + } else { + serialpay.setPaystatus(0x2); + ycOrderSerialpayService.updateYcOrderSerialpay(serialpay); + return null; + } + } + + @Override + public boolean updateSerialPay(String orderno, String tradeNo, String userId, String payType) { + YcOrderSerialpay serialpay = new YcOrderSerialpay(); + serialpay.setOuttradeno(orderno); + serialpay.setUpdatetime(new Date()); + serialpay.setTransactionid(tradeNo); + serialpay.setUserno(userId); + serialpay.setPaytype(payType); + int result = ycOrderSerialpayService.updateYcOrderSerialpayByOuttradeno(serialpay); + return result > 0; + } + + /** + * 删除 + */ + @Override + public int deleteYcPayCallback(Long id) { + return ycPayCallbackMapper.deleteYcPayCallback(id); + } + + /** + * 更新 + */ + @Override + public int updateYcPayCallback(YcPayCallback ycPayCallback) { + return ycPayCallbackMapper.updateYcPayCallback(ycPayCallback); + } + + /** + * 根据主键查询 + */ + @Override + public YcPayCallback selectYcPayCallbackById(Long id) { + return ycPayCallbackMapper.selectYcPayCallbackById(id); + } + + /** + * 查询单条 + */ + @Override + public YcPayCallback selectYcPayCallback(YcPayCallback ycPayCallback) { + return ycPayCallbackMapper.selectYcPayCallback(ycPayCallback); + } + + /** + * 查询列表 + */ + @Override + public List selectListYcPayCallback(YcPayCallback ycPayCallback) { + return ycPayCallbackMapper.selectListYcPayCallback(ycPayCallback); + } + + @Override + public void insertAlipayCallback(String orderno) { + //加锁 + try { + synchronized (this) { + payLock(orderno, "PAY", new Date()); + } + } catch (Exception e) { + logger.info("订单{}正在处理。", orderno); + } + + YcOrder ycOrder = new YcOrder(); + ycOrder.setOrderno(orderno); + ycOrder = ycOrderService.selectYcOrder(ycOrder); + if (ycOrder != null) { + String orderType = ycOrder.getOrdertype(); + switch (orderType) { + case "PREREGIST"://预约挂号 + confirmPreRegOrder(ycOrder); + break; + case "CURREGIST"://当日挂号 + confirmCurRegOrder(ycOrder); + break; + case "CLINIC"://自费病人门诊缴费 + confirmClinicOrder(ycOrder); + break; + case "NUCL"://核酸挂号 + confirmNUCLOrder(ycOrder); + break; + case "INHOSP"://住院缴费 + confirmINHOSPOrder(ycOrder); + case "RECORD"://病例复印 + confirmRecordOrder(ycOrder); + break; + } + } + } + + @Override + public boolean insertYcPayCallback(String content, String payName, String payType) { + YcPayCallback callBack = new YcPayCallback(); + callBack.setContent(content); + callBack.setPayname(payName); + callBack.setPaytype(payType); + int result = ycPayCallbackMapper.insertYcPayCallback(callBack); + return result > 0; + } + + /** + * 预约挂号 + */ + private void confirmPreRegOrderInsurance(YcOrder ycOrder) { + YcOrderRegist ycOrderRegist = new YcOrderRegist(); + ycOrderRegist.setOrderid(ycOrder.getOrderid()); + ycOrderRegist = ycOrderRegistService.selectYcOrderRegist(ycOrderRegist); + ycOrderRegist.setYcOrder(ycOrder); + registHealthService.preRegOrderInsurance(ycOrder); + } + /** + * 预约挂号 + */ + private void confirmPreRegOrder(YcOrder ycOrder) { + YcOrderRegist ycOrderRegist = new YcOrderRegist(); + ycOrderRegist.setOrderid(ycOrder.getOrderid()); + ycOrderRegist = ycOrderRegistService.selectYcOrderRegist(ycOrderRegist); + ycOrderRegist.setYcOrder(ycOrder); + registHealthService.confirmPreRegOrderPay(ycOrderRegist); + //发送消息通知 +// if (result) { +// YcPatient ycPatient = patientService.selectYcPatientById(ycOrder.getPatientid()); +// +// String payType = ycOrderSerialpay.getPaytype(); +// if (payType.equals("WECHAT")) { +// +// } else if (payType.equals("ALIPAY")) { +// String userId = ycOrderSerialpay.getUserno(); +// String deptName = ycOrderRegist.getDeptname(); +// String doctorName = ycOrderRegist.getDoctorname(); +// String patientName = ycPatient.getPatientName(); +// String address = ""; +// String regDate = ycOrderRegist.getRegdate(); +// String orderId = ycOrderRegist.getOrderno(); +//// alipayAppletService.registerMsgSuccessSend(userId, deptName, doctorName, patientName, address, regDate, orderId); +// } +// } + } + + /** + * 当日挂号 + */ + private void confirmCurRegOrder(YcOrder ycOrder) { + YcOrderRegist ycOrderRegist = new YcOrderRegist(); + ycOrderRegist.setOrderid(ycOrder.getOrderid()); + ycOrderRegist = ycOrderRegistService.selectYcOrderRegist(ycOrderRegist); + YcOrderSerialpay ycOrderSerialpay = new YcOrderSerialpay(); + ycOrderSerialpay.setOrderid(ycOrder.getOrderid()); + ycOrderSerialpay = ycOrderSerialpayService.selectYcOrderSerialpay(ycOrderSerialpay); + ycOrderRegist.setSerialpay(ycOrderSerialpay); + ycOrderRegist.setYcOrder(ycOrder); + boolean result = registHealthService.confirmCurRegOrder(ycOrderRegist); + + //发送消息通知 + if (result) { + YcPatient ycPatient = patientService.selectYcPatientById(ycOrder.getPatientid()); + + String payType = ycOrderSerialpay.getPaytype(); + if (payType.equals("WECHAT")) { + + } else if (payType.equals("ALIPAY")) { + String userId = ycOrderSerialpay.getUserno(); + String deptName = ycOrderRegist.getDeptname(); + String doctorName = ycOrderRegist.getDoctorname(); + String patientName = ycPatient.getPatientName(); + String address = ""; + String regDate = ycOrderRegist.getRegdate(); + String orderId = ycOrderRegist.getOrderno(); +// alipayAppletService.registerMsgSuccessSend(userId, deptName, doctorName, patientName, address, regDate, orderId); + } + } + } + + /** + * 自费病人门诊缴费 + */ + private void confirmClinicOrder(YcOrder ycOrder) { + YcOrderClinic ycOrderClinic = new YcOrderClinic(); + ycOrderClinic.setOrderid(ycOrder.getOrderid()); + ycOrderClinic = ycOrderClinicService.selectYcOrderClinic(ycOrderClinic); + YcOrderSerialpay ycOrderSerialpay = new YcOrderSerialpay(); + ycOrderSerialpay.setOrderid(ycOrder.getOrderid()); + ycOrderSerialpay = ycOrderSerialpayService.selectYcOrderSerialpay(ycOrderSerialpay); + + Map params = new HashMap<>(); + params.put("openid", ycOrder.getOpenid()); + params.put("orderno", ycOrder.getOrderno()); + params.put("orderid", String.valueOf(ycOrder.getOrderid())); + params.put("patId", String.valueOf(ycOrder.getPatientid())); + params.put("visitId", ycOrderClinic.getVisitid()); + params.put("orderPayId", ycOrderSerialpay.getTransactionid()); + params.put("payAmount", String.valueOf(ycOrderSerialpay.getPaymoney())); + params.put("payMode", ycOrderSerialpay.getPaytype()); + params.put("payTime", DateUtils.dateTimeHMS(ycOrderSerialpay.getPaytime())); + params.put("serialno", ycOrderSerialpay.getSerialno()); + params.put("paynocestr", ycOrderSerialpay.getPaynocestr()); + params.put("deptId", ycOrderClinic.getDeptno()); + params.put("doctorId", ycOrderClinic.getDoctorno()); + HisResult result = hisCallService.payClinicOrder(params); + if (result.isSucess()) { + String hisOrderPayId = (String) result.getRetData().get("hisOrderId"); + String receiptId = (String) result.getRetData().get("receiptId"); + ycOrder.setHisOrderId(hisOrderPayId); + ycOrder.setReceiptId(receiptId); + ycOrder.setOrderStatus(5); + } else { + ycOrder.setOrderStatus(2); + ycOrder.setReason(result.getReturnMsg()); + } + ycOrderService.updateYcOrder(ycOrder); + + //缴费成功,发送消息 + if (result.isSucess()) { + YcPatient ycPatient = patientService.selectYcPatientById(ycOrder.getPatientid()); + + String payType = ycOrderSerialpay.getPaytype(); + if (payType.equals("WECHAT")) { + + } else if (payType.equals("ALIPAY")) { + String userId = ycOrderSerialpay.getUserno(); + String deptName = ycOrderClinic.getDeptname(); + String doctorName = ycOrderClinic.getDoctorname(); + String patientName = ycPatient.getPatientName(); + int totalAmount = ycOrderSerialpay.getTotalmoney(); + String clinicDate = DateUtil.formatDate(ycOrderSerialpay.getPaytime()); + String orderId = ycOrderClinic.getOrderno(); + alipayAppletService.clinicMsgSuccessSend(userId, deptName, doctorName, patientName, totalAmount, clinicDate, orderId); + } + } + } + + /** + * 核酸挂号缴费 + * + * @param ycOrder + */ + private void confirmNUCLOrder(YcOrder ycOrder) { + YcOrderSerialpay ycOrderSerialpay = new YcOrderSerialpay(); + ycOrderSerialpay.setOrderid(ycOrder.getOrderid()); + ycOrderSerialpay = ycOrderSerialpayService.selectYcOrderSerialpay(ycOrderSerialpay); + + Map params = new HashMap<>(); + params.put("hisCode", ycOrder.getHisOrderId()); + params.put("patId", String.valueOf(ycOrder.getPatientid())); + params.put("orderId", ycOrder.getOrderno()); + params.put("orderPayId", ycOrderSerialpay.getTransactionid()); + + Map result = hisCallService.createNucl(params); + YcOrderRegist orderRegist = new YcOrderRegist(); + orderRegist.setOrderno(ycOrder.getOrderno()); + orderRegist = ycOrderRegistService.selectYcOrderRegist(orderRegist); + if (Convert.toInt(result.get("returnCode")) == 0) { + ycOrder.setOrderStatus(5); + orderRegist.setOrderstatus("5"); + } else { + ycOrder.setOrderStatus(2); + ycOrder.setReason((String) result.get("returnMsg")); + + orderRegist.setOrderstatus("2"); + } + orderRegist.setUpdatetime(new Date()); + ycOrderService.updateYcOrder(ycOrder); + + orderRegist.setUpdatetime(new Date()); + ycOrderRegistService.updateYcOrderRegist(orderRegist); + } + + /** + * 住院缴费 + * + * @param ycOrder + */ + private void confirmINHOSPOrder(YcOrder ycOrder) { + YcOrderSerialpay ycOrderSerialpay = new YcOrderSerialpay(); + ycOrderSerialpay.setOrderid(ycOrder.getOrderid()); + ycOrderSerialpay = ycOrderSerialpayService.selectYcOrderSerialpay(ycOrderSerialpay); + + Map params = new HashMap<>(); + params.put("visitId", ycOrder.getHisOrderId()); + params.put("patId", String.valueOf(ycOrder.getPatientid())); + params.put("orderId", ycOrder.getOrderno()); + params.put("orderPayId", ycOrderSerialpay.getTransactionid()); + params.put("payAmount", ycOrderSerialpay.getPaymoney() + ""); + + YcPatient patient = patientService.selectYcPatientById(ycOrder.getPatientid()); + params.put("patName", patient.getPatientName()); + + HisResult result = hisCallService.payIpDeposit(params); + if (result.isSucess()) { + ycOrder.setOrderStatus(5); + ycOrderService.updateYcOrder(ycOrder); + } else { + ycOrder.setOrderStatus(2); + ycOrder.setReason(result.getReturnMsg()); + ycOrderService.updateYcOrder(ycOrder); + } + } + + /** + * 病例复印缴费 + * + * @param ycOrder + */ + private void confirmRecordOrder(YcOrder ycOrder) { + ycOrder.setOrderStatus(5); + ycOrderService.updateYcOrder(ycOrder); + + MedicalRecord medicalRecord = new MedicalRecord(); + medicalRecord.setOrderNo(ycOrder.getOrderno()); + medicalRecord.setStatus(3); + medicalRecord.setUpdateTime(new Date()); + medicalRecordService.updateByOrderNo(medicalRecord); + } + + /** + * 预约挂号退款 + */ + private void refundPreRegOrder(YcOrder ycOrder) { + YcOrderRegist orderRegist = new YcOrderRegist(); + orderRegist.setOrderno(ycOrder.getOrderno()); + orderRegist.setOrderstatus("7"); + orderRegist = ycOrderRegistService.selectYcOrderRegist(orderRegist); + + if (orderRegist != null) { + orderRegist.setOrderstatus("6");//6:退费完成,7:HIS退费待微信退费 + orderRegist.setUpdatetime(new Date()); + ycOrderRegistService.updateYcOrderRegist(orderRegist); + + ycOrder.setOrderStatus(6); + ycOrderService.updateYcOrder(ycOrder); + //registHealthService.refundPreReg(orderRegist); + } + } + + /** + * 当日挂号退款 + */ + private void refundCurRegOrder(YcOrder ycOrder) { + YcOrderRegist orderRegist = new YcOrderRegist(); + orderRegist.setOrderno(ycOrder.getOrderno()); + orderRegist.setOrderstatus("5"); + orderRegist = ycOrderRegistService.selectYcOrderRegist(orderRegist); + + if (orderRegist != null) { + orderRegist.setOrderstatus("6"); + orderRegist.setUpdatetime(new Date()); + ycOrderRegistService.updateYcOrderRegist(orderRegist); + registHealthService.cancelLockCurRegOrder(orderRegist); + } + } + + private void refundNuclOrder(YcOrder ycOrder) { + YcOrderRegist orderRegist = new YcOrderRegist(); + orderRegist.setOrderstatus("1"); + orderRegist.setOrderno(ycOrder.getOrderno()); + orderRegist = ycOrderRegistService.selectYcOrderRegist(orderRegist); + if (orderRegist != null) { + ycOrder.setOrderStatus(2); + ycOrder.setReason("系统异常,手动退款"); + ycOrderService.updateYcOrder(ycOrder); + + orderRegist.setOrderstatus("6"); + orderRegist.setUpdatetime(new Date()); + ycOrderRegistService.updateYcOrderRegist(orderRegist); + } + } + + /** + * 缴费退款 + */ + private void refundClinicRegOrder(YcOrder ycOrder) { + ycOrder.setOrderStatus(6); + int result = ycOrderService.updateYcOrder(ycOrder); + if (result < 1) { + logger.info("退费成功,状态修改失败,订单号码:{}", ycOrder.getOrderno()); + } + } + + /** + * 住院缴费退费 + */ + private void refundInhospOrder(YcOrder ycOrder) { + ycOrder.setOrderStatus(6); + int result = ycOrderService.updateYcOrder(ycOrder); + + if (result < 1) { + logger.info("住院缴费退费成功,状态修改失败,订单号码:{}", ycOrder.getOrderno()); + } + } + + /** + * 向微信健康卡上报用卡监测数据 + */ +// @Override +// public JSONObject reportHISData(YcOrder ycOrder) { +// ReportHISData data = new ReportHISData(); +// data.setHospitalCode(WechatHospConfig.hospitalId); +// data.setTime(DateUtil.formatDateTime(new Date())); +// +// Long patientid = ycOrder.getPatientid(); +// HealthCardInfo cardInfo = healthCardInfoService.findHealthCardInfoByPatientId(String.valueOf(patientid)); +// data.setQrCodeText(cardInfo.getQrCodeText()); +// +// String scene = ""; +// String orderType = ycOrder.getOrdertype(); +// switch (orderType) { +// case "PREREGIST"://预约挂号 +// scene = "0101011"; +// break; +// case "CURREGIST"://当日挂号 +// scene = "0101012"; +// break; +// case "CLINIC"://自费病人门诊缴费 +// scene = "0101051"; +// break; +// case "NUCL"://核酸挂号 +// scene = "0101012"; +// break; +// } +// data.setScene(scene); +// +// if (!orderType.equals("CLINIC")) { +// if (orderType.equals("NUCL")) { +// data.setDepartment("传染科"); +// } else { +// YcOrderRegist ycOrderRegist = new YcOrderRegist(); +// ycOrderRegist.setOrderno(ycOrder.getOrderno()); +// ycOrderRegist = ycOrderRegistService.selectYcOrderRegist(ycOrderRegist); +// String deptId = ycOrderRegist.getDeptno();//获取科室代码 +// +// String department = ycPayCallbackMapper.getWechatDepartment(deptId); +// data.setDepartment(department); +// } +// } +// +// data.setCardType("11");//健康卡 +// data.setCardChannel("0402");//小程序 +// data.setCardCostTypes("0100");//自费 +// +// JSONObject reportHISDataRsp = getHeatlhCardService.reportHISData(data); +// +// //挂号再传一个缴费 +// if (!orderType.equals("CLINIC")) { +// data.setScene("0101051"); +// getHeatlhCardService.reportHISData(data); +// } +// +// // 响应请求 +// return reportHISDataRsp; +// } + @Override + public synchronized Integer payLock(String orderno, String payType, Date createTime) { + return ycPayCallbackMapper.payLock(orderno, payType, createTime); + } +} \ No newline at end of file diff --git a/health_framework/src/main/java/cn/card/health/service/impl/user/YcAuthorityServiceImpl.java b/health_framework/src/main/java/cn/card/health/service/impl/user/YcAuthorityServiceImpl.java new file mode 100644 index 0000000..e0d4ed5 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/service/impl/user/YcAuthorityServiceImpl.java @@ -0,0 +1,46 @@ +package cn.card.health.service.impl.user; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import java.util.List; +import cn.card.health.mapper.user.YcAuthorityMapper; +import cn.card.health.bean.user.YcAuthority; +import cn.card.health.service.user.IYcAuthorityService; + + +@Service +public class YcAuthorityServiceImpl implements IYcAuthorityService { + + @Autowired + private YcAuthorityMapper ycAuthorityMapper; + /** 新增 */ + public int insertYcAuthority(YcAuthority ycAuthority){ + return ycAuthorityMapper.insertYcAuthority(ycAuthority); + } + + /** 删除 */ + public int deleteYcAuthority(Long id){ + return ycAuthorityMapper.deleteYcAuthority(id); + } + + /** 更新 */ + public int updateYcAuthority(YcAuthority ycAuthority){ + return ycAuthorityMapper.updateYcAuthority(ycAuthority); + } + + /** 根据主键查询 */ + public YcAuthority selectYcAuthorityById(Long id){ + return ycAuthorityMapper.selectYcAuthorityById(id); + } + + /** 查询单条 */ + public YcAuthority selectYcAuthority(YcAuthority ycAuthority){ + return ycAuthorityMapper.selectYcAuthority(ycAuthority); + } + + /** 查询列表 */ + public List selectListYcAuthority(YcAuthority ycAuthority){ + return ycAuthorityMapper.selectListYcAuthority(ycAuthority); + } + +} \ No newline at end of file diff --git a/health_framework/src/main/java/cn/card/health/service/impl/user/YcInhospPatientServiceImpl.java b/health_framework/src/main/java/cn/card/health/service/impl/user/YcInhospPatientServiceImpl.java new file mode 100644 index 0000000..b27a47f --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/service/impl/user/YcInhospPatientServiceImpl.java @@ -0,0 +1,48 @@ +package cn.card.health.service.impl.user; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import cn.card.health.bean.user.YcInhospPatient; +import cn.card.health.mapper.user.YcInhospPatientMapper; +import cn.card.health.service.user.IYcInhospPatientService; + + +@Service +public class YcInhospPatientServiceImpl implements IYcInhospPatientService { + + @Autowired + private YcInhospPatientMapper ycInhospPatientMapper; + /** 新增 */ + public int insertYcInhospPatient(YcInhospPatient ycInhospPatient){ + return ycInhospPatientMapper.insertYcInhospPatient(ycInhospPatient); + } + + /** 删除 */ + public int deleteYcInhospPatient(Long id){ + return ycInhospPatientMapper.deleteYcInhospPatient(id); + } + + /** 更新 */ + public int updateYcInhospPatient(YcInhospPatient ycInhospPatient){ + return ycInhospPatientMapper.updateYcInhospPatient(ycInhospPatient); + } + + /** 根据主键查询 */ + public YcInhospPatient selectYcInhospPatientById(Long id){ + return ycInhospPatientMapper.selectYcInhospPatientById(id); + } + + /** 查询单条 */ + public YcInhospPatient selectYcInhospPatient(YcInhospPatient ycInhospPatient){ + return ycInhospPatientMapper.selectYcInhospPatient(ycInhospPatient); + } + + /** 查询列表 */ + public List selectListYcInhospPatient(YcInhospPatient ycInhospPatient){ + return ycInhospPatientMapper.selectListYcInhospPatient(ycInhospPatient); + } + +} \ No newline at end of file diff --git a/health_framework/src/main/java/cn/card/health/service/impl/user/YcOAuthServiceImpl.java b/health_framework/src/main/java/cn/card/health/service/impl/user/YcOAuthServiceImpl.java new file mode 100644 index 0000000..d830f15 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/service/impl/user/YcOAuthServiceImpl.java @@ -0,0 +1,75 @@ +package cn.card.health.service.impl.user; + +import cn.card.health.bean.user.YcOAuth; +import cn.card.health.mapper.user.YcOAuthMapper; +import cn.card.health.service.user.IYcOAuthService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + + +@Service +public class YcOAuthServiceImpl implements IYcOAuthService { + + @Autowired + private YcOAuthMapper YcOAuthMapper; + + /** + * 新增 + */ + @Override + public int insertYcOAuth(YcOAuth YcOAuth) { + return YcOAuthMapper.insertYcOAuth(YcOAuth); + } + + /** + * 删除 + */ + @Override + public int deleteYcOAuth(Long id) { + return YcOAuthMapper.deleteYcOAuth(id); + } + + /** + * 更新 + */ + @Override + public int updateYcOAuth(YcOAuth YcOAuth) { + return YcOAuthMapper.updateYcOAuth(YcOAuth); + } + + /** + * 根据主键查询 + */ + @Override + public YcOAuth selectYcOAuthById(Long id) { + return YcOAuthMapper.selectYcOAuthById(id); + } + + /** + * 查询单条 + */ + @Override + public YcOAuth selectYcOAuth(YcOAuth YcOAuth) { + return YcOAuthMapper.selectYcOAuth(YcOAuth); + } + + @Override + public YcOAuth selectYcOAuth(String openid, String authType) { + YcOAuth auth = new YcOAuth(); + auth.setOpenid(openid); + auth.setAuthType(authType); + YcOAuth oauth = this.selectYcOAuth(auth); + return oauth; + } + + /** + * 查询列表 + */ + @Override + public List selectListYcOAuth(YcOAuth YcOAuth) { + return YcOAuthMapper.selectListYcOAuth(YcOAuth); + } + +} \ No newline at end of file diff --git a/health_framework/src/main/java/cn/card/health/service/impl/user/YcPatientServiceImpl.java b/health_framework/src/main/java/cn/card/health/service/impl/user/YcPatientServiceImpl.java new file mode 100644 index 0000000..11b57c2 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/service/impl/user/YcPatientServiceImpl.java @@ -0,0 +1,183 @@ +package cn.card.health.service.impl.user; + +import cn.card.health.bean.hospital.YcPatient; +import cn.card.health.his.service.HisResult; +import cn.card.health.his.service.IHisCallService; +import cn.card.health.mapper.user.YcPatientMapper; +import cn.card.health.service.user.IYcPatientService; +import com.alibaba.fastjson.JSONObject; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; + +@Service +public class YcPatientServiceImpl implements IYcPatientService { + private Logger logger = LoggerFactory.getLogger(YcPatientServiceImpl.class); + + private IHisCallService hisCallService; + + @Autowired + private YcPatientMapper ycPatientMapper; + + @Autowired + public YcPatientServiceImpl(@Qualifier("hdzxyHisCallService") IHisCallService hisCallService) { + this.hisCallService = hisCallService; + } + + /** + * 新增 + */ + @Override + public int insertYcPatient(YcPatient ycPatient) { + return ycPatientMapper.insertYcPatient(ycPatient); + } + + /** + * 删除 + */ + @Override + public int deleteYcPatient(Long id) { + YcPatient patient = new YcPatient(); + patient.setPatientid(id); + patient.setDelFlag(2); + return ycPatientMapper.updateYcPatient(patient); + } + + /** + * 更新 + */ + @Override + public int updateYcPatient(YcPatient patient) { + return ycPatientMapper.updateYcPatient(patient); + } + + /** + * 更新 + */ + @Override + public int updateHISPatient(JSONObject params) { + + logger.info("==YcPatientServiceImpl.addPatient 开始修改患者信息{}==", params.toJSONString()); + HisResult result = hisCallService.updatePatient(params); + if (result.isSucess()) { + logger.info("====YcPatientServiceImpl.addPatient调用HIS服务,有患者记录修改{} ===", params.toJSONString()); + return 1; + }else{ + return 0; + } +// return ycPatientMapper.updateYcPatient(patient); + } + + /** + * 根据主键查询 + */ + @Override + public YcPatient selectYcPatientById(Long id) { + return ycPatientMapper.selectYcPatientById(id); + } + + /** + * 查询单条 + */ + @Override + public YcPatient selectYcPatient(YcPatient ycPatient) { + return ycPatientMapper.selectYcPatient(ycPatient); + } + + /** + * 查询列表 + */ + @Override + public List selectListYcPatient(YcPatient ycPatient) { + return ycPatientMapper.selectListYcPatient(ycPatient); + } + + @Override + public int addPatient(YcPatient patient) { + YcPatient pat = new YcPatient(); + pat.setCardno(patient.getCardno()); + pat.setDelFlag(1); + pat = selectYcPatient(pat); + logger.info("====YcPatientServiceImpl.addMemberInfo调用HIS服务,{} {}建卡", patient.getCardno(), patient.getPatientName()); + HisResult result = hisCallService.registPatientInfo(patient); + if (result.isSucess()) { + String memberid = ""; + if(result.getListData()!=null) { + List> list = result.getListData(); + + for (Map map : list) { + memberid = memberid + "," + map.get("id"); + } + memberid = memberid.substring(1); + }else if(result.getRetData()!=null) { + memberid = result.getRetData().get("memberId")+""; + } + patient.setCardid(memberid); + patient.setDelFlag(1); + logger.info("====YcPatientServiceImpl.addPatient调用HIS服务,{} {}建卡成功", patient.getCardno(), patient.getPatientName()); + + return this.insertYcPatient(patient); + } else { + patient.setChannel(result.getReturnMsg()); + logger.info("====YcPatientServiceImpl.addPatient调用HIS服务,{} {}建卡失败", patient.getCardno(), patient.getPatientName()); + return 0; + } + } + + @Override + public Object checkPatient(String memberid) { + HisResult result = hisCallService.getPatientInfo(memberid); + if(result.isSucess()){ + return result.getRetData(); + }else { + return null; + } + } + + @Override + public int removeYcPatientByMap(Map params) { + //params.put("hospid", WechatConfig.hospitalId); + YcPatient patient = selectYcPatientByMap(params); + if (patient == null) { + logger.info("====YcPatientServiceImpl.removeYcPatientByMap 未查询到患者信息{}", params); + return 0; + } + + patient.setDelFlag(2); + this.updateYcPatient(patient); +// if ("F".equals(patient.getIsnew())) { +// logger.info("====YcPatientServiceImpl.removeYcPatientByMap 患者{} {}不是在此建卡,直接解绑", patient.getCardno(), patient.getPatientName()); +// return 1; +// } +// logger.info("====YcPatientServiceImpl.removeYcPatientByMap 患者{} {}是在此建卡,调用his解绑", patient.getCardno(), patient.getPatientName()); +// HisResult result = hisCallService.unbindPatient(patient); +// if (result.isSucess()) { +// logger.info("====YcPatientServiceImpl.removeYcPatientByMap 患者{} {}his解绑成功", patient.getCardno(), patient.getPatientName()); +// return 1; +// } else { +// logger.info("====YcPatientServiceImpl.removeYcPatientByMap 患者{} {}his解绑失败", patient.getCardno(), patient.getPatientName()); +// return 0; +// } + return 1; + } + + @Override + public YcPatient selectYcPatientByMap(Map params) { + return ycPatientMapper.selectYcPatientByMap(params); + } + + @Override + public int registerLock(String idNumber) { + return ycPatientMapper.registerLock(idNumber); + } + + @Override + public int registerUnlock(String idNumber) { + return ycPatientMapper.registerUnlock(idNumber); + } +} \ No newline at end of file diff --git a/health_framework/src/main/java/cn/card/health/service/impl/user/YcUserServiceImpl.java b/health_framework/src/main/java/cn/card/health/service/impl/user/YcUserServiceImpl.java new file mode 100644 index 0000000..3a214b2 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/service/impl/user/YcUserServiceImpl.java @@ -0,0 +1,171 @@ +package cn.card.health.service.impl.user; + +import cn.card.health.bean.user.LoginUser; +import cn.card.health.bean.user.YcOAuth; +import cn.card.health.bean.user.YcUser; +import cn.card.health.framework.service.alipay.AlipayAppletService; +import cn.card.health.framework.service.alipay.TokenService; +import cn.card.health.alipay.config.AlipayAppletConfig; +import cn.card.health.framework.service.alipay.domain.AlipayOAuthTokenDto; +import cn.card.health.mapper.user.YcUserMapper; +import cn.card.health.service.user.IYcOAuthService; +import cn.card.health.service.user.IYcUserService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + + +@Service +public class YcUserServiceImpl implements IYcUserService { + + private Logger logger = LoggerFactory.getLogger(YcUserServiceImpl.class); + @Autowired + private YcUserMapper ycUserMapper; + + @Autowired + private IYcOAuthService oauthService; + @Autowired + private TokenService tokenService; + @Autowired + private AlipayAppletService alipayAppletService; + + /** + * 新增 + */ + @Override + public int insertYcUser(YcUser ycUser) { + return ycUserMapper.insertYcUser(ycUser); + } + + /** + * 删除 + */ + @Override + public int deleteYcUser(Long id) { + return ycUserMapper.deleteYcUser(id); + } + + /** + * 更新 + */ + @Override + public int updateYcUser(YcUser ycUser) { + return ycUserMapper.updateYcUser(ycUser); + } + + /** + * 根据主键查询 + */ + @Override + public YcUser selectYcUserById(Long id) { + return ycUserMapper.selectYcUserById(id); + } + + /** + * 查询单条 + */ + @Override + public YcUser selectYcUser(YcUser ycUser) { + return ycUserMapper.selectYcUser(ycUser); + } + + /** + * 查询列表 + */ + @Override + public List selectListYcUser(YcUser ycUser) { + return ycUserMapper.selectListYcUser(ycUser); + } + + @Override + public YcUser loadUserByUsername(String username) { + return ycUserMapper.loadUserByUsername(username); + } + + @Override + public String login(LoginUser loginUser) { + String openid = loginUser.getUsername(); + String hisid = loginUser.getHisid(); + +/*// TODO 正式上线测试用,未认证用户不允许使用 + YcWechatopen wechatOpen = new YcWechatopen(); + wechatOpen.setOpenid(openid); + wechatOpen = wechatopenService.selectYcWechatopen(wechatOpen); + if (wechatOpen == null) { + logger.info("======wechatLogin openid: " + openid); + throw new CustomException("此功能暂未开通,请等待 " + openid); + }*/ + YcUser user = loadUserByUsername(openid); +// HisConfig hisConfig = wechatConfig.getHisConfig(hisid); + Long hospitalid = 33560L; + loginUser.setHospitalid(hospitalid); + if (user != null) { + } else { + user = new YcUser(); + user.setUsername(openid); + user.setUserType("wechat"); + user.setActivated(true); +// user.setHisid(hisid); +// user.setHospitalid(hospitalid); + this.insertYcUser(user); + } + loginUser.setUser(user); + String token = tokenService.createToken(loginUser); + return token; + } + + @Override + public boolean alipayLogin(LoginUser loginUser) { + logger.info("=====支付宝小程序授权登录====="); + AlipayOAuthTokenDto respDto = alipayAppletService.getOauthToken(loginUser.getCode(), ""); + + //授权获取失败,返回异常 + if (!respDto.isSuccess()) { + logger.info(respDto.getCode() + "|" + respDto.getMsg()); + loginUser.setToken(respDto.getMsg()); + return false; + } + String alipayUserid = respDto.getUserid(); + String access_token = respDto.getAccessToken(); + loginUser.setUsername(alipayUserid); + logger.info("=====token: " + access_token + "======"); + + YcUser user; + // 先查询授权表 + YcOAuth oAuth = oauthService.selectYcOAuth(alipayUserid, "alipay"); + if (oAuth != null) { + user = selectYcUserById(oAuth.getUserid()); + user.setPassword(access_token); //access_token后面要用,很重要 + updateYcUser(user); + } else { + // 查询否存在数据 + user = loadUserByUsername(alipayUserid); + if (user != null) { + } else { + user = new YcUser(); + user.setUsername(alipayUserid); + user.setUserType("alipay"); + user.setActivated(true); + user.setActiveKey(respDto.getRefreshToken()); + //access_token后面要用,很重要 + user.setPassword(access_token); + this.insertYcUser(user); + } + oAuth = new YcOAuth(); + oAuth.setUserid(user.getUserid()); + oAuth.setAppid(AlipayAppletConfig.appid); + oAuth.setAuthType("alipay"); + oAuth.setOpenid(alipayUserid); + oauthService.insertYcOAuth(oAuth); + } + loginUser.setUser(user); + String token = tokenService.createToken(loginUser); + loginUser.setUser(user); + loginUser.setToken(token); + return true; + } + +} \ No newline at end of file diff --git a/health_framework/src/main/java/cn/card/health/service/insurance/IMkAppletRequestService.java b/health_framework/src/main/java/cn/card/health/service/insurance/IMkAppletRequestService.java new file mode 100644 index 0000000..2946cc4 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/service/insurance/IMkAppletRequestService.java @@ -0,0 +1,64 @@ +package cn.card.health.service.insurance; + +import cn.card.health.bean.insurance.MkAppletRequest; +import org.springframework.scheduling.annotation.Async; + +import java.util.List; + +/** + * 支付宝小程序请求Service接口 + * + * @author ruoyi + * @date 2022-10-15 + */ +public interface IMkAppletRequestService +{ + /** + * 查询支付宝小程序请求 + * + * @param mkId 支付宝小程序请求主键 + * @return 支付宝小程序请求 + */ + public MkAppletRequest selectMkAppletRequestByMkId(Long mkId); + + /** + * 查询支付宝小程序请求列表 + * + * @param mkAppletRequest 支付宝小程序请求 + * @return 支付宝小程序请求集合 + */ + public List selectMkAppletRequestList(MkAppletRequest mkAppletRequest); + + /** + * 新增支付宝小程序请求 + * + * @param mkAppletRequest 支付宝小程序请求 + * @return 结果 + */ + @Async + public Integer insertMkAppletRequest(MkAppletRequest mkAppletRequest); + + /** + * 修改支付宝小程序请求 + * + * @param mkAppletRequest 支付宝小程序请求 + * @return 结果 + */ + public int updateMkAppletRequest(MkAppletRequest mkAppletRequest); + + /** + * 批量删除支付宝小程序请求 + * + * @param mkIds 需要删除的支付宝小程序请求主键集合 + * @return 结果 + */ + public int deleteMkAppletRequestByMkIds(Long[] mkIds); + + /** + * 删除支付宝小程序请求信息 + * + * @param mkId 支付宝小程序请求主键 + * @return 结果 + */ + public int deleteMkAppletRequestByMkId(Long mkId); +} diff --git a/health_framework/src/main/java/cn/card/health/service/insurance/IMkInsurancePayService.java b/health_framework/src/main/java/cn/card/health/service/insurance/IMkInsurancePayService.java new file mode 100644 index 0000000..055c227 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/service/insurance/IMkInsurancePayService.java @@ -0,0 +1,78 @@ +package cn.card.health.service.insurance; + +import cn.card.health.bean.insurance.MkInsurancePay; + +import java.util.List; + +/** + * 医保支付Service接口 + * + * @author ruoyi + * @date 2022-10-24 + */ +public interface IMkInsurancePayService +{ + /** + * 查询医保支付 + * + * @param mkId 医保支付主键 + * @return 医保支付 + */ + public MkInsurancePay selectMkInsurancePayByMkId(Long mkId); + + /** + * 查询医保支付列表 + * + * @param mkInsurancePay 医保支付 + * @return 医保支付集合 + */ + public List selectMkInsurancePayList(MkInsurancePay mkInsurancePay); + + /** + * 查询医保支付订单 + * + * @param mkInsurancePay 医保支付 + * @return 医保支付集合 + */ + public MkInsurancePay selectMkInsurancePayInfo(MkInsurancePay mkInsurancePay); + + /** + * 新增医保支付 + * + * @param mkInsurancePay 医保支付 + * @return 结果 + */ + public int insertMkInsurancePay(MkInsurancePay mkInsurancePay); + + /** + * 修改医保支付 + * + * @param mkInsurancePay 医保支付 + * @return 结果 + */ + public int updateMkInsurancePay(MkInsurancePay mkInsurancePay); + + /** + * 修改医保支付 + * + * @param mkInsurancePay 医保支付 + * @return 结果 + */ + public void updateMkInsurancePayAsyc(MkInsurancePay mkInsurancePay); + + /** + * 批量删除医保支付 + * + * @param mkIds 需要删除的医保支付主键集合 + * @return 结果 + */ + public int deleteMkInsurancePayByMkIds(Long[] mkIds); + + /** + * 删除医保支付信息 + * + * @param mkId 医保支付主键 + * @return 结果 + */ + public int deleteMkInsurancePayByMkId(Long mkId); +} diff --git a/health_framework/src/main/java/cn/card/health/service/order/IYcMsgService.java b/health_framework/src/main/java/cn/card/health/service/order/IYcMsgService.java new file mode 100644 index 0000000..04f8c36 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/service/order/IYcMsgService.java @@ -0,0 +1,34 @@ +package cn.card.health.service.order; + +import cn.card.health.bean.order.YcMsg; +import java.util.List; +import java.util.Map; + +/** + * 消息发送 + * + * @author xinggm + * @email + * @date 2021-07-22 10:10:34 + */ +public interface IYcMsgService { + + /** 新增 */ + public int insertYcMsg(YcMsg ycMsg); + + /** 删除 */ + public int deleteYcMsg(Long id); + + /** 更新 */ + public int updateYcMsg(YcMsg ycMsg); + + /** 根据主键查询 */ + public YcMsg selectYcMsgById(Long id); + + /** 查询单条 */ + public YcMsg selectYcMsg(YcMsg ycMsg); + + /** 查询列表 */ + public List selectListYcMsg(YcMsg ycMsg); +} + diff --git a/health_framework/src/main/java/cn/card/health/service/order/IYcPayCallbackService.java b/health_framework/src/main/java/cn/card/health/service/order/IYcPayCallbackService.java new file mode 100644 index 0000000..f3070f7 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/service/order/IYcPayCallbackService.java @@ -0,0 +1,66 @@ +package cn.card.health.service.order; + +import cn.card.health.bean.order.YcOrder; +import cn.card.health.bean.order.YcPayCallback; +import com.alibaba.fastjson.JSONObject; + +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * 微信调用 + * + * @author xinggm + * @email + * @date 2021-07-08 15:32:53 + */ +public interface IYcPayCallbackService { + + /** + * 新增 + */ + public int insertYcPayCallback(YcPayCallback ycPayCallback); + + public int insertYcPayCallbackInsurance(YcPayCallback ycPayCallback, Map params); + + public int insertYcPayCallback(YcPayCallback ycPayCallback, Map params); + + public int insertYcPayCallbackBank(YcPayCallback ycPayCallback, Map params); + + /** + * 删除 + */ + public int deleteYcPayCallback(Long id); + + /** + * 更新 + */ + public int updateYcPayCallback(YcPayCallback ycPayCallback); + + /** + * 根据主键查询 + */ + public YcPayCallback selectYcPayCallbackById(Long id); + + /** + * 查询单条 + */ + public YcPayCallback selectYcPayCallback(YcPayCallback ycPayCallback); + + /** + * 查询列表 + */ + public List selectListYcPayCallback(YcPayCallback ycPayCallback); + + void insertAlipayCallback(String orderNo); + +// public JSONObject reportHISData(YcOrder ycOrder); + + Integer payLock(String orderno, String payType, Date createTime); + + boolean updateSerialPay(String orderNo, String tradeNo, String userId, String payType); + + boolean insertYcPayCallback(String content, String payName, String payType); +} + diff --git a/health_framework/src/main/java/cn/card/health/service/order/impl/YcHealthcardApptokenServiceImpl.java b/health_framework/src/main/java/cn/card/health/service/order/impl/YcHealthcardApptokenServiceImpl.java new file mode 100644 index 0000000..773e976 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/service/order/impl/YcHealthcardApptokenServiceImpl.java @@ -0,0 +1,44 @@ +//package cn.card.health.service.order.impl; +//import org.springframework.stereotype.Service; +//import java.util.Map; +//import cn.card.health.mapper.order.YcHealthcardApptokenMapper; +//import cn.card.health.bean.order.YcHealthcardApptoken; +//import cn.card.health.service.order.IYcHealthcardApptokenService; +// +// +//@Service +//public class YcHealthcardApptokenServiceImpl implements IYcHealthcardApptokenService { +// +// @Autowired +// private YcHealthcardApptokenMapper ycHealthcardApptokenMapper; +// /** 新增 */ +// public int insertYcHealthcardApptoken(YcHealthcardApptoken ycHealthcardApptoken){ +// return ycHealthcardApptokenMapper.insertYcHealthcardApptoken(ycHealthcardApptoken); +// } +// +// /** 删除 */ +// public int deleteYcHealthcardApptoken(Long id){ +// return ycHealthcardApptokenMapper.deleteYcHealthcardApptoken(id); +// } +// +// /** 更新 */ +// public int updateYcHealthcardApptoken(YcHealthcardApptoken ycHealthcardApptoken){ +// return ycHealthcardApptokenMapper.updateYcHealthcardApptoken(ycHealthcardApptoken); +// } +// +// /** 根据主键查询 */ +// public YcHealthcardApptoken selectYcHealthcardApptokenBy(Long id){ +// return ycHealthcardApptokenMapper.selectYcHealthcardApptoken(id); +// } +// +// /** 查询单条 */ +// public YcHealthcardApptoken selectYcHealthcardApptoken(YcHealthcardApptoken ycHealthcardApptoken){ +// return ycHealthcardApptokenMapper.selectYcHealthcardApptoken(ycHealthcardApptoken); +// } +// +// /** 查询列表 */ +// public List selectListYcHealthcardApptoken(YcHealthcardApptoken ycHealthcardApptoken){ +// return ycHealthcardApptokenMapper.selectListYcHealthcardApptoken(ycHealthcardApptoken); +// } +// +//} \ No newline at end of file diff --git a/health_framework/src/main/java/cn/card/health/service/user/IYcAuthorityService.java b/health_framework/src/main/java/cn/card/health/service/user/IYcAuthorityService.java new file mode 100644 index 0000000..c46d67b --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/service/user/IYcAuthorityService.java @@ -0,0 +1,34 @@ +package cn.card.health.service.user; + +import cn.card.health.bean.user.YcAuthority; +import java.util.List; +import java.util.Map; + +/** + * 授权表 + * + * @author xinggm + * @email + * @date 2021-08-30 17:59:54 + */ +public interface IYcAuthorityService { + + /** 新增 */ + public int insertYcAuthority(YcAuthority ycAuthority); + + /** 删除 */ + public int deleteYcAuthority(Long id); + + /** 更新 */ + public int updateYcAuthority(YcAuthority ycAuthority); + + /** 根据主键查询 */ + public YcAuthority selectYcAuthorityById(Long id); + + /** 查询单条 */ + public YcAuthority selectYcAuthority(YcAuthority ycAuthority); + + /** 查询列表 */ + public List selectListYcAuthority(YcAuthority ycAuthority); +} + diff --git a/health_framework/src/main/java/cn/card/health/service/user/IYcInhospPatientService.java b/health_framework/src/main/java/cn/card/health/service/user/IYcInhospPatientService.java new file mode 100644 index 0000000..225e7db --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/service/user/IYcInhospPatientService.java @@ -0,0 +1,34 @@ +package cn.card.health.service.user; + +import cn.card.health.bean.user.YcInhospPatient; +import java.util.List; +import java.util.Map; + +/** + * 住院病人信息 + * + * @author xinggm + * @email + * @date 2021-09-04 09:31:54 + */ +public interface IYcInhospPatientService { + + /** 新增 */ + public int insertYcInhospPatient(YcInhospPatient ycInhospPatient); + + /** 删除 */ + public int deleteYcInhospPatient(Long id); + + /** 更新 */ + public int updateYcInhospPatient(YcInhospPatient ycInhospPatient); + + /** 根据主键查询 */ + public YcInhospPatient selectYcInhospPatientById(Long id); + + /** 查询单条 */ + public YcInhospPatient selectYcInhospPatient(YcInhospPatient ycInhospPatient); + + /** 查询列表 */ + public List selectListYcInhospPatient(YcInhospPatient ycInhospPatient); +} + diff --git a/health_framework/src/main/java/cn/card/health/service/user/IYcOAuthService.java b/health_framework/src/main/java/cn/card/health/service/user/IYcOAuthService.java new file mode 100644 index 0000000..4bf8168 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/service/user/IYcOAuthService.java @@ -0,0 +1,51 @@ +package cn.card.health.service.user; + +import cn.card.health.bean.user.YcOAuth; + +import java.util.List; + +/** + * 用户表 + * + * @author xinggm + * @email + * @date 2021-08-24 15:41:43 + */ +public interface IYcOAuthService { + + /** + * 新增 + */ + public int insertYcOAuth(YcOAuth YcOAuth); + + /** + * 删除 + */ + public int deleteYcOAuth(Long id); + + /** + * 更新 + */ + public int updateYcOAuth(YcOAuth YcOAuth); + + /** + * 根据主键查询 + */ + public YcOAuth selectYcOAuthById(Long id); + + /** + * 查询单条 + */ + public YcOAuth selectYcOAuth(YcOAuth YcOAuth); + + /** + * 查询列表 + */ + public List selectListYcOAuth(YcOAuth YcOAuth); + + /** + * 查询授权表 + */ + YcOAuth selectYcOAuth(String openid, String type); +} + diff --git a/health_framework/src/main/java/cn/card/health/service/user/IYcPatientService.java b/health_framework/src/main/java/cn/card/health/service/user/IYcPatientService.java new file mode 100644 index 0000000..61df51d --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/service/user/IYcPatientService.java @@ -0,0 +1,74 @@ +package cn.card.health.service.user; + +import cn.card.health.bean.hospital.YcPatient; +import com.alibaba.fastjson.JSONObject; + +import java.util.List; +import java.util.Map; + +/** + * HIS病人健康卡对照表 + * + * @author xinggm + * @email + * @date 2021-07-14 09:05:22 + */ +public interface IYcPatientService { + + /** + * 新增 + */ + public int insertYcPatient(YcPatient ycPatient); + + /** + * 删除 + */ + public int deleteYcPatient(Long id); + + /** + * 更新 + */ + public int updateYcPatient(YcPatient ycPatient); + + public int updateHISPatient(JSONObject hisParams); + + /** + * 根据主键查询 + */ + public YcPatient selectYcPatientById(Long id); + + /** + * 查询单条 + */ + public YcPatient selectYcPatient(YcPatient ycPatient); + + /** + * 查询单条 + */ + public YcPatient selectYcPatientByMap(Map params); + + /** + * 查询列表 + */ + public List selectListYcPatient(YcPatient ycPatient); + + /** + * 添加病人信息 + */ + public int addPatient(YcPatient patient); + + /** + * 查看患者信息 + */ + public Object checkPatient(String memberid); + + /** + * 解绑就诊卡 + */ + public int removeYcPatientByMap(Map map); + + int registerLock(String idNumber); + + int registerUnlock(String idNumber); +} + diff --git a/health_framework/src/main/java/cn/card/health/service/user/IYcUserService.java b/health_framework/src/main/java/cn/card/health/service/user/IYcUserService.java new file mode 100644 index 0000000..b82938b --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/service/user/IYcUserService.java @@ -0,0 +1,62 @@ +package cn.card.health.service.user; + +import cn.card.health.bean.user.LoginUser; +import cn.card.health.bean.user.YcUser; + +import java.util.List; + +/** + * 用户表 + * + * @author xinggm + * @email + * @date 2021-08-28 10:47:55 + */ +public interface IYcUserService { + + /** + * 新增 + */ + public int insertYcUser(YcUser ycUser); + + /** + * 删除 + */ + public int deleteYcUser(Long id); + + /** + * 更新 + */ + public int updateYcUser(YcUser ycUser); + + /** + * 根据主键查询 + */ + public YcUser selectYcUserById(Long id); + + /** + * 查询单条 + */ + public YcUser selectYcUser(YcUser ycUser); + + /** + * 查询列表 + */ + public List selectListYcUser(YcUser ycUser); + + /** + * 通过用户名查询 + */ + public YcUser loadUserByUsername(String username); + + /** + * 微信登录 + */ + public String login(LoginUser loginUser); + + /** + * 支付宝小程序登录 + */ + boolean alipayLogin(LoginUser loginUser); +} + diff --git a/health_framework/src/main/java/cn/card/health/util/JSONNode.java b/health_framework/src/main/java/cn/card/health/util/JSONNode.java new file mode 100644 index 0000000..f314d71 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/util/JSONNode.java @@ -0,0 +1,483 @@ +package cn.card.health.util; + +import static com.alibaba.fastjson.util.TypeUtils.castToBigDecimal; +import static com.alibaba.fastjson.util.TypeUtils.castToBigInteger; +import static com.alibaba.fastjson.util.TypeUtils.castToBoolean; +import static com.alibaba.fastjson.util.TypeUtils.castToByte; +import static com.alibaba.fastjson.util.TypeUtils.castToBytes; +import static com.alibaba.fastjson.util.TypeUtils.castToDate; +import static com.alibaba.fastjson.util.TypeUtils.castToDouble; +import static com.alibaba.fastjson.util.TypeUtils.castToFloat; +import static com.alibaba.fastjson.util.TypeUtils.castToInt; +import static com.alibaba.fastjson.util.TypeUtils.castToLong; +import static com.alibaba.fastjson.util.TypeUtils.castToShort; +import static com.alibaba.fastjson.util.TypeUtils.castToSqlDate; +import static com.alibaba.fastjson.util.TypeUtils.castToTimestamp; + +import java.io.Serializable; +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; +import java.lang.reflect.Type; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONException; +import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.TypeReference; +import com.alibaba.fastjson.annotation.JSONField; +import com.alibaba.fastjson.parser.ParserConfig; +import com.alibaba.fastjson.util.TypeUtils; + +public class JSONNode extends JSON implements Map, Cloneable, Serializable, InvocationHandler { + + private static final long serialVersionUID = 1L; + private static final int DEFAULT_INITIAL_CAPACITY = 16; + public JSONNode putNode(String key) { + JSONNode node = new JSONNode(); + this.put(key, node); + return node; + } + + private final Map map; + + public JSONNode(){ + this(DEFAULT_INITIAL_CAPACITY, false); + } + + public JSONNode(Map map){ + this.map = map; + } + + public JSONNode(boolean ordered){ + this(DEFAULT_INITIAL_CAPACITY, ordered); + } + + public JSONNode(int initialCapacity){ + this(initialCapacity, false); + } + + public JSONNode(int initialCapacity, boolean ordered){ + if (ordered) { + map = new LinkedHashMap(initialCapacity); + } else { + map = new HashMap(initialCapacity); + } + } + + public int size() { + return map.size(); + } + + public boolean isEmpty() { + return map.isEmpty(); + } + + public boolean containsKey(Object key) { + return map.containsKey(key); + } + + public boolean containsValue(Object value) { + return map.containsValue(value); + } + + public Object get(Object key) { + Object val = map.get(key); + + if (val == null && key instanceof Number) { + val = map.get(key.toString()); + } + + return val; + } + + public JSONObject getJSONObject(String key) { + Object value = map.get(key); + + if (value instanceof JSONObject) { + return (JSONObject) value; + } + + if (value instanceof String) { + return JSON.parseObject((String) value); + } + + return (JSONObject) toJSON(value); + } + + public JSONArray getJSONArray(String key) { + Object value = map.get(key); + + if (value instanceof JSONArray) { + return (JSONArray) value; + } + + if (value instanceof String) { + return (JSONArray) JSON.parse((String) value); + } + + return (JSONArray) toJSON(value); + } + + public T getObject(String key, Class clazz) { + Object obj = map.get(key); + return TypeUtils.castToJavaBean(obj, clazz); + } + + public T getObject(String key, Type type) { + Object obj = map.get(key); + return TypeUtils.cast(obj, type, ParserConfig.getGlobalInstance()); + } + + public T getObject(String key, TypeReference typeReference) { + Object obj = map.get(key); + if (typeReference == null) { + return (T) obj; + } + return TypeUtils.cast(obj, typeReference.getType(), ParserConfig.getGlobalInstance()); + } + + public Boolean getBoolean(String key) { + Object value = get(key); + + if (value == null) { + return null; + } + + return castToBoolean(value); + } + + public byte[] getBytes(String key) { + Object value = get(key); + + if (value == null) { + return null; + } + + return castToBytes(value); + } + + public boolean getBooleanValue(String key) { + Object value = get(key); + + Boolean booleanVal = castToBoolean(value); + if (booleanVal == null) { + return false; + } + + return booleanVal.booleanValue(); + } + + public Byte getByte(String key) { + Object value = get(key); + + return castToByte(value); + } + + public byte getByteValue(String key) { + Object value = get(key); + + Byte byteVal = castToByte(value); + if (byteVal == null) { + return 0; + } + + return byteVal.byteValue(); + } + + public Short getShort(String key) { + Object value = get(key); + + return castToShort(value); + } + + public short getShortValue(String key) { + Object value = get(key); + + Short shortVal = castToShort(value); + if (shortVal == null) { + return 0; + } + + return shortVal.shortValue(); + } + + public Integer getInteger(String key) { + Object value = get(key); + + return castToInt(value); + } + + public int getIntValue(String key) { + Object value = get(key); + + Integer intVal = castToInt(value); + if (intVal == null) { + return 0; + } + + return intVal.intValue(); + } + + public Long getLong(String key) { + Object value = get(key); + + return castToLong(value); + } + + public long getLongValue(String key) { + Object value = get(key); + + Long longVal = castToLong(value); + if (longVal == null) { + return 0L; + } + + return longVal.longValue(); + } + + public Float getFloat(String key) { + Object value = get(key); + + return castToFloat(value); + } + + public float getFloatValue(String key) { + Object value = get(key); + + Float floatValue = castToFloat(value); + if (floatValue == null) { + return 0F; + } + + return floatValue.floatValue(); + } + + public Double getDouble(String key) { + Object value = get(key); + + return castToDouble(value); + } + + public double getDoubleValue(String key) { + Object value = get(key); + + Double doubleValue = castToDouble(value); + if (doubleValue == null) { + return 0D; + } + + return doubleValue.doubleValue(); + } + + public BigDecimal getBigDecimal(String key) { + Object value = get(key); + + return castToBigDecimal(value); + } + + public BigInteger getBigInteger(String key) { + Object value = get(key); + + return castToBigInteger(value); + } + + public String getString(String key) { + Object value = get(key); + + if (value == null) { + return null; + } + + return value.toString(); + } + + public Date getDate(String key) { + Object value = get(key); + + return castToDate(value); + } + + public java.sql.Date getSqlDate(String key) { + Object value = get(key); + + return castToSqlDate(value); + } + + public java.sql.Timestamp getTimestamp(String key) { + Object value = get(key); + + return castToTimestamp(value); + } + + public JSONNode put(String key, Object value) { + map.put(key, value); + return this; + } + + public JSONNode fluentPut(String key, Object value) { + map.put(key, value); + return this; + } + + public void putAll(Map m) { + map.putAll(m); + } + + public JSONNode fluentPutAll(Map m) { + map.putAll(m); + return this; + } + + public void clear() { + map.clear(); + } + + public JSONNode fluentClear() { + map.clear(); + return this; + } + + public Object remove(Object key) { + return map.remove(key); + } + + public JSONNode fluentRemove(Object key) { + map.remove(key); + return this; + } + + public Set keySet() { + return map.keySet(); + } + + public Collection values() { + return map.values(); + } + + public Set> entrySet() { + return map.entrySet(); + } + + @Override + public Object clone() { + return new JSONObject(map instanceof LinkedHashMap // + ? new LinkedHashMap(map) // + : new HashMap(map) + ); + } + + public boolean equals(Object obj) { + return this.map.equals(obj); + } + + public int hashCode() { + return this.map.hashCode(); + } + + public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + Class[] parameterTypes = method.getParameterTypes(); + if (parameterTypes.length == 1) { + if (method.getName().equals("equals")) { + return this.equals(args[0]); + } + + Class returnType = method.getReturnType(); + if (returnType != void.class) { + throw new JSONException("illegal setter"); + } + + String name = null; + JSONField annotation = method.getAnnotation(JSONField.class); + if (annotation != null) { + if (annotation.name().length() != 0) { + name = annotation.name(); + } + } + + if (name == null) { + name = method.getName(); + + if (!name.startsWith("set")) { + throw new JSONException("illegal setter"); + } + + name = name.substring(3); + if (name.length() == 0) { + throw new JSONException("illegal setter"); + } + name = Character.toLowerCase(name.charAt(0)) + name.substring(1); + } + + map.put(name, args[0]); + return null; + } + + if (parameterTypes.length == 0) { + Class returnType = method.getReturnType(); + if (returnType == void.class) { + throw new JSONException("illegal getter"); + } + + String name = null; + JSONField annotation = method.getAnnotation(JSONField.class); + if (annotation != null) { + if (annotation.name().length() != 0) { + name = annotation.name(); + } + } + + if (name == null) { + name = method.getName(); + if (name.startsWith("get")) { + name = name.substring(3); + if (name.length() == 0) { + throw new JSONException("illegal getter"); + } + name = Character.toLowerCase(name.charAt(0)) + name.substring(1); + } else if (name.startsWith("is")) { + name = name.substring(2); + if (name.length() == 0) { + throw new JSONException("illegal getter"); + } + name = Character.toLowerCase(name.charAt(0)) + name.substring(1); + } else if (name.startsWith("hashCode")) { + return this.hashCode(); + } else if (name.startsWith("toString")) { + return this.toString(); + } else { + throw new JSONException("illegal getter"); + } + } + + Object value = map.get(name); + return TypeUtils.cast(value, method.getGenericReturnType(), ParserConfig.getGlobalInstance()); + } + + throw new UnsupportedOperationException(method.toGenericString()); + } + + public Map getInnerMap() { + return this.map; + } +// public static void main(String[] args) { +// List ls = new ArrayList(); +// ls.add("aaa"); +// ls.add("bbb"); +// ls.add("ccc"); +// JSONNode node = new JSONNode(); +// node.put("a", 1).put("c", "dc") +// .putNode("data").put("b", 2).put("d", "4") +// .put("l", ls); +// System.out.println(node); +// } +} diff --git a/health_framework/src/main/java/cn/card/health/util/MyX509TrustManager.java b/health_framework/src/main/java/cn/card/health/util/MyX509TrustManager.java new file mode 100644 index 0000000..b2ae381 --- /dev/null +++ b/health_framework/src/main/java/cn/card/health/util/MyX509TrustManager.java @@ -0,0 +1,23 @@ +package cn.card.health.util; + +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; + +import javax.net.ssl.X509TrustManager; + +/** + * 证书信任管理器(用于HTTPS请求) + * + */ +public class MyX509TrustManager implements X509TrustManager { + + public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { + } + + public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { + } + + public X509Certificate[] getAcceptedIssuers() { + return null; + } +} \ No newline at end of file diff --git a/health_framework/src/main/resources/.DS_Store b/health_framework/src/main/resources/.DS_Store new file mode 100644 index 0000000..120c54e Binary files /dev/null and b/health_framework/src/main/resources/.DS_Store differ diff --git a/health_framework/src/main/resources/jar/InfosecCrypto_Java1_02_JDK14+.jar b/health_framework/src/main/resources/jar/InfosecCrypto_Java1_02_JDK14+.jar new file mode 100644 index 0000000..353497a Binary files /dev/null and b/health_framework/src/main/resources/jar/InfosecCrypto_Java1_02_JDK14+.jar differ diff --git a/health_framework/src/main/resources/jar/hsm-software-share-1.0.5.jar b/health_framework/src/main/resources/jar/hsm-software-share-1.0.5.jar new file mode 100644 index 0000000..486426b Binary files /dev/null and b/health_framework/src/main/resources/jar/hsm-software-share-1.0.5.jar differ diff --git a/health_framework/src/main/resources/jar/icbc-api-sdk-cop-io.jar b/health_framework/src/main/resources/jar/icbc-api-sdk-cop-io.jar new file mode 100644 index 0000000..3773d49 Binary files /dev/null and b/health_framework/src/main/resources/jar/icbc-api-sdk-cop-io.jar differ diff --git a/health_framework/src/main/resources/jar/icbc-api-sdk-cop.jar b/health_framework/src/main/resources/jar/icbc-api-sdk-cop.jar new file mode 100644 index 0000000..9a7ff05 Binary files /dev/null and b/health_framework/src/main/resources/jar/icbc-api-sdk-cop.jar differ diff --git a/health_framework/src/main/resources/jar/icbc-ca.jar b/health_framework/src/main/resources/jar/icbc-ca.jar new file mode 100644 index 0000000..870b73b Binary files /dev/null and b/health_framework/src/main/resources/jar/icbc-ca.jar differ diff --git a/health_framework/src/main/resources/mapper/insurance/MkAppletRequestMapper.xml b/health_framework/src/main/resources/mapper/insurance/MkAppletRequestMapper.xml new file mode 100644 index 0000000..c4ad678 --- /dev/null +++ b/health_framework/src/main/resources/mapper/insurance/MkAppletRequestMapper.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + select mk_id, mk_requestid, mk_applet_request_data, mk_applet_response_data, mk_insurance_request_data, mk_insurance_response_data,mk_sign , mk_validate, create_time from mk_applet_request + + + + + + + + + insert into mk_applet_request + + mk_requestid, + mk_request_method, + mk_applet_request_data, + mk_applet_response_data, + mk_insurance_request_data, + mk_insurance_response_data, + mk_sign, + mk_validate, + create_time, + + + #{mkRequestid}, + #{mkRequestMethod}, + #{mkAppletRequestData}, + #{mkAppletResponseData}, + #{mkInsuranceRequestData}, + #{mkInsuranceResponseData}, + #{mkSign}, + #{mkValidate}, + #{createTime}, + + + + + update mk_applet_request + + mk_requestid = #{mkRequestid}, + mk_applet_request_data = #{mkAppletRequestData}, + mk_applet_response_data = #{mkAppletResponseData}, + mk_insurance_request_data = #{mkInsuranceRequestData}, + mk_insurance_response_data = #{mkInsuranceResponseData}, + create_time = #{createTime}, + + where mk_id = #{mkId} + + + + delete from mk_applet_request where mk_id = #{mkId} + + + + delete from mk_applet_request where mk_id in + + #{mkId} + + + \ No newline at end of file diff --git a/health_framework/src/main/resources/mapper/insurance/MkInsurancePayMapper.xml b/health_framework/src/main/resources/mapper/insurance/MkInsurancePayMapper.xml new file mode 100644 index 0000000..4f82473 --- /dev/null +++ b/health_framework/src/main/resources/mapper/insurance/MkInsurancePayMapper.xml @@ -0,0 +1,177 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select mk_id, orderid, idNo, userName, idType, psnNo, medOrgOrd, medType, feeType, psnSetlway, mdtrtCertType, payOrdId, payToken, payAuthNo, chrgBchno, mdtrtId, ordStas, feeSumamt, ownPayAmt, psnAcctPay, fundPay, othFeeAmt, applyTime, approvedTime, userid, outTradeNo, tradeno, reason, medinsSetlId from mk_insurance_pay + + + + + + + + + + insert into mk_insurance_pay + + mk_id, + orderid, + idNo, + userName, + idType, + psnNo, + medOrgOrd, + medType, + feeType, + psnSetlway, + mdtrtCertType, + payOrdId, + payToken, + payAuthNo, + chrgBchno, + mdtrtId, + ordStas, + feeSumamt, + ownPayAmt, + psnAcctPay, + fundPay, + othFeeAmt, + applyTime, + approvedTime, + userid, + outTradeNo, + tradeno, + reason, + + + #{mkId}, + #{orderid}, + #{idno}, + #{ username}, + #{idtype}, + #{psnno}, + #{medorgord}, + #{medtype}, + #{feetype}, + #{psnsetlway}, + #{mdtrtcerttype}, + #{payordid}, + #{paytoken}, + #{payAuthNo}, + #{chrgbchno}, + #{mdtrtid}, + #{ordstas}, + #{feesumamt}, + #{ownpayamt}, + #{psnacctpay}, + #{fundpay}, + #{othFeeAmt}, + #{applytime}, + #{approvedtime}, + #{userid}, + #{outTradeNo}, + #{tradeno}, + #{reason}, + + + + + update mk_insurance_pay + + idNo = #{idno}, + userName = #{username}, + idType = #{idtype}, + psnNo = #{psnno}, + medOrgOrd = #{medorgord}, + medType = #{medtype}, + feeType = #{feetype}, + psnSetlway = #{psnsetlway}, + mdtrtCertType = #{mdtrtcerttype}, + payOrdId = #{payordid}, + payToken = #{paytoken}, + chrgBchno = #{chrgbchno}, + mdtrtId = #{mdtrtid}, + ordStas = #{ordstas}, + feeSumamt = #{feesumamt}, + ownPayAmt = #{ownpayamt}, + psnAcctPay = #{psnacctpay}, + othFeeAmt = #{othFeeAmt}, + fundPay = #{fundpay}, + applyTime = #{applytime}, + approvedTime = #{approvedtime}, + userid = #{userid}, + outTradeNo = #{outTradeNo}, + tradeno = #{tradeno}, + reason = #{reason}, + medinsSetlId = #{medinsSetlId}, + + where mk_id = #{mkId} + + + + delete from mk_insurance_pay where mk_id = #{mkId} + + + + delete from mk_insurance_pay where mk_id in + + #{mkId} + + + \ No newline at end of file diff --git a/health_framework/src/main/resources/mapper/order/YcMsgMapper.xml b/health_framework/src/main/resources/mapper/order/YcMsgMapper.xml new file mode 100644 index 0000000..db0c19a --- /dev/null +++ b/health_framework/src/main/resources/mapper/order/YcMsgMapper.xml @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + select + msgid, + touser, + temlateid, + msgurl, + content, + msgStatus, + createDate, + updateTime, + tmsgid + from yc_msg + + + + + + + + insert into yc_msg + + msgid, + touser, + temlateid, + msgurl, + content, + msg_status, + create_date, + update_time, + tmsgid, + + + #{msgid}, + #{touser}, + #{temlateid}, + #{msgurl}, + #{content}, + #{msgStatus}, + #{createDate}, + #{updateTime}, + #{tmsgid}, + + + + + update yc_msg + + msgid = #{msgid}, + touser = #{touser}, + temlateid = #{temlateid}, + msgurl = #{msgurl}, + content = #{content}, + msg_status = #{msgStatus}, + create_date = #{createDate}, + update_time = #{updateTime}, + tmsgid = #{tmsgid}, + + where msgid = #{msgid} + + + + update sys_dept set + del_flag = '2' where msgid = #{msgid} + + \ No newline at end of file diff --git a/health_framework/src/main/resources/mapper/order/YcPayCallbackMapper.xml b/health_framework/src/main/resources/mapper/order/YcPayCallbackMapper.xml new file mode 100644 index 0000000..e025dea --- /dev/null +++ b/health_framework/src/main/resources/mapper/order/YcPayCallbackMapper.xml @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + select + id, + content, + descContent, + paytype, + payname, + createtime + from yc_pay_callback + + + + + + + + insert into yc_pay_callback + + id, + content, + descContent, + paytype, + payname, + createtime + + + #{id}, + #{content}, + #{descContent}, + #{paytype}, + #{payname}, + SYSDATE() + + + + + update yc_pay_callback + + id = #{id}, + content = #{content}, + descContent = #{descContent}, + paytype = #{paytype}, + payname = #{payname}, + createtime = #{createtime}, + + where id = #{id} + + + + update + sys_dept set del_flag = '2' where id = #{id} + + \ No newline at end of file diff --git a/health_framework/src/main/resources/mapper/user/YcAuthorityMapper.xml b/health_framework/src/main/resources/mapper/user/YcAuthorityMapper.xml new file mode 100644 index 0000000..2b88212 --- /dev/null +++ b/health_framework/src/main/resources/mapper/user/YcAuthorityMapper.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + select + authorityid, + authority, + remark + from yc_authority + + + + + + + + + + insert into yc_authority + + authorityid, + authority, + remark, + + + #{authorityid}, + #{authority}, + #{remark}, + + + + + update yc_authority + + authorityid = #{authorityid}, + authority = #{authority}, + remark = #{remark}, + + where authorityid = #{authorityid} + + + + update sys_dept set del_flag = '2' where authorityid = #{authorityid} + + \ No newline at end of file diff --git a/health_framework/src/main/resources/mapper/user/YcInhospPatientMapper.xml b/health_framework/src/main/resources/mapper/user/YcInhospPatientMapper.xml new file mode 100644 index 0000000..9672c73 --- /dev/null +++ b/health_framework/src/main/resources/mapper/user/YcInhospPatientMapper.xml @@ -0,0 +1,261 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select + patientid, + hospid, + patid, + ippatid, + ippatno, + idcardno, + cardtype, + patmedno, + patname, + visitid, + patsex, + birthday, + phone, + address, + contactPerson, + contactRelation, + contactPhone, + areaName, + bedNo, + admitDate, + totalAmount, + totalDeposit, + closedAmount, + uncoveredDeposit, + patState, + hospitalId, + del_flag, + createtime, + createby + from yc_inhosp_patient + + + + + + + + + + insert into yc_inhosp_patient + + patientid, + hospid, + patid, + ippatid, + ippatno, + idcardno, + cardtype, + patmedno, + patname, + visitid, + patsex, + birthday, + phone, + address, + contactPerson, + contactRelation, + contactPhone, + areaName, + bedNo, + admitDate, + totalAmount, + totalDeposit, + closedAmount, + uncoveredDeposit, + patState, + hospitalId, + del_flag, + createtime, + createby, + + + #{patientid}, + #{hospid}, + #{patid}, + #{ippatid}, + #{ippatno}, + #{idcardno}, + #{cardtype}, + #{patmedno}, + #{patname}, + #{visitid}, + #{patsex}, + #{birthday}, + #{phone}, + #{address}, + #{contactperson}, + #{contactrelation}, + #{contactphone}, + #{areaname}, + #{bedno}, + #{admitdate}, + #{totalamount}, + #{totaldeposit}, + #{closedamount}, + #{uncovereddeposit}, + #{patstate}, + #{hospitalid}, + #{delFlag}, + #{createtime}, + #{createby}, + + + + + update yc_inhosp_patient + + patientid = #{patientid}, + hospid = #{hospid}, + patid = #{patid}, + ippatid = #{ippatid}, + ippatno = #{ippatno}, + idcardno = #{idcardno}, + cardtype = #{cardtype}, + patmedno = #{patmedno}, + patname = #{patname}, + visitid = #{visitid}, + patsex = #{patsex}, + birthday = #{birthday}, + phone = #{phone}, + address = #{address}, + contactPerson = #{contactperson}, + contactRelation = #{contactrelation}, + contactPhone = #{contactphone}, + areaName = #{areaname}, + bedNo = #{bedno}, + admitDate = #{admitdate}, + totalAmount = #{totalamount}, + totalDeposit = #{totaldeposit}, + closedAmount = #{closedamount}, + uncoveredDeposit = #{uncovereddeposit}, + patState = #{patstate}, + hospitalId = #{hospitalid}, + del_flag = #{delFlag}, + createtime = #{createtime}, + createby = #{createby}, + + where patientid = #{patientid} + + + + update + sys_dept set del_flag = '2' where patientid = #{patientid} + + \ No newline at end of file diff --git a/health_framework/src/main/resources/mapper/user/YcOAuthMapper.xml b/health_framework/src/main/resources/mapper/user/YcOAuthMapper.xml new file mode 100644 index 0000000..fddd8ef --- /dev/null +++ b/health_framework/src/main/resources/mapper/user/YcOAuthMapper.xml @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + select + authid, + appid, + openid, + userid, + auth_type, + createtime, + updatetime + from yc_oauth + + + + + + + + + + insert into yc_oauth + + authid, + appid, + openid, + userid, + auth_type, + createtime, + updatetime, + + + #{authid}, + #{appid}, + #{openid}, + #{userid}, + #{authType}, + #{createtime}, + #{updatetime}, + + + + + update yc_oauth + + authid = #{authid}, + appid = #{appid}, + openid = #{openid}, + userid = #{userid}, + auth_type = #{authType}, + createtime = #{createtime}, + updatetime = #{updatetime}, + + where authid = #{authid} + + + + update sys_dept set + del_flag = '2' where authid = #{authid} + + \ No newline at end of file diff --git a/health_framework/src/main/resources/mapper/user/YcPatientMapper.xml b/health_framework/src/main/resources/mapper/user/YcPatientMapper.xml new file mode 100644 index 0000000..dccdabe --- /dev/null +++ b/health_framework/src/main/resources/mapper/user/YcPatientMapper.xml @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + + + select patientid, + openid, + patientName, + patientSex, + oppatno, + hiscardno, + cardno, + cardtype, + phone, + address, + cardid, + isnew + from yc_patient + + + + + + + + insert into yc_patient + + patientid, + openid, + opPatNo, + hiscardno, + cardno, + cardtype, + phone, + address, + cardid, + patientName, + patientSex, + isnew, + del_flag, + + + #{patientid}, + #{openid}, + #{oppatno}, + #{hiscardno}, + #{cardno}, + #{cardtype}, + #{phone}, + #{address}, + #{cardid}, + #{patientName}, + #{patientSex}, + #{isnew}, + #{delFlag}, + + + + + update yc_patient + + patientid = #{patientid}, + openid = #{openid}, + opPatNo = #{oppatno}, + hiscardno = #{hiscardno}, + cardno = #{cardno}, + cardtype = #{cardtype}, + phone = #{phone}, + address = #{address}, + cardid = #{cardid}, + patientName = #{patientName}, + patientSex = #{patientSex}, + isnew = #{isnew}, + del_flag = #{delFlag}, + + where patientid = #{patientid} + + + + + + + + update yc_patient + set del_flag = '2' + where patientid = #{patientid} + + \ No newline at end of file diff --git a/health_framework/src/main/resources/mapper/user/YcUserMapper.xml b/health_framework/src/main/resources/mapper/user/YcUserMapper.xml new file mode 100644 index 0000000..77fd254 --- /dev/null +++ b/health_framework/src/main/resources/mapper/user/YcUserMapper.xml @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + select + userid, + username, + user_type, + isActivated, + active_key, + password, + phonenum, + email, + createtime, + updatetime, + remark + from yc_user + + + + + + + + + + + + insert into yc_user( + userid, + username, + user_type, + isActivated, + active_key, + password, + phonenum, + email, + updatetime, + remark, + createtime) values( + #{userid}, + #{username}, + #{userType}, + #{isActivated}, + #{activeKey}, + #{password}, + #{phonenum}, + #{email}, + #{updatetime}, + #{remark}, + sysdate() + ) + + + + update yc_user + + userid = #{userid}, + username = #{username}, + user_type = #{userType}, + isActivated = #{isActivated}, + active_key = #{activeKey}, + password = #{password}, + phonenum = #{phonenum}, + email = #{email}, + createtime = #{createtime}, + updatetime = #{updatetime}, + remark = #{remark}, + + where userid = #{userid} + + + + update sys_dept set + del_flag = '2' where userid = #{userid} + + \ No newline at end of file diff --git a/health_framework/target/classes/cn/card/health/alipay/config/AlipayAppletConfig.class b/health_framework/target/classes/cn/card/health/alipay/config/AlipayAppletConfig.class new file mode 100644 index 0000000..3f69553 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/alipay/config/AlipayAppletConfig.class differ diff --git a/health_framework/target/classes/cn/card/health/alipay/pay/MkAlipayInsuranceService.class b/health_framework/target/classes/cn/card/health/alipay/pay/MkAlipayInsuranceService.class new file mode 100644 index 0000000..46edf89 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/alipay/pay/MkAlipayInsuranceService.class differ diff --git a/health_framework/target/classes/cn/card/health/base/controller/BaseController$1.class b/health_framework/target/classes/cn/card/health/base/controller/BaseController$1.class new file mode 100644 index 0000000..ceee45e Binary files /dev/null and b/health_framework/target/classes/cn/card/health/base/controller/BaseController$1.class differ diff --git a/health_framework/target/classes/cn/card/health/base/controller/BaseController.class b/health_framework/target/classes/cn/card/health/base/controller/BaseController.class new file mode 100644 index 0000000..2a81a28 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/base/controller/BaseController.class differ diff --git a/health_framework/target/classes/cn/card/health/bean/insurance/MkAppletRequest.class b/health_framework/target/classes/cn/card/health/bean/insurance/MkAppletRequest.class new file mode 100644 index 0000000..0d257f0 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/bean/insurance/MkAppletRequest.class differ diff --git a/health_framework/target/classes/cn/card/health/bean/insurance/MkInsurancePay.class b/health_framework/target/classes/cn/card/health/bean/insurance/MkInsurancePay.class new file mode 100644 index 0000000..7e7a5af Binary files /dev/null and b/health_framework/target/classes/cn/card/health/bean/insurance/MkInsurancePay.class differ diff --git a/health_framework/target/classes/cn/card/health/bean/order/YcMsg.class b/health_framework/target/classes/cn/card/health/bean/order/YcMsg.class new file mode 100644 index 0000000..54d76b9 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/bean/order/YcMsg.class differ diff --git a/health_framework/target/classes/cn/card/health/bean/order/YcPayCallback.class b/health_framework/target/classes/cn/card/health/bean/order/YcPayCallback.class new file mode 100644 index 0000000..df21bd7 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/bean/order/YcPayCallback.class differ diff --git a/health_framework/target/classes/cn/card/health/config/DataSourceConfig.class b/health_framework/target/classes/cn/card/health/config/DataSourceConfig.class new file mode 100644 index 0000000..8d6c1a0 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/config/DataSourceConfig.class differ diff --git a/health_framework/target/classes/cn/card/health/config/HealthCardConfig.class b/health_framework/target/classes/cn/card/health/config/HealthCardConfig.class new file mode 100644 index 0000000..97c2e85 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/config/HealthCardConfig.class differ diff --git a/health_framework/target/classes/cn/card/health/config/MybatisPubConfig.class b/health_framework/target/classes/cn/card/health/config/MybatisPubConfig.class new file mode 100644 index 0000000..35f9ff7 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/config/MybatisPubConfig.class differ diff --git a/health_framework/target/classes/cn/card/health/config/Swagger2Config.class b/health_framework/target/classes/cn/card/health/config/Swagger2Config.class new file mode 100644 index 0000000..71682e5 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/config/Swagger2Config.class differ diff --git a/health_framework/target/classes/cn/card/health/entity/HealthCardInfoEntity.class b/health_framework/target/classes/cn/card/health/entity/HealthCardInfoEntity.class new file mode 100644 index 0000000..dea2e97 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/entity/HealthCardInfoEntity.class differ diff --git a/health_framework/target/classes/cn/card/health/entity/Image.class b/health_framework/target/classes/cn/card/health/entity/Image.class new file mode 100644 index 0000000..935415d Binary files /dev/null and b/health_framework/target/classes/cn/card/health/entity/Image.class differ diff --git a/health_framework/target/classes/cn/card/health/entity/Phone.class b/health_framework/target/classes/cn/card/health/entity/Phone.class new file mode 100644 index 0000000..183d97c Binary files /dev/null and b/health_framework/target/classes/cn/card/health/entity/Phone.class differ diff --git a/health_framework/target/classes/cn/card/health/entity/Unbing.class b/health_framework/target/classes/cn/card/health/entity/Unbing.class new file mode 100644 index 0000000..a154091 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/entity/Unbing.class differ diff --git a/health_framework/target/classes/cn/card/health/framework/ScheduleRegistResource.class b/health_framework/target/classes/cn/card/health/framework/ScheduleRegistResource.class new file mode 100644 index 0000000..458523c Binary files /dev/null and b/health_framework/target/classes/cn/card/health/framework/ScheduleRegistResource.class differ diff --git a/health_framework/target/classes/cn/card/health/framework/UserLoginService.class b/health_framework/target/classes/cn/card/health/framework/UserLoginService.class new file mode 100644 index 0000000..a6be2f9 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/framework/UserLoginService.class differ diff --git a/health_framework/target/classes/cn/card/health/framework/config/JwtAuthenticationTokenFilter.class b/health_framework/target/classes/cn/card/health/framework/config/JwtAuthenticationTokenFilter.class new file mode 100644 index 0000000..25902cd Binary files /dev/null and b/health_framework/target/classes/cn/card/health/framework/config/JwtAuthenticationTokenFilter.class differ diff --git a/health_framework/target/classes/cn/card/health/framework/config/ResourcesConfig.class b/health_framework/target/classes/cn/card/health/framework/config/ResourcesConfig.class new file mode 100644 index 0000000..709097d Binary files /dev/null and b/health_framework/target/classes/cn/card/health/framework/config/ResourcesConfig.class differ diff --git a/health_framework/target/classes/cn/card/health/framework/config/SecurityConfig.class b/health_framework/target/classes/cn/card/health/framework/config/SecurityConfig.class new file mode 100644 index 0000000..94c392f Binary files /dev/null and b/health_framework/target/classes/cn/card/health/framework/config/SecurityConfig.class differ diff --git a/health_framework/target/classes/cn/card/health/framework/security/handle/AuthenticationEntryPointImpl.class b/health_framework/target/classes/cn/card/health/framework/security/handle/AuthenticationEntryPointImpl.class new file mode 100644 index 0000000..5f8141d Binary files /dev/null and b/health_framework/target/classes/cn/card/health/framework/security/handle/AuthenticationEntryPointImpl.class differ diff --git a/health_framework/target/classes/cn/card/health/framework/security/handle/LogoutSuccessHandlerImpl.class b/health_framework/target/classes/cn/card/health/framework/security/handle/LogoutSuccessHandlerImpl.class new file mode 100644 index 0000000..c2f7d34 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/framework/security/handle/LogoutSuccessHandlerImpl.class differ diff --git a/health_framework/target/classes/cn/card/health/framework/service/HisCardService.class b/health_framework/target/classes/cn/card/health/framework/service/HisCardService.class new file mode 100644 index 0000000..6634452 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/framework/service/HisCardService.class differ diff --git a/health_framework/target/classes/cn/card/health/framework/service/HisClinicHealthService.class b/health_framework/target/classes/cn/card/health/framework/service/HisClinicHealthService.class new file mode 100644 index 0000000..46ca6a8 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/framework/service/HisClinicHealthService.class differ diff --git a/health_framework/target/classes/cn/card/health/framework/service/HisInPatientService.class b/health_framework/target/classes/cn/card/health/framework/service/HisInPatientService.class new file mode 100644 index 0000000..f71a7fb Binary files /dev/null and b/health_framework/target/classes/cn/card/health/framework/service/HisInPatientService.class differ diff --git a/health_framework/target/classes/cn/card/health/framework/service/HisReportService.class b/health_framework/target/classes/cn/card/health/framework/service/HisReportService.class new file mode 100644 index 0000000..fc443e1 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/framework/service/HisReportService.class differ diff --git a/health_framework/target/classes/cn/card/health/framework/service/RegistHealthService.class b/health_framework/target/classes/cn/card/health/framework/service/RegistHealthService.class new file mode 100644 index 0000000..caab116 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/framework/service/RegistHealthService.class differ diff --git a/health_framework/target/classes/cn/card/health/framework/service/ThreadOrderService.class b/health_framework/target/classes/cn/card/health/framework/service/ThreadOrderService.class new file mode 100644 index 0000000..218242b Binary files /dev/null and b/health_framework/target/classes/cn/card/health/framework/service/ThreadOrderService.class differ diff --git a/health_framework/target/classes/cn/card/health/framework/service/alipay/AlipayAppletService.class b/health_framework/target/classes/cn/card/health/framework/service/alipay/AlipayAppletService.class new file mode 100644 index 0000000..2c1c820 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/framework/service/alipay/AlipayAppletService.class differ diff --git a/health_framework/target/classes/cn/card/health/framework/service/alipay/HealthInsuranceService.class b/health_framework/target/classes/cn/card/health/framework/service/alipay/HealthInsuranceService.class new file mode 100644 index 0000000..8b57d3d Binary files /dev/null and b/health_framework/target/classes/cn/card/health/framework/service/alipay/HealthInsuranceService.class differ diff --git a/health_framework/target/classes/cn/card/health/framework/service/alipay/TokenService.class b/health_framework/target/classes/cn/card/health/framework/service/alipay/TokenService.class new file mode 100644 index 0000000..9799a9a Binary files /dev/null and b/health_framework/target/classes/cn/card/health/framework/service/alipay/TokenService.class differ diff --git a/health_framework/target/classes/cn/card/health/framework/service/alipay/domain/AlipayOAuthTokenDto.class b/health_framework/target/classes/cn/card/health/framework/service/alipay/domain/AlipayOAuthTokenDto.class new file mode 100644 index 0000000..916f05c Binary files /dev/null and b/health_framework/target/classes/cn/card/health/framework/service/alipay/domain/AlipayOAuthTokenDto.class differ diff --git a/health_framework/target/classes/cn/card/health/framework/service/alipay/utils/IdUtils.class b/health_framework/target/classes/cn/card/health/framework/service/alipay/utils/IdUtils.class new file mode 100644 index 0000000..df68eca Binary files /dev/null and b/health_framework/target/classes/cn/card/health/framework/service/alipay/utils/IdUtils.class differ diff --git a/health_framework/target/classes/cn/card/health/framework/service/alipay/utils/UUID$Holder.class b/health_framework/target/classes/cn/card/health/framework/service/alipay/utils/UUID$Holder.class new file mode 100644 index 0000000..04e3bb5 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/framework/service/alipay/utils/UUID$Holder.class differ diff --git a/health_framework/target/classes/cn/card/health/framework/service/alipay/utils/UUID.class b/health_framework/target/classes/cn/card/health/framework/service/alipay/utils/UUID.class new file mode 100644 index 0000000..e4211ef Binary files /dev/null and b/health_framework/target/classes/cn/card/health/framework/service/alipay/utils/UUID.class differ diff --git a/health_framework/target/classes/cn/card/health/framework/service/bank/BankConfig.class b/health_framework/target/classes/cn/card/health/framework/service/bank/BankConfig.class new file mode 100644 index 0000000..d3c13d3 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/framework/service/bank/BankConfig.class differ diff --git a/health_framework/target/classes/cn/card/health/framework/service/bank/BankService.class b/health_framework/target/classes/cn/card/health/framework/service/bank/BankService.class new file mode 100644 index 0000000..815bdd0 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/framework/service/bank/BankService.class differ diff --git a/health_framework/target/classes/cn/card/health/framework/service/wechat/HealthCardWechatServcie.class b/health_framework/target/classes/cn/card/health/framework/service/wechat/HealthCardWechatServcie.class new file mode 100644 index 0000000..2c90c5b Binary files /dev/null and b/health_framework/target/classes/cn/card/health/framework/service/wechat/HealthCardWechatServcie.class differ diff --git a/health_framework/target/classes/cn/card/health/helper/iniOpenId.class b/health_framework/target/classes/cn/card/health/helper/iniOpenId.class new file mode 100644 index 0000000..5e34c08 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/helper/iniOpenId.class differ diff --git a/health_framework/target/classes/cn/card/health/insurance/HealthInsuranceConfig.class b/health_framework/target/classes/cn/card/health/insurance/HealthInsuranceConfig.class new file mode 100644 index 0000000..c6bb463 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/insurance/HealthInsuranceConfig.class differ diff --git a/health_framework/target/classes/cn/card/health/insurance/HealthInsuranceService.class b/health_framework/target/classes/cn/card/health/insurance/HealthInsuranceService.class new file mode 100644 index 0000000..92128b9 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/insurance/HealthInsuranceService.class differ diff --git a/health_framework/target/classes/cn/card/health/insurance/utils/BCUtils.class b/health_framework/target/classes/cn/card/health/insurance/utils/BCUtils.class new file mode 100644 index 0000000..092cfa2 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/insurance/utils/BCUtils.class differ diff --git a/health_framework/target/classes/cn/card/health/insurance/utils/EasyGmUtils.class b/health_framework/target/classes/cn/card/health/insurance/utils/EasyGmUtils.class new file mode 100644 index 0000000..4acb5df Binary files /dev/null and b/health_framework/target/classes/cn/card/health/insurance/utils/EasyGmUtils.class differ diff --git a/health_framework/target/classes/cn/card/health/insurance/utils/SMSignUtil.class b/health_framework/target/classes/cn/card/health/insurance/utils/SMSignUtil.class new file mode 100644 index 0000000..50d6c8c Binary files /dev/null and b/health_framework/target/classes/cn/card/health/insurance/utils/SMSignUtil.class differ diff --git a/health_framework/target/classes/cn/card/health/insurance/utils/SignAndEncodeUtil.class b/health_framework/target/classes/cn/card/health/insurance/utils/SignAndEncodeUtil.class new file mode 100644 index 0000000..bea8bc1 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/insurance/utils/SignAndEncodeUtil.class differ diff --git a/health_framework/target/classes/cn/card/health/mapper/HealthCardApptokenMapper.class b/health_framework/target/classes/cn/card/health/mapper/HealthCardApptokenMapper.class new file mode 100644 index 0000000..505f399 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/mapper/HealthCardApptokenMapper.class differ diff --git a/health_framework/target/classes/cn/card/health/mapper/insurance/MkAppletRequestMapper.class b/health_framework/target/classes/cn/card/health/mapper/insurance/MkAppletRequestMapper.class new file mode 100644 index 0000000..6a30680 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/mapper/insurance/MkAppletRequestMapper.class differ diff --git a/health_framework/target/classes/cn/card/health/mapper/insurance/MkInsurancePayMapper.class b/health_framework/target/classes/cn/card/health/mapper/insurance/MkInsurancePayMapper.class new file mode 100644 index 0000000..a1a4006 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/mapper/insurance/MkInsurancePayMapper.class differ diff --git a/health_framework/target/classes/cn/card/health/mapper/order/YcMsgMapper.class b/health_framework/target/classes/cn/card/health/mapper/order/YcMsgMapper.class new file mode 100644 index 0000000..b088879 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/mapper/order/YcMsgMapper.class differ diff --git a/health_framework/target/classes/cn/card/health/mapper/order/YcPayCallbackMapper.class b/health_framework/target/classes/cn/card/health/mapper/order/YcPayCallbackMapper.class new file mode 100644 index 0000000..7e9cf85 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/mapper/order/YcPayCallbackMapper.class differ diff --git a/health_framework/target/classes/cn/card/health/mapper/user/YcAuthorityMapper.class b/health_framework/target/classes/cn/card/health/mapper/user/YcAuthorityMapper.class new file mode 100644 index 0000000..cbef86a Binary files /dev/null and b/health_framework/target/classes/cn/card/health/mapper/user/YcAuthorityMapper.class differ diff --git a/health_framework/target/classes/cn/card/health/mapper/user/YcInhospPatientMapper.class b/health_framework/target/classes/cn/card/health/mapper/user/YcInhospPatientMapper.class new file mode 100644 index 0000000..f27c9bb Binary files /dev/null and b/health_framework/target/classes/cn/card/health/mapper/user/YcInhospPatientMapper.class differ diff --git a/health_framework/target/classes/cn/card/health/mapper/user/YcOAuthMapper.class b/health_framework/target/classes/cn/card/health/mapper/user/YcOAuthMapper.class new file mode 100644 index 0000000..39809fd Binary files /dev/null and b/health_framework/target/classes/cn/card/health/mapper/user/YcOAuthMapper.class differ diff --git a/health_framework/target/classes/cn/card/health/mapper/user/YcPatientMapper.class b/health_framework/target/classes/cn/card/health/mapper/user/YcPatientMapper.class new file mode 100644 index 0000000..2b89a99 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/mapper/user/YcPatientMapper.class differ diff --git a/health_framework/target/classes/cn/card/health/mapper/user/YcUserMapper.class b/health_framework/target/classes/cn/card/health/mapper/user/YcUserMapper.class new file mode 100644 index 0000000..9004af7 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/mapper/user/YcUserMapper.class differ diff --git a/health_framework/target/classes/cn/card/health/oauth/security/UserDetailsServiceImpl.class b/health_framework/target/classes/cn/card/health/oauth/security/UserDetailsServiceImpl.class new file mode 100644 index 0000000..35e26a5 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/oauth/security/UserDetailsServiceImpl.class differ diff --git a/health_framework/target/classes/cn/card/health/service/HealthCardApptokenService.class b/health_framework/target/classes/cn/card/health/service/HealthCardApptokenService.class new file mode 100644 index 0000000..ae650f8 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/service/HealthCardApptokenService.class differ diff --git a/health_framework/target/classes/cn/card/health/service/Sign.class b/health_framework/target/classes/cn/card/health/service/Sign.class new file mode 100644 index 0000000..87a8939 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/service/Sign.class differ diff --git a/health_framework/target/classes/cn/card/health/service/impl/HealthCardApptokenServiceImpl.class b/health_framework/target/classes/cn/card/health/service/impl/HealthCardApptokenServiceImpl.class new file mode 100644 index 0000000..ad0eaad Binary files /dev/null and b/health_framework/target/classes/cn/card/health/service/impl/HealthCardApptokenServiceImpl.class differ diff --git a/health_framework/target/classes/cn/card/health/service/impl/insurance/MkAppletRequestServiceImpl.class b/health_framework/target/classes/cn/card/health/service/impl/insurance/MkAppletRequestServiceImpl.class new file mode 100644 index 0000000..4f6ed45 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/service/impl/insurance/MkAppletRequestServiceImpl.class differ diff --git a/health_framework/target/classes/cn/card/health/service/impl/insurance/MkInsurancePayServiceImpl.class b/health_framework/target/classes/cn/card/health/service/impl/insurance/MkInsurancePayServiceImpl.class new file mode 100644 index 0000000..a032870 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/service/impl/insurance/MkInsurancePayServiceImpl.class differ diff --git a/health_framework/target/classes/cn/card/health/service/impl/order/YcMsgServiceImpl.class b/health_framework/target/classes/cn/card/health/service/impl/order/YcMsgServiceImpl.class new file mode 100644 index 0000000..a5aa3b8 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/service/impl/order/YcMsgServiceImpl.class differ diff --git a/health_framework/target/classes/cn/card/health/service/impl/order/YcPayCallbackServiceImpl.class b/health_framework/target/classes/cn/card/health/service/impl/order/YcPayCallbackServiceImpl.class new file mode 100644 index 0000000..e968d77 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/service/impl/order/YcPayCallbackServiceImpl.class differ diff --git a/health_framework/target/classes/cn/card/health/service/impl/user/YcAuthorityServiceImpl.class b/health_framework/target/classes/cn/card/health/service/impl/user/YcAuthorityServiceImpl.class new file mode 100644 index 0000000..85a8737 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/service/impl/user/YcAuthorityServiceImpl.class differ diff --git a/health_framework/target/classes/cn/card/health/service/impl/user/YcInhospPatientServiceImpl.class b/health_framework/target/classes/cn/card/health/service/impl/user/YcInhospPatientServiceImpl.class new file mode 100644 index 0000000..a5cb976 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/service/impl/user/YcInhospPatientServiceImpl.class differ diff --git a/health_framework/target/classes/cn/card/health/service/impl/user/YcOAuthServiceImpl.class b/health_framework/target/classes/cn/card/health/service/impl/user/YcOAuthServiceImpl.class new file mode 100644 index 0000000..3b5397a Binary files /dev/null and b/health_framework/target/classes/cn/card/health/service/impl/user/YcOAuthServiceImpl.class differ diff --git a/health_framework/target/classes/cn/card/health/service/impl/user/YcPatientServiceImpl.class b/health_framework/target/classes/cn/card/health/service/impl/user/YcPatientServiceImpl.class new file mode 100644 index 0000000..addcaba Binary files /dev/null and b/health_framework/target/classes/cn/card/health/service/impl/user/YcPatientServiceImpl.class differ diff --git a/health_framework/target/classes/cn/card/health/service/impl/user/YcUserServiceImpl.class b/health_framework/target/classes/cn/card/health/service/impl/user/YcUserServiceImpl.class new file mode 100644 index 0000000..933cce6 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/service/impl/user/YcUserServiceImpl.class differ diff --git a/health_framework/target/classes/cn/card/health/service/insurance/IMkAppletRequestService.class b/health_framework/target/classes/cn/card/health/service/insurance/IMkAppletRequestService.class new file mode 100644 index 0000000..6863e74 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/service/insurance/IMkAppletRequestService.class differ diff --git a/health_framework/target/classes/cn/card/health/service/insurance/IMkInsurancePayService.class b/health_framework/target/classes/cn/card/health/service/insurance/IMkInsurancePayService.class new file mode 100644 index 0000000..53c6f90 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/service/insurance/IMkInsurancePayService.class differ diff --git a/health_framework/target/classes/cn/card/health/service/order/IYcMsgService.class b/health_framework/target/classes/cn/card/health/service/order/IYcMsgService.class new file mode 100644 index 0000000..88b97de Binary files /dev/null and b/health_framework/target/classes/cn/card/health/service/order/IYcMsgService.class differ diff --git a/health_framework/target/classes/cn/card/health/service/order/IYcPayCallbackService.class b/health_framework/target/classes/cn/card/health/service/order/IYcPayCallbackService.class new file mode 100644 index 0000000..4ecb5af Binary files /dev/null and b/health_framework/target/classes/cn/card/health/service/order/IYcPayCallbackService.class differ diff --git a/health_framework/target/classes/cn/card/health/service/user/IYcAuthorityService.class b/health_framework/target/classes/cn/card/health/service/user/IYcAuthorityService.class new file mode 100644 index 0000000..cb1c2ee Binary files /dev/null and b/health_framework/target/classes/cn/card/health/service/user/IYcAuthorityService.class differ diff --git a/health_framework/target/classes/cn/card/health/service/user/IYcInhospPatientService.class b/health_framework/target/classes/cn/card/health/service/user/IYcInhospPatientService.class new file mode 100644 index 0000000..4df35c3 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/service/user/IYcInhospPatientService.class differ diff --git a/health_framework/target/classes/cn/card/health/service/user/IYcOAuthService.class b/health_framework/target/classes/cn/card/health/service/user/IYcOAuthService.class new file mode 100644 index 0000000..d66f996 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/service/user/IYcOAuthService.class differ diff --git a/health_framework/target/classes/cn/card/health/service/user/IYcPatientService.class b/health_framework/target/classes/cn/card/health/service/user/IYcPatientService.class new file mode 100644 index 0000000..3f94944 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/service/user/IYcPatientService.class differ diff --git a/health_framework/target/classes/cn/card/health/service/user/IYcUserService.class b/health_framework/target/classes/cn/card/health/service/user/IYcUserService.class new file mode 100644 index 0000000..028c5eb Binary files /dev/null and b/health_framework/target/classes/cn/card/health/service/user/IYcUserService.class differ diff --git a/health_framework/target/classes/cn/card/health/util/JSONNode.class b/health_framework/target/classes/cn/card/health/util/JSONNode.class new file mode 100644 index 0000000..0ebd8ec Binary files /dev/null and b/health_framework/target/classes/cn/card/health/util/JSONNode.class differ diff --git a/health_framework/target/classes/cn/card/health/util/MyX509TrustManager.class b/health_framework/target/classes/cn/card/health/util/MyX509TrustManager.class new file mode 100644 index 0000000..738e937 Binary files /dev/null and b/health_framework/target/classes/cn/card/health/util/MyX509TrustManager.class differ diff --git a/health_framework/target/classes/mapper/insurance/MkAppletRequestMapper.xml b/health_framework/target/classes/mapper/insurance/MkAppletRequestMapper.xml new file mode 100644 index 0000000..c4ad678 --- /dev/null +++ b/health_framework/target/classes/mapper/insurance/MkAppletRequestMapper.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + select mk_id, mk_requestid, mk_applet_request_data, mk_applet_response_data, mk_insurance_request_data, mk_insurance_response_data,mk_sign , mk_validate, create_time from mk_applet_request + + + + + + + + + insert into mk_applet_request + + mk_requestid, + mk_request_method, + mk_applet_request_data, + mk_applet_response_data, + mk_insurance_request_data, + mk_insurance_response_data, + mk_sign, + mk_validate, + create_time, + + + #{mkRequestid}, + #{mkRequestMethod}, + #{mkAppletRequestData}, + #{mkAppletResponseData}, + #{mkInsuranceRequestData}, + #{mkInsuranceResponseData}, + #{mkSign}, + #{mkValidate}, + #{createTime}, + + + + + update mk_applet_request + + mk_requestid = #{mkRequestid}, + mk_applet_request_data = #{mkAppletRequestData}, + mk_applet_response_data = #{mkAppletResponseData}, + mk_insurance_request_data = #{mkInsuranceRequestData}, + mk_insurance_response_data = #{mkInsuranceResponseData}, + create_time = #{createTime}, + + where mk_id = #{mkId} + + + + delete from mk_applet_request where mk_id = #{mkId} + + + + delete from mk_applet_request where mk_id in + + #{mkId} + + + \ No newline at end of file diff --git a/health_framework/target/classes/mapper/insurance/MkInsurancePayMapper.xml b/health_framework/target/classes/mapper/insurance/MkInsurancePayMapper.xml new file mode 100644 index 0000000..4f82473 --- /dev/null +++ b/health_framework/target/classes/mapper/insurance/MkInsurancePayMapper.xml @@ -0,0 +1,177 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select mk_id, orderid, idNo, userName, idType, psnNo, medOrgOrd, medType, feeType, psnSetlway, mdtrtCertType, payOrdId, payToken, payAuthNo, chrgBchno, mdtrtId, ordStas, feeSumamt, ownPayAmt, psnAcctPay, fundPay, othFeeAmt, applyTime, approvedTime, userid, outTradeNo, tradeno, reason, medinsSetlId from mk_insurance_pay + + + + + + + + + + insert into mk_insurance_pay + + mk_id, + orderid, + idNo, + userName, + idType, + psnNo, + medOrgOrd, + medType, + feeType, + psnSetlway, + mdtrtCertType, + payOrdId, + payToken, + payAuthNo, + chrgBchno, + mdtrtId, + ordStas, + feeSumamt, + ownPayAmt, + psnAcctPay, + fundPay, + othFeeAmt, + applyTime, + approvedTime, + userid, + outTradeNo, + tradeno, + reason, + + + #{mkId}, + #{orderid}, + #{idno}, + #{ username}, + #{idtype}, + #{psnno}, + #{medorgord}, + #{medtype}, + #{feetype}, + #{psnsetlway}, + #{mdtrtcerttype}, + #{payordid}, + #{paytoken}, + #{payAuthNo}, + #{chrgbchno}, + #{mdtrtid}, + #{ordstas}, + #{feesumamt}, + #{ownpayamt}, + #{psnacctpay}, + #{fundpay}, + #{othFeeAmt}, + #{applytime}, + #{approvedtime}, + #{userid}, + #{outTradeNo}, + #{tradeno}, + #{reason}, + + + + + update mk_insurance_pay + + idNo = #{idno}, + userName = #{username}, + idType = #{idtype}, + psnNo = #{psnno}, + medOrgOrd = #{medorgord}, + medType = #{medtype}, + feeType = #{feetype}, + psnSetlway = #{psnsetlway}, + mdtrtCertType = #{mdtrtcerttype}, + payOrdId = #{payordid}, + payToken = #{paytoken}, + chrgBchno = #{chrgbchno}, + mdtrtId = #{mdtrtid}, + ordStas = #{ordstas}, + feeSumamt = #{feesumamt}, + ownPayAmt = #{ownpayamt}, + psnAcctPay = #{psnacctpay}, + othFeeAmt = #{othFeeAmt}, + fundPay = #{fundpay}, + applyTime = #{applytime}, + approvedTime = #{approvedtime}, + userid = #{userid}, + outTradeNo = #{outTradeNo}, + tradeno = #{tradeno}, + reason = #{reason}, + medinsSetlId = #{medinsSetlId}, + + where mk_id = #{mkId} + + + + delete from mk_insurance_pay where mk_id = #{mkId} + + + + delete from mk_insurance_pay where mk_id in + + #{mkId} + + + \ No newline at end of file diff --git a/health_framework/target/classes/mapper/order/YcMsgMapper.xml b/health_framework/target/classes/mapper/order/YcMsgMapper.xml new file mode 100644 index 0000000..db0c19a --- /dev/null +++ b/health_framework/target/classes/mapper/order/YcMsgMapper.xml @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + select + msgid, + touser, + temlateid, + msgurl, + content, + msgStatus, + createDate, + updateTime, + tmsgid + from yc_msg + + + + + + + + insert into yc_msg + + msgid, + touser, + temlateid, + msgurl, + content, + msg_status, + create_date, + update_time, + tmsgid, + + + #{msgid}, + #{touser}, + #{temlateid}, + #{msgurl}, + #{content}, + #{msgStatus}, + #{createDate}, + #{updateTime}, + #{tmsgid}, + + + + + update yc_msg + + msgid = #{msgid}, + touser = #{touser}, + temlateid = #{temlateid}, + msgurl = #{msgurl}, + content = #{content}, + msg_status = #{msgStatus}, + create_date = #{createDate}, + update_time = #{updateTime}, + tmsgid = #{tmsgid}, + + where msgid = #{msgid} + + + + update sys_dept set + del_flag = '2' where msgid = #{msgid} + + \ No newline at end of file diff --git a/health_framework/target/classes/mapper/order/YcPayCallbackMapper.xml b/health_framework/target/classes/mapper/order/YcPayCallbackMapper.xml new file mode 100644 index 0000000..e025dea --- /dev/null +++ b/health_framework/target/classes/mapper/order/YcPayCallbackMapper.xml @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + select + id, + content, + descContent, + paytype, + payname, + createtime + from yc_pay_callback + + + + + + + + insert into yc_pay_callback + + id, + content, + descContent, + paytype, + payname, + createtime + + + #{id}, + #{content}, + #{descContent}, + #{paytype}, + #{payname}, + SYSDATE() + + + + + update yc_pay_callback + + id = #{id}, + content = #{content}, + descContent = #{descContent}, + paytype = #{paytype}, + payname = #{payname}, + createtime = #{createtime}, + + where id = #{id} + + + + update + sys_dept set del_flag = '2' where id = #{id} + + \ No newline at end of file diff --git a/health_framework/target/classes/mapper/user/YcAuthorityMapper.xml b/health_framework/target/classes/mapper/user/YcAuthorityMapper.xml new file mode 100644 index 0000000..2b88212 --- /dev/null +++ b/health_framework/target/classes/mapper/user/YcAuthorityMapper.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + select + authorityid, + authority, + remark + from yc_authority + + + + + + + + + + insert into yc_authority + + authorityid, + authority, + remark, + + + #{authorityid}, + #{authority}, + #{remark}, + + + + + update yc_authority + + authorityid = #{authorityid}, + authority = #{authority}, + remark = #{remark}, + + where authorityid = #{authorityid} + + + + update sys_dept set del_flag = '2' where authorityid = #{authorityid} + + \ No newline at end of file diff --git a/health_framework/target/classes/mapper/user/YcInhospPatientMapper.xml b/health_framework/target/classes/mapper/user/YcInhospPatientMapper.xml new file mode 100644 index 0000000..9672c73 --- /dev/null +++ b/health_framework/target/classes/mapper/user/YcInhospPatientMapper.xml @@ -0,0 +1,261 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select + patientid, + hospid, + patid, + ippatid, + ippatno, + idcardno, + cardtype, + patmedno, + patname, + visitid, + patsex, + birthday, + phone, + address, + contactPerson, + contactRelation, + contactPhone, + areaName, + bedNo, + admitDate, + totalAmount, + totalDeposit, + closedAmount, + uncoveredDeposit, + patState, + hospitalId, + del_flag, + createtime, + createby + from yc_inhosp_patient + + + + + + + + + + insert into yc_inhosp_patient + + patientid, + hospid, + patid, + ippatid, + ippatno, + idcardno, + cardtype, + patmedno, + patname, + visitid, + patsex, + birthday, + phone, + address, + contactPerson, + contactRelation, + contactPhone, + areaName, + bedNo, + admitDate, + totalAmount, + totalDeposit, + closedAmount, + uncoveredDeposit, + patState, + hospitalId, + del_flag, + createtime, + createby, + + + #{patientid}, + #{hospid}, + #{patid}, + #{ippatid}, + #{ippatno}, + #{idcardno}, + #{cardtype}, + #{patmedno}, + #{patname}, + #{visitid}, + #{patsex}, + #{birthday}, + #{phone}, + #{address}, + #{contactperson}, + #{contactrelation}, + #{contactphone}, + #{areaname}, + #{bedno}, + #{admitdate}, + #{totalamount}, + #{totaldeposit}, + #{closedamount}, + #{uncovereddeposit}, + #{patstate}, + #{hospitalid}, + #{delFlag}, + #{createtime}, + #{createby}, + + + + + update yc_inhosp_patient + + patientid = #{patientid}, + hospid = #{hospid}, + patid = #{patid}, + ippatid = #{ippatid}, + ippatno = #{ippatno}, + idcardno = #{idcardno}, + cardtype = #{cardtype}, + patmedno = #{patmedno}, + patname = #{patname}, + visitid = #{visitid}, + patsex = #{patsex}, + birthday = #{birthday}, + phone = #{phone}, + address = #{address}, + contactPerson = #{contactperson}, + contactRelation = #{contactrelation}, + contactPhone = #{contactphone}, + areaName = #{areaname}, + bedNo = #{bedno}, + admitDate = #{admitdate}, + totalAmount = #{totalamount}, + totalDeposit = #{totaldeposit}, + closedAmount = #{closedamount}, + uncoveredDeposit = #{uncovereddeposit}, + patState = #{patstate}, + hospitalId = #{hospitalid}, + del_flag = #{delFlag}, + createtime = #{createtime}, + createby = #{createby}, + + where patientid = #{patientid} + + + + update + sys_dept set del_flag = '2' where patientid = #{patientid} + + \ No newline at end of file diff --git a/health_framework/target/classes/mapper/user/YcOAuthMapper.xml b/health_framework/target/classes/mapper/user/YcOAuthMapper.xml new file mode 100644 index 0000000..fddd8ef --- /dev/null +++ b/health_framework/target/classes/mapper/user/YcOAuthMapper.xml @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + select + authid, + appid, + openid, + userid, + auth_type, + createtime, + updatetime + from yc_oauth + + + + + + + + + + insert into yc_oauth + + authid, + appid, + openid, + userid, + auth_type, + createtime, + updatetime, + + + #{authid}, + #{appid}, + #{openid}, + #{userid}, + #{authType}, + #{createtime}, + #{updatetime}, + + + + + update yc_oauth + + authid = #{authid}, + appid = #{appid}, + openid = #{openid}, + userid = #{userid}, + auth_type = #{authType}, + createtime = #{createtime}, + updatetime = #{updatetime}, + + where authid = #{authid} + + + + update sys_dept set + del_flag = '2' where authid = #{authid} + + \ No newline at end of file diff --git a/health_framework/target/classes/mapper/user/YcPatientMapper.xml b/health_framework/target/classes/mapper/user/YcPatientMapper.xml new file mode 100644 index 0000000..dccdabe --- /dev/null +++ b/health_framework/target/classes/mapper/user/YcPatientMapper.xml @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + + + select patientid, + openid, + patientName, + patientSex, + oppatno, + hiscardno, + cardno, + cardtype, + phone, + address, + cardid, + isnew + from yc_patient + + + + + + + + insert into yc_patient + + patientid, + openid, + opPatNo, + hiscardno, + cardno, + cardtype, + phone, + address, + cardid, + patientName, + patientSex, + isnew, + del_flag, + + + #{patientid}, + #{openid}, + #{oppatno}, + #{hiscardno}, + #{cardno}, + #{cardtype}, + #{phone}, + #{address}, + #{cardid}, + #{patientName}, + #{patientSex}, + #{isnew}, + #{delFlag}, + + + + + update yc_patient + + patientid = #{patientid}, + openid = #{openid}, + opPatNo = #{oppatno}, + hiscardno = #{hiscardno}, + cardno = #{cardno}, + cardtype = #{cardtype}, + phone = #{phone}, + address = #{address}, + cardid = #{cardid}, + patientName = #{patientName}, + patientSex = #{patientSex}, + isnew = #{isnew}, + del_flag = #{delFlag}, + + where patientid = #{patientid} + + + + + + + + update yc_patient + set del_flag = '2' + where patientid = #{patientid} + + \ No newline at end of file diff --git a/health_framework/target/classes/mapper/user/YcUserMapper.xml b/health_framework/target/classes/mapper/user/YcUserMapper.xml new file mode 100644 index 0000000..77fd254 --- /dev/null +++ b/health_framework/target/classes/mapper/user/YcUserMapper.xml @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + select + userid, + username, + user_type, + isActivated, + active_key, + password, + phonenum, + email, + createtime, + updatetime, + remark + from yc_user + + + + + + + + + + + + insert into yc_user( + userid, + username, + user_type, + isActivated, + active_key, + password, + phonenum, + email, + updatetime, + remark, + createtime) values( + #{userid}, + #{username}, + #{userType}, + #{isActivated}, + #{activeKey}, + #{password}, + #{phonenum}, + #{email}, + #{updatetime}, + #{remark}, + sysdate() + ) + + + + update yc_user + + userid = #{userid}, + username = #{username}, + user_type = #{userType}, + isActivated = #{isActivated}, + active_key = #{activeKey}, + password = #{password}, + phonenum = #{phonenum}, + email = #{email}, + createtime = #{createtime}, + updatetime = #{updatetime}, + remark = #{remark}, + + where userid = #{userid} + + + + update sys_dept set + del_flag = '2' where userid = #{userid} + + \ No newline at end of file diff --git a/health_framework/target/health_framework.jar b/health_framework/target/health_framework.jar new file mode 100644 index 0000000..b7d77be Binary files /dev/null and b/health_framework/target/health_framework.jar differ diff --git a/health_framework/target/maven-archiver/pom.properties b/health_framework/target/maven-archiver/pom.properties new file mode 100644 index 0000000..86bc234 --- /dev/null +++ b/health_framework/target/maven-archiver/pom.properties @@ -0,0 +1,3 @@ +version=1.0.2 +groupId=cn.health.service +artifactId=health_framework diff --git a/health_framework/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/health_framework/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 0000000..9dd92a9 --- /dev/null +++ b/health_framework/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1,80 @@ +cn/card/health/mapper/order/YcPayCallbackMapper.class +cn/card/health/framework/config/JwtAuthenticationTokenFilter.class +cn/card/health/util/JSONNode.class +cn/card/health/insurance/utils/SMSignUtil.class +cn/card/health/config/Swagger2Config.class +cn/card/health/service/impl/user/YcInhospPatientServiceImpl.class +cn/card/health/framework/service/HisCardService.class +cn/card/health/insurance/utils/BCUtils.class +cn/card/health/service/user/IYcOAuthService.class +cn/card/health/framework/service/alipay/utils/UUID$Holder.class +cn/card/health/mapper/insurance/MkInsurancePayMapper.class +cn/card/health/alipay/pay/MkAlipayInsuranceService.class +cn/card/health/service/order/IYcMsgService.class +cn/card/health/framework/config/SecurityConfig.class +cn/card/health/mapper/user/YcInhospPatientMapper.class +cn/card/health/service/user/IYcUserService.class +cn/card/health/framework/UserLoginService.class +cn/card/health/mapper/HealthCardApptokenMapper.class +cn/card/health/framework/service/alipay/AlipayAppletService.class +cn/card/health/service/impl/user/YcOAuthServiceImpl.class +cn/card/health/mapper/user/YcOAuthMapper.class +cn/card/health/service/impl/insurance/MkInsurancePayServiceImpl.class +cn/card/health/framework/config/ResourcesConfig.class +cn/card/health/service/impl/insurance/MkAppletRequestServiceImpl.class +cn/card/health/service/impl/user/YcPatientServiceImpl.class +cn/card/health/service/user/IYcInhospPatientService.class +cn/card/health/base/controller/BaseController.class +cn/card/health/framework/security/handle/LogoutSuccessHandlerImpl.class +cn/card/health/framework/service/wechat/HealthCardWechatServcie.class +cn/card/health/service/insurance/IMkAppletRequestService.class +cn/card/health/service/user/IYcPatientService.class +cn/card/health/insurance/HealthInsuranceService.class +cn/card/health/mapper/insurance/MkAppletRequestMapper.class +cn/card/health/framework/service/bank/BankService.class +cn/card/health/framework/service/alipay/utils/UUID.class +cn/card/health/insurance/utils/SignAndEncodeUtil.class +cn/card/health/framework/service/alipay/HealthInsuranceService.class +cn/card/health/framework/service/alipay/TokenService.class +cn/card/health/service/user/IYcAuthorityService.class +cn/card/health/base/controller/BaseController$1.class +cn/card/health/framework/service/HisClinicHealthService.class +cn/card/health/util/MyX509TrustManager.class +cn/card/health/service/impl/order/YcMsgServiceImpl.class +cn/card/health/service/HealthCardApptokenService.class +cn/card/health/framework/ScheduleRegistResource.class +cn/card/health/bean/order/YcPayCallback.class +cn/card/health/alipay/config/AlipayAppletConfig.class +cn/card/health/service/impl/user/YcUserServiceImpl.class +cn/card/health/framework/service/alipay/utils/IdUtils.class +cn/card/health/entity/Unbing.class +cn/card/health/entity/Image.class +cn/card/health/bean/order/YcMsg.class +cn/card/health/bean/insurance/MkInsurancePay.class +cn/card/health/framework/service/alipay/domain/AlipayOAuthTokenDto.class +cn/card/health/framework/service/HisReportService.class +cn/card/health/service/impl/user/YcAuthorityServiceImpl.class +cn/card/health/framework/security/handle/AuthenticationEntryPointImpl.class +cn/card/health/framework/service/bank/BankConfig.class +cn/card/health/config/HealthCardConfig.class +cn/card/health/mapper/user/YcAuthorityMapper.class +cn/card/health/service/impl/order/YcPayCallbackServiceImpl.class +cn/card/health/service/insurance/IMkInsurancePayService.class +cn/card/health/entity/Phone.class +cn/card/health/mapper/user/YcPatientMapper.class +cn/card/health/helper/iniOpenId.class +cn/card/health/framework/service/HisInPatientService.class +cn/card/health/framework/service/RegistHealthService.class +cn/card/health/entity/HealthCardInfoEntity.class +cn/card/health/service/Sign.class +cn/card/health/service/order/IYcPayCallbackService.class +cn/card/health/insurance/HealthInsuranceConfig.class +cn/card/health/oauth/security/UserDetailsServiceImpl.class +cn/card/health/mapper/order/YcMsgMapper.class +cn/card/health/config/DataSourceConfig.class +cn/card/health/service/impl/HealthCardApptokenServiceImpl.class +cn/card/health/insurance/utils/EasyGmUtils.class +cn/card/health/config/MybatisPubConfig.class +cn/card/health/framework/service/ThreadOrderService.class +cn/card/health/bean/insurance/MkAppletRequest.class +cn/card/health/mapper/user/YcUserMapper.class diff --git a/health_framework/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/health_framework/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 0000000..0ade2a2 --- /dev/null +++ b/health_framework/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1,110 @@ +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/order/mapper/YcHealthcardApptokenMapper.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/service/impl/user/YcPatientServiceImpl.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/service/impl/HealthCardTempServiceImpl.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/config/HealthCardConfig.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/mapper/HealthCardApptokenMapper.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/alipay/utils/UUID.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/alipay/pay/AlipayPayService.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/service/user/IYcOAuthService.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/mapper/insurance/MkInsurancePayMapper.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/service/user/IYcInhospPatientService.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/framework/service/alipay/AlipayAppletService.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/framework/security/handle/LogoutSuccessHandlerImpl.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/service/HealthCardApptokenService.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/mapper/HealthCardInfoMapper.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/framework/service/HisCardService.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/service/impl/insurance/MkAppletRequestServiceImpl.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/order/mapper/YcHealthcardInfoMapper.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/mapper/order/YcMsgMapper.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/mapper/user/YcPatientMapper.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/framework/service/bank/BankConfig.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/framework/service/HisClinicHealthService.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/mapper/user/YcAuthorityMapper.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/framework/config/SecurityConfig.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/entity/Phone.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/service/impl/insurance/MkInsurancePayServiceImpl.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/insurance/HealthInsuranceService.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/order/controller/YcHealthcardApptokenController.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/service/order/IYcPayCallbackService.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/insurance/utils/SignAndEncodeUtil.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/order/service/IYcHealthcardApptokenService.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/framework/ScheduleRegistResource.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/service/user/IYcAuthorityService.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/mapper/insurance/MkAppletRequestMapper.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/framework/service/ThreadOrderService.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/service/impl/order/YcPayCallbackServiceImpl.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/framework/service/HisReportService.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/mapper/user/YcOAuthMapper.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/service/impl/HealthCardInfoServiceImpl.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/service/HealthCardInfoService.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/service/order/impl/YcHealthcardApptokenServiceImpl.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/framework/service/wechat/HealthCardWechatServcie.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/alipay/pay/MkAlipayInsuranceService.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/service/impl/HealthCardApptokenServiceImpl.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/insurance/HealthInsuranceConfig.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/entity/Unbing.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/framework/service/RegistHealthService.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/framework/security/handle/AuthenticationEntryPointImpl.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/order/service/impl/YcHealthcardTempServiceImpl.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/oauth/OAuth2Configuration.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/framework/service/HisCallService.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/oauth/security/SecurityConfiguration.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/framework/service/HisInPatientService.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/oauth/SecurityConfiguration.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/base/controller/BaseController.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/order/service/IYcHealthcardTempService.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/oauth/security/UserDetailsServiceImpl.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/framework/UserLoginService.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/framework/service/GetHeatlhCardService.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/alipay/domain/AlipayOAuthTokenDto.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/service/impl/user/YcUserServiceImpl.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/config/XBasicDataSource.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/bean/order/YcPayCallback.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/order/controller/YcHealthcardInfoController.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/oauth/security/UserNotActivatedException.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/order/service/IYcHealthcardInfoService.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/insurance/utils/EasyGmUtils.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/insurance/utils/BCUtils.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/order/mapper/YcHealthcardTempMapper.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/framework/config/ApplicationConfig.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/framework/service/bank/BankService.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/entity/HealthCardInfoEntity.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/service/Sign.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/entity/Image.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/bean/order/YcMsg.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/service/impl/order/YcMsgServiceImpl.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/alipay/config/AlipayAppletConfig.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/service/HealthCardTempService.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/config/Swagger2Config.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/bean/insurance/MkAppletRequest.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/mapper/HealthCardTempMapper.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/order/service/impl/YcHealthcardInfoServiceImpl.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/framework/service/alipay/HealthInsuranceService.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/mapper/order/YcPayCallbackMapper.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/insurance/utils/SMSignUtil.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/util/JSONNode.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/alipay/utils/IdUtils.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/mapper/user/YcUserMapper.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/service/impl/user/YcInhospPatientServiceImpl.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/order/controller/YcHealthcardTempController.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/framework/config/ResourcesConfig.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/helper/iniOpenId.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/service/insurance/IMkAppletRequestService.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/oauth/security/UserRepository.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/service/user/IYcPatientService.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/util/MyX509TrustManager.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/config/DataSourceConfig.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/helper/InitCommonIn.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/oauth/security/CustomLogoutSuccessHandler.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/framework/config/JwtAuthenticationTokenFilter.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/bean/insurance/MkInsurancePay.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/service/insurance/IMkInsurancePayService.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/framework/service/MyUserDetailsService.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/service/user/IYcUserService.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/config/MybatisPubConfig.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/service/impl/user/YcAuthorityServiceImpl.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/service/order/IYcMsgService.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/framework/service/alipay/TokenService.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/oauth/security/CustomAuthenticationEntryPoint.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/service/impl/user/YcOAuthServiceImpl.java +/Users/circlexing/work_java/1/health_parent/health_framework/src/main/java/cn/card/health/mapper/user/YcInhospPatientMapper.java diff --git a/health_common b/health_framework/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst similarity index 100% rename from health_common rename to health_framework/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst diff --git a/health_framework/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/health_framework/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst new file mode 100644 index 0000000..e69de29 diff --git a/health_his/pom.xml b/health_his/pom.xml new file mode 100644 index 0000000..d0963cc --- /dev/null +++ b/health_his/pom.xml @@ -0,0 +1,48 @@ + + + 4.0.0 + + cn.health.service + health-parent + 1.0.2 + + health_his + his调用 + + + + + + + + cn.health.service + health_hosp + + + + cn.hutool + hutool-all + 5.7.12 + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + true + + + + + \ No newline at end of file diff --git a/health_his/src/main/java/cn/card/health/config/wasdyrmyy/WechatHospConfig.java b/health_his/src/main/java/cn/card/health/config/wasdyrmyy/WechatHospConfig.java new file mode 100644 index 0000000..90574db --- /dev/null +++ b/health_his/src/main/java/cn/card/health/config/wasdyrmyy/WechatHospConfig.java @@ -0,0 +1,82 @@ +package cn.card.health.config.wasdyrmyy; + +/** + * 微信配置 + * + * @author xinggm + * @date 2021年5月26日 + */ +public class WechatHospConfig { + //云端cloud证书序列号 + /** */ +// public static final String service_appid = "wx2bab72a2efc661a9"; +// public static final String mech_serialno= "7C2B12FCE39CCA0AF4DCABFF23366CAC79C102D7";// +// public static final String service_mech_id = "1541563721"; +// public static final String service_app_secret_v3 = "BE3F4E196937F9308899D7CA4C8664AA"; +// public static final String mech_cert_path = "D:/data/wechat/cloud/apiclient_key.pem"; +// public static final String wechatCode = "73EFA6796D3869FF82FAE7E81E9814B7"; +// public static final String service_secret = "f7482839c93f6b8732ea5257397d1815"; + + + /** + * 微信健康卡appId + */ + //public static final String appId = "660a4a5aac415e24be8e636362a74f63"; + public static final String appId = "52702d8529ac4d0ea8881557931601ac"; + /** + * 微信健康卡秘钥 + */ + //public static final String appSecret = "fe495c53d250593b47ad27e0ada93e19"; + public static final String appSecret = "0ef0241ddf5c42fbaa620fdb7664e6e2"; + +// /** 微信公众号app秘钥 */ +// public static final String service_secret = "282fef76cbb1a40bab7ad70827bbb82e"; +// /** 微信appid */ +// public static final String service_appid = "wx1680ad749d368804"; +// /** 雨辰商户号 */ +// public static final String service_mech_id = "1603587020"; +// /** 支付api秘钥 */ +// public static final String service_app_secret = "F3F205A8C5F6822AC07E8FAD8E14E9A6"; +// /** 支付apiv3秘钥 */ +// public static final String service_app_secret_v3 = "EFB19D8AD100E310404A9A34AF01E7BC"; +// +// /** 雨辰商户证书序列号 */ +// public static final String mech_serialno = "1AF46981DAA3A83B9CDFBC74F7DF44CDF6868393"; +// /** 商户证书路径 */ +// public static final String mech_cert_path = "D:/data/wechat/apiclient_key.pem"; + + + // /** 微信调用地址 */ +// public static final String url = "https://api.weixin.qq.com"; +// /** 微信证书序列号 */ +// public static final String serialNo = "1AF46981DAA3A83B9CDFBC74F7DF44CDF6868393"; +// /** 微信支付回调地址 */ +// public static final String notify_url = "https://www.hbyctr.com/health_service/wechat/notify"; +// /** 微信退款回调地址 */ +// public static final String refund_rul = "https://www.hbyctr.com/health_service/wechat/refund"; +// /** 子商户号 */ +// public static final String sub_mech_id = "1900000109"; +// /** 微信appid */ +// public static final String sub_appid = "wx1680ad749d368804"; +// +// public static final String hospitalId = "31956";// + public static final String hospitalId = "33456"; + public static final String hospcode = "747554124"; +// public static final String hospcode = "747554124"; +// /** 微信退款地址 */ +// public static final String url_refund = "https://api.mch.weixin.qq.com/v3/refund/domestic/refunds"; +// /** 微信公众号支付地址 */ +// public static final String url_jsapi = "https://api.mch.weixin.qq.com/v3/pay/transactions/jsapi"; + /** */ +// public static final String wechatCode = "73EFA6796D3869FF82FAE7E81E9814B7"; +// /** 微信appid */ +// public static final String appid = "wxc7debf0cf94f9616"; +// /** 微信appId */ +// public static final String appId = "660a4a5aac415e24be8e636362a74f63"; +// /** 微信公众号秘钥 */ +// public static final String secret = "93bf768ed25b1ffebd42abb691af1811"; +// /** 微信公众号app秘钥 */ +// public static String appSecret = "fe495c53d250593b47ad27e0ada93e19"; +// /** 微信调用地址 */ +// public static final String url = "https://api.weixin.qq.com"; +} diff --git a/health_his/src/main/java/cn/card/health/his/service/ClientConnection.java b/health_his/src/main/java/cn/card/health/his/service/ClientConnection.java new file mode 100644 index 0000000..a0f2373 --- /dev/null +++ b/health_his/src/main/java/cn/card/health/his/service/ClientConnection.java @@ -0,0 +1,138 @@ +package cn.card.health.his.service; + +import cn.his.client.gdbh.NWzfservice; +import cn.his.client.gdbh.NWzfserviceSoap; +import cn.hutool.core.collection.ConcurrentHashSet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Iterator; +import java.util.Set; + +public class ClientConnection { + private static Logger log = LoggerFactory.getLogger(ClientConnection.class); + + /** + * 当前连接数 + */ + private int connNum = 5; + + //WebService连接池 + private static Set connPools; + + /** + * 创建连接池 + */ + public void createPools(String host, String port) { + if (connPools == null) { + connPools = new ConcurrentHashSet<>(connNum); + } + System.setProperty("http.proxyHost", host); + System.setProperty("http.proxyPort", port); + for (int i = 0; i < connNum; i++) { + NWzfservice service = new NWzfservice(); + NWzfserviceSoap soap = service.getNWzfserviceSoap(); + connPools.add(soap); + } + } + + /** + * 获取一个连接 + * + * @return + */ + public NWzfserviceSoap getPoolConn() { + synchronized (this) { + Iterator iter = connPools.iterator(); + while (iter.hasNext()) { + NWzfserviceSoap client = iter.next(); + connPools.remove(client); + log.info(Thread.currentThread().getName() + ":取出一个连接,当前还剩" + connPools.size() + "个连接"); + if (isValid(client)) { + return client; + } else { + log.info(Thread.currentThread().getName() + ":连接已经过期,新建连接"); + NWzfservice service = new NWzfservice(); + NWzfserviceSoap soap = service.getNWzfserviceSoap(); + return soap; + } + } + try { + log.info(Thread.currentThread().getName() + ":连接池中没有对象了,等待连接中"); + wait(); + } catch (InterruptedException e) { + log.error(e.getMessage()); + } + log.info(Thread.currentThread().getName() + ":该线程被唤醒"); + return this.getPoolConn(); + } + } + + /** + * 判断连接是否可用 + * + * @param client + * @return + */ + private boolean isValid(NWzfserviceSoap client) { + if (client == null) { + return false; + } + return true; + } + + + /** + * 释放连接 + * + * @param client + */ + public void freeConnection(NWzfserviceSoap client) { + synchronized (this) { + connPools.add(client); + //唤醒等待连接的线程 + notifyAll(); + } + } + + /** + * 关闭所有连接 + */ + public void relase() { + synchronized (this) { + Iterator iter = connPools.iterator(); + while (iter.hasNext()) { + connPools.remove(iter.next()); + } + } + } + + /** + * 检查连接是否过期,如果过期重新创建 + */ + public void checkConnection() { + synchronized (this) { + log.info("检查连接是否为空!"); + if (connPools.size() != 0) { + Iterator iter = connPools.iterator(); + while (iter.hasNext()) { + NWzfserviceSoap client = iter.next(); + if (!isValid(client)) { + connPools.remove(iter.next()); + log.info(Thread.currentThread().getName() + ":连接已经过期,新建连接"); + NWzfservice service = new NWzfservice(); + client = service.getNWzfserviceSoap(); + connPools.add(client); + } + } + } else { + log.info("连接池中没有连接,重新创建连接!"); + for (int i = 0; i < connNum; i++) { + NWzfservice service = new NWzfservice(); + NWzfserviceSoap soap = service.getNWzfserviceSoap(); + connPools.add(soap); + } + } + } + } +} diff --git a/health_his/src/main/java/cn/card/health/his/service/HisResult.java b/health_his/src/main/java/cn/card/health/his/service/HisResult.java new file mode 100644 index 0000000..402186c --- /dev/null +++ b/health_his/src/main/java/cn/card/health/his/service/HisResult.java @@ -0,0 +1,126 @@ +package cn.card.health.his.service; + +import cn.card.health.common.utils.MapUtils; +import org.apache.commons.lang3.StringUtils; + +import java.util.List; +import java.util.Map; + +/** + * 处理HIS返回 + * + * @author xinggm + * @date 2021年7月14日 + */ +public class HisResult { + + /** + * his返回结果 + */ + private String returnCode; + /** + * his返回消息 + */ + private String returnMsg; + + private List> listData; + + private Map retData; + + public String getReturnCode() { + return returnCode; + } + + public void setReturnCode(String returnCode) { + this.returnCode = returnCode; + } + + public String getReturnMsg() { + return returnMsg; + } + + public void setReturnMsg(String returnMsg) { + this.returnMsg = returnMsg; + } + + public boolean isSucess() { + if ("1".equals(this.getReturnCode())) { + return true; + } else { + return false; + } + } + + public boolean isSucess(String flag) { + if (flag.equals(this.getReturnCode())) { + return true; + } else { + return false; + } + } + + @SuppressWarnings("unchecked") + public static HisResult instance(Map map, String expression, boolean isSingle) { + HisResult retResult = new HisResult(); + retResult.setReturnCode(map.get("code") + ""); + retResult.setReturnMsg(map.get("msg") + ""); + if (!retResult.isSucess()) { + return retResult; + } + if (StringUtils.isBlank(expression)) { + return retResult; + } + if (isSingle) { + retResult.setRetData((Map) MapUtils.getValue(map, expression)); + } else { + retResult.setListData((List>) MapUtils.getValue(map, expression, List.class)); + } + return retResult; + } + + public static HisResult instance(Map map) { + HisResult retResult = new HisResult(); + retResult.setReturnCode(map.get("code") + ""); + retResult.setReturnMsg(map.get("msg") + ""); + if (!retResult.isSucess()) { + return retResult; + } + + return retResult; + } + + @SuppressWarnings("unchecked") + public static HisResult instance(Map map, String expression, boolean isSingle, String flag) { + HisResult retResult = new HisResult(); + retResult.setReturnCode(map.get("code") + ""); + retResult.setReturnMsg(map.get("msg") + ""); + if (!retResult.isSucess(flag)) { + return retResult; + } + if (StringUtils.isBlank(expression)) { + return retResult; + } + if (isSingle) { + retResult.setRetData((Map) MapUtils.getValue(map, expression)); + } else { + retResult.setListData((List>) MapUtils.getValue(map, expression, List.class)); + } + return retResult; + } + + public List> getListData() { + return listData; + } + + public void setListData(List> listData) { + this.listData = listData; + } + + public Map getRetData() { + return retData; + } + + public void setRetData(Map retData) { + this.retData = retData; + } +} diff --git a/health_his/src/main/java/cn/card/health/his/service/IHisCallService.java b/health_his/src/main/java/cn/card/health/his/service/IHisCallService.java new file mode 100644 index 0000000..4bc2059 --- /dev/null +++ b/health_his/src/main/java/cn/card/health/his/service/IHisCallService.java @@ -0,0 +1,277 @@ +package cn.card.health.his.service; + +import cn.card.health.bean.hospital.YcPatient; +import cn.card.health.bean.order.YcOrderRegist; +import com.alibaba.fastjson.JSONObject; + +import java.util.List; +import java.util.Map; + +/** + * HIS调用service + * + * @author xinggm + * @date 2021年9月13日 + */ +public interface IHisCallService { + /** + * 患者信息匹配 + */ + public HisResult getPatientInfo(String memberid); + + /** + * 患者信息绑定 + */ + public Map bindPatientInfo(Map params); + + /** + * 建卡接口 + */ + public HisResult registPatientInfo(YcPatient patient); + + /** + * 患者信息解除绑定 + */ + public HisResult updatePatient(JSONObject params); + + /** + * 卡充值 + */ + public HisResult cardCharge(JSONObject hParams); + + /** + * 充值列表 + * @param hParams + * @return + */ + public HisResult chargeList(JSONObject hParams); + + /** + * 获取医保人员信息 + */ + public HisResult getPsnInfo(JSONObject pParams); + + public HisResult getNationList(); + + /** + * 科室挂号信息查询接口 + */ + public List> getDeptList(Map params); + + /** + * 医生挂号信息查询 + */ + public List> getDoctorList(Map params); + + /** + * 医生挂号班别信息查询 + */ + public List> getDoctorRegScheduleListByDept(Map params); + + /** + * 医生挂号班别信息查询 + */ + public List> getDoctorRegScheduleListByDr(Map params); + + /** + * 医生挂号分时号源信息 + */ + public List> getDoctorRegTimeList(Map params); + + /** + * 生成预约挂号订单 + */ + public HisResult lockPreRegOrder(YcOrderRegist regist); + + /** + * 取消预约挂号订单 + */ + public HisResult cancelPreRegOrder(YcOrderRegist regist); + + /** + * 预约挂号订单支付 + */ + public HisResult payPreRegOrder(JSONObject hParams); + + /** + * 预约挂号订单退费 + */ + public HisResult refundPreReg(JSONObject hParams); + + /** + * 当天挂号号源锁定 + */ + public HisResult lockRegSeqToday(YcOrderRegist regist); + + /** + * 当天挂号解除锁定接口 + */ + public HisResult unlockRegSeqToday(YcOrderRegist regist); + + /** + * 当天挂号接口 + */ + public HisResult addRegOrder(YcOrderRegist regist); + + /** + * 挂号订单查询 + */ + public List> getRegOrderInfo(Map params); + + /** + * 待缴费就诊记录查询 + */ + public HisResult getWaitClinicList(Map params); + + /** + * 待缴费明细记录查询接口 + */ + public HisResult getWaitClinicDetail(Map params); + + /** + * 待缴费明细记录查询接口 + */ + public HisResult getWaitClinicInsurance(Map params); + + /** + * 待缴费明细记录查询接口 + */ + public HisResult lockClinicOrder(Map params); + + /** + * 待缴费记录支付接口 + */ + public HisResult payClinicOrder(Map params); + + /** + * 已缴费记录查询 + */ + public HisResult getPayClinicInfo(Map params); + + /** + * 已缴费记录明细查询 + */ + public HisResult getPayClinicDetail(Map params); + + /** + * 门诊病人就诊记录查询 + */ + public HisResult getMedicalRecord(Map params); + + /** + * 门诊病人病历查询接口 + */ + public HisResult getMedicalDetail(Map params); + + /** + * 住院病人基本情况查询 + */ + public HisResult getInPatientInfo(Map params); + + /** + * 住院当前费用情况查询 + */ + public HisResult getIpChgInfo001(Map params); + + /** + * 住院当前费用情况查询 + */ + public HisResult getIpChgInfo002(Map params); + + /** + * 住院费用分类项目汇总查询 + */ + public HisResult getIpExpenseItemTotal(Map params); + + /** + * 住院押金明细查询 + */ + public HisResult getIpDepositDetail001(Map params); + + /** + * 住院押金支付接口 + */ + public HisResult getIpDepositDetail002(Map params); + + /** + * 住院押金支付 + */ + public HisResult payIpDeposit(Map params); + + /** + * 住院一日清单查询 + */ + public HisResult getIpDayExpenseList(Map params); + + /** + * 住院一日清单费用分类项目汇总查询 + */ + public HisResult getIpDayExpenseItemTotal(Map params); + + /** + * 检验报告 + */ + public HisResult getLisReportList(JSONObject params); + + /** + * 核酸检验报告 + * + * @param patId + * @param month + * @return + */ + public HisResult getNuclReportList(String patId, String month); + + /** + * 检验报告详情 + */ + public HisResult getLisReportDetail(JSONObject params); + + /** + * 检查报告列表 + */ + public HisResult getPacsReportList(Map params); + + /** + * 检查报告详情 + */ + public HisResult getPacsReportDetail(Map params); + + /** + * 科室查询 + */ + public List> getDeptInfo(String deptId); + + /** + * 医生查询 + */ + public List> getDoctorInfo(String deptId, String doctorId); + + /** + * 获取核酸价格 + */ + public Map getNucl(String hisCode); + + /** + * 核酸挂号缴费 + */ + public Map createNucl(Map params); + + /** + * 查询住院病例 + * + * @param patName + * @param idNumber + * @return + */ + Map getIpPatientInfo(String patName, String idNumber); + + /** + * 医保缴费待缴费记录明细(91001) + * + * @param patId + * @param prscrptNumber + * @return + */ + Map getLisReportDetailInfo(String patId, String prscrptNumber); +} diff --git a/health_his/src/main/java/cn/card/health/his/service/hdzxy/HisCallService.java b/health_his/src/main/java/cn/card/health/his/service/hdzxy/HisCallService.java new file mode 100644 index 0000000..fcc2876 --- /dev/null +++ b/health_his/src/main/java/cn/card/health/his/service/hdzxy/HisCallService.java @@ -0,0 +1,1904 @@ +package cn.card.health.his.service.hdzxy; + +import cn.card.health.bean.hospital.YcPatient; +import cn.card.health.bean.order.MkHisParams; +import cn.card.health.bean.order.YcOrderRegist; +import cn.card.health.bean.order.YcOrderSerialpay; +import cn.card.health.common.utils.Convert; +import cn.card.health.common.utils.DateUtils; +import cn.card.health.common.utils.MapUtils; +import cn.card.health.common.utils.XMLUtils; +import cn.card.health.config.wasdyrmyy.WechatHospConfig; +import cn.card.health.his.service.HisResult; +import cn.card.health.his.service.IHisCallService; +import cn.card.health.service.order.IMkHisParamsService; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.IdUtil; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import java.util.*; + +@Service("hdzxyHisCallService") +public class HisCallService implements IHisCallService { + @Value("${config.isMN}") + private boolean isMN; + @Autowired + private IMkHisParamsService hisParamsService; + + /** + * 4.2 患者信息匹配002 + */ + @Override + public HisResult getPatientInfo(String memberid) { + String resxml = ""; + JSONObject params = new JSONObject(); + params.put("cardId", memberid); + if (isMN) { + resxml = "{ \"msg\": \"操作成功\", \"data\": { \"sex\": \"M\", \"nationId\": 1, \"nation\": \"汉族\", \"name\": \"测试\", \"member_id\": 25805, \"idcard\": \"130681198803232232\", \"hspcard\": \"81523797\", \"createdate\": \"YES\", \"balance\": 259.99, \"age\": \"\", \"address\": \"河北省保定市涿州市奥特曼技术培养地\" }, \"code\": 1 }"; + } else { + resxml = HisWebClient.getHisPost("getMemberInfo", params.toJSONString(), ""); + MkHisParams hisParams = new MkHisParams(); + hisParams.setMkMethod("getMemberInfo"); + hisParams.setMkRequestData(params.toJSONString()); + hisParams.setMkResponseData(resxml); + hisParamsService.insertMkHisParams(hisParams); + } + JSONObject resJSON = JSONObject.parseObject(resxml); + HisResult result = HisResult.instance(resJSON, "data", true); +// if (result.isSucess()) { +// Map data = result.getRetData(); +// patient.setAddress(data.get("homeAddress") + ""); +// patient.setPhone(data.get("patMobile") + ""); +// patient.setOppatno(data.get("opPatNo") + ""); +// patient.setHiscardno(data.get("patMedNo") + ""); +// patient.setPatientid(Long.parseLong((String) data.get("patId"))); +// return result; +// } else { +// return result; +// } + return result; + } + + /** + * 卡充值 + */ + @Override + public HisResult cardCharge(JSONObject params) { + HisResult retResult; + String resData; + if (isMN) { + resData = "{ \"msg\": \"建档信息已经存在\", \"code\": 1, \"data\": [ { \"id\": 25805, \"name\": \"测试\", \"idcard\": \"130681198803232232\", \"pincode\": \"CS\", \"sex\": \"M\", \"birthday\": \"1988-03-23 00:00:00\", \"mobile\": null, \"homeaddress\": \"河北省保定市涿州市奥特曼技术培养地\", \"proviceId\": 130000, \"cityId\": 130600, \"countyId\": 130681, \"raceId\": 1, \"race\": \"汉族\", \"hspcard\": null }, { \"id\": 220531, \"name\": \"王凯\", \"idcard\": \"130681198803232232\", \"pincode\": \"CS(K)\", \"sex\": \"M\", \"birthday\": \"1988-03-23 00:00:00\", \"mobile\": 13091126787, \"homeaddress\": \"河北省保定市涿州市奥特曼技术培养地\", \"proviceId\": 130000, \"cityId\": 130600, \"countyId\": 130681, \"raceId\": 1, \"race\": \"汉族\", \"hspcard\": null }, { \"id\": 273741, \"name\": \"王凯\", \"idcard\": \"130681198803232232\", \"pincode\": \"WK\", \"sex\": \"M\", \"birthday\": \"1988-03-23 00:00:00\", \"mobile\": null, \"homeaddress\": \"河北省保定市涿州市hfghgf\", \"proviceId\": 130000, \"cityId\": 130600, \"countyId\": 130681, \"raceId\": 1, \"race\": \"汉族\", \"hspcard\": null } ] }"; + + } else { + resData = HisWebClient.getHisPost("rechargeMember", params.toJSONString(), ""); + MkHisParams hisParams = new MkHisParams(); + hisParams.setMkMethod("rechargeMember"); + hisParams.setMkRequestData(params.toJSONString()); + hisParams.setMkResponseData(resData); + hisParamsService.insertMkHisParams(hisParams); + } + JSONObject resJSON = JSONObject.parseObject(resData); + retResult = HisResult.instance(resJSON); + Map data = new HashMap(); + data.put("orderid", resJSON.getString("data")); + retResult.setRetData(data); + return retResult; + } + + + /** + * 卡充值列表 + */ + @Override + public HisResult chargeList(JSONObject params) { + HisResult retResult; + String resData; + if (isMN) { + resData = "{ \"msg\": \"建档信息已经存在\", \"code\": 1, \"data\": [ { \"id\": 25805, \"name\": \"测试\", \"idcard\": \"130681198803232232\", \"pincode\": \"CS\", \"sex\": \"M\", \"birthday\": \"1988-03-23 00:00:00\", \"mobile\": null, \"homeaddress\": \"河北省保定市涿州市奥特曼技术培养地\", \"proviceId\": 130000, \"cityId\": 130600, \"countyId\": 130681, \"raceId\": 1, \"race\": \"汉族\", \"hspcard\": null }, { \"id\": 220531, \"name\": \"王凯\", \"idcard\": \"130681198803232232\", \"pincode\": \"CS(K)\", \"sex\": \"M\", \"birthday\": \"1988-03-23 00:00:00\", \"mobile\": 13091126787, \"homeaddress\": \"河北省保定市涿州市奥特曼技术培养地\", \"proviceId\": 130000, \"cityId\": 130600, \"countyId\": 130681, \"raceId\": 1, \"race\": \"汉族\", \"hspcard\": null }, { \"id\": 273741, \"name\": \"王凯\", \"idcard\": \"130681198803232232\", \"pincode\": \"WK\", \"sex\": \"M\", \"birthday\": \"1988-03-23 00:00:00\", \"mobile\": null, \"homeaddress\": \"河北省保定市涿州市hfghgf\", \"proviceId\": 130000, \"cityId\": 130600, \"countyId\": 130681, \"raceId\": 1, \"race\": \"汉族\", \"hspcard\": null } ] }"; + + } else { + resData = HisWebClient.getHisPost("getRechargeRecord", params.toJSONString()); + MkHisParams hisParams = new MkHisParams(); + hisParams.setMkMethod("getRechargeRecord"); + hisParams.setMkRequestData(params.toJSONString()); + hisParams.setMkResponseData(resData); + hisParamsService.insertMkHisParams(hisParams); + } + JSONObject resJSON = JSONObject.parseObject(resData); + retResult = HisResult.instance(resJSON, "data", false); + return retResult; + } + + + /** + * 4.7 患者信息绑定003 + */ + @Override + public Map bindPatientInfo(Map params) { + StringBuffer sbfin = new StringBuffer(); + sbfin.append(""); + sbfin.append(""); + sbfin.append("patInfoBind003"); + sbfin.append(""); + sbfin.append("" + WechatHospConfig.hospcode + ""); + sbfin.append("oYXd5s28xLluMU-xb3y8rb39-Ln0"); + sbfin.append(""); + sbfin.append(""); + sbfin.append(""); +// sbfin.append("1"); + sbfin.append(""); + sbfin.append("16619937285"); + sbfin.append(""); + sbfin.append(""); + sbfin.append("1"); + sbfin.append(""); +// sbfin.append("1396716"); +// sbfin.append("2105182085"); + sbfin.append(""); + sbfin.append(""); + sbfin.append(""); + sbfin.append(""); + sbfin.append(""); + String resxml; + if (isMN) { + resxml = "0建立病人档案成功210720306014364431436443"; + } else { + resxml = HisWebClient.getHisPost("", sbfin.toString()); + } + Map resMap = XMLUtils.Xml2Map(resxml); + Map resultMap = (Map) MapUtils.getValue(resMap, "response.returnData"); + return resultMap; + } + + /** + * 4.11 建卡接口002 + */ + @Override + public HisResult registPatientInfo(YcPatient patient) { + JSONObject params = new JSONObject(); + params.put("name", patient.getPatientName()); + params.put("sex", patient.getPatientSex()); + params.put("phone", patient.getPhone()); + params.put("age", ""); + params.put("idcard", patient.getCardno()); + params.put("nation", patient.getChannel()); + params.put("address", patient.getAddress()); + HisResult retResult; + String resData; + if (isMN) { + resData = "{ \"msg\": \"建档信息已经存在\", \"code\": 1, \"data\": [ { \"id\": 25805, \"name\": \"测试\", \"idcard\": \"130681198803232232\", \"pincode\": \"CS\", \"sex\": \"M\", \"birthday\": \"1988-03-23 00:00:00\", \"mobile\": null, \"homeaddress\": \"河北省保定市涿州市奥特曼技术培养地\", \"proviceId\": 130000, \"cityId\": 130600, \"countyId\": 130681, \"raceId\": 1, \"race\": \"汉族\", \"hspcard\": null }, { \"id\": 220531, \"name\": \"王凯\", \"idcard\": \"130681198803232232\", \"pincode\": \"CS(K)\", \"sex\": \"M\", \"birthday\": \"1988-03-23 00:00:00\", \"mobile\": 13091126787, \"homeaddress\": \"河北省保定市涿州市奥特曼技术培养地\", \"proviceId\": 130000, \"cityId\": 130600, \"countyId\": 130681, \"raceId\": 1, \"race\": \"汉族\", \"hspcard\": null }, { \"id\": 273741, \"name\": \"王凯\", \"idcard\": \"130681198803232232\", \"pincode\": \"WK\", \"sex\": \"M\", \"birthday\": \"1988-03-23 00:00:00\", \"mobile\": null, \"homeaddress\": \"河北省保定市涿州市hfghgf\", \"proviceId\": 130000, \"cityId\": 130600, \"countyId\": 130681, \"raceId\": 1, \"race\": \"汉族\", \"hspcard\": null } ] }"; + + } else { + resData = HisWebClient.getHisPost("addMemberInfo", params.toJSONString(), ""); + MkHisParams hisParams = new MkHisParams(); + hisParams.setMkMethod("addMemberInfo"); + hisParams.setMkRequestData(params.toJSONString()); + hisParams.setMkResponseData(resData); + hisParamsService.insertMkHisParams(hisParams); + } + JSONObject resJSON = JSONObject.parseObject(resData); + Object data = resJSON.get("data"); + if(data instanceof JSONArray){ + retResult = HisResult.instance(resJSON, "data", false); + }else{ + retResult = HisResult.instance(resJSON, "data", true); + } + return retResult; + } + + /** + * 4.9 患者信息解除绑定001 + */ + @Override + public HisResult updatePatient(JSONObject params) { + HisResult retResult; + String resData; + if (isMN) { + resData = "{ \"msg\": \"建档信息已经存在\", \"code\": 1, \"data\": [ { \"id\": 25805, \"name\": \"测试\", \"idcard\": \"130681198803232232\", \"pincode\": \"CS\", \"sex\": \"M\", \"birthday\": \"1988-03-23 00:00:00\", \"mobile\": null, \"homeaddress\": \"河北省保定市涿州市奥特曼技术培养地\", \"proviceId\": 130000, \"cityId\": 130600, \"countyId\": 130681, \"raceId\": 1, \"race\": \"汉族\", \"hspcard\": null }, { \"id\": 220531, \"name\": \"王凯\", \"idcard\": \"130681198803232232\", \"pincode\": \"CS(K)\", \"sex\": \"M\", \"birthday\": \"1988-03-23 00:00:00\", \"mobile\": 13091126787, \"homeaddress\": \"河北省保定市涿州市奥特曼技术培养地\", \"proviceId\": 130000, \"cityId\": 130600, \"countyId\": 130681, \"raceId\": 1, \"race\": \"汉族\", \"hspcard\": null }, { \"id\": 273741, \"name\": \"王凯\", \"idcard\": \"130681198803232232\", \"pincode\": \"WK\", \"sex\": \"M\", \"birthday\": \"1988-03-23 00:00:00\", \"mobile\": null, \"homeaddress\": \"河北省保定市涿州市hfghgf\", \"proviceId\": 130000, \"cityId\": 130600, \"countyId\": 130681, \"raceId\": 1, \"race\": \"汉族\", \"hspcard\": null } ] }"; + + } else { + resData = HisWebClient.getHisPost("modmemberinfo", params.toJSONString(), ""); + MkHisParams hisParams = new MkHisParams(); + hisParams.setMkMethod("modmemberinfo"); + hisParams.setMkRequestData(params.toJSONString()); + hisParams.setMkResponseData(resData); + hisParamsService.insertMkHisParams(hisParams); + } + JSONObject resJSON = JSONObject.parseObject(resData); + retResult = HisResult.instance(resJSON); + return retResult; + } + + @Override + public HisResult getPsnInfo(JSONObject pParams) { + String resxml; + if (isMN) { + resxml = "{ \"msg\": \"操作成功\", \"code\": 1, \"data\": { \"psn_no\": \"10000000000000000044437811\", \"insutype\": \"310\" } }"; + } else { + MkHisParams hisParams = new MkHisParams(); + hisParams.setMkMethod("queryPsnInfo"); + hisParams.setMkRequestData(pParams.toJSONString()); + resxml = HisWebClient.getHisPost("queryPsnInfo", pParams.toJSONString(), ""); + hisParams.setMkResponseData(resxml); + hisParamsService.insertMkHisParams(hisParams); + } + JSONObject resData = JSONObject.parseObject(resxml); + HisResult res = new HisResult(); + res.setRetData(resData); + res.setReturnCode("1"); + return res; + } + + + @Override + public HisResult getNationList() { + String resxml; + if (isMN) { + resxml = "{ \"msg\": \"操作成功\", \"code\": 1, \"data\": [ { \"name\": \"汉族\", \"id\": 1 }, { \"name\": \"蒙古族\", \"id\": 2 }, { \"name\": \"回族\", \"id\": 3 }, { \"name\": \"藏族\", \"id\": 4 }, { \"name\": \"维吾尔族\", \"id\": 5 }, { \"name\": \"苗族\", \"id\": 6 }, { \"name\": \"彝族\", \"id\": 7 }, { \"name\": \"壮族\", \"id\": 8 }, { \"name\": \"布依族\", \"id\": 9 }, { \"name\": \"朝鲜族\", \"id\": 10 }, { \"name\": \"满族\", \"id\": 11 }, { \"name\": \"侗族\", \"id\": 12 }, { \"name\": \"瑶族\", \"id\": 13 }, { \"name\": \"白族\", \"id\": 14 }, { \"name\": \"土家族\", \"id\": 15 }, { \"name\": \"哈尼族\", \"id\": 16 }, { \"name\": \"哈萨克族\", \"id\": 17 }, { \"name\": \"傣族\", \"id\": 18 }, { \"name\": \"黎族\", \"id\": 19 }, { \"name\": \"傈僳族\", \"id\": 20 }, { \"name\": \"佤族\", \"id\": 21 }, { \"name\": \"畲族\", \"id\": 22 }, { \"name\": \"高山族\", \"id\": 23 }, { \"name\": \"拉祜族\", \"id\": 24 }, { \"name\": \"水族\", \"id\": 25 }, { \"name\": \"东乡族\", \"id\": 26 }, { \"name\": \"纳西族\", \"id\": 27 }, { \"name\": \"景颇族\", \"id\": 28 }, { \"name\": \"柯尔克孜族\", \"id\": 29 }, { \"name\": \"土族\", \"id\": 30 }, { \"name\": \"达斡尔族\", \"id\": 31 }, { \"name\": \"仫佬族\", \"id\": 32 }, { \"name\": \"羌族\", \"id\": 33 }, { \"name\": \"布朗族\", \"id\": 34 }, { \"name\": \"撒拉族\", \"id\": 35 }, { \"name\": \"毛难族\", \"id\": 36 }, { \"name\": \"仡佬族\", \"id\": 37 }, { \"name\": \"锡伯族\", \"id\": 38 }, { \"name\": \"阿昌族\", \"id\": 39 } ] }"; + } else { + resxml = HisWebClient.getHisPost("getNationList", ""); + MkHisParams hisParams = new MkHisParams(); + hisParams.setMkMethod("getNationList"); + hisParams.setMkRequestData(""); + hisParams.setMkResponseData(resxml); + hisParamsService.insertMkHisParams(hisParams); + } + JSONObject resData = JSONObject.parseObject(resxml); + HisResult res = HisResult.instance(resData, "data", false); + return res; + } + + /** + * 5.1.1 科室挂号信息查询接口001 + */ + @Override + public List> getDeptList(Map params) { + JSONObject hParams = new JSONObject(params); + String resxml; + if (isMN) { + resxml = "{ \"msg\": \"操作成功\", \"code\": 1, \"data\": [ { \"depart_id\": 101, \"sn\": \"Z\", \"limist\": 90, \"depart_name\": \"治未病科\" }, { \"depart_id\": 111, \"sn\": \"Z\", \"limist\": 40, \"depart_name\": \"肿瘤二科\" }, { \"depart_id\": 113, \"sn\": \"Z\", \"limist\": 70, \"depart_name\": \"肿瘤四科\" }, { \"depart_id\": 142, \"sn\": \"H\", \"limist\": 30, \"depart_name\": \"呼吸与危重症医学科\" }, { \"depart_id\": 145, \"sn\": \"G\", \"limist\": 30, \"depart_name\": \"功能神经外科\" }, { \"depart_id\": 155, \"sn\": \"J\", \"limist\": 30, \"depart_name\": \"颈肩腰腿痛门诊\" }, { \"depart_id\": 156, \"sn\": \"Z\", \"limist\": 30, \"depart_name\": \"肿瘤六科\" }, { \"depart_id\": 160, \"sn\": \"P\", \"limist\": 30, \"depart_name\": \"普外一科(二病区)\" }, { \"depart_id\": 161, \"sn\": \"M\", \"limist\": 30, \"depart_name\": \"名中医工作室\" }, { \"depart_id\": 162, \"sn\": \"E\", \"limist\": 30, \"depart_name\": \"儿童青少年心理科\" }, { \"depart_id\": 166, \"sn\": \"X\", \"limist\": 60, \"depart_name\": \"眩晕科\" }, { \"depart_id\": 167, \"sn\": \"X\", \"limist\": 30, \"depart_name\": \"心脏内科(心病科)\" }, { \"depart_id\": 168, \"sn\": \"N\", \"limist\": 30, \"depart_name\": \"内分泌科(全科医学科)\" } ] }"; + } else { + resxml = HisWebClient.getHisPost("getSuhdudet", hParams.toJSONString()); + MkHisParams hisParams = new MkHisParams(); + hisParams.setMkMethod("getSuhdudet"); + hisParams.setMkRequestData(hParams.toJSONString()); + hisParams.setMkResponseData(resxml); + hisParamsService.insertMkHisParams(hisParams); + } + JSONObject resData = JSONObject.parseObject(resxml); + HisResult res = HisResult.instance(resData, "data", false); + if (res.isSucess()) { + return res.getListData(); + } else { + return null; + } + } + + /** + * 5.1.2 医生挂号信息查询接口001 + */ + @Override + public List> getDoctorList(Map params) { + JSONObject hParams = new JSONObject(params); + String resxml; + if (isMN) { + resxml = "{ \"msg\": \"操作成功\", \"code\": 1, \"data\": [ { \"doctor_type\": \"普通门诊中医辨证论治\", \"doctor_id\": 283, \"doctor_price\": 25.00, \"depart_id\": 101, \"timesegment\": \"AM\", \"id\": 35497, \"doctor_name\": \"王利敏\", \"depart_name\": \"治未病科\", \"limits\": 30, \"doctor_profile\": \" \" }, { \"doctor_type\": \"普通门诊中医辨证论治\", \"doctor_id\": 294, \"doctor_price\": 25.00, \"depart_id\": 101, \"timesegment\": \"AM\", \"id\": 35507, \"doctor_name\": \"任雨菲\", \"depart_name\": \"治未病科\", \"limits\": 30, \"doctor_profile\": \" \" }, { \"doctor_type\": \"普通门诊中医辨证论治\", \"doctor_id\": 754, \"doctor_price\": 25.00, \"depart_id\": 101, \"timesegment\": \"AM\", \"id\": 35521, \"depart_name\": \"治未病科\", \"limits\": 30, \"doctor_profile\": \" \" } ] }"; + } else { + resxml = HisWebClient.getHisPost("getSuhdudetDoctor", hParams.toJSONString()); + MkHisParams hisParams = new MkHisParams(); + hisParams.setMkMethod("getSuhdudetDoctor"); + hisParams.setMkRequestData(hParams.toJSONString()); + hisParams.setMkResponseData(resxml); + hisParamsService.insertMkHisParams(hisParams); + } + JSONObject resData = JSONObject.parseObject(resxml); + HisResult res = HisResult.instance(resData, "data", false); + if (res.isSucess()) { + return res.getListData(); + } else { + return null; + } + } + + /** + * 5.1.3 医生挂号班别信息查询接口001 + */ + @Override + public List> getDoctorRegScheduleListByDept(Map params) { + JSONObject hParams = new JSONObject(params); + String resxml; + if (isMN) { + resxml = "{ \"msg\": \"操作成功\", \"code\": 1, \"data\": [ { \"nation\": \"\", \"doctor_price\": 25.00, \"sex\": \"\", \"taskdate\": \"2024-06-06\", \"timesegment\": \"AM\", \"time\": \"8:00-12:00\", \"doctor_name\": \"王利敏\", \"doctor_depart\": \"治未病科\", \"age\": \"\", \"describes\": \"\", \"limits\": 30 }, { \"nation\": \"\", \"doctor_price\": 25.00, \"sex\": \"\", \"taskdate\": \"2024-06-06\", \"timesegment\": \"PM\", \"time\": \"2:00-5:30\", \"doctor_name\": \"王利敏\", \"doctor_depart\": \"治未病科\", \"age\": \"\", \"describes\": \"\", \"limits\": 30 } ] }"; + } else { + resxml = HisWebClient.getHisPost("getDotcotinfo", hParams.toJSONString()); + MkHisParams hisParams = new MkHisParams(); + hisParams.setMkMethod("getDotcotinfo"); + hisParams.setMkRequestData(hParams.toJSONString()); + hisParams.setMkResponseData(resxml); + hisParamsService.insertMkHisParams(hisParams); + } + JSONObject resData = JSONObject.parseObject(resxml); + HisResult res = HisResult.instance(resData, "data", false); + if (res.isSucess()) { + return res.getListData(); + } else { + return null; + } + } + + /** + * 5.1.4 医生挂号班别信息查询接口002 + */ + @Override + public List> getDoctorRegScheduleListByDr(Map params) { + JSONObject hParams = new JSONObject(params); + String resxml; + if (isMN) { + resxml = "{ \"msg\": \"操作成功\", \"code\": 1, \"data\": [ { \"nation\": \"\", \"doctor_price\": 25.00, \"sex\": \"\", \"taskdate\": \"2024-06-06\", \"timesegment\": \"AM\", \"time\": \"8:00-12:00\", \"doctor_name\": \"王利敏\", \"doctor_depart\": \"治未病科\", \"age\": \"\", \"describes\": \"\", \"limits\": 30 }, { \"nation\": \"\", \"doctor_price\": 25.00, \"sex\": \"\", \"taskdate\": \"2024-06-06\", \"timesegment\": \"PM\", \"time\": \"2:00-5:30\", \"doctor_name\": \"王利敏\", \"doctor_depart\": \"治未病科\", \"age\": \"\", \"describes\": \"\", \"limits\": 30 } ] }"; + } else { + resxml = HisWebClient.getHisPost("getDotcotinfo", hParams.toJSONString()); + MkHisParams hisParams = new MkHisParams(); + hisParams.setMkMethod("getDotcotinfo"); + hisParams.setMkRequestData(hParams.toJSONString()); + hisParams.setMkResponseData(resxml); + hisParamsService.insertMkHisParams(hisParams); + } + JSONObject resData = JSONObject.parseObject(resxml); + HisResult res = HisResult.instance(resData, "data", false); + if (res.isSucess()) { + return res.getListData(); + } else { + return null; + } + } + + /** + * 5.1.5 医生挂号分时号源信息接口001 + */ + @Override + public List> getDoctorRegTimeList(Map params) { + StringBuffer sbfin = new StringBuffer(); + sbfin.append(""); + sbfin.append(""); + sbfin.append("getDrRegTimeInfo001"); + sbfin.append(""); + sbfin.append(""); + sbfin.append(WechatHospConfig.hospcode); + sbfin.append(""); + sbfin.append(""); + sbfin.append(params.get("deptId")); + sbfin.append(""); + sbfin.append(""); + sbfin.append(params.get("doctorId")); + sbfin.append(""); + sbfin.append(""); + sbfin.append(params.get("regDate")); + sbfin.append(""); + sbfin.append(""); + sbfin.append(params.get("scheduleType")); + sbfin.append(""); + sbfin.append(""); + sbfin.append(""); + String resxml = HisWebClient.getHisPost("", sbfin.toString()); + Map resMap = XMLUtils.Xml2Map(resxml); + List> list = (List) MapUtils.getValue(resMap, "response.returnData.timeRegInfo", + List.class); + if (list != null) { + List> temp = new ArrayList<>(); + for (int i = 0; i < list.size(); i++) { + Map map = list.get(i); + if (map.get("regLeaveCount") != null && !"0".equals(map.get("regLeaveCount"))) { + temp.add(map); + } + } + list = temp; + + Collections.sort(list, (c1, c2) -> { + String s1 = c1.get("beginTime") + ""; + String s2 = c2.get("beginTime") + ""; + return (s1).compareTo(s2); + }); + } + + return list; + } + + /** + * 5.2.1 生成预约挂号订单接口001 + */ + @Override + public HisResult lockPreRegOrder(YcOrderRegist regist) { + Date tomorrow = DateUtils.getNowDate(); + tomorrow.setDate(tomorrow.getDate() + 7); + StringBuffer sbfin = new StringBuffer(); + sbfin.append(""); + sbfin.append(""); + sbfin.append("addPreRegOrder001"); + sbfin.append(""); + sbfin.append(""); + sbfin.append(WechatHospConfig.hospcode); + sbfin.append(""); + sbfin.append(""); + sbfin.append("wmp01" + regist.getOrderno()); + sbfin.append(""); + sbfin.append(""); + sbfin.append(regist.getDeptno()); + sbfin.append(""); + sbfin.append(""); + sbfin.append(regist.getRegdate()); + sbfin.append(""); + sbfin.append(""); + sbfin.append(regist.getScheduleFlag()); + sbfin.append(""); + sbfin.append(""); + sbfin.append(regist.getBegintime()); + sbfin.append(""); + sbfin.append(""); + sbfin.append(regist.getEndtime()); + sbfin.append(""); + sbfin.append(""); + sbfin.append(regist.getPatientid()); //患者主索引id + sbfin.append(""); + sbfin.append(""); + sbfin.append(regist.getDoctorno()); + sbfin.append(""); + sbfin.append(""); + sbfin.append(regist.getPatient().getPatientName());// TODO 患者姓名 + sbfin.append(""); + sbfin.append(""); + sbfin.append("WECHAT"); + sbfin.append(""); + sbfin.append(""); + sbfin.append(DateUtils.getTime()); + sbfin.append(""); + sbfin.append(""); + sbfin.append(regist.getFee()); + sbfin.append(""); + sbfin.append(""); + sbfin.append(regist.getTreatfee()); + sbfin.append(""); + sbfin.append(""); + sbfin.append(regist.getTreatfee());//Y挂号类型 + sbfin.append(""); + sbfin.append(""); + sbfin.append(regist.getHisLockid()); + sbfin.append(""); + sbfin.append(""); + sbfin.append(""); + + String resxml; + if (isMN) { + resxml = "0 success" + + IdUtil.getSnowflake().nextIdStr() + + "OLD"; + } else { + resxml = HisWebClient.getHisPost("", sbfin.toString()); + } + Map resMap = XMLUtils.Xml2Map(resxml); + Map map = (Map) MapUtils.getValue(resMap, "response"); + HisResult hisResult = HisResult.instance(map, "returnData", true, "0"); + return hisResult; + } + + /** + * 5.2.2 取消预约挂号订单接口001 + */ + @Override + public HisResult cancelPreRegOrder(YcOrderRegist regist) { + StringBuffer sbfin = new StringBuffer(); + sbfin.append(""); + sbfin.append(""); + sbfin.append("cancelPreRegOrder001"); + sbfin.append(""); + sbfin.append(""); + sbfin.append(WechatHospConfig.hospcode); + sbfin.append(""); + sbfin.append(""); + sbfin.append(regist.getOpenid()); + sbfin.append("");// o4nrBwgRgFIKyhdyBbTGFOurHa2U + sbfin.append(""); + sbfin.append("wmp01" + regist.getOrderno()); + sbfin.append(""); + sbfin.append(""); + sbfin.append(regist.getYcOrder().getHisOrderId());// his预约订单 + sbfin.append(""); + sbfin.append(""); // ipPatNo + sbfin.append(""); + sbfin.append(""); + sbfin.append(DateUtils.dateTimeNow()); + sbfin.append(""); + sbfin.append(""); + sbfin.append(regist.getRemark()); + sbfin.append(""); + sbfin.append(""); + sbfin.append(""); + String resxml; + if (isMN) { + resxml = "0success"; + } else { + resxml = HisWebClient.getHisPost("", sbfin.toString()); + } + Map resMap = XMLUtils.Xml2Map(resxml); + Map map = (Map) MapUtils.getValue(resMap, "response"); + HisResult result = HisResult.instance(map, "", true, "1"); + return result; + + } + + /** + * 5.2.3 预约挂号订单支付接口001 + */ + @Override + public HisResult payPreRegOrder(JSONObject hParams) { + String resxml; + if (isMN) { + resxml = "{ \"msg\": \"操作成功\", \"code\": 1, \"data\": { \"regid\": 374528 } }"; + } else { + resxml = HisWebClient.getHisPost("hisregister", hParams.toJSONString(), ""); + MkHisParams hisParams = new MkHisParams(); + hisParams.setMkMethod("hisregister"); + hisParams.setMkRequestData(hParams.toJSONString()); + hisParams.setMkResponseData(resxml); + hisParamsService.insertMkHisParams(hisParams); + } + JSONObject resData = JSONObject.parseObject(resxml); + HisResult res = HisResult.instance(resData, "data", true); + return res; + } + + /** + * 5.2.4 预约挂号订单退费接口001 + */ + @Override + public HisResult refundPreReg(JSONObject hParams) { + + String resxml; + if (isMN) { + resxml = "{ \"msg\": \"操作成功\", \"code\": 1, \"data\": null }"; + } else { + resxml = HisWebClient.getHisPost("RetreatReg", hParams.toJSONString(), ""); + MkHisParams hisParams = new MkHisParams(); + hisParams.setMkMethod("RetreatReg"); + hisParams.setMkRequestData(hParams.toJSONString()); + hisParams.setMkResponseData(resxml); + hisParamsService.insertMkHisParams(hisParams); + } + JSONObject resData = JSONObject.parseObject(resxml); + HisResult res = HisResult.instance(resData, "", true); + return res; + } + + /** + * 5.3.1 当天挂号号源锁定接口001 + */ + @Override + public HisResult lockRegSeqToday(YcOrderRegist regist) { + StringBuffer sbfin = new StringBuffer(); + sbfin.append(""); + sbfin.append(""); + sbfin.append("lockRegSeqToday001"); + sbfin.append(""); + sbfin.append(""); + sbfin.append(WechatHospConfig.hospcode); + sbfin.append(""); + sbfin.append(""); + sbfin.append(Convert.toStr(regist.getOpenid(), "")); + sbfin.append("");// o4nrBwgRgFIKyhdyBbTGFOurHa2U + sbfin.append(""); + sbfin.append("wmp01" + regist.getOrderno()); + sbfin.append(""); + sbfin.append(""); + sbfin.append(regist.getPatientid());// TODO + sbfin.append(""); + sbfin.append(""); + sbfin.append(regist.getDeptno()); + sbfin.append(""); + sbfin.append(""); + sbfin.append(regist.getDoctorno()); + sbfin.append(""); + sbfin.append(""); + sbfin.append(regist.getPatient().getPatientName()); + sbfin.append(""); + sbfin.append(""); + sbfin.append(regist.getDeptno()); + sbfin.append(""); + sbfin.append(""); + sbfin.append(regist.getDoctorno()); + sbfin.append(""); + sbfin.append(""); + sbfin.append(regist.getRegdate()); + sbfin.append(""); + sbfin.append(""); + sbfin.append(regist.getScheduleFlag()); + sbfin.append(""); + sbfin.append(""); + sbfin.append(regist.getBegintime()); + sbfin.append(""); + sbfin.append(""); + sbfin.append(regist.getEndtime()); + sbfin.append(""); + sbfin.append(""); + //sbfin.append(regist.getSerialpay().getPaytype());// 支付方式 + sbfin.append("WECHAT"); + sbfin.append(""); + sbfin.append(""); + sbfin.append(regist.getFee());// 挂号费 分 + sbfin.append(""); + sbfin.append(""); + sbfin.append(regist.getTreatfee());// 诊疗费 分 + sbfin.append(""); + sbfin.append(""); + sbfin.append(regist.getHisLockid()); + sbfin.append(""); + sbfin.append(""); + sbfin.append(""); + String resxml; + if (isMN) { + //resxml = "0success"; + resxml = "0 success" + + IdUtil.getSnowflake().nextIdStr() + + "OLD"; + } else { + resxml = HisWebClient.getHisPost("", sbfin.toString()); + } + Map resMap = XMLUtils.Xml2Map(resxml); + Map map = (Map) MapUtils.getValue(resMap, "response"); + HisResult result = HisResult.instance(map, "returnData", true, "0"); + return result; + } + + /** + * 5.3.2 当天挂号解除锁定接口001 + */ + @Override + public HisResult unlockRegSeqToday(YcOrderRegist regist) { + Date tomorrow = DateUtils.getNowDate(); + tomorrow.setDate(tomorrow.getDate() + 7); + StringBuffer sbfin = new StringBuffer(); + sbfin.append(""); + sbfin.append(""); + sbfin.append("unlockRegSeqToday001"); + sbfin.append(""); + sbfin.append(""); + sbfin.append(WechatHospConfig.hospcode); + sbfin.append(""); + sbfin.append(""); + sbfin.append(regist.getYcOrder().getOpenid()); + sbfin.append(""); + sbfin.append(""); + sbfin.append(regist.getPatientid()); + sbfin.append(""); + sbfin.append(""); + sbfin.append(regist.getYcOrder().getHisOrderId()); + sbfin.append(""); + sbfin.append(""); + sbfin.append(regist.getOrderno()); + sbfin.append(""); + sbfin.append(""); + sbfin.append(""); + String resxml; + if (isMN) { + resxml = "0success"; + } else { + resxml = HisWebClient.getHisPost("", sbfin.toString()); + } + Map resMap = XMLUtils.Xml2Map(resxml); + Map map = (Map) MapUtils.getValue(resMap, "response"); + HisResult result = HisResult.instance(map, "", true, "0"); + return result; + } + + /** + * 5.3.3 当天挂号接口001 + */ + @Override + public HisResult addRegOrder(YcOrderRegist regist) { + //YcPatient patient = regist.getPatient(); + YcOrderSerialpay serialpay = regist.getSerialpay(); + StringBuffer sbfin = new StringBuffer(); + sbfin.append(""); + sbfin.append(""); + sbfin.append("addRegOrder001"); + sbfin.append(""); + sbfin.append(""); + sbfin.append(WechatHospConfig.hospcode); + sbfin.append(""); + sbfin.append(""); + sbfin.append(regist.getPatientid()); + sbfin.append(""); + sbfin.append(""); + sbfin.append(regist.getYcOrder().getHisOrderId()); + sbfin.append(""); + sbfin.append(""); + sbfin.append("wmp01" + regist.getOrderno()); + sbfin.append(""); + sbfin.append(""); + sbfin.append("WECHAT"); + sbfin.append(""); + sbfin.append(""); + sbfin.append(DateUtils.dateTime()); + sbfin.append(""); + sbfin.append(""); + sbfin.append(regist.getFee()); + sbfin.append(""); + sbfin.append(""); + sbfin.append(regist.getTreatfee()); + sbfin.append(""); + sbfin.append(""); + sbfin.append(serialpay.getTransactionid()); + sbfin.append(""); + sbfin.append(""); + sbfin.append(serialpay.getPaymoney()); + sbfin.append(""); + sbfin.append(""); + sbfin.append(serialpay.getPaytype()); + sbfin.append(""); + sbfin.append(""); + sbfin.append(DateUtils.dateTimeHMS(serialpay.getPaytime())); + sbfin.append(""); + sbfin.append(""); + sbfin.append(""); + String resxml; + if (isMN) { + resxml = "0 success AFAFFAF41234312312201303020035张三 门诊号:0000009184| 牙周科(门诊楼四楼三诊室)第9号 AFAFFAF41234312312"; + } else { + resxml = HisWebClient.getHisPost("", sbfin.toString()); + } + Map resMap = XMLUtils.Xml2Map(resxml); + Map map = (Map) MapUtils.getValue(resMap, "response"); + HisResult result = HisResult.instance(map, "returnData", true, "0"); + return result; + } + + /** + * 5.1.7 挂号订单查询接口 001 + */ + @Override + public List> getRegOrderInfo(Map params) { + String resxml; + if (isMN) { + resxml = "{ \"msg\": \"操作成功\", \"code\": 1, \"data\": [ { \"amount\": 15.00, \"stus\": \"挂号\", \"clinc_room\": \"\", \"isarchives\": \"OO\", \"depart_name\": \"治未病科\", \"acctype\": \"网上收费\", \"regdate\": \"2024-06-06 16:15:49\", \"isarchive\": \"未叫号\", \"regid\": 374529, \"state\": \"REG\", \"sn\": 941853, \"doctor_name\": \"王利敏\", \"patienttype\": \"自费\" }, { \"amount\": 15.00, \"stus\": \"挂号\", \"clinc_room\": \"\", \"isarchives\": \"OO\", \"depart_name\": \"治未病科\", \"acctype\": \"网上收费\", \"regdate\": \"2024-06-06 08:47:42\", \"isarchive\": \"未叫号\", \"regid\": 374528, \"state\": \"REG\", \"sn\": 941852, \"doctor_name\": \"王利敏\", \"patienttype\": \"自费\" }, { \"amount\": 15.00, \"stus\": \"退号\", \"clinc_room\": \"\", \"isarchives\": \"OO\", \"depart_name\": \"治未病科\", \"acctype\": \"网上收费\", \"regdate\": \"2024-06-03 18:18:10\", \"isarchive\": \"未叫号\", \"regid\": 374526, \"state\": \"BACK\", \"sn\": 941851, \"doctor_name\": \"王利敏\", \"patienttype\": \"自费\" } ] }"; + } else { + JSONObject hParams = new JSONObject(); + hParams.put("memberId", params.get("memberid")); + if (params.containsKey("regDateBegin")) { + hParams.put("regDateBegin", params.get("regDateBegin")); + } + if (params.containsKey("regDateEnd")) { + hParams.put("regDateEnd", params.get("regDateEnd")); + } + if (params.containsKey("regid")) { + hParams.put("regid", params.get("regid")); + } + resxml = HisWebClient.getHisPost("getRegisterInfo", hParams.toJSONString()); + MkHisParams hisParams = new MkHisParams(); + hisParams.setMkMethod("getRegisterInfo"); + hisParams.setMkRequestData(hParams.toJSONString()); + hisParams.setMkResponseData(resxml); + hisParamsService.insertMkHisParams(hisParams); + } + JSONObject resData = JSONObject.parseObject(resxml); + HisResult res = HisResult.instance(resData, "data", false); + return res.getListData(); + } + + /** + * 6.1.1 待缴费就诊记录查询接口001 + */ + @Override + public HisResult getWaitClinicList(Map params) { + String resxml; + if (isMN) { + resxml = ""; + } else { + JSONObject hParams = new JSONObject(); + hParams.put("memberId", params.get("memberid")); + if (params.containsKey("begdate")) { + hParams.put("begdate", params.get("begdate")); + } + if (params.containsKey("enddate")) { + hParams.put("enddate", params.get("enddate")); + } + resxml = HisWebClient.getHisPost("getPaymentinfo", hParams.toJSONString()); + MkHisParams hisParams = new MkHisParams(); + hisParams.setMkMethod("getPaymentinfo"); + hisParams.setMkRequestData(hParams.toJSONString()); + hisParams.setMkResponseData(resxml); + hisParamsService.insertMkHisParams(hisParams); + } + JSONObject resData = JSONObject.parseObject(resxml); + HisResult res = HisResult.instance(resData, "data", false); + return res; + } + + /** + * 6.1.2 待缴费明细记录查询接口001 + */ + @Override + public HisResult getWaitClinicDetail(Map params) { + String resxml; + if (isMN) { + resxml = ""; + } else { + JSONObject hParams = new JSONObject(); + hParams.put("costId", params.get("costId")); + resxml = HisWebClient.getHisPost("getPaymentinfoDetail", hParams.toJSONString()); + MkHisParams hisParams = new MkHisParams(); + hisParams.setMkMethod("getPaymentinfoDetail"); + hisParams.setMkRequestData(hParams.toJSONString()); + hisParams.setMkResponseData(resxml); + hisParamsService.insertMkHisParams(hisParams); + } + JSONObject resData = JSONObject.parseObject(resxml); + HisResult res = HisResult.instance(resData, "data", true); + return res; + } + + /** + * 6.1.2 待缴费明细记录查询接口001 + */ + @Override + public HisResult getWaitClinicInsurance(Map params) { + String resxml; + if (isMN) { + resxml = ""; + } else { + JSONObject hParams = new JSONObject(); + hParams.put("memberId", params.get("memberid")); + if (params.containsKey("begdate")) { + hParams.put("begdate", params.get("begdate")); + } + if (params.containsKey("enddate")) { + hParams.put("enddate", params.get("enddate")); + } + resxml = HisWebClient.getHisPost("getPaymentinfo_yb", hParams.toJSONString()); + MkHisParams hisParams = new MkHisParams(); + hisParams.setMkMethod("getPaymentinfoDetail"); + hisParams.setMkRequestData(hParams.toJSONString()); + hisParams.setMkResponseData(resxml); + hisParamsService.insertMkHisParams(hisParams); + } + JSONObject resData = JSONObject.parseObject(resxml); + HisResult res = HisResult.instance(resData, "data", false); + return res; + } + + + /** + * 6.1.2 待缴费明细记录查询接口001 + */ + @Override + public HisResult lockClinicOrder(Map params) { + StringBuffer sbfin = new StringBuffer(); + sbfin.append(""); + sbfin.append(""); + sbfin.append("getNoPayDetailInfo001"); + sbfin.append(""); + sbfin.append(""); + sbfin.append(WechatHospConfig.hospcode); + sbfin.append(""); + sbfin.append("" + params.get("opPatId") + ""); + sbfin.append(""); + sbfin.append(DateUtil.formatDate(DateUtil.offsetDay(new Date(), -2))); + sbfin.append(""); + sbfin.append(""); + sbfin.append(DateUtil.formatDate(new Date())); + sbfin.append(""); + sbfin.append("1"); + sbfin.append(""); + sbfin.append(""); + String resxml = null; + if (isMN) { + + } else { + resxml = HisWebClient.getHisPost("", sbfin.toString()); + } + Map resMap = XMLUtils.Xml2Map(resxml); + @SuppressWarnings("unchecked") + Map map = (Map) MapUtils.getValue(resMap, "response"); + HisResult result = HisResult.instance(map, "returnData.reportInfo", false, "1.0"); + return result; + } + + /** + * 6.1.3 待缴费记录支付接口001 + */ + @Override + public HisResult payClinicOrder(Map params) { + StringBuffer sbfin = new StringBuffer(); + sbfin.append(""); + sbfin.append(""); + sbfin.append("payChgOrder001"); + sbfin.append(""); + sbfin.append(""); + sbfin.append(WechatHospConfig.hospcode); + sbfin.append(""); + sbfin.append(""); + sbfin.append(params.get("openid")); + sbfin.append(""); + sbfin.append(""); + sbfin.append(params.get("deptId")); + sbfin.append(""); + sbfin.append(""); + sbfin.append(params.get("doctorId")); + sbfin.append(""); + sbfin.append(""); + sbfin.append("wmp01" + params.get("orderno")); + sbfin.append(""); + sbfin.append(""); + sbfin.append(params.get("patId")); + sbfin.append(""); + sbfin.append(""); + sbfin.append("WECHAT"); + sbfin.append(""); + sbfin.append(""); + sbfin.append(DateUtils.dateTime()); + sbfin.append(""); + sbfin.append(""); + sbfin.append(params.get("visitId")); + sbfin.append(""); + sbfin.append(""); + sbfin.append(params.get("orderPayId")); + sbfin.append(""); + sbfin.append(""); + sbfin.append(params.get("payAmount")); + sbfin.append(""); + sbfin.append(""); + sbfin.append(params.get("payMode")); + sbfin.append(""); + sbfin.append(""); + sbfin.append(params.get("payTime")); + sbfin.append(""); + sbfin.append(""); + sbfin.append(WechatHospConfig.appId); // 公众号appid + sbfin.append(""); + sbfin.append(""); + sbfin.append(params.get("serialno")); // 支付终端设备号 + sbfin.append(""); + sbfin.append(""); + sbfin.append(params.get("paynocestr")); // 支付随机字符串 + sbfin.append(""); + sbfin.append(""); + sbfin.append("sign"); + sbfin.append(""); + sbfin.append(""); + sbfin.append("SUCCESS"); + sbfin.append(""); + sbfin.append(""); + sbfin.append(""); + String resxml = null; + if (isMN) { + resxml = "0 success7777777777缴费成功医院流水号:7777777777|支付金额:100元|请先到二楼西药房取药|然后到三楼注射室进行注射。2013-12-12/01/22235"; + } else { + resxml = HisWebClient.getHisPost("", sbfin.toString()); + } + Map resMap = XMLUtils.Xml2Map(resxml); + @SuppressWarnings("unchecked") + Map map = (Map) MapUtils.getValue(resMap, "response"); + HisResult result = HisResult.instance(map, "returnData", true, "0"); + return result; + } + + /** + * 6.1.4 已缴费记录查询接口001 + */ + @Override + public HisResult getPayClinicInfo(Map params) { + StringBuffer sbfin = new StringBuffer(); + sbfin.append(""); + sbfin.append(""); + sbfin.append("getPayReceiptInfo001"); + sbfin.append(""); + sbfin.append(""); + sbfin.append(WechatHospConfig.hospcode); + sbfin.append(""); + sbfin.append("" + params.get("patId") + ""); + sbfin.append(""); + sbfin.append(DateUtil.formatDate(DateUtil.offsetDay(new Date(), -30))); + sbfin.append(""); + sbfin.append(""); + sbfin.append(DateUtil.formatDate(DateUtil.offsetDay(new Date(), 1))); + sbfin.append(""); + sbfin.append(""); + sbfin.append(""); + String resxml = null; + if (isMN) { + //resxml = "0SUCCESS闫会斌武安医保记账A8D16649DF7B4DBD9AF2A91F6F64DA9E2020-09-23门诊科韩彬171806202300063武安医保记账EF05DC011FF343639CC068DB6925DB4C2020-09-23门诊科韩彬52806202300063"; + resxml = "0 success张三2013-12-12/010101内科0168刘为民12650WECHATPAYED2013-12-12/01/2223411112222222013-12-12/020301妇科0369高平23750WECHATPAYED2013-12-12/01/22235"; + } else { + resxml = HisWebClient.getHisPost("", sbfin.toString()); + } + Map resMap = XMLUtils.Xml2Map(resxml); + @SuppressWarnings("unchecked") + Map map = (Map) MapUtils.getValue(resMap, "response"); + HisResult result = HisResult.instance(map, "returnData", true, "0"); + return result; + } + + /** + * 6.1.5 已缴费记录明细查询接口001 + */ + @Override + public HisResult getPayClinicDetail(Map params) { + StringBuffer sbfin = new StringBuffer(); + sbfin.append(""); + sbfin.append(""); + sbfin.append("getPayDetailInfo001"); + sbfin.append(""); + sbfin.append(""); + sbfin.append(WechatHospConfig.hospcode); + sbfin.append(""); + sbfin.append("" + params.get("patId") + ""); + sbfin.append("" + params.get("visitId") + ""); + sbfin.append(""); + sbfin.append(DateUtil.formatDate(DateUtil.offsetDay(new Date(), -30))); + sbfin.append(""); + sbfin.append(""); + sbfin.append(DateUtil.formatDate(DateUtil.offsetDay(new Date(), 1))); + sbfin.append(""); + sbfin.append(""); + sbfin.append(""); + String resxml = null; + if (isMN) { + //resxml = "0SUCCESS20276215937621593203中草药268004诊查37140005床位136400012其它12060008护理330009治疗33209015卫生材料32921006放射2790001西药5601311化验27480017冷暖11950007检查4620100"; + resxml = "0success药费123葡萄糖250002500/瓶2500注射费456葡萄糖注射250002500/次2500"; + } else { + resxml = HisWebClient.getHisPost("", sbfin.toString()); + } + Map resMap = XMLUtils.Xml2Map(resxml); + @SuppressWarnings("unchecked") + Map map = (Map) MapUtils.getValue(resMap, "response"); + HisResult result = HisResult.instance(map, "returnData.orderDetailInfo", false, "0"); + return result; + } + + /** + * 7.1.2 门诊病人就诊记录查询接口001 + */ + @Override + public HisResult getMedicalRecord(Map params) { + StringBuffer sbfin = new StringBuffer(); + sbfin.append(""); + sbfin.append(""); + sbfin.append("getMedicalRecord001"); + sbfin.append(""); + sbfin.append(""); + sbfin.append(WechatHospConfig.hospcode); + sbfin.append(""); +// sbfin.append(""); +// sbfin.append("oYXd5s8uZsTfzR6f1PFN28outKYo"); +//// sbfin.append(params.get("openid")); +// sbfin.append("");// o4nrBwgRgFIKyhdyBbTGFOurHa2U + sbfin.append("1807095010"); +// sbfin.append("0148239"); + sbfin.append(""); + sbfin.append(DateUtil.formatDate(DateUtil.offsetDay(new Date(), -2))); + sbfin.append(""); + sbfin.append(""); + sbfin.append(DateUtil.formatDate(new Date())); + sbfin.append(""); + sbfin.append("1"); + sbfin.append(""); + sbfin.append(""); + String resxml = null; + if (isMN) { + resxml = "0SUCCESS110200005住院诊查费619371400600"; + } else { + resxml = HisWebClient.getHisPost("", sbfin.toString()); + } + Map resMap = XMLUtils.Xml2Map(resxml); + @SuppressWarnings("unchecked") + Map map = (Map) MapUtils.getValue(resMap, "response"); + HisResult result = HisResult.instance(map, "returnData.reportInfo", false, "1.0"); + return result; + } + + /** + * 7.1.3 门诊病人病历查询接口001 + */ + @Override + public HisResult getMedicalDetail(Map params) { + StringBuffer sbfin = new StringBuffer(); + sbfin.append(""); + sbfin.append(""); + sbfin.append("getMedicalDetail001"); + sbfin.append(""); + sbfin.append(""); + sbfin.append(WechatHospConfig.hospcode); + sbfin.append(""); +// sbfin.append(""); +// sbfin.append("oYXd5s8uZsTfzR6f1PFN28outKYo"); +//// sbfin.append(params.get("openid")); +// sbfin.append("");// o4nrBwgRgFIKyhdyBbTGFOurHa2U + sbfin.append("1807095010"); +// sbfin.append("0148239"); + sbfin.append(""); + sbfin.append(DateUtil.formatDate(DateUtil.offsetDay(new Date(), -2))); + sbfin.append(""); + sbfin.append(""); + sbfin.append(DateUtil.formatDate(new Date())); + sbfin.append(""); + sbfin.append("1"); + sbfin.append(""); + sbfin.append(""); + String resxml = null; + if (isMN) { + resxml = "0SUCCESS673911271639691测试测试163969122163968913940673891332019-12-2404诊查60005床位220015卫生材料994009治疗1200"; + } else { + resxml = HisWebClient.getHisPost("", sbfin.toString()); + } + Map resMap = XMLUtils.Xml2Map(resxml); + @SuppressWarnings("unchecked") + Map map = (Map) MapUtils.getValue(resMap, "response"); + HisResult result = HisResult.instance(map, "returnData.reportInfo", false, "1.0"); + return result; + } + + /** + * 8.1.1 住院病人基本情况查询接口001 + */ + @Override + public HisResult getInPatientInfo(Map params) { + StringBuffer sbfin = new StringBuffer(); + sbfin.append(""); + sbfin.append(""); + sbfin.append("getIpPatientInfo001"); + sbfin.append(""); + sbfin.append(""); + sbfin.append(WechatHospConfig.hospcode); + sbfin.append(""); + sbfin.append(""); + sbfin.append(params.get("patId")); + sbfin.append(""); + sbfin.append(""); + sbfin.append(params.get("patName")); + sbfin.append(""); + sbfin.append(""); + sbfin.append(""); + String resxml = null; + if (isMN) { + resxml = "0SUCCESSnull98023测试测试2000-10-10广东123456778测试朋友123456778测试病区012019-11-127621593207621591在院00751101011"; + } else { + resxml = HisWebClient.getHisPost("", sbfin.toString()); + } + System.out.println(resxml); + Map resMap = XMLUtils.Xml2Map(resxml); + @SuppressWarnings("unchecked") + Map map = (Map) MapUtils.getValue(resMap, "response"); + HisResult result = HisResult.instance(map, "returnData", true, "0"); + return result; + } + + /** + * 8.1.2 住院当前费用情况查询接口001 + */ + @Override + public HisResult getIpChgInfo001(Map params) { + StringBuffer sbfin = new StringBuffer(); + sbfin.append(""); + sbfin.append(""); + sbfin.append("getIpChgInfo001"); + sbfin.append(""); + sbfin.append(""); + sbfin.append(WechatHospConfig.hospcode); + sbfin.append(""); +// sbfin.append(""); +// sbfin.append("oYXd5s8uZsTfzR6f1PFN28outKYo"); +//// sbfin.append(params.get("openid")); +// sbfin.append("");// o4nrBwgRgFIKyhdyBbTGFOurHa2U + sbfin.append("1807095010"); +// sbfin.append("0148239"); + sbfin.append("2018-06-25"); + sbfin.append("2021-12-24"); + sbfin.append("1"); + sbfin.append(""); + sbfin.append(""); + String resxml = null; + if (isMN) { + + } else { + resxml = HisWebClient.getHisPost("", sbfin.toString()); + } + Map resMap = XMLUtils.Xml2Map(resxml); + @SuppressWarnings("unchecked") + Map map = (Map) MapUtils.getValue(resMap, "response"); + HisResult result = HisResult.instance(map, "returnData", true, "1.0"); + return result; + } + + /** + * 8.1.3 住院当前费用情况查询接口002 + */ + @Override + public HisResult getIpChgInfo002(Map params) { + StringBuffer sbfin = new StringBuffer(); + sbfin.append(""); + sbfin.append(""); + sbfin.append("getIpChgInfo002"); + sbfin.append(""); + sbfin.append(""); + sbfin.append(WechatHospConfig.hospcode); + sbfin.append(""); + sbfin.append(""); + sbfin.append("oYXd5swGH4L43o2WhlcxbUKgHIxI"); +// sbfin.append(params.get("openid")); + sbfin.append("");// o4nrBwgRgFIKyhdyBbTGFOurHa2U + sbfin.append("<00612999"); +// sbfin.append("0148239"); + sbfin.append("699167"); + sbfin.append(""); + sbfin.append("2021-01-22"); + sbfin.append(""); + sbfin.append(""); + String resxml = null; + if (isMN) { + resxml = "0SUCCESS20276215937621593203中草药268004诊查37140005床位136400012其它12060008护理330009治疗33209015卫生材料32921006放射2790001西药5601311化验27480017冷暖11950007检查4620100"; + } else { + resxml = HisWebClient.getHisPost("", sbfin.toString()); + } + Map resMap = XMLUtils.Xml2Map(resxml); + @SuppressWarnings("unchecked") + Map map = (Map) MapUtils.getValue(resMap, "response"); + HisResult result = HisResult.instance(map, "returnData", false, "1.0"); + return result; + } + + /** + * 8.1.4 住院费用分类项目汇总查询接口001 + */ + @Override + public HisResult getIpExpenseItemTotal(Map params) { + StringBuffer sbfin = new StringBuffer(); + sbfin.append(""); + sbfin.append(""); + sbfin.append("getIpExpenseItemTotal001"); + sbfin.append(""); + sbfin.append(""); + sbfin.append(WechatHospConfig.hospcode); + sbfin.append(""); + sbfin.append(""); + sbfin.append("oYXd5s-ZZYzSoZP5gckKms9-JQtw"); +// sbfin.append(params.get("openid")); + sbfin.append("");// o4nrBwgRgFIKyhdyBbTGFOurHa2U +// sbfin.append("1807095010"); +// sbfin.append("0148239"); + sbfin.append("700506"); + sbfin.append("朱书善"); + sbfin.append("2"); + sbfin.append(""); + sbfin.append(""); + String resxml = null; + if (isMN) { + + } else { + resxml = HisWebClient.getHisPost("", sbfin.toString()); + } + Map resMap = XMLUtils.Xml2Map(resxml); + @SuppressWarnings("unchecked") + Map map = (Map) MapUtils.getValue(resMap, "response"); + HisResult result = HisResult.instance(map, "returnData.reportInfo", true, "1.0"); + return result; + } + + /** + * 8.1.5 住院押金明细查询接口001 + */ + @Override + public HisResult getIpDepositDetail001(Map params) { + StringBuffer sbfin = new StringBuffer(); + sbfin.append(""); + sbfin.append(""); + sbfin.append("getIpDepositDetail001"); + sbfin.append(""); + sbfin.append(""); + sbfin.append(WechatHospConfig.hospcode); + sbfin.append(""); + sbfin.append(""); + sbfin.append(params.get("visitId")); + sbfin.append(""); + sbfin.append(""); + sbfin.append(params.get("patName")); + sbfin.append(""); + sbfin.append(""); + sbfin.append(""); + String resxml = null; + if (isMN) { + resxml = "\t0\t获取病人信息成功\t742669马彬789发热病区2791发热二病区FE17071王维2021-12-27 11:29:0037442180021937812022-03-16 16:17:50100支付宝021884062022-02-23 10:27:151700支付宝0"; + } else { + resxml = HisWebClient.getHisPost("", sbfin.toString()); + } + System.out.println(resxml); + Map resMap = XMLUtils.Xml2Map(resxml); + @SuppressWarnings("unchecked") + Map map = (Map) MapUtils.getValue(resMap, "response"); + HisResult result = HisResult.instance(map, "returnData.depositInfo", false, "0"); + return result; + } + + /** + * 8.1.6 住院押金支付接口 + */ + @Override + public HisResult getIpDepositDetail002(Map params) { + StringBuffer sbfin = new StringBuffer(); + sbfin.append(""); + sbfin.append(""); + sbfin.append("getIpDepositDetail002"); + sbfin.append(""); + sbfin.append(""); + sbfin.append(WechatHospConfig.hospcode); + sbfin.append(""); +// sbfin.append(""); +// sbfin.append("oYXd5s8uZsTfzR6f1PFN28outKYo"); +//// sbfin.append(params.get("openid")); +// sbfin.append("");// o4nrBwgRgFIKyhdyBbTGFOurHa2U + sbfin.append("1807095010"); +// sbfin.append("0148239"); + sbfin.append("2018-06-25"); + sbfin.append("2021-12-24"); + sbfin.append("1"); + sbfin.append(""); + sbfin.append(""); + String resxml = null; + if (isMN) { + resxml = "0 success7777777777缴费成功本次缴纳押金金额:3000元,请及时缴纳住院押金以免影响治疗。2013121222235"; + } else { + resxml = HisWebClient.getHisPost("", sbfin.toString()); + } + Map resMap = XMLUtils.Xml2Map(resxml); + @SuppressWarnings("unchecked") + Map map = (Map) MapUtils.getValue(resMap, "response"); + HisResult result = HisResult.instance(map, "returnData.reportInfo", true, "1.0"); + return result; + } + + /** + * 8.1.7 住院押金支付接口001 + */ + @Override + public HisResult payIpDeposit(Map params) { + StringBuffer sbfin = new StringBuffer(); + sbfin.append(""); + sbfin.append(""); + sbfin.append("payIpDeposit001"); + sbfin.append(""); + sbfin.append(""); + sbfin.append(WechatHospConfig.hospcode); + sbfin.append(""); + sbfin.append(""); + sbfin.append("wmp01" + params.get("orderId")); + sbfin.append(""); + sbfin.append(""); + sbfin.append(params.get("orderPayId")); + sbfin.append(""); + sbfin.append(""); + sbfin.append(params.get("visitId")); + sbfin.append(""); + sbfin.append(""); + sbfin.append(params.get("patName")); + sbfin.append(""); + sbfin.append(""); + sbfin.append(params.get("payAmount")); + sbfin.append(""); + sbfin.append(""); + sbfin.append(""); + String resxml = null; + if (isMN) { + + } else { + resxml = HisWebClient.getHisPost("", sbfin.toString()); + } + System.out.println(resxml); + Map resMap = XMLUtils.Xml2Map(resxml); + @SuppressWarnings("unchecked") + Map map = (Map) MapUtils.getValue(resMap, "response"); + HisResult result = HisResult.instance(map, "returnData", false, "0"); + return result; + } + + /** + * 8.1.8 住院一日清单查询接口001 7.2.3 + */ + @Override + public HisResult getIpDayExpenseList(Map params) { + StringBuffer sbfin = new StringBuffer(); + sbfin.append(""); + sbfin.append(""); + sbfin.append("getIpDayExpenseList001"); + sbfin.append(""); + sbfin.append(""); + sbfin.append(WechatHospConfig.hospcode); + sbfin.append(""); +// sbfin.append(""); +// sbfin.append("oYXd5s8uZsTfzR6f1PFN28outKYo"); +//// sbfin.append(params.get("openid")); +// sbfin.append("");// o4nrBwgRgFIKyhdyBbTGFOurHa2U + sbfin.append("1807095010"); +// sbfin.append("0148239"); + sbfin.append("2018-06-25"); + sbfin.append("2021-12-24"); + sbfin.append("1"); + sbfin.append(""); + sbfin.append(""); + String resxml = null; + if (isMN) { + resxml = "0SUCCESS673911271639691测试测试163969122163968913940673891332019-12-2404诊查60005床位220015卫生材料994009治疗1200"; + } else { + resxml = HisWebClient.getHisPost("", sbfin.toString()); + } + Map resMap = XMLUtils.Xml2Map(resxml); + @SuppressWarnings("unchecked") + Map map = (Map) MapUtils.getValue(resMap, "response"); + HisResult result = HisResult.instance(map, "returnData", true, "1.0"); + if (result.isSucess()) { +// List> list = (List>) MapUtils.getValue(map, "returnData.expenseCategory", List.class); +// result.setListData(list); + return result; + } else { + return result; + } + } + + /** + * 8.1.9 住院一日清单费用分类项目汇总查询接口001 + */ + @Override + public HisResult getIpDayExpenseItemTotal(Map params) { + StringBuffer sbfin = new StringBuffer(); + sbfin.append(""); + sbfin.append(""); + sbfin.append("getIpDayExpenseList001"); + sbfin.append(""); + sbfin.append(""); + sbfin.append("1011"); + sbfin.append(""); + sbfin.append("98023"); + sbfin.append("05"); + sbfin.append("2018-06-25"); + sbfin.append("67389133"); + sbfin.append("67391127"); + sbfin.append(""); + sbfin.append(""); + String resxml = null; + if (isMN) { + resxml = "0SUCCESS110900001-1普通病房床位费(三人间)01122002200"; + } else { + resxml = HisWebClient.getHisPost("", sbfin.toString()); + } + Map resMap = XMLUtils.Xml2Map(resxml); + @SuppressWarnings("unchecked") + Map map = (Map) MapUtils.getValue(resMap, "response"); + HisResult result = HisResult.instance(map, "returnData.expenseDetail", false, "1.0"); + return result; + } + + /** + * 检验报告 + */ + @Override + public HisResult getLisReportList(JSONObject hParams) { + String resxml; + if (isMN) { + resxml = ""; + } else { + + resxml = HisWebClient.getHisPost("getChkAppAll", hParams.toJSONString()); + MkHisParams hisParams = new MkHisParams(); + hisParams.setMkMethod("getChkAppAll"); + hisParams.setMkRequestData(hParams.toJSONString()); + hisParams.setMkResponseData(resxml); + hisParamsService.insertMkHisParams(hisParams); + } + JSONObject resData = JSONObject.parseObject(resxml); + HisResult res = HisResult.instance(resData, "data", false); + return res; + } + + /** + * 检验报告 + */ + @Override + public HisResult getNuclReportList(String patId, String month) { + String beginDate = month + "-01"; + String endDate = DateUtil.formatDate(DateUtil.offsetMonth(DateUtil.parseDate(beginDate), 1)); + + StringBuffer sbfin = new StringBuffer(); + sbfin.append(""); + sbfin.append(""); + sbfin.append("hsbg"); + sbfin.append(""); + sbfin.append(""); + sbfin.append(WechatHospConfig.hospcode); + sbfin.append(""); + sbfin.append(""); + sbfin.append(patId); + sbfin.append(""); + sbfin.append(""); + sbfin.append(""); + sbfin.append(""); + sbfin.append(beginDate); + sbfin.append(""); + sbfin.append(""); + sbfin.append(endDate); + sbfin.append(""); + sbfin.append(""); + sbfin.append(""); + String resxml = ""; + if (isMN) { + resxml = "0获取化验信息成功20180817SHC0376201800010077352A化验住院李楠楠226肝功1+葡萄糖测定各种酶法产科2刘强血清已打印2018-08-17 19:25:382018-08-17 19:25:38"; + } else { + resxml = HisWebClient.getHisPost("", sbfin.toString()); + } + + Map resMap = XMLUtils.Xml2Map(resxml); + @SuppressWarnings("unchecked") + Map map = (Map) MapUtils.getValue(resMap, "response"); + HisResult result = HisResult.instance(map, "returnData.reportInfo", false, "0"); + return result; + } + + @Override + public HisResult getLisReportDetail(JSONObject hParams) { + String resxml; + if (isMN) { + resxml = "{ \"msg\": \"操作成功\", \"code\": 1, \"data\": [ { \"depart_id\": 101, \"sn\": \"Z\", \"limist\": 90, \"depart_name\": \"治未病科\" }, { \"depart_id\": 111, \"sn\": \"Z\", \"limist\": 40, \"depart_name\": \"肿瘤二科\" }, { \"depart_id\": 113, \"sn\": \"Z\", \"limist\": 70, \"depart_name\": \"肿瘤四科\" }, { \"depart_id\": 142, \"sn\": \"H\", \"limist\": 30, \"depart_name\": \"呼吸与危重症医学科\" }, { \"depart_id\": 145, \"sn\": \"G\", \"limist\": 30, \"depart_name\": \"功能神经外科\" }, { \"depart_id\": 155, \"sn\": \"J\", \"limist\": 30, \"depart_name\": \"颈肩腰腿痛门诊\" }, { \"depart_id\": 156, \"sn\": \"Z\", \"limist\": 30, \"depart_name\": \"肿瘤六科\" }, { \"depart_id\": 160, \"sn\": \"P\", \"limist\": 30, \"depart_name\": \"普外一科(二病区)\" }, { \"depart_id\": 161, \"sn\": \"M\", \"limist\": 30, \"depart_name\": \"名中医工作室\" }, { \"depart_id\": 162, \"sn\": \"E\", \"limist\": 30, \"depart_name\": \"儿童青少年心理科\" }, { \"depart_id\": 166, \"sn\": \"X\", \"limist\": 60, \"depart_name\": \"眩晕科\" }, { \"depart_id\": 167, \"sn\": \"X\", \"limist\": 30, \"depart_name\": \"心脏内科(心病科)\" }, { \"depart_id\": 168, \"sn\": \"N\", \"limist\": 30, \"depart_name\": \"内分泌科(全科医学科)\" } ] }"; + } else { + resxml = HisWebClient.getHisPost("getChkAppDet", hParams.toJSONString()); + MkHisParams hisParams = new MkHisParams(); + hisParams.setMkMethod("getChkAppDet"); + hisParams.setMkRequestData(hParams.toJSONString()); + hisParams.setMkResponseData(resxml); + hisParamsService.insertMkHisParams(hisParams); + } + JSONObject resData = JSONObject.parseObject(resxml); + HisResult res = HisResult.instance(resData, "data", false); + return res; + } + + @Override + public HisResult getPacsReportList(Map params) { + StringBuffer sbfin = new StringBuffer(); + sbfin.append(""); + sbfin.append(""); + sbfin.append("getPacsReportList001"); + sbfin.append(""); + sbfin.append(""); + sbfin.append(WechatHospConfig.hospcode); + sbfin.append(""); + sbfin.append("1000503"); + sbfin.append(""); + sbfin.append(""); + sbfin.append(""); + sbfin.append("2016-08-31"); + sbfin.append("2021-09-31"); + sbfin.append(""); + sbfin.append(""); + String resxml = ""; + if (isMN) { + resxml = "1.0成功200101脑梗塞46岁1006540头颅CT平扫王建辉nullnullnullCT、MRI室住院陈瑞敏1006540-1"; + } else { + resxml = HisWebClient.getHisPost("", sbfin.toString()); + } + Map resMap = XMLUtils.Xml2Map(resxml); + @SuppressWarnings("unchecked") + Map map = (Map) MapUtils.getValue(resMap, "response"); + HisResult result = HisResult.instance(map, "returnData", false, "1.0"); + return result; + } + + @Override + public HisResult getPacsReportDetail(Map params) { + StringBuffer sbfin = new StringBuffer(); + sbfin.append(""); + sbfin.append(""); + sbfin.append("getPacsReportDetail001"); + sbfin.append(""); + sbfin.append(""); + sbfin.append(WechatHospConfig.hospcode); + sbfin.append(""); + sbfin.append(""); + sbfin.append("1006540"); + sbfin.append(""); + sbfin.append(""); + sbfin.append(""); + String resxml = ""; + if (isMN) { + resxml = "1.0成功146L1703062240全血nullnullnullnull白细胞数目(WBC)2017-03-07 10:07:00null陈瑞敏200101脑梗塞3.37血细胞分析(流式细胞仪法26项指标)4.00-10.00王建辉10^9/LnullnullL246N1703062240全血nullnullnullnull中性粒细胞百分比(NEU%)2017-03-07 10:07:00null陈瑞敏200101脑梗塞61.4血细胞分析(流式细胞仪法26项指标)50.0-70.0王建辉null%nullnullN546N1703062240全血nullnullnullnull嗜酸性粒细胞百分比(EOS%)2017-03-07 10:07:00null陈瑞敏200101脑梗塞3.4血细胞分析(流式细胞仪法26项指标)0.5-5.0王建辉null%nullnullN646N1703062240全血nullnullnullnull嗜碱性粒细胞百分比(BAS%)2017-03-07 10:07:00null陈瑞敏200101脑梗塞0.4血细胞分析(流式细胞仪法26项指标)0.0-1.0王建辉null%nullnullN746N1703062240全血nullnullnullnull中性粒细胞数目(NEU#)2017-03-07 10:07:00null陈瑞敏200101脑梗塞2.07血细胞分析(流式细胞仪法26项指标)2.00-7.00王建辉null10^9/LnullnullN846N1703062240全血nullnullnullnull淋巴细胞数目(LYM#)2017-03-07 10:07:00null陈瑞敏200101脑梗塞0.96血细胞分析(流式细胞仪法26项指标)0.80-4.00王建辉null10^9/LnullnullN1146N1703062240全血nullnullnullnull嗜酸性粒细胞数目(EOS#)2017-03-07 10:07:00null陈瑞敏200101脑梗塞0.11血细胞分析(流式细胞仪法26项指标)0.00-0.70王建辉null10^9/LnullnullN1246N1703062240全血nullnullnullnull嗜碱性粒细胞数目(BAS#)2017-03-07 10:07:00null陈瑞敏200101脑梗塞0.01血细胞分析(流式细胞仪法26项指标)0.00-0.20王建辉null10^9/LnullnullN1646L1703062240全血nullnullnullnull红细胞压积(HCT)2017-03-07 10:07:00null陈瑞敏200101脑梗塞33.8血细胞分析(流式细胞仪法26项指标)37.0-54.0王建辉%nullnullL2146N1703062240全血nullnullnullnull红细胞分布宽度(RDW-SD)2017-03-07 10:07:00null陈瑞敏200101脑梗塞54.0血细胞分析(流式细胞仪法26项指标)35.0-56.0王建辉nullfLnullnullN2446N1703062240全血nullnullnullnull血小板分布宽度(PDW)2017-03-07 10:07:00null陈瑞敏200101脑梗塞16.4血细胞分析(流式细胞仪法26项指标)10-20王建辉null%nullnullN2646N1703062240全血nullnullnullnull异型淋巴细胞百分比(ALY%)2017-03-07 10:07:00null陈瑞敏200101脑梗塞0.2血细胞分析(流式细胞仪法26项指标)0.0-2.0王建辉null%nullnullN2746N1703062240全血nullnullnullnull巨大不成熟细胞百分比(LIC%)2017-03-07 10:07:00null陈瑞敏200101脑梗塞0.0血细胞分析(流式细胞仪法26项指标)0.0-2.0王建辉null%nullnullN2846N1703062240全血nullnullnullnull异型淋巴细胞数目(ALY#)2017-03-07 10:07:00null陈瑞敏200101脑梗塞0.01血细胞分析(流式细胞仪法26项指标)0.00-0.20王建辉null10^9/LnullnullN2946N1703062240全血nullnullnullnull巨大不成熟细胞数目(LIC#)2017-03-07 10:07:00null陈瑞敏200101脑梗塞0.00血细胞分析(流式细胞仪法26项指标)0.00-0.20王建辉null10^9/LnullnullN100000246N1703062240全血nullnullnullnull红细胞数目(RBC)2017-03-07 10:07:00null陈瑞敏200101脑梗塞3.52血细胞分析(流式细胞仪法26项指标)3.50-5.50王建辉null10^12/LnullnullN100000346N1703062240全血nullnullnullnull血红蛋白浓度(HGB)2017-03-07 10:07:00null陈瑞敏200101脑梗塞114血细胞分析(流式细胞仪法26项指标)110-160王建辉nullg/LnullnullN100000446N1703062240全血nullnullnullnull血小板数目(PLT)2017-03-07 10:07:00null陈瑞敏200101脑梗塞128血细胞分析(流式细胞仪法26项指标)100-300王建辉null10^9/LnullnullN100000646N1703062240全血nullnullnullnull平均红细胞体积(MCV)2017-03-07 10:07:00null陈瑞敏200101脑梗塞96.1血细胞分析(流式细胞仪法26项指标)80.0-100.0王建辉nullfLnullnullN100000746N1703062240全血nullnullnullnull平均血红蛋白含量(MCH)2017-03-07 10:07:00null陈瑞敏200101脑梗塞32.4血细胞分析(流式细胞仪法26项指标)27.0-34.0王建辉nullpgnullnullN100000846N1703062240全血nullnullnullnull平均血红蛋白浓度(MCHC)2017-03-07 10:07:00null陈瑞敏200101脑梗塞337血细胞分析(流式细胞仪法26项指标)320-360王建辉nullg/LnullnullN100000946N1703062240全血nullnullnullnull红细胞分布宽度(RDW)2017-03-07 10:07:00null陈瑞敏200101脑梗塞12.9血细胞分析(流式细胞仪法26项指标)10.6-16.0王建辉null%nullnullN100001046N1703062240全血nullnullnullnull平均血小板体积(MPV)2017-03-07 10:07:00null陈瑞敏200101脑梗塞9.3血细胞分析(流式细胞仪法26项指标)6.5-13.0王建辉nullfLnullnullN100001146N1703062240全血nullnullnullnull血小板压积(PCT)2017-03-07 10:07:00null陈瑞敏200101脑梗塞0.119血细胞分析(流式细胞仪法26项指标)0.108-0.282王建辉null%nullnullN100001346N1703062240全血nullnullnullnull淋巴细胞百分比(LYM%)2017-03-07 10:07:00null陈瑞敏200101脑梗塞28.3血细胞分析(流式细胞仪法26项指标)20.0-40.0王建辉null%nullnullN100001546N1703062240全血nullnullnullnull单核细胞百分比(MON%)2017-03-07 10:07:00null陈瑞敏200101脑梗塞6.5血细胞分析(流式细胞仪法26项指标)2.0-10.0王建辉null%nullnullN100001646N1703062240全血nullnullnullnull单核细胞数目(MON#)2017-03-07 10:07:00null陈瑞敏200101脑梗塞0.22血细胞分析(流式细胞仪法26项指标)0.12-1.20王建辉null10^9/LnullnullN"; + } else { + resxml = HisWebClient.getHisPost("", sbfin.toString()); + } + Map resMap = XMLUtils.Xml2Map(resxml); + @SuppressWarnings("unchecked") + Map map = (Map) MapUtils.getValue(resMap, "response"); + HisResult result = HisResult.instance(map, "returnData", false, "1.0"); + return result; + } + + /** + * 3.1 医院信息查询接口 + * + * @return + */ + public HisResult getHospitalInfo() { + StringBuffer sbfin = new StringBuffer(); + sbfin.append(""); + sbfin.append(""); + sbfin.append("getHospitalInfo001"); + sbfin.append(""); + sbfin.append(""); + sbfin.append(WechatHospConfig.hospcode); + sbfin.append(""); + sbfin.append(""); + sbfin.append(""); + String resxml = ""; + if (isMN) { + resxml = "0获取成功011006武安市第一人民医院河北省武安市矿建路与西环路交叉口西行500米0310-5857000www.wasyy.com2"; + } else { + resxml = HisWebClient.getHisPost("", sbfin.toString()); + } + Map resMap = XMLUtils.Xml2Map(resxml); + @SuppressWarnings("unchecked") + Map map = (Map) MapUtils.getValue(resMap, "response"); + HisResult result = HisResult.instance(map, "returnData", true, "0"); + return result; + } + + /** + * 3.2 科室信息查询接口 + * + * @return + */ + @Override + public List> getDeptInfo(String deptId) { + StringBuffer sbfin = new StringBuffer(); + sbfin.append(""); + sbfin.append(""); + sbfin.append("getDeptInfo001"); + sbfin.append(""); + sbfin.append(""); + sbfin.append(WechatHospConfig.hospcode); + sbfin.append(""); + sbfin.append(""); + sbfin.append(deptId); + sbfin.append(""); + sbfin.append(""); + sbfin.append(""); + String resxml = ""; + if (isMN) { + resxml = ""; + } else { + resxml = HisWebClient.getHisPost("", sbfin.toString()); + } + Map resMap = XMLUtils.Xml2Map(resxml); + List> list = (List>) MapUtils.getValue(resMap, + "response.returnData.deptInfo", List.class); + + Collections.sort(list, (c1, c2) -> { + String s1 = c1.get("deptClassId") + ""; + String s2 = c2.get("deptClassId") + ""; + return (s1).compareTo(s2); + }); + Map deptMap = new HashMap(); + deptMap.put("deptClassId", "-"); + deptMap.put("deptClassName", "-"); + List listDept = new ArrayList(); + List listParent = new ArrayList(); + for (Map map : list) { + if (map.get("deptClassId").equals(deptMap.get("deptClassId"))) { + listDept.add(map); + } else { + deptMap = new HashMap(); + listDept = new ArrayList(); + deptMap.put("info", listDept); + listParent.add(deptMap); + deptMap.put("deptClassId", map.get("deptClassId")); + deptMap.put("deptClassName", map.get("deptClassName")); + listDept.add(map); + } + + } + return listParent; + } + + /** + * 3.3 医生信息查询接口 + * + * @return + */ + @Override + public List> getDoctorInfo(String deptId, String doctorId) { + StringBuffer sbfin = new StringBuffer(); + sbfin.append(""); + sbfin.append(""); + sbfin.append("getDoctorInfo001"); + sbfin.append(""); + sbfin.append(""); + sbfin.append(WechatHospConfig.hospcode); + sbfin.append(""); + sbfin.append(""); + sbfin.append(deptId); + sbfin.append(""); + sbfin.append(""); + sbfin.append(doctorId); + sbfin.append(""); + sbfin.append(""); + sbfin.append(""); + String resxml = ""; + if (isMN) { + resxml = ""; + } else { + resxml = HisWebClient.getHisPost("", sbfin.toString()); + } + + Map resMap = XMLUtils.Xml2Map(resxml); + List list = (List) MapUtils.getValue(resMap, "response.returnData.doctorInfo", List.class); + return list; + } + + /** + * 获取核酸费用 + * + * @return + */ + @Override + public Map getNucl(String hisCode) { + StringBuffer sbfin = new StringBuffer(); + sbfin.append(""); + sbfin.append(""); + sbfin.append("Getnucl"); + sbfin.append(""); + sbfin.append(""); + sbfin.append(WechatHospConfig.hospcode); + sbfin.append(""); + sbfin.append(""); + sbfin.append(hisCode); + sbfin.append(""); + sbfin.append(""); + sbfin.append(""); + String resxml = ""; + if (isMN) { + resxml = ""; + } else { + resxml = HisWebClient.getHisPost("", sbfin.toString()); + } + Map resMap = XMLUtils.Xml2Map(resxml); + Map map = (Map) MapUtils.getValue(resMap, "response"); + HisResult result = HisResult.instance(map, "returnData.dd_hyxm.dd_hyxm_row", true, "0"); + if (result.isSucess()) { + return result.getRetData(); + } + return null; + } + + /** + * 核酸缴费 + * + * @return + */ + @Override + public Map createNucl(Map params) { + StringBuffer sbfin = new StringBuffer(); + sbfin.append(""); + sbfin.append(""); + sbfin.append("CreateNucl"); + sbfin.append(""); + sbfin.append(""); + sbfin.append(WechatHospConfig.hospcode); + sbfin.append(""); + sbfin.append(""); + sbfin.append(params.get("hisCode")); + sbfin.append(""); + sbfin.append(""); + sbfin.append(params.get("patId")); + sbfin.append(""); + sbfin.append(""); + sbfin.append("wmp01" + params.get("orderId")); + sbfin.append(""); + sbfin.append(""); + sbfin.append(params.get("orderPayId")); + sbfin.append(""); + sbfin.append(""); + sbfin.append(""); + String resxml = ""; + if (isMN) { + resxml = "0支付成功"; + } else { + resxml = HisWebClient.getHisPost("", sbfin.toString()); + } + Map resMap = XMLUtils.Xml2Map(resxml); + Map map = (Map) MapUtils.getValue(resMap, "response"); + return map; + } + + /** + * 核酸缴费 + * + * @return + */ + @Override + public Map getIpPatientInfo(String patName, String idNumber) { + StringBuffer sbfin = new StringBuffer(); + sbfin.append(""); + sbfin.append(""); + sbfin.append("getIpPatientInfo002"); + sbfin.append(""); + sbfin.append(""); + sbfin.append(WechatHospConfig.hospcode); + sbfin.append(""); + sbfin.append(""); + sbfin.append(patName); + sbfin.append(""); + sbfin.append(""); + sbfin.append(idNumber); + sbfin.append(""); + sbfin.append(""); + sbfin.append(""); + String resxml = ""; + if (isMN) { + //resxml = "\t0\t获取病人信息成功\t5861240052451700524517130481199303045741古丽媛58255721993-03-04 00:00:00665产科2653十七病区CE231522郭薇2018-07-0482653393000002018-07-06\t\n"; + resxml = "\t1\t获取病人信息成功\t"; + } else { + resxml = HisWebClient.getHisPost("", sbfin.toString()); + } + Map resMap = XMLUtils.Xml2Map(resxml); + Map map = (Map) MapUtils.getValue(resMap, "response"); + HisResult result = HisResult.instance(map, "returnData", true, "0"); + if (result.isSucess()) { + return result.getRetData(); + } + return null; + } + + //查询医保代缴费明细 + @Override + public Map getLisReportDetailInfo(String patId, String prscrptNumber) { + StringBuffer sbfin = new StringBuffer(); + sbfin.append(""); + sbfin.append(""); + sbfin.append("91001"); + sbfin.append(""); + sbfin.append(""); + sbfin.append(WechatHospConfig.hospcode); + sbfin.append(""); + sbfin.append(""); + sbfin.append(patId); + sbfin.append(""); + sbfin.append(""); + sbfin.append(prscrptNumber); + sbfin.append(""); + sbfin.append(""); + sbfin.append(""); + String resxml = ""; + if (isMN) { + resxml = "\t1\t获取病人信息成功\t"; + } else { + resxml = HisWebClient.getHisPost("", sbfin.toString()); + } + Map resMap = XMLUtils.Xml2Map(resxml); + + Map map = (Map) MapUtils.getValue(resMap, "response"); + HisResult result = HisResult.instance(map, "returnData", true, "0"); + if (result.isSucess()) { + return result.getRetData(); + } + return null; + } + + public static void main(String[] args) { +// HisCallService service = new HisCallService(); +// service.isMN = false; +// +// Map params = new HashMap<>(); +// params.put("patId", "1000596"); +// +// String data = "{ \"appId\": \"1GI1ID7O302G3F60C80A000072E7D954\", \"code\": 0, \"data\": { \"extData\": { \"setlInfo\": { \"acct_mulaid_pay\": 0, \"acct_pay\": -1, \"act_pay_dedc\": 0, \"age\": 36, \"balc\": 75, \"brdy\": \"1988-01-28\", \"certno\": \"131124198801283219\", \"clr_optins\": \"130499\", \"clr_type\": \"11\", \"clr_way\": \"1\", \"cvlserv_flag\": \"0\", \"cvlserv_pay\": 0, \"fulamt_ownpay_amt\": 0, \"fund_pay_sumamt\": -14, \"gend\": \"1\", \"hifdm_pay\": 0, \"hifes_pay\": 0, \"hifmi_pay\": 0, \"hifob_pay\": 0, \"hifp_pay\": -14, \"inscp_scp_amt\": -15, \"insutype\": \"310\", \"maf_pay\": 0, \"mdtrt_cert_type\": \"01\", \"mdtrt_id\": \"300229723\", \"med_type\": \"12\", \"medfee_sumamt\": -15, \"medins_setl_id\": \"H13040207288202406231645211312\", \"naty\": \"01\", \"oth_pay\": 0, \"overlmt_selfpay\": 0, \"pool_prop_selfpay\": -1, \"preselfpay_amt\": 0, \"psn_cash_pay\": 0, \"psn_cert_type\": \"01\", \"psn_name\": \"邢广冒\", \"psn_no\": \"13000000000000000500031580\", \"psn_type\": \"1101\", \"setl_id\": \"13049920240623000300144007\", \"setl_time\": \"2024-06-23 16:45:21\" }, \"setldetail\": [ { \"fund_pay_type\": \"310100\", \"fund_pay_type_name\": \"城镇职工基本医疗保险统筹基金\", \"fund_payamt\": -14, \"inscp_scp_amt\": -15 }, { \"fund_pay_type\": \"310200\", \"fund_pay_type_name\": \"城镇职工基本医疗保险个人账户基金\", \"fund_payamt\": -1, \"inscp_scp_amt\": -15 } ] }, \"hiFefdSn\": \"13049920240623000300144007\", \"hiTrnsDate\": \"20240623\", \"hiTrnsTime\": \"164521\", \"refStatus\": \"SUCC\", \"refdSn\": \"REF130100202406231645210000007\" }, \"encType\": \"SM4\", \"flag\": true, \"message\": \"成功-072-fbf24527115042339fb25fecde2503c2\", \"signData\": \"+jSYF8FAoCAQpcf5XIBjUMf9wPynsw08MUnx1wF4PRcXzypzC8pHAoZUNqpDv4n+lR1+TO9uMbu0BGMt8n9z9Q==\", \"signType\": \"SM2\", \"success\": true, \"timestamp\": \"1719132321960\", \"version\": \"2.0.1\" }"; +// JSONObject retRefund = JSONObject.parseObject(data); + + System.out.println((99 - new Random().nextInt(99))); + } + +} diff --git a/health_his/src/main/java/cn/card/health/his/service/hdzxy/HisWebClient.java b/health_his/src/main/java/cn/card/health/his/service/hdzxy/HisWebClient.java new file mode 100644 index 0000000..52d8a63 --- /dev/null +++ b/health_his/src/main/java/cn/card/health/his/service/hdzxy/HisWebClient.java @@ -0,0 +1,73 @@ +package cn.card.health.his.service.hdzxy; + +import cn.card.health.common.utils.HttpUtils; +import com.alibaba.fastjson.JSONObject; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Repository; + +@Repository("hdzxyHisWebClient") +public class HisWebClient { + private static Logger logger = LoggerFactory.getLogger(HisWebClient.class); + + private static String url; + private static String proxyHost; + private static String proxyPort; + private static String methodName; + private static String namespaceURI; + +// @Value("${his.proxyHost}") + public void setProxyHost(String proxyHost) { + proxyHost = proxyHost; + } + +// @Value("${his.proxyPort}") + public void setProxyPort(String proxyPort) { + proxyPort = proxyPort; + } + + @Value("${his.url}") + public void setUrl(String url) { + url = url; + } + +// @Value("${his.methodName}") + public void setMethodName(String methodName) { + methodName = methodName; + } + +// @Value("${his.namespaceURI}") + public void setNamespaceURI(String namespaceURI) { + namespaceURI = namespaceURI; + } + + public static String getHisPost(String method, String params) { + logger.info("请求参数:{}", params); + String result = send(method, params); +// logger.info("请求结果:{}", result.replace("\n", "")); + + return result; + } + public static String getHisPost(String method, String params, String aa) { + logger.info("请求参数:{}", params); + String result = send(method, params); + logger.info("请求结果:{}", result.replace("\n", "")); + + return result; + } + +// public static String getHisXmlNoLog(String inxml) { +// logger.info("向HIS发起数据查询请求"); +// String resxml = send(inxml); +// logger.info("HIS返回请求结果"); +// return resxml; +// } + + + private static String send(String method, String parmas) { + url = "http://127.0.0.1:33061/"+method; + String result = HttpUtils.sendJSONPost(url, parmas); + return result; + } +} diff --git a/health_his/src/main/java/cn/his/client/gdbh/Hisforhzfwhmessage.java b/health_his/src/main/java/cn/his/client/gdbh/Hisforhzfwhmessage.java new file mode 100644 index 0000000..5ca9d65 --- /dev/null +++ b/health_his/src/main/java/cn/his/client/gdbh/Hisforhzfwhmessage.java @@ -0,0 +1,53 @@ +package cn.his.client.gdbh; + +import javax.xml.bind.annotation.*; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="inparm" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "inparm" +}) +@XmlRootElement(name = "hisforhzfwhmessage") +public class Hisforhzfwhmessage { + + @XmlElement(required = true, nillable = true) + protected String inparm; + + /** + * Gets the value of the inparm property. + * + * @return possible object is + * {@link String } + */ + public String getInparm() { + return inparm; + } + + /** + * Sets the value of the inparm property. + * + * @param value allowed object is + * {@link String } + */ + public void setInparm(String value) { + this.inparm = value; + } + +} diff --git a/health_his/src/main/java/cn/his/client/gdbh/HisforhzfwhmessageResponse.java b/health_his/src/main/java/cn/his/client/gdbh/HisforhzfwhmessageResponse.java new file mode 100644 index 0000000..d3ffc7c --- /dev/null +++ b/health_his/src/main/java/cn/his/client/gdbh/HisforhzfwhmessageResponse.java @@ -0,0 +1,53 @@ +package cn.his.client.gdbh; + +import javax.xml.bind.annotation.*; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="hisforhzfwhmessageResult" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "hisforhzfwhmessageResult" +}) +@XmlRootElement(name = "hisforhzfwhmessageResponse") +public class HisforhzfwhmessageResponse { + + @XmlElement(required = true, nillable = true) + protected String hisforhzfwhmessageResult; + + /** + * Gets the value of the hisforhzfwhmessageResult property. + * + * @return possible object is + * {@link String } + */ + public String getHisforhzfwhmessageResult() { + return hisforhzfwhmessageResult; + } + + /** + * Sets the value of the hisforhzfwhmessageResult property. + * + * @param value allowed object is + * {@link String } + */ + public void setHisforhzfwhmessageResult(String value) { + this.hisforhzfwhmessageResult = value; + } + +} diff --git a/health_his/src/main/java/cn/his/client/gdbh/NWzfservice.java b/health_his/src/main/java/cn/his/client/gdbh/NWzfservice.java new file mode 100644 index 0000000..21b42ae --- /dev/null +++ b/health_his/src/main/java/cn/his/client/gdbh/NWzfservice.java @@ -0,0 +1,82 @@ +package cn.his.client.gdbh; + +import javax.xml.namespace.QName; +import javax.xml.ws.*; +import java.net.MalformedURLException; +import java.net.URL; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.2.4-b01 + * Generated source version: 2.2 + */ +@WebServiceClient(name = "n_wzfservice", targetNamespace = "http://tempurl.org", wsdlLocation = "http://221.193.240.211:8088/wzfservice/n_wzfservice.asmx?WSDL") +public class NWzfservice + extends Service { + + private final static URL NWZFSERVICE_WSDL_LOCATION; + private final static WebServiceException NWZFSERVICE_EXCEPTION; + private final static QName NWZFSERVICE_QNAME = new QName("http://tempurl.org", "n_wzfservice"); + + static { + URL url = null; + WebServiceException e = null; + try { + url = new URL("http://192.168.20.20:8081/wzfservice/n_wzfservice.asmx?WSDL");//http://221.193.240.211:8088/wzfservice/n_wzfservice.asmx?WSDL + } catch (MalformedURLException ex) { + e = new WebServiceException(ex); + } + NWZFSERVICE_WSDL_LOCATION = url; + NWZFSERVICE_EXCEPTION = e; + } + + public NWzfservice() { + super(__getWsdlLocation(), NWZFSERVICE_QNAME); + } + + public NWzfservice(WebServiceFeature... features) { + super(__getWsdlLocation(), NWZFSERVICE_QNAME, features); + } + + public NWzfservice(URL wsdlLocation) { + super(wsdlLocation, NWZFSERVICE_QNAME); + } + + public NWzfservice(URL wsdlLocation, WebServiceFeature... features) { + super(wsdlLocation, NWZFSERVICE_QNAME, features); + } + + public NWzfservice(URL wsdlLocation, QName serviceName) { + super(wsdlLocation, serviceName); + } + + public NWzfservice(URL wsdlLocation, QName serviceName, WebServiceFeature... features) { + super(wsdlLocation, serviceName, features); + } + + /** + * @return returns NWzfserviceSoap + */ + @WebEndpoint(name = "n_wzfserviceSoap") + public NWzfserviceSoap getNWzfserviceSoap() { + return super.getPort(new QName("http://tempurl.org", "n_wzfserviceSoap"), NWzfserviceSoap.class); + } + + /** + * @param features A list of {@link WebServiceFeature} to configure on the proxy. Supported features not in the features parameter will have their default values. + * @return returns NWzfserviceSoap + */ + @WebEndpoint(name = "n_wzfserviceSoap") + public NWzfserviceSoap getNWzfserviceSoap(WebServiceFeature... features) { + return super.getPort(new QName("http://tempurl.org", "n_wzfserviceSoap"), NWzfserviceSoap.class, features); + } + + private static URL __getWsdlLocation() { + if (NWZFSERVICE_EXCEPTION != null) { + throw NWZFSERVICE_EXCEPTION; + } + return NWZFSERVICE_WSDL_LOCATION; + } + +} diff --git a/health_his/src/main/java/cn/his/client/gdbh/NWzfserviceSoap.java b/health_his/src/main/java/cn/his/client/gdbh/NWzfserviceSoap.java new file mode 100644 index 0000000..26c51f3 --- /dev/null +++ b/health_his/src/main/java/cn/his/client/gdbh/NWzfserviceSoap.java @@ -0,0 +1,45 @@ +package cn.his.client.gdbh; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebResult; +import javax.jws.WebService; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.ws.RequestWrapper; +import javax.xml.ws.ResponseWrapper; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.2.4-b01 + * Generated source version: 2.2 + */ +@WebService(name = "n_wzfserviceSoap", targetNamespace = "http://tempurl.org") +@XmlSeeAlso({ + ObjectFactory.class +}) +public interface NWzfserviceSoap { + + + /** + * @param inparm + * @return returns java.lang.String + */ + @WebMethod(action = "http://tempurl.org/hisforhzfwhmessage") + @WebResult(name = "hisforhzfwhmessageResult", targetNamespace = "http://tempurl.org") + @RequestWrapper(localName = "hisforhzfwhmessage", targetNamespace = "http://tempurl.org", className = "com.hyan.client.Hisforhzfwhmessage") + @ResponseWrapper(localName = "hisforhzfwhmessageResponse", targetNamespace = "http://tempurl.org", className = "com.hyan.client.HisforhzfwhmessageResponse") + public String hisforhzfwhmessage( + @WebParam(name = "inparm", targetNamespace = "http://tempurl.org") + String inparm); + + /** + * @return returns java.lang.String + */ + @WebMethod(action = "http://tempurl.org/test") + @WebResult(name = "testResult", targetNamespace = "http://tempurl.org") + @RequestWrapper(localName = "test", targetNamespace = "http://tempurl.org", className = "com.hyan.client.Test") + @ResponseWrapper(localName = "testResponse", targetNamespace = "http://tempurl.org", className = "com.hyan.client.TestResponse") + public String test(); + +} diff --git a/health_his/src/main/java/cn/his/client/gdbh/ObjectFactory.java b/health_his/src/main/java/cn/his/client/gdbh/ObjectFactory.java new file mode 100644 index 0000000..9548d27 --- /dev/null +++ b/health_his/src/main/java/cn/his/client/gdbh/ObjectFactory.java @@ -0,0 +1,44 @@ +package cn.his.client.gdbh; + +import javax.xml.bind.annotation.XmlRegistry; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the com.hyan.client package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + */ +@XmlRegistry +public class ObjectFactory { + + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.hyan.client + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link Hisforhzfwhmessage } + */ + public Hisforhzfwhmessage createHisforhzfwhmessage() { + return new Hisforhzfwhmessage(); + } + + /** + * Create an instance of {@link HisforhzfwhmessageResponse } + */ + public HisforhzfwhmessageResponse createHisforhzfwhmessageResponse() { + return new HisforhzfwhmessageResponse(); + } + + +} diff --git a/health_his/src/main/java/cn/his/client/hdsxyy/Hisforhzfwhmessage.java b/health_his/src/main/java/cn/his/client/hdsxyy/Hisforhzfwhmessage.java new file mode 100644 index 0000000..a6bf330 --- /dev/null +++ b/health_his/src/main/java/cn/his/client/hdsxyy/Hisforhzfwhmessage.java @@ -0,0 +1,64 @@ + +package cn.his.client.hdsxyy; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="inparm" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "inparm" +}) +@XmlRootElement(name = "hisforhzfwhmessage") +public class Hisforhzfwhmessage { + + @XmlElement(required = true, nillable = true) + protected String inparm; + + /** + * Gets the value of the inparm property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getInparm() { + return inparm; + } + + /** + * Sets the value of the inparm property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setInparm(String value) { + this.inparm = value; + } + +} diff --git a/health_his/src/main/java/cn/his/client/hdsxyy/HisforhzfwhmessageResponse.java b/health_his/src/main/java/cn/his/client/hdsxyy/HisforhzfwhmessageResponse.java new file mode 100644 index 0000000..2c5aadc --- /dev/null +++ b/health_his/src/main/java/cn/his/client/hdsxyy/HisforhzfwhmessageResponse.java @@ -0,0 +1,64 @@ + +package cn.his.client.hdsxyy; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="hisforhzfwhmessageResult" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "hisforhzfwhmessageResult" +}) +@XmlRootElement(name = "hisforhzfwhmessageResponse") +public class HisforhzfwhmessageResponse { + + @XmlElement(required = true, nillable = true) + protected String hisforhzfwhmessageResult; + + /** + * Gets the value of the hisforhzfwhmessageResult property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getHisforhzfwhmessageResult() { + return hisforhzfwhmessageResult; + } + + /** + * Sets the value of the hisforhzfwhmessageResult property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setHisforhzfwhmessageResult(String value) { + this.hisforhzfwhmessageResult = value; + } + +} diff --git a/health_his/src/main/java/cn/his/client/hdsxyy/NWzfservice.java b/health_his/src/main/java/cn/his/client/hdsxyy/NWzfservice.java new file mode 100644 index 0000000..ff24916 --- /dev/null +++ b/health_his/src/main/java/cn/his/client/hdsxyy/NWzfservice.java @@ -0,0 +1,82 @@ +package cn.his.client.hdsxyy; + +import javax.xml.namespace.QName; +import javax.xml.ws.*; +import java.net.MalformedURLException; +import java.net.URL; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.2.4-b01 + * Generated source version: 2.2 + */ +@WebServiceClient(name = "n_wzfservice", targetNamespace = "http://tempurl.org", wsdlLocation = "http://221.193.240.211:8088/wzfservice/n_wzfservice.asmx?WSDL") +public class NWzfservice + extends Service { + + private final static URL NWZFSERVICE_WSDL_LOCATION; + private final static WebServiceException NWZFSERVICE_EXCEPTION; + private final static QName NWZFSERVICE_QNAME = new QName("http://tempurl.org", "n_wzfservice"); + + static { + URL url = null; + WebServiceException e = null; + try { + url = new URL("http://192.168.20.20:8081/wzfservice/n_wzfservice.asmx?WSDL");//http://221.193.240.211:8088/wzfservice/n_wzfservice.asmx?WSDL + } catch (MalformedURLException ex) { + e = new WebServiceException(ex); + } + NWZFSERVICE_WSDL_LOCATION = url; + NWZFSERVICE_EXCEPTION = e; + } + + public NWzfservice() { + super(__getWsdlLocation(), NWZFSERVICE_QNAME); + } + + public NWzfservice(WebServiceFeature... features) { + super(__getWsdlLocation(), NWZFSERVICE_QNAME, features); + } + + public NWzfservice(URL wsdlLocation) { + super(wsdlLocation, NWZFSERVICE_QNAME); + } + + public NWzfservice(URL wsdlLocation, WebServiceFeature... features) { + super(wsdlLocation, NWZFSERVICE_QNAME, features); + } + + public NWzfservice(URL wsdlLocation, QName serviceName) { + super(wsdlLocation, serviceName); + } + + public NWzfservice(URL wsdlLocation, QName serviceName, WebServiceFeature... features) { + super(wsdlLocation, serviceName, features); + } + + /** + * @return returns NWzfserviceSoap + */ + @WebEndpoint(name = "n_wzfserviceSoap") + public NWzfserviceSoap getNWzfserviceSoap() { + return super.getPort(new QName("http://tempurl.org", "n_wzfserviceSoap"), NWzfserviceSoap.class); + } + + /** + * @param features A list of {@link WebServiceFeature} to configure on the proxy. Supported features not in the features parameter will have their default values. + * @return returns NWzfserviceSoap + */ + @WebEndpoint(name = "n_wzfserviceSoap") + public NWzfserviceSoap getNWzfserviceSoap(WebServiceFeature... features) { + return super.getPort(new QName("http://tempurl.org", "n_wzfserviceSoap"), NWzfserviceSoap.class, features); + } + + private static URL __getWsdlLocation() { + if (NWZFSERVICE_EXCEPTION != null) { + throw NWZFSERVICE_EXCEPTION; + } + return NWZFSERVICE_WSDL_LOCATION; + } + +} diff --git a/health_his/src/main/java/cn/his/client/hdsxyy/NWzfserviceSoap.java b/health_his/src/main/java/cn/his/client/hdsxyy/NWzfserviceSoap.java new file mode 100644 index 0000000..364ac36 --- /dev/null +++ b/health_his/src/main/java/cn/his/client/hdsxyy/NWzfserviceSoap.java @@ -0,0 +1,51 @@ + +package cn.his.client.hdsxyy; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebResult; +import javax.jws.WebService; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.ws.RequestWrapper; +import javax.xml.ws.ResponseWrapper; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.2.4-b01 + * Generated source version: 2.2 + * + */ +@WebService(name = "n_wzfserviceSoap", targetNamespace = "http://tempurl.org") +@XmlSeeAlso({ + ObjectFactory.class +}) +public interface NWzfserviceSoap { + + + /** + * + * @param inparm + * @return + * returns java.lang.String + */ + @WebMethod(action = "http://tempurl.org/hisforhzfwhmessage") + @WebResult(name = "hisforhzfwhmessageResult", targetNamespace = "http://tempurl.org") + @RequestWrapper(localName = "hisforhzfwhmessage", targetNamespace = "http://tempurl.org", className = "com.hyan.client.Hisforhzfwhmessage") + @ResponseWrapper(localName = "hisforhzfwhmessageResponse", targetNamespace = "http://tempurl.org", className = "com.hyan.client.HisforhzfwhmessageResponse") + public String hisforhzfwhmessage( + @WebParam(name = "inparm", targetNamespace = "http://tempurl.org") + String inparm); + + /** + * + * @return + * returns java.lang.String + */ + @WebMethod(action = "http://tempurl.org/test") + @WebResult(name = "testResult", targetNamespace = "http://tempurl.org") + @RequestWrapper(localName = "test", targetNamespace = "http://tempurl.org", className = "com.hyan.client.Test") + @ResponseWrapper(localName = "testResponse", targetNamespace = "http://tempurl.org", className = "com.hyan.client.TestResponse") + public String test(); + +} diff --git a/health_his/src/main/java/cn/his/client/hdsxyy/ObjectFactory.java b/health_his/src/main/java/cn/his/client/hdsxyy/ObjectFactory.java new file mode 100644 index 0000000..035ed0b --- /dev/null +++ b/health_his/src/main/java/cn/his/client/hdsxyy/ObjectFactory.java @@ -0,0 +1,49 @@ + +package cn.his.client.hdsxyy; + +import javax.xml.bind.annotation.XmlRegistry; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the com.hyan.client package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.hyan.client + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link Hisforhzfwhmessage } + * + */ + public Hisforhzfwhmessage createHisforhzfwhmessage() { + return new Hisforhzfwhmessage(); + } + + /** + * Create an instance of {@link HisforhzfwhmessageResponse } + * + */ + public HisforhzfwhmessageResponse createHisforhzfwhmessageResponse() { + return new HisforhzfwhmessageResponse(); + } + + +} diff --git a/health_his/src/main/java/cn/his/client/wasdyrmyy/GetData.java b/health_his/src/main/java/cn/his/client/wasdyrmyy/GetData.java new file mode 100644 index 0000000..9229c9e --- /dev/null +++ b/health_his/src/main/java/cn/his/client/wasdyrmyy/GetData.java @@ -0,0 +1,60 @@ + +package cn.his.client.wasdyrmyy; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

getData complex type�� Java �ࡣ + * + *

����ģʽƬ��ָ�������ڴ����е�Ԥ�����ݡ� + * + *

+ * <complexType name="getData">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="arg0" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "getData", propOrder = { + "arg0" +}) +public class GetData { + + protected String arg0; + + /** + * ��ȡarg0���Ե�ֵ�� + * + * @return + * possible object is + * {@link String } + * + */ + public String getArg0() { + return arg0; + } + + /** + * ����arg0���Ե�ֵ�� + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setArg0(String value) { + this.arg0 = value; + } + +} diff --git a/health_his/src/main/java/cn/his/client/wasdyrmyy/GetDataResponse.java b/health_his/src/main/java/cn/his/client/wasdyrmyy/GetDataResponse.java new file mode 100644 index 0000000..0d20068 --- /dev/null +++ b/health_his/src/main/java/cn/his/client/wasdyrmyy/GetDataResponse.java @@ -0,0 +1,62 @@ + +package cn.his.client.wasdyrmyy; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

getDataResponse complex type�� Java �ࡣ + * + *

����ģʽƬ��ָ�������ڴ����е�Ԥ�����ݡ� + * + *

+ * <complexType name="getDataResponse">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="return" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "getDataResponse", propOrder = { + "_return" +}) +public class GetDataResponse { + + @XmlElement(name = "return") + protected String _return; + + /** + * ��ȡreturn���Ե�ֵ�� + * + * @return + * possible object is + * {@link String } + * + */ + public String getReturn() { + return _return; + } + + /** + * ����return���Ե�ֵ�� + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setReturn(String value) { + this._return = value; + } + +} diff --git a/health_his/src/main/java/cn/his/client/wasdyrmyy/HISDataService.java b/health_his/src/main/java/cn/his/client/wasdyrmyy/HISDataService.java new file mode 100644 index 0000000..881eaf5 --- /dev/null +++ b/health_his/src/main/java/cn/his/client/wasdyrmyy/HISDataService.java @@ -0,0 +1,40 @@ + +package cn.his.client.wasdyrmyy; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebResult; +import javax.jws.WebService; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.ws.RequestWrapper; +import javax.xml.ws.ResponseWrapper; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.2.9-b130926.1035 + * Generated source version: 2.2 + * + */ +@WebService(name = "HISDataService", targetNamespace = "http://service.hdsxyy.cn/") +@XmlSeeAlso({ + ObjectFactory.class +}) +public interface HISDataService { + + + /** + * + * @param arg0 + * @return + * returns java.lang.String + */ + @WebMethod + @WebResult(targetNamespace = "") + @RequestWrapper(localName = "getData", targetNamespace = "http://service.hdsxyy.cn/", className = "cn.card.health.his.service.wasdyrmyy.GetData") + @ResponseWrapper(localName = "getDataResponse", targetNamespace = "http://service.hdsxyy.cn/", className = "cn.card.health.his.service.wasdyrmyy.GetDataResponse") + public String getData( + @WebParam(name = "arg0", targetNamespace = "") + String arg0); + +} diff --git a/health_his/src/main/java/cn/his/client/wasdyrmyy/Hisforhzfwhmessage.java b/health_his/src/main/java/cn/his/client/wasdyrmyy/Hisforhzfwhmessage.java new file mode 100644 index 0000000..952a28c --- /dev/null +++ b/health_his/src/main/java/cn/his/client/wasdyrmyy/Hisforhzfwhmessage.java @@ -0,0 +1,60 @@ + +package cn.his.client.wasdyrmyy; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +/** + *

+ * Java class for anonymous complex type. + * + *

+ * The following schema fragment specifies the expected content contained within + * this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="inparm" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { "inparm" }) +@XmlRootElement(name = "hisforhzfwhmessage") +public class Hisforhzfwhmessage { + + @XmlElement(required = true, nillable = true) + protected String inparm; + + /** + * Gets the value of the inparm property. + * + * @return possible object is {@link String } + * + */ + public String getInparm() { + return inparm; + } + + /** + * Sets the value of the inparm property. + * + * @param value allowed object is {@link String } + * + */ + public void setInparm(String value) { + this.inparm = value; + } + +} diff --git a/health_his/src/main/java/cn/his/client/wasdyrmyy/HisforhzfwhmessageResponse.java b/health_his/src/main/java/cn/his/client/wasdyrmyy/HisforhzfwhmessageResponse.java new file mode 100644 index 0000000..e8e8028 --- /dev/null +++ b/health_his/src/main/java/cn/his/client/wasdyrmyy/HisforhzfwhmessageResponse.java @@ -0,0 +1,60 @@ + +package cn.his.client.wasdyrmyy; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +/** + *

+ * Java class for anonymous complex type. + * + *

+ * The following schema fragment specifies the expected content contained within + * this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="hisforhzfwhmessageResult" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { "hisforhzfwhmessageResult" }) +@XmlRootElement(name = "hisforhzfwhmessageResponse") +public class HisforhzfwhmessageResponse { + + @XmlElement(required = true, nillable = true) + protected String hisforhzfwhmessageResult; + + /** + * Gets the value of the hisforhzfwhmessageResult property. + * + * @return possible object is {@link String } + * + */ + public String getHisforhzfwhmessageResult() { + return hisforhzfwhmessageResult; + } + + /** + * Sets the value of the hisforhzfwhmessageResult property. + * + * @param value allowed object is {@link String } + * + */ + public void setHisforhzfwhmessageResult(String value) { + this.hisforhzfwhmessageResult = value; + } + +} diff --git a/health_his/src/main/java/cn/his/client/wasdyrmyy/NWzfservice.java b/health_his/src/main/java/cn/his/client/wasdyrmyy/NWzfservice.java new file mode 100644 index 0000000..99ea621 --- /dev/null +++ b/health_his/src/main/java/cn/his/client/wasdyrmyy/NWzfservice.java @@ -0,0 +1,73 @@ + +package cn.his.client.wasdyrmyy; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.logging.Logger; +import javax.xml.namespace.QName; +import javax.xml.ws.Service; +import javax.xml.ws.WebEndpoint; +import javax.xml.ws.WebServiceClient; + +/** + * This class was generated by the JAX-WS RI. JAX-WS RI 2.1.3-hudson-390- + * Generated source version: 2.0 + *

+ * An example of how this class may be used: + * + *

+* n_wzfservice service = new n_wzfservice();
+* NWzfserviceSoap portType = service.getNWzfserviceSoap();
+* portType.hisforhzfwhmessage(...);
+ * 
+ *

+ * + */ +@WebServiceClient(name = "n_wzfservice", targetNamespace = "http://tempurl.org", wsdlLocation = "http://221.193.240.211:8088/wzfservice/n_wzfservice.asmx?WSDL") +public class NWzfservice extends Service { + + private final static URL NWZFSERVICE_WSDL_LOCATION; + private final static Logger logger = Logger.getLogger(NWzfservice.class.getName()); + + static { + URL url = null; + try { + URL baseUrl; + baseUrl = NWzfservice.class.getResource("."); +// url = new URL(baseUrl, "http://221.193.240.211:8088/wzfservice/n_wzfservice.asmx"); + url = new URL(baseUrl, "http://221.193.240.211:8088/wzfservice/n_wzfservice.asmx?WSDL"); + } catch (MalformedURLException e) { + logger.warning( + "Failed to create URL for the wsdl Location: 'http://221.193.240.211:8088/wzfservice/n_wzfservice.asmx?WSDL', retrying as a local file"); + logger.warning(e.getMessage()); + } + NWZFSERVICE_WSDL_LOCATION = url; + } + + public NWzfservice(URL wsdlLocation, QName serviceName) { + super(wsdlLocation, serviceName); + } + + public NWzfservice() { + super(NWZFSERVICE_WSDL_LOCATION, new QName("http://tempurl.org", "n_wzfservice")); + } + + /** + * + * @return returns NWzfserviceSoap + */ + @WebEndpoint(name = "n_wzfserviceSoap") + public NWzfserviceSoap getNWzfserviceSoap() { + return super.getPort(new QName("http://tempurl.org", "n_wzfserviceSoap"), NWzfserviceSoap.class); + } + + /** + * + * @return returns NWzfserviceSoap + */ + @WebEndpoint(name = "n_wzfserviceSoap12") + public NWzfserviceSoap getNWzfserviceSoap12() { + return super.getPort(new QName("http://tempurl.org", "n_wzfserviceSoap12"), NWzfserviceSoap.class); + } + +} diff --git a/health_his/src/main/java/cn/his/client/wasdyrmyy/NWzfserviceSoap.java b/health_his/src/main/java/cn/his/client/wasdyrmyy/NWzfserviceSoap.java new file mode 100644 index 0000000..b3c8abc --- /dev/null +++ b/health_his/src/main/java/cn/his/client/wasdyrmyy/NWzfserviceSoap.java @@ -0,0 +1,40 @@ + +package cn.his.client.wasdyrmyy; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebResult; +import javax.jws.WebService; +import javax.xml.ws.RequestWrapper; +import javax.xml.ws.ResponseWrapper; + +/** + * This class was generated by the JAX-WS RI. JAX-WS RI 2.1.3-hudson-390- + * Generated source version: 2.0 + * + */ +@WebService(name = "n_wzfserviceSoap", targetNamespace = "http://tempurl.org") +public interface NWzfserviceSoap { + + /** + * + * @param inparm + * @return returns java.lang.String + */ + @WebMethod(action = "http://tempurl.org/hisforhzfwhmessage") + @WebResult(name = "hisforhzfwhmessageResult", targetNamespace = "http://tempurl.org") + @RequestWrapper(localName = "hisforhzfwhmessage", targetNamespace = "http://tempurl.org", className = "cn.hosp.client.Hisforhzfwhmessage") + @ResponseWrapper(localName = "hisforhzfwhmessageResponse", targetNamespace = "http://tempurl.org", className = "cn.hosp.client.HisforhzfwhmessageResponse") + public String hisforhzfwhmessage(@WebParam(name = "inparm", targetNamespace = "http://tempurl.org") String inparm); + + /** + * + * @return returns java.lang.String + */ + @WebMethod(action = "http://tempurl.org/test") + @WebResult(name = "testResult", targetNamespace = "http://tempurl.org") + @RequestWrapper(localName = "test", targetNamespace = "http://tempurl.org", className = "cn.hosp.client.Test") + @ResponseWrapper(localName = "testResponse", targetNamespace = "http://tempurl.org", className = "cn.hosp.client.TestResponse") + public String test(); + +} diff --git a/health_his/src/main/java/cn/his/client/wasdyrmyy/ObjectFactory.java b/health_his/src/main/java/cn/his/client/wasdyrmyy/ObjectFactory.java new file mode 100644 index 0000000..90f6e15 --- /dev/null +++ b/health_his/src/main/java/cn/his/client/wasdyrmyy/ObjectFactory.java @@ -0,0 +1,71 @@ + +package cn.his.client.wasdyrmyy; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the cn.card.health.his.service.wasdyrmyy package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _GetData_QNAME = new QName("http://service.hdsxyy.cn/", "getData"); + private final static QName _GetDataResponse_QNAME = new QName("http://service.hdsxyy.cn/", "getDataResponse"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: cn.card.health.his.service.wasdyrmyy + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link GetDataResponse } + * + */ + public GetDataResponse createGetDataResponse() { + return new GetDataResponse(); + } + + /** + * Create an instance of {@link GetData } + * + */ + public GetData createGetData() { + return new GetData(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link GetData }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://service.hdsxyy.cn/", name = "getData") + public JAXBElement createGetData(GetData value) { + return new JAXBElement(_GetData_QNAME, GetData.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link GetDataResponse }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://service.hdsxyy.cn/", name = "getDataResponse") + public JAXBElement createGetDataResponse(GetDataResponse value) { + return new JAXBElement(_GetDataResponse_QNAME, GetDataResponse.class, null, value); + } + +} diff --git a/health_his/src/main/java/cn/his/client/wasdyrmyy/Test.java b/health_his/src/main/java/cn/his/client/wasdyrmyy/Test.java new file mode 100644 index 0000000..e70f38b --- /dev/null +++ b/health_his/src/main/java/cn/his/client/wasdyrmyy/Test.java @@ -0,0 +1,33 @@ + +package cn.his.client.wasdyrmyy; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +/** + *

+ * Java class for anonymous complex type. + * + *

+ * The following schema fragment specifies the expected content contained within + * this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "") +@XmlRootElement(name = "test") +public class Test { + +} diff --git a/health_his/src/main/java/cn/his/client/wasdyrmyy/TestResponse.java b/health_his/src/main/java/cn/his/client/wasdyrmyy/TestResponse.java new file mode 100644 index 0000000..b49d736 --- /dev/null +++ b/health_his/src/main/java/cn/his/client/wasdyrmyy/TestResponse.java @@ -0,0 +1,60 @@ + +package cn.his.client.wasdyrmyy; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +/** + *

+ * Java class for anonymous complex type. + * + *

+ * The following schema fragment specifies the expected content contained within + * this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="testResult" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { "testResult" }) +@XmlRootElement(name = "testResponse") +public class TestResponse { + + @XmlElement(required = true, nillable = true) + protected String testResult; + + /** + * Gets the value of the testResult property. + * + * @return possible object is {@link String } + * + */ + public String getTestResult() { + return testResult; + } + + /** + * Sets the value of the testResult property. + * + * @param value allowed object is {@link String } + * + */ + public void setTestResult(String value) { + this.testResult = value; + } + +} diff --git a/health_his/src/main/java/cn/his/client/wasdyrmyy/package-info.java b/health_his/src/main/java/cn/his/client/wasdyrmyy/package-info.java new file mode 100644 index 0000000..fd4865b --- /dev/null +++ b/health_his/src/main/java/cn/his/client/wasdyrmyy/package-info.java @@ -0,0 +1,2 @@ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://tempurl.org", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +package cn.his.client.wasdyrmyy; diff --git a/health_his/target/classes/cn/card/health/config/wasdyrmyy/WechatHospConfig.class b/health_his/target/classes/cn/card/health/config/wasdyrmyy/WechatHospConfig.class new file mode 100644 index 0000000..f06c18d Binary files /dev/null and b/health_his/target/classes/cn/card/health/config/wasdyrmyy/WechatHospConfig.class differ diff --git a/health_his/target/classes/cn/card/health/his/service/ClientConnection.class b/health_his/target/classes/cn/card/health/his/service/ClientConnection.class new file mode 100644 index 0000000..b117cef Binary files /dev/null and b/health_his/target/classes/cn/card/health/his/service/ClientConnection.class differ diff --git a/health_his/target/classes/cn/card/health/his/service/HisResult.class b/health_his/target/classes/cn/card/health/his/service/HisResult.class new file mode 100644 index 0000000..4470e76 Binary files /dev/null and b/health_his/target/classes/cn/card/health/his/service/HisResult.class differ diff --git a/health_his/target/classes/cn/card/health/his/service/IHisCallService.class b/health_his/target/classes/cn/card/health/his/service/IHisCallService.class new file mode 100644 index 0000000..3c10a3c Binary files /dev/null and b/health_his/target/classes/cn/card/health/his/service/IHisCallService.class differ diff --git a/health_his/target/classes/cn/card/health/his/service/hdzxy/HisCallService.class b/health_his/target/classes/cn/card/health/his/service/hdzxy/HisCallService.class new file mode 100644 index 0000000..618618f Binary files /dev/null and b/health_his/target/classes/cn/card/health/his/service/hdzxy/HisCallService.class differ diff --git a/health_his/target/classes/cn/card/health/his/service/hdzxy/HisWebClient.class b/health_his/target/classes/cn/card/health/his/service/hdzxy/HisWebClient.class new file mode 100644 index 0000000..df0aef0 Binary files /dev/null and b/health_his/target/classes/cn/card/health/his/service/hdzxy/HisWebClient.class differ diff --git a/health_his/target/classes/cn/his/client/gdbh/Hisforhzfwhmessage.class b/health_his/target/classes/cn/his/client/gdbh/Hisforhzfwhmessage.class new file mode 100644 index 0000000..62f5567 Binary files /dev/null and b/health_his/target/classes/cn/his/client/gdbh/Hisforhzfwhmessage.class differ diff --git a/health_his/target/classes/cn/his/client/gdbh/HisforhzfwhmessageResponse.class b/health_his/target/classes/cn/his/client/gdbh/HisforhzfwhmessageResponse.class new file mode 100644 index 0000000..8282fbf Binary files /dev/null and b/health_his/target/classes/cn/his/client/gdbh/HisforhzfwhmessageResponse.class differ diff --git a/health_his/target/classes/cn/his/client/gdbh/NWzfservice.class b/health_his/target/classes/cn/his/client/gdbh/NWzfservice.class new file mode 100644 index 0000000..d292b3e Binary files /dev/null and b/health_his/target/classes/cn/his/client/gdbh/NWzfservice.class differ diff --git a/health_his/target/classes/cn/his/client/gdbh/NWzfserviceSoap.class b/health_his/target/classes/cn/his/client/gdbh/NWzfserviceSoap.class new file mode 100644 index 0000000..843966c Binary files /dev/null and b/health_his/target/classes/cn/his/client/gdbh/NWzfserviceSoap.class differ diff --git a/health_his/target/classes/cn/his/client/gdbh/ObjectFactory.class b/health_his/target/classes/cn/his/client/gdbh/ObjectFactory.class new file mode 100644 index 0000000..e73ccf6 Binary files /dev/null and b/health_his/target/classes/cn/his/client/gdbh/ObjectFactory.class differ diff --git a/health_his/target/classes/cn/his/client/hdsxyy/Hisforhzfwhmessage.class b/health_his/target/classes/cn/his/client/hdsxyy/Hisforhzfwhmessage.class new file mode 100644 index 0000000..1752270 Binary files /dev/null and b/health_his/target/classes/cn/his/client/hdsxyy/Hisforhzfwhmessage.class differ diff --git a/health_his/target/classes/cn/his/client/hdsxyy/HisforhzfwhmessageResponse.class b/health_his/target/classes/cn/his/client/hdsxyy/HisforhzfwhmessageResponse.class new file mode 100644 index 0000000..46bb72e Binary files /dev/null and b/health_his/target/classes/cn/his/client/hdsxyy/HisforhzfwhmessageResponse.class differ diff --git a/health_his/target/classes/cn/his/client/hdsxyy/NWzfservice.class b/health_his/target/classes/cn/his/client/hdsxyy/NWzfservice.class new file mode 100644 index 0000000..f19087b Binary files /dev/null and b/health_his/target/classes/cn/his/client/hdsxyy/NWzfservice.class differ diff --git a/health_his/target/classes/cn/his/client/hdsxyy/NWzfserviceSoap.class b/health_his/target/classes/cn/his/client/hdsxyy/NWzfserviceSoap.class new file mode 100644 index 0000000..8ad748e Binary files /dev/null and b/health_his/target/classes/cn/his/client/hdsxyy/NWzfserviceSoap.class differ diff --git a/health_his/target/classes/cn/his/client/hdsxyy/ObjectFactory.class b/health_his/target/classes/cn/his/client/hdsxyy/ObjectFactory.class new file mode 100644 index 0000000..aa27fe0 Binary files /dev/null and b/health_his/target/classes/cn/his/client/hdsxyy/ObjectFactory.class differ diff --git a/health_his/target/classes/cn/his/client/wasdyrmyy/GetData.class b/health_his/target/classes/cn/his/client/wasdyrmyy/GetData.class new file mode 100644 index 0000000..cdbbe48 Binary files /dev/null and b/health_his/target/classes/cn/his/client/wasdyrmyy/GetData.class differ diff --git a/health_his/target/classes/cn/his/client/wasdyrmyy/GetDataResponse.class b/health_his/target/classes/cn/his/client/wasdyrmyy/GetDataResponse.class new file mode 100644 index 0000000..f6bdd27 Binary files /dev/null and b/health_his/target/classes/cn/his/client/wasdyrmyy/GetDataResponse.class differ diff --git a/health_his/target/classes/cn/his/client/wasdyrmyy/HISDataService.class b/health_his/target/classes/cn/his/client/wasdyrmyy/HISDataService.class new file mode 100644 index 0000000..9674221 Binary files /dev/null and b/health_his/target/classes/cn/his/client/wasdyrmyy/HISDataService.class differ diff --git a/health_his/target/classes/cn/his/client/wasdyrmyy/Hisforhzfwhmessage.class b/health_his/target/classes/cn/his/client/wasdyrmyy/Hisforhzfwhmessage.class new file mode 100644 index 0000000..c9d615b Binary files /dev/null and b/health_his/target/classes/cn/his/client/wasdyrmyy/Hisforhzfwhmessage.class differ diff --git a/health_his/target/classes/cn/his/client/wasdyrmyy/HisforhzfwhmessageResponse.class b/health_his/target/classes/cn/his/client/wasdyrmyy/HisforhzfwhmessageResponse.class new file mode 100644 index 0000000..16de6c0 Binary files /dev/null and b/health_his/target/classes/cn/his/client/wasdyrmyy/HisforhzfwhmessageResponse.class differ diff --git a/health_his/target/classes/cn/his/client/wasdyrmyy/NWzfservice.class b/health_his/target/classes/cn/his/client/wasdyrmyy/NWzfservice.class new file mode 100644 index 0000000..1dc6c2e Binary files /dev/null and b/health_his/target/classes/cn/his/client/wasdyrmyy/NWzfservice.class differ diff --git a/health_his/target/classes/cn/his/client/wasdyrmyy/NWzfserviceSoap.class b/health_his/target/classes/cn/his/client/wasdyrmyy/NWzfserviceSoap.class new file mode 100644 index 0000000..bc9effa Binary files /dev/null and b/health_his/target/classes/cn/his/client/wasdyrmyy/NWzfserviceSoap.class differ diff --git a/health_his/target/classes/cn/his/client/wasdyrmyy/ObjectFactory.class b/health_his/target/classes/cn/his/client/wasdyrmyy/ObjectFactory.class new file mode 100644 index 0000000..f068a2f Binary files /dev/null and b/health_his/target/classes/cn/his/client/wasdyrmyy/ObjectFactory.class differ diff --git a/health_his/target/classes/cn/his/client/wasdyrmyy/Test.class b/health_his/target/classes/cn/his/client/wasdyrmyy/Test.class new file mode 100644 index 0000000..5c6b997 Binary files /dev/null and b/health_his/target/classes/cn/his/client/wasdyrmyy/Test.class differ diff --git a/health_his/target/classes/cn/his/client/wasdyrmyy/TestResponse.class b/health_his/target/classes/cn/his/client/wasdyrmyy/TestResponse.class new file mode 100644 index 0000000..0f02be1 Binary files /dev/null and b/health_his/target/classes/cn/his/client/wasdyrmyy/TestResponse.class differ diff --git a/health_his/target/classes/cn/his/client/wasdyrmyy/package-info.class b/health_his/target/classes/cn/his/client/wasdyrmyy/package-info.class new file mode 100644 index 0000000..8e4488c Binary files /dev/null and b/health_his/target/classes/cn/his/client/wasdyrmyy/package-info.class differ diff --git a/health_his/target/health_his.jar b/health_his/target/health_his.jar new file mode 100644 index 0000000..e8ad715 Binary files /dev/null and b/health_his/target/health_his.jar differ diff --git a/health_his/target/maven-archiver/pom.properties b/health_his/target/maven-archiver/pom.properties new file mode 100644 index 0000000..63ee33a --- /dev/null +++ b/health_his/target/maven-archiver/pom.properties @@ -0,0 +1,3 @@ +version=1.0.2 +groupId=cn.health.service +artifactId=health_his diff --git a/health_his/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/health_his/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 0000000..7088446 --- /dev/null +++ b/health_his/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1,27 @@ +cn/his/client/wasdyrmyy/HISDataService.class +cn/his/client/hdsxyy/ObjectFactory.class +cn/card/health/his/service/hdzxy/HisCallService.class +cn/his/client/gdbh/HisforhzfwhmessageResponse.class +cn/his/client/hdsxyy/NWzfservice.class +cn/his/client/wasdyrmyy/NWzfserviceSoap.class +cn/his/client/wasdyrmyy/package-info.class +cn/card/health/his/service/HisResult.class +cn/his/client/wasdyrmyy/TestResponse.class +cn/his/client/wasdyrmyy/Test.class +cn/his/client/wasdyrmyy/HisforhzfwhmessageResponse.class +cn/card/health/his/service/IHisCallService.class +cn/card/health/config/wasdyrmyy/WechatHospConfig.class +cn/his/client/hdsxyy/NWzfserviceSoap.class +cn/card/health/his/service/ClientConnection.class +cn/his/client/hdsxyy/HisforhzfwhmessageResponse.class +cn/his/client/gdbh/ObjectFactory.class +cn/his/client/gdbh/NWzfservice.class +cn/his/client/gdbh/Hisforhzfwhmessage.class +cn/his/client/wasdyrmyy/ObjectFactory.class +cn/his/client/wasdyrmyy/GetDataResponse.class +cn/card/health/his/service/hdzxy/HisWebClient.class +cn/his/client/hdsxyy/Hisforhzfwhmessage.class +cn/his/client/wasdyrmyy/GetData.class +cn/his/client/wasdyrmyy/Hisforhzfwhmessage.class +cn/his/client/wasdyrmyy/NWzfservice.class +cn/his/client/gdbh/NWzfserviceSoap.class diff --git a/health_his/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/health_his/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 0000000..04e3f93 --- /dev/null +++ b/health_his/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1,27 @@ +/Users/circlexing/work_java/1/health_parent/health_his/src/main/java/cn/his/client/wasdyrmyy/Hisforhzfwhmessage.java +/Users/circlexing/work_java/1/health_parent/health_his/src/main/java/cn/card/health/his/service/hdzxy/HisCallService.java +/Users/circlexing/work_java/1/health_parent/health_his/src/main/java/cn/his/client/wasdyrmyy/HISDataService.java +/Users/circlexing/work_java/1/health_parent/health_his/src/main/java/cn/his/client/wasdyrmyy/NWzfserviceSoap.java +/Users/circlexing/work_java/1/health_parent/health_his/src/main/java/cn/his/client/gdbh/HisforhzfwhmessageResponse.java +/Users/circlexing/work_java/1/health_parent/health_his/src/main/java/cn/his/client/gdbh/NWzfserviceSoap.java +/Users/circlexing/work_java/1/health_parent/health_his/src/main/java/cn/his/client/gdbh/NWzfservice.java +/Users/circlexing/work_java/1/health_parent/health_his/src/main/java/cn/his/client/gdbh/Hisforhzfwhmessage.java +/Users/circlexing/work_java/1/health_parent/health_his/src/main/java/cn/his/client/hdsxyy/NWzfservice.java +/Users/circlexing/work_java/1/health_parent/health_his/src/main/java/cn/his/client/wasdyrmyy/HisforhzfwhmessageResponse.java +/Users/circlexing/work_java/1/health_parent/health_his/src/main/java/cn/his/client/wasdyrmyy/Test.java +/Users/circlexing/work_java/1/health_parent/health_his/src/main/java/cn/his/client/wasdyrmyy/TestResponse.java +/Users/circlexing/work_java/1/health_parent/health_his/src/main/java/cn/card/health/his/service/IHisCallService.java +/Users/circlexing/work_java/1/health_parent/health_his/src/main/java/cn/card/health/his/service/HisResult.java +/Users/circlexing/work_java/1/health_parent/health_his/src/main/java/cn/his/client/wasdyrmyy/NWzfservice.java +/Users/circlexing/work_java/1/health_parent/health_his/src/main/java/cn/his/client/wasdyrmyy/ObjectFactory.java +/Users/circlexing/work_java/1/health_parent/health_his/src/main/java/cn/his/client/wasdyrmyy/GetData.java +/Users/circlexing/work_java/1/health_parent/health_his/src/main/java/cn/his/client/hdsxyy/HisforhzfwhmessageResponse.java +/Users/circlexing/work_java/1/health_parent/health_his/src/main/java/cn/his/client/hdsxyy/NWzfserviceSoap.java +/Users/circlexing/work_java/1/health_parent/health_his/src/main/java/cn/card/health/his/service/hdzxy/HisWebClient.java +/Users/circlexing/work_java/1/health_parent/health_his/src/main/java/cn/his/client/hdsxyy/ObjectFactory.java +/Users/circlexing/work_java/1/health_parent/health_his/src/main/java/cn/card/health/config/wasdyrmyy/WechatHospConfig.java +/Users/circlexing/work_java/1/health_parent/health_his/src/main/java/cn/his/client/wasdyrmyy/GetDataResponse.java +/Users/circlexing/work_java/1/health_parent/health_his/src/main/java/cn/his/client/gdbh/ObjectFactory.java +/Users/circlexing/work_java/1/health_parent/health_his/src/main/java/cn/his/client/hdsxyy/Hisforhzfwhmessage.java +/Users/circlexing/work_java/1/health_parent/health_his/src/main/java/cn/his/client/wasdyrmyy/package-info.java +/Users/circlexing/work_java/1/health_parent/health_his/src/main/java/cn/card/health/his/service/ClientConnection.java diff --git a/health_his/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst b/health_his/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst new file mode 100644 index 0000000..e69de29 diff --git a/health_his/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/health_his/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst new file mode 100644 index 0000000..e69de29 diff --git a/health_hosp/pom.xml b/health_hosp/pom.xml new file mode 100644 index 0000000..a22620b --- /dev/null +++ b/health_hosp/pom.xml @@ -0,0 +1,41 @@ + + + 4.0.0 + + cn.health.service + health-parent + 1.0.2 + + health_hosp + health_hosp + http://maven.apache.org + + UTF-8 + + + + junit + junit + test + + + cn.health.service + health_common + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + true + + + + + diff --git a/health_hosp/src/main/java/cn/card/health/bean/order/MedicalRecord.java b/health_hosp/src/main/java/cn/card/health/bean/order/MedicalRecord.java new file mode 100644 index 0000000..13830d5 --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/bean/order/MedicalRecord.java @@ -0,0 +1,422 @@ +package cn.card.health.bean.order; + +import java.io.Serializable; +import java.util.Date; + +public class MedicalRecord implements Serializable { + private String id; + + /** + * 微信号 + */ + private String openid; + + /** + * 患者索引号 + */ + private Long patientId; + + /** + * 患者姓名 + */ + private String patientName; + + /** + * 申请方式(1:本人,2:代理人) + */ + private Integer applyType; + + /** + * 申请人姓名 + */ + private String name; + + /** + * 申请人身份证号码 + */ + private String idNumber; + + /** + * 本人身份证正面照 + */ + private String img1; + + /** + * 本人身份证反面照 + */ + private String img2; + + /** + * 代理人身份证正面照 + */ + private String img3; + + /** + * 代理人身份证正面照 + */ + private String img4; + + /** + * 复印份数 + */ + private Integer copies; + + /** + * 每份页数 + */ + private Integer pages; + + /** + * 总金额(单位为分) + */ + private Integer amount; + + /** + * 提取方式(1:邮寄,2:自提) + */ + private Integer receiveType; + + /** + * 收件人姓名 + */ + private String receiveName; + + /** + * 收件人手机号码 + */ + private String receivePhone; + + /** + * 收件地址 + */ + private String receiveAddress; + + /** + * 快递公司 + */ + private String expressCompany; + + /** + * 快递单号 + */ + private String expressNo; + + /** + * 是否需要发票(0:不需要, 1:需要) + */ + private Integer invoice; + + /** + * 发票号码 + */ + private String invoiceNo; + + /** + * 状态(1、待审核,2、待支付,3、已支付,4、已快递,5、取消,6、驳回) + */ + private Integer status; + + /** + * 说明 + */ + private String remark; + + /** + * 支付订单号 + */ + private String orderNo; + + /** + * 删除标记 + */ + private Integer delFlag; + + /** + * 申请时间 + */ + private Date createTime; + + /** + * 更新时间 + */ + private Date updateTime; + + /** + * 处理人 + */ + private String updateBy; + + /** + * 用途 + */ + private String purpose; + + private static final long serialVersionUID = 1L; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getOpenid() { + return openid; + } + + public void setOpenid(String openid) { + this.openid = openid; + } + + public Long getPatientId() { + return patientId; + } + + public void setPatientId(Long patientId) { + this.patientId = patientId; + } + + public String getPatientName() { + return patientName; + } + + public void setPatientName(String patientName) { + this.patientName = patientName; + } + + public Integer getApplyType() { + return applyType; + } + + public void setApplyType(Integer applyType) { + this.applyType = applyType; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getIdNumber() { + return idNumber; + } + + public void setIdNumber(String idNumber) { + this.idNumber = idNumber; + } + + public String getImg1() { + return img1; + } + + public void setImg1(String img1) { + this.img1 = img1; + } + + public String getImg2() { + return img2; + } + + public void setImg2(String img2) { + this.img2 = img2; + } + + public String getImg3() { + return img3; + } + + public void setImg3(String img3) { + this.img3 = img3; + } + + public String getImg4() { + return img4; + } + + public void setImg4(String img4) { + this.img4 = img4; + } + + public Integer getCopies() { + return copies; + } + + public void setCopies(Integer copies) { + this.copies = copies; + } + + public Integer getPages() { + return pages; + } + + public void setPages(Integer pages) { + this.pages = pages; + } + + public Integer getAmount() { + return amount; + } + + public void setAmount(Integer amount) { + this.amount = amount; + } + + public Integer getReceiveType() { + return receiveType; + } + + public void setReceiveType(Integer receiveType) { + this.receiveType = receiveType; + } + + public String getReceiveName() { + return receiveName; + } + + public void setReceiveName(String receiveName) { + this.receiveName = receiveName; + } + + public String getReceivePhone() { + return receivePhone; + } + + public void setReceivePhone(String receivePhone) { + this.receivePhone = receivePhone; + } + + public String getReceiveAddress() { + return receiveAddress; + } + + public void setReceiveAddress(String receiveAddress) { + this.receiveAddress = receiveAddress; + } + + public String getExpressCompany() { + return expressCompany; + } + + public void setExpressCompany(String expressCompany) { + this.expressCompany = expressCompany; + } + + public String getExpressNo() { + return expressNo; + } + + public void setExpressNo(String expressNo) { + this.expressNo = expressNo; + } + + public Integer getInvoice() { + return invoice; + } + + public void setInvoice(Integer invoice) { + this.invoice = invoice; + } + + public String getInvoiceNo() { + return invoiceNo; + } + + public void setInvoiceNo(String invoiceNo) { + this.invoiceNo = invoiceNo; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getOrderNo() { + return orderNo; + } + + public void setOrderNo(String orderNo) { + this.orderNo = orderNo; + } + + public Integer getDelFlag() { + return delFlag; + } + + public void setDelFlag(Integer delFlag) { + this.delFlag = delFlag; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + public String getUpdateBy() { + return updateBy; + } + + public void setUpdateBy(String updateBy) { + this.updateBy = updateBy; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + + /** + * 申请时间 + */ + private String createTimeFormat; + + public void setCreateTimeFormat(String createTimeFormat) { + this.createTimeFormat = createTimeFormat; + } + + public String getCreateTimeFormat() { + return this.createTimeFormat; + } + + /** + * 更新时间 + */ + private String updateTimeFormat; + + public void setUpdateTimeFormat(String updateTimeFormat) { + this.updateTimeFormat = updateTimeFormat; + } + + public String getUpdateTimeFormat() { + return this.updateTimeFormat; + } +} diff --git a/health_hosp/src/main/java/cn/card/health/bean/order/MkHisParams.java b/health_hosp/src/main/java/cn/card/health/bean/order/MkHisParams.java new file mode 100644 index 0000000..a96948d --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/bean/order/MkHisParams.java @@ -0,0 +1,86 @@ +package cn.card.health.bean.order; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.Serializable; +import java.util.Date; + +/** + * 支付宝小程序请求对象 mk_applet_request + * + * @author ruoyi + * @date 2022-10-15 + */ +public class MkHisParams implements Serializable +{ + private static final long serialVersionUID = 1L; + + /** 主键 */ + private Long mkId; + + + /** 请求方法 */ + private String mkMethod; + + /** 小程序请求数据 */ + private String mkRequestData; + + /** 小程序返回数据 */ + private String mkResponseData; + /** + * 创建时间 + */ + private Date createTime; + + public Long getMkId() { + return mkId; + } + + public void setMkId(Long mkId) { + this.mkId = mkId; + } + + public String getMkMethod() { + return mkMethod; + } + + public void setMkMethod(String mkMethod) { + this.mkMethod = mkMethod; + } + + public String getMkRequestData() { + return mkRequestData; + } + + public void setMkRequestData(String mkRequestData) { + this.mkRequestData = mkRequestData; + } + + public String getMkResponseData() { + return mkResponseData; + } + + public void setMkResponseData(String mkResponseData) { + this.mkResponseData = mkResponseData; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + @Override + public String toString() { + + ObjectMapper objectMapper = new ObjectMapper(); + try { + return objectMapper.writeValueAsString(this); + } catch (JsonProcessingException e) { + e.printStackTrace(); + return null; + } + } +} diff --git a/health_hosp/src/main/java/cn/card/health/bean/order/YcOrder.java b/health_hosp/src/main/java/cn/card/health/bean/order/YcOrder.java new file mode 100644 index 0000000..d5d7fba --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/bean/order/YcOrder.java @@ -0,0 +1,287 @@ +package cn.card.health.bean.order; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import io.swagger.annotations.ApiModelProperty; + +import java.io.Serializable; +import java.util.Date; + +/** + * @author tt + * @date 2021-07-06 12:15:47 + */ +public class YcOrder implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "") + private Long orderid; + /** + * 患者主键 + */ + private Long patientid; + /** + * 微信openid + */ + private String openid; + /** + * 订单类型 + */ + @ApiModelProperty(value = "订单类型") + private String ordertype; + /** + * 订单编号 + */ + private String orderno; + /** + * 删除状态 + */ + private Integer delFlag; + /** + * 订单状态 + */ + private Integer orderStatus; + /** + * 创建时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createtime; + /** + * 原因 + */ + private String reason; + /** + * 用户标志 + */ + private Long userid; + /** + * 医院标志主键 自费 是否支付宝支付:1支付宝;2余额 + */ + private Long hospid; + + private Integer totalmoney; + + /** + * 是否医保 1是 2否 + */ + private boolean isInsure; + + /** + * 1支付宝 2余额 + */ + private boolean isAlipay; + + private String hisOrderId; + + private String hisOrderPayId; + + private String receiptId; + + private Integer insureStatus; + + private Integer hisStatus; + + private Integer payStatus; + private String begdate; + private String enddate; + + + public Long getOrderid() { + return orderid; + } + + public void setOrderid(Long orderid) { + this.orderid = orderid; + } + + public String getOrderno() { + return orderno; + } + + public void setOrderno(String orderno) { + this.orderno = orderno; + } + + public String getOrdertype() { + return ordertype; + } + + public void setOrdertype(String ordertype) { + this.ordertype = ordertype; + } + + public Integer getDelFlag() { + return delFlag; + } + + public void setDelFlag(Integer delFlag) { + this.delFlag = delFlag; + } + + public Integer getOrderStatus() { + return orderStatus; + } + + public void setOrderStatus(Integer orderStatus) { + this.orderStatus = orderStatus; + } + + public Date getCreatetime() { + return createtime; + } + + public void setCreatetime(Date createtime) { + this.createtime = createtime; + } + + public String getReason() { + return reason; + } + + public void setReason(String reason) { + this.reason = reason; + } + + public Long getHospid() { + return hospid; + } + + public void setHospid(Long hospid) { + this.hospid = hospid; + } + + public Long getPatientid() { + return patientid; + } + + public void setPatientid(Long patientid) { + this.patientid = patientid; + } + + public String getOpenid() { + return openid; + } + + public void setOpenid(String openid) { + this.openid = openid; + } + + public Long getUserid() { + return userid; + } + + public void setUserid(Long userid) { + this.userid = userid; + } + + public Integer getTotalmoney() { + return totalmoney; + } + + public void setTotalmoney(Integer totalmoney) { + this.totalmoney = totalmoney; + } + + public String getHisOrderId() { + return hisOrderId; + } + + public void setHisOrderId(String hisOrderId) { + this.hisOrderId = hisOrderId; + } + + public String getHisOrderPayId() { + return hisOrderPayId; + } + + public void setHisOrderPayId(String hisOrderPayId) { + this.hisOrderPayId = hisOrderPayId; + } + + + public String getReceiptId() { + return receiptId; + } + + public void setReceiptId(String receiptId) { + this.receiptId = receiptId; + } + + public boolean isInsure() { + if(hospid == null){ + return false; + } + isInsure = (hospid.intValue() & 0xC) == 4; + return isInsure; + } + + public void setInsure(boolean insure) { + isInsure = insure; + } + + public boolean isAlipay() { + if(hospid == null){ + return false; + } + isAlipay = (hospid.intValue() & 0x3) == 1; + return isAlipay; + } + + public void setAlipay(boolean alipay) { + isAlipay = alipay; + } + + public Integer getInsureStatus() { + return insureStatus; + } + + public void setInsureStatus(Integer insureStatus) { + this.insureStatus = insureStatus; + } + + public Integer getHisStatus() { + return hisStatus; + } + + public void setHisStatus(Integer hisStatus) { + this.hisStatus = hisStatus; + } + + public Integer getPayStatus() { + return payStatus; + } + + public void setPayStatus(Integer payStatus) { + this.payStatus = payStatus; + } + + public String getBegdate() { + return begdate; + } + + public void setBegdate(String begdate) { + this.begdate = begdate; + } + + public String getEnddate() { + return enddate; + } + + public void setEnddate(String enddate) { + this.enddate = enddate; + } + + @Override + public String toString() { + + ObjectMapper objectMapper = new ObjectMapper(); + try { + return objectMapper.writeValueAsString(this); + } catch (JsonProcessingException e) { + e.printStackTrace(); + return null; + } + } +} \ No newline at end of file diff --git a/health_hosp/src/main/java/cn/card/health/bean/order/YcOrderClinic.java b/health_hosp/src/main/java/cn/card/health/bean/order/YcOrderClinic.java new file mode 100644 index 0000000..ecdb511 --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/bean/order/YcOrderClinic.java @@ -0,0 +1,233 @@ +package cn.card.health.bean.order; + +import java.io.Serializable; +import java.util.Date; + +/** + * 门诊缴费订单 + * + * @author xinggm + * @email + * @date 2021-08-10 17:00:29 + */ +public class YcOrderClinic implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 诊间订单主键 + */ + private Long clinicOrderid; + /** + * 订单主键 + */ + private Long orderid; + /** + * 订单编号 + */ + private String orderno; + /** + * 病人主键 + */ + private Long patientid; + /** + * + */ + private String openid; + /** + * HIS病人标志 + */ + private String hisPatientid; + /** + * 医院HIS标志 + */ + private String hisid; + /** + * + */ + private String hislockid; + /** + * HIS订单主键 + */ + private String hisOrderid; + /** + * his 挂号标志 + */ + private String visitid; + /** + * 医院标志 + */ + private String hospid; + /** + * 科室编号 + */ + private String deptno; + /** + * 科室名称 + */ + private String deptname; + /** + * 医生编码 + */ + private String doctorno; + /** + * 医生名称 + */ + private String doctorname; + /** + * 总金额 + */ + private Long totalmoney; + /** + * 创建时间 + */ + private Date createtime; + /** + * 更新时间 + */ + private Date updatetime; + + public Long getClinicOrderid() { + return clinicOrderid; + } + + public void setClinicOrderid(Long clinicOrderid) { + this.clinicOrderid = clinicOrderid; + } + + public Long getOrderid() { + return orderid; + } + + public void setOrderid(Long orderid) { + this.orderid = orderid; + } + + public String getOrderno() { + return orderno; + } + + public void setOrderno(String orderno) { + this.orderno = orderno; + } + + public Long getPatientid() { + return patientid; + } + + public void setPatientid(Long patientid) { + this.patientid = patientid; + } + + public String getOpenid() { + return openid; + } + + public void setOpenid(String openid) { + this.openid = openid; + } + + public String getHisPatientid() { + return hisPatientid; + } + + public void setHisPatientid(String hisPatientid) { + this.hisPatientid = hisPatientid; + } + + public String getHisid() { + return hisid; + } + + public void setHisid(String hisid) { + this.hisid = hisid; + } + + public String getHislockid() { + return hislockid; + } + + public void setHislockid(String hislockid) { + this.hislockid = hislockid; + } + + public String getHisOrderid() { + return hisOrderid; + } + + public void setHisOrderid(String hisOrderid) { + this.hisOrderid = hisOrderid; + } + + public String getHospid() { + return hospid; + } + + public void setHospid(String hospid) { + this.hospid = hospid; + } + + public String getVisitid() { + return visitid; + } + + public void setVisitid(String visitid) { + this.visitid = visitid; + } + + public String getDeptno() { + return deptno; + } + + public void setDeptno(String deptno) { + this.deptno = deptno; + } + + public String getDeptname() { + return deptname; + } + + public void setDeptname(String deptname) { + this.deptname = deptname; + } + + public String getDoctorno() { + return doctorno; + } + + public void setDoctorno(String doctorno) { + this.doctorno = doctorno; + } + + public String getDoctorname() { + return doctorname; + } + + public void setDoctorname(String doctorname) { + this.doctorname = doctorname; + } + + public Long getTotalmoney() { + return totalmoney; + } + + public void setTotalmoney(Long totalmoney) { + this.totalmoney = totalmoney; + } + + public Date getCreatetime() { + return createtime; + } + + public void setCreatetime(Date createtime) { + this.createtime = createtime; + } + + public Date getUpdatetime() { + return updatetime; + } + + public void setUpdatetime(Date updatetime) { + this.updatetime = updatetime; + } + +} diff --git a/health_hosp/src/main/java/cn/card/health/bean/order/YcOrderClinicDetail.java b/health_hosp/src/main/java/cn/card/health/bean/order/YcOrderClinicDetail.java new file mode 100644 index 0000000..16d4406 --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/bean/order/YcOrderClinicDetail.java @@ -0,0 +1,194 @@ +package cn.card.health.bean.order; + +import java.io.Serializable; +import java.util.Date; + +/** + * 门诊交费订单详情 + * + * @author xinggm + * @email + * @date 2021-08-10 17:00:28 + */ +public class YcOrderClinicDetail implements Serializable { + private static final long serialVersionUID = 1L; + + /** 主键 */ +private Long clinicDetailid; + /** 订单主键 */ +private Long orderid; + /** 诊间订单主键 */ +private Long clinicOrderid; + /** 病人主键 */ +private Long patientid; + /** 接诊科室名称 */ +private String deptname; + /** 接诊医生姓名 */ +private String doctorname; + /** 未缴费总金额,单位:分 */ +private Long payamount; + /** */ +private String detailtypeid; + /** */ +private String detailfee; + /** 缴费细目流水号,要求唯一 */ +private String detailid; + /** 缴费细目名称 */ +private String detailname; + /** 缴费细目数量 */ +private String detailcount; + /** 缴费细目单位 */ +private String detailunit; + /** 缴费细目金额,单位:分 */ +private String detailamount; + /** 缴费规格 */ +private String detailspec; + /** 缴费细目单价,单位:分 */ +private String detailprice; + + + public Long getClinicDetailid() { + return clinicDetailid; + } + + public void setClinicDetailid(Long clinicDetailid) { + this.clinicDetailid = clinicDetailid; + } + + + public Long getOrderid() { + return orderid; + } + + public void setOrderid(Long orderid) { + this.orderid = orderid; + } + + + public Long getClinicOrderid() { + return clinicOrderid; + } + + public void setClinicOrderid(Long clinicOrderid) { + this.clinicOrderid = clinicOrderid; + } + + + public Long getPatientid() { + return patientid; + } + + public void setPatientid(Long patientid) { + this.patientid = patientid; + } + + + public String getDeptname() { + return deptname; + } + + public void setDeptname(String deptname) { + this.deptname = deptname; + } + + + public String getDoctorname() { + return doctorname; + } + + public void setDoctorname(String doctorname) { + this.doctorname = doctorname; + } + + + public Long getPayamount() { + return payamount; + } + + public void setPayamount(Long payamount) { + this.payamount = payamount; + } + + + public String getDetailtypeid() { + return detailtypeid; + } + + public void setDetailtypeid(String detailtypeid) { + this.detailtypeid = detailtypeid; + } + + + public String getDetailfee() { + return detailfee; + } + + public void setDetailfee(String detailfee) { + this.detailfee = detailfee; + } + + + public String getDetailid() { + return detailid; + } + + public void setDetailid(String detailid) { + this.detailid = detailid; + } + + + public String getDetailname() { + return detailname; + } + + public void setDetailname(String detailname) { + this.detailname = detailname; + } + + + public String getDetailcount() { + return detailcount; + } + + public void setDetailcount(String detailcount) { + this.detailcount = detailcount; + } + + + public String getDetailunit() { + return detailunit; + } + + public void setDetailunit(String detailunit) { + this.detailunit = detailunit; + } + + + public String getDetailamount() { + return detailamount; + } + + public void setDetailamount(String detailamount) { + this.detailamount = detailamount; + } + + + public String getDetailspec() { + return detailspec; + } + + public void setDetailspec(String detailspec) { + this.detailspec = detailspec; + } + + + public String getDetailprice() { + return detailprice; + } + + public void setDetailprice(String detailprice) { + this.detailprice = detailprice; + } + + +} diff --git a/health_hosp/src/main/java/cn/card/health/bean/order/YcOrderInhosp.java b/health_hosp/src/main/java/cn/card/health/bean/order/YcOrderInhosp.java new file mode 100644 index 0000000..981d9af --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/bean/order/YcOrderInhosp.java @@ -0,0 +1,149 @@ +package cn.card.health.bean.order; + +import java.io.Serializable; +import java.util.Date; + +/** + * 住院预缴订单 + * + * @author xinggm + * @email + * @date 2021-09-07 14:12:41 + */ +public class YcOrderInhosp implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 住院预缴订单主键 + */ + private Long inhospOrderid; + /** + * 订单主键 + */ + private Long orderid; + /** + * 订单编号 + */ + private String orderno; + /** + * his订单主键 + */ + private String hisOrderid; + /** + * 病人主键 + */ + private Long patientid; + /** + * 开放平台主键 + */ + private String openid; + /** + * 用户主键 + */ + private Long userid; + /** + * 总金额 + */ + private Integer totalmoney; + /** + * 删除标志 + */ + private Integer delFlag; + /** + * 创建时间 + */ + private Date createtime; + /** + * 更新时间 + */ + private Date updatetime; + + public Long getInhospOrderid() { + return inhospOrderid; + } + + public void setInhospOrderid(Long inhospOrderid) { + this.inhospOrderid = inhospOrderid; + } + + public Long getOrderid() { + return orderid; + } + + public void setOrderid(Long orderid) { + this.orderid = orderid; + } + + public String getOrderno() { + return orderno; + } + + public void setOrderno(String orderno) { + this.orderno = orderno; + } + + public String getHisOrderid() { + return hisOrderid; + } + + public void setHisOrderid(String hisOrderid) { + this.hisOrderid = hisOrderid; + } + + public Long getPatientid() { + return patientid; + } + + public void setPatientid(Long patientid) { + this.patientid = patientid; + } + + public String getOpenid() { + return openid; + } + + public void setOpenid(String openid) { + this.openid = openid; + } + + public Long getUserid() { + return userid; + } + + public void setUserid(Long userid) { + this.userid = userid; + } + + public Integer getTotalmoney() { + return totalmoney; + } + + public void setTotalmoney(Integer totalmoney) { + this.totalmoney = totalmoney; + } + + public Integer getDelFlag() { + return delFlag; + } + + public void setDelFlag(Integer delFlag) { + this.delFlag = delFlag; + } + + public Date getCreatetime() { + return createtime; + } + + public void setCreatetime(Date createtime) { + this.createtime = createtime; + } + + public Date getUpdatetime() { + return updatetime; + } + + public void setUpdatetime(Date updatetime) { + this.updatetime = updatetime; + } + +} diff --git a/health_hosp/src/main/java/cn/card/health/bean/order/YcOrderRefundpay.java b/health_hosp/src/main/java/cn/card/health/bean/order/YcOrderRefundpay.java new file mode 100644 index 0000000..98e0a7d --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/bean/order/YcOrderRefundpay.java @@ -0,0 +1,139 @@ +package cn.card.health.bean.order; + +import java.io.Serializable; +import java.util.Date; + +import io.swagger.annotations.ApiModelProperty; + +//import io.swagger.annotations.ApiModelProperty; +/** + * + * + * @author tt + * @date 2021-07-06 12:15:47 + */ +public class YcOrderRefundpay implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "") + private Long refundpayid; + + @ApiModelProperty(value = "") + private Long orderid; + + @ApiModelProperty(value = "") + private Long serialpayid; + + @ApiModelProperty(value = "退款商户订单号") + private String outrefundno; + + @ApiModelProperty(value = "退款订单号") + private String refundid; + + @ApiModelProperty(value = "") + private String paytype; + + @ApiModelProperty(value = "") + private Integer money; + + @ApiModelProperty(value = "") + private Integer refundstatus; + + @ApiModelProperty(value = "") + private Date refundtime; + + @ApiModelProperty(value = "") + private Date createtime; + + @ApiModelProperty(value = "") + private Date modifytime; + + public Long getRefundpayid() { + return refundpayid; + } + + public void setRefundpayid(Long refundpayid) { + this.refundpayid = refundpayid; + } + + public Long getOrderid() { + return orderid; + } + + public void setOrderid(Long orderid) { + this.orderid = orderid; + } + + public Long getSerialpayid() { + return serialpayid; + } + + public void setSerialpayid(Long serialpayid) { + this.serialpayid = serialpayid; + } + + public String getPaytype() { + return paytype; + } + + public void setPaytype(String paytype) { + this.paytype = paytype; + } + + public Integer getMoney() { + return money; + } + + public void setMoney(Integer money) { + this.money = money; + } + + public String getOutrefundno() { + return outrefundno; + } + + public void setOutrefundno(String outrefundno) { + this.outrefundno = outrefundno; + } + + public String getRefundid() { + return refundid; + } + + public void setRefundid(String refundid) { + this.refundid = refundid; + } + + public Integer getRefundstatus() { + return refundstatus; + } + + public void setRefundstatus(Integer refundstatus) { + this.refundstatus = refundstatus; + } + + public Date getRefundtime() { + return refundtime; + } + + public void setRefundtime(Date refundtime) { + this.refundtime = refundtime; + } + + public Date getCreatetime() { + return createtime; + } + + public void setCreatetime(Date createtime) { + this.createtime = createtime; + } + + public Date getModifytime() { + return modifytime; + } + + public void setModifytime(Date modifytime) { + this.modifytime = modifytime; + } +} \ No newline at end of file diff --git a/health_hosp/src/main/java/cn/card/health/bean/order/YcOrderRegist.java b/health_hosp/src/main/java/cn/card/health/bean/order/YcOrderRegist.java new file mode 100644 index 0000000..0a9c11a --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/bean/order/YcOrderRegist.java @@ -0,0 +1,457 @@ +package cn.card.health.bean.order; + +import cn.card.health.bean.hospital.YcPatient; +import com.alibaba.fastjson.JSONObject; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import io.swagger.annotations.ApiModelProperty; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import java.util.Map; + +/** + * 挂号订单表 + * + * @author tt + * @date 2021-07-06 12:15:47 + */ +public class YcOrderRegist implements Serializable { + + private static final long serialVersionUID = 1L; + + public YcOrderRegist() { + } + + public YcOrderRegist(JSONObject params) { + this.patientid = params.getLong("patientid"); + this.hisPatientid = params.getString("memberid"); +// this.openid = params.get("openid"); +// this.hospid = params.getString("hospid"); + this.deptno = params.getString("depart_id"); + this.deptname = params.getString("depart_name"); + this.doctorno = params.getString("doctor_id"); + this.doctorname = params.getString("doctor_name"); + this.regdate = params.getString("regdate"); + this.begintime = params.getString("begintime"); + this.endtime = params.getString("endtime"); +// this.scheduleFlag = params.getString("scheduleFlag"); + BigDecimal a100 = new BigDecimal(100); + this.totalmoney = params.getBigDecimal("doctor_price").multiply(a100).intValue(); +// this.fee =params.getBigDecimal("")*100 +// this.treatfee = Integer.parseInt(params.get("treatFee")); +// this.totalmoney = Integer.parseInt(params.get("totalmoney")); + } + + /** + * 挂号订单主键 + */ + @ApiModelProperty(value = "挂号订单主键") + private Long registOrderid; + + /** + * 订单主键 + */ + @ApiModelProperty(value = "订单主键") + private Long orderid; + + /** + * 订单编号 + */ + private String orderno; + + private String ordertype; + + /** + * 就诊卡主键 + */ + @ApiModelProperty(value = "就诊卡主键") + private Long patientid; + + /** + * + */ + @ApiModelProperty(value = "") + private String hisPatientid; + + /** + * 支付宝微信用户openid + */ + private String openid; + + /** + * + */ + @ApiModelProperty(value = "") + private String hisid; + + private String memberid; + + @ApiModelProperty(value = "his锁号标志") + private String hisLockid; + + /** + * 医院主键 + */ + @ApiModelProperty(value = "医院主键") + private String hospid; + + /** + * 科室代码 + */ + @ApiModelProperty(value = "科室代码") + private String deptno; + + /** + * 科室名称 + */ + @ApiModelProperty(value = "科室名称") + private String deptname; + + /** + * 医生编码 + */ + @ApiModelProperty(value = "医生编码") + private String doctorno; + + /** + * 医生名称 + */ + @ApiModelProperty(value = "医生名称") + private String doctorname; + + /** + * 挂号日期 + */ + @ApiModelProperty(value = "挂号日期") + private String regdate; + + /** + * 开始时间 + */ + @ApiModelProperty(value = "开始时间") + private String begintime; + + /** + * 结束时间 + */ + @ApiModelProperty(value = "结束时间") + private String endtime; + + /** + * 班别 + */ + @ApiModelProperty(value = "班别") + private String scheduleFlag; + + /** + * + */ + @ApiModelProperty(value = "") + private String hisOrderid; + + /** + * 挂号费 + */ + @ApiModelProperty(value = "挂号费") + private Integer fee; + + /** + * 诊疗费 + */ + @ApiModelProperty(value = "诊疗费") + private Integer treatfee; + + /** + * 总金额 + */ + @ApiModelProperty(value = "总金额") + private Integer totalmoney; + + /** + * 订单状态 + */ + @ApiModelProperty(value = "订单状态") + private String orderstatus; + + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间") + private Date createtime; + + @ApiModelProperty(value = "更新时间") + private Date updatetime; + + @ApiModelProperty(value = "备注") + private String remark; + + /** + * 订单 + */ + private YcOrder ycOrder; + + /** + * 订单流程 + */ + private YcOrderSerialpay serialpay; + + /** + * 健康卡病人信息 + */ + private YcPatient patient; + + public Long getRegistOrderid() { + return registOrderid; + } + + public void setRegistOrderid(Long registOrderid) { + this.registOrderid = registOrderid; + } + + public Long getOrderid() { + return orderid; + } + + public void setOrderid(Long orderid) { + this.orderid = orderid; + } + + public String getOrderno() { + return orderno; + } + + public void setOrderno(String orderno) { + this.orderno = orderno; + } + + public Long getPatientid() { + return patientid; + } + + public void setPatientid(Long patientid) { + this.patientid = patientid; + } + + public String getHisPatientid() { + return hisPatientid; + } + + public String getOpenid() { + return openid; + } + + public void setOpenid(String openid) { + this.openid = openid; + } + + public void setHisPatientid(String hisPatientid) { + this.hisPatientid = hisPatientid; + } + + public String getHisid() { + return hisid; + } + + public void setHisid(String hisid) { + this.hisid = hisid; + } + + public String getHospid() { + return hospid; + } + + public void setHospid(String hospid) { + this.hospid = hospid; + } + + public String getDeptno() { + return deptno; + } + + public void setDeptno(String deptno) { + this.deptno = deptno; + } + + public String getDeptname() { + return deptname; + } + + public void setDeptname(String deptname) { + this.deptname = deptname; + } + + public String getDoctorno() { + return doctorno; + } + + public void setDoctorno(String doctorno) { + this.doctorno = doctorno; + } + + public String getDoctorname() { + return doctorname; + } + + public void setDoctorname(String doctorname) { + this.doctorname = doctorname; + } + + public String getRegdate() { + return regdate; + } + + public void setRegdate(String regdate) { + this.regdate = regdate; + } + + public String getBegintime() { + return begintime; + } + + public void setBegintime(String begintime) { + this.begintime = begintime; + } + + public String getEndtime() { + return endtime; + } + + public void setEndtime(String endtime) { + this.endtime = endtime; + } + + + public String getScheduleFlag() { + return scheduleFlag; + } + + public void setScheduleFlag(String scheduleFlag) { + this.scheduleFlag = scheduleFlag; + } + + public String getHisOrderid() { + return hisOrderid; + } + + public void setHisOrderid(String hisOrderid) { + this.hisOrderid = hisOrderid; + } + + public String getHisLockid() { + return hisLockid; + } + + public void setHisLockid(String hisLockid) { + this.hisLockid = hisLockid; + } + + public Integer getFee() { + return fee; + } + + public void setFee(Integer fee) { + this.fee = fee; + } + + public Integer getTreatfee() { + return treatfee; + } + + public void setTreatfee(Integer treatfee) { + this.treatfee = treatfee; + } + + public Integer getTotalmoney() { + return totalmoney; + } + + public void setTotalmoney(Integer totalmoney) { + this.totalmoney = totalmoney; + } + + public String getOrderstatus() { + return orderstatus; + } + + public void setOrderstatus(String orderstatus) { + this.orderstatus = orderstatus; + } + + public Date getCreatetime() { + return createtime; + } + + public void setCreatetime(Date createtime) { + this.createtime = createtime; + } + + public Date getUpdatetime() { + return updatetime; + } + + public void setUpdatetime(Date updatetime) { + this.updatetime = updatetime; + } + + public YcOrder getYcOrder() { + return ycOrder; + } + + public void setYcOrder(YcOrder ycOrder) { + this.ycOrder = ycOrder; + } + + public YcOrderSerialpay getSerialpay() { + return serialpay; + } + + public void setSerialpay(YcOrderSerialpay serialpay) { + this.serialpay = serialpay; + } + + public YcPatient getPatient() { + return patient; + } + + public void setPatient(YcPatient patient) { + this.patient = patient; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + + public String getOrdertype() { + return ordertype; + } + + public void setOrdertype(String ordertype) { + this.ordertype = ordertype; + } + + public String getMemberid() { + return memberid; + } + + public void setMemberid(String memberid) { + this.memberid = memberid; + } + @Override + public String toString() { + + ObjectMapper objectMapper = new ObjectMapper(); + try { + return objectMapper.writeValueAsString(this); + } catch (JsonProcessingException e) { + e.printStackTrace(); + return null; + } + } +} \ No newline at end of file diff --git a/health_hosp/src/main/java/cn/card/health/bean/order/YcOrderSerialpay.java b/health_hosp/src/main/java/cn/card/health/bean/order/YcOrderSerialpay.java new file mode 100644 index 0000000..ce45fa7 --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/bean/order/YcOrderSerialpay.java @@ -0,0 +1,323 @@ +package cn.card.health.bean.order; + +import cn.card.health.common.utils.DateUtils; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; + +import java.io.Serializable; +import java.util.Date; +import java.util.Random; + +/** + * @author tt + * @date 2021-07-06 12:15:47 + */ +public class YcOrderSerialpay implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "") + private Long serialpayid; + + @ApiModelProperty(value = "订单主键") + private Long orderid; + + @ApiModelProperty(value = "患者主键") + private Long patientid; + + @ApiModelProperty(value = "医院标志") + private Long hospid; + + @ApiModelProperty(value = "金额") + private Integer money; + + @ApiModelProperty(value = "") + private Date paytime; + + @ApiModelProperty(value = "业务类型") + private String businesstype; + + @ApiModelProperty(value = "设备编号") + private String serialno; + + @ApiModelProperty(value = "支付状态") + private Integer paystatus; + /** + * 用户标志 + */ + private String openid; + /** + * 商户订单号 + */ + @ApiModelProperty(value = "商户订单号") + private String outtradeno; + + @ApiModelProperty(value = "支付方式") + private String paytype; + + @ApiModelProperty(value = "预支付订单标志") + private String prepayid; + + @ApiModelProperty(value = "第三方支付订单标志") + private String transactionid; + + @ApiModelProperty(value = "支付随机字符串") + private String paynocestr; + + @ApiModelProperty(value = "支付名称") + private String payname; + + @ApiModelProperty(value = "支付金额") + private Integer paymoney; + + @ApiModelProperty(value = "总金额") + private Integer totalmoney; + + @ApiModelProperty(value = "支付说明") + private String description; + + @ApiModelProperty(value = "用户标志") + private String userno; + + @ApiModelProperty(value = "") + private String createip; + + @ApiModelProperty(value = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createtime; + + @ApiModelProperty(value = "更新时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date updatetime; + + @ApiModelProperty(value = "删除标志 1正常;2删除") + private Integer delFlag; + + public static String getOuttradeno(String paytype, String ordertype) { + String outTradeNo = ""; + if ("alipay".equals(paytype)) { + outTradeNo = "a"; + } else if ("yue".equals(paytype)) { + outTradeNo = "e"; + + } else if ("bank".equals(paytype)) { + outTradeNo = "b"; + } else { + outTradeNo = "o"; + } + if ("regist".equals(ordertype)) { + outTradeNo = "r" + outTradeNo; + } else if ("card".equals(ordertype)) { + outTradeNo = "d" + outTradeNo; + } else if ("clinic".equals(ordertype)) { + outTradeNo = "c" + outTradeNo; + } else { + outTradeNo = "o" + outTradeNo; + } + outTradeNo = outTradeNo + DateUtils.getDateTimes() + (10 + new Random().nextInt(89)); + + + return outTradeNo; + } + + public Long getSerialpayid() { + return serialpayid; + } + + public void setSerialpayid(Long serialpayid) { + this.serialpayid = serialpayid; + } + + public Long getOrderid() { + return orderid; + } + + public void setOrderid(Long orderid) { + this.orderid = orderid; + } + + public Long getCardid() { + return patientid; + } + + public String getOpenid() { + return openid; + } + + public void setOpenid(String openid) { + this.openid = openid; + } + + public void setCardid(Long patientid) { + this.patientid = patientid; + } + + public Long getHospid() { + return hospid; + } + + public void setHospid(Long hospid) { + this.hospid = hospid; + } + + public Integer getMoney() { + return money; + } + + public void setMoney(Integer money) { + this.money = money; + } + + public String getBusinesstype() { + return businesstype; + } + + public void setBusinesstype(String businesstype) { + this.businesstype = businesstype; + } + + public String getSerialno() { + return serialno; + } + + public void setSerialno(String serialno) { + this.serialno = serialno; + } + + public String getOuttradeno() { + return outtradeno; + } + + public void setOuttradeno(String outtradeno) { + this.outtradeno = outtradeno; + } + + public Long getPatientid() { + return patientid; + } + + public void setPatientid(Long patientid) { + this.patientid = patientid; + } + + public String getPrepayid() { + return prepayid; + } + + public void setPrepayid(String prepayid) { + this.prepayid = prepayid; + } + + public String getTransactionid() { + return transactionid; + } + + public void setTransactionid(String transactionid) { + this.transactionid = transactionid; + } + + public Integer getDelFlag() { + return delFlag; + } + + public void setDelFlag(Integer delFlag) { + this.delFlag = delFlag; + } + + public String getPaytype() { + return paytype; + } + + public void setPaytype(String paytype) { + this.paytype = paytype; + } + + public Date getPaytime() { + return paytime; + } + + public void setPaytime(Date paytime) { + this.paytime = paytime; + } + + public String getPayname() { + return payname; + } + + public void setPayname(String payname) { + this.payname = payname; + } + + public String getPaynocestr() { + return paynocestr; + } + + public void setPaynocestr(String paynocestr) { + this.paynocestr = paynocestr; + } + + public Integer getPaymoney() { + return paymoney; + } + + public void setPaymoney(Integer paymoney) { + this.paymoney = paymoney; + } + + public Integer getTotalmoney() { + return totalmoney; + } + + public void setTotalmoney(Integer totalmoney) { + this.totalmoney = totalmoney; + } + + public String getUserno() { + return userno; + } + + public void setUserno(String userno) { + this.userno = userno; + } + + public String getCreateip() { + return createip; + } + + public void setCreateip(String createip) { + this.createip = createip; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Date getCreatetime() { + return createtime; + } + + public void setCreatetime(Date createtime) { + this.createtime = createtime; + } + + public Date getUpdatetime() { + return updatetime; + } + + public void setUpdatetime(Date updatetime) { + this.updatetime = updatetime; + } + + public Integer getPaystatus() { + return paystatus; + } + + public void setPaystatus(Integer paystatus) { + this.paystatus = paystatus; + } + +} \ No newline at end of file diff --git a/health_hosp/src/main/java/cn/card/health/bean/order/YcRegistSource.java b/health_hosp/src/main/java/cn/card/health/bean/order/YcRegistSource.java new file mode 100644 index 0000000..581054f --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/bean/order/YcRegistSource.java @@ -0,0 +1,178 @@ +package cn.card.health.bean.order; + +import java.io.Serializable; +import java.util.Date; + +/** + * 挂号号源信息 + * + * @author xinggm + * @email + * @date 2021-08-14 17:50:10 + */ +public class YcRegistSource implements Serializable { + private static final long serialVersionUID = 1L; + + /** 号源主键 */ + private Long sourceid; + /** 医院主键 */ + private Long hospid; + /** 科室编码 */ + private String deptno; + /** 科室名称 */ + private String deptname; + /** 医生编码 */ + private String doctorno; + /** 医生名称 */ + private String doctorname; + /** 出诊日期(周几) */ + private String regweekday; + /** 挂号日期 */ + private String regdate; + /** 剩余号源 */ + private Long regleavecount; + /** 出诊状态 */ + private String regstatus; + /** 号源总数量 */ + private Long regtotalcount; + /** 班别 上午下午 */ + private String scheduletype; + /** 挂号费 */ + private Long regfee; + /** 诊疗费 */ + private Long treatfee; + /** 是否挂号到具体时段 */ + private String istimereg; + + /** 创建时间 */ + private Date createtime; + + public Long getSourceid() { + return sourceid; + } + + public void setSourceid(Long sourceid) { + this.sourceid = sourceid; + } + + public Long getHospid() { + return hospid; + } + + public void setHospid(Long hospid) { + this.hospid = hospid; + } + + public String getDeptno() { + return deptno; + } + + public void setDeptno(String deptno) { + this.deptno = deptno; + } + + public String getDeptname() { + return deptname; + } + + public void setDeptname(String deptname) { + this.deptname = deptname; + } + + public String getDoctorno() { + return doctorno; + } + + public void setDoctorno(String doctorno) { + this.doctorno = doctorno; + } + + public String getDoctorname() { + return doctorname; + } + + public void setDoctorname(String doctorname) { + this.doctorname = doctorname; + } + + public String getRegweekday() { + return regweekday; + } + + public void setRegweekday(String regweekday) { + this.regweekday = regweekday; + } + + public String getRegdate() { + return regdate; + } + + public void setRegdate(String regdate) { + this.regdate = regdate; + } + + public Long getRegleavecount() { + return regleavecount; + } + + public void setRegleavecount(Long regleavecount) { + this.regleavecount = regleavecount; + } + + public String getRegstatus() { + return regstatus; + } + + public void setRegstatus(String regstatus) { + this.regstatus = regstatus; + } + + public Long getRegtotalcount() { + return regtotalcount; + } + + public void setRegtotalcount(Long regtotalcount) { + this.regtotalcount = regtotalcount; + } + + public String getScheduletype() { + return scheduletype; + } + + public void setScheduletype(String scheduletype) { + this.scheduletype = scheduletype; + } + + public Long getRegfee() { + return regfee; + } + + public void setRegfee(Long regfee) { + this.regfee = regfee; + } + + public Long getTreatfee() { + return treatfee; + } + + public void setTreatfee(Long treatfee) { + this.treatfee = treatfee; + } + + public String getIstimereg() { + return istimereg; + } + + public void setIstimereg(String istimereg) { + this.istimereg = istimereg; + } + + public Date getCreatetime() { + return createtime; + } + + public void setCreatetime(Date createtime) { + this.createtime = createtime; + } + +} diff --git a/health_hosp/src/main/java/cn/card/health/bean/order/YcSourceShedule.java b/health_hosp/src/main/java/cn/card/health/bean/order/YcSourceShedule.java new file mode 100644 index 0000000..0a16391 --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/bean/order/YcSourceShedule.java @@ -0,0 +1,117 @@ +package cn.card.health.bean.order; + +import java.io.Serializable; +import java.util.Date; + +/** + * 号源排班表 + * + * @author xinggm + * @email + * @date 2021-08-14 17:50:10 + */ +public class YcSourceShedule implements Serializable { + private static final long serialVersionUID = 1L; + + /** 号源主键 */ + private Long sheduleid; + /** 医院主键 */ + private Long hospid; + /** 挂号信息主键 */ + private Long sourceid; + /** 可预约号源总数量 */ + private Long regtotalcount; + /** 剩余号源数量 */ + private Long regleavecount; + /** 就诊顺序号 */ + private String visitsnum; + /** 分时开始时间 */ + private String begintime; + /** 分时结束时间 */ + private String endtime; + /** */ + private Long signalsourceid; + /** 创建时间 */ + private Date createtime; + + public Long getSheduleid() { + return sheduleid; + } + + public void setSheduleid(Long sheduleid) { + this.sheduleid = sheduleid; + } + + public Long getHospid() { + return hospid; + } + + public void setHospid(Long hospid) { + this.hospid = hospid; + } + + public Long getSourceid() { + return sourceid; + } + + public void setSourceid(Long sourceid) { + this.sourceid = sourceid; + } + + public Long getRegtotalcount() { + return regtotalcount; + } + + public void setRegtotalcount(Long regtotalcount) { + this.regtotalcount = regtotalcount; + } + + public Long getRegleavecount() { + return regleavecount; + } + + public void setRegleavecount(Long regleavecount) { + this.regleavecount = regleavecount; + } + + public String getVisitsnum() { + return visitsnum; + } + + public void setVisitsnum(String visitsnum) { + this.visitsnum = visitsnum; + } + + public String getBegintime() { + return begintime; + } + + public void setBegintime(String begintime) { + this.begintime = begintime; + } + + public String getEndtime() { + return endtime; + } + + public void setEndtime(String endtime) { + this.endtime = endtime; + } + + public Long getSignalsourceid() { + return signalsourceid; + } + + public void setSignalsourceid(Long signalsourceid) { + this.signalsourceid = signalsourceid; + } + + public Date getCreatetime() { + return createtime; + } + + public void setCreatetime(Date createtime) { + this.createtime = createtime; + } + +} diff --git a/health_hosp/src/main/java/cn/card/health/mapper/hospital/YcHospitalMapper.java b/health_hosp/src/main/java/cn/card/health/mapper/hospital/YcHospitalMapper.java new file mode 100644 index 0000000..d084bb8 --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/mapper/hospital/YcHospitalMapper.java @@ -0,0 +1,33 @@ +package cn.card.health.mapper.hospital; + +import java.util.List; + +import cn.card.health.bean.hospital.YcHospital; + +/** + * 医院信息表 + * + * @author xinggm + * @email + * @date 2021-08-16 10:07:33 + */ +public interface YcHospitalMapper { + /** 新增 */ + public int insertYcHospital(YcHospital ycHospital); + + /** 删除 */ + public int deleteYcHospital(Long id); + + /** 更新 */ + public int updateYcHospital(YcHospital ycHospital); + + /** 根据主键查询 */ + public YcHospital selectYcHospitalById(Long id); + + /** 查询单条 */ + public YcHospital selectYcHospital(YcHospital ycHospital); + + /** 查询列表 */ + public List selectListYcHospital(YcHospital ycHospital); + +} diff --git a/health_hosp/src/main/java/cn/card/health/mapper/order/MedicalRecordMapper.java b/health_hosp/src/main/java/cn/card/health/mapper/order/MedicalRecordMapper.java new file mode 100644 index 0000000..350ae00 --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/mapper/order/MedicalRecordMapper.java @@ -0,0 +1,27 @@ +package cn.card.health.mapper.order; + +import cn.card.health.bean.order.MedicalRecord; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface MedicalRecordMapper { + int insert(MedicalRecord record); + + int insertSelective(MedicalRecord record); + + MedicalRecord selectById(String id); + + List selectByPatientId(Long patientId); + + List selectByOpenid(String openid); + + List selectApplying(Long patientId); + + int updateByIdSelective(MedicalRecord record); + + int updateById(MedicalRecord record); + + int updateByOrderNoSelective(MedicalRecord record); +} diff --git a/health_hosp/src/main/java/cn/card/health/mapper/order/MkHisParamsMapper.java b/health_hosp/src/main/java/cn/card/health/mapper/order/MkHisParamsMapper.java new file mode 100644 index 0000000..9edeb46 --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/mapper/order/MkHisParamsMapper.java @@ -0,0 +1,64 @@ +package cn.card.health.mapper.order; + +import cn.card.health.bean.order.MkHisParams; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 支付宝小程序请求Mapper接口 + * + * @author ruoyi + * @date 2022-10-15 + */ +@Mapper +public interface MkHisParamsMapper +{ + /** + * 查询支付宝小程序请求 + * + * @param mkId 支付宝小程序请求主键 + * @return 支付宝小程序请求 + */ + public MkHisParams selectMkHisParamsByMkId(Long mkId); + + /** + * 查询支付宝小程序请求列表 + * + * @param hisParams 支付宝小程序请求 + * @return 支付宝小程序请求集合 + */ + public List selectMkHisParamsList(MkHisParams hisParams); + + /** + * 新增支付宝小程序请求 + * + * @param hisParams 支付宝小程序请求 + * @return 结果 + */ + public Integer insertMkHisParams(MkHisParams hisParams); + + /** + * 修改支付宝小程序请求 + * + * @param hisParams 支付宝小程序请求 + * @return 结果 + */ + public int updateMkHisParams(MkHisParams hisParams); + + /** + * 删除支付宝小程序请求 + * + * @param mkId 支付宝小程序请求主键 + * @return 结果 + */ + public int deleteMkHisParamsByMkId(Long mkId); + + /** + * 批量删除支付宝小程序请求 + * + * @param mkIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteMkHisParamsByMkIds(Long[] mkIds); +} diff --git a/health_hosp/src/main/java/cn/card/health/mapper/order/YcOrderClinicDetailMapper.java b/health_hosp/src/main/java/cn/card/health/mapper/order/YcOrderClinicDetailMapper.java new file mode 100644 index 0000000..40ae3d6 --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/mapper/order/YcOrderClinicDetailMapper.java @@ -0,0 +1,33 @@ +package cn.card.health.mapper.order; + +import java.util.List; + +import cn.card.health.bean.order.YcOrderClinicDetail; + +/** + * 门诊交费订单详情 + * + * @author xinggm + * @email + * @date 2021-08-10 17:00:28 + */ +public interface YcOrderClinicDetailMapper { + /** 新增 */ + public int insertYcOrderClinicDetail(YcOrderClinicDetail ycOrderClinicDetail); + + /** 删除 */ + public int deleteYcOrderClinicDetail(Long id); + + /** 更新 */ + public int updateYcOrderClinicDetail(YcOrderClinicDetail ycOrderClinicDetail); + + /** 根据主键查询 */ + public YcOrderClinicDetail selectYcOrderClinicDetailById(Long id); + + /** 查询单条 */ + public YcOrderClinicDetail selectYcOrderClinicDetail(YcOrderClinicDetail ycOrderClinicDetail); + + /** 查询列表 */ + public List selectListYcOrderClinicDetail(YcOrderClinicDetail ycOrderClinicDetail); + +} diff --git a/health_hosp/src/main/java/cn/card/health/mapper/order/YcOrderClinicMapper.java b/health_hosp/src/main/java/cn/card/health/mapper/order/YcOrderClinicMapper.java new file mode 100644 index 0000000..2070389 --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/mapper/order/YcOrderClinicMapper.java @@ -0,0 +1,33 @@ +package cn.card.health.mapper.order; + +import java.util.List; + +import cn.card.health.bean.order.YcOrderClinic; + +/** + * 门诊缴费订单 + * + * @author xinggm + * @email + * @date 2021-08-10 17:00:29 + */ +public interface YcOrderClinicMapper { + /** 新增 */ + public int insertYcOrderClinic(YcOrderClinic ycOrderClinic); + + /** 删除 */ + public int deleteYcOrderClinic(Long id); + + /** 更新 */ + public int updateYcOrderClinic(YcOrderClinic ycOrderClinic); + + /** 根据主键查询 */ + public YcOrderClinic selectYcOrderClinicById(Long id); + + /** 查询单条 */ + public YcOrderClinic selectYcOrderClinic(YcOrderClinic ycOrderClinic); + + /** 查询列表 */ + public List selectListYcOrderClinic(YcOrderClinic ycOrderClinic); + +} diff --git a/health_hosp/src/main/java/cn/card/health/mapper/order/YcOrderInhospMapper.java b/health_hosp/src/main/java/cn/card/health/mapper/order/YcOrderInhospMapper.java new file mode 100644 index 0000000..47aad91 --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/mapper/order/YcOrderInhospMapper.java @@ -0,0 +1,33 @@ +package cn.card.health.mapper.order; + +import cn.card.health.bean.order.YcOrderInhosp; +import java.util.List; + +/** + * 住院预缴订单 + * + * + * @author xinggm + * @email + * @date 2021-09-07 14:12:41 + */ +public interface YcOrderInhospMapper { + /** 新增 */ + public int insertYcOrderInhosp(YcOrderInhosp ycOrderInhosp); + + /** 删除 */ + public int deleteYcOrderInhosp(Long id); + + /** 更新 */ + public int updateYcOrderInhosp(YcOrderInhosp ycOrderInhosp); + + /** 根据主键查询 */ + public YcOrderInhosp selectYcOrderInhospById(Long id); + + /** 查询单条 */ + public YcOrderInhosp selectYcOrderInhosp(YcOrderInhosp ycOrderInhosp); + + /** 查询列表 */ + public List selectListYcOrderInhosp(YcOrderInhosp ycOrderInhosp); + +} diff --git a/health_hosp/src/main/java/cn/card/health/mapper/order/YcOrderMapper.java b/health_hosp/src/main/java/cn/card/health/mapper/order/YcOrderMapper.java new file mode 100644 index 0000000..c0559e2 --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/mapper/order/YcOrderMapper.java @@ -0,0 +1,34 @@ +package cn.card.health.mapper.order; + +import java.util.List; + +import cn.card.health.bean.order.YcOrder; + +/** + * + * + * @author xinggm + * @email + * @date 2021-07-08 15:32:52 + */ +public interface YcOrderMapper { + /** 新增 */ + public int insertYcOrder(YcOrder ycOrder); + + /** 删除 */ + public int deleteYcOrder(Long id); + + /** 更新 */ + public int updateYcOrder(YcOrder ycOrder); + + /** 根据主键查询 */ + public YcOrder selectYcOrderById(Long id); + + /** 查询单条 */ + public YcOrder selectYcOrder(YcOrder ycOrder); + + /** 查询列表 */ + public List selectListYcOrder(YcOrder ycOrder); + + public List selectListYcOrderByDate(YcOrder ycOrder); +} diff --git a/health_hosp/src/main/java/cn/card/health/mapper/order/YcOrderRefundpayMapper.java b/health_hosp/src/main/java/cn/card/health/mapper/order/YcOrderRefundpayMapper.java new file mode 100644 index 0000000..e3b9b1f --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/mapper/order/YcOrderRefundpayMapper.java @@ -0,0 +1,38 @@ +package cn.card.health.mapper.order; + +import java.util.List; + +import cn.card.health.bean.order.YcOrderRefundpay; + + +/** + * + * + * @author xinggm + * @email + * @date 2021-07-08 15:32:53 + */ +public interface YcOrderRefundpayMapper { + + /** 新增 */ + public int insertYcOrderRefundpay(YcOrderRefundpay ycOrderRefundpay); + + /** 删除 */ + public int deleteYcOrderRefundpay(Long id); + + /** 更新 */ + public int updateYcOrderRefundpay(YcOrderRefundpay ycOrderRefundpay); + + /** 根据主键查询 */ + public YcOrderRefundpay selectYcOrderRefundpayById(Long id); + + /** 查询单条 */ + public YcOrderRefundpay selectYcOrderRefundpay(YcOrderRefundpay ycOrderRefundpay); + + /** 查询列表 */ + public List selectListYcOrderRefundpay(YcOrderRefundpay ycOrderRefundpay); + + /** 更新 */ + public int updateYcOrderRefundpayByOutRefundno(YcOrderRefundpay ycOrderRefundpay); + +} diff --git a/health_hosp/src/main/java/cn/card/health/mapper/order/YcOrderRegistMapper.java b/health_hosp/src/main/java/cn/card/health/mapper/order/YcOrderRegistMapper.java new file mode 100644 index 0000000..b97de56 --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/mapper/order/YcOrderRegistMapper.java @@ -0,0 +1,57 @@ +package cn.card.health.mapper.order; + +import cn.card.health.bean.order.YcOrderRegist; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.List; + +/** + * 挂号订单表 + * + * @author xinggm + * @email + * @date 2021-07-08 15:32:53 + */ +@Mapper +public interface YcOrderRegistMapper { + /** + * 新增 + */ + public int insertYcOrderRegist(YcOrderRegist ycOrderRegist); + + /** + * 删除 + */ + public int deleteYcOrderRegist(Long id); + + /** + * 更新 + */ + public int updateYcOrderRegist(YcOrderRegist ycOrderRegist); + + /** + * 根据主键查询 + */ + public YcOrderRegist selectYcOrderRegistById(Long id); + + /** + * 查询单条 + */ + public YcOrderRegist selectYcOrderRegist(YcOrderRegist ycOrderRegist); + + /** + * 查询列表 + */ + public List selectListYcOrderRegist(YcOrderRegist ycOrderRegist); + + /** + * 查询列表 + * 状态为1:待缴费,5:完成,6:已取消 近30天 + */ + public List selectRegistList(Long patientId); + + @Select("select * from yc_order_regist where patientid = #{patientId} and regDate >= #{regDate} and orderStatus = 1") + public List selectUnpaidRegisterList(@Param("patientId") Long patientId, @Param("regDate") String regDate); +} diff --git a/health_hosp/src/main/java/cn/card/health/mapper/order/YcOrderSerialpayMapper.java b/health_hosp/src/main/java/cn/card/health/mapper/order/YcOrderSerialpayMapper.java new file mode 100644 index 0000000..44e4889 --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/mapper/order/YcOrderSerialpayMapper.java @@ -0,0 +1,36 @@ +package cn.card.health.mapper.order; + +import java.util.List; + +import cn.card.health.bean.order.YcOrderSerialpay; + +/** + * + * + * @author xinggm + * @email + * @date 2021-07-08 15:32:53 + */ +public interface YcOrderSerialpayMapper { + /** 新增 */ + public int insertYcOrderSerialpay(YcOrderSerialpay ycOrderSerialpay); + + /** 删除 */ + public int deleteYcOrderSerialpay(Long id); + + /** 更新 */ + public int updateYcOrderSerialpay(YcOrderSerialpay ycOrderSerialpay); + + /** 根据主键查询 */ + public YcOrderSerialpay selectYcOrderSerialpayById(Long id); + + /** 查询单条 */ + public YcOrderSerialpay selectYcOrderSerialpay(YcOrderSerialpay ycOrderSerialpay); + + /** 查询列表 */ + public List selectListYcOrderSerialpay(YcOrderSerialpay ycOrderSerialpay); + + /** 更新支付结果 */ + public int updateYcOrderSerialpayByOuttradeno(YcOrderSerialpay ycOrderSerialpay); + +} diff --git a/health_hosp/src/main/java/cn/card/health/mapper/order/YcRegistSourceMapper.java b/health_hosp/src/main/java/cn/card/health/mapper/order/YcRegistSourceMapper.java new file mode 100644 index 0000000..d50af5a --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/mapper/order/YcRegistSourceMapper.java @@ -0,0 +1,33 @@ +package cn.card.health.mapper.order; + +import java.util.List; + +import cn.card.health.bean.order.YcRegistSource; + +/** + * 挂号号源信息 + * + * @author xinggm + * @email + * @date 2021-08-14 17:50:10 + */ +public interface YcRegistSourceMapper { + /** 新增 */ + public int insertYcRegistSource(YcRegistSource ycRegistSource); + + /** 删除 */ + public int deleteYcRegistSource(Long id); + + /** 更新 */ + public int updateYcRegistSource(YcRegistSource ycRegistSource); + + /** 根据主键查询 */ + public YcRegistSource selectYcRegistSourceById(Long id); + + /** 查询单条 */ + public YcRegistSource selectYcRegistSource(YcRegistSource ycRegistSource); + + /** 查询列表 */ + public List selectListYcRegistSource(YcRegistSource ycRegistSource); + +} diff --git a/health_hosp/src/main/java/cn/card/health/mapper/order/YcSourceSheduleMapper.java b/health_hosp/src/main/java/cn/card/health/mapper/order/YcSourceSheduleMapper.java new file mode 100644 index 0000000..7226bd1 --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/mapper/order/YcSourceSheduleMapper.java @@ -0,0 +1,33 @@ +package cn.card.health.mapper.order; + +import java.util.List; + +import cn.card.health.bean.order.YcSourceShedule; + +/** + * 号源排班表 + * + * @author xinggm + * @email + * @date 2021-08-14 17:50:10 + */ +public interface YcSourceSheduleMapper { + /** 新增 */ + public int insertYcSourceShedule(YcSourceShedule ycSourceShedule); + + /** 删除 */ + public int deleteYcSourceShedule(Long id); + + /** 更新 */ + public int updateYcSourceShedule(YcSourceShedule ycSourceShedule); + + /** 根据主键查询 */ + public YcSourceShedule selectYcSourceSheduleById(Long id); + + /** 查询单条 */ + public YcSourceShedule selectYcSourceShedule(YcSourceShedule ycSourceShedule); + + /** 查询列表 */ + public List selectListYcSourceShedule(YcSourceShedule ycSourceShedule); + +} diff --git a/health_hosp/src/main/java/cn/card/health/service/hospital/IYcHospitalService.java b/health_hosp/src/main/java/cn/card/health/service/hospital/IYcHospitalService.java new file mode 100644 index 0000000..08d8665 --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/service/hospital/IYcHospitalService.java @@ -0,0 +1,34 @@ +package cn.card.health.service.hospital; + +import java.util.List; + +import cn.card.health.bean.hospital.YcHospital; + +/** + * 医院信息表 + * + * @author xinggm + * @email + * @date 2021-08-16 10:07:33 + */ +public interface IYcHospitalService { + + /** 新增 */ + public int insertYcHospital(YcHospital ycHospital); + + /** 删除 */ + public int deleteYcHospital(Long id); + + /** 更新 */ + public int updateYcHospital(YcHospital ycHospital); + + /** 根据主键查询 */ + public YcHospital selectYcHospitalById(Long id); + + /** 查询单条 */ + public YcHospital selectYcHospital(YcHospital ycHospital); + + /** 查询列表 */ + public List selectListYcHospital(YcHospital ycHospital); +} + diff --git a/health_hosp/src/main/java/cn/card/health/service/hospital/impl/YcHospitalServiceImpl.java b/health_hosp/src/main/java/cn/card/health/service/hospital/impl/YcHospitalServiceImpl.java new file mode 100644 index 0000000..1b5ce23 --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/service/hospital/impl/YcHospitalServiceImpl.java @@ -0,0 +1,48 @@ +package cn.card.health.service.hospital.impl; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import cn.card.health.bean.hospital.YcHospital; +import cn.card.health.mapper.hospital.YcHospitalMapper; +import cn.card.health.service.hospital.IYcHospitalService; + + +@Service +public class YcHospitalServiceImpl implements IYcHospitalService { + + @Autowired + private YcHospitalMapper ycHospitalMapper; + /** 新增 */ + public int insertYcHospital(YcHospital ycHospital){ + return ycHospitalMapper.insertYcHospital(ycHospital); + } + + /** 删除 */ + public int deleteYcHospital(Long id){ + return ycHospitalMapper.deleteYcHospital(id); + } + + /** 更新 */ + public int updateYcHospital(YcHospital ycHospital){ + return ycHospitalMapper.updateYcHospital(ycHospital); + } + + /** 根据主键查询 */ + public YcHospital selectYcHospitalById(Long id){ + return ycHospitalMapper.selectYcHospitalById(id); + } + + /** 查询单条 */ + public YcHospital selectYcHospital(YcHospital ycHospital){ + return ycHospitalMapper.selectYcHospital(ycHospital); + } + + /** 查询列表 */ + public List selectListYcHospital(YcHospital ycHospital){ + return ycHospitalMapper.selectListYcHospital(ycHospital); + } + +} \ No newline at end of file diff --git a/health_hosp/src/main/java/cn/card/health/service/impl/order/MedicalRecordServiceImpl.java b/health_hosp/src/main/java/cn/card/health/service/impl/order/MedicalRecordServiceImpl.java new file mode 100644 index 0000000..b8d7619 --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/service/impl/order/MedicalRecordServiceImpl.java @@ -0,0 +1,50 @@ +package cn.card.health.service.impl.order; + +import cn.card.health.bean.order.MedicalRecord; +import cn.card.health.mapper.order.MedicalRecordMapper; +import cn.card.health.service.order.IMedicalRecordService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service("medicalRecordService") +public class MedicalRecordServiceImpl implements IMedicalRecordService { + @Autowired + private MedicalRecordMapper medicalRecordMapper; + + @Override + public MedicalRecord selectById(String id) { + return medicalRecordMapper.selectById(id); + } + + @Override + public List selectByPatientId(Long paientId) { + return medicalRecordMapper.selectByPatientId(paientId); + } + + @Override + public List selectByOpenid(String openid) { + return medicalRecordMapper.selectByOpenid(openid); + } + + @Override + public List selectApplying(Long patientId) { + return medicalRecordMapper.selectApplying(patientId); + } + + @Override + public Integer insert(MedicalRecord medicalRecord) { + return medicalRecordMapper.insertSelective(medicalRecord); + } + + @Override + public Integer update(MedicalRecord medicalRecord) { + return medicalRecordMapper.updateByIdSelective(medicalRecord); + } + + @Override + public Integer updateByOrderNo(MedicalRecord medicalRecord) { + return medicalRecordMapper.updateByOrderNoSelective(medicalRecord); + } +} diff --git a/health_hosp/src/main/java/cn/card/health/service/impl/order/MkHisParamsServiceImpl.java b/health_hosp/src/main/java/cn/card/health/service/impl/order/MkHisParamsServiceImpl.java new file mode 100644 index 0000000..2b7880c --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/service/impl/order/MkHisParamsServiceImpl.java @@ -0,0 +1,97 @@ +package cn.card.health.service.impl.order; + +import cn.card.health.bean.order.MkHisParams; +import cn.card.health.common.utils.DateUtils; +import cn.card.health.mapper.order.MkHisParamsMapper; +import cn.card.health.service.order.IMkHisParamsService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 支付宝小程序请求Service业务层处理 + * + * @author ruoyi + * @date 2022-10-15 + */ +@Service +public class MkHisParamsServiceImpl implements IMkHisParamsService +{ + @Autowired + private MkHisParamsMapper mkHisParamsMapper; + + /** + * 查询支付宝小程序请求 + * + * @param mkId 支付宝小程序请求主键 + * @return 支付宝小程序请求 + */ + @Override + public MkHisParams selectMkHisParamsByMkId(Long mkId) + { + return mkHisParamsMapper.selectMkHisParamsByMkId(mkId); + } + + /** + * 查询支付宝小程序请求列表 + * + * @param mkHisParams 支付宝小程序请求 + * @return 支付宝小程序请求 + */ + @Override + public List selectMkHisParamsList(MkHisParams mkHisParams) + { + return mkHisParamsMapper.selectMkHisParamsList(mkHisParams); + } + + /** + * 新增支付宝小程序请求 + * + * @param mkHisParams 支付宝小程序请求 + * @return 结果 + */ + @Override + public Integer insertMkHisParams(MkHisParams mkHisParams) + { + mkHisParams.setCreateTime(DateUtils.getNowDate()); + Integer i= mkHisParamsMapper.insertMkHisParams(mkHisParams); + return i; + } + + /** + * 修改支付宝小程序请求 + * + * @param mkHisParams 支付宝小程序请求 + * @return 结果 + */ + @Override + public int updateMkHisParams(MkHisParams mkHisParams) + { + return mkHisParamsMapper.updateMkHisParams(mkHisParams); + } + + /** + * 批量删除支付宝小程序请求 + * + * @param mkIds 需要删除的支付宝小程序请求主键 + * @return 结果 + */ + @Override + public int deleteMkHisParamsByMkIds(Long[] mkIds) + { + return mkHisParamsMapper.deleteMkHisParamsByMkIds(mkIds); + } + + /** + * 删除支付宝小程序请求信息 + * + * @param mkId 支付宝小程序请求主键 + * @return 结果 + */ + @Override + public int deleteMkHisParamsByMkId(Long mkId) + { + return mkHisParamsMapper.deleteMkHisParamsByMkId(mkId); + } +} diff --git a/health_hosp/src/main/java/cn/card/health/service/impl/order/YcOrderClinicDetailServiceImpl.java b/health_hosp/src/main/java/cn/card/health/service/impl/order/YcOrderClinicDetailServiceImpl.java new file mode 100644 index 0000000..0527a97 --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/service/impl/order/YcOrderClinicDetailServiceImpl.java @@ -0,0 +1,46 @@ +package cn.card.health.service.impl.order; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; +import cn.card.health.mapper.order.YcOrderClinicDetailMapper; +import cn.card.health.bean.order.YcOrderClinicDetail; +import cn.card.health.service.order.IYcOrderClinicDetailService; + + +@Service +public class YcOrderClinicDetailServiceImpl implements IYcOrderClinicDetailService { + + @Autowired + private YcOrderClinicDetailMapper ycOrderClinicDetailMapper; + /** 新增 */ + public int insertYcOrderClinicDetail(YcOrderClinicDetail ycOrderClinicDetail){ + return ycOrderClinicDetailMapper.insertYcOrderClinicDetail(ycOrderClinicDetail); + } + + /** 删除 */ + public int deleteYcOrderClinicDetail(Long id){ + return ycOrderClinicDetailMapper.deleteYcOrderClinicDetail(id); + } + + /** 更新 */ + public int updateYcOrderClinicDetail(YcOrderClinicDetail ycOrderClinicDetail){ + return ycOrderClinicDetailMapper.updateYcOrderClinicDetail(ycOrderClinicDetail); + } + + /** 根据主键查询 */ + public YcOrderClinicDetail selectYcOrderClinicDetailById(Long id){ + return ycOrderClinicDetailMapper.selectYcOrderClinicDetailById(id); + } + + /** 查询单条 */ + public YcOrderClinicDetail selectYcOrderClinicDetail(YcOrderClinicDetail ycOrderClinicDetail){ + return ycOrderClinicDetailMapper.selectYcOrderClinicDetail(ycOrderClinicDetail); + } + + /** 查询列表 */ + public List selectListYcOrderClinicDetail(YcOrderClinicDetail ycOrderClinicDetail){ + return ycOrderClinicDetailMapper.selectListYcOrderClinicDetail(ycOrderClinicDetail); + } +} \ No newline at end of file diff --git a/health_hosp/src/main/java/cn/card/health/service/impl/order/YcOrderClinicServiceImpl.java b/health_hosp/src/main/java/cn/card/health/service/impl/order/YcOrderClinicServiceImpl.java new file mode 100644 index 0000000..7a7f3eb --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/service/impl/order/YcOrderClinicServiceImpl.java @@ -0,0 +1,46 @@ +package cn.card.health.service.impl.order; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import java.util.List; +import cn.card.health.mapper.order.YcOrderClinicMapper; +import cn.card.health.bean.order.YcOrderClinic; +import cn.card.health.service.order.IYcOrderClinicService; + + +@Service +public class YcOrderClinicServiceImpl implements IYcOrderClinicService { + + @Autowired + private YcOrderClinicMapper ycOrderClinicMapper; + /** 新增 */ + public int insertYcOrderClinic(YcOrderClinic ycOrderClinic){ + return ycOrderClinicMapper.insertYcOrderClinic(ycOrderClinic); + } + + /** 删除 */ + public int deleteYcOrderClinic(Long id){ + return ycOrderClinicMapper.deleteYcOrderClinic(id); + } + + /** 更新 */ + public int updateYcOrderClinic(YcOrderClinic ycOrderClinic){ + return ycOrderClinicMapper.updateYcOrderClinic(ycOrderClinic); + } + + /** 根据主键查询 */ + public YcOrderClinic selectYcOrderClinicById(Long id){ + return ycOrderClinicMapper.selectYcOrderClinicById(id); + } + + /** 查询单条 */ + public YcOrderClinic selectYcOrderClinic(YcOrderClinic ycOrderClinic){ + return ycOrderClinicMapper.selectYcOrderClinic(ycOrderClinic); + } + + /** 查询列表 */ + public List selectListYcOrderClinic(YcOrderClinic ycOrderClinic){ + return ycOrderClinicMapper.selectListYcOrderClinic(ycOrderClinic); + } + +} \ No newline at end of file diff --git a/health_hosp/src/main/java/cn/card/health/service/impl/order/YcOrderInhospServiceImpl.java b/health_hosp/src/main/java/cn/card/health/service/impl/order/YcOrderInhospServiceImpl.java new file mode 100644 index 0000000..ccff325 --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/service/impl/order/YcOrderInhospServiceImpl.java @@ -0,0 +1,46 @@ +package cn.card.health.service.impl.order; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import java.util.List; +import cn.card.health.mapper.order.YcOrderInhospMapper; +import cn.card.health.bean.order.YcOrderInhosp; +import cn.card.health.service.order.IYcOrderInhospService; + + +@Service +public class YcOrderInhospServiceImpl implements IYcOrderInhospService { + + @Autowired + private YcOrderInhospMapper ycOrderInhospMapper; + /** 新增 */ + public int insertYcOrderInhosp(YcOrderInhosp ycOrderInhosp){ + return ycOrderInhospMapper.insertYcOrderInhosp(ycOrderInhosp); + } + + /** 删除 */ + public int deleteYcOrderInhosp(Long id){ + return ycOrderInhospMapper.deleteYcOrderInhosp(id); + } + + /** 更新 */ + public int updateYcOrderInhosp(YcOrderInhosp ycOrderInhosp){ + return ycOrderInhospMapper.updateYcOrderInhosp(ycOrderInhosp); + } + + /** 根据主键查询 */ + public YcOrderInhosp selectYcOrderInhospById(Long id){ + return ycOrderInhospMapper.selectYcOrderInhospById(id); + } + + /** 查询单条 */ + public YcOrderInhosp selectYcOrderInhosp(YcOrderInhosp ycOrderInhosp){ + return ycOrderInhospMapper.selectYcOrderInhosp(ycOrderInhosp); + } + + /** 查询列表 */ + public List selectListYcOrderInhosp(YcOrderInhosp ycOrderInhosp){ + return ycOrderInhospMapper.selectListYcOrderInhosp(ycOrderInhosp); + } + +} \ No newline at end of file diff --git a/health_hosp/src/main/java/cn/card/health/service/impl/order/YcOrderRefundpayServiceImpl.java b/health_hosp/src/main/java/cn/card/health/service/impl/order/YcOrderRefundpayServiceImpl.java new file mode 100644 index 0000000..5a4bfe1 --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/service/impl/order/YcOrderRefundpayServiceImpl.java @@ -0,0 +1,51 @@ +package cn.card.health.service.impl.order; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import java.util.List; +import cn.card.health.mapper.order.YcOrderRefundpayMapper; +import cn.card.health.bean.order.YcOrderRefundpay; +import cn.card.health.service.order.IYcOrderRefundpayService; + + +@Service +public class YcOrderRefundpayServiceImpl implements IYcOrderRefundpayService { + + @Autowired + private YcOrderRefundpayMapper ycOrderRefundpayMapper; + /** 新增 */ + public int insertYcOrderRefundpay(YcOrderRefundpay ycOrderRefundpay){ + return ycOrderRefundpayMapper.insertYcOrderRefundpay(ycOrderRefundpay); + } + + /** 删除 */ + public int deleteYcOrderRefundpay(Long id){ + return ycOrderRefundpayMapper.deleteYcOrderRefundpay(id); + } + + /** 更新 */ + public int updateYcOrderRefundpay(YcOrderRefundpay ycOrderRefundpay){ + return ycOrderRefundpayMapper.updateYcOrderRefundpay(ycOrderRefundpay); + } + + /** 根据主键查询 */ + public YcOrderRefundpay selectYcOrderRefundpayById(Long id){ + return ycOrderRefundpayMapper.selectYcOrderRefundpayById(id); + } + + /** 查询单条 */ + public YcOrderRefundpay selectYcOrderRefundpay(YcOrderRefundpay ycOrderRefundpay){ + return ycOrderRefundpayMapper.selectYcOrderRefundpay(ycOrderRefundpay); + } + + /** 查询列表 */ + public List selectListYcOrderRefundpay(YcOrderRefundpay ycOrderRefundpay){ + return ycOrderRefundpayMapper.selectListYcOrderRefundpay(ycOrderRefundpay); + } + + @Override + public int updateYcOrderRefundpayByOutRefundno(YcOrderRefundpay ycOrderRefundpay) { + return ycOrderRefundpayMapper.updateYcOrderRefundpayByOutRefundno(ycOrderRefundpay); + } + +} \ No newline at end of file diff --git a/health_hosp/src/main/java/cn/card/health/service/impl/order/YcOrderRegistServiceImpl.java b/health_hosp/src/main/java/cn/card/health/service/impl/order/YcOrderRegistServiceImpl.java new file mode 100644 index 0000000..185dba1 --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/service/impl/order/YcOrderRegistServiceImpl.java @@ -0,0 +1,75 @@ +package cn.card.health.service.impl.order; + +import cn.card.health.bean.order.YcOrderRegist; +import cn.card.health.mapper.order.YcOrderRegistMapper; +import cn.card.health.service.order.IYcOrderRegistService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class YcOrderRegistServiceImpl implements IYcOrderRegistService { + + @Autowired + private YcOrderRegistMapper ycOrderRegistMapper; + + /** + * 新增 + */ + @Override + public synchronized int insertYcOrderRegist(YcOrderRegist ycOrderRegist) { + return ycOrderRegistMapper.insertYcOrderRegist(ycOrderRegist); + } + + /** + * 删除 + */ + @Override + public int deleteYcOrderRegist(Long id) { + return ycOrderRegistMapper.deleteYcOrderRegist(id); + } + + /** + * 更新 + */ + @Override + public int updateYcOrderRegist(YcOrderRegist ycOrderRegist) { + return ycOrderRegistMapper.updateYcOrderRegist(ycOrderRegist); + } + + /** + * 根据主键查询 + */ + @Override + public YcOrderRegist selectYcOrderRegistById(Long id) { + return ycOrderRegistMapper.selectYcOrderRegistById(id); + } + + /** + * 查询单条 + */ + @Override + public YcOrderRegist selectYcOrderRegist(YcOrderRegist ycOrderRegist) { + return ycOrderRegistMapper.selectYcOrderRegist(ycOrderRegist); + } + + /** + * 查询列表 + */ + @Override + public List selectListYcOrderRegist(YcOrderRegist ycOrderRegist) { + return ycOrderRegistMapper.selectListYcOrderRegist(ycOrderRegist); + } + + @Override + public List selectRegistList(Long patientId) { + return ycOrderRegistMapper.selectRegistList(patientId); + } + + @Override + public List selectUnpaidRegisterList(Long patientId, String regDate) { + return ycOrderRegistMapper.selectUnpaidRegisterList(patientId, regDate); + } + +} \ No newline at end of file diff --git a/health_hosp/src/main/java/cn/card/health/service/impl/order/YcOrderSerialpayServiceImpl.java b/health_hosp/src/main/java/cn/card/health/service/impl/order/YcOrderSerialpayServiceImpl.java new file mode 100644 index 0000000..77e6423 --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/service/impl/order/YcOrderSerialpayServiceImpl.java @@ -0,0 +1,61 @@ +package cn.card.health.service.impl.order; + +import java.util.List; + +import cn.card.health.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import cn.card.health.bean.order.YcOrderSerialpay; +import cn.card.health.mapper.order.YcOrderSerialpayMapper; +import cn.card.health.service.order.IYcOrderSerialpayService; + + +@Service +public class YcOrderSerialpayServiceImpl implements IYcOrderSerialpayService { + + @Autowired + private YcOrderSerialpayMapper ycOrderSerialpayMapper; + /** 新增 */ + @Override + public int insertYcOrderSerialpay(YcOrderSerialpay ycOrderSerialpay){ + ycOrderSerialpay.setDelFlag(1); + ycOrderSerialpay.setCreatetime(DateUtils.getNowDate()); + return ycOrderSerialpayMapper.insertYcOrderSerialpay(ycOrderSerialpay); + } + + /** 删除 */ + @Override + public int deleteYcOrderSerialpay(Long id){ + return ycOrderSerialpayMapper.deleteYcOrderSerialpay(id); + } + + /** 更新 */ + @Override + public int updateYcOrderSerialpay(YcOrderSerialpay ycOrderSerialpay){ + return ycOrderSerialpayMapper.updateYcOrderSerialpay(ycOrderSerialpay); + } + + /** 根据主键查询 */ + @Override + public YcOrderSerialpay selectYcOrderSerialpayById(Long id){ + return ycOrderSerialpayMapper.selectYcOrderSerialpayById(id); + } + + /** 查询单条 */ + @Override + public YcOrderSerialpay selectYcOrderSerialpay(YcOrderSerialpay ycOrderSerialpay){ + return ycOrderSerialpayMapper.selectYcOrderSerialpay(ycOrderSerialpay); + } + + /** 查询列表 */ + @Override + public List selectListYcOrderSerialpay(YcOrderSerialpay ycOrderSerialpay){ + return ycOrderSerialpayMapper.selectListYcOrderSerialpay(ycOrderSerialpay); + } + + @Override + public int updateYcOrderSerialpayByOuttradeno(YcOrderSerialpay ycOrderSerialpay) { + return ycOrderSerialpayMapper.updateYcOrderSerialpayByOuttradeno(ycOrderSerialpay); + } + +} \ No newline at end of file diff --git a/health_hosp/src/main/java/cn/card/health/service/impl/order/YcOrderServiceImpl.java b/health_hosp/src/main/java/cn/card/health/service/impl/order/YcOrderServiceImpl.java new file mode 100644 index 0000000..0408906 --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/service/impl/order/YcOrderServiceImpl.java @@ -0,0 +1,57 @@ +package cn.card.health.service.impl.order; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import cn.card.health.bean.order.YcOrder; +import cn.card.health.mapper.order.YcOrderMapper; +import cn.card.health.service.order.IYcOrderService; + + +@Service +public class YcOrderServiceImpl implements IYcOrderService { + + @Autowired + private YcOrderMapper ycOrderMapper; + /** 新增 */ + @Override + public int insertYcOrder(YcOrder ycOrder){ + return ycOrderMapper.insertYcOrder(ycOrder); + } + + /** 删除 */ + @Override + public int deleteYcOrder(Long id){ + return ycOrderMapper.deleteYcOrder(id); + } + + /** 更新 */ + @Override + public int updateYcOrder(YcOrder ycOrder){ + return ycOrderMapper.updateYcOrder(ycOrder); + } + + /** 根据主键查询 */ + @Override + public YcOrder selectYcOrderById(Long id){ + return ycOrderMapper.selectYcOrderById(id); + } + + /** 查询单条 */ + @Override + public YcOrder selectYcOrder(YcOrder ycOrder){ + return ycOrderMapper.selectYcOrder(ycOrder); + } + + /** 查询列表 */ + @Override + public List selectListYcOrder(YcOrder ycOrder){ + return ycOrderMapper.selectListYcOrder(ycOrder); + } + /** 查询列表 */ + @Override + public List selectListYcOrderByDate(YcOrder ycOrder){ + return ycOrderMapper.selectListYcOrderByDate(ycOrder); + } + +} \ No newline at end of file diff --git a/health_hosp/src/main/java/cn/card/health/service/impl/order/YcRegistSourceServiceImpl.java b/health_hosp/src/main/java/cn/card/health/service/impl/order/YcRegistSourceServiceImpl.java new file mode 100644 index 0000000..05501f1 --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/service/impl/order/YcRegistSourceServiceImpl.java @@ -0,0 +1,46 @@ +package cn.card.health.service.impl.order; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import java.util.List; +import cn.card.health.mapper.order.YcRegistSourceMapper; +import cn.card.health.bean.order.YcRegistSource; +import cn.card.health.service.order.IYcRegistSourceService; + +@Service +public class YcRegistSourceServiceImpl implements IYcRegistSourceService { + + @Autowired + private YcRegistSourceMapper ycRegistSourceMapper; + + /** 新增 */ + public int insertYcRegistSource(YcRegistSource ycRegistSource) { + return ycRegistSourceMapper.insertYcRegistSource(ycRegistSource); + } + + /** 删除 */ + public int deleteYcRegistSource(Long id) { + return ycRegistSourceMapper.deleteYcRegistSource(id); + } + + /** 更新 */ + public int updateYcRegistSource(YcRegistSource ycRegistSource) { + return ycRegistSourceMapper.updateYcRegistSource(ycRegistSource); + } + + /** 根据主键查询 */ + public YcRegistSource selectYcRegistSourceById(Long id) { + return ycRegistSourceMapper.selectYcRegistSourceById(id); + } + + /** 查询单条 */ + public YcRegistSource selectYcRegistSource(YcRegistSource ycRegistSource) { + return ycRegistSourceMapper.selectYcRegistSource(ycRegistSource); + } + + /** 查询列表 */ + public List selectListYcRegistSource(YcRegistSource ycRegistSource) { + return ycRegistSourceMapper.selectListYcRegistSource(ycRegistSource); + } + +} \ No newline at end of file diff --git a/health_hosp/src/main/java/cn/card/health/service/impl/order/YcSourceSheduleServiceImpl.java b/health_hosp/src/main/java/cn/card/health/service/impl/order/YcSourceSheduleServiceImpl.java new file mode 100644 index 0000000..78dea8f --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/service/impl/order/YcSourceSheduleServiceImpl.java @@ -0,0 +1,46 @@ +package cn.card.health.service.impl.order; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import java.util.List; +import cn.card.health.mapper.order.YcSourceSheduleMapper; +import cn.card.health.bean.order.YcSourceShedule; +import cn.card.health.service.order.IYcSourceSheduleService; + +@Service +public class YcSourceSheduleServiceImpl implements IYcSourceSheduleService { + + @Autowired + private YcSourceSheduleMapper ycSourceSheduleMapper; + + /** 新增 */ + public int insertYcSourceShedule(YcSourceShedule ycSourceShedule) { + return ycSourceSheduleMapper.insertYcSourceShedule(ycSourceShedule); + } + + /** 删除 */ + public int deleteYcSourceShedule(Long id) { + return ycSourceSheduleMapper.deleteYcSourceShedule(id); + } + + /** 更新 */ + public int updateYcSourceShedule(YcSourceShedule ycSourceShedule) { + return ycSourceSheduleMapper.updateYcSourceShedule(ycSourceShedule); + } + + /** 根据主键查询 */ + public YcSourceShedule selectYcSourceSheduleById(Long id) { + return ycSourceSheduleMapper.selectYcSourceSheduleById(id); + } + + /** 查询单条 */ + public YcSourceShedule selectYcSourceShedule(YcSourceShedule ycSourceShedule) { + return ycSourceSheduleMapper.selectYcSourceShedule(ycSourceShedule); + } + + /** 查询列表 */ + public List selectListYcSourceShedule(YcSourceShedule ycSourceShedule) { + return ycSourceSheduleMapper.selectListYcSourceShedule(ycSourceShedule); + } + +} \ No newline at end of file diff --git a/health_hosp/src/main/java/cn/card/health/service/order/IMedicalRecordService.java b/health_hosp/src/main/java/cn/card/health/service/order/IMedicalRecordService.java new file mode 100644 index 0000000..472fb94 --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/service/order/IMedicalRecordService.java @@ -0,0 +1,21 @@ +package cn.card.health.service.order; + +import cn.card.health.bean.order.MedicalRecord; + +import java.util.List; + +public interface IMedicalRecordService { + MedicalRecord selectById(String id); + + List selectByPatientId(Long patientId); + + List selectByOpenid(String openid); + + List selectApplying(Long patientId); + + Integer insert(MedicalRecord medicalRecord); + + Integer update(MedicalRecord medicalRecord); + + Integer updateByOrderNo(MedicalRecord medicalRecord); +} diff --git a/health_hosp/src/main/java/cn/card/health/service/order/IMkHisParamsService.java b/health_hosp/src/main/java/cn/card/health/service/order/IMkHisParamsService.java new file mode 100644 index 0000000..79ec1f7 --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/service/order/IMkHisParamsService.java @@ -0,0 +1,64 @@ +package cn.card.health.service.order; + +import cn.card.health.bean.order.MkHisParams; +import org.springframework.scheduling.annotation.Async; + +import java.util.List; + +/** + * 支付宝小程序请求Service接口 + * + * @author ruoyi + * @date 2022-10-15 + */ +public interface IMkHisParamsService +{ + /** + * 查询支付宝小程序请求 + * + * @param mkId 支付宝小程序请求主键 + * @return 支付宝小程序请求 + */ + public MkHisParams selectMkHisParamsByMkId(Long mkId); + + /** + * 查询支付宝小程序请求列表 + * + * @param mkHisParams 支付宝小程序请求 + * @return 支付宝小程序请求集合 + */ + public List selectMkHisParamsList(MkHisParams mkHisParams); + + /** + * 新增支付宝小程序请求 + * + * @param mkHisParams 支付宝小程序请求 + * @return 结果 + */ + @Async + public Integer insertMkHisParams(MkHisParams mkHisParams); + + /** + * 修改支付宝小程序请求 + * + * @param mkHisParams 支付宝小程序请求 + * @return 结果 + */ + public int updateMkHisParams(MkHisParams mkHisParams); + + /** + * 批量删除支付宝小程序请求 + * + * @param mkIds 需要删除的支付宝小程序请求主键集合 + * @return 结果 + */ + public int deleteMkHisParamsByMkIds(Long[] mkIds); + + /** + * 删除支付宝小程序请求信息 + * + * @param mkId 支付宝小程序请求主键 + * @return 结果 + */ + public int deleteMkHisParamsByMkId(Long mkId); +} diff --git a/health_hosp/src/main/java/cn/card/health/service/order/IYcOrderClinicDetailService.java b/health_hosp/src/main/java/cn/card/health/service/order/IYcOrderClinicDetailService.java new file mode 100644 index 0000000..41442a4 --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/service/order/IYcOrderClinicDetailService.java @@ -0,0 +1,34 @@ +package cn.card.health.service.order; + +import java.util.List; + +import cn.card.health.bean.order.YcOrderClinicDetail; + +/** + * 门诊交费订单详情 + * + * @author xinggm + * @email + * @date 2021-08-10 17:00:28 + */ +public interface IYcOrderClinicDetailService { + + /** 新增 */ + public int insertYcOrderClinicDetail(YcOrderClinicDetail ycOrderClinicDetail); + + /** 删除 */ + public int deleteYcOrderClinicDetail(Long id); + + /** 更新 */ + public int updateYcOrderClinicDetail(YcOrderClinicDetail ycOrderClinicDetail); + + /** 根据主键查询 */ + public YcOrderClinicDetail selectYcOrderClinicDetailById(Long id); + + /** 查询单条 */ + public YcOrderClinicDetail selectYcOrderClinicDetail(YcOrderClinicDetail ycOrderClinicDetail); + + /** 查询列表 */ + public List selectListYcOrderClinicDetail(YcOrderClinicDetail ycOrderClinicDetail); +} + diff --git a/health_hosp/src/main/java/cn/card/health/service/order/IYcOrderClinicService.java b/health_hosp/src/main/java/cn/card/health/service/order/IYcOrderClinicService.java new file mode 100644 index 0000000..6752f72 --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/service/order/IYcOrderClinicService.java @@ -0,0 +1,33 @@ +package cn.card.health.service.order; + +import java.util.List; +import cn.card.health.bean.order.YcOrderClinic; + +/** + * 门诊缴费订单 + * + * @author xinggm + * @email + * @date 2021-08-10 17:00:29 + */ +public interface IYcOrderClinicService { + + /** 新增 */ + public int insertYcOrderClinic(YcOrderClinic ycOrderClinic); + + /** 删除 */ + public int deleteYcOrderClinic(Long id); + + /** 更新 */ + public int updateYcOrderClinic(YcOrderClinic ycOrderClinic); + + /** 根据主键查询 */ + public YcOrderClinic selectYcOrderClinicById(Long id); + + /** 查询单条 */ + public YcOrderClinic selectYcOrderClinic(YcOrderClinic ycOrderClinic); + + /** 查询列表 */ + public List selectListYcOrderClinic(YcOrderClinic ycOrderClinic); +} + diff --git a/health_hosp/src/main/java/cn/card/health/service/order/IYcOrderInhospService.java b/health_hosp/src/main/java/cn/card/health/service/order/IYcOrderInhospService.java new file mode 100644 index 0000000..ded3597 --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/service/order/IYcOrderInhospService.java @@ -0,0 +1,35 @@ +package cn.card.health.service.order; + +import cn.card.health.bean.order.YcOrderInhosp; +import java.util.List; +import java.util.Map; + +/** + * 住院预缴订单 + + * + * @author xinggm + * @email + * @date 2021-09-07 14:12:41 + */ +public interface IYcOrderInhospService { + + /** 新增 */ + public int insertYcOrderInhosp(YcOrderInhosp ycOrderInhosp); + + /** 删除 */ + public int deleteYcOrderInhosp(Long id); + + /** 更新 */ + public int updateYcOrderInhosp(YcOrderInhosp ycOrderInhosp); + + /** 根据主键查询 */ + public YcOrderInhosp selectYcOrderInhospById(Long id); + + /** 查询单条 */ + public YcOrderInhosp selectYcOrderInhosp(YcOrderInhosp ycOrderInhosp); + + /** 查询列表 */ + public List selectListYcOrderInhosp(YcOrderInhosp ycOrderInhosp); +} + diff --git a/health_hosp/src/main/java/cn/card/health/service/order/IYcOrderRefundpayService.java b/health_hosp/src/main/java/cn/card/health/service/order/IYcOrderRefundpayService.java new file mode 100644 index 0000000..919dd81 --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/service/order/IYcOrderRefundpayService.java @@ -0,0 +1,37 @@ +package cn.card.health.service.order; + +import java.util.List; + +import cn.card.health.bean.order.YcOrderRefundpay; + +/** + * + * + * @author xinggm + * @email + * @date 2021-07-08 15:32:53 + */ +public interface IYcOrderRefundpayService { + + /** 新增 */ + public int insertYcOrderRefundpay(YcOrderRefundpay ycOrderRefundpay); + + /** 删除 */ + public int deleteYcOrderRefundpay(Long id); + + /** 更新 */ + public int updateYcOrderRefundpay(YcOrderRefundpay ycOrderRefundpay); + + /** 更新 */ + public int updateYcOrderRefundpayByOutRefundno(YcOrderRefundpay ycOrderRefundpay); + + /** 根据主键查询 */ + public YcOrderRefundpay selectYcOrderRefundpayById(Long id); + + /** 查询单条 */ + public YcOrderRefundpay selectYcOrderRefundpay(YcOrderRefundpay ycOrderRefundpay); + + /** 查询列表 */ + public List selectListYcOrderRefundpay(YcOrderRefundpay ycOrderRefundpay); +} + diff --git a/health_hosp/src/main/java/cn/card/health/service/order/IYcOrderRegistService.java b/health_hosp/src/main/java/cn/card/health/service/order/IYcOrderRegistService.java new file mode 100644 index 0000000..1abe81e --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/service/order/IYcOrderRegistService.java @@ -0,0 +1,60 @@ +package cn.card.health.service.order; + +import cn.card.health.bean.order.YcOrderRegist; + +import java.util.List; + +/** + * 挂号订单表 + * + * @author xinggm + * @email + * @date 2021-07-08 15:32:53 + */ +public interface IYcOrderRegistService { + + /** + * 新增 + */ + public int insertYcOrderRegist(YcOrderRegist ycOrderRegist); + + /** + * 删除 + */ + public int deleteYcOrderRegist(Long id); + + /** + * 更新 + */ + public int updateYcOrderRegist(YcOrderRegist ycOrderRegist); + + /** + * 根据主键查询 + */ + public YcOrderRegist selectYcOrderRegistById(Long id); + + /** + * 查询单条 + */ + public YcOrderRegist selectYcOrderRegist(YcOrderRegist ycOrderRegist); + + /** + * 查询列表 + */ + public List selectListYcOrderRegist(YcOrderRegist ycOrderRegist); + + /** + * 查询列表 + */ + public List selectRegistList(Long patientId); + + /** + * 查询未支付的挂号订单 + * + * @param patientId + * @param regDate + * @return + */ + public List selectUnpaidRegisterList(Long patientId, String regDate); +} + diff --git a/health_hosp/src/main/java/cn/card/health/service/order/IYcOrderSerialpayService.java b/health_hosp/src/main/java/cn/card/health/service/order/IYcOrderSerialpayService.java new file mode 100644 index 0000000..53b6383 --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/service/order/IYcOrderSerialpayService.java @@ -0,0 +1,36 @@ +package cn.card.health.service.order; + +import java.util.List; +import cn.card.health.bean.order.YcOrderSerialpay; + +/** + * + * + * @author xinggm + * @email + * @date 2021-07-08 15:32:53 + */ +public interface IYcOrderSerialpayService { + + /** 新增 */ + public int insertYcOrderSerialpay(YcOrderSerialpay ycOrderSerialpay); + + /** 删除 */ + public int deleteYcOrderSerialpay(Long id); + + /** 更新 */ + public int updateYcOrderSerialpay(YcOrderSerialpay ycOrderSerialpay); + + /** 根据主键查询 */ + public YcOrderSerialpay selectYcOrderSerialpayById(Long id); + + /** 查询单条 */ + public YcOrderSerialpay selectYcOrderSerialpay(YcOrderSerialpay ycOrderSerialpay); + + /** 查询列表 */ + public List selectListYcOrderSerialpay(YcOrderSerialpay ycOrderSerialpay); + + /** 更新支付结果 */ + public int updateYcOrderSerialpayByOuttradeno(YcOrderSerialpay serialpay); + +} diff --git a/health_hosp/src/main/java/cn/card/health/service/order/IYcOrderService.java b/health_hosp/src/main/java/cn/card/health/service/order/IYcOrderService.java new file mode 100644 index 0000000..54f29c2 --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/service/order/IYcOrderService.java @@ -0,0 +1,34 @@ +package cn.card.health.service.order; + +import java.util.List; +import cn.card.health.bean.order.YcOrder; + +/** + * + * + * @author xinggm + * @email + * @date 2021-07-08 15:32:52 + */ +public interface IYcOrderService { + + /** 新增 */ + public int insertYcOrder(YcOrder ycOrder); + + /** 删除 */ + public int deleteYcOrder(Long id); + + /** 更新 */ + public int updateYcOrder(YcOrder ycOrder); + + /** 根据主键查询 */ + public YcOrder selectYcOrderById(Long id); + + /** 查询单条 */ + public YcOrder selectYcOrder(YcOrder ycOrder); + + /** 查询列表 */ + public List selectListYcOrder(YcOrder ycOrder); + + public List selectListYcOrderByDate(YcOrder ycOrder); +} diff --git a/health_hosp/src/main/java/cn/card/health/service/order/IYcRegistSourceService.java b/health_hosp/src/main/java/cn/card/health/service/order/IYcRegistSourceService.java new file mode 100644 index 0000000..3252ef6 --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/service/order/IYcRegistSourceService.java @@ -0,0 +1,34 @@ +package cn.card.health.service.order; + +import java.util.List; + +import cn.card.health.bean.order.YcRegistSource; + +/** + * 挂号号源信息 + * + * @author xinggm + * @email + * @date 2021-08-14 17:50:10 + */ +public interface IYcRegistSourceService { + + /** 新增 */ + public int insertYcRegistSource(YcRegistSource ycRegistSource); + + /** 删除 */ + public int deleteYcRegistSource(Long id); + + /** 更新 */ + public int updateYcRegistSource(YcRegistSource ycRegistSource); + + /** 根据主键查询 */ + public YcRegistSource selectYcRegistSourceById(Long id); + + /** 查询单条 */ + public YcRegistSource selectYcRegistSource(YcRegistSource ycRegistSource); + + /** 查询列表 */ + public List selectListYcRegistSource(YcRegistSource ycRegistSource); +} + diff --git a/health_hosp/src/main/java/cn/card/health/service/order/IYcSourceSheduleService.java b/health_hosp/src/main/java/cn/card/health/service/order/IYcSourceSheduleService.java new file mode 100644 index 0000000..a26f712 --- /dev/null +++ b/health_hosp/src/main/java/cn/card/health/service/order/IYcSourceSheduleService.java @@ -0,0 +1,34 @@ +package cn.card.health.service.order; + +import java.util.List; + +import cn.card.health.bean.order.YcSourceShedule; + +/** + * 号源排班表 + * + * @author xinggm + * @email + * @date 2021-08-14 17:50:10 + */ +public interface IYcSourceSheduleService { + + /** 新增 */ + public int insertYcSourceShedule(YcSourceShedule ycSourceShedule); + + /** 删除 */ + public int deleteYcSourceShedule(Long id); + + /** 更新 */ + public int updateYcSourceShedule(YcSourceShedule ycSourceShedule); + + /** 根据主键查询 */ + public YcSourceShedule selectYcSourceSheduleById(Long id); + + /** 查询单条 */ + public YcSourceShedule selectYcSourceShedule(YcSourceShedule ycSourceShedule); + + /** 查询列表 */ + public List selectListYcSourceShedule(YcSourceShedule ycSourceShedule); +} + diff --git a/health_hosp/src/main/resources/mapper/hospital/YcHospitalMapper.xml b/health_hosp/src/main/resources/mapper/hospital/YcHospitalMapper.xml new file mode 100644 index 0000000..0ebf2fa --- /dev/null +++ b/health_hosp/src/main/resources/mapper/hospital/YcHospitalMapper.xml @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + select + hospid, + hospname, + wechathospid, + hospcode, + del_flag, + createtime, + createby, + updatetime, + updateby + from yc_hospital + + + + + + + + + + insert into yc_hospital + + hospid, + hospname, + wechathospid, + hospcode, + del_flag, + createtime, + createby, + updatetime, + updateby, + + + #{hospid}, + #{hospname}, + #{wechathospid}, + #{hospcode}, + #{delFlag}, + #{createtime}, + #{createby}, + #{updatetime}, + #{updateby}, + + + + + update yc_hospital + + hospid = #{hospid}, + hospname = #{hospname}, + wechathospid = #{wechathospid}, + hospcode = #{hospcode}, + del_flag = #{delFlag}, + createtime = #{createtime}, + createby = #{createby}, + updatetime = #{updatetime}, + updateby = #{updateby}, + + where hospid = #{hospid} + + + + update sys_dept set del_flag = '2' where hospid = #{hospid} + + \ No newline at end of file diff --git a/health_hosp/src/main/resources/mapper/order/MedicalRecordMapper.xml b/health_hosp/src/main/resources/mapper/order/MedicalRecordMapper.xml new file mode 100644 index 0000000..4f8a818 --- /dev/null +++ b/health_hosp/src/main/resources/mapper/order/MedicalRecordMapper.xml @@ -0,0 +1,497 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id + , openid, patient_id, patient_name, apply_type, `name`, id_number, img1, img2, img4, purpose, + img3, copies, pages, amount, receive_type, receive_name, receive_phone, receive_address, + express_company, express_no, invoice, invoice_no, `status`, remark, order_no, del_flag, + create_time, update_time, update_by + + + + + + + + + + + insert into yc_medical_record (openid, patient_id, patient_name, + apply_type, `name`, id_number, + img1, img2, img3, img4, purpose, copies, + pages, amount, receive_type, + receive_name, receive_phone, receive_address, + express_company, express_no, invoice, + invoice_no, `status`, remark, + order_no, del_flag, create_time, + update_time, update_by) + values (#{openid,jdbcType=VARCHAR}, #{patientId,jdbcType=BIGINT}, #{patientName,jdbcType=VARCHAR}, + #{applyType,jdbcType=SMALLINT}, #{name,jdbcType=VARCHAR}, #{idNumber,jdbcType=VARCHAR}, + #{img1,jdbcType=VARCHAR}, #{img2,jdbcType=VARCHAR}, #{img3,jdbcType=VARCHAR}, #{img4,jdbcType=VARCHAR}, + #{purpose,jdbcType=VARCHAR}, + #{copies,jdbcType=SMALLINT}, + #{pages,jdbcType=SMALLINT}, #{amount,jdbcType=INTEGER}, #{receiveType,jdbcType=SMALLINT}, + #{receiveName,jdbcType=VARCHAR}, #{receivePhone,jdbcType=VARCHAR}, #{receiveAddress,jdbcType=VARCHAR}, + #{expressCompany,jdbcType=VARCHAR}, #{expressNo,jdbcType=VARCHAR}, #{invoice,jdbcType=SMALLINT}, + #{invoiceNo,jdbcType=VARCHAR}, #{status,jdbcType=SMALLINT}, #{remark,jdbcType=VARCHAR}, + #{orderNo,jdbcType=VARCHAR}, #{delFlag,jdbcType=SMALLINT}, #{createTime,jdbcType=TIMESTAMP}, + #{updateTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR}) + + + insert into yc_medical_record + + id, + + openid, + + + patient_id, + + + patient_name, + + + apply_type, + + + `name`, + + + id_number, + + + img1, + + + img2, + + + img3, + + + img4, + + + purpose, + + + copies, + + + pages, + + + amount, + + + receive_type, + + + receive_name, + + + receive_phone, + + + receive_address, + + + express_company, + + + express_no, + + + invoice, + + + invoice_no, + + + `status`, + + + remark, + + + order_no, + + + del_flag, + + + create_time, + + + update_time, + + + update_by, + + + + #{id,jdbcType=VARCHAR}, + + #{openid,jdbcType=VARCHAR}, + + + #{patientId,jdbcType=BIGINT}, + + + #{patientName,jdbcType=VARCHAR}, + + + #{applyType,jdbcType=SMALLINT}, + + + #{name,jdbcType=VARCHAR}, + + + #{idNumber,jdbcType=VARCHAR}, + + + #{img1,jdbcType=VARCHAR}, + + + #{img2,jdbcType=VARCHAR}, + + + #{img3,jdbcType=VARCHAR}, + + + #{img4,jdbcType=VARCHAR}, + + + #{purpose,jdbcType=VARCHAR}, + + + #{copies,jdbcType=SMALLINT}, + + + #{pages,jdbcType=SMALLINT}, + + + #{amount,jdbcType=INTEGER}, + + + #{receiveType,jdbcType=SMALLINT}, + + + #{receiveName,jdbcType=VARCHAR}, + + + #{receivePhone,jdbcType=VARCHAR}, + + + #{receiveAddress,jdbcType=VARCHAR}, + + + #{expressCompany,jdbcType=VARCHAR}, + + + #{expressNo,jdbcType=VARCHAR}, + + + #{invoice,jdbcType=SMALLINT}, + + + #{invoiceNo,jdbcType=VARCHAR}, + + + #{status,jdbcType=SMALLINT}, + + + #{remark,jdbcType=VARCHAR}, + + + #{orderNo,jdbcType=VARCHAR}, + + + #{delFlag,jdbcType=SMALLINT}, + + + #{createTime,jdbcType=TIMESTAMP}, + + + #{updateTime,jdbcType=TIMESTAMP}, + + + #{updateBy,jdbcType=VARCHAR}, + + + + + update yc_medical_record + + + openid = #{openid,jdbcType=VARCHAR}, + + + patient_id = #{patientId,jdbcType=BIGINT}, + + + patient_name = #{patientName,jdbcType=VARCHAR}, + + + apply_type = #{applyType,jdbcType=SMALLINT}, + + + `name` = #{name,jdbcType=VARCHAR}, + + + id_number = #{idNumber,jdbcType=VARCHAR}, + + + img1 = #{img1,jdbcType=VARCHAR}, + + + img2 = #{img2,jdbcType=VARCHAR}, + + + img3 = #{img3,jdbcType=VARCHAR}, + + + img4 = #{img4,jdbcType=VARCHAR}, + + + purpose = #{purpose,jdbcType=VARCHAR}, + + + copies = #{copies,jdbcType=SMALLINT}, + + + pages = #{pages,jdbcType=SMALLINT}, + + + amount = #{amount,jdbcType=INTEGER}, + + + receive_type = #{receiveType,jdbcType=SMALLINT}, + + + receive_name = #{receiveName,jdbcType=VARCHAR}, + + + receive_phone = #{receivePhone,jdbcType=VARCHAR}, + + + receive_address = #{receiveAddress,jdbcType=VARCHAR}, + + + express_company = #{expressCompany,jdbcType=VARCHAR}, + + + express_no = #{expressNo,jdbcType=VARCHAR}, + + + invoice = #{invoice,jdbcType=SMALLINT}, + + + invoice_no = #{invoiceNo,jdbcType=VARCHAR}, + + + `status` = #{status,jdbcType=SMALLINT}, + + + remark = #{remark,jdbcType=VARCHAR}, + + + order_no = #{orderNo,jdbcType=VARCHAR}, + + + del_flag = #{delFlag,jdbcType=SMALLINT}, + + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + update_time = #{updateTime,jdbcType=TIMESTAMP}, + + + update_by = #{updateBy,jdbcType=VARCHAR}, + + + where id = #{id,jdbcType=VARCHAR} + + + update yc_medical_record + set openid = #{openid,jdbcType=VARCHAR}, + patient_id = #{patientId,jdbcType=BIGINT}, + patient_name = #{patientName,jdbcType=VARCHAR}, + apply_type = #{applyType,jdbcType=SMALLINT}, + `name` = #{name,jdbcType=VARCHAR}, + id_number = #{idNumber,jdbcType=VARCHAR}, + img1 = #{img1,jdbcType=VARCHAR}, + img2 = #{img2,jdbcType=VARCHAR}, + img3 = #{img3,jdbcType=VARCHAR}, + img4 = #{img4,jdbcType=VARCHAR}, + purpose = #{purpose,jdbcType=VARCHAR}, + copies = #{copies,jdbcType=SMALLINT}, + pages = #{pages,jdbcType=SMALLINT}, + amount = #{amount,jdbcType=INTEGER}, + receive_type = #{receiveType,jdbcType=SMALLINT}, + receive_name = #{receiveName,jdbcType=VARCHAR}, + receive_phone = #{receivePhone,jdbcType=VARCHAR}, + receive_address = #{receiveAddress,jdbcType=VARCHAR}, + express_company = #{expressCompany,jdbcType=VARCHAR}, + express_no = #{expressNo,jdbcType=VARCHAR}, + invoice = #{invoice,jdbcType=SMALLINT}, + invoice_no = #{invoiceNo,jdbcType=VARCHAR}, + `status` = #{status,jdbcType=SMALLINT}, + remark = #{remark,jdbcType=VARCHAR}, + order_no = #{orderNo,jdbcType=VARCHAR}, + del_flag = #{delFlag,jdbcType=SMALLINT}, + create_time = #{createTime,jdbcType=TIMESTAMP}, + update_time = #{updateTime,jdbcType=TIMESTAMP}, + update_by = #{updateBy,jdbcType=VARCHAR} + where id = #{id,jdbcType=VARCHAR} + + + update yc_medical_record + + + openid = #{openid,jdbcType=VARCHAR}, + + + patient_id = #{patientId,jdbcType=BIGINT}, + + + patient_name = #{patientName,jdbcType=VARCHAR}, + + + apply_type = #{applyType,jdbcType=SMALLINT}, + + + `name` = #{name,jdbcType=VARCHAR}, + + + id_number = #{idNumber,jdbcType=VARCHAR}, + + + img1 = #{img1,jdbcType=VARCHAR}, + + + img2 = #{img2,jdbcType=VARCHAR}, + + + img3 = #{img3,jdbcType=VARCHAR}, + + + img4 = #{img4,jdbcType=VARCHAR}, + + + purpose = #{purpose,jdbcType=VARCHAR}, + + + copies = #{copies,jdbcType=SMALLINT}, + + + pages = #{pages,jdbcType=SMALLINT}, + + + amount = #{amount,jdbcType=INTEGER}, + + + receive_type = #{receiveType,jdbcType=SMALLINT}, + + + receive_name = #{receiveName,jdbcType=VARCHAR}, + + + receive_phone = #{receivePhone,jdbcType=VARCHAR}, + + + receive_address = #{receiveAddress,jdbcType=VARCHAR}, + + + express_company = #{expressCompany,jdbcType=VARCHAR}, + + + express_no = #{expressNo,jdbcType=VARCHAR}, + + + invoice = #{invoice,jdbcType=SMALLINT}, + + + invoice_no = #{invoiceNo,jdbcType=VARCHAR}, + + + `status` = #{status,jdbcType=SMALLINT}, + + + remark = #{remark,jdbcType=VARCHAR}, + + + del_flag = #{delFlag,jdbcType=SMALLINT}, + + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + update_time = #{updateTime,jdbcType=TIMESTAMP}, + + + update_by = #{updateBy,jdbcType=VARCHAR}, + + + where order_no = #{orderNo,jdbcType=VARCHAR} + + \ No newline at end of file diff --git a/health_hosp/src/main/resources/mapper/order/MkHisParamsMapper.xml b/health_hosp/src/main/resources/mapper/order/MkHisParamsMapper.xml new file mode 100644 index 0000000..d7d6206 --- /dev/null +++ b/health_hosp/src/main/resources/mapper/order/MkHisParamsMapper.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + select mk_id, mk_method, mk_requestdata, mk_responsedata, create_time from mk_his_params + + + + + + + + insert into mk_his_params + + mk_method, + mk_requestdata, + mk_responsedata, + create_time, + + + #{mkMethod}, + #{mkRequestData}, + #{mkResponseData}, + #{createTime}, + + + + + update mk_his_params + + mk_method = #{mkMethod}, + mk_requestdata = #{mkRequestData}, + mk_responsedata = #{mkResponseData}, + create_time = #{createTime}, + + where mk_id = #{mkId} + + + + delete from mk_his_params where mk_id = #{mkId} + + + + delete from mk_his_params where mk_id in + + #{mkId} + + + \ No newline at end of file diff --git a/health_hosp/src/main/resources/mapper/order/YcOrderClinicDetailMapper.xml b/health_hosp/src/main/resources/mapper/order/YcOrderClinicDetailMapper.xml new file mode 100644 index 0000000..55a1102 --- /dev/null +++ b/health_hosp/src/main/resources/mapper/order/YcOrderClinicDetailMapper.xml @@ -0,0 +1,165 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + select clinic_detailid, + orderid, + clinic_orderid, + patientid, + deptName, + doctorName, + payAmount, + detailTypeId, + detailFee, + detailId, + detailName, + detailCount, + detailUnit, + detailAmount, + detailSpec, + detailPrice, + from yc_order_clinic_detail + + + + + + + + + + insert into yc_order_clinic_detail + + clinic_detailid, + orderid, + clinic_orderid, + patientid, + deptName, + doctorName, + payAmount, + detailTypeId, + detailFee, + detailId, + detailName, + detailCount, + detailUnit, + detailAmount, + detailSpec, + detailPrice, + + + #{clinicDetailid}, + #{orderid}, + #{clinicOrderid}, + #{patientid}, + #{deptname}, + #{doctorname}, + #{payamount}, + #{detailtypeid}, + #{detailfee}, + #{detailid}, + #{detailname}, + #{detailcount}, + #{detailunit}, + #{detailamount}, + #{detailspec}, + #{detailprice}, + + + + + update yc_order_clinic_detail + + clinic_detailid = #{clinicDetailid}, + orderid = #{orderid}, + clinic_orderid = #{clinicOrderid}, + patientid = #{patientid}, + deptName = #{deptname}, + doctorName = #{doctorname}, + payAmount = #{payamount}, + detailTypeId = #{detailtypeid}, + detailFee = #{detailfee}, + detailId = #{detailid}, + detailName = #{detailname}, + detailCount = #{detailcount}, + detailUnit = #{detailunit}, + detailAmount = #{detailamount}, + detailSpec = #{detailspec}, + detailPrice = #{detailprice}, + + where clinic_detailid = #{clinicDetailid} + + + + update sys_dept + set del_flag = '2' + where clinic_detailid = #{clinicDetailid} + + \ No newline at end of file diff --git a/health_hosp/src/main/resources/mapper/order/YcOrderClinicMapper.xml b/health_hosp/src/main/resources/mapper/order/YcOrderClinicMapper.xml new file mode 100644 index 0000000..6279ecb --- /dev/null +++ b/health_hosp/src/main/resources/mapper/order/YcOrderClinicMapper.xml @@ -0,0 +1,177 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select clinic_orderid, + orderid, + orderno, + patientid, + openid, + his_patientid, + hisid, + hisLockid, + his_orderid, + visitid, + hospid, + deptNo, + deptName, + doctorNo, + doctorName, + totalMoney, + createtime, + updatetime + from yc_order_clinic + + + + + + + + + + insert into yc_order_clinic + + clinic_orderid, + orderid, + orderno, + patientid, + openid, + his_patientid, + hisid, + hisLockid, + his_orderid, + visitid, + hospid, + deptNo, + deptName, + doctorNo, + doctorName, + totalMoney, + createtime, + updatetime, + + + #{clinicOrderid}, + #{orderid}, + #{orderno}, + #{patientid}, + #{openid}, + #{hisPatientid}, + #{hisid}, + #{hislockid}, + #{hisOrderid}, + #{visitid}, + #{hospid}, + #{deptno}, + #{deptname}, + #{doctorno}, + #{doctorname}, + #{totalmoney}, + #{createtime}, + #{updatetime}, + + + + + update yc_order_clinic + + clinic_orderid = #{clinicOrderid}, + orderid = #{orderid}, + orderno = #{orderno}, + patientid = #{patientid}, + openid = #{openid}, + his_patientid = #{hisPatientid}, + hisid = #{hisid}, + hisLockid = #{hislockid}, + his_orderid = #{hisOrderid}, + visitid = #{visitid}, + hospid = #{hospid}, + deptNo = #{deptno}, + deptName = #{deptname}, + doctorNo = #{doctorno}, + doctorName = #{doctorname}, + totalMoney = #{totalmoney}, + createtime = #{createtime}, + updatetime = #{updatetime}, + + where clinic_orderid = #{clinicOrderid} + + + + update sys_dept + set del_flag = '2' + where clinic_orderid = #{clinicOrderid} + + \ No newline at end of file diff --git a/health_hosp/src/main/resources/mapper/order/YcOrderInhospMapper.xml b/health_hosp/src/main/resources/mapper/order/YcOrderInhospMapper.xml new file mode 100644 index 0000000..89953ed --- /dev/null +++ b/health_hosp/src/main/resources/mapper/order/YcOrderInhospMapper.xml @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + select inhosp_orderid, + orderid, + orderno, + his_orderid, + patientid, + openid, + userid, + totalMoney, + del_flag, + createtime, + updatetime + from yc_order_inhosp + + + + + + + + + + insert into yc_order_inhosp + + inhosp_orderid, + orderid, + orderno, + his_orderid, + patientid, + openid, + userid, + totalMoney, + del_flag, + createtime, + updatetime, + + + #{inhospOrderid}, + #{orderid}, + #{orderno}, + #{hisOrderid}, + #{patientid}, + #{openid}, + #{userid}, + #{totalmoney}, + #{delFlag}, + #{createtime}, + #{updatetime}, + + + + + update yc_order_inhosp + + inhosp_orderid = #{inhospOrderid}, + orderid = #{orderid}, + orderno = #{orderno}, + his_orderid = #{hisOrderid}, + patientid = #{patientid}, + openid = #{openid}, + userid = #{userid}, + totalMoney = #{totalmoney}, + del_flag = #{delFlag}, + createtime = #{createtime}, + updatetime = #{updatetime}, + + where inhosp_orderid = #{inhospOrderid} + + + + update + sys_dept + set del_flag = '2' + where inhosp_orderid = #{inhospOrderid} + + \ No newline at end of file diff --git a/health_hosp/src/main/resources/mapper/order/YcOrderMapper.xml b/health_hosp/src/main/resources/mapper/order/YcOrderMapper.xml new file mode 100644 index 0000000..f40f4c6 --- /dev/null +++ b/health_hosp/src/main/resources/mapper/order/YcOrderMapper.xml @@ -0,0 +1,183 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select orderid, + patientid, + userid, + openid, + ordertype, + orderno, + del_flag, + orderstatus, + createtime, + reason, + totalmoney, + hisOrderId, + hisOrderPayId, + visitid, + hospid, + insureStatus, + hisStatus, + payStatus + from yc_order + + + + + + + + + + + + + + insert into yc_order + + orderid, + userid, + patientid, + openid, + ordertype, + orderno, + orderstatus, + reason, + totalmoney, + hospid, + hisOrderId, + payStatus, + hisStatus, + insureStatus, + del_flag, + createtime, + + + #{orderid}, + #{userid}, + #{patientid}, + #{openid}, + #{ordertype}, + #{orderno}, + #{orderStatus}, + #{reason}, + #{totalmoney}, + #{hospid}, + #{hisOrderId}, + #{payStatus}, + #{hisStatus}, + #{insureStatus}, + 1, + #{createtime}, + + + + + update yc_order + + ordertype = #{ordertype}, + orderno = #{orderno}, + orderstatus = #{orderStatus}, + reason = #{reason}, + hisOrderPayId = #{hisOrderPayId}, + hisOrderId = #{hisOrderId}, + receiptId = #{receiptId}, + hospid=#{hospid}, + insureStatus=#{insureStatus}, + hisStatus=#{hisStatus}, + payStatus=#{payStatus}, + + + and orderid=#{orderid} + and orderno=#{orderno} + + + + + update yc_order + set del_flag = '2' + where orderid = #{orderid} + + \ No newline at end of file diff --git a/health_hosp/src/main/resources/mapper/order/YcOrderRefundpayMapper.xml b/health_hosp/src/main/resources/mapper/order/YcOrderRefundpayMapper.xml new file mode 100644 index 0000000..894ea21 --- /dev/null +++ b/health_hosp/src/main/resources/mapper/order/YcOrderRefundpayMapper.xml @@ -0,0 +1,155 @@ + + + + + + + + + + + + + + + + + + + + + + select + refundpayid, + orderid, + serialpayid, + out_refund_no, + refundid, + paytype, + money, + refundstatus, + refundtime, + createtime, + modifytime + from + yc_order_refundpay + + + + + + + + + + insert into yc_order_refundpay + + refundpayid, + orderid, + serialpayid, + out_refund_no, + refundid, + paytype, + money, + refundstatus, + refundtime, + createtime, + modifytime, + + + #{refundpayid}, + #{orderid}, + #{serialpayid}, + #{outrefundno}, + #{refundid}, + #{paytype}, + #{money}, + #{refundstatus}, + #{refundtime}, + #{createtime}, + #{modifytime}, + + + + + update yc_order_refundpay + + refundpayid = #{refundpayid}, + orderid = #{orderid}, + serialpayid = #{serialpayid}, + out_refund_no = #{outrefundno}, + refundid = #{refundid}, + paytype = #{paytype}, + money = #{money}, + refundstatus = #{refundstatus}, + refundtime = #{refundtime}, + createtime = #{createtime}, + modifytime = SYSDATE(), + + where refundpayid = #{refundpayid} + + + + update yc_order_refundpay + + refundpayid = #{refundpayid}, + orderid = #{orderid}, + serialpayid = #{serialpayid}, + out_refund_no = #{outrefundno}, + refundid = #{refundid}, + money = #{money}, + refundstatus = #{refundstatus}, + refundtime = #{refundtime}, + createtime = #{createtime}, + modifytime = #{modifytime}, + + where out_refund_no = #{outrefundno} + and paytype = #{paytype} + + + + update + sys_dept set del_flag = '2' where refundpayid = #{refundpayid} + + \ No newline at end of file diff --git a/health_hosp/src/main/resources/mapper/order/YcOrderRegistMapper.xml b/health_hosp/src/main/resources/mapper/order/YcOrderRegistMapper.xml new file mode 100644 index 0000000..721225c --- /dev/null +++ b/health_hosp/src/main/resources/mapper/order/YcOrderRegistMapper.xml @@ -0,0 +1,232 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select regist_orderid, + orderid, + orderno, + ordertype, + openid, + patientid, + his_patientid, + hisid, + hospid, + deptno, + deptname, + doctorno, + doctorname, + regdate, + begintime, + endtime, + scheduleFlag, + his_orderid, + hisLockid, + fee, + treatfee, + totalmoney, + orderstatus, + createtime, + updatetime + from yc_order_regist + + + + + + + + + + + + + insert into yc_order_regist + + regist_orderid, + orderid, + orderno, + ordertype, + openid, + patientid, + his_patientid, + hisid, + hospid, + deptNo, + deptName, + doctorNo, + doctorName, + regDate, + beginTime, + endTime, + scheduleFlag, + his_orderid, + hisLockid, + fee, + treatfee, + totalmoney, + orderStatus, + createtime, + updatetime, + + + #{registOrderid}, + #{orderid}, + #{orderno}, + #{ordertype}, + #{openid}, + #{patientid}, + #{hisPatientid}, + #{hisid}, + #{hospid}, + #{deptno}, + #{deptname}, + #{doctorno}, + #{doctorname}, + #{regdate}, + #{begintime}, + #{endtime}, + #{scheduleFlag}, + #{hisOrderid}, + #{hisLockid}, + #{fee}, + #{treatfee}, + #{totalmoney}, + #{orderstatus}, + #{createtime}, + #{updatetime}, + + + + + update yc_order_regist + + regist_orderid = #{registOrderid}, + orderid = #{orderid}, + orderno = #{orderno}, + patientid = #{patientid}, + his_patientid = #{hisPatientid}, + hisid = #{hisid}, + hospid = #{hospid}, + deptNo = #{deptno}, + deptName = #{deptname}, + doctorNo = #{doctorno}, + doctorName = #{doctorname}, + regDate = #{regdate}, + beginTime = #{begintime}, + endTime = #{endtime}, + scheduleFlag = #{scheduleFlag}, + his_orderid = #{hisOrderid}, + hisLockid = #{hisLockid}, + fee = #{fee}, + treatfee = #{treatfee}, + totalmoney = #{totalmoney}, + orderStatus = #{orderstatus}, + createtime = #{createtime}, + updatetime = #{updatetime}, + + where regist_orderid = #{registOrderid} + + + + update yc_order_regist + set del_flag = '2' + where regist_orderid = #{registOrderid} + + \ No newline at end of file diff --git a/health_hosp/src/main/resources/mapper/order/YcOrderSerialpayMapper.xml b/health_hosp/src/main/resources/mapper/order/YcOrderSerialpayMapper.xml new file mode 100644 index 0000000..04d19f1 --- /dev/null +++ b/health_hosp/src/main/resources/mapper/order/YcOrderSerialpayMapper.xml @@ -0,0 +1,244 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select serialpayid, + orderid, + patientid, + hospid, + money, + paytime, + businesstype, + serialno, + out_trade_no, + prepayid, + transactionid, + paytype, + paynocestr, + payname, + paystatus, + paymoney, + totalmoney, + userno, + createip, + createtime, + updatetime, + description + from yc_order_serialpay + + + + + + + + + + insert into yc_order_serialpay + + serialpayid, + orderid, + patientid, + hospid, + money, + paytime, + businesstype, + serialno, + out_trade_no, + prepayid, + transactionid, + paytype, + payname, + paystatus, + paynocestr, + paymoney, + totalmoney, + userno, + createip, + createtime, + updatetime, + description, + + + #{serialpayid}, + #{orderid}, + #{patientid}, + #{hospid}, + #{money}, + #{paytime}, + #{businesstype}, + #{serialno}, + #{outtradeno}, + #{prepayid}, + #{transactionid}, + #{paytype}, + #{payname}, + #{paystatus}, + #{paynocestr}, + #{paymoney}, + #{totalmoney}, + #{userno}, + #{createip}, + SYSDATE(), + #{updatetime}, + #{description}, + + + + + update yc_order_serialpay + + serialpayid = #{serialpayid}, + orderid = #{orderid}, + patientid = #{patientid}, + hospid = #{hospid}, + money = #{money}, + paytime = #{paytime}, + businesstype = #{businesstype}, + serialno = #{serialno}, + out_trade_no = #{outtradeno}, + prepayid = #{prepayid}, + transactionid = #{transactionid}, + paytype = #{paytype}, + payname = #{payname}, + paystatus = #{paystatus}, + paynocestr = #{paynocestr}, + paymoney = #{paymoney}, + totalmoney = #{totalmoney}, + userno = #{userno}, + createip = #{createip}, + createtime = #{createtime}, + updatetime = SYSDATE(), + description = #{description}, + + where serialpayid = #{serialpayid} + + + update yc_order_serialpay + + serialpayid = #{serialpayid}, + orderid = #{orderid}, + patientid = #{patientid}, + hospid = #{hospid}, + money = #{money}, + paytime = #{paytime}, + businesstype = #{businesstype}, + serialno = #{serialno}, + out_trade_no = #{outtradeno}, + prepayid = #{prepayid}, + transactionid = #{transactionid}, + paytype = #{paytype}, + payname = #{payname}, + paystatus = #{paystatus}, + paynocestr = #{paynocestr}, + paymoney = #{paymoney}, + totalmoney = #{totalmoney}, + userno = #{userno}, + createip = #{createip}, + updatetime = SYSDATE(), + description = #{description}, + + where out_trade_no = #{outtradeno} and paytype= #{paytype} + + + + update + yc_order_serialpay + set del_flag = 2 + where serialpayid = #{serialpayid} + + \ No newline at end of file diff --git a/health_hosp/src/main/resources/mapper/order/YcRegistSourceMapper.xml b/health_hosp/src/main/resources/mapper/order/YcRegistSourceMapper.xml new file mode 100644 index 0000000..b319bf0 --- /dev/null +++ b/health_hosp/src/main/resources/mapper/order/YcRegistSourceMapper.xml @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + select + sourceid, + hospid, + deptNo, + deptName, + doctorNo, + doctorName, + regWeekDay, + regDate, + regLeaveCount, + regStatus, + regTotalCount, + scheduleType, + regFee, + treatFee, + isTimeReg, + createtime + from yc_regist_source + + + + + + + + + + insert into yc_regist_source + + sourceid, + hospid, + deptNo, + deptName, + doctorNo, + doctorName, + regWeekDay, + regDate, + regLeaveCount, + regStatus, + regTotalCount, + scheduleType, + regFee, + treatFee, + isTimeReg, + createtime, + + + #{sourceid}, + #{hospid}, + #{deptno}, + #{deptname}, + #{doctorno}, + #{doctorname}, + #{regweekday}, + #{regdate}, + #{regleavecount}, + #{regstatus}, + #{regtotalcount}, + #{scheduletype}, + #{regfee}, + #{treatfee}, + #{istimereg}, + #{createtime}, + + + + + update yc_regist_source + + sourceid = #{sourceid}, + hospid = #{hospid}, + deptNo = #{deptno}, + deptName = #{deptname}, + doctorNo = #{doctorno}, + doctorName = #{doctorname}, + regWeekDay = #{regweekday}, + regDate = #{regdate}, + regLeaveCount = #{regleavecount}, + regStatus = #{regstatus}, + regTotalCount = #{regtotalcount}, + scheduleType = #{scheduletype}, + regFee = #{regfee}, + treatFee = #{treatfee}, + isTimeReg = #{istimereg}, + createtime = #{createtime}, + + where sourceid = #{sourceid} + + + + update sys_dept set del_flag = '2' where sourceid = #{sourceid} + + \ No newline at end of file diff --git a/health_hosp/src/main/resources/mapper/order/YcSourceSheduleMapper.xml b/health_hosp/src/main/resources/mapper/order/YcSourceSheduleMapper.xml new file mode 100644 index 0000000..85df0fd --- /dev/null +++ b/health_hosp/src/main/resources/mapper/order/YcSourceSheduleMapper.xml @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + + + + + + select + sheduleid, + hospid, + sourceid, + regTotalCount, + regLeaveCount, + visitsNum, + beginTime, + endTime, + signalSourceID, + createtime + from yc_source_shedule + + + + + + + + + + insert into yc_source_shedule + + sheduleid, + hospid, + sourceid, + regTotalCount, + regLeaveCount, + visitsNum, + beginTime, + endTime, + signalSourceID, + createtime, + + + #{sheduleid}, + #{hospid}, + #{sourceid}, + #{regtotalcount}, + #{regleavecount}, + #{visitsnum}, + #{begintime}, + #{endtime}, + #{signalsourceid}, + #{createtime}, + + + + + update yc_source_shedule + + sheduleid = #{sheduleid}, + hospid = #{hospid}, + sourceid = #{sourceid}, + regTotalCount = #{regtotalcount}, + regLeaveCount = #{regleavecount}, + visitsNum = #{visitsnum}, + beginTime = #{begintime}, + endTime = #{endtime}, + signalSourceID = #{signalsourceid}, + createtime = #{createtime}, + + where sheduleid = #{sheduleid} + + + + update + sys_dept set del_flag = '2' where sheduleid = #{sheduleid} + + \ No newline at end of file diff --git a/health_hosp/target/classes/cn/card/health/bean/order/MedicalRecord.class b/health_hosp/target/classes/cn/card/health/bean/order/MedicalRecord.class new file mode 100644 index 0000000..c0a3d98 Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/bean/order/MedicalRecord.class differ diff --git a/health_hosp/target/classes/cn/card/health/bean/order/MkHisParams.class b/health_hosp/target/classes/cn/card/health/bean/order/MkHisParams.class new file mode 100644 index 0000000..c2652b3 Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/bean/order/MkHisParams.class differ diff --git a/health_hosp/target/classes/cn/card/health/bean/order/YcOrder.class b/health_hosp/target/classes/cn/card/health/bean/order/YcOrder.class new file mode 100644 index 0000000..37be3a3 Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/bean/order/YcOrder.class differ diff --git a/health_hosp/target/classes/cn/card/health/bean/order/YcOrderClinic.class b/health_hosp/target/classes/cn/card/health/bean/order/YcOrderClinic.class new file mode 100644 index 0000000..33ff82a Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/bean/order/YcOrderClinic.class differ diff --git a/health_hosp/target/classes/cn/card/health/bean/order/YcOrderClinicDetail.class b/health_hosp/target/classes/cn/card/health/bean/order/YcOrderClinicDetail.class new file mode 100644 index 0000000..0a95ff0 Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/bean/order/YcOrderClinicDetail.class differ diff --git a/health_hosp/target/classes/cn/card/health/bean/order/YcOrderInhosp.class b/health_hosp/target/classes/cn/card/health/bean/order/YcOrderInhosp.class new file mode 100644 index 0000000..05640c1 Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/bean/order/YcOrderInhosp.class differ diff --git a/health_hosp/target/classes/cn/card/health/bean/order/YcOrderRefundpay.class b/health_hosp/target/classes/cn/card/health/bean/order/YcOrderRefundpay.class new file mode 100644 index 0000000..88cccaf Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/bean/order/YcOrderRefundpay.class differ diff --git a/health_hosp/target/classes/cn/card/health/bean/order/YcOrderRegist.class b/health_hosp/target/classes/cn/card/health/bean/order/YcOrderRegist.class new file mode 100644 index 0000000..e1827eb Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/bean/order/YcOrderRegist.class differ diff --git a/health_hosp/target/classes/cn/card/health/bean/order/YcOrderSerialpay.class b/health_hosp/target/classes/cn/card/health/bean/order/YcOrderSerialpay.class new file mode 100644 index 0000000..923bb9e Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/bean/order/YcOrderSerialpay.class differ diff --git a/health_hosp/target/classes/cn/card/health/bean/order/YcRegistSource.class b/health_hosp/target/classes/cn/card/health/bean/order/YcRegistSource.class new file mode 100644 index 0000000..6931ce1 Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/bean/order/YcRegistSource.class differ diff --git a/health_hosp/target/classes/cn/card/health/bean/order/YcSourceShedule.class b/health_hosp/target/classes/cn/card/health/bean/order/YcSourceShedule.class new file mode 100644 index 0000000..d32a028 Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/bean/order/YcSourceShedule.class differ diff --git a/health_hosp/target/classes/cn/card/health/mapper/hospital/YcHospitalMapper.class b/health_hosp/target/classes/cn/card/health/mapper/hospital/YcHospitalMapper.class new file mode 100644 index 0000000..47eda65 Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/mapper/hospital/YcHospitalMapper.class differ diff --git a/health_hosp/target/classes/cn/card/health/mapper/order/MedicalRecordMapper.class b/health_hosp/target/classes/cn/card/health/mapper/order/MedicalRecordMapper.class new file mode 100644 index 0000000..3fccbf8 Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/mapper/order/MedicalRecordMapper.class differ diff --git a/health_hosp/target/classes/cn/card/health/mapper/order/MkHisParamsMapper.class b/health_hosp/target/classes/cn/card/health/mapper/order/MkHisParamsMapper.class new file mode 100644 index 0000000..934d671 Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/mapper/order/MkHisParamsMapper.class differ diff --git a/health_hosp/target/classes/cn/card/health/mapper/order/YcOrderClinicDetailMapper.class b/health_hosp/target/classes/cn/card/health/mapper/order/YcOrderClinicDetailMapper.class new file mode 100644 index 0000000..191b9c4 Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/mapper/order/YcOrderClinicDetailMapper.class differ diff --git a/health_hosp/target/classes/cn/card/health/mapper/order/YcOrderClinicMapper.class b/health_hosp/target/classes/cn/card/health/mapper/order/YcOrderClinicMapper.class new file mode 100644 index 0000000..1c7cbd0 Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/mapper/order/YcOrderClinicMapper.class differ diff --git a/health_hosp/target/classes/cn/card/health/mapper/order/YcOrderInhospMapper.class b/health_hosp/target/classes/cn/card/health/mapper/order/YcOrderInhospMapper.class new file mode 100644 index 0000000..82b844e Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/mapper/order/YcOrderInhospMapper.class differ diff --git a/health_hosp/target/classes/cn/card/health/mapper/order/YcOrderMapper.class b/health_hosp/target/classes/cn/card/health/mapper/order/YcOrderMapper.class new file mode 100644 index 0000000..eccdbc1 Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/mapper/order/YcOrderMapper.class differ diff --git a/health_hosp/target/classes/cn/card/health/mapper/order/YcOrderRefundpayMapper.class b/health_hosp/target/classes/cn/card/health/mapper/order/YcOrderRefundpayMapper.class new file mode 100644 index 0000000..769eda4 Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/mapper/order/YcOrderRefundpayMapper.class differ diff --git a/health_hosp/target/classes/cn/card/health/mapper/order/YcOrderRegistMapper.class b/health_hosp/target/classes/cn/card/health/mapper/order/YcOrderRegistMapper.class new file mode 100644 index 0000000..42ee3ab Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/mapper/order/YcOrderRegistMapper.class differ diff --git a/health_hosp/target/classes/cn/card/health/mapper/order/YcOrderSerialpayMapper.class b/health_hosp/target/classes/cn/card/health/mapper/order/YcOrderSerialpayMapper.class new file mode 100644 index 0000000..c6b28ba Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/mapper/order/YcOrderSerialpayMapper.class differ diff --git a/health_hosp/target/classes/cn/card/health/mapper/order/YcRegistSourceMapper.class b/health_hosp/target/classes/cn/card/health/mapper/order/YcRegistSourceMapper.class new file mode 100644 index 0000000..52cbc1b Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/mapper/order/YcRegistSourceMapper.class differ diff --git a/health_hosp/target/classes/cn/card/health/mapper/order/YcSourceSheduleMapper.class b/health_hosp/target/classes/cn/card/health/mapper/order/YcSourceSheduleMapper.class new file mode 100644 index 0000000..fb3a152 Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/mapper/order/YcSourceSheduleMapper.class differ diff --git a/health_hosp/target/classes/cn/card/health/service/hospital/IYcHospitalService.class b/health_hosp/target/classes/cn/card/health/service/hospital/IYcHospitalService.class new file mode 100644 index 0000000..f19eccc Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/service/hospital/IYcHospitalService.class differ diff --git a/health_hosp/target/classes/cn/card/health/service/hospital/impl/YcHospitalServiceImpl.class b/health_hosp/target/classes/cn/card/health/service/hospital/impl/YcHospitalServiceImpl.class new file mode 100644 index 0000000..4c8824e Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/service/hospital/impl/YcHospitalServiceImpl.class differ diff --git a/health_hosp/target/classes/cn/card/health/service/impl/order/MedicalRecordServiceImpl.class b/health_hosp/target/classes/cn/card/health/service/impl/order/MedicalRecordServiceImpl.class new file mode 100644 index 0000000..01c18b9 Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/service/impl/order/MedicalRecordServiceImpl.class differ diff --git a/health_hosp/target/classes/cn/card/health/service/impl/order/MkHisParamsServiceImpl.class b/health_hosp/target/classes/cn/card/health/service/impl/order/MkHisParamsServiceImpl.class new file mode 100644 index 0000000..be24712 Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/service/impl/order/MkHisParamsServiceImpl.class differ diff --git a/health_hosp/target/classes/cn/card/health/service/impl/order/YcOrderClinicDetailServiceImpl.class b/health_hosp/target/classes/cn/card/health/service/impl/order/YcOrderClinicDetailServiceImpl.class new file mode 100644 index 0000000..4ab16c3 Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/service/impl/order/YcOrderClinicDetailServiceImpl.class differ diff --git a/health_hosp/target/classes/cn/card/health/service/impl/order/YcOrderClinicServiceImpl.class b/health_hosp/target/classes/cn/card/health/service/impl/order/YcOrderClinicServiceImpl.class new file mode 100644 index 0000000..e85db67 Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/service/impl/order/YcOrderClinicServiceImpl.class differ diff --git a/health_hosp/target/classes/cn/card/health/service/impl/order/YcOrderInhospServiceImpl.class b/health_hosp/target/classes/cn/card/health/service/impl/order/YcOrderInhospServiceImpl.class new file mode 100644 index 0000000..62a1778 Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/service/impl/order/YcOrderInhospServiceImpl.class differ diff --git a/health_hosp/target/classes/cn/card/health/service/impl/order/YcOrderRefundpayServiceImpl.class b/health_hosp/target/classes/cn/card/health/service/impl/order/YcOrderRefundpayServiceImpl.class new file mode 100644 index 0000000..7ea6a8c Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/service/impl/order/YcOrderRefundpayServiceImpl.class differ diff --git a/health_hosp/target/classes/cn/card/health/service/impl/order/YcOrderRegistServiceImpl.class b/health_hosp/target/classes/cn/card/health/service/impl/order/YcOrderRegistServiceImpl.class new file mode 100644 index 0000000..0cf3a12 Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/service/impl/order/YcOrderRegistServiceImpl.class differ diff --git a/health_hosp/target/classes/cn/card/health/service/impl/order/YcOrderSerialpayServiceImpl.class b/health_hosp/target/classes/cn/card/health/service/impl/order/YcOrderSerialpayServiceImpl.class new file mode 100644 index 0000000..4545f66 Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/service/impl/order/YcOrderSerialpayServiceImpl.class differ diff --git a/health_hosp/target/classes/cn/card/health/service/impl/order/YcOrderServiceImpl.class b/health_hosp/target/classes/cn/card/health/service/impl/order/YcOrderServiceImpl.class new file mode 100644 index 0000000..2a07d07 Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/service/impl/order/YcOrderServiceImpl.class differ diff --git a/health_hosp/target/classes/cn/card/health/service/impl/order/YcRegistSourceServiceImpl.class b/health_hosp/target/classes/cn/card/health/service/impl/order/YcRegistSourceServiceImpl.class new file mode 100644 index 0000000..a4394fe Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/service/impl/order/YcRegistSourceServiceImpl.class differ diff --git a/health_hosp/target/classes/cn/card/health/service/impl/order/YcSourceSheduleServiceImpl.class b/health_hosp/target/classes/cn/card/health/service/impl/order/YcSourceSheduleServiceImpl.class new file mode 100644 index 0000000..c72ab5c Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/service/impl/order/YcSourceSheduleServiceImpl.class differ diff --git a/health_hosp/target/classes/cn/card/health/service/order/IMedicalRecordService.class b/health_hosp/target/classes/cn/card/health/service/order/IMedicalRecordService.class new file mode 100644 index 0000000..b488128 Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/service/order/IMedicalRecordService.class differ diff --git a/health_hosp/target/classes/cn/card/health/service/order/IMkHisParamsService.class b/health_hosp/target/classes/cn/card/health/service/order/IMkHisParamsService.class new file mode 100644 index 0000000..0f3347f Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/service/order/IMkHisParamsService.class differ diff --git a/health_hosp/target/classes/cn/card/health/service/order/IYcOrderClinicDetailService.class b/health_hosp/target/classes/cn/card/health/service/order/IYcOrderClinicDetailService.class new file mode 100644 index 0000000..f810c62 Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/service/order/IYcOrderClinicDetailService.class differ diff --git a/health_hosp/target/classes/cn/card/health/service/order/IYcOrderClinicService.class b/health_hosp/target/classes/cn/card/health/service/order/IYcOrderClinicService.class new file mode 100644 index 0000000..dd13e66 Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/service/order/IYcOrderClinicService.class differ diff --git a/health_hosp/target/classes/cn/card/health/service/order/IYcOrderInhospService.class b/health_hosp/target/classes/cn/card/health/service/order/IYcOrderInhospService.class new file mode 100644 index 0000000..46a8e72 Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/service/order/IYcOrderInhospService.class differ diff --git a/health_hosp/target/classes/cn/card/health/service/order/IYcOrderRefundpayService.class b/health_hosp/target/classes/cn/card/health/service/order/IYcOrderRefundpayService.class new file mode 100644 index 0000000..7777e72 Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/service/order/IYcOrderRefundpayService.class differ diff --git a/health_hosp/target/classes/cn/card/health/service/order/IYcOrderRegistService.class b/health_hosp/target/classes/cn/card/health/service/order/IYcOrderRegistService.class new file mode 100644 index 0000000..9e3d4ab Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/service/order/IYcOrderRegistService.class differ diff --git a/health_hosp/target/classes/cn/card/health/service/order/IYcOrderSerialpayService.class b/health_hosp/target/classes/cn/card/health/service/order/IYcOrderSerialpayService.class new file mode 100644 index 0000000..35b75f3 Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/service/order/IYcOrderSerialpayService.class differ diff --git a/health_hosp/target/classes/cn/card/health/service/order/IYcOrderService.class b/health_hosp/target/classes/cn/card/health/service/order/IYcOrderService.class new file mode 100644 index 0000000..37f646b Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/service/order/IYcOrderService.class differ diff --git a/health_hosp/target/classes/cn/card/health/service/order/IYcRegistSourceService.class b/health_hosp/target/classes/cn/card/health/service/order/IYcRegistSourceService.class new file mode 100644 index 0000000..c01cf44 Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/service/order/IYcRegistSourceService.class differ diff --git a/health_hosp/target/classes/cn/card/health/service/order/IYcSourceSheduleService.class b/health_hosp/target/classes/cn/card/health/service/order/IYcSourceSheduleService.class new file mode 100644 index 0000000..6ad8e83 Binary files /dev/null and b/health_hosp/target/classes/cn/card/health/service/order/IYcSourceSheduleService.class differ diff --git a/health_hosp/target/classes/mapper/hospital/YcHospitalMapper.xml b/health_hosp/target/classes/mapper/hospital/YcHospitalMapper.xml new file mode 100644 index 0000000..0ebf2fa --- /dev/null +++ b/health_hosp/target/classes/mapper/hospital/YcHospitalMapper.xml @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + select + hospid, + hospname, + wechathospid, + hospcode, + del_flag, + createtime, + createby, + updatetime, + updateby + from yc_hospital + + + + + + + + + + insert into yc_hospital + + hospid, + hospname, + wechathospid, + hospcode, + del_flag, + createtime, + createby, + updatetime, + updateby, + + + #{hospid}, + #{hospname}, + #{wechathospid}, + #{hospcode}, + #{delFlag}, + #{createtime}, + #{createby}, + #{updatetime}, + #{updateby}, + + + + + update yc_hospital + + hospid = #{hospid}, + hospname = #{hospname}, + wechathospid = #{wechathospid}, + hospcode = #{hospcode}, + del_flag = #{delFlag}, + createtime = #{createtime}, + createby = #{createby}, + updatetime = #{updatetime}, + updateby = #{updateby}, + + where hospid = #{hospid} + + + + update sys_dept set del_flag = '2' where hospid = #{hospid} + + \ No newline at end of file diff --git a/health_hosp/target/classes/mapper/order/MedicalRecordMapper.xml b/health_hosp/target/classes/mapper/order/MedicalRecordMapper.xml new file mode 100644 index 0000000..4f8a818 --- /dev/null +++ b/health_hosp/target/classes/mapper/order/MedicalRecordMapper.xml @@ -0,0 +1,497 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id + , openid, patient_id, patient_name, apply_type, `name`, id_number, img1, img2, img4, purpose, + img3, copies, pages, amount, receive_type, receive_name, receive_phone, receive_address, + express_company, express_no, invoice, invoice_no, `status`, remark, order_no, del_flag, + create_time, update_time, update_by + + + + + + + + + + + insert into yc_medical_record (openid, patient_id, patient_name, + apply_type, `name`, id_number, + img1, img2, img3, img4, purpose, copies, + pages, amount, receive_type, + receive_name, receive_phone, receive_address, + express_company, express_no, invoice, + invoice_no, `status`, remark, + order_no, del_flag, create_time, + update_time, update_by) + values (#{openid,jdbcType=VARCHAR}, #{patientId,jdbcType=BIGINT}, #{patientName,jdbcType=VARCHAR}, + #{applyType,jdbcType=SMALLINT}, #{name,jdbcType=VARCHAR}, #{idNumber,jdbcType=VARCHAR}, + #{img1,jdbcType=VARCHAR}, #{img2,jdbcType=VARCHAR}, #{img3,jdbcType=VARCHAR}, #{img4,jdbcType=VARCHAR}, + #{purpose,jdbcType=VARCHAR}, + #{copies,jdbcType=SMALLINT}, + #{pages,jdbcType=SMALLINT}, #{amount,jdbcType=INTEGER}, #{receiveType,jdbcType=SMALLINT}, + #{receiveName,jdbcType=VARCHAR}, #{receivePhone,jdbcType=VARCHAR}, #{receiveAddress,jdbcType=VARCHAR}, + #{expressCompany,jdbcType=VARCHAR}, #{expressNo,jdbcType=VARCHAR}, #{invoice,jdbcType=SMALLINT}, + #{invoiceNo,jdbcType=VARCHAR}, #{status,jdbcType=SMALLINT}, #{remark,jdbcType=VARCHAR}, + #{orderNo,jdbcType=VARCHAR}, #{delFlag,jdbcType=SMALLINT}, #{createTime,jdbcType=TIMESTAMP}, + #{updateTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR}) + + + insert into yc_medical_record + + id, + + openid, + + + patient_id, + + + patient_name, + + + apply_type, + + + `name`, + + + id_number, + + + img1, + + + img2, + + + img3, + + + img4, + + + purpose, + + + copies, + + + pages, + + + amount, + + + receive_type, + + + receive_name, + + + receive_phone, + + + receive_address, + + + express_company, + + + express_no, + + + invoice, + + + invoice_no, + + + `status`, + + + remark, + + + order_no, + + + del_flag, + + + create_time, + + + update_time, + + + update_by, + + + + #{id,jdbcType=VARCHAR}, + + #{openid,jdbcType=VARCHAR}, + + + #{patientId,jdbcType=BIGINT}, + + + #{patientName,jdbcType=VARCHAR}, + + + #{applyType,jdbcType=SMALLINT}, + + + #{name,jdbcType=VARCHAR}, + + + #{idNumber,jdbcType=VARCHAR}, + + + #{img1,jdbcType=VARCHAR}, + + + #{img2,jdbcType=VARCHAR}, + + + #{img3,jdbcType=VARCHAR}, + + + #{img4,jdbcType=VARCHAR}, + + + #{purpose,jdbcType=VARCHAR}, + + + #{copies,jdbcType=SMALLINT}, + + + #{pages,jdbcType=SMALLINT}, + + + #{amount,jdbcType=INTEGER}, + + + #{receiveType,jdbcType=SMALLINT}, + + + #{receiveName,jdbcType=VARCHAR}, + + + #{receivePhone,jdbcType=VARCHAR}, + + + #{receiveAddress,jdbcType=VARCHAR}, + + + #{expressCompany,jdbcType=VARCHAR}, + + + #{expressNo,jdbcType=VARCHAR}, + + + #{invoice,jdbcType=SMALLINT}, + + + #{invoiceNo,jdbcType=VARCHAR}, + + + #{status,jdbcType=SMALLINT}, + + + #{remark,jdbcType=VARCHAR}, + + + #{orderNo,jdbcType=VARCHAR}, + + + #{delFlag,jdbcType=SMALLINT}, + + + #{createTime,jdbcType=TIMESTAMP}, + + + #{updateTime,jdbcType=TIMESTAMP}, + + + #{updateBy,jdbcType=VARCHAR}, + + + + + update yc_medical_record + + + openid = #{openid,jdbcType=VARCHAR}, + + + patient_id = #{patientId,jdbcType=BIGINT}, + + + patient_name = #{patientName,jdbcType=VARCHAR}, + + + apply_type = #{applyType,jdbcType=SMALLINT}, + + + `name` = #{name,jdbcType=VARCHAR}, + + + id_number = #{idNumber,jdbcType=VARCHAR}, + + + img1 = #{img1,jdbcType=VARCHAR}, + + + img2 = #{img2,jdbcType=VARCHAR}, + + + img3 = #{img3,jdbcType=VARCHAR}, + + + img4 = #{img4,jdbcType=VARCHAR}, + + + purpose = #{purpose,jdbcType=VARCHAR}, + + + copies = #{copies,jdbcType=SMALLINT}, + + + pages = #{pages,jdbcType=SMALLINT}, + + + amount = #{amount,jdbcType=INTEGER}, + + + receive_type = #{receiveType,jdbcType=SMALLINT}, + + + receive_name = #{receiveName,jdbcType=VARCHAR}, + + + receive_phone = #{receivePhone,jdbcType=VARCHAR}, + + + receive_address = #{receiveAddress,jdbcType=VARCHAR}, + + + express_company = #{expressCompany,jdbcType=VARCHAR}, + + + express_no = #{expressNo,jdbcType=VARCHAR}, + + + invoice = #{invoice,jdbcType=SMALLINT}, + + + invoice_no = #{invoiceNo,jdbcType=VARCHAR}, + + + `status` = #{status,jdbcType=SMALLINT}, + + + remark = #{remark,jdbcType=VARCHAR}, + + + order_no = #{orderNo,jdbcType=VARCHAR}, + + + del_flag = #{delFlag,jdbcType=SMALLINT}, + + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + update_time = #{updateTime,jdbcType=TIMESTAMP}, + + + update_by = #{updateBy,jdbcType=VARCHAR}, + + + where id = #{id,jdbcType=VARCHAR} + + + update yc_medical_record + set openid = #{openid,jdbcType=VARCHAR}, + patient_id = #{patientId,jdbcType=BIGINT}, + patient_name = #{patientName,jdbcType=VARCHAR}, + apply_type = #{applyType,jdbcType=SMALLINT}, + `name` = #{name,jdbcType=VARCHAR}, + id_number = #{idNumber,jdbcType=VARCHAR}, + img1 = #{img1,jdbcType=VARCHAR}, + img2 = #{img2,jdbcType=VARCHAR}, + img3 = #{img3,jdbcType=VARCHAR}, + img4 = #{img4,jdbcType=VARCHAR}, + purpose = #{purpose,jdbcType=VARCHAR}, + copies = #{copies,jdbcType=SMALLINT}, + pages = #{pages,jdbcType=SMALLINT}, + amount = #{amount,jdbcType=INTEGER}, + receive_type = #{receiveType,jdbcType=SMALLINT}, + receive_name = #{receiveName,jdbcType=VARCHAR}, + receive_phone = #{receivePhone,jdbcType=VARCHAR}, + receive_address = #{receiveAddress,jdbcType=VARCHAR}, + express_company = #{expressCompany,jdbcType=VARCHAR}, + express_no = #{expressNo,jdbcType=VARCHAR}, + invoice = #{invoice,jdbcType=SMALLINT}, + invoice_no = #{invoiceNo,jdbcType=VARCHAR}, + `status` = #{status,jdbcType=SMALLINT}, + remark = #{remark,jdbcType=VARCHAR}, + order_no = #{orderNo,jdbcType=VARCHAR}, + del_flag = #{delFlag,jdbcType=SMALLINT}, + create_time = #{createTime,jdbcType=TIMESTAMP}, + update_time = #{updateTime,jdbcType=TIMESTAMP}, + update_by = #{updateBy,jdbcType=VARCHAR} + where id = #{id,jdbcType=VARCHAR} + + + update yc_medical_record + + + openid = #{openid,jdbcType=VARCHAR}, + + + patient_id = #{patientId,jdbcType=BIGINT}, + + + patient_name = #{patientName,jdbcType=VARCHAR}, + + + apply_type = #{applyType,jdbcType=SMALLINT}, + + + `name` = #{name,jdbcType=VARCHAR}, + + + id_number = #{idNumber,jdbcType=VARCHAR}, + + + img1 = #{img1,jdbcType=VARCHAR}, + + + img2 = #{img2,jdbcType=VARCHAR}, + + + img3 = #{img3,jdbcType=VARCHAR}, + + + img4 = #{img4,jdbcType=VARCHAR}, + + + purpose = #{purpose,jdbcType=VARCHAR}, + + + copies = #{copies,jdbcType=SMALLINT}, + + + pages = #{pages,jdbcType=SMALLINT}, + + + amount = #{amount,jdbcType=INTEGER}, + + + receive_type = #{receiveType,jdbcType=SMALLINT}, + + + receive_name = #{receiveName,jdbcType=VARCHAR}, + + + receive_phone = #{receivePhone,jdbcType=VARCHAR}, + + + receive_address = #{receiveAddress,jdbcType=VARCHAR}, + + + express_company = #{expressCompany,jdbcType=VARCHAR}, + + + express_no = #{expressNo,jdbcType=VARCHAR}, + + + invoice = #{invoice,jdbcType=SMALLINT}, + + + invoice_no = #{invoiceNo,jdbcType=VARCHAR}, + + + `status` = #{status,jdbcType=SMALLINT}, + + + remark = #{remark,jdbcType=VARCHAR}, + + + del_flag = #{delFlag,jdbcType=SMALLINT}, + + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + update_time = #{updateTime,jdbcType=TIMESTAMP}, + + + update_by = #{updateBy,jdbcType=VARCHAR}, + + + where order_no = #{orderNo,jdbcType=VARCHAR} + + \ No newline at end of file diff --git a/health_hosp/target/classes/mapper/order/MkHisParamsMapper.xml b/health_hosp/target/classes/mapper/order/MkHisParamsMapper.xml new file mode 100644 index 0000000..d7d6206 --- /dev/null +++ b/health_hosp/target/classes/mapper/order/MkHisParamsMapper.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + select mk_id, mk_method, mk_requestdata, mk_responsedata, create_time from mk_his_params + + + + + + + + insert into mk_his_params + + mk_method, + mk_requestdata, + mk_responsedata, + create_time, + + + #{mkMethod}, + #{mkRequestData}, + #{mkResponseData}, + #{createTime}, + + + + + update mk_his_params + + mk_method = #{mkMethod}, + mk_requestdata = #{mkRequestData}, + mk_responsedata = #{mkResponseData}, + create_time = #{createTime}, + + where mk_id = #{mkId} + + + + delete from mk_his_params where mk_id = #{mkId} + + + + delete from mk_his_params where mk_id in + + #{mkId} + + + \ No newline at end of file diff --git a/health_hosp/target/classes/mapper/order/YcOrderClinicDetailMapper.xml b/health_hosp/target/classes/mapper/order/YcOrderClinicDetailMapper.xml new file mode 100644 index 0000000..55a1102 --- /dev/null +++ b/health_hosp/target/classes/mapper/order/YcOrderClinicDetailMapper.xml @@ -0,0 +1,165 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + select clinic_detailid, + orderid, + clinic_orderid, + patientid, + deptName, + doctorName, + payAmount, + detailTypeId, + detailFee, + detailId, + detailName, + detailCount, + detailUnit, + detailAmount, + detailSpec, + detailPrice, + from yc_order_clinic_detail + + + + + + + + + + insert into yc_order_clinic_detail + + clinic_detailid, + orderid, + clinic_orderid, + patientid, + deptName, + doctorName, + payAmount, + detailTypeId, + detailFee, + detailId, + detailName, + detailCount, + detailUnit, + detailAmount, + detailSpec, + detailPrice, + + + #{clinicDetailid}, + #{orderid}, + #{clinicOrderid}, + #{patientid}, + #{deptname}, + #{doctorname}, + #{payamount}, + #{detailtypeid}, + #{detailfee}, + #{detailid}, + #{detailname}, + #{detailcount}, + #{detailunit}, + #{detailamount}, + #{detailspec}, + #{detailprice}, + + + + + update yc_order_clinic_detail + + clinic_detailid = #{clinicDetailid}, + orderid = #{orderid}, + clinic_orderid = #{clinicOrderid}, + patientid = #{patientid}, + deptName = #{deptname}, + doctorName = #{doctorname}, + payAmount = #{payamount}, + detailTypeId = #{detailtypeid}, + detailFee = #{detailfee}, + detailId = #{detailid}, + detailName = #{detailname}, + detailCount = #{detailcount}, + detailUnit = #{detailunit}, + detailAmount = #{detailamount}, + detailSpec = #{detailspec}, + detailPrice = #{detailprice}, + + where clinic_detailid = #{clinicDetailid} + + + + update sys_dept + set del_flag = '2' + where clinic_detailid = #{clinicDetailid} + + \ No newline at end of file diff --git a/health_hosp/target/classes/mapper/order/YcOrderClinicMapper.xml b/health_hosp/target/classes/mapper/order/YcOrderClinicMapper.xml new file mode 100644 index 0000000..6279ecb --- /dev/null +++ b/health_hosp/target/classes/mapper/order/YcOrderClinicMapper.xml @@ -0,0 +1,177 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select clinic_orderid, + orderid, + orderno, + patientid, + openid, + his_patientid, + hisid, + hisLockid, + his_orderid, + visitid, + hospid, + deptNo, + deptName, + doctorNo, + doctorName, + totalMoney, + createtime, + updatetime + from yc_order_clinic + + + + + + + + + + insert into yc_order_clinic + + clinic_orderid, + orderid, + orderno, + patientid, + openid, + his_patientid, + hisid, + hisLockid, + his_orderid, + visitid, + hospid, + deptNo, + deptName, + doctorNo, + doctorName, + totalMoney, + createtime, + updatetime, + + + #{clinicOrderid}, + #{orderid}, + #{orderno}, + #{patientid}, + #{openid}, + #{hisPatientid}, + #{hisid}, + #{hislockid}, + #{hisOrderid}, + #{visitid}, + #{hospid}, + #{deptno}, + #{deptname}, + #{doctorno}, + #{doctorname}, + #{totalmoney}, + #{createtime}, + #{updatetime}, + + + + + update yc_order_clinic + + clinic_orderid = #{clinicOrderid}, + orderid = #{orderid}, + orderno = #{orderno}, + patientid = #{patientid}, + openid = #{openid}, + his_patientid = #{hisPatientid}, + hisid = #{hisid}, + hisLockid = #{hislockid}, + his_orderid = #{hisOrderid}, + visitid = #{visitid}, + hospid = #{hospid}, + deptNo = #{deptno}, + deptName = #{deptname}, + doctorNo = #{doctorno}, + doctorName = #{doctorname}, + totalMoney = #{totalmoney}, + createtime = #{createtime}, + updatetime = #{updatetime}, + + where clinic_orderid = #{clinicOrderid} + + + + update sys_dept + set del_flag = '2' + where clinic_orderid = #{clinicOrderid} + + \ No newline at end of file diff --git a/health_hosp/target/classes/mapper/order/YcOrderInhospMapper.xml b/health_hosp/target/classes/mapper/order/YcOrderInhospMapper.xml new file mode 100644 index 0000000..89953ed --- /dev/null +++ b/health_hosp/target/classes/mapper/order/YcOrderInhospMapper.xml @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + select inhosp_orderid, + orderid, + orderno, + his_orderid, + patientid, + openid, + userid, + totalMoney, + del_flag, + createtime, + updatetime + from yc_order_inhosp + + + + + + + + + + insert into yc_order_inhosp + + inhosp_orderid, + orderid, + orderno, + his_orderid, + patientid, + openid, + userid, + totalMoney, + del_flag, + createtime, + updatetime, + + + #{inhospOrderid}, + #{orderid}, + #{orderno}, + #{hisOrderid}, + #{patientid}, + #{openid}, + #{userid}, + #{totalmoney}, + #{delFlag}, + #{createtime}, + #{updatetime}, + + + + + update yc_order_inhosp + + inhosp_orderid = #{inhospOrderid}, + orderid = #{orderid}, + orderno = #{orderno}, + his_orderid = #{hisOrderid}, + patientid = #{patientid}, + openid = #{openid}, + userid = #{userid}, + totalMoney = #{totalmoney}, + del_flag = #{delFlag}, + createtime = #{createtime}, + updatetime = #{updatetime}, + + where inhosp_orderid = #{inhospOrderid} + + + + update + sys_dept + set del_flag = '2' + where inhosp_orderid = #{inhospOrderid} + + \ No newline at end of file diff --git a/health_hosp/target/classes/mapper/order/YcOrderMapper.xml b/health_hosp/target/classes/mapper/order/YcOrderMapper.xml new file mode 100644 index 0000000..f40f4c6 --- /dev/null +++ b/health_hosp/target/classes/mapper/order/YcOrderMapper.xml @@ -0,0 +1,183 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select orderid, + patientid, + userid, + openid, + ordertype, + orderno, + del_flag, + orderstatus, + createtime, + reason, + totalmoney, + hisOrderId, + hisOrderPayId, + visitid, + hospid, + insureStatus, + hisStatus, + payStatus + from yc_order + + + + + + + + + + + + + + insert into yc_order + + orderid, + userid, + patientid, + openid, + ordertype, + orderno, + orderstatus, + reason, + totalmoney, + hospid, + hisOrderId, + payStatus, + hisStatus, + insureStatus, + del_flag, + createtime, + + + #{orderid}, + #{userid}, + #{patientid}, + #{openid}, + #{ordertype}, + #{orderno}, + #{orderStatus}, + #{reason}, + #{totalmoney}, + #{hospid}, + #{hisOrderId}, + #{payStatus}, + #{hisStatus}, + #{insureStatus}, + 1, + #{createtime}, + + + + + update yc_order + + ordertype = #{ordertype}, + orderno = #{orderno}, + orderstatus = #{orderStatus}, + reason = #{reason}, + hisOrderPayId = #{hisOrderPayId}, + hisOrderId = #{hisOrderId}, + receiptId = #{receiptId}, + hospid=#{hospid}, + insureStatus=#{insureStatus}, + hisStatus=#{hisStatus}, + payStatus=#{payStatus}, + + + and orderid=#{orderid} + and orderno=#{orderno} + + + + + update yc_order + set del_flag = '2' + where orderid = #{orderid} + + \ No newline at end of file diff --git a/health_hosp/target/classes/mapper/order/YcOrderRefundpayMapper.xml b/health_hosp/target/classes/mapper/order/YcOrderRefundpayMapper.xml new file mode 100644 index 0000000..894ea21 --- /dev/null +++ b/health_hosp/target/classes/mapper/order/YcOrderRefundpayMapper.xml @@ -0,0 +1,155 @@ + + + + + + + + + + + + + + + + + + + + + + select + refundpayid, + orderid, + serialpayid, + out_refund_no, + refundid, + paytype, + money, + refundstatus, + refundtime, + createtime, + modifytime + from + yc_order_refundpay + + + + + + + + + + insert into yc_order_refundpay + + refundpayid, + orderid, + serialpayid, + out_refund_no, + refundid, + paytype, + money, + refundstatus, + refundtime, + createtime, + modifytime, + + + #{refundpayid}, + #{orderid}, + #{serialpayid}, + #{outrefundno}, + #{refundid}, + #{paytype}, + #{money}, + #{refundstatus}, + #{refundtime}, + #{createtime}, + #{modifytime}, + + + + + update yc_order_refundpay + + refundpayid = #{refundpayid}, + orderid = #{orderid}, + serialpayid = #{serialpayid}, + out_refund_no = #{outrefundno}, + refundid = #{refundid}, + paytype = #{paytype}, + money = #{money}, + refundstatus = #{refundstatus}, + refundtime = #{refundtime}, + createtime = #{createtime}, + modifytime = SYSDATE(), + + where refundpayid = #{refundpayid} + + + + update yc_order_refundpay + + refundpayid = #{refundpayid}, + orderid = #{orderid}, + serialpayid = #{serialpayid}, + out_refund_no = #{outrefundno}, + refundid = #{refundid}, + money = #{money}, + refundstatus = #{refundstatus}, + refundtime = #{refundtime}, + createtime = #{createtime}, + modifytime = #{modifytime}, + + where out_refund_no = #{outrefundno} + and paytype = #{paytype} + + + + update + sys_dept set del_flag = '2' where refundpayid = #{refundpayid} + + \ No newline at end of file diff --git a/health_hosp/target/classes/mapper/order/YcOrderRegistMapper.xml b/health_hosp/target/classes/mapper/order/YcOrderRegistMapper.xml new file mode 100644 index 0000000..721225c --- /dev/null +++ b/health_hosp/target/classes/mapper/order/YcOrderRegistMapper.xml @@ -0,0 +1,232 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select regist_orderid, + orderid, + orderno, + ordertype, + openid, + patientid, + his_patientid, + hisid, + hospid, + deptno, + deptname, + doctorno, + doctorname, + regdate, + begintime, + endtime, + scheduleFlag, + his_orderid, + hisLockid, + fee, + treatfee, + totalmoney, + orderstatus, + createtime, + updatetime + from yc_order_regist + + + + + + + + + + + + + insert into yc_order_regist + + regist_orderid, + orderid, + orderno, + ordertype, + openid, + patientid, + his_patientid, + hisid, + hospid, + deptNo, + deptName, + doctorNo, + doctorName, + regDate, + beginTime, + endTime, + scheduleFlag, + his_orderid, + hisLockid, + fee, + treatfee, + totalmoney, + orderStatus, + createtime, + updatetime, + + + #{registOrderid}, + #{orderid}, + #{orderno}, + #{ordertype}, + #{openid}, + #{patientid}, + #{hisPatientid}, + #{hisid}, + #{hospid}, + #{deptno}, + #{deptname}, + #{doctorno}, + #{doctorname}, + #{regdate}, + #{begintime}, + #{endtime}, + #{scheduleFlag}, + #{hisOrderid}, + #{hisLockid}, + #{fee}, + #{treatfee}, + #{totalmoney}, + #{orderstatus}, + #{createtime}, + #{updatetime}, + + + + + update yc_order_regist + + regist_orderid = #{registOrderid}, + orderid = #{orderid}, + orderno = #{orderno}, + patientid = #{patientid}, + his_patientid = #{hisPatientid}, + hisid = #{hisid}, + hospid = #{hospid}, + deptNo = #{deptno}, + deptName = #{deptname}, + doctorNo = #{doctorno}, + doctorName = #{doctorname}, + regDate = #{regdate}, + beginTime = #{begintime}, + endTime = #{endtime}, + scheduleFlag = #{scheduleFlag}, + his_orderid = #{hisOrderid}, + hisLockid = #{hisLockid}, + fee = #{fee}, + treatfee = #{treatfee}, + totalmoney = #{totalmoney}, + orderStatus = #{orderstatus}, + createtime = #{createtime}, + updatetime = #{updatetime}, + + where regist_orderid = #{registOrderid} + + + + update yc_order_regist + set del_flag = '2' + where regist_orderid = #{registOrderid} + + \ No newline at end of file diff --git a/health_hosp/target/classes/mapper/order/YcOrderSerialpayMapper.xml b/health_hosp/target/classes/mapper/order/YcOrderSerialpayMapper.xml new file mode 100644 index 0000000..04d19f1 --- /dev/null +++ b/health_hosp/target/classes/mapper/order/YcOrderSerialpayMapper.xml @@ -0,0 +1,244 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select serialpayid, + orderid, + patientid, + hospid, + money, + paytime, + businesstype, + serialno, + out_trade_no, + prepayid, + transactionid, + paytype, + paynocestr, + payname, + paystatus, + paymoney, + totalmoney, + userno, + createip, + createtime, + updatetime, + description + from yc_order_serialpay + + + + + + + + + + insert into yc_order_serialpay + + serialpayid, + orderid, + patientid, + hospid, + money, + paytime, + businesstype, + serialno, + out_trade_no, + prepayid, + transactionid, + paytype, + payname, + paystatus, + paynocestr, + paymoney, + totalmoney, + userno, + createip, + createtime, + updatetime, + description, + + + #{serialpayid}, + #{orderid}, + #{patientid}, + #{hospid}, + #{money}, + #{paytime}, + #{businesstype}, + #{serialno}, + #{outtradeno}, + #{prepayid}, + #{transactionid}, + #{paytype}, + #{payname}, + #{paystatus}, + #{paynocestr}, + #{paymoney}, + #{totalmoney}, + #{userno}, + #{createip}, + SYSDATE(), + #{updatetime}, + #{description}, + + + + + update yc_order_serialpay + + serialpayid = #{serialpayid}, + orderid = #{orderid}, + patientid = #{patientid}, + hospid = #{hospid}, + money = #{money}, + paytime = #{paytime}, + businesstype = #{businesstype}, + serialno = #{serialno}, + out_trade_no = #{outtradeno}, + prepayid = #{prepayid}, + transactionid = #{transactionid}, + paytype = #{paytype}, + payname = #{payname}, + paystatus = #{paystatus}, + paynocestr = #{paynocestr}, + paymoney = #{paymoney}, + totalmoney = #{totalmoney}, + userno = #{userno}, + createip = #{createip}, + createtime = #{createtime}, + updatetime = SYSDATE(), + description = #{description}, + + where serialpayid = #{serialpayid} + + + update yc_order_serialpay + + serialpayid = #{serialpayid}, + orderid = #{orderid}, + patientid = #{patientid}, + hospid = #{hospid}, + money = #{money}, + paytime = #{paytime}, + businesstype = #{businesstype}, + serialno = #{serialno}, + out_trade_no = #{outtradeno}, + prepayid = #{prepayid}, + transactionid = #{transactionid}, + paytype = #{paytype}, + payname = #{payname}, + paystatus = #{paystatus}, + paynocestr = #{paynocestr}, + paymoney = #{paymoney}, + totalmoney = #{totalmoney}, + userno = #{userno}, + createip = #{createip}, + updatetime = SYSDATE(), + description = #{description}, + + where out_trade_no = #{outtradeno} and paytype= #{paytype} + + + + update + yc_order_serialpay + set del_flag = 2 + where serialpayid = #{serialpayid} + + \ No newline at end of file diff --git a/health_hosp/target/classes/mapper/order/YcRegistSourceMapper.xml b/health_hosp/target/classes/mapper/order/YcRegistSourceMapper.xml new file mode 100644 index 0000000..b319bf0 --- /dev/null +++ b/health_hosp/target/classes/mapper/order/YcRegistSourceMapper.xml @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + select + sourceid, + hospid, + deptNo, + deptName, + doctorNo, + doctorName, + regWeekDay, + regDate, + regLeaveCount, + regStatus, + regTotalCount, + scheduleType, + regFee, + treatFee, + isTimeReg, + createtime + from yc_regist_source + + + + + + + + + + insert into yc_regist_source + + sourceid, + hospid, + deptNo, + deptName, + doctorNo, + doctorName, + regWeekDay, + regDate, + regLeaveCount, + regStatus, + regTotalCount, + scheduleType, + regFee, + treatFee, + isTimeReg, + createtime, + + + #{sourceid}, + #{hospid}, + #{deptno}, + #{deptname}, + #{doctorno}, + #{doctorname}, + #{regweekday}, + #{regdate}, + #{regleavecount}, + #{regstatus}, + #{regtotalcount}, + #{scheduletype}, + #{regfee}, + #{treatfee}, + #{istimereg}, + #{createtime}, + + + + + update yc_regist_source + + sourceid = #{sourceid}, + hospid = #{hospid}, + deptNo = #{deptno}, + deptName = #{deptname}, + doctorNo = #{doctorno}, + doctorName = #{doctorname}, + regWeekDay = #{regweekday}, + regDate = #{regdate}, + regLeaveCount = #{regleavecount}, + regStatus = #{regstatus}, + regTotalCount = #{regtotalcount}, + scheduleType = #{scheduletype}, + regFee = #{regfee}, + treatFee = #{treatfee}, + isTimeReg = #{istimereg}, + createtime = #{createtime}, + + where sourceid = #{sourceid} + + + + update sys_dept set del_flag = '2' where sourceid = #{sourceid} + + \ No newline at end of file diff --git a/health_hosp/target/classes/mapper/order/YcSourceSheduleMapper.xml b/health_hosp/target/classes/mapper/order/YcSourceSheduleMapper.xml new file mode 100644 index 0000000..85df0fd --- /dev/null +++ b/health_hosp/target/classes/mapper/order/YcSourceSheduleMapper.xml @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + + + + + + select + sheduleid, + hospid, + sourceid, + regTotalCount, + regLeaveCount, + visitsNum, + beginTime, + endTime, + signalSourceID, + createtime + from yc_source_shedule + + + + + + + + + + insert into yc_source_shedule + + sheduleid, + hospid, + sourceid, + regTotalCount, + regLeaveCount, + visitsNum, + beginTime, + endTime, + signalSourceID, + createtime, + + + #{sheduleid}, + #{hospid}, + #{sourceid}, + #{regtotalcount}, + #{regleavecount}, + #{visitsnum}, + #{begintime}, + #{endtime}, + #{signalsourceid}, + #{createtime}, + + + + + update yc_source_shedule + + sheduleid = #{sheduleid}, + hospid = #{hospid}, + sourceid = #{sourceid}, + regTotalCount = #{regtotalcount}, + regLeaveCount = #{regleavecount}, + visitsNum = #{visitsnum}, + beginTime = #{begintime}, + endTime = #{endtime}, + signalSourceID = #{signalsourceid}, + createtime = #{createtime}, + + where sheduleid = #{sheduleid} + + + + update + sys_dept set del_flag = '2' where sheduleid = #{sheduleid} + + \ No newline at end of file diff --git a/health_hosp/target/health_hosp.jar b/health_hosp/target/health_hosp.jar new file mode 100644 index 0000000..f1efc12 Binary files /dev/null and b/health_hosp/target/health_hosp.jar differ diff --git a/health_hosp/target/maven-archiver/pom.properties b/health_hosp/target/maven-archiver/pom.properties new file mode 100644 index 0000000..b6f6908 --- /dev/null +++ b/health_hosp/target/maven-archiver/pom.properties @@ -0,0 +1,3 @@ +version=1.0.2 +groupId=cn.health.service +artifactId=health_hosp diff --git a/health_hosp/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/health_hosp/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 0000000..853c12e --- /dev/null +++ b/health_hosp/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1,47 @@ +cn/card/health/service/order/IYcOrderRefundpayService.class +cn/card/health/bean/order/YcOrderRefundpay.class +cn/card/health/mapper/order/YcOrderClinicMapper.class +cn/card/health/service/order/IYcOrderRegistService.class +cn/card/health/service/impl/order/YcOrderRefundpayServiceImpl.class +cn/card/health/mapper/order/YcOrderRefundpayMapper.class +cn/card/health/service/order/IYcSourceSheduleService.class +cn/card/health/bean/order/YcOrderClinicDetail.class +cn/card/health/service/order/IYcOrderClinicService.class +cn/card/health/bean/order/YcOrderClinic.class +cn/card/health/mapper/hospital/YcHospitalMapper.class +cn/card/health/service/impl/order/YcRegistSourceServiceImpl.class +cn/card/health/bean/order/MkHisParams.class +cn/card/health/mapper/order/YcSourceSheduleMapper.class +cn/card/health/mapper/order/YcOrderClinicDetailMapper.class +cn/card/health/bean/order/YcOrderRegist.class +cn/card/health/service/order/IYcOrderService.class +cn/card/health/bean/order/YcOrder.class +cn/card/health/service/impl/order/YcOrderServiceImpl.class +cn/card/health/mapper/order/MedicalRecordMapper.class +cn/card/health/service/impl/order/YcSourceSheduleServiceImpl.class +cn/card/health/service/order/IYcOrderInhospService.class +cn/card/health/service/order/IYcOrderClinicDetailService.class +cn/card/health/mapper/order/MkHisParamsMapper.class +cn/card/health/service/order/IYcOrderSerialpayService.class +cn/card/health/service/impl/order/YcOrderClinicDetailServiceImpl.class +cn/card/health/bean/order/YcSourceShedule.class +cn/card/health/service/hospital/IYcHospitalService.class +cn/card/health/service/order/IMedicalRecordService.class +cn/card/health/service/impl/order/MkHisParamsServiceImpl.class +cn/card/health/bean/order/MedicalRecord.class +cn/card/health/mapper/order/YcOrderRegistMapper.class +cn/card/health/bean/order/YcOrderSerialpay.class +cn/card/health/mapper/order/YcOrderMapper.class +cn/card/health/service/impl/order/YcOrderInhospServiceImpl.class +cn/card/health/mapper/order/YcOrderSerialpayMapper.class +cn/card/health/bean/order/YcOrderInhosp.class +cn/card/health/service/order/IMkHisParamsService.class +cn/card/health/service/impl/order/YcOrderClinicServiceImpl.class +cn/card/health/service/order/IYcRegistSourceService.class +cn/card/health/service/impl/order/MedicalRecordServiceImpl.class +cn/card/health/mapper/order/YcRegistSourceMapper.class +cn/card/health/service/hospital/impl/YcHospitalServiceImpl.class +cn/card/health/service/impl/order/YcOrderRegistServiceImpl.class +cn/card/health/mapper/order/YcOrderInhospMapper.class +cn/card/health/service/impl/order/YcOrderSerialpayServiceImpl.class +cn/card/health/bean/order/YcRegistSource.class diff --git a/health_hosp/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/health_hosp/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 0000000..32fb80d --- /dev/null +++ b/health_hosp/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1,47 @@ +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/service/order/IYcOrderInhospService.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/service/order/IYcSourceSheduleService.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/service/order/IYcOrderClinicService.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/mapper/order/MkHisParamsMapper.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/bean/order/YcOrderSerialpay.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/bean/order/YcOrder.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/service/impl/order/YcOrderRefundpayServiceImpl.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/bean/order/YcRegistSource.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/mapper/order/YcOrderRegistMapper.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/mapper/order/YcOrderClinicMapper.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/service/order/IYcOrderService.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/mapper/order/YcOrderInhospMapper.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/service/impl/order/YcOrderServiceImpl.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/mapper/order/YcOrderMapper.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/service/impl/order/YcOrderClinicServiceImpl.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/service/impl/order/YcOrderSerialpayServiceImpl.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/bean/order/YcOrderRegist.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/service/impl/order/YcSourceSheduleServiceImpl.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/service/impl/order/YcOrderClinicDetailServiceImpl.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/bean/order/YcOrderClinicDetail.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/service/order/IYcRegistSourceService.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/service/impl/order/YcRegistSourceServiceImpl.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/bean/order/YcSourceShedule.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/service/hospital/IYcHospitalService.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/bean/order/YcOrderRefundpay.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/mapper/order/YcRegistSourceMapper.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/service/order/IYcOrderClinicDetailService.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/mapper/order/YcSourceSheduleMapper.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/mapper/order/YcOrderSerialpayMapper.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/service/impl/order/MedicalRecordServiceImpl.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/service/impl/order/MkHisParamsServiceImpl.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/service/order/IMedicalRecordService.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/mapper/order/YcOrderClinicDetailMapper.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/mapper/hospital/YcHospitalMapper.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/service/impl/order/YcOrderRegistServiceImpl.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/service/impl/order/YcOrderInhospServiceImpl.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/service/order/IYcOrderSerialpayService.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/mapper/order/MedicalRecordMapper.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/service/order/IMkHisParamsService.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/bean/order/YcOrderInhosp.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/service/order/IYcOrderRegistService.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/service/order/IYcOrderRefundpayService.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/service/hospital/impl/YcHospitalServiceImpl.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/mapper/order/YcOrderRefundpayMapper.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/bean/order/MedicalRecord.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/bean/order/MkHisParams.java +/Users/circlexing/work_java/1/health_parent/health_hosp/src/main/java/cn/card/health/bean/order/YcOrderClinic.java diff --git a/health_hosp/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst b/health_hosp/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst new file mode 100644 index 0000000..e69de29 diff --git a/health_hosp/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/health_hosp/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst new file mode 100644 index 0000000..e69de29 diff --git a/health_service/.DS_Store b/health_service/.DS_Store new file mode 100644 index 0000000..fd49df5 Binary files /dev/null and b/health_service/.DS_Store differ diff --git a/health_service/HealthCard_Service.iml b/health_service/HealthCard_Service.iml new file mode 100644 index 0000000..c774131 --- /dev/null +++ b/health_service/HealthCard_Service.iml @@ -0,0 +1,136 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/health_service/logs/logFile.log b/health_service/logs/logFile.log new file mode 100644 index 0000000..5a922f7 --- /dev/null +++ b/health_service/logs/logFile.log @@ -0,0 +1,310 @@ +2024-06-03 08:46:08 [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]-[INFO] Neither @ContextConfiguration nor @ContextHierarchy found for test class [cn.card.health.test.TestLoaderController], using SpringBootContextLoader +2024-06-03 08:46:08 [org.springframework.test.context.support.AbstractContextLoader]-[INFO] Could not detect default resource locations for test class [cn.card.health.test.TestLoaderController]: no resource found for suffixes {-context.xml, Context.groovy}. +2024-06-03 08:46:08 [org.springframework.test.context.support.AnnotationConfigContextLoaderUtils]-[INFO] Could not detect default configuration classes for test class [cn.card.health.test.TestLoaderController]: TestLoaderController does not declare any static, non-private, non-final, nested classes annotated with @Configuration. +2024-06-03 08:46:08 [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]-[INFO] Found @SpringBootConfiguration cn.card.health.HealthApplication for test class cn.card.health.test.TestLoaderController +2024-06-03 08:46:08 [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]-[INFO] Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener, org.springframework.test.context.event.EventPublishingTestExecutionListener] +2024-06-03 08:46:08 [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]-[INFO] Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@1d296da, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@7c7a06ec, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@75d4a5c2, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@557caf28, org.springframework.test.context.support.DirtiesContextTestExecutionListener@408d971b, org.springframework.test.context.transaction.TransactionalTestExecutionListener@6c6cb480, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@3c46e67a, org.springframework.test.context.event.EventPublishingTestExecutionListener@c730b35, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@206a70ef, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@292b08d6, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@22555ebf, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@36ebc363, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@45752059] +2024-06-03 08:46:09 [org.hibernate.validator.internal.util.Version]-[INFO] HV000001: Hibernate Validator 6.0.20.Final +2024-06-03 08:46:09 [cn.card.health.test.TestLoaderController]-[INFO] Starting TestLoaderController on 192.168.5.26 with PID 95374 (started by circlexing in /Users/circlexing/work_java/1/health_parent/health_service) +2024-06-03 08:46:09 [cn.card.health.test.TestLoaderController]-[INFO] The following profiles are active: dev +2024-06-03 08:46:11 [org.springframework.data.repository.config.RepositoryConfigurationDelegate]-[INFO] Multiple Spring Data modules found, entering strict repository configuration mode! +2024-06-03 08:46:11 [org.springframework.data.repository.config.RepositoryConfigurationDelegate]-[INFO] Bootstrapping Spring Data Redis repositories in DEFAULT mode. +2024-06-03 08:46:11 [org.springframework.data.repository.config.RepositoryConfigurationDelegate]-[INFO] Finished Spring Data repository scanning in 74ms. Found 0 Redis repository interfaces. +2024-06-03 08:46:17 [springfox.documentation.spring.web.PropertySourcedRequestMappingHandlerMapping]-[INFO] Mapped URL path [/v2/api-docs] onto method [springfox.documentation.swagger2.web.Swagger2Controller#getDocumentation(String, HttpServletRequest)] +2024-06-03 08:46:18 [org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor]-[INFO] Initializing ExecutorService 'applicationTaskExecutor' +2024-06-03 08:46:18 [org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler]-[INFO] Initializing ExecutorService 'taskScheduler' +2024-06-03 08:46:19 [springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper]-[INFO] Context refreshed +2024-06-03 08:46:19 [springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper]-[INFO] Found 1 custom documentation plugin(s) +2024-06-03 08:46:19 [springfox.documentation.spring.web.scanners.ApiListingReferenceScanner]-[INFO] Scanning for api listing references +2024-06-03 08:46:19 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: refundPreRegUsingPOST_1 +2024-06-03 08:46:19 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_1 +2024-06-03 08:46:19 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectListUsingPOST_1 +2024-06-03 08:46:19 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_1 +2024-06-03 08:46:19 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_2 +2024-06-03 08:46:19 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectListUsingPOST_2 +2024-06-03 08:46:19 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_2 +2024-06-03 08:46:19 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_3 +2024-06-03 08:46:19 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectListUsingPOST_3 +2024-06-03 08:46:19 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_3 +2024-06-03 08:46:19 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_4 +2024-06-03 08:46:19 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectListUsingPOST_4 +2024-06-03 08:46:19 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_4 +2024-06-03 08:46:19 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_5 +2024-06-03 08:46:19 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectListUsingPOST_5 +2024-06-03 08:46:19 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_5 +2024-06-03 08:46:19 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_6 +2024-06-03 08:46:20 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_6 +2024-06-03 08:46:20 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_7 +2024-06-03 08:46:20 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectByTradeUsingPOST_1 +2024-06-03 08:46:20 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectListUsingPOST_6 +2024-06-03 08:46:20 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_7 +2024-06-03 08:46:20 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_8 +2024-06-03 08:46:20 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectListUsingPOST_7 +2024-06-03 08:46:20 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_8 +2024-06-03 08:46:20 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_9 +2024-06-03 08:46:20 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectListUsingPOST_8 +2024-06-03 08:46:20 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_9 +2024-06-03 08:46:20 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_10 +2024-06-03 08:46:20 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectListUsingPOST_9 +2024-06-03 08:46:20 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_10 +2024-06-03 08:46:20 [cn.card.health.test.TestLoaderController]-[INFO] Started TestLoaderController in 11.175 seconds (JVM running for 12.44) +2024-06-03 08:46:20 [com.zaxxer.hikari.HikariDataSource]-[INFO] HikariPool-1 - Starting... +2024-06-03 08:46:20 [com.zaxxer.hikari.HikariDataSource]-[INFO] HikariPool-1 - Start completed. +2024-06-03 08:46:21 [org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler]-[INFO] Shutting down ExecutorService 'taskScheduler' +2024-06-03 08:46:21 [org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor]-[INFO] Shutting down ExecutorService 'applicationTaskExecutor' +2024-06-03 08:46:21 [com.zaxxer.hikari.HikariDataSource]-[INFO] HikariPool-1 - Shutdown initiated... +2024-06-03 08:46:21 [com.zaxxer.hikari.HikariDataSource]-[INFO] HikariPool-1 - Shutdown completed. +2024-06-03 08:49:54 [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]-[INFO] Neither @ContextConfiguration nor @ContextHierarchy found for test class [cn.card.health.test.TestLoaderController], using SpringBootContextLoader +2024-06-03 08:49:54 [org.springframework.test.context.support.AbstractContextLoader]-[INFO] Could not detect default resource locations for test class [cn.card.health.test.TestLoaderController]: no resource found for suffixes {-context.xml, Context.groovy}. +2024-06-03 08:49:54 [org.springframework.test.context.support.AnnotationConfigContextLoaderUtils]-[INFO] Could not detect default configuration classes for test class [cn.card.health.test.TestLoaderController]: TestLoaderController does not declare any static, non-private, non-final, nested classes annotated with @Configuration. +2024-06-03 08:49:55 [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]-[INFO] Found @SpringBootConfiguration cn.card.health.HealthApplication for test class cn.card.health.test.TestLoaderController +2024-06-03 08:49:55 [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]-[INFO] Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener, org.springframework.test.context.event.EventPublishingTestExecutionListener] +2024-06-03 08:49:55 [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]-[INFO] Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@1d296da, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@7c7a06ec, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@75d4a5c2, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@557caf28, org.springframework.test.context.support.DirtiesContextTestExecutionListener@408d971b, org.springframework.test.context.transaction.TransactionalTestExecutionListener@6c6cb480, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@3c46e67a, org.springframework.test.context.event.EventPublishingTestExecutionListener@c730b35, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@206a70ef, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@292b08d6, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@22555ebf, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@36ebc363, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@45752059] +2024-06-03 08:49:55 [org.hibernate.validator.internal.util.Version]-[INFO] HV000001: Hibernate Validator 6.0.20.Final +2024-06-03 08:49:55 [cn.card.health.test.TestLoaderController]-[INFO] Starting TestLoaderController on 192.168.5.26 with PID 98843 (started by circlexing in /Users/circlexing/work_java/1/health_parent/health_service) +2024-06-03 08:49:55 [cn.card.health.test.TestLoaderController]-[INFO] The following profiles are active: dev +2024-06-03 08:49:57 [org.springframework.data.repository.config.RepositoryConfigurationDelegate]-[INFO] Multiple Spring Data modules found, entering strict repository configuration mode! +2024-06-03 08:49:57 [org.springframework.data.repository.config.RepositoryConfigurationDelegate]-[INFO] Bootstrapping Spring Data Redis repositories in DEFAULT mode. +2024-06-03 08:49:57 [org.springframework.data.repository.config.RepositoryConfigurationDelegate]-[INFO] Finished Spring Data repository scanning in 83ms. Found 0 Redis repository interfaces. +2024-06-03 08:50:02 [springfox.documentation.spring.web.PropertySourcedRequestMappingHandlerMapping]-[INFO] Mapped URL path [/v2/api-docs] onto method [springfox.documentation.swagger2.web.Swagger2Controller#getDocumentation(String, HttpServletRequest)] +2024-06-03 08:50:03 [org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor]-[INFO] Initializing ExecutorService 'applicationTaskExecutor' +2024-06-03 08:50:04 [org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler]-[INFO] Initializing ExecutorService 'taskScheduler' +2024-06-03 08:50:04 [springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper]-[INFO] Context refreshed +2024-06-03 08:50:04 [springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper]-[INFO] Found 1 custom documentation plugin(s) +2024-06-03 08:50:04 [springfox.documentation.spring.web.scanners.ApiListingReferenceScanner]-[INFO] Scanning for api listing references +2024-06-03 08:50:05 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: refundPreRegUsingPOST_1 +2024-06-03 08:50:05 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_1 +2024-06-03 08:50:05 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectListUsingPOST_1 +2024-06-03 08:50:05 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_1 +2024-06-03 08:50:05 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_2 +2024-06-03 08:50:05 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectListUsingPOST_2 +2024-06-03 08:50:05 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_2 +2024-06-03 08:50:05 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_3 +2024-06-03 08:50:05 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectListUsingPOST_3 +2024-06-03 08:50:05 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_3 +2024-06-03 08:50:05 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_4 +2024-06-03 08:50:05 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectListUsingPOST_4 +2024-06-03 08:50:05 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_4 +2024-06-03 08:50:05 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_5 +2024-06-03 08:50:05 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectListUsingPOST_5 +2024-06-03 08:50:05 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_5 +2024-06-03 08:50:05 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_6 +2024-06-03 08:50:05 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_6 +2024-06-03 08:50:05 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_7 +2024-06-03 08:50:05 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectByTradeUsingPOST_1 +2024-06-03 08:50:05 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectListUsingPOST_6 +2024-06-03 08:50:05 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_7 +2024-06-03 08:50:05 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_8 +2024-06-03 08:50:05 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectListUsingPOST_7 +2024-06-03 08:50:05 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_8 +2024-06-03 08:50:05 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_9 +2024-06-03 08:50:05 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectListUsingPOST_8 +2024-06-03 08:50:05 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_9 +2024-06-03 08:50:05 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_10 +2024-06-03 08:50:05 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectListUsingPOST_9 +2024-06-03 08:50:05 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_10 +2024-06-03 08:50:05 [cn.card.health.test.TestLoaderController]-[INFO] Started TestLoaderController in 10.498 seconds (JVM running for 11.717) +2024-06-03 08:50:06 [com.zaxxer.hikari.HikariDataSource]-[INFO] HikariPool-1 - Starting... +2024-06-03 08:50:06 [com.zaxxer.hikari.HikariDataSource]-[INFO] HikariPool-1 - Start completed. +2024-06-03 08:50:06 [org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler]-[INFO] Shutting down ExecutorService 'taskScheduler' +2024-06-03 08:50:06 [org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor]-[INFO] Shutting down ExecutorService 'applicationTaskExecutor' +2024-06-03 08:50:06 [com.zaxxer.hikari.HikariDataSource]-[INFO] HikariPool-1 - Shutdown initiated... +2024-06-03 08:50:07 [com.zaxxer.hikari.HikariDataSource]-[INFO] HikariPool-1 - Shutdown completed. +2024-06-03 08:51:37 [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]-[INFO] Neither @ContextConfiguration nor @ContextHierarchy found for test class [cn.card.health.test.TestLoaderController], using SpringBootContextLoader +2024-06-03 08:51:37 [org.springframework.test.context.support.AbstractContextLoader]-[INFO] Could not detect default resource locations for test class [cn.card.health.test.TestLoaderController]: no resource found for suffixes {-context.xml, Context.groovy}. +2024-06-03 08:51:37 [org.springframework.test.context.support.AnnotationConfigContextLoaderUtils]-[INFO] Could not detect default configuration classes for test class [cn.card.health.test.TestLoaderController]: TestLoaderController does not declare any static, non-private, non-final, nested classes annotated with @Configuration. +2024-06-03 08:51:37 [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]-[INFO] Found @SpringBootConfiguration cn.card.health.HealthApplication for test class cn.card.health.test.TestLoaderController +2024-06-03 08:51:37 [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]-[INFO] Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener, org.springframework.test.context.event.EventPublishingTestExecutionListener] +2024-06-03 08:51:37 [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]-[INFO] Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@609bcfb6, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@7d94beb9, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@560348e6, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@1df8b5b8, org.springframework.test.context.support.DirtiesContextTestExecutionListener@23202fce, org.springframework.test.context.transaction.TransactionalTestExecutionListener@7b993c65, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@37911f88, org.springframework.test.context.event.EventPublishingTestExecutionListener@6f1c29b7, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@4d6025c5, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@7f284218, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@407a7f2a, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@4ea5b703, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@2a7ed1f] +2024-06-03 08:51:37 [org.hibernate.validator.internal.util.Version]-[INFO] HV000001: Hibernate Validator 6.0.20.Final +2024-06-03 08:51:38 [cn.card.health.test.TestLoaderController]-[INFO] Starting TestLoaderController on 192.168.5.26 with PID 264 (started by circlexing in /Users/circlexing/work_java/1/health_parent/health_service) +2024-06-03 08:51:38 [cn.card.health.test.TestLoaderController]-[INFO] The following profiles are active: dev +2024-06-03 08:51:40 [org.springframework.data.repository.config.RepositoryConfigurationDelegate]-[INFO] Multiple Spring Data modules found, entering strict repository configuration mode! +2024-06-03 08:51:40 [org.springframework.data.repository.config.RepositoryConfigurationDelegate]-[INFO] Bootstrapping Spring Data Redis repositories in DEFAULT mode. +2024-06-03 08:51:40 [org.springframework.data.repository.config.RepositoryConfigurationDelegate]-[INFO] Finished Spring Data repository scanning in 68ms. Found 0 Redis repository interfaces. +2024-06-03 08:52:46 [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]-[INFO] Neither @ContextConfiguration nor @ContextHierarchy found for test class [cn.card.health.test.TestLoaderController], using SpringBootContextLoader +2024-06-03 08:52:46 [org.springframework.test.context.support.AbstractContextLoader]-[INFO] Could not detect default resource locations for test class [cn.card.health.test.TestLoaderController]: no resource found for suffixes {-context.xml, Context.groovy}. +2024-06-03 08:52:46 [org.springframework.test.context.support.AnnotationConfigContextLoaderUtils]-[INFO] Could not detect default configuration classes for test class [cn.card.health.test.TestLoaderController]: TestLoaderController does not declare any static, non-private, non-final, nested classes annotated with @Configuration. +2024-06-03 08:52:46 [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]-[INFO] Found @SpringBootConfiguration cn.card.health.HealthApplication for test class cn.card.health.test.TestLoaderController +2024-06-03 08:52:46 [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]-[INFO] Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener, org.springframework.test.context.event.EventPublishingTestExecutionListener] +2024-06-03 08:52:46 [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]-[INFO] Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@7bf3a5d8, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@42e25b0b, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@39b43d60, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@44be0077, org.springframework.test.context.support.DirtiesContextTestExecutionListener@2205a05d, org.springframework.test.context.transaction.TransactionalTestExecutionListener@72ef8d15, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@6aa8e115, org.springframework.test.context.event.EventPublishingTestExecutionListener@5e21e98f, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@51a9ad5e, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@5f20155b, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@72ade7e3, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@239105a8, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@3fce8fd9] +2024-06-03 08:52:46 [org.hibernate.validator.internal.util.Version]-[INFO] HV000001: Hibernate Validator 6.0.20.Final +2024-06-03 08:52:47 [cn.card.health.test.TestLoaderController]-[INFO] Starting TestLoaderController on 192.168.5.26 with PID 1238 (started by circlexing in /Users/circlexing/work_java/1/health_parent/health_service) +2024-06-03 08:52:47 [cn.card.health.test.TestLoaderController]-[INFO] The following profiles are active: dev +2024-06-03 08:52:49 [org.springframework.data.repository.config.RepositoryConfigurationDelegate]-[INFO] Multiple Spring Data modules found, entering strict repository configuration mode! +2024-06-03 08:52:49 [org.springframework.data.repository.config.RepositoryConfigurationDelegate]-[INFO] Bootstrapping Spring Data Redis repositories in DEFAULT mode. +2024-06-03 08:52:49 [org.springframework.data.repository.config.RepositoryConfigurationDelegate]-[INFO] Finished Spring Data repository scanning in 76ms. Found 0 Redis repository interfaces. +2024-06-03 08:53:09 [springfox.documentation.spring.web.PropertySourcedRequestMappingHandlerMapping]-[INFO] Mapped URL path [/v2/api-docs] onto method [springfox.documentation.swagger2.web.Swagger2Controller#getDocumentation(String, HttpServletRequest)] +2024-06-03 08:53:28 [org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor]-[INFO] Initializing ExecutorService 'applicationTaskExecutor' +2024-06-03 08:53:52 [org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler]-[INFO] Initializing ExecutorService 'taskScheduler' +2024-06-03 08:53:57 [springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper]-[INFO] Context refreshed +2024-06-03 08:53:57 [springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper]-[INFO] Found 1 custom documentation plugin(s) +2024-06-03 08:53:58 [springfox.documentation.spring.web.scanners.ApiListingReferenceScanner]-[INFO] Scanning for api listing references +2024-06-03 08:54:08 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: refundPreRegUsingPOST_1 +2024-06-03 08:54:10 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_1 +2024-06-03 08:54:11 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectListUsingPOST_1 +2024-06-03 08:54:11 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_1 +2024-06-03 08:54:11 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_2 +2024-06-03 08:54:11 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectListUsingPOST_2 +2024-06-03 08:54:12 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_2 +2024-06-03 08:54:12 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_3 +2024-06-03 08:54:12 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectListUsingPOST_3 +2024-06-03 08:54:13 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_3 +2024-06-03 08:54:13 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_4 +2024-06-03 08:54:13 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectListUsingPOST_4 +2024-06-03 08:54:13 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_4 +2024-06-03 08:54:14 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_5 +2024-06-03 08:54:14 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectListUsingPOST_5 +2024-06-03 08:54:15 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_5 +2024-06-03 08:54:16 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_6 +2024-06-03 08:54:18 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_6 +2024-06-03 08:54:19 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_7 +2024-06-03 08:54:19 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectByTradeUsingPOST_1 +2024-06-03 08:54:19 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectListUsingPOST_6 +2024-06-03 08:54:19 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_7 +2024-06-03 08:54:19 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_8 +2024-06-03 08:54:20 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectListUsingPOST_7 +2024-06-03 08:54:20 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_8 +2024-06-03 08:54:20 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_9 +2024-06-03 08:54:20 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectListUsingPOST_8 +2024-06-03 08:54:21 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_9 +2024-06-03 08:54:21 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_10 +2024-06-03 08:54:21 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectListUsingPOST_9 +2024-06-03 08:54:22 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_10 +2024-06-03 08:54:22 [cn.card.health.test.TestLoaderController]-[INFO] Started TestLoaderController in 165.08 seconds (JVM running for 166.511) +2024-06-03 08:54:27 [com.zaxxer.hikari.HikariDataSource]-[INFO] HikariPool-1 - Starting... +2024-06-03 08:54:30 [com.zaxxer.hikari.HikariDataSource]-[INFO] HikariPool-1 - Start completed. +2024-06-03 08:54:32 [org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler]-[INFO] Shutting down ExecutorService 'taskScheduler' +2024-06-03 08:54:32 [org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor]-[INFO] Shutting down ExecutorService 'applicationTaskExecutor' +2024-06-03 08:54:33 [com.zaxxer.hikari.HikariDataSource]-[INFO] HikariPool-1 - Shutdown initiated... +2024-06-03 08:54:33 [com.zaxxer.hikari.HikariDataSource]-[INFO] HikariPool-1 - Shutdown completed. +2024-06-03 08:55:56 [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]-[INFO] Neither @ContextConfiguration nor @ContextHierarchy found for test class [cn.card.health.test.TestLoaderController], using SpringBootContextLoader +2024-06-03 08:55:56 [org.springframework.test.context.support.AbstractContextLoader]-[INFO] Could not detect default resource locations for test class [cn.card.health.test.TestLoaderController]: no resource found for suffixes {-context.xml, Context.groovy}. +2024-06-03 08:55:56 [org.springframework.test.context.support.AnnotationConfigContextLoaderUtils]-[INFO] Could not detect default configuration classes for test class [cn.card.health.test.TestLoaderController]: TestLoaderController does not declare any static, non-private, non-final, nested classes annotated with @Configuration. +2024-06-03 08:55:56 [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]-[INFO] Found @SpringBootConfiguration cn.card.health.HealthApplication for test class cn.card.health.test.TestLoaderController +2024-06-03 08:55:56 [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]-[INFO] Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener, org.springframework.test.context.event.EventPublishingTestExecutionListener] +2024-06-03 08:55:56 [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]-[INFO] Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@609bcfb6, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@7d94beb9, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@560348e6, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@1df8b5b8, org.springframework.test.context.support.DirtiesContextTestExecutionListener@23202fce, org.springframework.test.context.transaction.TransactionalTestExecutionListener@7b993c65, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@37911f88, org.springframework.test.context.event.EventPublishingTestExecutionListener@6f1c29b7, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@4d6025c5, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@7f284218, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@407a7f2a, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@4ea5b703, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@2a7ed1f] +2024-06-03 08:55:57 [org.hibernate.validator.internal.util.Version]-[INFO] HV000001: Hibernate Validator 6.0.20.Final +2024-06-03 08:55:57 [cn.card.health.test.TestLoaderController]-[INFO] Starting TestLoaderController on 192.168.5.26 with PID 3633 (started by circlexing in /Users/circlexing/work_java/1/health_parent/health_service) +2024-06-03 08:55:57 [cn.card.health.test.TestLoaderController]-[INFO] The following profiles are active: dev +2024-06-03 08:55:59 [org.springframework.data.repository.config.RepositoryConfigurationDelegate]-[INFO] Multiple Spring Data modules found, entering strict repository configuration mode! +2024-06-03 08:55:59 [org.springframework.data.repository.config.RepositoryConfigurationDelegate]-[INFO] Bootstrapping Spring Data Redis repositories in DEFAULT mode. +2024-06-03 08:55:59 [org.springframework.data.repository.config.RepositoryConfigurationDelegate]-[INFO] Finished Spring Data repository scanning in 64ms. Found 0 Redis repository interfaces. +2024-06-03 08:57:27 [springfox.documentation.spring.web.PropertySourcedRequestMappingHandlerMapping]-[INFO] Mapped URL path [/v2/api-docs] onto method [springfox.documentation.swagger2.web.Swagger2Controller#getDocumentation(String, HttpServletRequest)] +2024-06-03 08:57:45 [org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor]-[INFO] Initializing ExecutorService 'applicationTaskExecutor' +2024-06-03 08:58:09 [org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler]-[INFO] Initializing ExecutorService 'taskScheduler' +2024-06-03 08:58:13 [springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper]-[INFO] Context refreshed +2024-06-03 08:58:13 [springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper]-[INFO] Found 1 custom documentation plugin(s) +2024-06-03 08:58:15 [springfox.documentation.spring.web.scanners.ApiListingReferenceScanner]-[INFO] Scanning for api listing references +2024-06-03 08:58:26 [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]-[INFO] Neither @ContextConfiguration nor @ContextHierarchy found for test class [cn.card.health.test.TestLoaderController], using SpringBootContextLoader +2024-06-03 08:58:26 [org.springframework.test.context.support.AbstractContextLoader]-[INFO] Could not detect default resource locations for test class [cn.card.health.test.TestLoaderController]: no resource found for suffixes {-context.xml, Context.groovy}. +2024-06-03 08:58:26 [org.springframework.test.context.support.AnnotationConfigContextLoaderUtils]-[INFO] Could not detect default configuration classes for test class [cn.card.health.test.TestLoaderController]: TestLoaderController does not declare any static, non-private, non-final, nested classes annotated with @Configuration. +2024-06-03 08:58:27 [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]-[INFO] Found @SpringBootConfiguration cn.card.health.HealthApplication for test class cn.card.health.test.TestLoaderController +2024-06-03 08:58:27 [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]-[INFO] Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener, org.springframework.test.context.event.EventPublishingTestExecutionListener] +2024-06-03 08:58:27 [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]-[INFO] Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@1d296da, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@7c7a06ec, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@75d4a5c2, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@557caf28, org.springframework.test.context.support.DirtiesContextTestExecutionListener@408d971b, org.springframework.test.context.transaction.TransactionalTestExecutionListener@6c6cb480, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@3c46e67a, org.springframework.test.context.event.EventPublishingTestExecutionListener@c730b35, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@206a70ef, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@292b08d6, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@22555ebf, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@36ebc363, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@45752059] +2024-06-03 08:58:27 [org.hibernate.validator.internal.util.Version]-[INFO] HV000001: Hibernate Validator 6.0.20.Final +2024-06-03 08:58:27 [cn.card.health.test.TestLoaderController]-[INFO] Starting TestLoaderController on 192.168.5.26 with PID 5515 (started by circlexing in /Users/circlexing/work_java/1/health_parent/health_service) +2024-06-03 08:58:27 [cn.card.health.test.TestLoaderController]-[INFO] The following profiles are active: dev +2024-06-03 08:58:29 [org.springframework.data.repository.config.RepositoryConfigurationDelegate]-[INFO] Multiple Spring Data modules found, entering strict repository configuration mode! +2024-06-03 08:58:29 [org.springframework.data.repository.config.RepositoryConfigurationDelegate]-[INFO] Bootstrapping Spring Data Redis repositories in DEFAULT mode. +2024-06-03 08:58:29 [org.springframework.data.repository.config.RepositoryConfigurationDelegate]-[INFO] Finished Spring Data repository scanning in 66ms. Found 0 Redis repository interfaces. +2024-06-03 08:58:34 [springfox.documentation.spring.web.PropertySourcedRequestMappingHandlerMapping]-[INFO] Mapped URL path [/v2/api-docs] onto method [springfox.documentation.swagger2.web.Swagger2Controller#getDocumentation(String, HttpServletRequest)] +2024-06-03 08:58:34 [org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor]-[INFO] Initializing ExecutorService 'applicationTaskExecutor' +2024-06-03 08:58:35 [org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler]-[INFO] Initializing ExecutorService 'taskScheduler' +2024-06-03 08:58:35 [springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper]-[INFO] Context refreshed +2024-06-03 08:58:35 [springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper]-[INFO] Found 1 custom documentation plugin(s) +2024-06-03 08:58:35 [springfox.documentation.spring.web.scanners.ApiListingReferenceScanner]-[INFO] Scanning for api listing references +2024-06-03 08:58:36 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: refundPreRegUsingPOST_1 +2024-06-03 08:58:36 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_1 +2024-06-03 08:58:36 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectListUsingPOST_1 +2024-06-03 08:58:36 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_1 +2024-06-03 08:58:36 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_2 +2024-06-03 08:58:36 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectListUsingPOST_2 +2024-06-03 08:58:36 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_2 +2024-06-03 08:58:36 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_3 +2024-06-03 08:58:36 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectListUsingPOST_3 +2024-06-03 08:58:36 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_3 +2024-06-03 08:58:36 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_4 +2024-06-03 08:58:36 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectListUsingPOST_4 +2024-06-03 08:58:36 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_4 +2024-06-03 08:58:36 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_5 +2024-06-03 08:58:36 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectListUsingPOST_5 +2024-06-03 08:58:36 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_5 +2024-06-03 08:58:36 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_6 +2024-06-03 08:58:36 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_6 +2024-06-03 08:58:36 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_7 +2024-06-03 08:58:36 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectByTradeUsingPOST_1 +2024-06-03 08:58:36 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectListUsingPOST_6 +2024-06-03 08:58:36 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_7 +2024-06-03 08:58:36 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_8 +2024-06-03 08:58:36 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectListUsingPOST_7 +2024-06-03 08:58:36 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_8 +2024-06-03 08:58:36 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_9 +2024-06-03 08:58:36 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectListUsingPOST_8 +2024-06-03 08:58:36 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_9 +2024-06-03 08:58:36 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_10 +2024-06-03 08:58:36 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectListUsingPOST_9 +2024-06-03 08:58:36 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_10 +2024-06-03 08:58:37 [cn.card.health.test.TestLoaderController]-[INFO] Started TestLoaderController in 9.667 seconds (JVM running for 10.773) +2024-06-03 08:58:37 [com.zaxxer.hikari.HikariDataSource]-[INFO] HikariPool-1 - Starting... +2024-06-03 08:58:37 [com.zaxxer.hikari.HikariDataSource]-[INFO] HikariPool-1 - Start completed. +2024-06-03 08:58:37 [org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler]-[INFO] Shutting down ExecutorService 'taskScheduler' +2024-06-03 08:58:37 [org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor]-[INFO] Shutting down ExecutorService 'applicationTaskExecutor' +2024-06-03 08:58:38 [com.zaxxer.hikari.HikariDataSource]-[INFO] HikariPool-1 - Shutdown initiated... +2024-06-03 08:58:38 [com.zaxxer.hikari.HikariDataSource]-[INFO] HikariPool-1 - Shutdown completed. +2024-06-03 09:11:29 [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]-[INFO] Neither @ContextConfiguration nor @ContextHierarchy found for test class [cn.card.health.test.TestLoaderController], using SpringBootContextLoader +2024-06-03 09:11:30 [org.springframework.test.context.support.AbstractContextLoader]-[INFO] Could not detect default resource locations for test class [cn.card.health.test.TestLoaderController]: no resource found for suffixes {-context.xml, Context.groovy}. +2024-06-03 09:11:30 [org.springframework.test.context.support.AnnotationConfigContextLoaderUtils]-[INFO] Could not detect default configuration classes for test class [cn.card.health.test.TestLoaderController]: TestLoaderController does not declare any static, non-private, non-final, nested classes annotated with @Configuration. +2024-06-03 09:11:30 [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]-[INFO] Found @SpringBootConfiguration cn.card.health.HealthApplication for test class cn.card.health.test.TestLoaderController +2024-06-03 09:11:30 [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]-[INFO] Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener, org.springframework.test.context.event.EventPublishingTestExecutionListener] +2024-06-03 09:11:30 [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]-[INFO] Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@1d296da, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@7c7a06ec, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@75d4a5c2, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@557caf28, org.springframework.test.context.support.DirtiesContextTestExecutionListener@408d971b, org.springframework.test.context.transaction.TransactionalTestExecutionListener@6c6cb480, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@3c46e67a, org.springframework.test.context.event.EventPublishingTestExecutionListener@c730b35, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@206a70ef, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@292b08d6, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@22555ebf, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@36ebc363, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@45752059] +2024-06-03 09:11:30 [org.hibernate.validator.internal.util.Version]-[INFO] HV000001: Hibernate Validator 6.0.20.Final +2024-06-03 09:11:30 [cn.card.health.test.TestLoaderController]-[INFO] Starting TestLoaderController on 192.168.5.26 with PID 12304 (started by circlexing in /Users/circlexing/work_java/1/health_parent/health_service) +2024-06-03 09:11:30 [cn.card.health.test.TestLoaderController]-[INFO] The following profiles are active: dev +2024-06-03 09:11:32 [org.springframework.data.repository.config.RepositoryConfigurationDelegate]-[INFO] Multiple Spring Data modules found, entering strict repository configuration mode! +2024-06-03 09:11:32 [org.springframework.data.repository.config.RepositoryConfigurationDelegate]-[INFO] Bootstrapping Spring Data Redis repositories in DEFAULT mode. +2024-06-03 09:11:32 [org.springframework.data.repository.config.RepositoryConfigurationDelegate]-[INFO] Finished Spring Data repository scanning in 66ms. Found 0 Redis repository interfaces. +2024-06-03 09:11:37 [springfox.documentation.spring.web.PropertySourcedRequestMappingHandlerMapping]-[INFO] Mapped URL path [/v2/api-docs] onto method [springfox.documentation.swagger2.web.Swagger2Controller#getDocumentation(String, HttpServletRequest)] +2024-06-03 09:11:38 [org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor]-[INFO] Initializing ExecutorService 'applicationTaskExecutor' +2024-06-03 09:11:38 [org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler]-[INFO] Initializing ExecutorService 'taskScheduler' +2024-06-03 09:11:38 [springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper]-[INFO] Context refreshed +2024-06-03 09:11:38 [springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper]-[INFO] Found 1 custom documentation plugin(s) +2024-06-03 09:11:38 [springfox.documentation.spring.web.scanners.ApiListingReferenceScanner]-[INFO] Scanning for api listing references +2024-06-03 09:11:39 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: refundPreRegUsingPOST_1 +2024-06-03 09:11:39 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_1 +2024-06-03 09:11:39 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectListUsingPOST_1 +2024-06-03 09:11:39 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_1 +2024-06-03 09:11:39 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_2 +2024-06-03 09:11:39 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectListUsingPOST_2 +2024-06-03 09:11:39 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_2 +2024-06-03 09:11:39 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_3 +2024-06-03 09:11:39 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectListUsingPOST_3 +2024-06-03 09:11:39 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_3 +2024-06-03 09:11:39 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_4 +2024-06-03 09:11:39 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectListUsingPOST_4 +2024-06-03 09:11:39 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_4 +2024-06-03 09:11:39 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_5 +2024-06-03 09:11:39 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectListUsingPOST_5 +2024-06-03 09:11:39 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_5 +2024-06-03 09:11:39 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_6 +2024-06-03 09:11:39 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_6 +2024-06-03 09:11:39 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_7 +2024-06-03 09:11:39 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectByTradeUsingPOST_1 +2024-06-03 09:11:39 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectListUsingPOST_6 +2024-06-03 09:11:39 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_7 +2024-06-03 09:11:39 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_8 +2024-06-03 09:11:39 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectListUsingPOST_7 +2024-06-03 09:11:39 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_8 +2024-06-03 09:11:39 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_9 +2024-06-03 09:11:39 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectListUsingPOST_8 +2024-06-03 09:11:39 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_9 +2024-06-03 09:11:39 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: insertUsingPOST_10 +2024-06-03 09:11:39 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: selectListUsingPOST_9 +2024-06-03 09:11:39 [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator]-[INFO] Generating unique operation named: updateUsingPOST_10 +2024-06-03 09:11:39 [cn.card.health.test.TestLoaderController]-[INFO] Started TestLoaderController in 9.557 seconds (JVM running for 10.674) +2024-06-03 09:11:40 [com.zaxxer.hikari.HikariDataSource]-[INFO] HikariPool-1 - Starting... +2024-06-03 09:11:40 [com.zaxxer.hikari.HikariDataSource]-[INFO] HikariPool-1 - Start completed. +2024-06-03 09:11:40 [org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler]-[INFO] Shutting down ExecutorService 'taskScheduler' +2024-06-03 09:11:40 [org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor]-[INFO] Shutting down ExecutorService 'applicationTaskExecutor' +2024-06-03 09:11:40 [com.zaxxer.hikari.HikariDataSource]-[INFO] HikariPool-1 - Shutdown initiated... +2024-06-03 09:11:40 [com.zaxxer.hikari.HikariDataSource]-[INFO] HikariPool-1 - Shutdown completed. diff --git a/health_service/pom.xml b/health_service/pom.xml new file mode 100644 index 0000000..107b435 --- /dev/null +++ b/health_service/pom.xml @@ -0,0 +1,207 @@ + + + + + + cn.health.service + health-parent + 1.0.2 + + 4.0.0 + + health_service + health card + jar + + + 1.8 + + + + + + + + + + org.springframework.boot + spring-boot-starter-web + + + + ch.qos.logback + logback-classic + + + + + + + + + + + + + + + + + + + + log4j + log4j + + + org.slf4j + slf4j-api + ${slf4j.version} + + + org.slf4j + slf4j-log4j12 + ${slf4j.version} + + + + + + io.springfox + springfox-swagger2 + + + + com.github.xiaoymin + knife4j-spring-ui + + + + org.springframework.boot + spring-boot-test + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + mysql + mysql-connector-java + + + + + com.github.pagehelper + pagehelper-spring-boot-starter + + + + + + + + + + + + org.apache.httpcomponents + httpclient + + + + org.apache.httpcomponents + httpcore + + + + + + + com.google.code.gson + gson + + + + + + + + + cn.health.service + health_framework + + + + com.itextpdf + itextpdf + 5.4.3 + + + com.itextpdf + itext-asian + 5.2.0 + + + + + + + + junit + junit + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + 2.1.1.RELEASE + + true + + + + + repackage + + + + + + org.apache.maven.plugins + maven-war-plugin + 3.1.0 + + false + ${project.artifactId} + + + + ${project.artifactId} + + + diff --git a/health_service/src/main/.DS_Store b/health_service/src/main/.DS_Store new file mode 100644 index 0000000..d44e16d Binary files /dev/null and b/health_service/src/main/.DS_Store differ diff --git a/health_service/src/main/java/ServiceClient.java b/health_service/src/main/java/ServiceClient.java new file mode 100644 index 0000000..a52d8d8 --- /dev/null +++ b/health_service/src/main/java/ServiceClient.java @@ -0,0 +1,38 @@ +import java.io.IOException; +import java.net.URL; + +import javax.xml.namespace.QName; +import javax.xml.ws.Service; + +import cn.his.client.wasdyrmyy.NWzfserviceSoap; + + +public class ServiceClient { + + public static void main(String[] args) throws IOException { + //创建WSDL的URL,注意不是服务地址 + URL url = new URL("http://221.193.240.211:8088/wzfservice/n_wzfservice.asmx?wsdl"); + + //创建服务名称 + //1.namespaceURI - 命名空间地址 (wsdl文档中的targetNamespace) + //2.localPart - 服务视图名 (wsdl文档中服务名称,例如) +// QName qname = new QName("http://221.193.240.211:8088/wzfservice/", "n_wzfservice"); + + QName qname = new QName("http://tempurl.org", "n_wzfservice"); + //创建服务视图 + //参数解释: + //1.wsdlDocumentLocation - wsdl地址 + //2.serviceName - 服务名称 + Service service = Service.create(url, qname); + //获取服务实现类 + //参数解释:serviceEndpointInterface - 服务端口(wsdl文档中服务端口的name属性,例如) + NWzfserviceSoap soap = service.getPort(NWzfserviceSoap.class); +// String xml = "getHospitalInfo0011006"; + String xml = "getDeptRegInfo001747554124oYXd5syacDZV1skXW13gzB0jOzf42021-06-172021-06-19"; + String result = soap.hisforhzfwhmessage(xml); + System.out.println(result); + //调用查询方法 +// String result = mobileCodeWSSoap.getMobileCodeInfo("1866666666", ""); +// System.out.println(result); + } +} \ No newline at end of file diff --git a/health_service/src/main/java/SoapClient.java b/health_service/src/main/java/SoapClient.java new file mode 100644 index 0000000..1c9ccb8 --- /dev/null +++ b/health_service/src/main/java/SoapClient.java @@ -0,0 +1,74 @@ +import java.nio.charset.Charset; + +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.util.EntityUtils; + +/** + * webservice客户端 + * + * @author David Lin + * @version: 1.0 + * @date 2018-09-09 12:16 + */ +public class SoapClient { + + public static void main(String args[]) throws Exception { + //soap服务地址 +// String url = "http://localhost:8888/ssm/Services/UserService?wsdl"; + String url = "http://221.193.240.211:8088/wzfservice/n_wzfservice.asmx?wsdl"; + StringBuilder soapBuilder = new StringBuilder(64); + soapBuilder.append(""); + soapBuilder.append(""); + soapBuilder.append(" "); + soapBuilder.append(" "); + soapBuilder.append(" "); + soapBuilder.append(""); + String xml = "getHospitalInfo0011006"; + + //创建httpcleint对象 + CloseableHttpClient httpClient = HttpClients.createDefault(); + //创建http Post请求 + HttpPost httpPost = new HttpPost(url); + // 构建请求配置信息 + RequestConfig config = RequestConfig.custom().setConnectTimeout(5000) // 创建连接的最长时间 + .setConnectionRequestTimeout(5000) // 从连接池中获取到连接的最长时间 + .setSocketTimeout(3 * 1000) // 数据传输的最长时间10s + .build(); + httpPost.setConfig(config); + CloseableHttpResponse response = null; + try { + //采用SOAP1.1调用服务端,这种方式能调用服务端为soap1.1和soap1.2的服务 + httpPost.setHeader("Content-Type", "text/xml;charset=UTF-8"); + + //采用SOAP1.2调用服务端,这种方式只能调用服务端为soap1.2的服务 + // httpPost.setHeader("Content-Type", "application/soap+xml;charset=UTF-8"); + StringEntity stringEntity = new StringEntity(xml, Charset.forName("UTF-8")); + httpPost.setEntity(stringEntity); + response = httpClient.execute(httpPost); + // 判断返回状态是否为200 + if (response.getStatusLine().getStatusCode() == 200) { + String content = EntityUtils.toString(response.getEntity(), "UTF-8"); + System.out.println(content); + + } else { + System.out.println("===================调用失败================="); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (null != response) { + response.close(); + } + if (null != httpClient) { + httpClient.close(); + } + } + + + } +} diff --git a/health_service/src/main/java/WXPayDemo.java b/health_service/src/main/java/WXPayDemo.java new file mode 100644 index 0000000..72f66ef --- /dev/null +++ b/health_service/src/main/java/WXPayDemo.java @@ -0,0 +1,36 @@ +import java.util.HashMap; +import java.util.Map; +// +//import com.github.wxpay.sdk.WXPay; +//import com.github.wxpay.sdk.WXPayConfig; + +/** + * 微信支付 + * + * @author xinggm + * @date 2021年6月29日 + */ +public class WXPayDemo { + public static void main(String[] args) throws Exception { +// WXPayConfig config = new WXPayConfig(); +// WXPay wxpay = new WXPay(config); + + Map data = new HashMap(); + data.put("body", "腾讯充值中心-QQ会员充值"); + data.put("out_trade_no", "202162910595900000212"); + data.put("device_info", ""); + data.put("fee_type", "CNY"); + data.put("total_fee", "1"); + data.put("spbill_create_ip", "123.12.12.123"); + data.put("notify_url", "https://www.hbyctr.com/health_service/notify"); + data.put("trade_type", "NATIVE"); // 此处指定为扫码支付JSAPI + data.put("product_id", "12"); + +// try { +// Map resp = wxpay.unifiedOrder(data); +// System.out.println(resp); +// } catch (Exception e) { +// e.printStackTrace(); +// } + } +} diff --git a/health_service/src/main/java/cn/card/health/HealthApplication.java b/health_service/src/main/java/cn/card/health/HealthApplication.java new file mode 100644 index 0000000..b39a9ee --- /dev/null +++ b/health_service/src/main/java/cn/card/health/HealthApplication.java @@ -0,0 +1,21 @@ +package cn.card.health; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.scheduling.annotation.EnableAsync; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +@EnableSwagger2 +//@EnableAutoConfiguration +//@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class }) +@SpringBootApplication +//@ComponentScan(basePackages = {"cn.card.health.controller", "cn.his.service"}) +//@MapperScan("cn.card.health.mapper") +@EnableAsync +public class HealthApplication { + + public static void main(String[] args) { + SpringApplication.run(HealthApplication.class, args); + } + +} diff --git a/health_service/src/main/java/cn/card/health/SpringBootStartApplication.java b/health_service/src/main/java/cn/card/health/SpringBootStartApplication.java new file mode 100644 index 0000000..8f3a3da --- /dev/null +++ b/health_service/src/main/java/cn/card/health/SpringBootStartApplication.java @@ -0,0 +1,13 @@ +package cn.card.health; + +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; + +//@EnableAutoConfiguration +//@SpringBootApplication +public class SpringBootStartApplication extends SpringBootServletInitializer { + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { + return builder.sources(HealthApplication.class); + } +} diff --git a/health_service/src/main/java/cn/card/health/config/ErrorCode.java b/health_service/src/main/java/cn/card/health/config/ErrorCode.java new file mode 100644 index 0000000..ef9e2dd --- /dev/null +++ b/health_service/src/main/java/cn/card/health/config/ErrorCode.java @@ -0,0 +1,22 @@ +package cn.card.health.config; + +public enum ErrorCode { + EXIST_UNPAID_REGISTER(4001, "存在未支付的挂号订单!"); + + private int code; + private String message; + + private ErrorCode(int code, String message) { + this.code = code; + this.message = message; + } + + public String getMessage() { + return this.message; + } + + public int getCode() { + return this.code; + } + +} diff --git a/health_service/src/main/java/cn/card/health/controller/order/MedicalRecordController.java b/health_service/src/main/java/cn/card/health/controller/order/MedicalRecordController.java new file mode 100644 index 0000000..da8b3ab --- /dev/null +++ b/health_service/src/main/java/cn/card/health/controller/order/MedicalRecordController.java @@ -0,0 +1,238 @@ +package cn.card.health.controller.order; + +import cn.card.health.bean.order.MedicalRecord; +import cn.card.health.bean.order.YcOrder; +import cn.card.health.common.utils.BaseResultJSON; +import cn.card.health.framework.service.HisReportService; +//import cn.card.health.service.HealthCardInfoService; +import cn.card.health.service.order.IMedicalRecordService; +import cn.card.health.service.order.IYcOrderService; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.img.ImgUtil; +import cn.hutool.core.io.FileUtil; +import cn.hutool.core.util.DesensitizedUtil; +import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.extra.servlet.ServletUtil; +import com.alibaba.fastjson.JSONObject; +import com.tencent.healthcard.model.HealthCardInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.activation.MimetypesFileTypeMap; +import javax.servlet.http.HttpServletResponse; +import java.awt.*; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.List; +import java.util.*; + +@RestController +@RequestMapping("/medicalRecord") +public class MedicalRecordController { + @Autowired + private IMedicalRecordService medicalRecordService; + + @Autowired + private IYcOrderService ycOrderService; + +// @Autowired +// private HealthCardInfoService cardInfoService; + + @Autowired + private HisReportService hisReportService; + + @Value("${credential.upload}") + private String uploadPath; + + @Value("${credential.pressText}") + private String pressText; + + @PostMapping("/upload") + public JSONObject upload(@RequestParam("file") MultipartFile file) { + if (file.isEmpty()) { + return BaseResultJSON.error("文件内容不能为空!"); + } + + String date = DateUtil.today(); + + // 获取文件名 + String fileName = file.getOriginalFilename(); + // 获取文件的后缀名 + String suffixName = fileName.substring(fileName.lastIndexOf(".")).toLowerCase(Locale.ROOT); + if (!suffixName.equals(".jpg") && !suffixName.equals(".jpeg") && !suffixName.equals(".png")) { + return BaseResultJSON.error("仅支持JPG、JPEG和PNG格式!"); + } + + String path = uploadPath + File.separator + "record" + File.separator + date + File.separator; + if (FileUtil.exist(path)) { + FileUtil.mkdir(path); + } + + fileName = IdUtil.getSnowflake().nextIdStr() + suffixName; + try { + File imgFile = FileUtil.writeFromStream(file.getInputStream(), path + fileName); + ImgUtil.pressText(imgFile, imgFile, pressText, Color.BLACK, //文字 + new Font("黑体", Font.BOLD, 30), //字体 + 0, //x坐标修正值。 默认在中间,偏移量相对于中间偏移 + 0, //y坐标修正值。 默认在中间,偏移量相对于中间偏移 + 0.3f//透明度:alpha 必须是范围 [0.0, 1.0] 之内(包含边界值)的一个浮点数字 + ); + return BaseResultJSON.success(date + File.separator + fileName); + } catch (IOException exception) { + return BaseResultJSON.error("上传失败!"); + } + } + + @GetMapping("/getImage") + public void getImage(@RequestParam(name = "fileName") String fileName, + HttpServletResponse response) { + if (StrUtil.isBlank(fileName)) { + return; + } + + String filePath = uploadPath + File.separator + "record" + File.separator + fileName; + if (!FileUtil.exist(filePath)) { + return; + } + + File file = FileUtil.file(filePath); + String type = new MimetypesFileTypeMap().getContentType(file); + response.setContentType(type); + response.setContentLength(new Long(file.length()).intValue()); + try { + ServletUtil.write(response, new FileInputStream(file)); + } catch (FileNotFoundException e) { + throw new RuntimeException(e); + } + } + + @PostMapping("/apply") + public JSONObject apply(@RequestBody MedicalRecord medicalRecord) { + String openid = medicalRecord.getOpenid(); + String patientId = String.valueOf(medicalRecord.getPatientId()); + if (StrUtil.isBlank(openid) || StrUtil.isBlank(patientId)) { + return BaseResultJSON.error("请求参数异常!"); + } + +// HealthCardInfo cardInfo = cardInfoService.findHealthCardInfoByOpenidAndPatientId(openid, patientId); +// if (cardInfo == null) { +// return BaseResultJSON.error("患者不存在!"); +// } + + List medicalRecords = medicalRecordService.selectApplying(medicalRecord.getPatientId()); + if (!medicalRecords.isEmpty()) { + return BaseResultJSON.error("患者有申请中的病例!"); + } + + medicalRecord.setId(IdUtil.getSnowflake().nextIdStr()); + medicalRecord.setStatus(1); + medicalRecord.setCreateTime(new Date()); + medicalRecordService.insert(medicalRecord); + + return BaseResultJSON.success("申请已提交,请等待审核!"); + } + + @PostMapping("/cancel") + public JSONObject cancel(@RequestBody MedicalRecord medicalRecord) { + MedicalRecord medicalRecord1 = medicalRecordService.selectById(medicalRecord.getId()); + if (medicalRecord1.getPatientId().compareTo(medicalRecord.getPatientId()) != 0) { + return BaseResultJSON.error("请求非法!"); + } + + Integer status = medicalRecord1.getStatus(); + if (status != 1 && status != 2) { + return BaseResultJSON.error("当前状态无法取消!"); + } + + medicalRecord1.setStatus(5); + medicalRecord1.setUpdateTime(new Date()); + Integer result = medicalRecordService.update(medicalRecord1); + if (result > 0) { + return BaseResultJSON.success("取消成功!"); + } else { + return BaseResultJSON.error("取消失败!"); + } + } + + @PostMapping("/createOrder") + public JSONObject createOrder(@RequestBody MedicalRecord medicalRecord) { + MedicalRecord medicalRecord1 = medicalRecordService.selectById(medicalRecord.getId()); + if (medicalRecord1.getPatientId().compareTo(medicalRecord.getPatientId()) != 0) { + return BaseResultJSON.error("请求非法!"); + } + + Integer status = medicalRecord1.getStatus(); + if (status != 2) { + return BaseResultJSON.error("请等待审核完成!"); + } + + /**每次创建新的订单,注销以下代码 + Map map = new HashMap<>(); + if (!StrUtil.isBlank(medicalRecord1.getOrderNo())) { + map.put("orderno", medicalRecord1.getOrderNo()); + map.put("patId", medicalRecord1.getPatientId()); + return BaseResultJSON.success(map); + } + */ + + YcOrder order = new YcOrder(); + order.setOrderno(IdUtil.getSnowflake().nextIdStr()); + order.setOrdertype("RECORD"); + order.setOrderStatus(1); + order.setPatientid(medicalRecord1.getPatientId()); + order.setOpenid(medicalRecord.getOpenid()); + order.setTotalmoney(medicalRecord1.getAmount()); + order.setCreatetime(new Date()); + + int result = ycOrderService.insertYcOrder(order); + if (result > 0) { + medicalRecord1.setOrderNo(order.getOrderno()); + Integer updateFlag = medicalRecordService.update(medicalRecord1); + if (updateFlag > 0) { + Map map = new HashMap<>(); + map.put("orderno", medicalRecord1.getOrderNo()); + map.put("patId", medicalRecord1.getPatientId()); + return BaseResultJSON.success(map); + } + } + return BaseResultJSON.error("订单创建失败!"); + } + + /** + * 查询申请列表 + * + * @param openid + * @return + */ + @GetMapping("/list") + public BaseResultJSON list(@RequestParam("openid") String openid) { + List recordList = medicalRecordService.selectByOpenid(openid); + recordList.forEach(record -> { + record.setIdNumber(DesensitizedUtil.idCardNum(record.getIdNumber(), 6, 4)); + record.setCreateTimeFormat(DateUtil.formatDateTime(record.getCreateTime())); + record.setUpdateTimeFormat(DateUtil.formatDateTime(record.getUpdateTime())); + }); + return BaseResultJSON.success(recordList); + } + +// @GetMapping("/getIpPatientInfo") +// public BaseResultJSON getIpPatientInfo(@RequestParam("openid") String openid, +// @RequestParam("patId") String patId) { +//// HealthCardInfo cardInfo = cardInfoService.findHealthCardInfoByOpenidAndPatientId(openid, patId); +//// if (cardInfo == null) { +//// return BaseResultJSON.error("患者信息不存在!"); +//// } +// +// Map info = hisReportService.getIpPatientInfo(cardInfo.getName(), cardInfo.getIdNumber()); +// if (info != null) { +// return BaseResultJSON.success(info); +// } else { +// return BaseResultJSON.error("住院信息不存在!"); +// } +// } +} diff --git a/health_service/src/main/java/cn/card/health/controller/order/YcMsgController.java b/health_service/src/main/java/cn/card/health/controller/order/YcMsgController.java new file mode 100644 index 0000000..559cf04 --- /dev/null +++ b/health_service/src/main/java/cn/card/health/controller/order/YcMsgController.java @@ -0,0 +1,58 @@ +package cn.card.health.controller.order; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import cn.card.health.bean.order.YcMsg; +import cn.card.health.service.order.IYcMsgService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; + +/** + * 消息发送 + * + * @author xinggm + * @date 2021-07-22 10:10:34 + */ +@Api("order") +@RestController +@RequestMapping("order/ycmsg") +public class YcMsgController { + + @Autowired + private IYcMsgService ycMsgService; + + @ApiOperation("新增") + @PostMapping("insert") + public Object insert(YcMsg ycMsg){ + return ycMsgService.insertYcMsg(ycMsg); + } + + @ApiOperation("删除") + @PostMapping(value = "delete") + public int deleteYcMsg(Long id) { + return ycMsgService.deleteYcMsg(id); + } + + @ApiOperation( "根据主键更新") + @PostMapping("update") + public int update(YcMsg ycMsg) { + return ycMsgService.updateYcMsg(ycMsg); + } + + @ApiOperation("根据主键查询") + @PostMapping("select") + public YcMsg selectYcMsg(Long id) { + return ycMsgService.selectYcMsgById(id); + } + + @ApiOperation("条件查询") + @PostMapping("selectList") + public List selectList(YcMsg ycMsg) { + return ycMsgService.selectListYcMsg(ycMsg); + } +} \ No newline at end of file diff --git a/health_service/src/main/java/cn/card/health/controller/order/YcOrderController.java b/health_service/src/main/java/cn/card/health/controller/order/YcOrderController.java new file mode 100644 index 0000000..2ce1c4c --- /dev/null +++ b/health_service/src/main/java/cn/card/health/controller/order/YcOrderController.java @@ -0,0 +1,97 @@ +package cn.card.health.controller.order; + +import cn.card.health.bean.order.YcOrder; +import cn.card.health.service.order.IYcOrderService; +import cn.card.health.service.order.IYcPayCallbackService; +import com.alibaba.fastjson.JSONObject; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; +import java.util.Map; + +/** + * @author xinggm + * @date 2021-07-08 15:32:52 + */ +@Api("order") +@RestController +@RequestMapping("order/ycorder") +public class YcOrderController { + + @Autowired + private IYcOrderService ycOrderService; + + @Autowired + private IYcPayCallbackService ycPayCallbackService; + + @ApiOperation("新增") + @PostMapping("insert") + public Object insert(YcOrder ycOrder) { + return ycOrderService.insertYcOrder(ycOrder); + } + + @ApiOperation("删除") + @PostMapping(value = "delete") + public int deleteYcOrder(Long id) { + return ycOrderService.deleteYcOrder(id); + } + + @ApiOperation("根据主键更新") + @PostMapping("update") + public int update(YcOrder ycOrder) { + return ycOrderService.updateYcOrder(ycOrder); + } + + @ApiOperation("根据主键查询") + @PostMapping("select") + public YcOrder selectYcOrder(Long id) { + return ycOrderService.selectYcOrderById(id); + } + + @ApiOperation("根据patid和orderno查询") + @PostMapping("selectOrderState") + public JSONObject selectOrderState(@RequestBody Map params) { + JSONObject object = new JSONObject(); + + if (params.get("patId") == null || params.get("orderno") == null) { + object.put("code", "500"); + object.put("message", "参数异常"); + return object; + } + + String orderno = (String) params.get("orderno"); + if (orderno.startsWith("wmp01")) { //HIS发起的退费,orderno添加了wmp01 + orderno = orderno.substring(5); + } + + YcOrder ycOrder = new YcOrder(); + ycOrder.setPatientid((Long) params.get("patId")); + ycOrder.setOrderno(orderno); + ycOrder = ycOrderService.selectYcOrder(ycOrder); + + JSONObject result = new JSONObject(); + result.put("patId", params.get("patId")); + result.put("orderno", orderno); + result.put("status", ycOrder.getOrderStatus()); + + object.put("code", "200"); + object.put("message", "查询成功"); + object.put("result", result); + return object; + } + + @ApiOperation("条件查询") + @PostMapping("selectList") + public List selectList(@RequestBody YcOrder ycOrder) { + ycOrder.setOrderStatus(2); + return ycOrderService.selectListYcOrder(ycOrder); + } + + +} \ No newline at end of file diff --git a/health_service/src/main/java/cn/card/health/controller/order/YcOrderInhospController.java b/health_service/src/main/java/cn/card/health/controller/order/YcOrderInhospController.java new file mode 100644 index 0000000..243b356 --- /dev/null +++ b/health_service/src/main/java/cn/card/health/controller/order/YcOrderInhospController.java @@ -0,0 +1,60 @@ +package cn.card.health.controller.order; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.alibaba.fastjson.JSONObject; + +import cn.card.health.bean.order.YcOrderInhosp; +import cn.card.health.common.utils.BaseResultJSON; +import cn.card.health.service.order.IYcOrderInhospService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; + +/** + * 住院预缴订单 + + * + * @author xinggm + * @date 2021-09-07 14:12:41 + */ +@Api("order") +@RestController +@RequestMapping("order/ycorderinhosp") +public class YcOrderInhospController { + + @Autowired + private IYcOrderInhospService ycOrderInhospService; + + @ApiOperation("新增") + @PostMapping("insert") + public JSONObject insert(YcOrderInhosp ycOrderInhosp){ + return BaseResultJSON.success(ycOrderInhospService.insertYcOrderInhosp(ycOrderInhosp)); + } + + @ApiOperation("删除") + @PostMapping(value = "/delete") + public JSONObject deleteYcOrderInhosp(Long id) { + return BaseResultJSON.success(ycOrderInhospService.deleteYcOrderInhosp(id)); + } + + @ApiOperation( "根据主键更新") + @PostMapping("/update") + public JSONObject update(YcOrderInhosp ycOrderInhosp) { + return BaseResultJSON.success(ycOrderInhospService.updateYcOrderInhosp(ycOrderInhosp)); + } + + @ApiOperation("根据主键查询") + @PostMapping("/selectYcOrderInhospById") + public JSONObject selectYcOrderInhosp(Long id) { + return BaseResultJSON.success(ycOrderInhospService.selectYcOrderInhospById(id)); + } + + @ApiOperation("条件查询") + @PostMapping("/selectList") + public JSONObject selectList(YcOrderInhosp ycOrderInhosp) { + return BaseResultJSON.success(ycOrderInhospService.selectListYcOrderInhosp(ycOrderInhosp)); + } +} \ No newline at end of file diff --git a/health_service/src/main/java/cn/card/health/controller/order/YcOrderRefundpayController.java b/health_service/src/main/java/cn/card/health/controller/order/YcOrderRefundpayController.java new file mode 100644 index 0000000..5c6f0b8 --- /dev/null +++ b/health_service/src/main/java/cn/card/health/controller/order/YcOrderRefundpayController.java @@ -0,0 +1,65 @@ +package cn.card.health.controller.order; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import cn.card.health.bean.order.YcOrderRefundpay; +import cn.card.health.service.order.IYcOrderRefundpayService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; + +/** + * + * + * @author xinggm + * @date 2021-07-08 15:32:53 + */ +@Api("order") +@RestController +@RequestMapping("order/ycorderRefundpay") +public class YcOrderRefundpayController { + + @Autowired + private IYcOrderRefundpayService ycOrderRefundpayService; + + @ApiOperation("新增") + @PostMapping("/insert") + public Object insert(YcOrderRefundpay ycOrderRefundpay){ + return ycOrderRefundpayService.insertYcOrderRefundpay(ycOrderRefundpay); + } + + @ApiOperation("删除") + @PostMapping("/delete") + public int deleteYcOrderRefundpay(Long id) { + return ycOrderRefundpayService.deleteYcOrderRefundpay(id); + } + + @ApiOperation( "根据主键更新") + @PostMapping("/update") + public int update(@RequestBody YcOrderRefundpay ycOrderRefundpay) { + return ycOrderRefundpayService.updateYcOrderRefundpay(ycOrderRefundpay); + } + + @ApiOperation("根据主键查询") + @PostMapping("/select") + public YcOrderRefundpay selectYcOrderRefundpay(Long id) { + return ycOrderRefundpayService.selectYcOrderRefundpayById(id); + } + + @ApiOperation("条件查询") + @PostMapping("/selectList") + public List selectList(@RequestBody YcOrderRefundpay ycOrderRefundpay) { + return ycOrderRefundpayService.selectListYcOrderRefundpay(ycOrderRefundpay); + } + + @ApiOperation("条件查询单条") + @PostMapping("/selectByTrade") + public YcOrderRefundpay selectByTrade(@RequestBody YcOrderRefundpay ycOrderRefundpay) { + return ycOrderRefundpayService.selectYcOrderRefundpay(ycOrderRefundpay); + } +} \ No newline at end of file diff --git a/health_service/src/main/java/cn/card/health/controller/order/YcOrderRegistController.java b/health_service/src/main/java/cn/card/health/controller/order/YcOrderRegistController.java new file mode 100644 index 0000000..ed83f6b --- /dev/null +++ b/health_service/src/main/java/cn/card/health/controller/order/YcOrderRegistController.java @@ -0,0 +1,65 @@ +package cn.card.health.controller.order; + +import cn.card.health.bean.order.YcOrderRegist; +import cn.card.health.service.order.IYcOrderRegistService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 挂号订单表 + * + * @author xinggm + * @date 2021-07-08 15:32:53 + */ +@Api("order") +@RestController +@RequestMapping("order/orderregist") +public class YcOrderRegistController { + + @Autowired + private IYcOrderRegistService ycOrderRegistService; + + @ApiOperation("新增") + @PostMapping("/insert") + public Object insert(YcOrderRegist ycOrderRegist) { + return ycOrderRegistService.insertYcOrderRegist(ycOrderRegist); + } + + @ApiOperation("删除") + @PostMapping("/delete") + public int deleteYcOrderRegist(Long id) { + return ycOrderRegistService.deleteYcOrderRegist(id); + } + + @ApiOperation("根据主键更新") + @PostMapping("/update") + public int update(YcOrderRegist ycOrderRegist) { + return ycOrderRegistService.updateYcOrderRegist(ycOrderRegist); + } + + @ApiOperation("根据主键查询") + @GetMapping("/select") + public YcOrderRegist selectYcOrderRegist(@RequestParam("orderId") Long id) { + if (id == null || id < 0) { + return null; + } + return ycOrderRegistService.selectYcOrderRegistById(id); + } + + @ApiOperation("条件查询") + @PostMapping("/selectOrderList") + public List selectOrderList(@RequestBody YcOrderRegist ycOrderRegist) { + if (ycOrderRegist.getPatientid() == null) { + return null; + } + //return ycOrderRegistService.selectListYcOrderRegist(ycOrderRegist); + + List ycOrderRegists = ycOrderRegistService.selectRegistList(ycOrderRegist.getPatientid()); + + return ycOrderRegists; + } +} \ No newline at end of file diff --git a/health_service/src/main/java/cn/card/health/controller/order/YcOrderSerialpayController.java b/health_service/src/main/java/cn/card/health/controller/order/YcOrderSerialpayController.java new file mode 100644 index 0000000..23e3398 --- /dev/null +++ b/health_service/src/main/java/cn/card/health/controller/order/YcOrderSerialpayController.java @@ -0,0 +1,66 @@ +package cn.card.health.controller.order; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.alibaba.fastjson.JSONObject; +import cn.card.health.bean.order.YcOrderSerialpay; +import cn.card.health.common.utils.BaseResultJSON; +import cn.card.health.service.order.IYcOrderSerialpayService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; + +/** + * + * + * @author xinggm + * @date 2021-07-08 15:32:53 + */ +@Api("order") +@RestController +@RequestMapping("order/orderSerialpay") +public class YcOrderSerialpayController { + + @Autowired + private IYcOrderSerialpayService ycOrderSerialpayService; + + @ApiOperation("新增") + @PostMapping("/insert") + public JSONObject insert(@RequestBody YcOrderSerialpay ycOrderSerialpay){ + return BaseResultJSON.success(ycOrderSerialpayService.insertYcOrderSerialpay(ycOrderSerialpay)); + } + + @ApiOperation("删除") + @PostMapping(value = "/delete") + public JSONObject deleteYcOrderSerialpay(Long id) { + return BaseResultJSON.success(ycOrderSerialpayService.deleteYcOrderSerialpay(id)); + } + + @ApiOperation( "根据主键更新") + @PostMapping("/update") + public JSONObject update(@RequestBody YcOrderSerialpay ycOrderSerialpay) { + return BaseResultJSON.success(ycOrderSerialpayService.updateYcOrderSerialpay(ycOrderSerialpay)); + } + + @ApiOperation("根据主键查询") + @PostMapping("/selectById") + public JSONObject selectYcOrderSerialpay(Long id) { + return BaseResultJSON.success(ycOrderSerialpayService.selectYcOrderSerialpayById(id)); + } + + @ApiOperation("条件查询") + @PostMapping("/selectList") + public JSONObject selectList(@RequestBody YcOrderSerialpay ycOrderSerialpay) { + return BaseResultJSON.success(ycOrderSerialpayService.selectListYcOrderSerialpay(ycOrderSerialpay)); + } + + @ApiOperation("根据条件查询单个") + @PostMapping("/selectByTrade") + public JSONObject selectByTrade(@RequestBody YcOrderSerialpay ycOrderSerialpay) { + return BaseResultJSON.success(ycOrderSerialpayService.selectYcOrderSerialpay(ycOrderSerialpay)); + } +} \ No newline at end of file diff --git a/health_service/src/main/java/cn/card/health/controller/order/YcPayCallbackController.java b/health_service/src/main/java/cn/card/health/controller/order/YcPayCallbackController.java new file mode 100644 index 0000000..13633cc --- /dev/null +++ b/health_service/src/main/java/cn/card/health/controller/order/YcPayCallbackController.java @@ -0,0 +1,58 @@ +package cn.card.health.controller.order; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import cn.card.health.bean.order.YcPayCallback; +import cn.card.health.service.order.IYcPayCallbackService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; + +/** + * 微信调用 + * + * @author xinggm + * @date 2021-07-08 15:32:53 + */ +@Api("order") +@RestController +@RequestMapping("order/ycpaycallback") +public class YcPayCallbackController { + + @Autowired + private IYcPayCallbackService ycPayCallbackService; + + @ApiOperation("新增") + @PostMapping("insert") + public Object insert(YcPayCallback ycPayCallback){ + return ycPayCallbackService.insertYcPayCallback(ycPayCallback); + } + + @ApiOperation("删除") + @PostMapping(value = "delete") + public int deleteYcPayCallback(Long id) { + return ycPayCallbackService.deleteYcPayCallback(id); + } + + @ApiOperation( "根据主键更新") + @PostMapping("update") + public int update(YcPayCallback ycPayCallback) { + return ycPayCallbackService.updateYcPayCallback(ycPayCallback); + } + + @ApiOperation("根据主键查询") + @PostMapping("select") + public YcPayCallback selectYcPayCallback(Long id) { + return ycPayCallbackService.selectYcPayCallbackById(id); + } + + @ApiOperation("条件查询") + @PostMapping("selectList") + public List selectList(YcPayCallback ycPayCallback) { + return ycPayCallbackService.selectListYcPayCallback(ycPayCallback); + } +} \ No newline at end of file diff --git a/health_service/src/main/java/cn/card/health/controller/user/YcAuthorityController.java b/health_service/src/main/java/cn/card/health/controller/user/YcAuthorityController.java new file mode 100644 index 0000000..f47247e --- /dev/null +++ b/health_service/src/main/java/cn/card/health/controller/user/YcAuthorityController.java @@ -0,0 +1,59 @@ +package cn.card.health.controller.user; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.alibaba.fastjson.JSONObject; + +import cn.card.health.bean.user.YcAuthority; +import cn.card.health.common.utils.BaseResultJSON; +import cn.card.health.service.user.IYcAuthorityService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; + +/** + * 授权表 + * + * @author xinggm + * @date 2021-08-30 17:59:54 + */ +@Api("user") +@RestController +@RequestMapping("user/ycauthority") +public class YcAuthorityController { + + @Autowired + private IYcAuthorityService ycAuthorityService; + + @ApiOperation("新增") + @PostMapping("insert") + public JSONObject insert(YcAuthority ycAuthority){ + return BaseResultJSON.success(ycAuthorityService.insertYcAuthority(ycAuthority)); + } + + @ApiOperation("删除") + @PostMapping(value = "/delete") + public JSONObject deleteYcAuthority(Long id) { + return BaseResultJSON.success(ycAuthorityService.deleteYcAuthority(id)); + } + + @ApiOperation( "根据主键更新") + @PostMapping("/update") + public JSONObject update(YcAuthority ycAuthority) { + return BaseResultJSON.success(ycAuthorityService.updateYcAuthority(ycAuthority)); + } + + @ApiOperation("根据主键查询") + @PostMapping("/selectYcAuthorityById") + public JSONObject selectYcAuthority(Long id) { + return BaseResultJSON.success(ycAuthorityService.selectYcAuthorityById(id)); + } + + @ApiOperation("条件查询") + @PostMapping("/selectList") + public JSONObject selectList(YcAuthority ycAuthority) { + return BaseResultJSON.success(ycAuthorityService.selectListYcAuthority(ycAuthority)); + } +} \ No newline at end of file diff --git a/health_service/src/main/java/cn/card/health/controller/user/YcPatientController.java b/health_service/src/main/java/cn/card/health/controller/user/YcPatientController.java new file mode 100644 index 0000000..e43e316 --- /dev/null +++ b/health_service/src/main/java/cn/card/health/controller/user/YcPatientController.java @@ -0,0 +1,163 @@ +package cn.card.health.controller.user; + +import java.util.List; + +import cn.card.health.base.controller.BaseController; +import cn.card.health.bean.user.LoginUser; +import cn.card.health.common.utils.spring.SecurityUtils; +import cn.card.health.his.service.HisResult; +import cn.card.health.his.service.IHisCallService; +import com.alibaba.fastjson.JSONObject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import cn.card.health.bean.hospital.YcPatient; +import cn.card.health.common.utils.BaseResultJSON; +import cn.card.health.service.user.IYcPatientService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; + +/** + * HIS病人健康卡对照表 + * + * @author xinggm + * @date 2021-07-14 09:05:22 + */ +@RestController +@RequestMapping("/filing") +public class YcPatientController extends BaseController { + + @Autowired + private IYcPatientService ycPatientService; + @Autowired + private IHisCallService hisCallService; + + @ApiOperation("新增") + @PostMapping("/insert") + public Object insert(YcPatient ycPatient) { + return ycPatientService.insertYcPatient(ycPatient); + } + + @ApiOperation("删除") + @PostMapping(value = "/delete") + public int deleteYcPatient(Long id) { + return ycPatientService.deleteYcPatient(id); + } + + @ApiOperation("根据主键更新") + @PostMapping("/update") + public int update(YcPatient ycPatient) { + return ycPatientService.updateYcPatient(ycPatient); + } + + @ApiOperation("根据主键查询") + @PostMapping("/selectYcPatientById") + public YcPatient selectYcPatient(Long id) { + return ycPatientService.selectYcPatientById(id); + } + + @ApiOperation("条件查询") + @PostMapping("/All") + public BaseResultJSON selectList(@RequestBody YcPatient patient) { + + LoginUser user = SecurityUtils.getLoginUser(); + patient.setOpenid(user.getUsername()); + patient.setDelFlag(1); + return BaseResultJSON.success(ycPatientService.selectListYcPatient(patient)); + } + + /** + * 查询就诊卡 + * @param params + * @return + */ + @PostMapping("/getMemberinfo") + public BaseResultJSON getMemberinfo(@RequestBody JSONObject params) { + if(!params.containsKey("memberid")){ + return BaseResultJSON.error(("请选择就诊卡操作")); + } + String memberid = params.getString("memberid"); + if(memberid.contains(",")){ + return BaseResultJSON.error(("请选择一张就诊卡操作")); + } + return BaseResultJSON.success(ycPatientService.checkPatient(memberid)); + } + + /** + * 删除就诊人 + * @param params + * @return + */ + @PostMapping("/delMemberinfo") + public BaseResultJSON delMemberinfo(@RequestBody JSONObject params) { + Long patientid = params.getLong("patientid"); + return BaseResultJSON.success(ycPatientService.deleteYcPatient(patientid)); + } + + + /** + * 添加就诊人 + * + * @param params + * @return + */ + @PostMapping("/addmemberinfo") + public BaseResultJSON addmemberinfo(@RequestBody JSONObject params) { + YcPatient patient = YcPatient.getInstance(params); + LoginUser user = SecurityUtils.getLoginUser(); + patient.setOpenid(user.getUsername()); + if(1 == ycPatientService.addPatient(patient)){ + return BaseResultJSON.success(patient); + }else{ + return BaseResultJSON.error(patient.getChannel()); + } + } + + /** + * 修改就诊人 + * + * @param params + * @return + */ + @PostMapping("/modmemberinfo") + public BaseResultJSON modmemberinfo(@RequestBody JSONObject params) { + + if(!params.containsKey("memberid")){ + return BaseResultJSON.error(("请选择就诊卡操作")); + } + String memberid = params.getString("memberid"); + if(memberid.contains(",")){ + return BaseResultJSON.error(("请选择一张就诊卡操作")); + } + JSONObject hisParams = new JSONObject(); + hisParams.put("name", ""); + hisParams.put("memberId", params.getString("memberid")); + hisParams.put("sex", params.getString("sex")); + hisParams.put("address", params.getString("address")); + hisParams.put("phone", params.getString("phone")); + hisParams.put("nation", params.getString("nation")); + hisParams.put("nationId", params.getString("nationId")); + if(1 == ycPatientService.updateHISPatient(hisParams)){ + return BaseResultJSON.success(); + }else{ + return BaseResultJSON.error(); + } + } + + /** + * 获取民族 + * + * @param + * @return + */ + @PostMapping("/nationList") + public BaseResultJSON nationList() { + HisResult result = hisCallService.getNationList(); + if(result.isSucess()){ + return BaseResultJSON.success(result.getListData()); + }else{ + return BaseResultJSON.error(result.getReturnMsg()); + } + } + +} \ No newline at end of file diff --git a/health_service/src/main/java/cn/card/health/controller/user/YcUserController.java b/health_service/src/main/java/cn/card/health/controller/user/YcUserController.java new file mode 100644 index 0000000..e9ec745 --- /dev/null +++ b/health_service/src/main/java/cn/card/health/controller/user/YcUserController.java @@ -0,0 +1,59 @@ +package cn.card.health.controller.user; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.alibaba.fastjson.JSONObject; + +import cn.card.health.bean.user.YcUser; +import cn.card.health.common.utils.BaseResultJSON; +import cn.card.health.service.user.IYcUserService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; + +/** + * 用户表 + * + * @author xinggm + * @date 2021-08-28 10:47:55 + */ +@Api("user") +@RestController +@RequestMapping("user/ycuser") +public class YcUserController { + + @Autowired + private IYcUserService ycUserService; + + @ApiOperation("新增") + @PostMapping("insert") + public JSONObject insert(YcUser ycUser){ + return BaseResultJSON.success(ycUserService.insertYcUser(ycUser)); + } + + @ApiOperation("删除") + @PostMapping(value = "/delete") + public JSONObject deleteYcUser(Long id) { + return BaseResultJSON.success(ycUserService.deleteYcUser(id)); + } + + @ApiOperation( "根据主键更新") + @PostMapping("/update") + public JSONObject update(YcUser ycUser) { + return BaseResultJSON.success(ycUserService.updateYcUser(ycUser)); + } + + @ApiOperation("根据主键查询") + @PostMapping("/selectYcUserById") + public JSONObject selectYcUser(Long id) { + return BaseResultJSON.success(ycUserService.selectYcUserById(id)); + } + + @ApiOperation("条件查询") + @PostMapping("/selectList") + public JSONObject selectList(YcUser ycUser) { + return BaseResultJSON.success(ycUserService.selectListYcUser(ycUser)); + } +} \ No newline at end of file diff --git a/health_service/src/main/java/cn/card/health/task/CancelOrderTimeTask.java b/health_service/src/main/java/cn/card/health/task/CancelOrderTimeTask.java new file mode 100644 index 0000000..2c476ec --- /dev/null +++ b/health_service/src/main/java/cn/card/health/task/CancelOrderTimeTask.java @@ -0,0 +1,40 @@ +package cn.card.health.task; + +import cn.card.health.bean.order.YcOrderRegist; +import cn.card.health.framework.service.RegistHealthService; +import cn.card.health.service.order.IYcOrderRegistService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.TimerTask; + +public class CancelOrderTimeTask extends TimerTask { + private static Logger logger = LoggerFactory.getLogger(CancelOrderTimeTask.class); + + private final RegistHealthService registHealthService; + private final IYcOrderRegistService orderRegistService; + + private final String orderno; + + public CancelOrderTimeTask(RegistHealthService registHealthService, IYcOrderRegistService orderRegistService, String orderno) { + this.registHealthService = registHealthService; + this.orderRegistService = orderRegistService; + this.orderno = orderno; + } + + @Override + public void run() { + logger.info("挂号订单超时未支付:" + orderno); + // 执行取消订单 + YcOrderRegist orderRegist = new YcOrderRegist(); + orderRegist.setOrderno(orderno); + orderRegist = orderRegistService.selectYcOrderRegist(orderRegist); + orderRegist.setRemark("超时未支付取消挂号"); + String orderType = orderRegist.getOrdertype(); + if ("PREREGIST".equals(orderType)) { + registHealthService.cancelLockPreRegOrder(orderRegist); + } else { + registHealthService.cancelLockCurRegOrder(orderRegist); + } + } +} diff --git a/health_service/src/main/java/cn/card/health/web/HealthCardController.java b/health_service/src/main/java/cn/card/health/web/HealthCardController.java new file mode 100644 index 0000000..22b5195 --- /dev/null +++ b/health_service/src/main/java/cn/card/health/web/HealthCardController.java @@ -0,0 +1,748 @@ +//package cn.card.health.web; +// +//import cn.card.health.base.controller.BaseController; +//import cn.card.health.bean.user.LoginUser; +//import cn.card.health.common.utils.BaseResultJSON; +//import cn.card.health.common.utils.http.Https; +//import cn.card.health.config.WechatConfig; +//import cn.card.health.entity.Image; +//import cn.card.health.entity.Phone; +//import cn.card.health.framework.service.GetHeatlhCardService; +//import cn.card.health.helper.iniOpenId; +//import cn.card.health.service.HealthCardInfoService; +//import cn.card.health.service.HealthCardTempService; +//import cn.card.health.service.JsapiTicketUtil; +//import cn.card.health.service.Sign; +//import cn.card.health.service.user.IYcUserService; +//import cn.hutool.core.date.DateUtil; +//import cn.hutool.core.util.StrUtil; +//import cn.hutool.http.HttpUtil; +//import cn.hutool.json.JSONUtil; +//import com.alibaba.fastjson.JSON; +//import com.alibaba.fastjson.JSONArray; +//import com.alibaba.fastjson.JSONObject; +//import com.tencent.healthcard.model.HealthCardInfo; +//import com.tencent.healthcard.model.ReportHISData; +//import io.swagger.annotations.Api; +//import io.swagger.annotations.ApiOperation; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.web.bind.annotation.*; +// +//import javax.servlet.http.HttpServletRequest; +//import javax.servlet.http.HttpServletResponse; +//import java.io.IOException; +//import java.net.URLEncoder; +//import java.util.Date; +//import java.util.List; +//import java.util.ListIterator; +//import java.util.Map; +// +//@Api("api") +//@RestController +//@RequestMapping("/api") +//public class HealthCardController extends BaseController { +// @Autowired +// GetHeatlhCardService getHeatlhCardService; +// @Autowired +// HealthCardInfoService healthCardInfoService; +// @Autowired +// HealthCardTempService healthCardTempService; +// +// @Autowired +// private IYcUserService userService; +// +// @ApiOperation(value = "保存用户基本信息") +// @PostMapping("/saveCardInfo") +// public JSONObject saveCardInfo(@RequestBody(required = false) HealthCardInfo healthCardInfo) { +// if (healthCardInfo.getIdNumber().length() != 18) { +// return BaseResultJSON.error(-1, "身份证格式不正确"); +// } +// +// if (healthCardInfo.getPhone1() == null || healthCardInfo.getPhone1().length() != 11) { +// return BaseResultJSON.error(-1, "请输入手机号码!"); +// } +// +// if (healthCardInfo.getWechatCode() == null || healthCardInfo.getWechatCode().length() != 32) { +// return BaseResultJSON.error(-1, "请先进行微信授权!"); +// } +// +// HealthCardInfo healthCardInfo1 = healthCardTempService.findHealthCardTempByOpenId(healthCardInfo.getOpenId(), healthCardInfo.getIdNumber()); +// if (healthCardInfo1 == null) { +// healthCardTempService.insertHealthCardTemp(healthCardInfo); +// } else { +// healthCardTempService.updateHealthCardTemp(healthCardInfo); +// } +// +// return BaseResultJSON.success("成功"); +// } +// +// @ApiOperation(value = "获取手机号并注册电子健康卡") +// @PostMapping("/registerHealthCard") +// public JSONObject registerHealthCard(@RequestBody(required = false) Phone phone) { +// logger.info("openId:{},idNumber:{}", phone.getOpenId(), phone.getIdNumber()); +// HealthCardInfo healthCardInfo = healthCardTempService.findHealthCardTempByOpenId(phone.getOpenId(), phone.getIdNumber()); +// if (healthCardInfo == null) { +// return BaseResultJSON.error(-1, "注册信息未查到!"); +// } +// if (phone.getClient() != null && phone.getClient().equalsIgnoreCase("ALIPAY")) { //支付宝小程序,不获取微信健康卡 +// logger.info("支付宝建卡:{}", phone.getOpenId()); +// return getHeatlhCardService.getHospitalCard(healthCardInfo); +// } else { +// return getHeatlhCardService.getHeathCard(healthCardInfo); +// } +// } +// +// @ApiOperation(value = "通过healthCode绑定医院卡") +// @PostMapping("/relatedHeathCard") +// public JSONObject relatedHeathCard(@RequestParam("openid") String openid, @RequestParam("healthCode") String healthCode) { +// if (StrUtil.isBlank(openid)) { +// return BaseResultJSON.error("微信号不能为空!"); +// } +// if (StrUtil.isBlank(healthCode)) { +// return BaseResultJSON.error("healthCode不能为空!"); +// } +// +// return getHeatlhCardService.relatedHeathCardByHealthCode(openid, healthCode); +// } +// +// @ApiOperation(value = "通过二维码获取电子健康卡") +// @PostMapping("/getHealthCardByCode") +// public JSONObject getHealthCardByCode(@RequestParam("qrCodeText") String qrCodeText) { +// JSONObject result = new JSONObject(); +// +// //如果本地有数据从本地取,如果没有从微信获取 +// HealthCardInfo cardInfo = healthCardInfoService.findHealthCardInfoByQRCode(qrCodeText); +// if (cardInfo != null) { +// result.put("birthday", cardInfo.getBirthday()); +// result.put("protectState", ""); +// result.put("gender", cardInfo.getGender()); +// result.put("color", ""); +// result.put("nation", ""); +// result.put("idCard", cardInfo.getIdNumber()); +// result.put("ecardNo", ""); +// result.put("phone2", cardInfo.getPhone2()); +// result.put("channel", ""); +// result.put("oldType", ""); +// result.put("registerType", ""); +// result.put("idNumber", cardInfo.getIdNumber()); +// result.put("allowUnbind", ""); +// result.put("retmsg", "成功"); +// result.put("healthCardId", cardInfo.getHealthCardId()); +// result.put("bindHospital", ""); +// result.put("phone1", cardInfo.getPhone1()); +// result.put("relation", cardInfo.getRelation()); +// result.put("lastbind_time", ""); +// result.put("adminFlag", ""); +// result.put("authType", ""); +// result.put("extType", ""); +// result.put("ext", ""); +// result.put("address", cardInfo.getAddress()); +// result.put("idType", cardInfo.getIdType()); +// result.put("patid", cardInfo.getPatid()); +// result.put("phid", ""); +// result.put("cardType", cardInfo.getIdType()); +// result.put("adminExt", ""); +// result.put("name", cardInfo.getName()); +// result.put("qrCodeText", cardInfo.getQrCodeText()); +// result.put("adminCard", ""); +// result.put("isVirtual", ""); +// result.put("retcode", "0"); +// result.put("isHomeMaster", ""); +// +// return result; +// } else { +// return getHeatlhCardService.getHealthCardByCode(qrCodeText); +// } +// } +// +// @ApiOperation(value = "获取动态二维码") +// @GetMapping("/getDynamicQRCode") +// public JSONObject getDynamicQRCode(@RequestParam String openid, @RequestParam String patId) { +// if (StrUtil.isBlank(openid) || StrUtil.isBlank(patId)) { +// return BaseResultJSON.error("请求参数不能为空!"); +// } +// +// HealthCardInfo cardInfo = healthCardInfoService.findHealthCardInfoByOpenidAndPatientId(openid, patId); +// if (cardInfo == null) { +// return BaseResultJSON.error("患者信息不存在!"); +// } +// +// String healthCardId = cardInfo.getHealthCardId(); +// String idType = cardInfo.getIdType(); +// String idNumber = cardInfo.getIdNumber(); +// return getHeatlhCardService.getDynamicQRCode(healthCardId, idType, idNumber); +// } +// +// @ApiOperation(value = "通过授权码获取电子健康卡") +// @PostMapping("/getHealthCardByHealthCode") +// public JSONObject getHealthCardByHealthCode(String healthCode) { +// return getHeatlhCardService.getHealthCardByCode(healthCode); +// } +// +// @ApiOperation(value = "重定向") +// @GetMapping("/sendWechatCode") +// public void sendWechatCode(HttpServletResponse response, HttpServletRequest request) { +// System.out.println("-------sendWechatCode----------"); +// // 获取参数 +// String openId = request.getParameter("openId"); +// System.out.println("======openID: " + openId); +// String url = request.getParameter("url"); +// System.out.println( +// "https://health.tengmed.com/open/getUserCode?redirect_uri=https://www.hbyctr.com/health_service/api/getWechatCode?url=" +// + url + "?openId=" + openId); +// +// try { +// String redirect_url = URLEncoder.encode("https://daxicn.mynatapp.cc/api/getWechatCode?", "UTF-8"); +// //response.sendRedirect( +// // "https://health.tengmed.com/open/getUserCode?apiVersion=2&redirect_uri=" + redirect_url + "url=" +// // + url + "?openId=" + openId); +// response.sendRedirect( +// "https://health.tengmed.com/open/getUserCode?apiVersion=2&redirect_uri=" + redirect_url); +// } catch (IOException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } +// } +// +// //不用 +// @ApiOperation(value = "获取wechatCode编码") +// @GetMapping("/getWechatCode") +// public void getWechatCode(HttpServletResponse response, HttpServletRequest request) { +// +// System.out.println("-------getWechatCode----------"); +// String wechatCode = request.getParameter("wechatCode"); +// String urls = request.getParameter("url"); +// String url = urls.substring(0, urls.indexOf("?openId")); +// String openId = urls.substring(urls.indexOf("?openId=") + 8); +// String idNumber = request.getParameter("idNumber"); +// HealthCardInfo healthCardInfo = healthCardTempService.findHealthCardTempByOpenId(openId, idNumber); +// if (healthCardInfo == null) { +// healthCardTempService.insertHealthCardInfoWechatCode(wechatCode, openId); +// } else { +// healthCardTempService.updateHealthCardInfoWechatCode(wechatCode, openId); +// } +// System.out.println("====return url: https://" + url + "?login=1"); +// try { +// response.sendRedirect("https://" + url + "?login=1"); +// } catch (IOException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } +// +// } +// +// @ApiOperation("sendRedirectHealthCard") +// @GetMapping("/sendRedirectHealthCard") +// public void sendRedirectHealthCard(HttpServletResponse response, HttpServletRequest request) throws IOException { +// System.out.println("=====sendRedirectHealthCard====="); +// String openId = request.getParameter("openId"); +// String url = request.getParameter("url"); +// System.out.println("----url: " + url); +// System.out.println("----openId: " + openId); +// response.sendRedirect( +// "https://health.tengmed.com/open/getHealthCardList?redirect_uri=https://www.hbyctr.com/health_service/api/getHealthCode?url=" +// + url + "?openId=" + openId); +// } +// +// @ApiOperation(value = "获取healthCode编码") +// @GetMapping("/getHealthCode") +// public void getHeathCode(HttpServletResponse response, HttpServletRequest request) throws IOException { +// System.out.println("-------getHealthCode----------"); +// String urls = request.getParameter("url"); +// String url = urls.substring(0, urls.indexOf("?openId")); +// String openId = urls.substring(urls.indexOf("?openId=") + 8); +// String healthCode = request.getParameter("healthCode"); +// String idNumber = request.getParameter("idNumber"); +//// JSONObject jsonObject = new JSONObject(); +//// if (healthCode == null) { +//// jsonObject.put("retcode", -1); +//// jsonObject.put("retmsg", "失败"); +//// } else { +// HealthCardInfo healthCardInfo = healthCardTempService.findHealthCardTempByOpenId(openId, idNumber); +// if (healthCardInfo == null) { +// healthCardTempService.insertHealthCardInfoHealthCode(healthCode, openId); +// } else { +// healthCardTempService.updateHealthCardInfoHealthCode(healthCode, openId); +// } +//// } +// JSONObject healthInfo = getHeatlhCardService.getHealthCardByHealthCode(healthCode); +// System.out.println("-------healthInfo: " + healthInfo); +// if (healthInfo.containsKey("commonOut")) { +// JSONObject commonOut = healthInfo.getJSONObject("commonOut"); +// System.out.println("====commonOut: " + commonOut); +// int resultCode = commonOut.getIntValue("resultCode"); +// if (resultCode != 0) { +// response.sendRedirect("https://www.hbyctr.com/ownWeb/wx/regist.html"); +// } else { +// JSONObject rsp = healthInfo.getJSONObject("rsp"); +// JSONObject card = rsp.getJSONObject("card"); +// HealthCardInfo cardInfo = healthCardInfoService.findHealthCardInfoByIdNumber(card.getString("idNumber"), openId); +// if (cardInfo == null) { +// healthCardInfo = new HealthCardInfo(); +// healthCardInfo.setPhone1(card.getString("phone1")); +// healthCardInfo.setName(card.getString("name")); +// healthCardInfo.setIdType(card.getString("idType")); +// healthCardInfo.setBirthday(card.getString("birthday")); +// healthCardInfo.setGender(card.getString("gender")); +// healthCardInfo.setHealthCardId(card.getString("healthCardId")); +// healthCardInfo.setOpenId(openId); +// healthCardInfo.setQrCodeText(card.getString("qrCodeText")); +// healthCardInfo.setAddress(card.getString("address")); +// healthCardInfo.setIdNumber(card.getString("idNumber")); +// healthCardInfo.setNation(card.getString("nation")); +// healthCardInfo.setPhone2(card.getString("phone2")); +// healthCardInfo.setPhid(card.getString("phid")); +// healthCardInfo.setPatid(card.getString("patid")); +// System.out.println("========start insert: " + healthCardInfo); +// healthCardInfoService.insertHealthCardInfo(healthCardInfo); +// } +// System.out.println("-------url: " + url); +// response.sendRedirect("https://" + url); +// } +// } else { +// int resultCode = healthInfo.getIntValue("retcode"); +// if (resultCode == 0) { +// healthCardInfo = new HealthCardInfo(); +// healthCardInfo.setPhone1(healthInfo.getString("phone1")); +// healthCardInfo.setName(healthInfo.getString("name")); +// healthCardInfo.setIdType(healthInfo.getString("idType")); +// healthCardInfo.setBirthday(healthInfo.getString("birthday")); +// healthCardInfo.setGender(healthInfo.getString("gender")); +// healthCardInfo.setHealthCardId(healthInfo.getString("healthCardId")); +// healthCardInfo.setOpenId(openId); +// healthCardInfo.setQrCodeText(healthInfo.getString("qrCodeText")); +// healthCardInfo.setAddress(healthInfo.getString("address")); +// healthCardInfo.setIdNumber(healthInfo.getString("idNumber")); +// healthCardInfo.setNation(healthInfo.getString("nation")); +// healthCardInfo.setPhone2(healthInfo.getString("phone2")); +// healthCardInfo.setPhid(healthInfo.getString("phid")); +// healthCardInfo.setPatid(healthInfo.getString("patid")); +// System.out.println("========start insert: " + healthCardInfo); +// healthCardInfoService.insertHealthCardInfo(healthCardInfo); +// } +// System.out.println("-------url: " + url); +// response.sendRedirect("https://" + url); +// } +// } +// +// @ApiOperation(value = "通过openId获取电子健康卡信息") +// @GetMapping("/getHealthCardByOpenId") +// public JSONObject getHealthCardByOpenId(@RequestParam("openid") String openId, +// @RequestParam(name = "dynamic", required = false, defaultValue = "0") int dynamic) { +// System.out.println("-------getHealthCardByOpenId----------"); +// logger.info("openid:" + openId); +// // 先从公众平台获取列表,然后再展示 +// List list = healthCardInfoService.findHealthCardInfoByOpenId(openId); +// ListIterator iterator = list.listIterator(); +// JSONArray cards = new JSONArray(); +// while (iterator.hasNext()) { +// HealthCardInfo healthCardInfo = iterator.next(); +// String name = healthCardInfo.getName(); +// String idNumber = healthCardInfo.getIdNumber(); +// String phone1 = healthCardInfo.getPhone1(); +//// healthCardInfo.setName(name.replace(name.substring(1, 2), "*")); +// healthCardInfo.setName(name); +// healthCardInfo.setIdNumber(idNumber.replace(idNumber.substring(4, 14), "**********")); +// healthCardInfo.setPhone1(phone1.replace(phone1.substring(2, 9), "******")); +// //iterator.remove(); +// //iterator.add(healthCardInfo); +// +// JSONObject cardInfo = (JSONObject) JSON.toJSON(healthCardInfo); +// +// if (dynamic == 1) { +// String healthCardId = healthCardInfo.getHealthCardId(); +// String idType = healthCardInfo.getIdType(); +// //JSONObject dynamicQRCode = getHeatlhCardService.getDynamicQRCode(healthCardId, idType, idNumber); +// JSONObject dynamicQRCode = new JSONObject(); +// dynamicQRCode.put("qrCodeImg", ""); +// dynamicQRCode.put("qrCodeText", ""); +// dynamicQRCode.put("color", ""); +// dynamicQRCode.put("retmsg", ""); +// dynamicQRCode.put("retcode", "-1"); +// cardInfo.put("dynamicQRCode", dynamicQRCode); +// } +// +// cards.add(cardInfo); +// } +// +// JSONObject jsonObject = new JSONObject(); +// jsonObject.put("retcode", 0); +// jsonObject.put("retmsg", "success"); +// jsonObject.put("cardcount", list.size()); +// //jsonObject.put("cardlist", list); +// jsonObject.put("cardlist", cards); +// return jsonObject; +// } +// +// /* +// * @ApiOperation(value = "获取code") +// * +// * @GetMapping("/getSendCode") public void getSendCode(HttpServletResponse +// * response){ try { response.sendRedirect( +// * "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc7debf0cf94f9616&redirect_uri=http://www.hbyctr.com/jkk/api/getCode&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect" +// * ); } catch (IOException e) { e.printStackTrace(); } } +// */ +// @ApiOperation(value = "获取code") +// @GetMapping("/getOpenId") +// public JSONObject getCode(@RequestParam("js_code") String code) { +// String appid = WechatConfig.service_appid; +// String secret = WechatConfig.service_secret; +//// 93bf768ed25b1ffebd42abb691af1811 +// String url = "https://api.weixin.qq.com/sns/jscode2session?appid=" + appid + "&secret=" + secret + "&js_code=" +// + code + "&grant_type=authorization_code"; +// String method = "GET"; +// String result = ""; +// try { +// result = Https.https(url, method); +// logger.info(result); +// } catch (Exception e) { +// logger.info("获取code,微信请求超时!"); +// result = "{\"errcode\":-1, \"errmsg\":\"微信请求超时\"}"; +// } +// JSONObject jsonObject = JSONObject.parseObject(result); +// if (jsonObject.containsKey("session_key")) { +// jsonObject.remove("session_key"); +// } +// //String openid = jsonObject.getString("openid"); +//// YcUser user = userLoginService.getWechatUser(openid); +// return jsonObject; +// +// } +// +// /* +// * @ApiOperation(value = "将电子健康卡放入卡包接口") +// * +// * @GetMapping("/takeMsCard") public JSONObject takeMsCard(HttpServletResponse +// * response,String qrCodeText) throws IOException { return +// * getHeatlhCardService.getOrderId(qrCodeText); } +// */ +// @ApiOperation(value = "将电子健康卡放入卡包接口") +// @GetMapping("/takeMsCard") +// public void takeMsCard(@RequestParam("qrCodeText") String qrCodeText, HttpServletResponse response) throws IOException { +// if (StrUtil.isBlank(qrCodeText)) { +// return; +// } +// +// String orderId = getHeatlhCardService.getOrderId(qrCodeText); +// //response.sendRedirect("https://health.tengmed.com/open/takeMsCard?order_id=" + orderId +// // + "&redirect_uri=page%2Findex"); +// response.sendRedirect("https://health.tengmed.com/open/takeMsCard?order_id=" + orderId +// + "&redirect_uri=back"); +// } +// +// /*@ApiOperation(value = "用卡数据检测") +// @RequestMapping("/reportHISData") +// public JSONObject reportHISData(@RequestBody(required = false) ReportHISData reportHISData) throws IOException { +// JSONObject jsonObject = getHeatlhCardService.reportHISData(reportHISData); +// return jsonObject; +// }*/ +// +// /** +// * 身份证照片OCR接口 +// * +// * @param image +// * @return +// * @throws IOException +// */ +// @ApiOperation(value = "通过OCR接口返回用户信息") +// @PostMapping("/registerByOcr") +// public JSONObject registerByOcr(@RequestBody(required = false) Image image) throws IOException { +// JSONObject jsonObject = getHeatlhCardService.registerByOcr(image.getImageContent()); +// return jsonObject; +// } +// +// @ApiOperation(value = "获取签名等配置") +// @GetMapping("/getWXConfigSignature") +// public Map getWXConfigSignature(String url) { +// String jsapi_ticket = JsapiTicketUtil.getWXJsapiTicket(); +// Map ret = Sign.sign(jsapi_ticket, url); +// ret.put("appId", WechatConfig.service_appid); +// return ret; +// } +// +// @ApiOperation(value = "解绑就诊卡") +// @PostMapping("/deleteHealthCard") +// public JSONObject deleteHealthCard(@RequestBody(required = false) Map map) { +// HealthCardInfo cardInfo = null; +// if (map.containsKey("patId")) { +// cardInfo = healthCardInfoService.findHealthCardInfoByOpenidAndPatientId(map.get("openid"), map.get("patId")); +// } else { +// List cardList = healthCardInfoService.findHealthCardInfoByOpenId(map.get("openid")); +// if (cardList.isEmpty()) { +// return BaseResultJSON.error("该微信号没有绑定健康卡!"); +// } +// for (int i = 0; i < cardList.size(); i++) { +// String qrCodeText = cardList.get(i).getQrCodeText(); +// if (qrCodeText.equals(map.get("qrCodeText"))) { +// cardInfo = cardList.get(i); +// break; +// } +// } +// } +// +// if (cardInfo == null) { +// return BaseResultJSON.error("健康卡不存在!"); +// } +// +// //如果是默认卡,处理默认卡问题 +// if (cardInfo.getIsCheck() == 1) { +// //查询是否存在别的健康卡,如果存在,将查到的第一个卡作为默认卡 +// List cardInfoList = healthCardInfoService.findHealthCardInfoByOpenId(cardInfo.getOpenId()); +// if (cardInfoList != null && cardInfoList.size() > 1) { +// for (int i = 0; i < cardInfoList.size(); i++) { +// HealthCardInfo cardInfo1 = cardInfoList.get(i); +// if (!cardInfo1.getPatid().equals(cardInfo.getPatid())) { +// healthCardInfoService.updateSelectedCard(cardInfo1.getOpenId(), cardInfo1.getPatid()); +// break; +// } +// } +// } +// } +// +// Integer flag = healthCardInfoService.delHealthCardInfoByIdNumber(cardInfo.getOpenId(), cardInfo.getIdNumber()); +// JSONObject result = new JSONObject(); +// if (flag > 0) { +// result.put("retcode", 0); +// result.put("retmsg", "删除成功"); +// } else { +// result.put("retcode", -1); +// result.put("retmsg", "删除失败"); +// } +// +// return result; +// } +// +// /* +// @ApiOperation(value = "解绑就诊卡") +// @PostMapping("/deleteHealthCard") +// public JSONObject deleteHealthCard(@RequestBody(required = false) Map map) { +// HealthCardInfo cardInfo = healthCardInfoService.findHealthCardInfoByQRCode(map.get("qrCodeText")); +// if (cardInfo == null) { +// return BaseResultJSON.error("健康卡不存在!"); +// } +// +// //如果是默认卡,处理默认卡问题 +// if (cardInfo.getIsCheck() == 1) { +// //查询是否存在别的健康卡,如果存在,将查到的第一个卡作为默认卡 +// List cardInfoList = healthCardInfoService.findHealthCardInfoByOpenId(cardInfo.getOpenId()); +// if (cardInfoList != null && cardInfoList.size() > 0) { +// HealthCardInfo cardInfo1 = cardInfoList.get(0); +// healthCardInfoService.updateSelectedCard(cardInfo1.getOpenId(), cardInfo1.getPatid()); +// } +// } +// +// Integer flag = healthCardInfoService.delHealthCardInfoByIdNumber(map); +// JSONObject result = new JSONObject(); +// if (flag > 0) { +// result.put("retcode", 0); +// result.put("retmsg", "删除成功"); +// } else { +// result.put("retcode", -1); +// result.put("retmsg", "删除失败"); +// } +// +// return result; +// } +// */ +// +// @ApiOperation(value = "批量注册健康卡") +// @PostMapping("/upgradeToHealthCard") +// public JSONObject upgradeToHealthCard(@RequestBody(required = false) HealthCardInfo[] healthCardInfos) { +// System.out.println(JSON.toJSONString(healthCardInfos)); +// return getHeatlhCardService.upgradeHeathCards(healthCardInfos); +// } +// +// @ApiOperation(value = "模版消息激活健康卡") +// @GetMapping("/templateActiveHealthCard") +// public void templateActiveHealthCard(HttpServletResponse response, HttpServletRequest request) throws IOException { +// String openId = request.getParameter("openId"); +// String enOpenId = iniOpenId.getEnOpenId(openId); +// response.sendRedirect("https://health.tengmed.com/open/batchActiveCard?open_id=" + enOpenId +// + "&redirect_uri=https://www.hbyctr.com/ownWeb/wx/list.html"); +// } +// +// @ApiOperation("设置默认卡") +// @PostMapping("/updateSelectedCard") +// public JSONObject updateSelectedCard(@RequestParam("openid") String openid, +// @RequestParam("patId") String patId) { +// if (StrUtil.isBlank(openid)) { +// return BaseResultJSON.error("微信号不能为空!"); +// } +// +// if (StrUtil.isBlank(patId)) { +// return BaseResultJSON.error("就诊卡号不能为空!"); +// } +// +// int result = healthCardInfoService.updateSelectedCard(openid, patId); +// if (result > 0) { +// return BaseResultJSON.success("设置默认卡成功!"); +// } else { +// return BaseResultJSON.error("设置默认卡失败!"); +// } +// } +// +// @ApiOperation(value = "用卡数据监测") +// @PostMapping("/reportHISData") +// public JSONObject reportHISData(@RequestParam("patId") String patId, +// @RequestParam("scene") String scene, +// @RequestParam("scene") String deptId, +// @RequestParam("channel") String channel) { +// if (StrUtil.isBlank(patId) || StrUtil.isBlank(scene)) { +// return BaseResultJSON.error("参数错误!"); +// } +// +// ReportHISData data = new ReportHISData(); +// data.setHospitalCode(WechatConfig.hospitalId); +// data.setTime(DateUtil.formatDateTime(new Date())); +// +// HealthCardInfo cardInfo = healthCardInfoService.findHealthCardInfoByPatientId(patId); +// data.setQrCodeText(cardInfo.getQrCodeText()); +// +// data.setScene(scene); +// +// if (!StrUtil.isBlank(deptId)) { +// String department = healthCardInfoService.getWechatDepartment(deptId); +// data.setDepartment(department); +// } +// +// data.setCardType("11");//健康卡 +// data.setCardChannel(channel);//小程序 +// data.setCardCostTypes("0100");//自费 +// +// JSONObject reportHISDataRsp = getHeatlhCardService.reportHISData(data); +// +// //挂号再传一个缴费 +// if (!StrUtil.isBlank(deptId)) { +// data.setScene("0101051"); +// getHeatlhCardService.reportHISData(data); +// } +// +// // 响应请求 +// return reportHISDataRsp; +// } +// +// /* +// @GetMapping("/sendMessage") +// public void sendMessage(@RequestParam("patId") String patId) { +// String url = "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/uniform_send?access_token=9E7FE39BEEA7142CF22F9623EEF8338C"; +// +// String access_token = getHeatlhCardService.getApptoken(); +// access_token = "9E7FE39BEEA7142CF22F9623EEF8338C"; +// String openid = "okYGs5FtuetRCuiPUPEynMm8zZIc"; +// +// JSONObject parma = new JSONObject(); +// parma.put("access_token", access_token); +// parma.put("touser", openid); +// +// JSONObject mp_template_msg = new JSONObject(); +// mp_template_msg.put("appid", "wxc7debf0cf94f9616"); +// mp_template_msg.put("template_id", "7NKKSD92yOKUZoibi1mGKyZXYLVwT-OcoZz6xKBV-N4"); +// mp_template_msg.put("url", ""); +// mp_template_msg.put("miniprogram", "pages/payment/payment"); +// +// JSONObject first = new JSONObject(); +// first.put("value", "您好!您已预约挂号成功!"); +// JSONObject patientName = new JSONObject(); +// patientName.put("value", "梁超飞"); +// JSONObject patientSex = new JSONObject(); +// patientSex.put("value", "男"); +// JSONObject department = new JSONObject(); +// department.put("value", "消化内科"); +// JSONObject doctor = new JSONObject(); +// doctor.put("value", "郭志军"); +// JSONObject seq = new JSONObject(); +// seq.put("value", "123456789"); +// JSONObject remark = new JSONObject(); +// remark.put("value", "请您及时取号!"); +// +// JSONObject data = new JSONObject(); +// data.put("first", first); +// data.put("patientName", patientName); +// data.put("patientSex", patientSex); +// data.put("department", department); +// data.put("department", department); +// data.put("seq", seq); +// data.put("remark", remark); +// +// mp_template_msg.put("data", data); +// +// parma.put("mp_template_msg", mp_template_msg); +// +// System.out.println(parma); +// String result = HttpUtil.post(url, parma); +// System.out.println(result); +// } +// */ +// +// @GetMapping("/sendMessage") +// public void sendMessage(@RequestParam("patId") String patId) { +// String url = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token="; +// +// String access_token = getHeatlhCardService.getApptoken(); +// access_token = "54_huwcduqB7Rji7V1-T7rOUaBAESPTaf3gLBUu8fZKTpIX3R-c0yJ7vxy_YxUIPSw5iUFoMXdtHcybnPbMLpntuE4AZu3wBa2IJsfp8jk_z8Tp5ixZPZQhvbS-6NKhXnk3704vcBrt96iaHLpxQIWcAEAUMA"; +// String openid = "okYGs5FtuetRCuiPUPEynMm8zZIc"; +// +// url += access_token; +// +// JSONObject parma = new JSONObject(); +// //parma.put("access_token", access_token); +// openid = "okYGs5NP26ru9EkDaWGOMdNxkgtE";//小吉 +// openid = "okYGs5M7fYtdWo2ep8Ej6NrrEPyU";//马健 +// parma.put("touser", openid); +// +// parma.put("template_id", "XS7sh3MRHtvvXR0ObBHGVRFF9l07fXIt7Pv4Sngm2_E"); +// parma.put("page", "pages/payment/payment"); +// parma.put("miniprogram_state", "trial"); +// +// //就诊人:{{name1.DATA}}\n缴费金额:{{amount5.DATA}}\n +// // 费用类型:{{thing6.DATA}}\n就诊科室:{{thing3.DATA}}\n提示说明:{{thing7.DATA}}\n +// JSONObject name1 = new JSONObject(); +// name1.put("value", "梁超飞"); +// JSONObject amount5 = new JSONObject(); +// amount5.put("value", "32.54"); +// JSONObject thing3 = new JSONObject(); +// thing3.put("value", "消化内科"); +// JSONObject thing6 = new JSONObject(); +// thing6.put("value", "检查费"); +// JSONObject thing7 = new JSONObject(); +// thing7.put("value", "门诊楼一层左侧"); +// +// JSONObject data = new JSONObject(); +// data.put("name1", name1); +// data.put("amount5", amount5); +// data.put("thing3", thing3); +// data.put("thing6", thing6); +// data.put("thing7", thing7); +// +// parma.put("data", data); +// +// System.out.println(parma); +// String result = HttpUtil.post(url, JSONUtil.toJsonStr(parma)); +// System.out.println(result); +// } +// +// @GetMapping("/getAccessToken") +// public String getAccessToken() { +// return getHeatlhCardService.getApptoken(); +// } +// +// @ApiOperation("7.5 支付宝授权登录") +// @GetMapping({"/getUserId"}) +// public JSONObject alipayCall(@RequestParam("js_code") String code) { +// if (StrUtil.isBlank(code)) { +// return BaseResultJSON.error("授权码不能为空!"); +// } +// LoginUser loginUser = new LoginUser(); +// loginUser.setCode(code); +// loginUser.setPlatform("alipay"); +// boolean result = userService.alipayLogin(loginUser); +// JSONObject obj = new JSONObject(); +// if (result) { +// obj.put("openid", loginUser.getUsername()); +// } else { +// obj.put("openid", ""); +// } +// return obj; +// } +// +//} \ No newline at end of file diff --git a/health_service/src/main/java/cn/card/health/web/alipay/AlipayAppletController.java b/health_service/src/main/java/cn/card/health/web/alipay/AlipayAppletController.java new file mode 100644 index 0000000..8728093 --- /dev/null +++ b/health_service/src/main/java/cn/card/health/web/alipay/AlipayAppletController.java @@ -0,0 +1,44 @@ +package cn.card.health.web.alipay; + +import cn.card.health.base.controller.BaseController; +import cn.card.health.bean.user.YcUser; +import cn.card.health.common.utils.BaseResultJSON; +import cn.card.health.common.utils.DateUtils; +import cn.card.health.common.utils.StringUtils; +import cn.card.health.framework.service.alipay.AlipayAppletService; +import cn.card.health.service.user.IYcUserService; +import com.alibaba.fastjson.JSONObject; +import com.tencent.healthcard.model.HealthCardInfo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +@Api("支付宝小程序请求") +@RestController +@RequestMapping("/alipay") +public class AlipayAppletController extends BaseController { + + @Autowired + private AlipayAppletService alipayAppletService; + @Autowired + private IYcUserService userService; + + @ApiOperation(value = "保存用户基本信息") + @PostMapping("/auth/query") + public JSONObject saveCardInfo(@RequestParam("userid") String userid) { + + YcUser user = userService.loadUserByUsername(userid); + if (user == null) { + BaseResultJSON.error("未查到该用户"); + } + String accessToken = user.getPassword(); + String bizNo = DateUtils.dateTimeNow() + userid.substring(12); + String authUrl = alipayAppletService.medicalAuthInfoAuthQuery(userid, accessToken, bizNo); + if(StringUtils.isNotEmpty(authUrl)) { + return BaseResultJSON.success(authUrl); + }else{ + return BaseResultJSON.error("111"); + } + } +} diff --git a/health_service/src/main/java/cn/card/health/web/hosp/HisCardController.java b/health_service/src/main/java/cn/card/health/web/hosp/HisCardController.java new file mode 100644 index 0000000..183baa5 --- /dev/null +++ b/health_service/src/main/java/cn/card/health/web/hosp/HisCardController.java @@ -0,0 +1,74 @@ +package cn.card.health.web.hosp; + +import cn.card.health.base.controller.BaseController; +import cn.card.health.common.utils.BaseResultJSON; +import cn.card.health.framework.service.HisCardService; +import com.alibaba.fastjson.JSONObject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * 就诊卡 + */ +@RestController +@RequestMapping("/hisCard") +public class HisCardController extends BaseController { + + @Autowired + private HisCardService cardService; + + /** + * 就诊卡充值 + * + * @param params + * @return + */ + @PostMapping("/preCharge") + public BaseResultJSON preCharge(@RequestBody JSONObject params) { + Long orderid = cardService.preCharge(params); + JSONObject result = new JSONObject(); + result.put("orderid", orderid); + return BaseResultJSON.success(result); + } + + /** + * 充值支付 + * + * @param params + * @return + */ + @PostMapping("/payCharge") + public BaseResultJSON payCharge(@RequestBody JSONObject params) { + if(!params.containsKey("memberid")){ + return BaseResultJSON.error(("请选择就诊卡操作")); + } + String memberid = params.getString("memberid"); + if(memberid.contains(",")){ + return BaseResultJSON.error(("请选择一张就诊卡操作")); + } + Long orderid = cardService.preCharge(params); + JSONObject result = cardService.payCharge(orderid); + result.put("orderid", orderid); + return BaseResultJSON.success(result); + } + + /** + * 充值列表 + * + * @param params + * @return + */ + @PostMapping("/chargeList") + public BaseResultJSON chargeList(@RequestBody JSONObject params) { + + String memberid = params.getString("memberid"); + List result = cardService.chargeList(memberid); + return BaseResultJSON.success(result); + } + +} diff --git a/health_service/src/main/java/cn/card/health/web/hosp/HisClinicController.java b/health_service/src/main/java/cn/card/health/web/hosp/HisClinicController.java new file mode 100644 index 0000000..f09f0ff --- /dev/null +++ b/health_service/src/main/java/cn/card/health/web/hosp/HisClinicController.java @@ -0,0 +1,81 @@ +package cn.card.health.web.hosp; + +import cn.card.health.base.controller.BaseController; +//import cn.card.health.framework.service.GetHeatlhCardService; +//import cn.card.health.service.HealthCardInfoService; +import cn.card.health.framework.service.HisClinicHealthService; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.thread.ThreadUtil; +import com.alibaba.fastjson.JSONObject; +import com.tencent.healthcard.model.ReportHISData; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Date; +import java.util.Map; + +@Api("门诊缴费查询") +@RestController +@RequestMapping("/HisClinic") +public class HisClinicController extends BaseController { + + @Autowired + private HisClinicHealthService clinicHealthService; + +// @Autowired +// GetHeatlhCardService getHeatlhCardService; +// @Autowired +// HealthCardInfoService healthCardInfoService; + + @ApiOperation("4.1 查询门诊缴费") + @PostMapping("/getWaitClinicList") + public JSONObject getWaitClinicList(@RequestBody Map params) { + return clinicHealthService.getWaitClinicList(params); + } + + @ApiOperation("4.2 查询门诊缴费详情") + @PostMapping("/getWaitClinicDetailList") + public JSONObject getWaitClinicDetailList(@RequestBody Map params) { + return clinicHealthService.getWaitClinicDetailList(params); + } + + @ApiOperation("4.3 创建门诊缴费订单") + @PostMapping("/prepayClinicOrder") + public JSONObject prepayClinicOrder(@RequestBody Map params) { + + return clinicHealthService.prepayClinicOrder(params); + } + + //小程序门诊缴费 + @ApiOperation("4.5 查询已缴费信息") + @PostMapping("/getPayClinicInfo") + public JSONObject getPayClinicInfo(@RequestBody Map params) { + ThreadUtil.execute(() -> { + String patId = params.get("patId")+""; + ReportHISData data = new ReportHISData(); + data.setHospitalCode(""); + data.setTime(DateUtil.formatDateTime(new Date())); +// HealthCardInfo cardInfo = healthCardInfoService.findHealthCardInfoByPatientId(patId); +// data.setQrCodeText(cardInfo.getQrCodeText()); +// data.setScene("0101052"); +// data.setCardType("11");//健康卡 +// data.setCardChannel("0402");//小程序 + +// getHeatlhCardService.reportHISData(data); + }); + + return clinicHealthService.getPayClinicInfo(params); + } + + @ApiOperation("4.6 查询已缴费详细") + @PostMapping("/getPayClinicDetail") + public JSONObject getPayClinicDetail(@RequestBody Map params) { + return clinicHealthService.getPayClinicDetail(params); + } + +} diff --git a/health_service/src/main/java/cn/card/health/web/hosp/HisInPatientController.java b/health_service/src/main/java/cn/card/health/web/hosp/HisInPatientController.java new file mode 100644 index 0000000..43dfe55 --- /dev/null +++ b/health_service/src/main/java/cn/card/health/web/hosp/HisInPatientController.java @@ -0,0 +1,191 @@ +package cn.card.health.web.hosp; + +import cn.card.health.bean.hospital.YcPatient; +import cn.card.health.bean.order.YcOrder; +import cn.card.health.bean.order.YcOrderSerialpay; +import cn.card.health.bean.user.YcInhospPatient; +import cn.card.health.common.utils.BaseResultJSON; +import cn.card.health.framework.service.HisInPatientService; +import cn.card.health.his.service.HisResult; +//import cn.card.health.service.HealthCardInfoService; +import cn.card.health.service.order.IYcOrderSerialpayService; +import cn.card.health.service.order.IYcOrderService; +import cn.card.health.service.user.IYcInhospPatientService; +import cn.card.health.service.user.IYcPatientService; +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSONObject; +import com.tencent.healthcard.model.HealthCardInfo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 住院模块快 + * + * @author xinggm + * @date 2021年9月3日 + */ +@Api("住院") +@RestController +@RequestMapping("/inHospital") +public class HisInPatientController { + + @Autowired + private HisInPatientService hisInPatientService; + @Autowired + private IYcInhospPatientService inhospPatientService; + +// @Autowired +// private HealthCardInfoService healthCardInfoService; + + @Autowired + private IYcPatientService patientService; + @Autowired + private IYcOrderService ycOrderService; + @Autowired + private IYcOrderSerialpayService ycOrderSerialpayService; + + @ApiOperation("5.1 查询绑定住院病人信息") + @PostMapping("/getPatientInfo") + public JSONObject getPatientInfo(@RequestBody Map params) { + String openid = params.get("openid")+""; + if (StrUtil.isBlank(openid)) { + return BaseResultJSON.error("openid不能为空!"); + } + String patId = params.get("patId")+""; + if (StrUtil.isBlank(patId)) { + return BaseResultJSON.error("patId不能为空!"); + } + +// HealthCardInfo cardInfo = healthCardInfoService.findHealthCardInfoByOpenidAndPatientId(openid, patId); +// if (cardInfo == null) { +// return BaseResultJSON.error("患者信息不存在!"); +// } + +// params.put("patName", cardInfo.getName()); + + return hisInPatientService.getInPatientInfo(params); + } + + @ApiOperation("5.2 住院 一日清单接口查询") + @PostMapping("/getInPatientDayInfo") + public JSONObject getInPatientDayInfo(@RequestBody Map params) { +// Map ptParams = new HashMap(); + return hisInPatientService.getInPatientDayInfo(params); + } + + @ApiOperation("5.3 住院 一日清单分类查询") + @PostMapping("/getInPatientDayItem") + public JSONObject getInPatientDayItem(@RequestBody Map params) { + Map ptParams = new HashMap(); + return hisInPatientService.getInPatientDayItem(params); + } + + @ApiOperation("5.4 住院当前费用情况查询接口002") + @PostMapping("/getInPatientExpenseTotal") + public JSONObject getInPatientExpenseTotal(@RequestBody Map params) { + Map ptParams = new HashMap(); + return hisInPatientService.getInPatientExpenseTotal(params); + } + + @ApiOperation("5.5 住院押金明细查询接口002") + @PostMapping("/getInPatientChargeList") + public JSONObject getInPatientChargeList(@RequestBody Map params) { + String openid = params.get("openid")+""; + if (StrUtil.isBlank(openid)) { + return BaseResultJSON.error("openid不能为空!"); + } + String patId = params.get("patId")+""; + if (StrUtil.isBlank(patId)) { + return BaseResultJSON.error("patId不能为空!"); + } + String visitId = params.get("visitId")+""; + if (StrUtil.isBlank(visitId)) { + return BaseResultJSON.error("visitId不能为空!"); + } + +// HealthCardInfo cardInfo = healthCardInfoService.findHealthCardInfoByOpenidAndPatientId(openid, patId); +// if (cardInfo == null) { +// return BaseResultJSON.error("患者信息不存在!"); +// } + + return hisInPatientService.getInPatientChargeList(params); + } + + @ApiOperation("5.6 创建住院订单并支付") + @PostMapping("/payInPatientCharge") + public JSONObject payInPatientCharge(@RequestBody Map params) { + String openid = (String) params.get("openid"); + if (StrUtil.isBlank(openid)) { + return BaseResultJSON.error("openid不能为空!"); + } + String patId = params.get("patId") + ""; + if (StrUtil.isBlank(patId)) { + return BaseResultJSON.error("patId不能为空!"); + } + String visitId = (String) params.get("visitId"); + if (StrUtil.isBlank(visitId)) { + return BaseResultJSON.error("visitId不能为空!"); + } + + Integer payMoney = (Integer) params.get("payMoney"); + if (payMoney == null || payMoney < 1 || payMoney > 500000) { + return BaseResultJSON.error("支付金额错误!"); + } +// +// HealthCardInfo cardInfo = healthCardInfoService.findHealthCardInfoByOpenidAndPatientId(openid, patId); +// if (cardInfo == null) { +// return BaseResultJSON.error("患者信息不存在!"); +// } + + String result = hisInPatientService.payInPatientCharge(params); + return BaseResultJSON.success(result); + } + + @ApiOperation("5.7 查询住院病人信息列表") + @PostMapping("/getInPatientList") + public JSONObject getInPatientList(@RequestBody Map params) { + YcInhospPatient patient = new YcInhospPatient(); + patient.setOpenid(params.get("openid")+""); + patient.setUserid(0L); + List list = inhospPatientService.selectListYcInhospPatient(patient); + return BaseResultJSON.success(list); + } + + @PostMapping("/pay") + public void inPatinetPay(@RequestBody YcOrder ycOrder) { + ycOrder = ycOrderService.selectYcOrder(ycOrder); + YcOrderSerialpay ycOrderSerialpay = new YcOrderSerialpay(); + ycOrderSerialpay.setOrderid(ycOrder.getOrderid()); + ycOrderSerialpay = ycOrderSerialpayService.selectYcOrderSerialpay(ycOrderSerialpay); + + Map params = new HashMap<>(); + params.put("visitId", ycOrder.getHisOrderId()); + params.put("patId", String.valueOf(ycOrder.getPatientid())); + params.put("orderId", ycOrder.getOrderno()); + params.put("orderPayId", ycOrderSerialpay.getTransactionid()); + params.put("payAmount", ycOrderSerialpay.getPaymoney() + ""); + + YcPatient patient = patientService.selectYcPatientById(ycOrder.getPatientid()); + params.put("patName", patient.getPatientName()); + + HisResult result = hisInPatientService.pay(params); + if (result.isSucess()) { + ycOrder.setOrderStatus(5); + ycOrderService.updateYcOrder(ycOrder); + } else { + ycOrder.setOrderStatus(2); + ycOrder.setReason(result.getReturnMsg()); + ycOrderService.updateYcOrder(ycOrder); + } + } + +} diff --git a/health_service/src/main/java/cn/card/health/web/hosp/HisPortController.java b/health_service/src/main/java/cn/card/health/web/hosp/HisPortController.java new file mode 100644 index 0000000..250f698 --- /dev/null +++ b/health_service/src/main/java/cn/card/health/web/hosp/HisPortController.java @@ -0,0 +1,32 @@ +package cn.card.health.web.hosp; + +import cn.card.health.base.controller.BaseController; +import cn.card.health.common.utils.BaseResultJSON; +import cn.card.health.framework.service.HisReportService; +import com.alibaba.fastjson.JSONObject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 报告 + */ +@RestController +@RequestMapping("/hisPort") +public class HisPortController extends BaseController { + + @Autowired + private HisReportService reportService; + @PostMapping("/getJylist") + public BaseResultJSON getJyPort(@RequestBody JSONObject params){ + return BaseResultJSON.success(reportService.getListReportList(params)); + } + + @PostMapping("/getJyInfo") + public BaseResultJSON getJyInfo(@RequestBody JSONObject params){ + return BaseResultJSON.success(reportService.getListReportInfo(params)); + } + +} diff --git a/health_service/src/main/java/cn/card/health/web/hosp/HisRegistController.java b/health_service/src/main/java/cn/card/health/web/hosp/HisRegistController.java new file mode 100644 index 0000000..4aedfc7 --- /dev/null +++ b/health_service/src/main/java/cn/card/health/web/hosp/HisRegistController.java @@ -0,0 +1,380 @@ +package cn.card.health.web.hosp; + +import cn.card.health.base.controller.BaseController; +import cn.card.health.bean.hospital.YcPatient; +import cn.card.health.bean.order.YcOrder; +import cn.card.health.bean.order.YcOrderRegist; +import cn.card.health.bean.order.YcOrderSerialpay; +import cn.card.health.bean.user.LoginUser; +import cn.card.health.common.page.TableDataInfo; +import cn.card.health.common.utils.BaseResultJSON; +import cn.card.health.common.utils.Convert; +import cn.card.health.common.utils.HttpStatus; +import cn.card.health.common.utils.StringUtils; +import cn.card.health.common.utils.spring.SecurityUtils; +import cn.card.health.config.ErrorCode; +import cn.card.health.framework.service.RegistHealthService; +import cn.card.health.framework.service.alipay.AlipayAppletService; +import cn.card.health.service.order.IYcOrderRegistService; +import cn.card.health.service.order.IYcOrderSerialpayService; +import cn.card.health.service.order.IYcOrderService; +import cn.card.health.service.user.IYcPatientService; +import cn.card.health.task.CancelOrderTimeTask; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.ArrayUtil; +import cn.hutool.core.util.IdcardUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.crypto.SecureUtil; +import cn.hutool.crypto.symmetric.AES; +import com.alibaba.fastjson.JSONObject; +import com.fasterxml.jackson.databind.ser.Serializers; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.web.bind.annotation.*; + +import java.nio.charset.StandardCharsets; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.Timer; +import java.util.concurrent.ScheduledExecutorService; + +/** + * 当日挂号 + * + * @author xinggm + * @date 2021年6月18日 + */ +@Api("挂号") +@RestController +@RequestMapping("/hisRegist") +public class HisRegistController extends BaseController { + private final static String AES_KEY = "$9iT&A5Jld1Deo$5"; //AESj加密解密KEY,绝对不能修改 + + @Autowired + private RegistHealthService registHealthService; + + @Autowired + private IYcOrderService ycOrderService; + + @Autowired + private IYcOrderRegistService ycOrderRegistService; + + @Autowired + private AlipayAppletService alipayAppletService; + + @Autowired + private IYcPatientService patientService; + + @Value("${dept.pediatrics}") + private String[] pediatrics; + + @ApiOperation("2.11 预约挂号锁号") + @PostMapping("/lockPreRegist") + public JSONObject lockPreRegist(@RequestBody JSONObject params) { + String memberid = params.getString("memberid"); + if (StringUtils.isBlank(memberid) || memberid.contains(",")) { + return BaseResultJSON.error("请选择就诊卡"); + } + + + YcOrderRegist orderRegist = new YcOrderRegist(params); + LoginUser loginUser = SecurityUtils.getLoginUser(); + orderRegist.setOpenid(loginUser.getUsername()); + orderRegist.setOrderid(loginUser.getUser().getUserid()); + + Map resultMap = registHealthService.lockPreRegOrder(orderRegist); + if ((Boolean) resultMap.get("success")) { +// createCancelListener(orderRegist.getOrderno()); + + return BaseResultJSON.success(resultMap.get("result")); + } else { + return BaseResultJSON.error((String) resultMap.get("message")); + } + } + + @ApiOperation("2.12 取消预约挂号锁号") + @PostMapping("/unLockPreRegist") + public JSONObject unLockPreRegist(@RequestBody YcOrderRegist orderRegist) { + orderRegist = ycOrderRegistService.selectYcOrderRegist(orderRegist); + orderRegist.setRemark("用户主动取消"); + return registHealthService.cancelLockPreRegOrder(orderRegist); + } + + @ApiOperation("2.13 确认预约挂号--自费") + @PostMapping("/toPreRegist") + public JSONObject toPreRegist(@RequestBody JSONObject params) { + YcOrder ycOrder = ycOrderService.selectYcOrderById(params.getLong("orderid")); + YcOrderRegist ycOrderRegist = new YcOrderRegist(); + ycOrderRegist.setOrderid(ycOrder.getOrderid()); + ycOrderRegist = ycOrderRegistService.selectYcOrderRegist(ycOrderRegist); + ycOrderRegist.setYcOrder(ycOrder); + ycOrder.setHospid(params.getLong("isAlipay") + 8); + + YcOrderSerialpay ycOrderSerialpay = new YcOrderSerialpay(); + ycOrderSerialpay.setOrderid(ycOrder.getOrderid()); + ycOrderRegist.setYcOrder(ycOrder); + JSONObject result = registHealthService.confirmPreRegOrder(ycOrderRegist); + return BaseResultJSON.success(result); + } + + @ApiOperation("2.13 确认预约挂号--医保预结算") + @PostMapping("/toPreRegistInsurance") + public JSONObject toPreRegistInsurance(@RequestBody JSONObject params) { + YcOrder ycOrder = ycOrderService.selectYcOrderById(params.getLong("orderid")); +// ycOrder.setHospid(5L); + //TODO 是否使用医保账户 1用;0不用 + String acctUsedFlag = "1"; + if (params.containsKey("acctUsedFlag")) { + acctUsedFlag = params.getString("acctUsedFlag"); + } + YcOrderRegist ycOrderRegist = new YcOrderRegist(); + ycOrderRegist.setOrderid(ycOrder.getOrderid()); + ycOrderRegist = ycOrderRegistService.selectYcOrderRegist(ycOrderRegist); + ycOrderRegist.setYcOrder(ycOrder); + + JSONObject result = registHealthService.preRegOrderInsurance(ycOrderRegist, acctUsedFlag); + return BaseResultJSON.success(result); + } + + //("2.13 确认预约挂号--医保支付") + @PostMapping("/toPreRegistInsurancePay") + public JSONObject toPreRegistInsurancePay(@RequestBody JSONObject params) { + YcOrder ycOrder = ycOrderService.selectYcOrderById(params.getLong("orderid")); + JSONObject result = registHealthService.preRegOrderInsurancePay(ycOrder); + return BaseResultJSON.success(result); + } + + //("2.13 确认预约挂号--医保支付") + @PostMapping("/toPreRegistInsuranceInfo") + public JSONObject toPreRegistInsuranceInfo(@RequestBody JSONObject params) { + YcOrder ycOrder = ycOrderService.selectYcOrderById(params.getLong("orderid")); + JSONObject result = registHealthService.preRegOrderInsuranceInfo(ycOrder); + return BaseResultJSON.success(result); + } + + @ApiOperation("2.14 取消预约挂号") + @PostMapping("/refundPreReg") + public BaseResultJSON refundPreReg(@RequestBody JSONObject params) { + YcOrderRegist orderRegist = new YcOrderRegist(); + String regid = ""; + if (params.containsKey("regid")) { + regid = params.getString("regid"); + orderRegist.setHisOrderid(regid); + } + if (params.containsKey("orderid")) { + Long orderid = params.getLong("orderid"); + orderRegist.setOrderid(orderid); + } + LoginUser loginUser = SecurityUtils.getLoginUser(); + orderRegist.setOpenid(loginUser.getUsername()); + orderRegist = ycOrderRegistService.selectYcOrderRegist(orderRegist); + logger.info("==============退费订单信息=================="); + logger.info(JSONObject.toJSONString(orderRegist)); + if (orderRegist == null) { + return BaseResultJSON.error("预约挂号订单" + regid + "不存在!"); + } + + if ("7".equals(orderRegist.getOrderstatus())) { + return BaseResultJSON.error("该预约挂号订单" + regid + "已退费"); + } + //向HIS发起取消预约请求 + BaseResultJSON resultObj = registHealthService.refundPreReg(orderRegist); + return resultObj; + } + + + @ApiOperation("2.21 挂号锁号") + @PostMapping("/lockCurRegist") + public JSONObject lockCurRegist(@RequestBody YcOrderRegist orderRegist) { + JSONObject result = verifyRegistrationConditions(orderRegist.getPatientid(), orderRegist.getDeptno()); + if (result != null) { + return result; + } + + Map resultMap = registHealthService.lockCurRegOrder(orderRegist); + if ((Boolean) resultMap.get("success")) { + createCancelListener(orderRegist.getOrderno()); + + return BaseResultJSON.success(resultMap.get("result")); + } else { + return BaseResultJSON.error((String) resultMap.get("message")); + } + } + + @ApiOperation("2.22 取消挂号锁号") + @PostMapping("/unLockCurRegist") + public JSONObject unLockCurRegist(@RequestBody YcOrderRegist orderRegist) { + orderRegist.setOrderstatus("3"); + orderRegist = ycOrderRegistService.selectYcOrderRegist(orderRegist); + if (orderRegist == null) { + return BaseResultJSON.error("订单信息不存在"); + } + orderRegist.setRemark("用户取消挂号锁号"); + + return registHealthService.cancelLockCurRegOrder(orderRegist); + } + + @ApiOperation("2.23 确认当日挂号") + @PostMapping("/toCurRegist") + public JSONObject toCurRegist(@RequestBody YcOrderRegist orderRegist) { + boolean result = registHealthService.confirmCurRegOrder(orderRegist); + if (result) { + return BaseResultJSON.success(); + } else { + return BaseResultJSON.error("锁号失败!请重新挂号!"); + } + } + + @ApiOperation("获取核酸价格") + @GetMapping("/getNucl") + public JSONObject getNucl(@RequestParam(name = "hisCode", required = true) String hisCode) { + if (hisCode == null || "".equals(hisCode) || hisCode.length() != 32) { + return BaseResultJSON.error("参数错误!"); + } + + hisCode = decryptHisCode(hisCode); + + return BaseResultJSON.success(registHealthService.getNucl(hisCode)); + } + + @ApiOperation("创建核酸挂号订单") + @PostMapping("/createNuclOrder") + public JSONObject createNuclOrder(@RequestParam(name = "hisCode", required = true) String hisCode, + @RequestParam(name = "patId", required = true) String patId, + @RequestParam(name = "openid", required = false, defaultValue = "") String openid) { + //hisCode传明码 + if (StrUtil.isBlank(hisCode)) { + return BaseResultJSON.error("参数错误!"); + } + + if (StrUtil.isBlank(patId)) { + return BaseResultJSON.error("病人门诊卡号不能为空!"); + } + + Long patientId = Convert.toLong(patId); + + return registHealthService.createNuclOrder(patientId, hisCode, openid); + } + + private String decryptHisCode(String hisCode) { + //绝对不能修改 + byte[] key = AES_KEY.getBytes(StandardCharsets.UTF_8); + //构建 + AES aes = SecureUtil.aes(key); + //解密为原字符串 + String decryptStr = aes.decryptStr(hisCode); + return decryptStr; + } + + /** + * 验证挂号条件 + * + * @param patientId + * @param deptNo + * @return + */ + private JSONObject verifyRegistrationConditions(Long patientId, String deptNo) { + //锁号之前先检查是否已经有锁号没有支付,如果有,先支付或者取消后再重新挂号锁号 + List list = ycOrderRegistService.selectUnpaidRegisterList(patientId, DateUtil.today()); + if (list.size() > 0) { + return BaseResultJSON.error(ErrorCode.EXIST_UNPAID_REGISTER.getCode(), ErrorCode.EXIST_UNPAID_REGISTER.getMessage()); + } + + //儿科挂号必须是14周岁以内 1001:儿科,1049:新生儿科 + if (ArrayUtil.contains(pediatrics, deptNo)) { + YcPatient patient = patientService.selectYcPatientById(patientId); + String idNumber = patient.getCardno(); + int age = IdcardUtil.getAgeByIdCard(idNumber); + if (age > 14) { + return BaseResultJSON.error("成年人不能预约儿科类门诊,请更换就诊人!"); + } + } + + return null; + } + + @ApiOperation("查询单条挂号信息") + @PostMapping("/getRegOrderInfo") + public JSONObject getRegOrderInfo(@RequestBody(required = false) Map params) { + return BaseResultJSON.success(registHealthService.getRegOrderInfo(params)); + } + + @ApiOperation("查询挂号信息列表") + @PostMapping("/getRegOrderList") + public JSONObject getRegOrderList(@RequestBody(required = false) Map params) { + return BaseResultJSON.success(registHealthService.getRegOrderList(params)); + } + + @ApiOperation("查询订单信息") + @PostMapping("/getOrderInfo") + public JSONObject getOrderInfo(@RequestBody(required = false) JSONObject params) throws InterruptedException { + Long orderid = params.getLong("orderid"); + + logger.info("===============orderid {}=================", orderid); + YcOrder order = ycOrderService.selectYcOrderById(orderid); + if (order == null) { + return BaseResultJSON.error(HttpStatus.NO_CONTENT, "未查到订单信息"); + } + while (order.getHisStatus() == 1) { + Thread.sleep(2000); + order = ycOrderService.selectYcOrderById(orderid); + } + JSONObject ret = new JSONObject(); + ret.put("regid", order.getHisOrderId()); + ret.put("orderStatus", order.getOrderStatus()); + ret.put("payStatus", order.getOrderStatus()); + ret.put("hisStatus", order.getHisStatus()); + return BaseResultJSON.success(ret); + } + + @ApiOperation("查询订单列表") + @PostMapping("/getOrderList") + public BaseResultJSON getOrderList(@RequestBody(required = false) JSONObject params) { + Long patientid = params.getLong("patientid"); + YcOrder order = new YcOrder(); + order.setHisStatus(2); + order.setPayStatus(3); + if (params.containsKey("begdate")) { + String begdate = params.getString("begdate"); + order.setBegdate(begdate); + } + if (params.containsKey("enddate")) { + String enddate = params.getString("enddate"); + order.setEnddate(enddate); + } + order.setPatientid(patientid); +// startPage(); + List orderList = ycOrderService.selectListYcOrderByDate(order); + return BaseResultJSON.success(orderList); + } + + @PostMapping("/getAuthNo") + public BaseResultJSON getAuthNo() { + LoginUser loginUser = SecurityUtils.getLoginUser(); + + String auth_url = alipayAppletService.medicalAuthInfoAuthQuery(loginUser.getUsername(), loginUser.getUser().getPassword(), System.currentTimeMillis() + ""); + + BaseResultJSON result = BaseResultJSON.success(auth_url); + logger.info(result.toJSONString()); + return result; + } + + /** + * 创建超时未支付监听 + * + * @param orderNo + */ + private void createCancelListener(String orderNo) { + //锁号成功,创建倒计时未支付解锁 + Timer timer = new Timer(); +// ScheduledExecutorService timerExecutor = new ScheduledExecutorService(); + CancelOrderTimeTask timeTask = new CancelOrderTimeTask(registHealthService, ycOrderRegistService, orderNo); + //15分钟后执行任务 + timer.schedule(timeTask, 15 * 60 * 1000); + } +} diff --git a/health_service/src/main/java/cn/card/health/web/hosp/HisRegistQueryController.java b/health_service/src/main/java/cn/card/health/web/hosp/HisRegistQueryController.java new file mode 100644 index 0000000..e6bab63 --- /dev/null +++ b/health_service/src/main/java/cn/card/health/web/hosp/HisRegistQueryController.java @@ -0,0 +1,137 @@ +package cn.card.health.web.hosp; + +import cn.card.health.base.controller.BaseController; +import cn.card.health.bean.order.YcOrderRegist; +import cn.card.health.common.utils.BaseResultJSON; +import cn.card.health.framework.service.RegistHealthService; +import com.alibaba.fastjson.JSONObject; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + +/** + * 查询 + * + * @author xinggm + * @date 2021年6月18日 + */ +@Api("查询医院信息") +@RestController +@RequestMapping("/hisQuery") +public class HisRegistQueryController extends BaseController { + + @Autowired + private RegistHealthService registHealthService; + + @ApiOperation("2.1 查询挂号科室") + @PostMapping("/getDeptlist") + public JSONObject getDeptlist(@RequestBody(required = false) Map params) { + return BaseResultJSON.success(registHealthService.getDeptList(params)); + } + + @ApiOperation("2.2 查询科室医生") + @ApiImplicitParam(name = "deptno", value = "科室编码", required = true) + @PostMapping("/getDoctorList") + public JSONObject getDoctorList(@RequestBody(required = false) Map params) { + return BaseResultJSON.success(registHealthService.getDoctorList(params)); + } + + @ApiOperation("2.3 根据科室医生查询医生号源班别信息") + @ApiImplicitParams({@ApiImplicitParam(name = "doctorId", value = "医生编码", required = true), + @ApiImplicitParam(name = "taskdate", value = "日期", required = true)}) + @PostMapping("/getDoctorRegScheduleListByDept") + public JSONObject getDoctorRegScheduleListByDept(@RequestBody(required = false) Map params) { + return BaseResultJSON.success(registHealthService.getDoctorRegScheduleByDept(params)); + } + + @ApiOperation("2.4 根据医生姓名查询医生号源班别信息") + @ApiImplicitParam(name = "doctorname", value = "医生姓名", required = true) + @PostMapping("/getDoctorRegScheduleListByDr") + public JSONObject getDoctorRegScheduleListByDr(@RequestBody(required = false) Map params) { + return BaseResultJSON.success(registHealthService.getDoctorRegScheduleByDr(params)); + } + + @ApiOperation("2.5 查询医生挂号分时号源信息") + @ApiImplicitParams({@ApiImplicitParam(name = "deptno", value = "科室编码", required = true), + @ApiImplicitParam(name = "doctorno", value = "医生编码", required = true), + @ApiImplicitParam(name = "regDate", value = "挂号日期yyyy-MM-dd", required = true), + @ApiImplicitParam(name = "scheduleType", value = "挂号班别 1上午;2下午", required = true)}) + @PostMapping("/getDoctorRegTimeList") + public JSONObject getDoctorRegTimeList(@RequestBody(required = false) Map params) { + return BaseResultJSON.success(registHealthService.getDoctorRegTimeList(params)); + } + + @ApiOperation("预约锁号") + @PostMapping("/lockPreRegOrder") + public JSONObject lockPreRegOrder(@RequestBody YcOrderRegist orderRegist) { + //return registHealthService.lockPreRegOrder(orderRegist); + return null; + } + + @ApiOperation("取消预约锁号") + @PostMapping("/cancelPreRegOrder") + public JSONObject cancelPreRegOrder(@RequestBody YcOrderRegist orderRegist) { + return registHealthService.cancelLockPreRegOrder(orderRegist); + } + + @ApiOperation("生成预约挂号订单") + @PostMapping("/payPreRegOrder") + public JSONObject payPreRegOrder(@RequestBody YcOrderRegist orderRegist) { +// boolean result = registHealthService.confirmPreRegOrder(orderRegist); + boolean result = false; + if (result) { + return BaseResultJSON.success(); + } else { + return BaseResultJSON.error(); + } + } + + @ApiOperation("预约挂号退费") + @PostMapping("/refundPreReg") + public JSONObject refundPreReg(@RequestBody YcOrderRegist orderRegist) { + return BaseResultJSON.success(registHealthService.refundPreReg(orderRegist)); + } + + @ApiOperation("挂号锁号") + @PostMapping("/lockRegSeqToday") + public JSONObject lockRegSeqToday(@RequestBody YcOrderRegist orderRegist) { + Map result = registHealthService.lockCurRegOrder(orderRegist); + if ((Boolean) result.get("success")) { + return BaseResultJSON.success("挂号成功!"); + } else { + return BaseResultJSON.error((String) result.get("message")); + } + } + + @ApiOperation("取消挂号锁号") + @PostMapping("/unlockRegSeqToday") + public JSONObject unlockRegSeqToday(@RequestBody YcOrderRegist orderRegist) { + return BaseResultJSON.success(registHealthService.cancelLockCurRegOrder(orderRegist)); + } + + @ApiOperation("生成挂号订单") + @PostMapping("/addRegOrder") + public JSONObject addRegOrder(@RequestBody YcOrderRegist orderRegist) { + return BaseResultJSON.success(registHealthService.confirmCurRegOrder(orderRegist)); + } + + @ApiOperation("3.2 查询科室信息") + @GetMapping("/getDeptInfo") + public JSONObject getDeptInfo(@RequestParam(name = "deptId", defaultValue = "0") String deptId) { + return BaseResultJSON.success(registHealthService.getDeptInfo(deptId)); + } + + @ApiOperation("3.3 查询医生信息") + @GetMapping("/getDoctorInfo") + public JSONObject getDoctorInfo(@RequestParam(name = "deptId", defaultValue = "0") String deptId, + @RequestParam(name = "doctorId", defaultValue = "0") String doctorId) { + return BaseResultJSON.success(registHealthService.getDoctorInfo(deptId, doctorId)); + } + + +} diff --git a/health_service/src/main/java/cn/card/health/web/hosp/YcHospitalController.java b/health_service/src/main/java/cn/card/health/web/hosp/YcHospitalController.java new file mode 100644 index 0000000..0f14985 --- /dev/null +++ b/health_service/src/main/java/cn/card/health/web/hosp/YcHospitalController.java @@ -0,0 +1,59 @@ +package cn.card.health.web.hosp; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.alibaba.fastjson.JSONObject; + +import cn.card.health.bean.hospital.YcHospital; +import cn.card.health.common.utils.BaseResultJSON; +import cn.card.health.service.hospital.IYcHospitalService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; + +/** + * 医院信息表 + * + * @author xinggm + * @date 2021-08-16 10:07:33 + */ +@Api("order") +@RestController +@RequestMapping("order/ychospital") +public class YcHospitalController { + + @Autowired + private IYcHospitalService ycHospitalService; + + @ApiOperation("新增") + @PostMapping("insert") + public JSONObject insert(YcHospital ycHospital){ + return BaseResultJSON.success(ycHospitalService.insertYcHospital(ycHospital)); + } + + @ApiOperation("删除") + @PostMapping(value = "/delete") + public JSONObject deleteYcHospital(Long id) { + return BaseResultJSON.success(ycHospitalService.deleteYcHospital(id)); + } + + @ApiOperation( "根据主键更新") + @PostMapping("/update") + public JSONObject update(YcHospital ycHospital) { + return BaseResultJSON.success(ycHospitalService.updateYcHospital(ycHospital)); + } + + @ApiOperation("根据主键查询") + @PostMapping("/selectYcHospitalById") + public JSONObject selectYcHospital(Long id) { + return BaseResultJSON.success(ycHospitalService.selectYcHospitalById(id)); + } + + @ApiOperation("条件查询") + @PostMapping("/selectList") + public JSONObject selectList(YcHospital ycHospital) { + return BaseResultJSON.success(ycHospitalService.selectListYcHospital(ycHospital)); + } +} \ No newline at end of file diff --git a/health_service/src/main/java/cn/card/health/web/pay/ThirdPayController.java b/health_service/src/main/java/cn/card/health/web/pay/ThirdPayController.java new file mode 100644 index 0000000..65940a3 --- /dev/null +++ b/health_service/src/main/java/cn/card/health/web/pay/ThirdPayController.java @@ -0,0 +1,268 @@ +package cn.card.health.web.pay; + +import cn.card.health.base.controller.BaseController; +import cn.card.health.bean.order.YcOrder; +import cn.card.health.bean.order.YcOrderRefundpay; +import cn.card.health.bean.order.YcOrderSerialpay; +import cn.card.health.common.utils.BaseResultJSON; +import cn.card.health.framework.service.HisInPatientService; +import cn.card.health.framework.service.alipay.AlipayAppletService; +import cn.card.health.service.order.IYcOrderRefundpayService; +import cn.card.health.service.order.IYcOrderSerialpayService; +import cn.card.health.service.order.IYcOrderService; +import cn.card.health.service.user.IYcPatientService; +import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSONObject; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +/** + * 测试第三方支付 + * + * @author xinggm + * @date 2021年7月19日 + */ +@Api("第三方支付") +@RestController +@RequestMapping("/pay") +public class ThirdPayController extends BaseController { + + private Logger logger = LoggerFactory.getLogger(ThirdPayController.class); + @Autowired + private AlipayAppletService alipayAppletService; + @Autowired + private IYcOrderSerialpayService orderSerialpayService; + @Autowired + private IYcOrderRefundpayService orderRefundpayService; + @Autowired + private HisInPatientService hisInPatientService; + @Autowired + private IYcOrderService ycOrderService; + @Autowired + private IYcOrderSerialpayService ycOrderSerialpayService; + @Autowired + private IYcPatientService ycPatientService; + + @ApiOperation("3.1 微信小程序支付") + @PostMapping("/miniPay") + public JSONObject wechat_jsapi(@RequestBody Map params) { + String openid = params.get("openid"); + if (StrUtil.isBlank(openid)) { + return BaseResultJSON.error("openId不能为空"); + } + + String orderno = params.get("orderno"); + if (StrUtil.isBlank(orderno)) { + return BaseResultJSON.error("订单号不能为空"); + } + + YcOrder ycOrder = new YcOrder(); + ycOrder.setOpenid(openid); + ycOrder.setOrderno(orderno); + ycOrder.setOrderStatus(1); + logger.info("支付订单查询:{},{}", ycOrder.getOpenid(), ycOrder.getOrderno()); + ycOrder = ycOrderService.selectYcOrder(ycOrder); + if (ycOrder == null) { + return BaseResultJSON.error("订单信息不存在"); + } + + String description = ""; + switch (ycOrder.getOrdertype()) { + case "PREREGIST": + description = "预约挂号"; + break; + case "CURREGIST": + description = "当日挂号"; + break; + case "CLINIC": + description = "门诊收费"; + break; + case "NUCL": + description = "新冠病毒核酸检测"; + break; + case "INHOSP": + description = "住院费用预存"; + break; + case "RECORD": + description = "病例复印"; + break; + default: + description = "其它收费"; + break; + } + +// //如果是核酸缴费,查看用户一个小时内是否有过支付 +// if ("NUCL".equals(ycOrder.getOrdertype())) { +// YcOrderSerialpay orderSerialpay = new YcOrderSerialpay(); +// orderSerialpay.setPatientid(ycOrder.getPatientid()); +// orderSerialpay.setPaystatus(3);//已支付 +// orderSerialpay.setBusinesstype(ycOrder.getOrdertype()); +// orderSerialpay = ycOrderSerialpayService.selectYcOrderSerialpay(orderSerialpay); +// if (orderSerialpay != null) { +// Date paytime = orderSerialpay.getPaytime(); +// if (System.currentTimeMillis() - paytime.getTime() < 3600 * 1000) { +// YcPatient patient = ycPatientService.selectYcPatientById(ycOrder.getPatientid()); +// return BaseResultJSON.error("当前就诊人" + patient.getPatientName() + "在1小时内已经支付过相同的订单,为防止重复支付,请核对!"); +// } +// } +// } + + Integer totalmoney = ycOrder.getTotalmoney(); + try { + String result = ""; + //写表yc_order_serialpay + YcOrderSerialpay serialpay = new YcOrderSerialpay(); + serialpay.setOrderid(ycOrder.getOrderid()); + serialpay.setPatientid(ycOrder.getPatientid()); + serialpay.setPaymoney(totalmoney); + serialpay.setTotalmoney(totalmoney); + serialpay.setMoney(totalmoney); + serialpay.setPaytime(new Date()); + serialpay.setBusinesstype(ycOrder.getOrdertype()); + serialpay.setOuttradeno(orderno); + JSONObject res; + if (params.containsKey("client") && "ALIPAY".equalsIgnoreCase(params.get("client"))) { + res = alipayAppletService.appletTradePay(description, orderno, totalmoney, openid); + if (res.getBoolean("success")) { + return BaseResultJSON.error("生成支付信息失败!"); + } + serialpay.setPrepayid(res.getString("trade_no")); + serialpay.setPaytype("ALIPAY"); + +// JSONObject object = new JSONObject(); +// object.put("payType", "ALIPAY"); +// object.put("tradeNo", tradeNo); +// result = object.toString(); + logger.info("支付宝支付:{}", res); + }else{ + res = new JSONObject(); + res.put("success", false); + } + + serialpay.setPaystatus(1); + serialpay.setCreatetime(new Date()); + ycOrderSerialpayService.insertYcOrderSerialpay(serialpay); + + return BaseResultJSON.success(res); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + return BaseResultJSON.error(); + } + } + + @ApiOperation("3.3 支付宝二维码支付") + @ApiImplicitParams({ + @ApiImplicitParam(name = "payAmount", value = "支付金额(分)", dataType = "Integer", required = true), + @ApiImplicitParam(name = "goods", value = "商品名称", dataType = "String", required = true), + @ApiImplicitParam(name = "outtradeno", value = "商户订单号", dataType = "String", required = true)}) + @PostMapping("/alipay_native") + public JSONObject alipay_native(@RequestBody Map params) { +// String openid = request.getParameter("openid"); + String payAmount = params.get("payAmount"); + String outtradeno = params.get("outtradeno"); + String goods = params.get("goods"); + String prepayid = ""; +// String prepayid = alipayPayService.test_trade_precreate(outtradeno, payAmount, goods); + // String body = "prepay_id="+prepayid; + // String content = wechatPayService.getToken(body, System.currentTimeMillis()); + return BaseResultJSON.success(prepayid); + } + + @ApiOperation("3.4 二维码支付") + @ApiImplicitParams({ + @ApiImplicitParam(name = "payAmount", value = "支付金额(分)", dataType = "Integer", required = true), + @ApiImplicitParam(name = "goods", value = "商品名称", dataType = "String", required = true), + @ApiImplicitParam(name = "paytype", value = "支付类型", dataType = "String", required = true), + @ApiImplicitParam(name = "outtradeno", value = "商户订单号", dataType = "String", required = true)}) + @PostMapping("/third_native") + public JSONObject third_native(@RequestBody Map params) { +// String openid = request.getParameter("openid"); + String payAmount = params.get("payAmount"); + String outtradeno = params.get("outtradeno"); + String goods = params.get("goods"); + String prepayid = ""; + if ("alipay".equals(params.get("paytype"))) { + //prepayid = alipayPayService.test_trade_precreate(outtradeno, payAmount, goods); + } + // String body = "prepay_id="+prepayid; + // String content = wechatPayService.getToken(body, System.currentTimeMillis()); + return BaseResultJSON.success(prepayid); + } + + @GetMapping("/third_refund") + public JSONObject third_refund(@RequestParam(name = "orderno") String orderno, + @RequestParam(name = "patId") String patId) { + if (StrUtil.isBlank(orderno) || (!orderno.startsWith("wmp01") && !orderno.startsWith("amp01")) || StrUtil.isBlank(patId)) { + return BaseResultJSON.error("HIS退费参数错误!"); + } + + Map params = new HashMap<>(); + params.put("orderno", orderno); + params.put("patId", patId); + params.put("reason", "窗口退费"); + return third_refund(params); + } + + @ApiOperation("3.6 退款接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "patId", value = "患者主索引号", dataType = "Integer", required = true), + @ApiImplicitParam(name = "reason", value = "退款原因", dataType = "String", required = false), + @ApiImplicitParam(name = "orderno", value = "退款订单号", dataType = "String", required = true)}) + @PostMapping("/third_refund") + public JSONObject third_refund(@RequestBody Map params) { + String outtradeno = params.get("orderno"); + String outRequestNo = IdUtil.getSnowflake().nextIdStr(); + String reason = params.get("reason"); + YcOrderSerialpay serialpay = new YcOrderSerialpay(); + serialpay.setDelFlag(1); + serialpay.setPatientid(Long.parseLong(params.get("patId"))); + if (outtradeno.startsWith("wmp01") || outtradeno.startsWith("amp01")) { //HIS发起的退费,orderno添加了wmp01 + outtradeno = outtradeno.substring(5); + } else { + serialpay.setBusinesstype("PREREGIST");//只有预约挂号可以退 + } + serialpay.setOuttradeno(outtradeno); + serialpay = orderSerialpayService.selectYcOrderSerialpay(serialpay); + if (serialpay == null) { + return BaseResultJSON.error("未查到订单"); + } + if (serialpay.getPaystatus() != 3) { + return BaseResultJSON.error("订单未支付"); + } + + YcOrderRefundpay refundpay = new YcOrderRefundpay(); + + refundpay.setPaytype(serialpay.getPaytype()); + refundpay.setOrderid(serialpay.getOrderid()); + refundpay.setRefundstatus(1); + refundpay.setSerialpayid(serialpay.getSerialpayid()); + refundpay.setOutrefundno(outRequestNo); + refundpay.setMoney(serialpay.getPaymoney()); + refundpay.setRefundtime(new Date()); + refundpay.setCreatetime(new Date()); + int refundMoney = serialpay.getPaymoney(); + if ("ALIPAY".equals(serialpay.getPaytype())) { + boolean flag = alipayAppletService.appletTradeRefund(outtradeno, serialpay.getTotalmoney(), outRequestNo, reason); + if (flag) { + refundpay.setRefundstatus(3); + } else { + refundpay.setRefundstatus(2); + } + orderRefundpayService.insertYcOrderRefundpay(refundpay); + } + return BaseResultJSON.success(); + } + +} diff --git a/health_service/src/main/java/cn/card/health/web/user/SysLoginController.java b/health_service/src/main/java/cn/card/health/web/user/SysLoginController.java new file mode 100644 index 0000000..e794787 --- /dev/null +++ b/health_service/src/main/java/cn/card/health/web/user/SysLoginController.java @@ -0,0 +1,128 @@ +package cn.card.health.web.user; + +import cn.card.health.base.controller.BaseController; +import cn.card.health.bean.user.LoginUser; +import cn.card.health.bean.user.YcUser; +import cn.card.health.common.redis.RedisCache; +import cn.card.health.common.utils.BaseResultJSON; +import cn.card.health.common.utils.spring.SecurityUtils; +import cn.card.health.framework.service.alipay.AlipayAppletService; +import cn.card.health.framework.service.alipay.TokenService; +import cn.card.health.framework.service.alipay.domain.AlipayOAuthTokenDto; +import cn.card.health.service.user.IYcUserService; +import com.alibaba.fastjson.JSONObject; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Map; + +@Api("微信授权登录") +@RestController +@RequestMapping({"/oauth"}) +public class SysLoginController extends BaseController { + + @Autowired + private IYcUserService userService; + @Autowired + private RedisCache RedisCache; + @Autowired + private AlipayAppletService alipayAppletService; + @Autowired + private TokenService tokenService; + + @ApiOperation("7.1 微信授权登录") + @GetMapping({"/wechatLogin"}) + public void weixinAutoLogin(HttpServletRequest request, HttpServletResponse response) { +// String state = "STATE"; +// String code = "code"; +// String hisid = request.getParameter("hisid"); +// System.out.println("=====hisid: " + hisid); +// String url; +// try { +// url = WechatConfig.url_wechat_oauth2 + "?appid=" + WechatConfig.service_appid + "&redirect_uri=" +// + URLEncoder.encode(WechatConfig.url_oauth, "UTF-8") + "&response_type=" + code +// + "&scope=snsapi_userinfo" + "&state=" + state + "#wechat_redirect"; +// response.sendRedirect(url); +// } catch (Exception e) { +// e.printStackTrace(); +// } + } + + @ApiOperation("7.3 通过微信openid登录---只测试") + @PostMapping("/openidLogin") + public JSONObject openidLogin(@RequestBody Map params) { + String openid = params.get("openid"); + LoginUser loginUser = new LoginUser(); + loginUser.setUsername(openid); + loginUser.setHisid(params.get("hisid")); +// loginUser.set + String token = userService.login(loginUser); + JSONObject json = new JSONObject(); + json.put("token", token); + json.put("loginUser", loginUser); + JSONObject psnInfo = alipayAppletService.getInfoShare(loginUser.getUser().getPassword()); + json.putAll(psnInfo.getJSONObject("data")); + return BaseResultJSON.success(json); + } + + //暂时没有使用,将代码移动到了HealthCardController中 + @ApiOperation("7.5 支付宝授权登录") + @PostMapping({"/alipayLogin"}) + public JSONObject alipayCall(@RequestBody JSONObject params) { + + logger.info(params.toJSONString()); + if (!params.containsKey("authCode")) { + return BaseResultJSON.error("授权码不能为空!"); + } + String authCode = params.getString("authCode"); + LoginUser loginUser = new LoginUser(); + loginUser.setCode(authCode); + loginUser.setPlatform("alipay"); + boolean result = userService.alipayLogin(loginUser); + if (result) { + JSONObject psnInfo = alipayAppletService.getInfoShare(loginUser.getUser().getPassword()); + BaseResultJSON resultRet = BaseResultJSON.success(loginUser); + JSONObject data = resultRet.getJSONObject("data"); + data.putAll(psnInfo.getJSONObject("data")); + resultRet.put("data", data); + logger.info(resultRet.toJSONString()); + return resultRet; + } else { + return BaseResultJSON.error(loginUser.getToken()); + } + } + @PostMapping("/freshToken") + public BaseResultJSON freshToken(@RequestBody JSONObject params){ + logger.info(params.toJSONString()); + if (!params.containsKey("authCode")) { + return BaseResultJSON.error("授权码不能为空!"); + } + String authCode = params.getString("authCode"); + LoginUser loginUser = SecurityUtils.getLoginUser(); + + logger.info("=====支付宝小程序授权登录====="); + AlipayOAuthTokenDto respDto = alipayAppletService.getOauthToken(authCode, ""); + + //授权获取失败,返回异常 + if (!respDto.isSuccess()) { + logger.info(respDto.getCode() + "|" + respDto.getMsg()); + loginUser.setToken(respDto.getMsg()); + return BaseResultJSON.error(respDto.getCode() + "|" + respDto.getMsg()); + } + String access_token = respDto.getAccessToken(); + String active_token = respDto.getRefreshToken(); + logger.info("=====token: " + access_token + "======"); + YcUser user = userService.selectYcUserById(loginUser.getUser().getUserid()); + user.setActiveKey(active_token); + user.setPassword(access_token); + userService.updateYcUser(user); + loginUser.setUser(user); + tokenService.refreshToken(loginUser); + return BaseResultJSON.success(); + + } +} diff --git a/health_service/src/main/java/cn/card/health/web/wechat/AlipayController.java b/health_service/src/main/java/cn/card/health/web/wechat/AlipayController.java new file mode 100644 index 0000000..d56714e --- /dev/null +++ b/health_service/src/main/java/cn/card/health/web/wechat/AlipayController.java @@ -0,0 +1,154 @@ +package cn.card.health.web.wechat; + +import cn.card.health.base.controller.BaseController; +import cn.card.health.bean.order.YcPayCallback; +import cn.card.health.alipay.config.AlipayAppletConfig; +import cn.card.health.framework.service.alipay.AlipayAppletService; +import cn.card.health.service.order.IYcPayCallbackService; +import cn.hutool.core.thread.ThreadUtil; +import com.alibaba.druid.support.json.JSONUtils; +import com.alibaba.fastjson.JSONObject; +import com.alipay.api.AlipayApiException; +import com.alipay.api.internal.util.AlipaySignature; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletRequest; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +@RestController +@RequestMapping("/alipay") +public class AlipayController extends BaseController { + private Logger logger = LoggerFactory.getLogger(AlipayController.class); + + @Autowired + private IYcPayCallbackService payCallbackService; + @Autowired + private AlipayAppletService alipayAppletService; + + @RequestMapping("/notify") + public String callBack(HttpServletRequest request) { + logger.info("===========支付异步消息通知 callBack====================="); + + //获取支付宝POST过来反馈信息 + Map params = new HashMap<>(); + Map requestParams = request.getParameterMap(); + for (Iterator iter = requestParams.keySet().iterator(); iter.hasNext(); ) { + String name = (String) iter.next(); + String[] values = (String[]) requestParams.get(name); + String valueStr = ""; + for (int i = 0; i < values.length; i++) { + valueStr = (i == values.length - 1) ? valueStr + values[i] + : valueStr + values[i] + ","; + } + params.put(name, valueStr); + } + + logger.info("ALIPAY支付结果:{}", JSONUtils.toJSONString(params)); + + try { + //params 是上面支付宝的返回参数 + boolean signVerified = AlipaySignature.rsaCheckV1(params, AlipayAppletConfig.alipay_public_key, params.get("charset"), "RSA2"); + /* 实际验证过程建议商户务必添加以下校验: + 1、需要验证该通知数据中的out_trade_no是否为商户系统中创建的订单号, + 2、判断total_amount是否确实为该订单的实际金额(即商户订单创建时的金额), + 3、校验通知中的seller_id(或者seller_email) 是否为out_trade_no这笔单据的对应的操作方(有的时候,一个商户可能有多个seller_id/seller_email) + 4、验证app_id是否为该商户本身。 + */ + if (signVerified) {//验证成功 + String app_id = params.get("app_id"); + if (!app_id.equals(AlipayAppletConfig.appid)) { + logger.info("商户ID错误。"); + return "success"; + } + //交易状态 + String trade_status = params.get("trade_status"); + if (trade_status.equals("TRADE_FINISHED")) { + //判断该笔订单是否在商户网站中已经做过处理 + //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序 + //如果有做过处理,不执行商户的业务程序 + //注意: + //退款日期超过可退款期限后(如三个月可退款),支付宝系统发送该交易状态通知 + } else if (trade_status.equals("TRADE_SUCCESS")) { + ThreadUtil.execute(() -> { + logger.info("开始处理支付宝支付订单:{}", params.get("out_trade_no")); + payComplete(params); + }); + } + } else {//验证失败 + logger.info("ALIPAY支付验签失败!"); + } + } catch (AlipayApiException e) { + logger.info("==========验签发生异常============="); + e.printStackTrace(); + } + return "success"; + } + + //医保支付异步消息通知 alipay.commerce.medical.payment.notify + @RequestMapping("/insureCallback") + public String insureCallback(HttpServletRequest request) { + logger.info("===========医保支付异步消息通知 insureCallback====================="); + Map params = getParams(); + String reqData = JSONObject.toJSONString(params); + logger.info("===reqData {}", reqData); + YcPayCallback callback = new YcPayCallback(); + callback.setPaytype("insure"); + callback.setPayname("alipay"); + callback.setContent(reqData); + payCallbackService.insertYcPayCallbackInsurance(callback, params); + + return "success"; + } + + //支付宝支付异步消息通知 alipay.commerce.medical.payment.notify + @RequestMapping("/payCallback") + public String payCallback(HttpServletRequest request) { + logger.info("===========支付宝支付异步消息通知 payCallback====================="); + Map params = getParams(); + String reqData = JSONObject.toJSONString(params); + logger.info("===reqData {}", reqData); + YcPayCallback callback = new YcPayCallback(); + callback.setPaytype("alipay"); + callback.setPayname("pay"); + callback.setContent(reqData); + payCallbackService.insertYcPayCallback(callback, params); + + return "success"; + } + + private void payComplete(Map params) { + //商户订单号 + String out_trade_no = params.get("out_trade_no"); + //支付宝交易号 + String trade_no = params.get("trade_no"); + String userId = params.get("buyer_id"); + String orderNo = out_trade_no.substring(5); + YcPayCallback callBack = new YcPayCallback(); + try { + callBack.setContent(new ObjectMapper().writeValueAsString(params)); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } + callBack.setPayname("JSAPI"); + callBack.setPaytype("WECHAT"); + payCallbackService.insertYcPayCallback(callBack); +// if (!flag) { +// logger.info("回调数据保存失败:{}", JSONUtils.toJSONString(params)); +// } + + boolean flag = payCallbackService.updateSerialPay(orderNo, trade_no, userId, "ALIPAY"); + if (!flag) { + logger.info("支付结果状态更新失败,订单号:{}", orderNo); + } + payCallbackService.insertAlipayCallback(orderNo); + logger.info("ALIPAY支付处理完成,订单号:{}", orderNo); + } +} diff --git a/health_service/src/main/java/cn/card/health/web/wechat/BankController.java b/health_service/src/main/java/cn/card/health/web/wechat/BankController.java new file mode 100644 index 0000000..b47fa30 --- /dev/null +++ b/health_service/src/main/java/cn/card/health/web/wechat/BankController.java @@ -0,0 +1,155 @@ +package cn.card.health.web.wechat; + +import cn.card.health.base.controller.BaseController; +import cn.card.health.bean.order.YcPayCallback; +import cn.card.health.framework.service.bank.BankConfig; +import cn.card.health.service.order.IYcPayCallbackService; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.icbc.api.utils.IcbcEncrypt; +import com.icbc.api.utils.IcbcSignature; +import com.icbc.api.utils.WebUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.PrintWriter; +import java.util.Map; + +@RestController +@RequestMapping("/bank") +public class BankController extends BaseController { + @Autowired + private IYcPayCallbackService payCallbackService; + @Autowired + private BankConfig bankConfig; + + @RequestMapping("/payCallback") + public String payCallback(HttpServletRequest request, HttpServletResponse response) { + Map params = getRequestParams(); + String reqData = JSONObject.toJSONString(params); + + logger.info("===========bank payCallback====================="); + logger.info(reqData); + YcPayCallback callback = new YcPayCallback(); + callback.setPaytype("bank"); + callback.setPayname("alipay"); + callback.setContent(reqData); + payCallbackService.insertYcPayCallbackBank(callback, params); + PrintWriter out = null; + try { + //网关公钥 + String APIGW_PUBLIC_KEY = bankConfig.apigw_public_key; + //商户证书,cert_sn=517722432651109523795125,有效期=20150302-20350302 +// String cert = "MIIDDTCCAfWgAwIBAgIKbaHKEE0tAAAstTANBgkqhkiG9w0BAQUFADA3MRowGAYDVQQDExFjb3JiYW5rMTAzIHNkYyBDTjEZMBcGA1UEChMQY29yYmFuazQzLmNvbS5jbjAeFw0xNTAzMDIwMzA4MDFaFw0zNTAzMDIwMzA4MDFaMEMxFzAVBgNVBAMTDmxpdXdoMzEueS4wMjAwMQ0wCwYDVQQLEwQwMjAwMRkwFwYDVQQKExBjb3JiYW5rNDMuY29tLmNuMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDzvGvNMJKzqZHrEKKcboCLemlLGnVQ1Za28qL6IQXgT0W4zKG7tes7YMDd3JL6EngE/RXhTviymkzyZwp7RTbe4Hxhsjl3l6+HsCflRJv8dPH1PqQjtzq0gD2primFI/iGm7oSruTcE8/G1ONkVlCMbNysc1IhnCOVU66JR/XsyQIDAQABo4GSMIGPMB8GA1UdIwQYMBaAFKnyXV7yfyOkd7D4zZtPLyquqLWdME0GA1UdHwRGMEQwQqBAoD6kPDA6MQ4wDAYDVQQDEwVjcmwxMjENMAsGA1UECxMEY2NybDEZMBcGA1UEChMQY29yYmFuazQzLmNvbS5jbjAdBgNVHQ4EFgQUcL8GdzLHRtN6yiJUlDC/u63nTyAwDQYJKoZIhvcNAQEFBQADggEBABaLovTpH0ID9HH7nIrv4zMWGc5PWvDBdc8k/lmHo6HfdAVwI/050Lll0IyzZ19FZhfA5Frpnwmk49QLRMjIoVJvbO1Zs1Ey8fkxd2LBniBkKUbdmU6YbmkEnn2aIOi6fjyDPbLT7fVmOnZmNqNeA8/woo5DmW7/hcD0ImxApq9iMUGmWU+q3G7Wv9N77QhRGFefGvxQ9zRVb86xVv9yyCSA/ICx5Y9M68wiC/fIG3uC9t4kfE/+tikHCW2crY2BWQ/Q0vfo3gGbZx3zAxkd/HUnfKJTgkhNTX3tv8UxHg6DHX16SPkoXb9zjQsL+aJaLqbFruusDRvmbgJex+muE+0="; + //商户私钥 + String CertPriKey = bankConfig.my_private_key; + + /* 获取证书序列号cert_sn的方法。 + byte[] merCert = ReturnValue.base64dec(cert.getBytes()); + ByteArrayInputStream bin = new ByteArrayInputStream(merCert); + CertificateFactory cf = CertificateFactory.getInstance("X.509", "INFOSEC"); + Certificate certificate = cf.generateCertificate(bin); + BigInteger sn = ((X509Certificate)certificate).getSerialNumber(); + bin.close(); + String serialNumber = sn.toString(); + System.out.print(serialNumber); + */ + +// Map params=new HashMap(); +// String from=request.getParameter("from"); +// String api=request.getParameter("api"); +// String app_id=request.getParameter("app_id"); + String charset = request.getParameter("charset"); +// String format=request.getParameter("format"); + String encrypt_type = request.getParameter("encrypt_type"); +// String timestamp=request.getParameter("timestamp"); + String biz_content = request.getParameter("biz_content"); + String sign_type = request.getParameter("sign_type"); + String sign = request.getParameter("sign"); +// params.put("from", from); +// params.put("api", api); +// params.put("app_id", app_id); +// params.put("charset", charset); +// params.put("format", format); +// params.put("encrypt_type", encrypt_type); +// params.put("timestamp", timestamp); +// params.put("biz_content", biz_content); +// params.put("sign_type", sign_type);//目前上行网关签名暂时仅支持RSA + + /**********验证工行上行网关RSA签名**********/ + + //notify_url=http://122.20.29.133:9081/notifyUrlServlet + String path = "/notifyUrlServlet"; + String signStr = WebUtils.buildOrderedSignStr(path, params); + String results = null; + String responseBizContent = null; + boolean flag = IcbcSignature.verify(signStr, sign_type, APIGW_PUBLIC_KEY, charset, sign); + if (!flag) { + responseBizContent = "{\"return_code\":-12345,\"return_msg\":\"icbc sign not pass.\"}"; + } else { + + /**********biz_content解密**********/ + + if ("AES".equals(encrypt_type)) { + String theKey = "12345678901234567890123456789012"; + biz_content = IcbcEncrypt.decryptContent(biz_content, encrypt_type, theKey, charset); + } + + /**********合作方/分行 业务逻辑处理**********/ + @SuppressWarnings("unchecked") + Map respMap = (Map) JSON.parse(biz_content); + String msg_id = respMap.get("msg_id").toString(); + //业务请求字段获取 + String busiParamRq = (String) respMap.get("busi_param_rq"); + //业务处理逻辑...... + System.out.print(busiParamRq); + //业务返回参数设置 + int return_code = 0; + String return_msg = "success."; + responseBizContent = "{\"return_code\":" + return_code + ",\"return_msg\":\"" + return_msg + "\",\"msg_id\":\"" + msg_id + "\"," + + "\"busi_param_rp\":\"thisisresponseparameter\"}"; + + /**********response_biz_content加密**********/ + + + logger.info("==============encrypt_type {}==================", encrypt_type); + if ("AES".equals(encrypt_type)) { + String theKey = "12345678901234567890123456789012"; + responseBizContent = IcbcEncrypt.encryptContent(responseBizContent, encrypt_type, theKey, charset); + responseBizContent = "\"" + responseBizContent + "\""; + } + + } + + /**********商户对消息返回响应进行签名,签名方式需与在API平台登记APP的sign_type保持一致**********/ + //1、商户以CA证书签名为例,如下: +// signStr = "\"response_biz_content\":" + responseBizContent + "," + "\"sign_type\":" + "\"CA\"," + "\"ca\":\"" + cert + "\""; + sign = IcbcSignature.sign(signStr, "CA", CertPriKey, + charset, "12345678"); + results = "{" + signStr + ",\"sign\":\"" + sign + "\"}"; + + //2、商户以RSA签名为例,如下:其中,priKey为商户私钥; + /*String priKey="MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBALAWAcPiTMRU906PTdy0ozspX7XptZnkEw2C8R64RDB9BiRFXAj0cU4aTA1MyfmGIlceeVdgJf7OnmvpHnYxjQ7sGxMItPtodrGwA2y8j0AEbHc5pNWU8Hn0zoY9smHS5e+KjSbWv+VNbdnrRFTpDeiJ3+s2E/cKI2CDRbo7cAarAgMBAAECgYABiA933q4APyTvf/uTYdbRmuiEMoYr0nn/8hWayMt/CHdXNWs5gLbDkSL8MqDHFM2TqGYxxlpOPwnNsndbW874QIEKmtH/SSHuVUJSPyDW4B6MazA+/e6Hy0TZg2VAYwkB1IwGJox+OyfWzmbqpQGgs3FvuH9q25cDxkWntWbDcQJBAP2RDXlqx7UKsLfM17uu+ol9UvpdGoNEed+5cpScjFcsB0XzdVdCpp7JLlxR+UZNwr9Wf1V6FbD2kDflqZRBuV8CQQCxxpq7CJUaLHfm2kjmVtaQwDDw1ZKRb/Dm+5MZ67bQbvbXFHCRKkGI4qqNRlKwGhqIAUN8Ynp+9WhrEe0lnxo1AkEA0flSDR9tbPADUtDgPN0zPrN3CTgcAmOsAKXSylmwpWciRrzKiI366DZ0m6KOJ7ew8z0viJrmZ3pmBsO537llRQJAZLrRxZRRV6lGrwmUMN+XaCFeGbgJ+lphN5/oc9F5npShTLEKL1awF23HkZD9HUdNLS76HCp4miNXbQOVSbHi2QJAUw7KSaWENXbCl5c7M43ESo9paHHXHT+/5bmzebq2eoBofn+IFsyJB8Lz5L7WciDK7WvrGC2JEbqwpFhWwCOl/w=="; + signStr="\"response_biz_content\":"+responseBizContent+","+"\"sign_type\":"+"\"RSA\""; + sign=IcbcSignature.sign(signStr, "RSA", priKey, + charset,"12345678"); + results="{"+signStr+",\"sign\":\""+sign+"\"}";*/ + + response.setContentType("application/json; charset=utf-8"); + out = response.getWriter(); + out.write(results); + + } catch (Throwable e) { + e.printStackTrace(); + out.write(e.getMessage()); + } finally { + out.flush(); + out.close(); + } + + return "success"; + } +} diff --git a/health_service/src/main/java/cn/card/health/web/wechat/WeChatController.java b/health_service/src/main/java/cn/card/health/web/wechat/WeChatController.java new file mode 100644 index 0000000..0886991 --- /dev/null +++ b/health_service/src/main/java/cn/card/health/web/wechat/WeChatController.java @@ -0,0 +1,210 @@ +package cn.card.health.web.wechat; + +import cn.card.health.bean.order.YcPayCallback; +import cn.card.health.service.order.IYcPayCallbackService; +import cn.hutool.core.thread.ThreadUtil; +import com.alibaba.fastjson.JSONObject; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.ByteArrayOutputStream; +import java.io.InputStream; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.Arrays; + +@RestController +@RequestMapping("/wechat") +public class WeChatController { + private Logger logger = LoggerFactory.getLogger(WeChatController.class); + private static final String TOKEN = "08D3DAB237E1EDA269DFA8A7B75EDE9E"; + + @Autowired + private IYcPayCallbackService payCallbackService; + + /** + * 微信验证token + * + * @param signature + * @param timestamp + * @param nonce + * @param echostr + * @return + */ + @GetMapping(value = "/checkToken", produces = "text/html;charset=utf-8") + public String checkToken(@RequestParam("signature") String signature, @RequestParam("timestamp") String timestamp, + @RequestParam("nonce") String nonce, @RequestParam("echostr") String echostr) { + // 排序 + String[] arr = {TOKEN, timestamp, nonce}; + Arrays.sort(arr); + + StringBuilder content = new StringBuilder(); + for (int i = 0; i < arr.length; i++) { + content.append(arr[i]); + } + + // sha1Hex 加密 + MessageDigest md = null; + String temp = null; + try { + md = MessageDigest.getInstance("SHA-1"); + byte[] digest = md.digest(content.toString().getBytes()); + temp = byteToStr(digest); + logger.info("加密后的token:" + temp); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } + if ((temp.toLowerCase()).equals(signature)) { + return echostr; + } + return "fail"; + } + + /** + * @Title: callBack + * @Description: 支付完成的回调函数 + * @param: + * @return: + */ + @RequestMapping("/notify") + public String callBack(HttpServletRequest request, HttpServletResponse response) { + // System.out.println("微信支付成功,微信发送的callback信息,请注意修改订单信息"); + InputStream is = null; + + //int result = 0; + try { + + is = request.getInputStream();// 获取请求的流信息(这里是微信发的xml格式所有只能使用流来读) + ByteArrayOutputStream outSteam = new ByteArrayOutputStream(); + byte[] buffer = new byte[1024]; + int len; + while ((len = is.read(buffer)) != -1) { + outSteam.write(buffer, 0, len); + } + + outSteam.close(); + is.close(); + String xml = new String(outSteam.toByteArray()); + + logger.info("微信返回给回调函数的信息为:{}", xml); + YcPayCallback callBack = new YcPayCallback(); + callBack.setContent(xml); + callBack.setPayname("JSAPI"); + callBack.setPaytype("WECHAT"); + ThreadUtil.execute(() -> { + logger.info("微信返回支付结果,开始处理业务逻辑。"); + int result = payCallbackService.insertYcPayCallback(callBack); + if (result == 1) { + logger.info("业务逻辑处理完毕,结果正确!"); + } else if (result == 2) { + logger.info("业务逻辑正在处理!"); + } else { + logger.info("业务逻辑处理失败!"); + } + }); + //result = payCallbackService.insertYcPayCallback(callBack); + JSONObject json = new JSONObject(); + //if (result == 1) { + json.put("code", "SUCCESS"); + json.put("message", "成功"); + //} else { + // json.put("code", "FAIL"); + // json.put("message", "失败"); + //} + return json.toString(); + } catch (Exception e) { + e.printStackTrace(); + JSONObject json = new JSONObject(); + json.put("code", "FAIL"); + json.put("message", "失败"); + return json.toString(); + } finally { + + } + } + + /** + * @Title: callBack + * @Description: 退款完成的回调函数 + * @param: + * @return: + */ + @RequestMapping("/refund") + public String refund(HttpServletRequest request, HttpServletResponse response) { + // System.out.println("微信支付成功,微信发送的callback信息,请注意修改订单信息"); + InputStream is = null; + + //int result = 0; + try { + is = request.getInputStream();// 获取请求的流信息(这里是微信发的xml格式所有只能使用流来读) + ByteArrayOutputStream outSteam = new ByteArrayOutputStream(); + byte[] buffer = new byte[1024]; + int len; + while ((len = is.read(buffer)) != -1) { + outSteam.write(buffer, 0, len); + } + + outSteam.close(); + is.close(); +// String xml = WXPayUtil.InputStream2String(is); + String xml = new String(outSteam.toByteArray()); + + logger.info("微信返回给回调函数的信息为:{}", xml); + YcPayCallback callBack = new YcPayCallback(); + callBack.setContent(xml); + callBack.setPayname("REFUND"); + callBack.setPaytype("WECHAT"); + ThreadUtil.execute(() -> { + logger.info("微信返回退款结果,开始处理业务逻辑。"); + int result = payCallbackService.insertYcPayCallback(callBack); + if (result == 1) { + logger.info("退款业务逻辑处理完毕,结果正确!"); + } else { + logger.info("退款业务逻辑处理失败!"); + } + }); + //result = payCallbackService.insertYcPayCallback(callBack); + JSONObject json = new JSONObject(); + //if (result == 1) { + json.put("code", "SUCCESS"); + json.put("message", "成功"); + //} else { + // json.put("code", "FAIL"); + // json.put("message", "失败"); + //} + return json.toString(); + } catch (Exception e) { + e.printStackTrace(); + JSONObject json = new JSONObject(); + json.put("code", "FAIL"); + json.put("message", "失败"); + return json.toString(); + } finally { + + } + } + + private static String byteToStr(byte[] byteArray) { + String strDigest = ""; + for (int i = 0; i < byteArray.length; i++) { + strDigest += byteToHexStr(byteArray[i]); + } + return strDigest; + } + + private static String byteToHexStr(byte mByte) { + char[] Digit = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; + char[] tempArr = new char[2]; + tempArr[0] = Digit[(mByte >>> 4) & 0X0F]; + tempArr[1] = Digit[mByte & 0X0F]; + String s = new String(tempArr); + return s; + } +} diff --git a/health_service/src/main/java/zfbinfo.properties b/health_service/src/main/java/zfbinfo.properties new file mode 100644 index 0000000..3a627ac --- /dev/null +++ b/health_service/src/main/java/zfbinfo.properties @@ -0,0 +1,32 @@ + +# 支付宝网关名、partnerId和appId +open_api_domain = https://openapi.alipay.com/gateway.do +mcloud_api_domain = http://mcloudmonitor.com/gateway.do +pid = 2088531517393630 +appid = 2019062165588721 + +# RSA私钥、公钥和支付宝公钥 +private_key = MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCgcIJoj1E/dE8s8tHmDdVxJyrPgxQONXBj6WuUjDaV7LWUym0caNvhKl5qUmH62xAKXTg12c5SDd/cQPvHqBWelfwG8lXrDHhrMB77wC+azgzFsGpCnhP4jkXz/DsHnH4qus0LOMkVnewnyLs65OyVZS2Q7iqPolxO7TKxkkeZ7fzCcJEHgxt9uEGddWmcL+KyQg2uYuBi26XBpKCBmPbb/KSfgFcwjKo+9PULx1rwbDNzrHBqkb9OMA3SGMiP/gSFFW4fIjjfuYfQRhNUlyIsFgPVcqIAAAQ10y6TrjjNPdreB8E+EdAkHbjmnDEOGhz0ibeY4HyTu8jR5aZnz8qFAgMBAAECggEAJmNlQKFyHk21GBstj+8lcAKgIrDJXrD4qF9Uh2GZOfw+YlChFNgeLF0X5Da8DOrXhrNRXMk1rbp2ItxFojscmSpn+D2Jw0jjkzobX79XZKICulaAxlnOi313TW6/rQ2Lvqudnh7DNnHn7IkCC5B07zYbVf82ndGKZrQomgZXLYQ7tJ4jxZntuZWLcrIDfTz32VsVF8V0fv37JeYX1zbfzu6yfSrCX8pAACjE0OCE9PLBgPwHhU/6/OzTHZjOyjQIKjdT6+n0udjBcwbNLMM9uEqKeCcFIfN0jyGaZzDmynu8+kvReTfzrLuJfUfvjzAZVV1fDdCeFNES9kDkKlgr7QKBgQDfHIRroWYTOBEleA5EqdVzZGqBuc+mCcfWXXjyUwAGMc1PyKp+5fHXoLuChkujAaqU4p7voDlQnlxwkMH4ItG9fiqrroyHkgn3+Te9kTcutDNhMm0MSHWHRW86mpEnLis66NGb3O4IKWqGRuMdioq9/6JQ4d/sbK7zWuCT0EVYpwKBgQC4FvZw7MEuBkoFf6ziQMHSm1LpPdnt422ZGDyhaRR5hkbh2Dw6wf/MnrOchDAmh7sZIFU2dHLoTAQAmvNzb7CjdThmvE3qULbnTJybvcjiJ5NxuwuBnumbvFNoFVXZY94uCbxpHQGt0I95VSQkMlBMC06rYHdVLYMyf6Awyk688wKBgQCnA67w7wH9UxQqy0NLDSNW3Q2JjLGvZlTs2E3ogE9dU7yQg/N1SOaP9qdHHwbRwDaUe0xkrrkY62LhdMtu14nQYvjIScKy3ZSOx0V9p436bTSlBt1wu3EXUNfhs8EC5mHAGHaISYr6Gx6946SyAXq4nftAtsUsM3OHgjjpDZhLswKBgBgIh2v+vMmxcIB/RqbTJXrFZHGm7YitJGXUUDYSbeXfrelWPaa+JRMltPU+HLsrBTYmjnlpgobpRax+jkIH1tvANfjTpKhumTJhQiDjChLcb9dtP/dQM9dtIsZ34pla/GquQrbGXq2+iLyibPF80BbdcwvUsD+ijXpORy+XeegZAoGAUN6w6nkYLbkKz5ehRyM2K2gwpbWfegwrjPmLZ7G30tTR2IoiSSZY81dbfQO/Eiwpydf5ta3eyPxAe6tOdAopwKn05CQHLbr/spMqRT+05NJWNF6gFn9a8g5JtehmfDn0pb6WzEtUnjnfQyLNiuactPt/miEtVoZoUGluShLpO2c= +public_key = MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoHCCaI9RP3RPLPLR5g3VcScqz4MUDjVwY+lrlIw2ley1lMptHGjb4SpealJh+tsQCl04NdnOUg3f3ED7x6gVnpX8BvJV6wx4azAe+8Avms4MxbBqQp4T+I5F8/w7B5x+KrrNCzjJFZ3sJ8i7OuTslWUtkO4qj6JcTu0ysZJHme38wnCRB4MbfbhBnXVpnC/iskINrmLgYtulwaSggZj22/ykn4BXMIyqPvT1C8da8Gwzc6xwapG/TjAN0hjIj/4EhRVuHyI437mH0EYTVJciLBYD1XKiAAAENdMuk644zT3a3gfBPhHQJB245pwxDhoc9Im3mOB8k7vI0eWmZ8/KhQIDAQAB + +#SHA1withRsa对应支付宝公钥 +#alipay_public_key = MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDDI6d306Q8fIfCOaTXyiUeJHkrIvYISRcc73s3vF1ZT7XN8RNPwJxo8pWaJMmvyTn9N4HQ632qJBVHf8sxHi/fEsraprwCtzvzQETrNRwVxLO5jVmRGi60j8Ue1efIlzPXV9je9mkjzOmdssymZkh2QhUrCmZYI/FCEa3/cNMW0QIDAQAB + +#SHA256withRsa对应支付宝公钥 +#alipay_public_key = MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjrEVFMOSiNJXaRNKicQuQdsREraftDA9Tua3WNZwcpeXeh8Wrt+V9JilLqSa7N7sVqwpvv8zWChgXhX/A96hEg97Oxe6GKUmzaZRNh0cZZ88vpkn5tlgL4mH/dhSr3Ip00kvM4rHq9PwuT4k7z1DpZAf1eghK8Q5BgxL88d0X07m9X96Ijd0yMkXArzD7jg+noqfbztEKoH3kPMRJC2w4ByVdweWUT2PwrlATpZZtYLmtDvUKG/sOkNAIKEMg3Rut1oKWpjyYanzDgS7Cg3awr1KPTl9rHCazk15aNYowmYtVabKwbGVToCAGK+qQ1gT3ELhkGnf3+h53fukNqRH+wIDAQAB +alipay_public_key = MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAl0yh95yTYfViYRJrXIuM96GnG9ViDq22woCvQj8c2QioGLuPTvl1zQGQmwYkmKfoEj9Ks/IRU6Yp1I5ifjATZjnddKFC73DeOAX5Pvugvf+XxHb3RTw8oaMkRS/HDSzhdlzd8odTZgzItRMIwjG5pyoICxLUMtErP/5754So1eFq74yT/hld7kOcR8NyNT3gqxafhJqPT47HnC7HUaHX2V3FMsJVT+ImbskgFakA6Itrx4+FjM6k5LDOvuFzK2fHrjE5Lo03bIl193k48R0Fgf3wN+CxHPADZwDCfdNPzq1CMdVsbDnUVigi/dRooahCxfj8V6xOIUGCPwSQoP1w6QIDAQAB + +# MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAl0yh95yTYfViYRJrXIuM96GnG9ViDq22woCvQj8c2QioGLuPTvl1zQGQmwYkmKfoEj9Ks/IRU6Yp1I5ifjATZjnddKFC73DeOAX5Pvugvf+XxHb3RTw8oaMkRS/HDSzhdlzd8odTZgzItRMIwjG5pyoICxLUMtErP/5754So1eFq74yT/hld7kOcR8NyNT3gqxafhJqPT47HnC7HUaHX2V3FMsJVT+ImbskgFakA6Itrx4+FjM6k5LDOvuFzK2fHrjE5Lo03bIl193k48R0Fgf3wN+CxHPADZwDCfdNPzq1CMdVsbDnUVigi/dRooahCxfj8V6xOIUGCPwSQoP1w6QIDAQAB +# 签名类型: RSA->SHA1withRsa,RSA2->SHA256withRsa +sign_type = RSA2 +# 当面付最大查询次数和查询间隔(毫秒) +max_query_retry = 5 +query_duration = 5000 + +# 当面付最大撤销次数和撤销间隔(毫秒) +max_cancel_retry = 3 +cancel_duration = 2000 + +# 交易保障线程第一次调度延迟和调度间隔(秒) +heartbeat_delay = 5 +heartbeat_duration = 900 diff --git a/health_service/src/main/resources/.DS_Store b/health_service/src/main/resources/.DS_Store new file mode 100644 index 0000000..200c5e2 Binary files /dev/null and b/health_service/src/main/resources/.DS_Store differ diff --git a/health_service/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/health_service/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..e518f84 --- /dev/null +++ b/health_service/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,5 @@ +{"properties": [{ + "name": "spring.datasource.jdbc-url", + "type": "java.lang.String", + "description": "A description for 'spring.datasource.jdbc-url'" +}]} \ No newline at end of file diff --git a/health_service/src/main/resources/application-dev.yml b/health_service/src/main/resources/application-dev.yml new file mode 100644 index 0000000..9edf397 --- /dev/null +++ b/health_service/src/main/resources/application-dev.yml @@ -0,0 +1,103 @@ +server: + port: 2033 + +spring: + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + jdbc-url: jdbc:mysql://182.92.82.204:3306/mk-healthcard?characterEncoding=utf8&useUnicode=true&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true +# jdbc-url: jdbc:mysql://127.0.0.1:3306/mk-healthcard?characterEncoding=utf8&useUnicode=true&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true + username: root + password: 1qaz@WSX + validation-query: SELECT 1 FROM DUAL + test-on-borrow: true + connection-timeout: 60000 + auto-connection: true + dbcp2: + initial-size: 10 + max-idle: 20 + min-idle: 5 + servlet: + multipart: + max-file-size: 10MB #最大支持文件大小 + max-request-size: 10MB #最大支持请求大小 + jackson: + time-zone: GMT+8 + +mybatis: + type-aliases-package: cn.card.health.bean.* + mapper-locations: classpath:mapper/**/*Mapper.xml + config-location: classpath:mybatis/mybatis-config.xml +# configuration: +# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl +# PageHelper分页插件 + +pagehelper: + helperDialect: mysql + supportMethodsArguments: true + params: count=countSql + +his: + proxyHost: 221.193.240.211 + proxyPort: 8088 + url: http://127.0.0.1:33061/ + +alipay: + appid: 2021003162675444 + app_private_key: MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQC5JmQ4tzgPZZW6WsQLTO60ZDJn2OgtAJb9MNbCIzXbGvnQVYqzdbq+LctiBw52swOgI4rSjPQWKoxnpEBnYbubYCCxldWC7LXATTEXw8HigDADg5V/1+kydGZfzlov48NesryolYgev++9G2qVs7nIc8HaDCqW7JFB7ZWkYYViykujjcrBz8ZOQKZbRwYbm2KoqIXDFEjH0pf3uamqgUqWfRg4KISV/e8zZ0RqYnruN1zVUVU6FVylsYzVF4qQSjpoB1CowXzaNPiBbdCm4GwqZ8hGNGxsqpa1TJJ83G3smp13rUni+6lpk2i+y+D1q67X0crVNUAcI55CDREySmY3AgMBAAECggEAEuT4FVGdRvT28q2QlBalxYL0IeTgzLbisbPqNqWhOVrnY3tXTDkXdZD20Gon77UVCaKW6CW6QwjUiz8X03UF0DVfIMBJqbK+WYGHIQW5I4QxYiprd0Bxa9S1HdHRIlH7/g3/crTPz1OHA6Vomx5cNziY78eOERjTOgck3kGVex89WuhcwqPDhC/V1bbQyANSOBo9/xSjmpK9mviwMP14f1S1xjkMCP/kCK+ZBA+LEAMhGoAR53UY9Q4kWVoaWJkIAkk16nLpgn+ggPLQtcZx+Opyf70o7200vOaD5TJByJBBBz3kdeowgy8xX4Lp7OdfJ1SzHKlbeHapW/4Q5dR6AQKBgQDk+k94qHmUixvhF7OcQTyy96u5F5mS2BVww6ikkIWDO+qCYI5RiLAJ+a4ZIdIeuFNX2hUteUTtgpdA/kWt0kW65mYJYKqEriEwMfqrej8NIdaL2hUscUR4q3GOa7RsxN1ow0bu/yOb4Mp3u4ygQHfzbK8ZHtC3B9VzEV7kyZGSDwKBgQDO//24kVrbt2EEvs31iMIfVKT8sh2EW+Xfoq1gmNkecVb7s4Nz5G0+UD6dq3Ob69rKRyH1PrV4jCuycTbF+oUWWIzBBGIl5ejL9oTXrZTTa+tws8pmskiPkMYplwuQqhxhIDsJSixS1zBE93JWJnQwcbmRM3c1t77Jteh5bWpxWQKBgFS1eXMEuL3IXM8ACrVSuRboY0H9RhY6FGx8JcaDpLDxGIeVGvF05NM76Dlp9qbgwAxvJIiHJYXMWxJzPunYMW28UKFFfq/JD4QZ6UdI2UyNaSahzlV7rb4Kht8OX1gh2FsqavJ9tvmyxpRW8OZUE0wduAVODh64KjIAih+PpmfnAoGAEGIcb7Y5bbhm2lxLqspHKvmlEUb7pRUs7XVPqZyPWqR30PYVSl/i8ZKiUhJW1RlmuKnGm0V6UW8uqjHhtuusCue5RDGXnw5CTZpWS0e2xsD84m+oblZf/dTkijglNy7vjhRh98tCFNBpRpwbFYx3l7n4iPB81+iSFh7qpmmtigkCgYBObJuGChOOn5INcbUK/z99Jx8+Qi4s/YPTfH7sG9ZDX1pofhMLS2KuIt/1K/AS+khRlaRlxcrXHbMNNqTw03t17OTQaM4EQV653qjhSnqK758u+4iAbtIp85XLUnA028p/MtmmWsO+QqHO/IAFCCeMoXv6EM4/WQQ1Cqvnfy5AbQ== + alipay_public_key: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmXO0GOwHf8ikGcXobNlHb7aCQXk1Is6mKapbw8RjLlZu45FMhZMA14iCFJNfMjzcrg/7K0OFjXok2ze1Sc5d8jg+DbqwsgitJaV8eXHBPEK9Q02B1r0V0F9ns1xrByJ/Xvh6AbTCzExdHqNLJ+k+XPtjKd1DJOeck97Jp9JvmRh/pPPycPCuzrNYc2Fc9K/Lc3ubIGG6dbVf5s4EkR59guYZW6akidSR+H5aLnd1fyHqA1IVNbYhKcf3eufQN/OUhpHyC0a3BhxYKZTUITkv90TEdD+F80wyQvBrwhW2imor9OaBZ1O+0sJF4H9c9CMiCL9DOuBAJPccW8+JTMyU3QIDAQAB + notify_url: https://alipay.hdszxyjhyy.com:33061/health/alipay/payCallback + notify_insure_url: https://alipay.hdszxyjhyy.com:33061/health/alipay/insureCallback + + insurance: + test: + # 定点医药机构在移动支付中心申请的应用Id + in_appid: 1GI1ID7O302G3F60C80A000072E7D954 + # 定点医药机构编码 + org_no: H13040207288 + # 机构渠道认证编码 + org_chnl_crtf_code: BqK1kMStlhVDgN2uHf4EsP9BQzovPtfTZGwRsyhqMMYAPlh8CUlCz1bMGY9466pv + # 医药机构名称 + org_name: 邯郸市精神病医院 + # 医保应用密钥 + in_app_secret: 1GI1ID7O802H3F60C80A00004577BF86 + # 医保应用私钥 + in_app_private_key: f1zWciLuLwbFTXABJHVvlqWq+eLmWE7cPBiww7cLBHM= + # 医保平台公钥 + in_app_public_key: BMt9tdobkT3LLFrJptGJ/J4YHb9BB6OwLiRedD8yKxRj3S+8K1woa6NL2sEk5HyJCiW1yLskyxFoYFbl581yAms= + # 医保服务地址(测试) + in_url: https://test.pub.ylbzj.yhwch.com:8089/pmc + prod: + # 定点医药机构在移动支付中心申请的应用Id + in_appid: 1GI1ID7O302G3F60C80A000072E7D954 + # 定点医药机构编码 + org_no: H13040207288 + # 机构渠道认证编码 + org_chnl_crtf_code: BqK1kMStlhVDgN2uHf4EsP9BQzovPtfTZGwRsyhqMMb3tMSdN3Pqhx4UP/XPwgad + # 医药机构名称 + org_name: 邯郸市精神病医院 + # 医保应用密钥 + in_app_secret: 1GH0SOG7Q06J76430B0A000081C3056C + # 医保应用私钥 + in_app_private_key: Gimez6VnBU5lSbOUrfTuBGIKt1inuCAqhjRn9xmzJr4= + # 医保平台公钥 + in_app_public_key: BAjWhvUa+B6xXWAZUmvAdR9z5FSyWYvKiKXsKj/fUlwUjnJtGzx/7G65JBBNDHAlabe9vHEQ+a9LFy4zdaq1gHM= + # 医保服务地址(测试) + in_url: https://pub.ylbzj.yhwch.com/pmc/ + + bank: + app_id: 11000000000000020432 + my_private_key: MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCGgPgvjzrd/9hSUoWGAk2yLhbYnH7bSfcYwjn2MY9a8H3IHbNgZCKEo5+pQ6vXcIJ+LZnm51xK9y/nTaUCQWkNhbC107fMLyEyhZLYQdp94XDZnbpLx3sUQb48BBIK08JRZsI44BWznQ7Ssvg3QWBQF6LovNrrWbKvjh9KhKnZ2YFYJWmKJpRgiz7WUXCTbY0KRGuPwvW4BVyviKAkWlvdPzLseKf66RZWBUIUDNMzvSjBBBtft6x40u5OqohIB/dVhDeDFzA3Z8wxWncVyS4vXKEoHJXuC3LW84J5W5eOceNq4iYDXD6+7ujHQUXpCDbej9JKm7bPoOdNp752OD1jAgMBAAECggEAXeib37DT+/3OTiPZn+fp0VbGkrQpCfhJclrhVxfhLDAu0dKS0+D2DL+lEOvzhbbDFU/HXWT5lkmhg5A9fianL07BQyIv+HqLZhfGoADSiQMm5HlwgcokD8+a/5Ij+rVAvc7OGiGyZTZqDAfyr7mQgjsOfgqlmp6E2HeVN1UKtdNYcuJCO1rZmnlIPdXXzMk528LPnp34Us68ivxHjwSUOtLq4Ooka7BiNEWx22kyQdJTjPAx9Rg0KtpOr8IeWhmhV3MLRgtdjEp+0FSg4la7OX9PKuYnR8oO8skfj/xUOenZ1XvG8PZguLb16dTqF8ZnCAEzrknuO8/Njo1pu/E96QKBgQC/ZKPXlb91HTbeThmUKWHA/RSVS0PO4N+xAO3JP4O43+uuNJVBRxh5Ve+uyWEAqdM7lXHc07r7a2fSdfk1TCvunfWM9Je6nj/mLCEryGTST1beSNn0wKV2UhuQLJ/+bLh1RGuZRecRGeezyES4mRLv2siCrViqLs0RjtB28x0yvQKBgQCz6DNjXRSfMPZs9/e8WkkUH5niPlsduk+1MdkW5A3sPsjFDbTVggAJAPUnJlU0vPIup9DYRdPmDpXFgIDckyi2qeSH38ff8hQ0TxyKmgxT3LI7rzjFRm7fU4Z06LoTQMk8psO7nVHPVrEiLpZ7PMPpA8Qcz59kysbhiBuBiJVCnwKBgQC7q21UyYtwxPK2TRKby3AFEqQKOEEHLE1rfKOtQFBjCX5J1Vm9Jn+DCpb5ZpFtWxi7RjDd/edM/OZS4kc40bYKRm0uh+/3l5DEm+Tyz469AfsF/51odzZHrP9GAdvoWKcOpcZ0Bq0qgaJHEUsBT2fYNUmDiYJ1bWq7mrQizwSEaQKBgQCIH1H6hawbwx1BV+HPVvTiUALMJ2gjtxumOqBKbKWIMf0Q9Az2W1WRenMDe0KPE8Oev4UKjtMEx9ZUyKU3v/TXOPbcQ9rkvDLDXXR3/pUDQwJsnGi1A1TSj0012f0ooiVhScDhjOggnDSMa3map2CIRzw0nHe6+J7AeI5vVRuyewKBgAOPyOQA2RAY6csrrmoogdo21Kl2E1X7TswJLgmAfmPZj6yf7m3zbdyjsmOK/3nRfR5eoxEWskUYLntRsa62t8pRogD9b4wZqnwJzF/77xIV69we8z1Q44U6WhhtMqBboBnnx1jvvMpqH3Go+Syd1ZvASxc5lEMJKR3csRGxX5aE + apigw_public_key: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCMpjaWjngB4E3ATh+G1DVAmQnIpiPEFAEDqRfNGAVvvH35yDetqewKi0l7OEceTMN1C6NPym3zStvSoQayjYV+eIcZERkx31KhtFu9clZKgRTyPjdKMIth/wBtPKjL/5+PYalLdomM4ONthrPgnkN4x4R0+D4+EBpXo8gNiAFsNwIDAQAB + aes_key: 5LRxjy8EV2PDBYNWbMzrVw== + +dept: + pediatrics: 1001,1049 + +#是否为模拟环境 +config: + isMN: true + +credential: + upload: D:/opt + pressText: 武安市第一人民医院 + download: D:/opt \ No newline at end of file diff --git a/health_service/src/main/resources/application-prod.yml b/health_service/src/main/resources/application-prod.yml new file mode 100644 index 0000000..49c0b0d --- /dev/null +++ b/health_service/src/main/resources/application-prod.yml @@ -0,0 +1,103 @@ +server: + port: 8086 + servlet: + # 应用的访问路径 + context-path: /health + +spring: + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + jdbc-url: jdbc:mysql://127.0.0.1:3306/mk-healthcard?characterEncoding=utf8&useUnicode=true&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true + username: root +# password: 1qaz@WSX + password: 123123 + validation-query: SELECT 1 FROM DUAL + test-on-borrow: true + connection-timeout: 60000 + auto-connection: true + dbcp2: + initial-size: 10 + max-idle: 20 + min-idle: 5 + jackson: + time-zone: GMT+8 + +mybatis: + type-aliases-package: cn.card.health.bean.* + mapper-locations: classpath:mapper/**/*Mapper.xml + config-location: classpath:mybatis/mybatis-config.xml +# configuration: +# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl +# PageHelper分页插件 + +pagehelper: + helperDialect: mysql + supportMethodsArguments: true + params: count=countSql +his: + proxyHost: 192.168.20.20 + proxyPort: 8081 + url: http://127.0.0.1:33061/ + +alipay: + appid: 2021003162675444 + app_private_key: MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQC5JmQ4tzgPZZW6WsQLTO60ZDJn2OgtAJb9MNbCIzXbGvnQVYqzdbq+LctiBw52swOgI4rSjPQWKoxnpEBnYbubYCCxldWC7LXATTEXw8HigDADg5V/1+kydGZfzlov48NesryolYgev++9G2qVs7nIc8HaDCqW7JFB7ZWkYYViykujjcrBz8ZOQKZbRwYbm2KoqIXDFEjH0pf3uamqgUqWfRg4KISV/e8zZ0RqYnruN1zVUVU6FVylsYzVF4qQSjpoB1CowXzaNPiBbdCm4GwqZ8hGNGxsqpa1TJJ83G3smp13rUni+6lpk2i+y+D1q67X0crVNUAcI55CDREySmY3AgMBAAECggEAEuT4FVGdRvT28q2QlBalxYL0IeTgzLbisbPqNqWhOVrnY3tXTDkXdZD20Gon77UVCaKW6CW6QwjUiz8X03UF0DVfIMBJqbK+WYGHIQW5I4QxYiprd0Bxa9S1HdHRIlH7/g3/crTPz1OHA6Vomx5cNziY78eOERjTOgck3kGVex89WuhcwqPDhC/V1bbQyANSOBo9/xSjmpK9mviwMP14f1S1xjkMCP/kCK+ZBA+LEAMhGoAR53UY9Q4kWVoaWJkIAkk16nLpgn+ggPLQtcZx+Opyf70o7200vOaD5TJByJBBBz3kdeowgy8xX4Lp7OdfJ1SzHKlbeHapW/4Q5dR6AQKBgQDk+k94qHmUixvhF7OcQTyy96u5F5mS2BVww6ikkIWDO+qCYI5RiLAJ+a4ZIdIeuFNX2hUteUTtgpdA/kWt0kW65mYJYKqEriEwMfqrej8NIdaL2hUscUR4q3GOa7RsxN1ow0bu/yOb4Mp3u4ygQHfzbK8ZHtC3B9VzEV7kyZGSDwKBgQDO//24kVrbt2EEvs31iMIfVKT8sh2EW+Xfoq1gmNkecVb7s4Nz5G0+UD6dq3Ob69rKRyH1PrV4jCuycTbF+oUWWIzBBGIl5ejL9oTXrZTTa+tws8pmskiPkMYplwuQqhxhIDsJSixS1zBE93JWJnQwcbmRM3c1t77Jteh5bWpxWQKBgFS1eXMEuL3IXM8ACrVSuRboY0H9RhY6FGx8JcaDpLDxGIeVGvF05NM76Dlp9qbgwAxvJIiHJYXMWxJzPunYMW28UKFFfq/JD4QZ6UdI2UyNaSahzlV7rb4Kht8OX1gh2FsqavJ9tvmyxpRW8OZUE0wduAVODh64KjIAih+PpmfnAoGAEGIcb7Y5bbhm2lxLqspHKvmlEUb7pRUs7XVPqZyPWqR30PYVSl/i8ZKiUhJW1RlmuKnGm0V6UW8uqjHhtuusCue5RDGXnw5CTZpWS0e2xsD84m+oblZf/dTkijglNy7vjhRh98tCFNBpRpwbFYx3l7n4iPB81+iSFh7qpmmtigkCgYBObJuGChOOn5INcbUK/z99Jx8+Qi4s/YPTfH7sG9ZDX1pofhMLS2KuIt/1K/AS+khRlaRlxcrXHbMNNqTw03t17OTQaM4EQV653qjhSnqK758u+4iAbtIp85XLUnA028p/MtmmWsO+QqHO/IAFCCeMoXv6EM4/WQQ1Cqvnfy5AbQ== + alipay_public_key: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmXO0GOwHf8ikGcXobNlHb7aCQXk1Is6mKapbw8RjLlZu45FMhZMA14iCFJNfMjzcrg/7K0OFjXok2ze1Sc5d8jg+DbqwsgitJaV8eXHBPEK9Q02B1r0V0F9ns1xrByJ/Xvh6AbTCzExdHqNLJ+k+XPtjKd1DJOeck97Jp9JvmRh/pPPycPCuzrNYc2Fc9K/Lc3ubIGG6dbVf5s4EkR59guYZW6akidSR+H5aLnd1fyHqA1IVNbYhKcf3eufQN/OUhpHyC0a3BhxYKZTUITkv90TEdD+F80wyQvBrwhW2imor9OaBZ1O+0sJF4H9c9CMiCL9DOuBAJPccW8+JTMyU3QIDAQAB + notify_url: https://alipay.hdszxyjhyy.com:33061/health/alipay/payCallback + notify_insure_url: https://alipay.hdszxyjhyy.com:33061/health/alipay/insureCallback + + insurance: + test: + # 定点医药机构在移动支付中心申请的应用Id + in_appid: 1GI1ID7O302G3F60C80A000072E7D954 + # 定点医药机构编码 + org_no: H13040207288 + # 机构渠道认证编码 + org_chnl_crtf_code: BqK1kMStlhVDgN2uHf4EsP9BQzovPtfTZGwRsyhqMMYAPlh8CUlCz1bMGY9466pv + # 医药机构名称 + org_name: 邯郸市精神病医院 + # 医保应用密钥 + in_app_secret: 1GI1ID7O802H3F60C80A00004577BF86 + # 医保应用私钥 + in_app_private_key: f1zWciLuLwbFTXABJHVvlqWq+eLmWE7cPBiww7cLBHM= + # 医保平台公钥 + in_app_public_key: BMt9tdobkT3LLFrJptGJ/J4YHb9BB6OwLiRedD8yKxRj3S+8K1woa6NL2sEk5HyJCiW1yLskyxFoYFbl581yAms= + # 医保服务地址(测试) + in_url: https://test.pub.ylbzj.yhwch.com:8089/pmc + prod: + # 定点医药机构在移动支付中心申请的应用Id + in_appid: 1GI1ID7O302G3F60C80A000072E7D954 + # 定点医药机构编码 + org_no: H13040207288 + # 机构渠道认证编码 + org_chnl_crtf_code: BqK1kMStlhVDgN2uHf4EsP9BQzovPtfTZGwRsyhqMMb3tMSdN3Pqhx4UP/XPwgad + # 医药机构名称 + org_name: 邯郸市精神病医院 + # 医保应用密钥 + in_app_secret: 1GH0SOG7Q06J76430B0A000081C3056C + # 医保应用私钥 + in_app_private_key: Gimez6VnBU5lSbOUrfTuBGIKt1inuCAqhjRn9xmzJr4= + # 医保平台公钥 + in_app_public_key: BAjWhvUa+B6xXWAZUmvAdR9z5FSyWYvKiKXsKj/fUlwUjnJtGzx/7G65JBBNDHAlabe9vHEQ+a9LFy4zdaq1gHM= + # 医保服务地址(测试) + in_url: https://pub.ylbzj.yhwch.com/pmc/ + + bank: + app_id: 11000000000000020432 + my_private_key: MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCGgPgvjzrd/9hSUoWGAk2yLhbYnH7bSfcYwjn2MY9a8H3IHbNgZCKEo5+pQ6vXcIJ+LZnm51xK9y/nTaUCQWkNhbC107fMLyEyhZLYQdp94XDZnbpLx3sUQb48BBIK08JRZsI44BWznQ7Ssvg3QWBQF6LovNrrWbKvjh9KhKnZ2YFYJWmKJpRgiz7WUXCTbY0KRGuPwvW4BVyviKAkWlvdPzLseKf66RZWBUIUDNMzvSjBBBtft6x40u5OqohIB/dVhDeDFzA3Z8wxWncVyS4vXKEoHJXuC3LW84J5W5eOceNq4iYDXD6+7ujHQUXpCDbej9JKm7bPoOdNp752OD1jAgMBAAECggEAXeib37DT+/3OTiPZn+fp0VbGkrQpCfhJclrhVxfhLDAu0dKS0+D2DL+lEOvzhbbDFU/HXWT5lkmhg5A9fianL07BQyIv+HqLZhfGoADSiQMm5HlwgcokD8+a/5Ij+rVAvc7OGiGyZTZqDAfyr7mQgjsOfgqlmp6E2HeVN1UKtdNYcuJCO1rZmnlIPdXXzMk528LPnp34Us68ivxHjwSUOtLq4Ooka7BiNEWx22kyQdJTjPAx9Rg0KtpOr8IeWhmhV3MLRgtdjEp+0FSg4la7OX9PKuYnR8oO8skfj/xUOenZ1XvG8PZguLb16dTqF8ZnCAEzrknuO8/Njo1pu/E96QKBgQC/ZKPXlb91HTbeThmUKWHA/RSVS0PO4N+xAO3JP4O43+uuNJVBRxh5Ve+uyWEAqdM7lXHc07r7a2fSdfk1TCvunfWM9Je6nj/mLCEryGTST1beSNn0wKV2UhuQLJ/+bLh1RGuZRecRGeezyES4mRLv2siCrViqLs0RjtB28x0yvQKBgQCz6DNjXRSfMPZs9/e8WkkUH5niPlsduk+1MdkW5A3sPsjFDbTVggAJAPUnJlU0vPIup9DYRdPmDpXFgIDckyi2qeSH38ff8hQ0TxyKmgxT3LI7rzjFRm7fU4Z06LoTQMk8psO7nVHPVrEiLpZ7PMPpA8Qcz59kysbhiBuBiJVCnwKBgQC7q21UyYtwxPK2TRKby3AFEqQKOEEHLE1rfKOtQFBjCX5J1Vm9Jn+DCpb5ZpFtWxi7RjDd/edM/OZS4kc40bYKRm0uh+/3l5DEm+Tyz469AfsF/51odzZHrP9GAdvoWKcOpcZ0Bq0qgaJHEUsBT2fYNUmDiYJ1bWq7mrQizwSEaQKBgQCIH1H6hawbwx1BV+HPVvTiUALMJ2gjtxumOqBKbKWIMf0Q9Az2W1WRenMDe0KPE8Oev4UKjtMEx9ZUyKU3v/TXOPbcQ9rkvDLDXXR3/pUDQwJsnGi1A1TSj0012f0ooiVhScDhjOggnDSMa3map2CIRzw0nHe6+J7AeI5vVRuyewKBgAOPyOQA2RAY6csrrmoogdo21Kl2E1X7TswJLgmAfmPZj6yf7m3zbdyjsmOK/3nRfR5eoxEWskUYLntRsa62t8pRogD9b4wZqnwJzF/77xIV69we8z1Q44U6WhhtMqBboBnnx1jvvMpqH3Go+Syd1ZvASxc5lEMJKR3csRGxX5aE + apigw_public_key: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCMpjaWjngB4E3ATh+G1DVAmQnIpiPEFAEDqRfNGAVvvH35yDetqewKi0l7OEceTMN1C6NPym3zStvSoQayjYV+eIcZERkx31KhtFu9clZKgRTyPjdKMIth/wBtPKjL/5+PYalLdomM4ONthrPgnkN4x4R0+D4+EBpXo8gNiAFsNwIDAQAB + aes_key: 5LRxjy8EV2PDBYNWbMzrVw== + notify_url: https://alipay.hdszxyjhyy.com:33061/health/bank/payCallback + +#配置科室ID +dept: + pediatrics: 1001,1049 #儿科,新生儿 + +#是否为模拟环境 +config: + isMN: false + +credential: + upload: D:/server/healthCard/image + pressText: 武安市第一人民医院 + download: D:/server/healthCard/download \ No newline at end of file diff --git a/health_service/src/main/resources/application.properties-bak b/health_service/src/main/resources/application.properties-bak new file mode 100644 index 0000000..4868fde --- /dev/null +++ b/health_service/src/main/resources/application.properties-bak @@ -0,0 +1,35 @@ +server.port=2033 +spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver +spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver +#spring.datasource.jdbc-url=jdbc:mysql://49.233.184.121:3306/healthcard?characterEncoding=utf8&useUnicode=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull +spring.datasource.jdbc-url=jdbc:mysql://127.0.0.1:3306/healthcard?characterEncoding=utf8&useUnicode=true&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true +spring.datasource.username=root +spring.datasource.password=root +spring.datasource.validationQuery=SELECT 1 FROM DUAL +spring.datasource.testOnBorrow=true +# MyBatis +# \u914D\u7F6Emapper\u7684\u626B\u63CF\uFF0C\u627E\u5230\u6240\u6709\u7684mapper.xml\u6620\u5C04\u6587\u4EF6 +mybatis.type-aliases-package:cn.card.health.bean.* +mybatis.mapper-locations:classpath:mapper/**/*Mapper.xml +# \u52A0\u8F7D\u5168\u5C40\u7684\u914D\u7F6E\u6587\u4EF6 +mybatis.configLocation:classpath:mybatis/mybatis-config.xml +mybatis.mapperLocations:classpath*:mapper/**/*Mapper.xml +mybatis.typeAliasesPackage:cn.card.health.bean.* +# Redis\u6570\u636E\u5E93\u7D22\u5F15\uFF08\u9ED8\u8BA4\u4E3A0\uFF09 +spring.redis.database=1 +# Redis\u670D\u52A1\u5668\u5730\u5740 +spring.redis.host=127.0.0.1 +# Redis\u670D\u52A1\u5668\u8FDE\u63A5\u7AEF\u53E3 +spring.redis.port=6379 +# Redis\u670D\u52A1\u5668\u8FDE\u63A5\u5BC6\u7801\uFF08\u9ED8\u8BA4\u4E3A\u7A7A\uFF09 +spring.redis.password= +# \u8FDE\u63A5\u6C60\u6700\u5927\u8FDE\u63A5\u6570\uFF08\u4F7F\u7528\u8D1F\u503C\u8868\u793A\u6CA1\u6709\u9650\u5236\uFF09 +spring.redis.pool.max-active=200 +# \u8FDE\u63A5\u6C60\u6700\u5927\u963B\u585E\u7B49\u5F85\u65F6\u95F4\uFF08\u4F7F\u7528\u8D1F\u503C\u8868\u793A\u6CA1\u6709\u9650\u5236\uFF09 +spring.redis.pool.max-wait=-1 +# \u8FDE\u63A5\u6C60\u4E2D\u7684\u6700\u5927\u7A7A\u95F2\u8FDE\u63A5 +spring.redis.pool.max-idle=10 +# \u8FDE\u63A5\u6C60\u4E2D\u7684\u6700\u5C0F\u7A7A\u95F2\u8FDE\u63A5 +spring.redis.pool.min-idle=0 +# \u8FDE\u63A5\u8D85\u65F6\u65F6\u95F4\uFF08\u6BEB\u79D2\uFF09 +spring.redis.timeout=1000 \ No newline at end of file diff --git a/health_service/src/main/resources/application.yml b/health_service/src/main/resources/application.yml new file mode 100644 index 0000000..1c73911 --- /dev/null +++ b/health_service/src/main/resources/application.yml @@ -0,0 +1,5 @@ +spring: + application: + name: hospital + profiles: + active: prod #@profile.name@ \ No newline at end of file diff --git a/health_service/src/main/resources/jar/.DS_Store b/health_service/src/main/resources/jar/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/health_service/src/main/resources/jar/.DS_Store differ diff --git a/health_service/src/main/resources/log4j.properties b/health_service/src/main/resources/log4j.properties new file mode 100644 index 0000000..49544a1 --- /dev/null +++ b/health_service/src/main/resources/log4j.properties @@ -0,0 +1,20 @@ +## 设置### +#log4j.rootLogger = stdout +log4j.rootLogger=info,stdout,R +log4j.logger.com.tencent.healthcard=debug +### 输出信息到控制抬 ### +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.Target=System.out +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d %-5p %l- %m%n +log4j.appender.logfile.encoding=UTF-8 +#DailyRollingFileAppender每天产生一个日志文件 +log4j.appender.R=org.apache.log4j.DailyRollingFileAppender +#设置日志文件保存路径 +log4j.appender.R.File=./logs/logFile.log +#日志输出格式 +log4j.appender.R.layout.ConversionPattern=%-d{yyyy-MM-dd HH\:mm\:ss} [%c]-[%p] %m%n +#设置日志文件后缀名,决定着多长时间创建一个新的文件!yyyyMMdd每天一个,yyyyMMddHH第小时一个,... +log4j.appender.R.DatePattern='.'yyyy-MM-dd +#日志布局格式 +log4j.appender.R.layout=org.apache.log4j.PatternLayout diff --git a/health_service/src/main/resources/mybatis/mybatis-config.xml b/health_service/src/main/resources/mybatis/mybatis-config.xml new file mode 100644 index 0000000..2a266e7 --- /dev/null +++ b/health_service/src/main/resources/mybatis/mybatis-config.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + diff --git a/health_service/src/main/resources/static/html2canvas.js b/health_service/src/main/resources/static/html2canvas.js new file mode 100644 index 0000000..435c802 --- /dev/null +++ b/health_service/src/main/resources/static/html2canvas.js @@ -0,0 +1,3519 @@ +/* + html2canvas 0.5.0-beta3 + Copyright (c) 2016 Niklas von Hertzen + + Released under License +*/ + +!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.html2canvas=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o= 0x80 (not a basic code point)', + 'invalid-input': 'Invalid input' + }, + + /** Convenience shortcuts */ + baseMinusTMin = base - tMin, + floor = Math.floor, + stringFromCharCode = String.fromCharCode, + + /** Temporary variable */ + key; + + /*--------------------------------------------------------------------------*/ + + /** + * A generic error utility function. + * @private + * @param {String} type The error type. + * @returns {Error} Throws a `RangeError` with the applicable error message. + */ + function error(type) { + throw RangeError(errors[type]); + } + + /** + * A generic `Array#map` utility function. + * @private + * @param {Array} array The array to iterate over. + * @param {Function} callback The function that gets called for every array + * item. + * @returns {Array} A new array of values returned by the callback function. + */ + function map(array, fn) { + var length = array.length; + while (length--) { + array[length] = fn(array[length]); + } + return array; + } + + /** + * A simple `Array#map`-like wrapper to work with domain name strings. + * @private + * @param {String} domain The domain name. + * @param {Function} callback The function that gets called for every + * character. + * @returns {Array} A new string of characters returned by the callback + * function. + */ + function mapDomain(string, fn) { + return map(string.split(regexSeparators), fn).join('.'); + } + + /** + * Creates an array containing the numeric code points of each Unicode + * character in the string. While JavaScript uses UCS-2 internally, + * this function will convert a pair of surrogate halves (each of which + * UCS-2 exposes as separate characters) into a single code point, + * matching UTF-16. + * @see `punycode.ucs2.encode` + * @see + * @memberOf punycode.ucs2 + * @name decode + * @param {String} string The Unicode input string (UCS-2). + * @returns {Array} The new array of code points. + */ + function ucs2decode(string) { + var output = [], + counter = 0, + length = string.length, + value, + extra; + while (counter < length) { + value = string.charCodeAt(counter++); + if (value >= 0xD800 && value <= 0xDBFF && counter < length) { + // high surrogate, and there is a next character + extra = string.charCodeAt(counter++); + if ((extra & 0xFC00) == 0xDC00) { // low surrogate + output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); + } else { + // unmatched surrogate; only append this code unit, in case the next + // code unit is the high surrogate of a surrogate pair + output.push(value); + counter--; + } + } else { + output.push(value); + } + } + return output; + } + + /** + * Creates a string based on an array of numeric code points. + * @see `punycode.ucs2.decode` + * @memberOf punycode.ucs2 + * @name encode + * @param {Array} codePoints The array of numeric code points. + * @returns {String} The new Unicode string (UCS-2). + */ + function ucs2encode(array) { + return map(array, function(value) { + var output = ''; + if (value > 0xFFFF) { + value -= 0x10000; + output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); + value = 0xDC00 | value & 0x3FF; + } + output += stringFromCharCode(value); + return output; + }).join(''); + } + + /** + * Converts a basic code point into a digit/integer. + * @see `digitToBasic()` + * @private + * @param {Number} codePoint The basic numeric code point value. + * @returns {Number} The numeric value of a basic code point (for use in + * representing integers) in the range `0` to `base - 1`, or `base` if + * the code point does not represent a value. + */ + function basicToDigit(codePoint) { + if (codePoint - 48 < 10) { + return codePoint - 22; + } + if (codePoint - 65 < 26) { + return codePoint - 65; + } + if (codePoint - 97 < 26) { + return codePoint - 97; + } + return base; + } + + /** + * Converts a digit/integer into a basic code point. + * @see `basicToDigit()` + * @private + * @param {Number} digit The numeric value of a basic code point. + * @returns {Number} The basic code point whose value (when used for + * representing integers) is `digit`, which needs to be in the range + * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is + * used; else, the lowercase form is used. The behavior is undefined + * if `flag` is non-zero and `digit` has no uppercase form. + */ + function digitToBasic(digit, flag) { + // 0..25 map to ASCII a..z or A..Z + // 26..35 map to ASCII 0..9 + return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); + } + + /** + * Bias adaptation function as per section 3.4 of RFC 3492. + * http://tools.ietf.org/html/rfc3492#section-3.4 + * @private + */ + function adapt(delta, numPoints, firstTime) { + var k = 0; + delta = firstTime ? floor(delta / damp) : delta >> 1; + delta += floor(delta / numPoints); + for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) { + delta = floor(delta / baseMinusTMin); + } + return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); + } + + /** + * Converts a Punycode string of ASCII-only symbols to a string of Unicode + * symbols. + * @memberOf punycode + * @param {String} input The Punycode string of ASCII-only symbols. + * @returns {String} The resulting string of Unicode symbols. + */ + function decode(input) { + // Don't use UCS-2 + var output = [], + inputLength = input.length, + out, + i = 0, + n = initialN, + bias = initialBias, + basic, + j, + index, + oldi, + w, + k, + digit, + t, + /** Cached calculation results */ + baseMinusT; + + // Handle the basic code points: let `basic` be the number of input code + // points before the last delimiter, or `0` if there is none, then copy + // the first basic code points to the output. + + basic = input.lastIndexOf(delimiter); + if (basic < 0) { + basic = 0; + } + + for (j = 0; j < basic; ++j) { + // if it's not a basic code point + if (input.charCodeAt(j) >= 0x80) { + error('not-basic'); + } + output.push(input.charCodeAt(j)); + } + + // Main decoding loop: start just after the last delimiter if any basic code + // points were copied; start at the beginning otherwise. + + for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) { + + // `index` is the index of the next character to be consumed. + // Decode a generalized variable-length integer into `delta`, + // which gets added to `i`. The overflow checking is easier + // if we increase `i` as we go, then subtract off its starting + // value at the end to obtain `delta`. + for (oldi = i, w = 1, k = base; /* no condition */; k += base) { + + if (index >= inputLength) { + error('invalid-input'); + } + + digit = basicToDigit(input.charCodeAt(index++)); + + if (digit >= base || digit > floor((maxInt - i) / w)) { + error('overflow'); + } + + i += digit * w; + t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); + + if (digit < t) { + break; + } + + baseMinusT = base - t; + if (w > floor(maxInt / baseMinusT)) { + error('overflow'); + } + + w *= baseMinusT; + + } + + out = output.length + 1; + bias = adapt(i - oldi, out, oldi == 0); + + // `i` was supposed to wrap around from `out` to `0`, + // incrementing `n` each time, so we'll fix that now: + if (floor(i / out) > maxInt - n) { + error('overflow'); + } + + n += floor(i / out); + i %= out; + + // Insert `n` at position `i` of the output + output.splice(i++, 0, n); + + } + + return ucs2encode(output); + } + + /** + * Converts a string of Unicode symbols to a Punycode string of ASCII-only + * symbols. + * @memberOf punycode + * @param {String} input The string of Unicode symbols. + * @returns {String} The resulting Punycode string of ASCII-only symbols. + */ + function encode(input) { + var n, + delta, + handledCPCount, + basicLength, + bias, + j, + m, + q, + k, + t, + currentValue, + output = [], + /** `inputLength` will hold the number of code points in `input`. */ + inputLength, + /** Cached calculation results */ + handledCPCountPlusOne, + baseMinusT, + qMinusT; + + // Convert the input in UCS-2 to Unicode + input = ucs2decode(input); + + // Cache the length + inputLength = input.length; + + // Initialize the state + n = initialN; + delta = 0; + bias = initialBias; + + // Handle the basic code points + for (j = 0; j < inputLength; ++j) { + currentValue = input[j]; + if (currentValue < 0x80) { + output.push(stringFromCharCode(currentValue)); + } + } + + handledCPCount = basicLength = output.length; + + // `handledCPCount` is the number of code points that have been handled; + // `basicLength` is the number of basic code points. + + // Finish the basic string - if it is not empty - with a delimiter + if (basicLength) { + output.push(delimiter); + } + + // Main encoding loop: + while (handledCPCount < inputLength) { + + // All non-basic code points < n have been handled already. Find the next + // larger one: + for (m = maxInt, j = 0; j < inputLength; ++j) { + currentValue = input[j]; + if (currentValue >= n && currentValue < m) { + m = currentValue; + } + } + + // Increase `delta` enough to advance the decoder's state to , + // but guard against overflow + handledCPCountPlusOne = handledCPCount + 1; + if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { + error('overflow'); + } + + delta += (m - n) * handledCPCountPlusOne; + n = m; + + for (j = 0; j < inputLength; ++j) { + currentValue = input[j]; + + if (currentValue < n && ++delta > maxInt) { + error('overflow'); + } + + if (currentValue == n) { + // Represent delta as a generalized variable-length integer + for (q = delta, k = base; /* no condition */; k += base) { + t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); + if (q < t) { + break; + } + qMinusT = q - t; + baseMinusT = base - t; + output.push( + stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)) + ); + q = floor(qMinusT / baseMinusT); + } + + output.push(stringFromCharCode(digitToBasic(q, 0))); + bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); + delta = 0; + ++handledCPCount; + } + } + + ++delta; + ++n; + + } + return output.join(''); + } + + /** + * Converts a Punycode string representing a domain name to Unicode. Only the + * Punycoded parts of the domain name will be converted, i.e. it doesn't + * matter if you call it on a string that has already been converted to + * Unicode. + * @memberOf punycode + * @param {String} domain The Punycode domain name to convert to Unicode. + * @returns {String} The Unicode representation of the given Punycode + * string. + */ + function toUnicode(domain) { + return mapDomain(domain, function(string) { + return regexPunycode.test(string) + ? decode(string.slice(4).toLowerCase()) + : string; + }); + } + + /** + * Converts a Unicode string representing a domain name to Punycode. Only the + * non-ASCII parts of the domain name will be converted, i.e. it doesn't + * matter if you call it with a domain that's already in ASCII. + * @memberOf punycode + * @param {String} domain The domain name to convert, as a Unicode string. + * @returns {String} The Punycode representation of the given domain name. + */ + function toASCII(domain) { + return mapDomain(domain, function(string) { + return regexNonASCII.test(string) + ? 'xn--' + encode(string) + : string; + }); + } + + /*--------------------------------------------------------------------------*/ + + /** Define the public API */ + punycode = { + /** + * A string representing the current Punycode.js version number. + * @memberOf punycode + * @type String + */ + 'version': '1.2.4', + /** + * An object of methods to convert from JavaScript's internal character + * representation (UCS-2) to Unicode code points, and back. + * @see + * @memberOf punycode + * @type Object + */ + 'ucs2': { + 'decode': ucs2decode, + 'encode': ucs2encode + }, + 'decode': decode, + 'encode': encode, + 'toASCII': toASCII, + 'toUnicode': toUnicode + }; + + /** Expose `punycode` */ + // Some AMD build optimizers, like r.js, check for specific condition patterns + // like the following: + if ( + typeof define == 'function' && + typeof define.amd == 'object' && + define.amd + ) { + define('punycode', function() { + return punycode; + }); + } else if (freeExports && !freeExports.nodeType) { + if (freeModule) { // in Node.js or RingoJS v0.8.0+ + freeModule.exports = punycode; + } else { // in Narwhal or RingoJS v0.7.0- + for (key in punycode) { + punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]); + } + } + } else { // in Rhino or a web browser + root.punycode = punycode; + } + + }(this)); + + }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) + },{}],2:[function(_dereq_,module,exports){ + var log = _dereq_('./log'); + + function restoreOwnerScroll(ownerDocument, x, y) { + if (ownerDocument.defaultView && (x !== ownerDocument.defaultView.pageXOffset || y !== ownerDocument.defaultView.pageYOffset)) { + ownerDocument.defaultView.scrollTo(x, y); + } + } + + function cloneCanvasContents(canvas, clonedCanvas) { + try { + if (clonedCanvas) { + clonedCanvas.width = canvas.width; + clonedCanvas.height = canvas.height; + clonedCanvas.getContext("2d").putImageData(canvas.getContext("2d").getImageData(0, 0, canvas.width, canvas.height), 0, 0); + } + } catch(e) { + log("Unable to copy canvas content from", canvas, e); + } + } + + function cloneNode(node, javascriptEnabled) { + var clone = node.nodeType === 3 ? document.createTextNode(node.nodeValue) : node.cloneNode(false); + + var child = node.firstChild; + while(child) { + if (javascriptEnabled === true || child.nodeType !== 1 || child.nodeName !== 'SCRIPT') { + clone.appendChild(cloneNode(child, javascriptEnabled)); + } + child = child.nextSibling; + } + + if (node.nodeType === 1) { + clone._scrollTop = node.scrollTop; + clone._scrollLeft = node.scrollLeft; + if (node.nodeName === "CANVAS") { + cloneCanvasContents(node, clone); + } else if (node.nodeName === "TEXTAREA" || node.nodeName === "SELECT") { + clone.value = node.value; + } + } + + return clone; + } + + function initNode(node) { + if (node.nodeType === 1) { + node.scrollTop = node._scrollTop; + node.scrollLeft = node._scrollLeft; + + var child = node.firstChild; + while(child) { + initNode(child); + child = child.nextSibling; + } + } + } + + module.exports = function(ownerDocument, containerDocument, width, height, options, x ,y) { + var documentElement = cloneNode(ownerDocument.documentElement, options.javascriptEnabled); + var container = containerDocument.createElement("iframe"); + + container.className = "html2canvas-container"; + container.style.visibility = "hidden"; + container.style.position = "fixed"; + container.style.left = "-10000px"; + container.style.top = "0px"; + container.style.border = "0"; + container.width = width; + container.height = height; + container.scrolling = "no"; // ios won't scroll without it + containerDocument.body.appendChild(container); + + return new Promise(function(resolve) { + var documentClone = container.contentWindow.document; + + /* Chrome doesn't detect relative background-images assigned in inline