Browse Source

完成患者管理模块单一身份证不重复的限制

ry
loser 1 year ago
parent
commit
6c4d36e9ad
  1. 3
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/CheckManageController.java
  2. 14
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/PatientManageController.java
  3. 26
      ruoyi-admin/src/main/resources/templates/check/checkManage/add.html
  4. 48
      ruoyi-admin/src/main/resources/templates/patient/patientManage/add.html
  5. 47
      ruoyi-admin/src/main/resources/templates/patient/patientManage/detail.html
  6. 83
      ruoyi-admin/src/main/resources/templates/patient/patientManage/edit.html
  7. 15
      ruoyi-admin/src/main/resources/templates/patient/patientManage/patientManage.html
  8. 3
      ruoyi-system/src/main/java/com/ruoyi/system/domain/PatientManage.java
  9. 7
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/PatientManageMapper.java
  10. 8
      ruoyi-system/src/main/java/com/ruoyi/system/service/IPatientManageService.java
  11. 18
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/PatientManageServiceImpl.java
  12. 9
      ruoyi-system/src/main/resources/mapper/PatientManageMapper.xml

3
ruoyi-admin/src/main/java/com/ruoyi/web/controller/CheckManageController.java

@ -1,10 +1,13 @@
package com.ruoyi.web.controller; package com.ruoyi.web.controller;
import java.util.List; import java.util.List;
import com.ruoyi.common.utils.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;

14
ruoyi-admin/src/main/java/com/ruoyi/web/controller/PatientManageController.java

@ -1,10 +1,13 @@
package com.ruoyi.web.controller; package com.ruoyi.web.controller;
import java.util.List; import java.util.List;
import com.ruoyi.common.utils.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@ -73,8 +76,13 @@ public class PatientManageController extends BaseController
@Log(title = "患者管理", businessType = BusinessType.INSERT) @Log(title = "患者管理", businessType = BusinessType.INSERT)
@PostMapping("/add") @PostMapping("/add")
@ResponseBody @ResponseBody
public AjaxResult addSave(PatientManage patientManage) public AjaxResult addSave(@Validated PatientManage patientManage)
{ {
if (StringUtils.isNotEmpty(patientManage.getPatientIdCard()) && !patientManageService.checkPatientIdCardUnique(patientManage))
{
return error("新增患者'" + patientManage.getPatientName() + "'失败,身份证已存在");
}
return toAjax(patientManageService.insertPatientManage(patientManage)); return toAjax(patientManageService.insertPatientManage(patientManage));
} }
@ -99,6 +107,10 @@ public class PatientManageController extends BaseController
@ResponseBody @ResponseBody
public AjaxResult editSave(PatientManage patientManage) public AjaxResult editSave(PatientManage patientManage)
{ {
if (StringUtils.isNotEmpty(patientManage.getPatientIdCard()) && !patientManageService.checkPatientIdCardUnique(patientManage))
{
return error("新增患者'" + patientManage.getPatientName() + "'失败,身份证已存在");
}
return toAjax(patientManageService.updatePatientManage(patientManage)); return toAjax(patientManageService.updatePatientManage(patientManage));
} }

26
ruoyi-admin/src/main/resources/templates/check/checkManage/add.html

@ -122,20 +122,28 @@
checkName:{ checkName:{
isName:true, isName:true,
}, },
currentPosition:{
},
healthState:{
},
checkDatetime:{
},
temperature:{ temperature:{
isTemperature:true isTemperature:true
}, },
checkPhonenumber:{ checkPhonenumber:{
isPhone:true, isPhone:true,
remote: {
url: prefix + "/checkPatientIdCardUnique",
type: "post",
dataType: "json",
data: {
"checkPhonenumber": function () {
return $.common.trim($("#checkPhonenumber").val());
}
}
},
}, },
description: { messages: {
"checkPhonenumber":{
remote: "电话号码已经存在"
}
}, },
}, },
@ -167,8 +175,8 @@
maximumAge : 1000 maximumAge : 1000
} }
if (navigator.geolocation) { if (navigator.geolocation) {
//浏览器支持geolocation //浏览器支持geolocationC
navigator.geolocation.getcurrentPosition(onSuccess, onError, options); navigator.geolocation.getCurrentPosition(onSuccess, onError, options);
} else { } else {
//浏览器不支持geolocation //浏览器不支持geolocation
alert('您的浏览器不支持地理位置定位'); alert('您的浏览器不支持地理位置定位');

48
ruoyi-admin/src/main/resources/templates/patient/patientManage/add.html

@ -28,7 +28,7 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">患者身份证:</label> <label class="col-sm-3 control-label">患者身份证:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="patientIdCard" class="form-control" type="text" maxlength="18"> <input name="patientIdCard" class="form-control" type="text" maxlength="18" placeholder="填写18位身份证号码">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -78,7 +78,7 @@
<label class="col-sm-3 control-label">目前诊断症状:</label> <label class="col-sm-3 control-label">目前诊断症状:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<div class="input-group date"> <div class="input-group date">
<input name="isDiagnosed" class="form-control" placeholder="目前诊断症状" type="text"> <input name="isDiagnosed" class="form-control" placeholder="目前诊断症状" type="text" maxlength="1">
<span class="input-group-addon"><i class="fa fa-hospital-o"></i></span> <span class="input-group-addon"><i class="fa fa-hospital-o"></i></span>
</div> </div>
</div> </div>
@ -87,29 +87,45 @@
</div> </div>
<th:block th:include="include :: footer" /> <th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" /> <th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript"> <script th:inline="javascript"+>
var prefix = ctx + "patient/patientManage" var prefix = ctx + "patient/patientManage"
$("#form-patientManage-add").validate({ $("#form-patientManage-add").validate({
focusCleanup: true onkeyup: false,
rules:{
patientName:{
isName:true,
},
temperature:{
isTemperature:true
},
patientIdCard:{
isIdentity18:true,
remote: {
url: prefix + "/checkPatientIdCardUnique",
type: "post",
dataType: "json",
data: {
"patientIdCard": function () {
return $.common.trim($("#patientIdCard").val());
}
}
},
},
messages: {
"patientIdCard":{
remote: "身份证号码已经存在"
}
},
focusCleanup: true
},
}); });
function submitHandler() {
if ($.validate.form()) {
var data = $("#form-patientManage-add").serializeArray();
var isTouch = $("input[id='isTouch']").is(':checked') == true ? 0 : 1;
var isHigh = $("input[id='isHigh']").is(':checked') == true ? 0 : 1;
data.push({"patientName": "isTouch", "value": isTouch});
data.push({"patientName": "isHigh", "value": isHigh});
$.operate.saveTab(prefix+"/add", data);
// $.operate.save(prefix + "/add", $('#form-patientManage-add').serialize());
}
}
$("input[name='diagnosedTime']").datetimepicker({ $("input[name='diagnosedTime']").datetimepicker({
format: "yyyy-mm-dd", format: "yyyy-mm-dd",
minView: "month", minView: "month",
autoclose: true autoclose: true
}); });
</script> </script>
</body> </body>
</html> </html>

47
ruoyi-admin/src/main/resources/templates/patient/patientManage/detail.html

@ -9,69 +9,64 @@
<form class="form-horizontal m-t" id="form-patientManage-detail"> <form class="form-horizontal m-t" id="form-patientManage-detail">
<div class="form-group"> <div class="form-group">
<label class="col-sm-2 control-label">姓名:</label> <label class="col-sm-3 control-label">姓名:</label>
<div class="form-control-static" th:text="${patientManage.patientName}"></div> <div class="form-control-static" th:text="${patientManage.patientName}"></div>
</div> </div>
<div class="form-group">
<label class="col-sm-2 control-label">最近感染地区:</label>
<div class="form-control-static" th:text="${patientManage.currentLocation}"></div>
</div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-2 control-label">性别:</label> <label class="col-sm-3 control-label">性别:</label>
<div class="form-control-static" th:text="${patientManage.patientSex}"></div> <div class="form-control-static" th:text="${patientManage.patientSex}"></div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-2 control-label">感染时间:</label> <label class="col-sm-3 control-label">感染时间:</label>
<div class="form-control-static" th:text="${patientManage.diagnosedTime}"></div> <div class="form-control-static" th:text="${patientManage.diagnosedTime}"></div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-2 control-label is-required">体温:</label> <label class="col-sm-3 control-label is-required">体温:</label>
<div class="form-control-static" th:text="${patientManage.temperature}"></div> <div class="form-control-static" th:text="${patientManage.temperature}"></div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-2 control-label">患者年龄:</label> <label class="col-sm-3 control-label">患者年龄:</label>
<div class="form-control-static" th:text="${patientManage.patientAge}"></div> <div class="form-control-static" th:text="${patientManage.patientAge}"></div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-2 control-label is-required">身份证:</label> <label class="col-sm-3 control-label ">身份证:</label>
<div class="form-control-static" th:text="${patientManage.patientIdCard}"></div> <div class="form-control-static" th:text="${patientManage.patientIdCard}"></div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-2 control-label ">确诊状态:</label> <label class="col-sm-3 control-label ">确诊状态:</label>
<div class="form-control-static" th:text="${patientManage.isDiagnosed}"></div> <div class="form-control-static" th:text="${patientManage.isDiagnosed}"></div>
</div> </div>
<!-- <div class="form-group" >--> <div class="form-group" >
<!-- <label class="col-sm-2 control-label">是否接触密接:</label>--> <label class="col-sm-3 control-label">是否接触密接:</label>
<!-- <div class="form-control-static" th:text="${patientManage.idTouch}"></div>--> <div class="form-control-static" th:text="${patientManage.isTouch}"></div>
<!-- </div>--> </div>
<!-- <div class="form-group">-->
<!-- <label class="col-sm-2 control-label">是否去过高风险:</label>-->
<!-- <div class="form-control-static" th:text="${patientManage.isHigh}"></div>-->
<!-- </div>-->
<div class="form-group">
<label class="col-sm-3 control-label">是否去过高风险:</label>
<div class="form-control-static" th:text="${patientManage.isHigh}"></div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">最近感染地区:</label>
<div class="form-control-static" th:text="${patientManage.currentLocation}"</div>
</div>
<div class="form-group"> <div class="form-group">
<label class="col-xs-2 control-label">备注:</label> <label class="col-xs-2 control-label">备注:</label>
<div class="form-control-static" th:text="${patientManage.description}"></div> <div class="form-control-static" th:text="${patientManage.description}"></div>
</div> </div>
</form> </form>
</div> </div>

83
ruoyi-admin/src/main/resources/templates/patient/patientManage/edit.html

@ -21,27 +21,33 @@
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">年龄:</label>
<div class="col-sm-8">
<input name="patientAge" th:field="*{patientAge}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">患者身份证:</label> <label class="col-sm-3 control-label">患者身份证:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="patientIdCard" th:field="*{patientIdCard}" class="form-control" type="text"> <input name="patientIdCard" th:field="*{patientIdCard}" class="form-control" type="text" maxlength="18">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">备注</label> <label class="col-sm-3 control-label">当天体温</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="description" th:field="*{description}" class="form-control" type="text"> <input name="temperature" th:field="*{temperature}" class="form-control" type="text">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">最近感染地区</label> <label class="col-sm-3 control-label">备注</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="currentLocation" th:field="*{currentLocation}" class="form-control" type="text"> <input name="description" th:field="*{description}" class="form-control" type="text">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">当天体温</label> <label class="col-sm-3 control-label">最近感染地区</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="temperature" th:field="*{temperature}" class="form-control" type="text"> <input name="currentLocation" th:field="*{currentLocation}" class="form-control" type="text">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -53,27 +59,27 @@
</div> </div>
</div> </div>
</div> </div>
<div class="form-group" style="display: flex"> <!-- <div class="form-group" style="display: flex">-->
<label class="col-sm-3 control-label">是否为密接人员:</label> <!-- <label class="col-sm-3 control-label">是否为密接人员:</label>-->
<div class="col-sm-2"> <!-- <div class="col-sm-2">-->
<label class="toggle-switch switch-solid"> <!-- <label class="toggle-switch switch-solid">-->
<input id="isTouch" th:field="*{temperature}" class="form-control" type="checkbox"> <!-- <input id="isTouch" th:field="*{isTouch}" class="form-control" type="checkbox">-->
<span></span> <!-- <span></span>-->
</label> <!-- </label>-->
</div> <!-- </div>-->
<label class="col-sm-3 control-label">是否去过高风险地区:</label> <!-- <label class="col-sm-3 control-label">是否去过高风险地区:</label>-->
<div class="col-sm-2"> <!-- <div class="col-sm-2">-->
<label class="toggle-switch switch-solid" th:field="*{temperature}" class="form-control" type="checkbox"> <!-- <label class="toggle-switch switch-solid" th:field="*{isHigh}" class="form-control" type="checkbox">-->
<input type="checkbox" id="isHigh"> <!-- <input type="checkbox" id="isHigh">-->
<span></span> <!-- <span></span>-->
</label> <!-- </label>-->
</div> <!-- </div>-->
</div> <!-- </div>-->
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">目前诊断症状:</label> <label class="col-sm-3 control-label">目前诊断症状:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<div class="input-group date"> <div class="input-group date">
<input name="isDiagnosed" class="form-control" placeholder="目前诊断症状" type="text"> <input name="isDiagnosed" class="form-control" placeholder="目前诊断症状" type="text" maxlength="1">
<span class="input-group-addon"><i class="fa fa-hospital-o"></i></span> <span class="input-group-addon"><i class="fa fa-hospital-o"></i></span>
</div> </div>
</div> </div>
@ -85,7 +91,34 @@
<script th:inline="javascript"> <script th:inline="javascript">
var prefix = ctx + "patient/patientManage"; var prefix = ctx + "patient/patientManage";
$("#form-patientManage-edit").validate({ $("#form-patientManage-edit").validate({
focusCleanup: true onkeyup: false,
rules:{
patientName:{
isName:true,
},
temperature:{
isTemperature:true
},
patientIdCard:{
isIdentity18:true,
remote: {
url: prefix + "/checkPatientIdCardUnique",
type: "post",
dataType: "json",
data: {
"patientIdCard": function () {
return $.common.trim($("#patientIdCard").val());
}
}
},
},
messages: {
"patientIdCard":{
remote: "身份证号码已经存在"
}
},
focusCleanup: true
},
}); });
function submitHandler() { function submitHandler() {

15
ruoyi-admin/src/main/resources/templates/patient/patientManage/patientManage.html

@ -104,15 +104,12 @@
field: 'patientSex', field: 'patientSex',
title: '患者性别' title: '患者性别'
}, },
// {
// isIdentity:true,
// field: 'patientIdCard',
// title: '患者身份证'
// },
{ {
field: 'description', isIdentity:true,
title: '备注' field: 'patientIdCard',
title: '患者身份证'
}, },
{ {
field: 'currentLocation', field: 'currentLocation',
title: '最近感染地区' title: '最近感染地区'
@ -137,6 +134,10 @@
field: 'isDiagnosed', field: 'isDiagnosed',
title: '诊断' title: '诊断'
}, },
{
field: 'description',
title: '备注'
},
{ {
title: '操作', title: '操作',
align: 'center', align: 'center',

3
ruoyi-system/src/main/java/com/ruoyi/system/domain/PatientManage.java

@ -7,6 +7,8 @@ import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity; import com.ruoyi.common.core.domain.BaseEntity;
import javax.validation.constraints.Size;
/** /**
* 患者管理对象 patient_manage * 患者管理对象 patient_manage
* *
@ -33,6 +35,7 @@ public class PatientManage extends BaseEntity
private String patientSex; private String patientSex;
/** 患者身份证 */ /** 患者身份证 */
@Size(max=18)
@Excel(name = "患者身份证") @Excel(name = "患者身份证")
private String patientIdCard; private String patientIdCard;

7
ruoyi-system/src/main/java/com/ruoyi/system/mapper/PatientManageMapper.java

@ -75,4 +75,11 @@ public interface PatientManageMapper
*/ */
public PatientManage selectPatientById(Long patientId); public PatientManage selectPatientById(Long patientId);
/**
* 通过调度患者ID查询调度信息
*
* @param patientIdCard 身份证唯一
* @return 患者信息
*/
public PatientManage checkPatientIdCardUnique(String patientIdCard);
} }

8
ruoyi-system/src/main/java/com/ruoyi/system/service/IPatientManageService.java

@ -74,4 +74,12 @@ public interface IPatientManageService
* @return 患者详细信息 * @return 患者详细信息
*/ */
public PatientManage selectPatientById(Long patientId); public PatientManage selectPatientById(Long patientId);
/**
* 校验身份证号码是否唯一
*
* @param patientManage 患者信息
* @return 结果
*/
public boolean checkPatientIdCardUnique(PatientManage patientManage);
} }

