枚举类显示查询相关更新
This commit is contained in:
@@ -4,7 +4,6 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.core.common.utils.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -12,11 +11,16 @@ import org.springframework.web.bind.annotation.*;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.enums.AssignSeqEnum;
|
||||
import com.core.common.utils.AssignSeqUtil;
|
||||
import com.core.common.utils.ChineseConvertUtils;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
import com.core.common.utils.StringUtils;
|
||||
import com.core.common.utils.bean.BeanUtils;
|
||||
import com.openhis.administration.domain.Patient;
|
||||
import com.openhis.administration.service.IPatientService;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.*;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.web.patientmanage.dto.PatientInformationDto;
|
||||
import com.openhis.web.patientmanage.dto.PatientListDto;
|
||||
import com.openhis.web.patientmanage.mapper.PatientManageMapper;
|
||||
@@ -171,17 +175,18 @@ public class PatientInformationController {
|
||||
// 使用基础采番,设置病人ID
|
||||
String code = assignSeqUtil.getSeq(AssignSeqEnum.PATIENT_NUM.getPrefix());
|
||||
patient.setBusNo(code);
|
||||
// 设置生日
|
||||
patient.setBirthDate(patientService.extractBirthday(patient.getIdCard()));
|
||||
|
||||
// 设置机构ID
|
||||
patient.setOrganizationId(organizationId);
|
||||
// 设置生日
|
||||
patient.setBirthDate(patientService.extractBirthday(patient.getIdCard()));
|
||||
// 设置拼音首拼
|
||||
patient.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(patient.getName()));
|
||||
// 设置五笔首拼
|
||||
patient.setWbStr(ChineseConvertUtils.toWBFirstLetter(patient.getName()));
|
||||
// 设置地址
|
||||
String fullAddress = stringUtils.joinStrings(patient.getAddressProvince(),
|
||||
patient.getAddressCity(), patient.getAddressDistrict(), patient.getAddressStreet(),patient.getAddress());
|
||||
String fullAddress = stringUtils.joinStrings(patient.getAddressProvince(), patient.getAddressCity(),
|
||||
patient.getAddressDistrict(), patient.getAddressStreet(), patient.getAddress());
|
||||
patient.setAddress(fullAddress);
|
||||
|
||||
// 调用服务层保存病人信息
|
||||
@@ -212,18 +217,15 @@ public class PatientInformationController {
|
||||
// 设置五笔首拼
|
||||
patient.setWbStr(ChineseConvertUtils.toWBFirstLetter(patient.getName()));
|
||||
// 设置地址
|
||||
String fullAddress = stringUtils.joinStrings(patient.getAddressProvince(),
|
||||
patient.getAddressCity(), patient.getAddressDistrict(), patient.getAddressStreet(),patient.getAddress());
|
||||
String fullAddress = stringUtils.joinStrings(patient.getAddressProvince(), patient.getAddressCity(),
|
||||
patient.getAddressDistrict(), patient.getAddressStreet(), patient.getAddress());
|
||||
patient.setAddress(fullAddress);
|
||||
|
||||
// 调用服务层更新病人信息
|
||||
boolean updateSuccess = patientService.updateById(patient);
|
||||
return patientService.updateById(patient)
|
||||
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00001, new Object[] {"病人信息"}))
|
||||
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
|
||||
if (!updateSuccess) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
|
||||
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00001, new Object[] {"病人信息"}));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -249,6 +251,24 @@ public class PatientInformationController {
|
||||
Page<PatientInformationDto> patientInformationPage = new Page<>(pageNo, pageSize, total);
|
||||
patientInformationPage.setRecords(listPatients);
|
||||
|
||||
// 性别枚举类回显赋值
|
||||
patientInformationPage.getRecords().forEach(
|
||||
e -> e.setGenderEnum_text(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum())));
|
||||
// 婚姻状态枚举类回显赋值
|
||||
patientInformationPage.getRecords().forEach(
|
||||
e -> e.setMaritalStatusEnum_text(EnumUtils.getInfoByValue(MaritalStatus.class, e.getMaritalStatusEnum())));
|
||||
// 职业编码枚举类回显赋值
|
||||
patientInformationPage.getRecords()
|
||||
.forEach(e -> e.setPrfsEnum_text(EnumUtils.getInfoByValue(OccupationType.class, e.getPrfsEnum())));
|
||||
// 血型ABO枚举类回显赋值
|
||||
patientInformationPage.getRecords()
|
||||
.forEach(e -> e.setBloodAbo_text(EnumUtils.getInfoByValue(BloodTypeABO.class, e.getBloodAbo())));
|
||||
// 血型RH枚举类回显赋值
|
||||
patientInformationPage.getRecords()
|
||||
.forEach(e -> e.setBloodRh_text(EnumUtils.getInfoByValue(BloodTypeRH.class, e.getBloodRh())));
|
||||
// 家庭关系枚举类回显赋值
|
||||
patientInformationPage.getRecords().forEach(e -> e
|
||||
.setLinkRelationCode_text(EnumUtils.getInfoByValue(FamilyRelationshipType.class, e.getLinkRelationCode())));
|
||||
return R.ok(patientInformationPage);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,13 @@ package com.openhis.web.patientmanage.dto;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.openhis.common.enums.AdministrativeGender;
|
||||
import com.openhis.common.enums.MaritalStatus;
|
||||
import com.openhis.common.enums.OccupationType;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -17,6 +21,8 @@ import lombok.Data;
|
||||
@Data
|
||||
public class PatientInformationDto {
|
||||
|
||||
/** ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/** 活动标记 */
|
||||
@@ -26,6 +32,7 @@ public class PatientInformationDto {
|
||||
private Integer tempFlag;
|
||||
|
||||
/** 患者姓名 */
|
||||
@NotBlank(message = "患者姓名不能为空")
|
||||
private String name;
|
||||
|
||||
/** 患者其他名称 */
|
||||
@@ -36,6 +43,7 @@ public class PatientInformationDto {
|
||||
|
||||
/** 性别编码 */
|
||||
private Integer genderEnum;
|
||||
private String genderEnum_text;
|
||||
|
||||
/** 生日 */
|
||||
private Date birthDate;
|
||||
@@ -45,11 +53,17 @@ public class PatientInformationDto {
|
||||
|
||||
/** 婚姻状态 */
|
||||
private Integer maritalStatusEnum;
|
||||
private String maritalStatusEnum_text;
|
||||
|
||||
/** 职业编码 */
|
||||
private Integer prfsEnum;
|
||||
private String prfsEnum_text;
|
||||
|
||||
/** 电话 */
|
||||
@NotNull(message = "电话不能为空")
|
||||
@NotBlank(message = "电话不能为空")
|
||||
@Size(min = 11, max = 11, message = "电话长度必须为11位")
|
||||
@Pattern(regexp = "^1[3-9]\\d{9}$", message = "电话格式不正确")
|
||||
private String phone;
|
||||
|
||||
/** 地址 */
|
||||
@@ -74,6 +88,9 @@ public class PatientInformationDto {
|
||||
private String nationalityCode;
|
||||
|
||||
/** 身份证号 */
|
||||
@NotNull(message = "身份证号不能为空")
|
||||
@Size(min = 18, max = 18, message = "身份证号必须是18位")
|
||||
@Pattern(regexp = "^[0-9Xx]{18}$", message = "身份证号格式不正确")
|
||||
private String idCard;
|
||||
|
||||
/** 拼音码 */
|
||||
@@ -84,9 +101,11 @@ public class PatientInformationDto {
|
||||
|
||||
/** 血型ABO */
|
||||
private Integer bloodAbo;
|
||||
private String bloodAbo_text;
|
||||
|
||||
/** 血型RH */
|
||||
private Integer bloodRh;
|
||||
private String bloodRh_text;
|
||||
|
||||
/** 工作单位 */
|
||||
private String workCompany;
|
||||
@@ -102,8 +121,11 @@ public class PatientInformationDto {
|
||||
|
||||
/** 联系人关系 */
|
||||
private Integer linkRelationCode;
|
||||
private String linkRelationCode_text;
|
||||
|
||||
/** 联系人电话 */
|
||||
@Size(min = 11, max = 11, message = "电话长度必须为11位")
|
||||
@Pattern(regexp = "^1[3-9]\\d{9}$", message = "电话格式不正确")
|
||||
private String linkTelcom;
|
||||
|
||||
/** 其他联系人 */
|
||||
@@ -118,7 +140,4 @@ public class PatientInformationDto {
|
||||
/** 创建时间 */
|
||||
private Date createTime;
|
||||
|
||||
/** 删除标识 */
|
||||
// 0 为未删除,1 为删除
|
||||
private String deleteFlag;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.openhis.web.patientmanage.mapper.PatientManageMapper">
|
||||
<!-- 病人信息相关查询-->
|
||||
<select id="getPatientPage" resultType="com.openhis.web.patientmanage.dto.PatientInformationDto">
|
||||
SELECT
|
||||
pt.id,
|
||||
@@ -97,4 +98,7 @@
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!-- 门诊记录相关查询-->
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user