Merge branch 'master' of ssh://git.jizhiweb.cn:2222/clinic-v2/server
This commit is contained in:
commit
8a174a0736
|
|
@ -14,24 +14,29 @@ public abstract class BaseInputModel {
|
||||||
public Map<String, Object> buildToMap() {
|
public Map<String, Object> buildToMap() {
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
|
||||||
|
// 遍历所有字段(包含父类)
|
||||||
Class<?> clazz = this.getClass();
|
Class<?> clazz = this.getClass();
|
||||||
while (clazz != null) {
|
while (clazz != null) {
|
||||||
for (Field field : clazz.getDeclaredFields()) {
|
for (Field field : clazz.getDeclaredFields()) {
|
||||||
field.setAccessible(true);
|
field.setAccessible(true);
|
||||||
try {
|
try {
|
||||||
Object value = field.get(this);
|
Object value = field.get(this); // 检查RequiredField注解
|
||||||
String mapKey = null;
|
String mapKey = null;
|
||||||
if (field.isAnnotationPresent(IMField.class)) {
|
if (field.isAnnotationPresent(IMField.class)) {
|
||||||
|
|
||||||
IMField annotation = field.getAnnotation(IMField.class);
|
IMField annotation = field.getAnnotation(IMField.class);
|
||||||
mapKey = annotation.key();
|
mapKey = annotation.key();
|
||||||
|
if (annotation.required()) {
|
||||||
if (annotation.required() && (value == null || (value instanceof String && ((String) value).isEmpty()))) {
|
if (value == null || value.toString().isEmpty()) {
|
||||||
throw new MessageException("[" + annotation.key() + ":" + annotation.name() + "] 不能为空");
|
throw new MessageException("[" + annotation.key() + ":"+annotation.name()+"]不能为空");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mapKey != null) {
|
}
|
||||||
// 处理 BaseInputModel 子类
|
if(mapKey == null){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (value instanceof BaseInputModel) {
|
if (value instanceof BaseInputModel) {
|
||||||
map.put(mapKey, ((BaseInputModel) value).buildToMap());
|
map.put(mapKey, ((BaseInputModel) value).buildToMap());
|
||||||
}
|
}
|
||||||
|
|
@ -48,11 +53,14 @@ public abstract class BaseInputModel {
|
||||||
}
|
}
|
||||||
map.put(mapKey, mappedList);
|
map.put(mapKey, mappedList);
|
||||||
}
|
}
|
||||||
// 其他非空值直接放入
|
else if (value == null || !value.toString().isEmpty()){
|
||||||
else if (value != null && !(value instanceof String || value.toString().isEmpty())) {
|
map.put(mapKey, value);
|
||||||
|
}else{
|
||||||
map.put(mapKey, value);
|
map.put(mapKey, value);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
@ -61,5 +69,4 @@ public abstract class BaseInputModel {
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ public class RegistrationController extends BaseController {
|
||||||
public Result<Page<PatientRegistration>> list() {
|
public Result<Page<PatientRegistration>> list() {
|
||||||
int page = parmsUtil.getInteger("page", "页码不能为空");
|
int page = parmsUtil.getInteger("page", "页码不能为空");
|
||||||
int size = parmsUtil.getInteger("size", "页容量不能为空");
|
int size = parmsUtil.getInteger("size", "页容量不能为空");
|
||||||
Integer dockerId = parmsUtil.getInteger("dockerId");
|
Integer dockerId = parmsUtil.getInteger("doctorId");
|
||||||
String startDate = parmsUtil.getString("startDate");
|
String startDate = parmsUtil.getString("startDate");
|
||||||
String endDate = parmsUtil.getString("endDate");
|
String endDate = parmsUtil.getString("endDate");
|
||||||
Page<PatientRegistration> pageResult = patientRegistrationService.listPage(page, size, startDate,endDate,dockerId);
|
Page<PatientRegistration> pageResult = patientRegistrationService.listPage(page, size, startDate,endDate,dockerId);
|
||||||
|
|
|
||||||
|
|
@ -236,7 +236,7 @@ public class ChargeService extends BaseService {
|
||||||
|
|
||||||
itemList.setPreUnitPrice(itemGroup.getUnitPrice());
|
itemList.setPreUnitPrice(itemGroup.getUnitPrice());
|
||||||
itemList.setUnitPrice(itemGroup.getUnitPrice());
|
itemList.setUnitPrice(itemGroup.getUnitPrice());
|
||||||
itemList.setNumber(itemGroup.getNumber());
|
itemList.setNumber(itemGroup.getNumber()*service.getSelectedNum());
|
||||||
itemList.setSocialCode(itemGroup.getSocialCode());
|
itemList.setSocialCode(itemGroup.getSocialCode());
|
||||||
|
|
||||||
itemList.setUnit(itemGroup.getUnit());
|
itemList.setUnit(itemGroup.getUnit());
|
||||||
|
|
@ -245,9 +245,9 @@ public class ChargeService extends BaseService {
|
||||||
itemList.setCreateDate(nowLocalDate);
|
itemList.setCreateDate(nowLocalDate);
|
||||||
itemList.setCreateTime(nowLocalDateTime);
|
itemList.setCreateTime(nowLocalDateTime);
|
||||||
itemList.setIsGroup(true);
|
itemList.setIsGroup(true);
|
||||||
BigDecimal subCost = itemGroup.getPurchaseUnitPrice().multiply(BigDecimal.valueOf(itemGroup.getNumber()));
|
BigDecimal subCost = itemGroup.getPurchaseUnitPrice().multiply(BigDecimal.valueOf(itemList.getNumber()));
|
||||||
itemList.setCost(subCost);
|
itemList.setCost(subCost);
|
||||||
BigDecimal subPrice = itemList.getUnitPrice().multiply(BigDecimal.valueOf(itemGroup.getNumber()));
|
BigDecimal subPrice = itemList.getUnitPrice().multiply(BigDecimal.valueOf(itemList.getNumber()));
|
||||||
itemList.setSubTotalPrice(subPrice);
|
itemList.setSubTotalPrice(subPrice);
|
||||||
chargeServiceLists.add(itemList);
|
chargeServiceLists.add(itemList);
|
||||||
preTotalPrice = preTotalPrice.add(subPrice);
|
preTotalPrice = preTotalPrice.add(subPrice);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue