|
@@ -5,19 +5,26 @@ import cn.hnthyy.thmz.comment.UserLoginToken;
|
|
|
import cn.hnthyy.thmz.entity.his.MzPatientMi;
|
|
|
import cn.hnthyy.thmz.enums.YesNoEnum;
|
|
|
import cn.hnthyy.thmz.service.his.MzPatientMiService;
|
|
|
+import com.fasterxml.jackson.annotation.JsonFormat;
|
|
|
import lombok.Data;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.dao.DataIntegrityViolationException;
|
|
|
+import org.springframework.format.annotation.DateTimeFormat;
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
@RestController
|
|
|
@RequestMapping("/api/v1")
|
|
|
+@Slf4j
|
|
|
public class MedicalViewApiController {
|
|
|
@Autowired
|
|
|
private MzPatientMiService mzPatientMiService;
|
|
@@ -39,7 +46,7 @@ public class MedicalViewApiController {
|
|
|
*/
|
|
|
@UserLoginToken
|
|
|
@RequestMapping(value="/queryPatientInfo/{itemType}/{itemNo}",method = {RequestMethod.GET})
|
|
|
- public Map<String,Object> queryGkh(@PathVariable String itemType,@PathVariable String itemNo) {
|
|
|
+ public Map<String,Object> queryPatientInfo(@PathVariable String itemType,@PathVariable String itemNo) {
|
|
|
Map<String,Object> results = new HashMap<>();
|
|
|
if(StringUtils.isBlank(itemType)){
|
|
|
results.put("resultCode",-1);
|
|
@@ -83,8 +90,8 @@ public class MedicalViewApiController {
|
|
|
* @return
|
|
|
*/
|
|
|
@UserLoginToken
|
|
|
- @RequestMapping(value="/tjlb/{gkh}",method = {RequestMethod.POST})
|
|
|
- public Map<String,Object> tjlbView(Haicipat haicipat) {
|
|
|
+ @RequestMapping(value="/savePatientInfo",method = {RequestMethod.POST})
|
|
|
+ public Map<String,Object> savePatientInfo(Haicipat haicipat) {
|
|
|
Map<String,Object> results = new HashMap<>();
|
|
|
if(haicipat==null){
|
|
|
results.put("resultCode",-1);
|
|
@@ -106,12 +113,12 @@ public class MedicalViewApiController {
|
|
|
results.put("resultMessage","患者性别不能为空");
|
|
|
return results;
|
|
|
}
|
|
|
- if(StringUtils.isBlank(haicipat.getPatAge())){
|
|
|
+ if(haicipat.getPatAge()==null){
|
|
|
results.put("resultCode",-1);
|
|
|
results.put("resultMessage","患者年龄不能为空");
|
|
|
return results;
|
|
|
}
|
|
|
- if(StringUtils.isBlank(haicipat.getPatBirth())){
|
|
|
+ if(haicipat.getPatBirth()==null){
|
|
|
results.put("resultCode",-1);
|
|
|
results.put("resultMessage","患者出生日期不能为空");
|
|
|
return results;
|
|
@@ -151,13 +158,249 @@ public class MedicalViewApiController {
|
|
|
results.put("resultMessage","患者监护人证件号码不能为空");
|
|
|
return results;
|
|
|
}
|
|
|
+ List<MzPatientMi> mzPatientMis=mzPatientMiService.queryBySocialNo(haicipat.getPatIdNo(),null);
|
|
|
+ if(mzPatientMis!=null && mzPatientMis.size()>0){
|
|
|
+ results.put("resultCode", -1);
|
|
|
+ results.put("resultMessage", "保存病人信息失败,已经存在相同的身份证号码记录");
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ MzPatientMi mzPatientMi = new MzPatientMi();
|
|
|
+ mzPatientMi.setName(haicipat.getPatName());
|
|
|
+ mzPatientMi.setSex(MAN.equals(haicipat.getPatSex())?YesNoEnum.YES.code:2);
|
|
|
+ mzPatientMi.setAge(haicipat.getPatAge());
|
|
|
+ mzPatientMi.setBirthDay(haicipat.getPatBirth());
|
|
|
+ mzPatientMi.setAddress(haicipat.getPatAddress());
|
|
|
+ mzPatientMi.setPhoneNo(haicipat.getPatMobile());
|
|
|
+ mzPatientMi.setSocialNo(haicipat.getPatIdNo());
|
|
|
+ mzPatientMi.setContractHz(haicipat.getGuardIdNo());
|
|
|
+ try {
|
|
|
+ int num=mzPatientMiService.saveMzPatientMi(mzPatientMi);
|
|
|
+ if(num==1){
|
|
|
+ results.put("resultCode", 0);
|
|
|
+ results.put("resultMessage", "保存病人信息成功");
|
|
|
+ results.put("patCardType",1);
|
|
|
+ results.put("data",mzPatientMi.getPatientId());
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ results.put("resultCode", -1);
|
|
|
+ results.put("resultMessage", "保存病人信息失败");
|
|
|
+ return results;
|
|
|
+ }catch (Exception e){
|
|
|
+ if (e instanceof DataIntegrityViolationException){
|
|
|
+ if(e.getMessage().contains("将截断字符串或二进制数据")){
|
|
|
+ results.put("resultCode", -1);
|
|
|
+ results.put("resultMessage", "病人地址信息超长");
|
|
|
+ log.error("系统异常,错误信息{病人地址信息超长}");
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ e.printStackTrace();
|
|
|
+ results.put("resultCode", -1);
|
|
|
+ results.put("resultMessage", StringUtils.isBlank(e.getMessage())?"系统出错,请联系管理员":e.getMessage());
|
|
|
+ log.error("系统异常,错误信息{}", e.getMessage());
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- results.put("code",0);
|
|
|
- //results.put("data",medicalViewService.listByGkh(gkh));
|
|
|
- return results;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 绑定通知
|
|
|
+ * @param haicipat
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @UserLoginToken
|
|
|
+ @RequestMapping(value="/boundPatCardNoInfo",method = {RequestMethod.POST})
|
|
|
+ public Map<String,Object> boundPatCardNoInfo(Haicipat haicipat) {
|
|
|
+ Map<String,Object> results = new HashMap<>();
|
|
|
+ if(haicipat==null){
|
|
|
+ results.put("resultCode",-1);
|
|
|
+ results.put("resultMessage","建档参数为空");
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(haicipat.getPatType())){
|
|
|
+ results.put("resultCode",-1);
|
|
|
+ results.put("resultMessage","患者类型不能为空");
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(haicipat.getPatName())){
|
|
|
+ results.put("resultCode",-1);
|
|
|
+ results.put("resultMessage","患者姓名不能为空");
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(haicipat.getPatSex())){
|
|
|
+ results.put("resultCode",-1);
|
|
|
+ results.put("resultMessage","患者性别不能为空");
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ if(haicipat.getPatAge()==null){
|
|
|
+ results.put("resultCode",-1);
|
|
|
+ results.put("resultMessage","患者年龄不能为空");
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ if(haicipat.getPatBirth()==null){
|
|
|
+ results.put("resultCode",-1);
|
|
|
+ results.put("resultMessage","患者出生日期不能为空");
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(haicipat.getPatAddress())){
|
|
|
+ results.put("resultCode",-1);
|
|
|
+ results.put("resultMessage","患者地址不能为空");
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(haicipat.getPatMobile())){
|
|
|
+ results.put("resultCode",-1);
|
|
|
+ results.put("resultMessage","患者电话不能为空");
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ if(PERSON.equals(haicipat.getPatType()) && StringUtils.isBlank(haicipat.getPatIdType())){
|
|
|
+ results.put("resultCode",-1);
|
|
|
+ results.put("resultMessage","患者证件类型不能为空");
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ if(PERSON.equals(haicipat.getPatType()) && StringUtils.isBlank(haicipat.getPatIdNo())){
|
|
|
+ results.put("resultCode",-1);
|
|
|
+ results.put("resultMessage","患者证件号码不能为空");
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ if(CHILD.equals(haicipat.getPatType()) && StringUtils.isBlank(haicipat.getGuardName())){
|
|
|
+ results.put("resultCode",-1);
|
|
|
+ results.put("resultMessage","患者监护人姓名不能为空");
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ if(CHILD.equals(haicipat.getPatType()) && StringUtils.isBlank(haicipat.getGuardIdType())){
|
|
|
+ results.put("resultCode",-1);
|
|
|
+ results.put("resultMessage","患者监护人证件类型不能为空");
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ if(CHILD.equals(haicipat.getPatType()) && StringUtils.isBlank(haicipat.getGuardIdNo())){
|
|
|
+ results.put("resultCode",-1);
|
|
|
+ results.put("resultMessage","患者监护人证件号码不能为空");
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+
|
|
|
+ MzPatientMi mzPatientMi = new MzPatientMi();
|
|
|
+ mzPatientMi.setPatientId(haicipat.getPatCardNo());
|
|
|
+ mzPatientMi.setIcCardNo(haicipat.getPatCardNo());
|
|
|
+ try {
|
|
|
+ int num=mzPatientMiService.modifyMzPatientMi(mzPatientMi);
|
|
|
+ if(num==1){
|
|
|
+ results.put("resultCode", 0);
|
|
|
+ results.put("resultMessage", "绑定病人信息成功");
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ results.put("resultCode", -1);
|
|
|
+ results.put("resultMessage", "绑定病人信息失败");
|
|
|
+ return results;
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ results.put("resultCode", -1);
|
|
|
+ results.put("resultMessage", StringUtils.isBlank(e.getMessage())?"系统出错,请联系管理员":e.getMessage());
|
|
|
+ log.error("系统异常,错误信息{}", e.getMessage());
|
|
|
+ return results;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 取消绑定通知
|
|
|
+ * @param haicipat
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @UserLoginToken
|
|
|
+ @RequestMapping(value="/cancelBoundPatCardNoInfo",method = {RequestMethod.POST})
|
|
|
+ public Map<String,Object> cancelBoundPatCardNoInfo(Haicipat haicipat) {
|
|
|
+ Map<String,Object> results = new HashMap<>();
|
|
|
+ if(haicipat==null){
|
|
|
+ results.put("resultCode",-1);
|
|
|
+ results.put("resultMessage","建档参数为空");
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(haicipat.getPatType())){
|
|
|
+ results.put("resultCode",-1);
|
|
|
+ results.put("resultMessage","患者类型不能为空");
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(haicipat.getPatName())){
|
|
|
+ results.put("resultCode",-1);
|
|
|
+ results.put("resultMessage","患者姓名不能为空");
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(haicipat.getPatSex())){
|
|
|
+ results.put("resultCode",-1);
|
|
|
+ results.put("resultMessage","患者性别不能为空");
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ if(haicipat.getPatAge()==null){
|
|
|
+ results.put("resultCode",-1);
|
|
|
+ results.put("resultMessage","患者年龄不能为空");
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ if(haicipat.getPatBirth()==null){
|
|
|
+ results.put("resultCode",-1);
|
|
|
+ results.put("resultMessage","患者出生日期不能为空");
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(haicipat.getPatAddress())){
|
|
|
+ results.put("resultCode",-1);
|
|
|
+ results.put("resultMessage","患者地址不能为空");
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(haicipat.getPatMobile())){
|
|
|
+ results.put("resultCode",-1);
|
|
|
+ results.put("resultMessage","患者电话不能为空");
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ if(PERSON.equals(haicipat.getPatType()) && StringUtils.isBlank(haicipat.getPatIdType())){
|
|
|
+ results.put("resultCode",-1);
|
|
|
+ results.put("resultMessage","患者证件类型不能为空");
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ if(PERSON.equals(haicipat.getPatType()) && StringUtils.isBlank(haicipat.getPatIdNo())){
|
|
|
+ results.put("resultCode",-1);
|
|
|
+ results.put("resultMessage","患者证件号码不能为空");
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ if(CHILD.equals(haicipat.getPatType()) && StringUtils.isBlank(haicipat.getGuardName())){
|
|
|
+ results.put("resultCode",-1);
|
|
|
+ results.put("resultMessage","患者监护人姓名不能为空");
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ if(CHILD.equals(haicipat.getPatType()) && StringUtils.isBlank(haicipat.getGuardIdType())){
|
|
|
+ results.put("resultCode",-1);
|
|
|
+ results.put("resultMessage","患者监护人证件类型不能为空");
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ if(CHILD.equals(haicipat.getPatType()) && StringUtils.isBlank(haicipat.getGuardIdNo())){
|
|
|
+ results.put("resultCode",-1);
|
|
|
+ results.put("resultMessage","患者监护人证件号码不能为空");
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ int num=mzPatientMiService.clearIcCardNo(haicipat.getPatCardNo());
|
|
|
+ if(num==1){
|
|
|
+ results.put("resultCode", 0);
|
|
|
+ results.put("resultMessage", "取消绑定成功");
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ results.put("resultCode", -1);
|
|
|
+ results.put("resultMessage", "取消绑定失败");
|
|
|
+ return results;
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ results.put("resultCode", -1);
|
|
|
+ results.put("resultMessage", StringUtils.isBlank(e.getMessage())?"系统出错,请联系管理员":e.getMessage());
|
|
|
+ log.error("系统异常,错误信息{}", e.getMessage());
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 海慈参数类
|
|
|
*/
|
|
@@ -170,9 +413,11 @@ public class MedicalViewApiController {
|
|
|
//性别 M:男,F:女
|
|
|
private String patSex;
|
|
|
//年龄
|
|
|
- private String patAge;
|
|
|
+ private Integer patAge;
|
|
|
//出生日期
|
|
|
- private String patBirth;
|
|
|
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
|
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
|
|
+ private Date patBirth;
|
|
|
//地址
|
|
|
private String patAddress;
|
|
|
//电话
|
|
@@ -187,8 +432,17 @@ public class MedicalViewApiController {
|
|
|
private String guardIdType;
|
|
|
//监护人证件号码 患者类型为“2”儿童时,该项必输
|
|
|
private String guardIdNo;
|
|
|
+ //诊疗卡类型 1:院内诊疗卡 2:社保卡 3:医保卡 4:区域健康卡
|
|
|
+ private Integer patCardType;
|
|
|
+ //诊疗卡号码
|
|
|
+ private String patCardNo;
|
|
|
+ //绑定渠道类型 WX:微信公众服务号 ZFB:支付宝钱包服务窗
|
|
|
+ private String channelType;
|
|
|
+ //渠道用户 ID 唯一标识微信公众服务号或者支付宝钱包 服务窗用户的 id,医院如需存储,需要保留 200 位的字段
|
|
|
+ private String openId;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
|
}
|