|
|
@@ -1,18 +1,23 @@
|
|
|
package com.coffee.admin;
|
|
|
|
|
|
+import cn.hutool.core.date.DateField;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.EnumUtil;
|
|
|
import cn.hutool.core.util.RandomUtil;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.coffee.bus.controller.BusDeviceManualController;
|
|
|
import com.coffee.bus.controller.vo.DeviceManualVo;
|
|
|
import com.coffee.bus.entity.BusClinicEntity;
|
|
|
import com.coffee.bus.entity.BusDeviceManualEntity;
|
|
|
import com.coffee.bus.entity.BusPatientEntity;
|
|
|
import com.coffee.bus.enums.DeviceManualEnum;
|
|
|
+import com.coffee.bus.his.strategy.all.EqualsStrategyHandler;
|
|
|
+import com.coffee.bus.his.strategy.all.HisAllStrategyHandler;
|
|
|
import com.coffee.bus.service.LocalBusClinicService;
|
|
|
import com.coffee.bus.service.LocalBusPatientService;
|
|
|
import com.coffee.bus.service.dto.PatientDeviceRepeatResult;
|
|
|
import com.coffee.common.enums.SexEnum;
|
|
|
+import org.hibernate.validator.constraints.Length;
|
|
|
import org.junit.Test;
|
|
|
import org.junit.runner.RunWith;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -21,10 +26,8 @@ import org.springframework.test.context.junit4.SpringRunner;
|
|
|
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
import java.math.BigDecimal;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Random;
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @author lifang
|
|
|
@@ -42,6 +45,8 @@ public class BusPatientTest {
|
|
|
@Autowired
|
|
|
private LocalBusClinicService clinicService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private EqualsStrategyHandler equalsStrategyHandler;
|
|
|
@Autowired
|
|
|
private BusDeviceManualController manualController;
|
|
|
@Test
|
|
|
@@ -82,6 +87,45 @@ public class BusPatientTest {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Test
|
|
|
+ public void fill(){
|
|
|
+ List<BusClinicEntity> clinicList = clinicService.list(new QueryWrapper<BusClinicEntity>().lambda().eq(BusClinicEntity::getMonitorType, true));
|
|
|
+ Map<String, List<BusClinicEntity>> groupByHospital = clinicList.stream().collect(Collectors.groupingBy(BusClinicEntity::getTenantId));
|
|
|
+ groupByHospital.forEach((tenantId,list)->{
|
|
|
+ Map< String, List<BusClinicEntity>> groupByPatientCode = list.stream().collect(Collectors.groupingBy(BusClinicEntity::getPatientCode));
|
|
|
+ groupByPatientCode.forEach((k,targets)->{
|
|
|
+ List<BusClinicEntity> source = new ArrayList<>();
|
|
|
+ for (BusClinicEntity target : targets) {
|
|
|
+ BusClinicEntity clinic = new BusClinicEntity();
|
|
|
+ clinic.setStartTime(target.getStartTime()==null?
|
|
|
+ RandomUtil.randomDate(DateUtil.beginOfMonth(new Date()), DateField.HOUR,-30,30):target.getStartTime());
|
|
|
+ clinic.setName(clinicNames.get(RandomUtil.randomInt(clinicNames.size()-1)));
|
|
|
+ clinic.setPatientName(getName());
|
|
|
+ clinic.setPatientGender(EnumUtil.likeValueOf(SexEnum.class,RandomUtil.randomInt(1,2)));
|
|
|
+ clinic.setBedNo(target.getBedNo());
|
|
|
+ clinic.setWard(target.getWard());
|
|
|
+ clinic.setWeight(String.valueOf(RandomUtil.randomInt(90,150)));
|
|
|
+ clinic.setWeight(String.valueOf(RandomUtil.randomInt(150,200)));
|
|
|
+ clinic.setAnaDoctor(getName());
|
|
|
+ clinic.setAnaType(anaTypes.get(RandomUtil.randomInt(anaTypes.size()-1)));
|
|
|
+ clinic.setAnalType(analTypes.get(RandomUtil.randomInt(analTypes.size()-1)));
|
|
|
+ clinic.setSurgeryDoctor(getName());
|
|
|
+ clinic.setConfigPerson(getName());
|
|
|
+ clinic.setPatientCode(target.getPatientCode());
|
|
|
+ clinic.setMonitorType(true);
|
|
|
+ clinic.setTenantId("1");
|
|
|
+ source.add(clinic);
|
|
|
+ }
|
|
|
+ equalsStrategyHandler.handle(source,targets);
|
|
|
+ });
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+ public void fillPatientCode(){
|
|
|
+ List<BusPatientEntity> list = patientService.list();
|
|
|
+ }
|
|
|
+
|
|
|
@Test
|
|
|
public void manualSave(){
|
|
|
for (int i = 0; i < 30; i++) {
|
|
|
@@ -89,6 +133,7 @@ public class BusPatientTest {
|
|
|
BusClinicEntity clinic = new BusClinicEntity();
|
|
|
clinic.setStartTime(new Date());
|
|
|
clinic.setName(clinicNames.get(RandomUtil.randomInt(clinicNames.size()-1)));
|
|
|
+ clinic.setPatientAge(RandomUtil.randomInt(15,50));
|
|
|
clinic.setPatientName(getName());
|
|
|
clinic.setPatientGender(EnumUtil.likeValueOf(SexEnum.class,RandomUtil.randomInt(1,2)));
|
|
|
clinic.setBedNo(String.valueOf(RandomUtil.randomInt(10,100)));
|