打印导检单
This commit is contained in:
parent
246cd830ef
commit
4d5bc05f35
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.inspect.controller.admin.checkupresult;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.inspect.controller.admin.checkupresult.vo.PrintRespVO;
|
||||
import cn.iocoder.yudao.module.inspect.controller.admin.inspectpatient.vo.InspectPatientRespVO;
|
||||
import cn.iocoder.yudao.module.inspect.controller.admin.inspectpatient.vo.InspectPatientSaveReqVO;
|
||||
import cn.iocoder.yudao.module.inspect.controller.admin.inspectpatientitems.vo.InspectPatientitemsRespVO;
|
||||
@ -91,4 +92,12 @@ public class CheckUpResultController {
|
||||
return success(existUncheck);
|
||||
}
|
||||
|
||||
@GetMapping("/printInfoOfMedicalSn")
|
||||
@Operation(summary = "打印模板的数据")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
public CommonResult<PrintRespVO> printInfoOfMedicalSn(@RequestParam("medicalSn") String medicalSn) {
|
||||
PrintRespVO printRespVO = patientitemsService.printItemsOfMedicalSn(medicalSn);
|
||||
return success(printRespVO);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,37 @@
|
||||
package cn.iocoder.yudao.module.inspect.controller.admin.checkupresult.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.inspect.dal.dataobject.inspectpatientitems.InspectPatientitemsDO;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class PrintRespVO {
|
||||
|
||||
private String pName;
|
||||
|
||||
private String gender;
|
||||
|
||||
private String age;
|
||||
|
||||
private String phone;
|
||||
|
||||
private String medicalSn;
|
||||
|
||||
private String address;
|
||||
|
||||
private String mealFront;
|
||||
|
||||
private String mealAfter;
|
||||
|
||||
private String mealOther;
|
||||
|
||||
private String barcode;
|
||||
|
||||
private String qrcode;
|
||||
|
||||
private List<InspectPatientitemsDO> table;
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,6 +1,8 @@
|
||||
package cn.iocoder.yudao.module.inspect.service.inspectpatientitems;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.module.inspect.controller.admin.checkupresult.vo.PrintRespVO;
|
||||
import cn.iocoder.yudao.module.inspect.controller.admin.inspectpatientitems.vo.*;
|
||||
import cn.iocoder.yudao.module.inspect.dal.dataobject.inspectpatient.InspectPatientDO;
|
||||
import cn.iocoder.yudao.module.inspect.dal.dataobject.inspectpatientitems.InspectPatientitemsDO;
|
||||
@ -81,5 +83,5 @@ public interface InspectPatientitemsService {
|
||||
|
||||
List<InspectPatientitemsDO> groupNameItemsOfMedicalSn( String medicalSn );
|
||||
|
||||
|
||||
PrintRespVO printItemsOfMedicalSn(String medicalSn);
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.inspect.service.inspectpatientitems;
|
||||
|
||||
import cn.iocoder.yudao.module.inspect.controller.admin.checkupresult.vo.PrintRespVO;
|
||||
import cn.iocoder.yudao.module.inspect.dal.dataobject.inspectpatient.InspectPatientDO;
|
||||
import cn.iocoder.yudao.module.inspect.dal.mysql.inspectpatient.InspectPatientMapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@ -10,6 +11,8 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.inspect.controller.admin.inspectpatientitems.vo.*;
|
||||
import cn.iocoder.yudao.module.inspect.dal.dataobject.inspectpatientitems.InspectPatientitemsDO;
|
||||
@ -157,4 +160,72 @@ public class InspectPatientitemsServiceImpl implements InspectPatientitemsServic
|
||||
return patientitemsMapper.groupNameItems(medicalSn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PrintRespVO printItemsOfMedicalSn(String medicalSn) {
|
||||
PrintRespVO printRespVO = new PrintRespVO();
|
||||
//获取患者信息
|
||||
LambdaQueryWrapper<InspectPatientDO> lambdaQuery = new LambdaQueryWrapper<>();
|
||||
lambdaQuery.eq(InspectPatientDO::getMedicalSn, medicalSn);
|
||||
InspectPatientDO inspectPatientDO = patientMapper.selectOne(lambdaQuery);
|
||||
printRespVO.setMedicalSn(inspectPatientDO.getMedicalSn());
|
||||
printRespVO.setPName(inspectPatientDO.getPName());
|
||||
printRespVO.setGender(inspectPatientDO.getGender());
|
||||
printRespVO.setPhone(inspectPatientDO.getPhoneNum());
|
||||
//没有校验身份证是否正确
|
||||
if (inspectPatientDO.getCardId()!=null && !Objects.equals(inspectPatientDO.getCardId(), "")){
|
||||
String age = String.valueOf(getAgeByIdCard(inspectPatientDO.getCardId()));
|
||||
printRespVO.setAge(age);
|
||||
}
|
||||
// 地址
|
||||
|
||||
//获取检查项目
|
||||
LambdaQueryWrapper<InspectPatientitemsDO> lambdaQuery2 = new LambdaQueryWrapper<>();
|
||||
lambdaQuery2.eq(InspectPatientitemsDO::getMedicalSn, medicalSn);
|
||||
List<InspectPatientitemsDO> list = patientitemsMapper.selectList(lambdaQuery2);
|
||||
StringBuilder mealFront = new StringBuilder();
|
||||
StringBuilder mealAfter = new StringBuilder();
|
||||
StringBuilder mealOther = new StringBuilder();
|
||||
for (InspectPatientitemsDO item : list) {
|
||||
if (Objects.equals(item.getMealfrontorafter(), "") || item.getMealfrontorafter()==null){
|
||||
mealOther.append("【").append(item.getItemName()).append("】");
|
||||
} else if (item.getMealfrontorafter().equals("餐前")) {
|
||||
mealFront.append("【").append(item.getItemName()).append("】");
|
||||
} else if (item.getMealfrontorafter().equals("餐后")) {
|
||||
mealAfter.append("【").append(item.getItemName()).append("】");
|
||||
}
|
||||
}
|
||||
printRespVO.setMealAfter(mealAfter.toString());
|
||||
printRespVO.setMealFront(mealFront.toString());
|
||||
printRespVO.setMealOther(mealOther.toString());
|
||||
|
||||
printRespVO.setTable(list);
|
||||
|
||||
printRespVO.setBarcode("111222333");
|
||||
printRespVO.setQrcode("333444555");
|
||||
|
||||
return printRespVO;
|
||||
}
|
||||
|
||||
public int getAgeByIdCard(String idCard) {
|
||||
String birthDateStr = idCard.substring(6, 14); // 身份证号码的7到14位为出生日期
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
|
||||
Date birthDate;
|
||||
try {
|
||||
birthDate = formatter.parse(birthDateStr);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
return -1; // 如果解析出生日期失败,返回-1
|
||||
}
|
||||
|
||||
Calendar birth = Calendar.getInstance();
|
||||
birth.setTime(birthDate);
|
||||
Calendar today = Calendar.getInstance();
|
||||
|
||||
int age = today.get(Calendar.YEAR) - birth.get(Calendar.YEAR);
|
||||
if (today.get(Calendar.DAY_OF_YEAR) < birth.get(Calendar.DAY_OF_YEAR)) {
|
||||
age -= 1; // 如果当前日期在生日之前,年龄减一
|
||||
}
|
||||
return age;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user