18
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/PatientManageServiceImpl.java

@ -2,6 +2,7 @@ package com.ruoyi.system.service.impl;
import java.util.List; import java.util.List;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
@ -192,4 +193,21 @@ public class PatientManageServiceImpl implements IPatientManageService
public PatientManage selectPatientById(Long patientId) { public PatientManage selectPatientById(Long patientId) {
return patientManageMapper.selectPatientById(patientId); return patientManageMapper.selectPatientById(patientId);
} }
/**
* 校验身份证号码是否唯一
*
* @param patientManage 用户信息
* @return
*/
@Override
public boolean checkPatientIdCardUnique(PatientManage patientManage) {
Long patientId = StringUtils.isNull(patientManage.getPatientId()) ? -1L : patientManage.getPatientId();
PatientManage info = patientManageMapper.checkPatientIdCardUnique(patientManage.getPatientIdCard());
if (StringUtils.isNotNull(info) && info.getPatientId().longValue() != patientId.longValue())
{
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
}
} }

9
ruoyi-system/src/main/resources/mapper/PatientManageMapper.xml

@ -58,7 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="diagnosedTime != null">diagnosed_time,</if> <if test="diagnosedTime != null">diagnosed_time,</if>
<if test="isDiagnosed != null">is_diagnosed,</if> <if test="isDiagnosed != null">is_diagnosed,</if>
<if test="isTouch != null">is_touch,</if> <if test="isTouch != null">is_touch,</if>
<if test="isHigh != null">is_dead,</if> <if test="isHigh != null">is_high,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="patientName != null">#{patientName},</if> <if test="patientName != null">#{patientName},</if>
@ -88,7 +88,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="diagnosedTime != null">diagnosed_time = #{diagnosedTime},</if> <if test="diagnosedTime != null">diagnosed_time = #{diagnosedTime},</if>
<if test="isDiagnosed != null">is_diagnosed = #{isDiagnosed},</if> <if test="isDiagnosed != null">is_diagnosed = #{isDiagnosed},</if>
<if test="isTouch != null">is_touch = #{isTouch},</if> <if test="isTouch != null">is_touch = #{isTouch},</if>
<if test="isHigh != null">is_dead = #{isHigh},</if> <if test="isHigh != null">is_high = #{isHigh},</if>
</trim> </trim>
where patient_id = #{patientId} where patient_id = #{patientId}
</update> </update>
@ -108,7 +108,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where patient_id_card = #{patientIdCard} where patient_id_card = #{patientIdCard}
</select> </select>
<select id="selectPatientById" parameterType="Long" resultMap="PatientManageResult"> <select id="selectPatientById" parameterType="Long" resultMap="PatientManageResult">
<include refid="selectPatientManageVo"/> <include refid="selectPatientManageVo"/>l
where patient_id= #{patientId} where patient_id= #{patientId}
</select> </select>
<select id="checkPatientIdCardUnique" parameterType="String" resultMap="PatientManageResult">
select patient_id, patient_id_card from patient_manage where patient_id_card=#{patientIdCard}
</select>
</mapper> </mapper>
Loading…
Cancel
Save