|
@@ -1,16 +1,18 @@
|
|
|
package cn.hnthyy.thmz.controller;
|
|
|
|
|
|
+import cn.hnthyy.thmz.Utils.IDCardUtil;
|
|
|
+import cn.hnthyy.thmz.Utils.StringUtil;
|
|
|
import cn.hnthyy.thmz.comment.UserLoginToken;
|
|
|
+import cn.hnthyy.thmz.entity.his.MzPatientMi;
|
|
|
import cn.hnthyy.thmz.service.his.MzPatientMiService;
|
|
|
+import cn.hnthyy.thmz.service.his.MzSerialNoService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
@Slf4j
|
|
@@ -18,9 +20,12 @@ import java.util.Map;
|
|
|
public class MzPatientMiController {
|
|
|
@Autowired
|
|
|
private MzPatientMiService mzPatientMiService;
|
|
|
+ @Autowired
|
|
|
+ private MzSerialNoService mzSerialNoService;
|
|
|
|
|
|
/**
|
|
|
* 根据病人就诊卡号查询病人信息
|
|
|
+ *
|
|
|
* @return
|
|
|
*/
|
|
|
@UserLoginToken
|
|
@@ -29,7 +34,7 @@ public class MzPatientMiController {
|
|
|
log.info("根据病人就诊卡号查询病人信息");
|
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
|
try {
|
|
|
- if(StringUtils.isBlank(icCardNo)){
|
|
|
+ if (StringUtils.isBlank(icCardNo)) {
|
|
|
resultMap.put("code", -1);
|
|
|
resultMap.put("message", "就诊卡号不能为空");
|
|
|
return resultMap;
|
|
@@ -38,40 +43,40 @@ public class MzPatientMiController {
|
|
|
resultMap.put("message", "查询病人信息成功");
|
|
|
resultMap.put("data", mzPatientMiService.queryByIcCardNo(icCardNo));
|
|
|
return resultMap;
|
|
|
- }catch (Exception e){
|
|
|
+ } catch (Exception e) {
|
|
|
resultMap.put("code", -1);
|
|
|
resultMap.put("message", "系统出错,请联系管理员");
|
|
|
- log.error("系统异常,错误信息{}",e.getMessage());
|
|
|
+ log.error("系统异常,错误信息{}", e.getMessage());
|
|
|
return resultMap;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 根据病人姓名查询病人信息
|
|
|
+ *
|
|
|
* @return
|
|
|
*/
|
|
|
@UserLoginToken
|
|
|
@RequestMapping(value = "/getPatientMiByName", method = {RequestMethod.GET})
|
|
|
- public Map<String, Object> getPatientMiByName(@RequestParam("name") String name,@RequestParam("pageIndex") Integer pageIndex) {
|
|
|
+ public Map<String, Object> getPatientMiByName(@RequestParam("name") String name, @RequestParam("pageIndex") Integer pageIndex) {
|
|
|
log.info("根据病人姓名查询病人信息");
|
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
|
try {
|
|
|
- if(StringUtils.isBlank(name)){
|
|
|
- name=null;
|
|
|
+ if (StringUtils.isBlank(name)) {
|
|
|
+ name = null;
|
|
|
}
|
|
|
- if(pageIndex==null){
|
|
|
- pageIndex=1;
|
|
|
+ if (pageIndex == null) {
|
|
|
+ pageIndex = 1;
|
|
|
}
|
|
|
resultMap.put("code", 0);
|
|
|
resultMap.put("message", "查询病人信息成功");
|
|
|
- resultMap.put("data", mzPatientMiService.queryByNameFuzzy(name,pageIndex,10));
|
|
|
+ resultMap.put("data", mzPatientMiService.queryByNameFuzzy(name, pageIndex, 10));
|
|
|
return resultMap;
|
|
|
- }catch (Exception e){
|
|
|
+ } catch (Exception e) {
|
|
|
resultMap.put("code", -1);
|
|
|
resultMap.put("message", "系统出错,请联系管理员");
|
|
|
- log.error("系统异常,错误信息{}",e.getMessage());
|
|
|
+ log.error("系统异常,错误信息{}", e.getMessage());
|
|
|
return resultMap;
|
|
|
}
|
|
|
}
|
|
@@ -79,6 +84,7 @@ public class MzPatientMiController {
|
|
|
|
|
|
/**
|
|
|
* 根据病人ID查询病人信息
|
|
|
+ *
|
|
|
* @return
|
|
|
*/
|
|
|
@UserLoginToken
|
|
@@ -86,7 +92,7 @@ public class MzPatientMiController {
|
|
|
public Map<String, Object> getByPatientId(@RequestParam("patientId") String patientId) {
|
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
|
try {
|
|
|
- if(StringUtils.isBlank(patientId)){
|
|
|
+ if (StringUtils.isBlank(patientId)) {
|
|
|
resultMap.put("code", -1);
|
|
|
resultMap.put("message", "病人id不能为空");
|
|
|
return resultMap;
|
|
@@ -95,10 +101,104 @@ public class MzPatientMiController {
|
|
|
resultMap.put("message", "根据病人ID查询病人信息成功");
|
|
|
resultMap.put("data", mzPatientMiService.queryByPatientId(patientId));
|
|
|
return resultMap;
|
|
|
- }catch (Exception e){
|
|
|
+ } catch (Exception e) {
|
|
|
resultMap.put("code", -1);
|
|
|
resultMap.put("message", "系统出错,请联系管理员");
|
|
|
- log.error("系统异常,错误信息{}",e.getMessage());
|
|
|
+ log.error("系统异常,错误信息{}", e.getMessage());
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增病人信息
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @UserLoginToken
|
|
|
+ @RequestMapping(value = "/savePatient", method = {RequestMethod.POST})
|
|
|
+ public Map<String, Object> savePatient(@RequestBody MzPatientMi mzPatientMi) {
|
|
|
+ Map<String, Object> resultMap = new HashMap<>();
|
|
|
+ try {
|
|
|
+ if (mzPatientMi == null) {
|
|
|
+ resultMap.put("code", -1);
|
|
|
+ resultMap.put("message", "病人信息不能为空");
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(mzPatientMi.getName())) {
|
|
|
+ resultMap.put("code", -1);
|
|
|
+ resultMap.put("message", "病人姓名不能为空");
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
+ if (mzPatientMi.getAge() == null) {
|
|
|
+ resultMap.put("code", -1);
|
|
|
+ resultMap.put("message", "病人年龄不能为空");
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
+ if (mzPatientMi.getSex() == null) {
|
|
|
+ resultMap.put("code", -1);
|
|
|
+ resultMap.put("message", "病人性别不能为空");
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
+ if (mzPatientMi.getBirthDay() == null) {
|
|
|
+ resultMap.put("code", -1);
|
|
|
+ resultMap.put("message", "病人出生日期不能为空");
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(mzPatientMi.getIcCardNo())) {
|
|
|
+ resultMap.put("code", -1);
|
|
|
+ resultMap.put("message", "病人卡号不能为空");
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(mzPatientMi.getPhoneNo())) {
|
|
|
+ resultMap.put("code", -1);
|
|
|
+ resultMap.put("message", "病人手机号码不能为空");
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(mzPatientMi.getResponseType())) {
|
|
|
+ resultMap.put("code", -1);
|
|
|
+ resultMap.put("message", "病人性质不能为空");
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(mzPatientMi.getSocialNo())) {
|
|
|
+ resultMap.put("code", -1);
|
|
|
+ resultMap.put("message", "病人身份证号码不能为空");
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
+ //校验身份证号码格式
|
|
|
+ String checkResult = IDCardUtil.IdentityCardVerification(mzPatientMi.getSocialNo());
|
|
|
+ if (StringUtils.isNotBlank(checkResult)) {
|
|
|
+ resultMap.put("code", -1);
|
|
|
+ resultMap.put("message", checkResult);
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
+ //校验手机号码格式
|
|
|
+ checkResult = StringUtil.isPhone(mzPatientMi.getPhoneNo());
|
|
|
+ if (StringUtils.isNotBlank(checkResult)) {
|
|
|
+ resultMap.put("code", -1);
|
|
|
+ resultMap.put("message", checkResult);
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
+ List<MzPatientMi> mzPatientMis=mzPatientMiService.queryBySocialNo(mzPatientMi.getSocialNo());
|
|
|
+ if(mzPatientMis!=null && mzPatientMis.size()>0){
|
|
|
+ resultMap.put("code", -1);
|
|
|
+ resultMap.put("message", "保存病人信息失败,已经存在相同的身份证号码记录");
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
+ int num=mzPatientMiService.saveMzPatientMi(mzPatientMi);
|
|
|
+ if(num==1){
|
|
|
+ resultMap.put("code", 0);
|
|
|
+ resultMap.put("message", "保存病人信息成功");
|
|
|
+ resultMap.put("data",mzPatientMi);
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
+ resultMap.put("code", -1);
|
|
|
+ resultMap.put("message", "保存病人信息失败");
|
|
|
+ return resultMap;
|
|
|
+ } catch (Exception e) {
|
|
|
+ resultMap.put("code", -1);
|
|
|
+ resultMap.put("message", StringUtils.isBlank(e.getMessage())?"系统出错,请联系管理员":e.getMessage());
|
|
|
+ log.error("系统异常,错误信息{}", e.getMessage());
|
|
|
return resultMap;
|
|
|
}
|
|
|
}
|