Browse Source

0610:患者信息记录表增加字段,平车上传记录判断是否上传过

pt
ma 4 years ago
parent
commit
5f2715981f
  1. 4
      wisdomcar/src/main/java/com/ccsens/wisdomcar/api/OtherRecordsController.java
  2. 22
      wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/po/PatientInformationRecord.java
  3. 120
      wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/po/PatientInformationRecordExample.java
  4. 7
      wisdomcar/src/main/java/com/ccsens/wisdomcar/service/IOtherRecordsService.java
  5. 4
      wisdomcar/src/main/java/com/ccsens/wisdomcar/service/OtherRecordsService.java
  6. 18
      wisdomcar/src/main/java/com/ccsens/wisdomcar/service/RecordService.java
  7. 42
      wisdomcar/src/main/resources/mapper_raw/PatientInformationRecordMapper.xml

4
wisdomcar/src/main/java/com/ccsens/wisdomcar/api/OtherRecordsController.java

@ -9,6 +9,7 @@ import com.ccsens.wisdomcar.bean.vo.OtherRecordsVo;
import com.ccsens.wisdomcar.bean.vo.RecordVo;
import com.ccsens.wisdomcar.service.IOtherRecordsService;
import com.ccsens.wisdomcar.service.IRecordService;
import com.ccsens.wisdomcar.util.Constant;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -37,7 +38,8 @@ public class OtherRecordsController {
@RequestMapping(value = "/upload", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse upload(@ApiParam @Validated @RequestBody QueryDto<OtherRecordsDto.PicturesAndRecords> params){
log.info("上传图片和记录:{}", params);
iOtherRecordsService.upload(params.getParam(),params.getUserId());
Byte user = Constant.OPERATION_USER;
iOtherRecordsService.upload(params.getParam(),params.getUserId(),user);
log.info("上传图片和记录成功");
return JsonResponse.newInstance().ok();
}

22
wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/po/PatientInformationRecord.java

@ -20,6 +20,10 @@ public class PatientInformationRecord implements Serializable {
private Byte recStatus;
private Byte carUser;
private Long userId;
private static final long serialVersionUID = 1L;
public Long getId() {
@ -86,6 +90,22 @@ public class PatientInformationRecord implements Serializable {
this.recStatus = recStatus;
}
public Byte getCarUser() {
return carUser;
}
public void setCarUser(Byte carUser) {
this.carUser = carUser;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
@ -100,6 +120,8 @@ public class PatientInformationRecord implements Serializable {
sb.append(", createdAt=").append(createdAt);
sb.append(", updatedAt=").append(updatedAt);
sb.append(", recStatus=").append(recStatus);
sb.append(", carUser=").append(carUser);
sb.append(", userId=").append(userId);
sb.append("]");
return sb.toString();
}

120
wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/po/PatientInformationRecordExample.java

@ -594,6 +594,126 @@ public class PatientInformationRecordExample {
addCriterion("rec_status not between", value1, value2, "recStatus");
return (Criteria) this;
}
public Criteria andCarUserIsNull() {
addCriterion("car_user is null");
return (Criteria) this;
}
public Criteria andCarUserIsNotNull() {
addCriterion("car_user is not null");
return (Criteria) this;
}
public Criteria andCarUserEqualTo(Byte value) {
addCriterion("car_user =", value, "carUser");
return (Criteria) this;
}
public Criteria andCarUserNotEqualTo(Byte value) {
addCriterion("car_user <>", value, "carUser");
return (Criteria) this;
}
public Criteria andCarUserGreaterThan(Byte value) {
addCriterion("car_user >", value, "carUser");
return (Criteria) this;
}
public Criteria andCarUserGreaterThanOrEqualTo(Byte value) {
addCriterion("car_user >=", value, "carUser");
return (Criteria) this;
}
public Criteria andCarUserLessThan(Byte value) {
addCriterion("car_user <", value, "carUser");
return (Criteria) this;
}
public Criteria andCarUserLessThanOrEqualTo(Byte value) {
addCriterion("car_user <=", value, "carUser");
return (Criteria) this;
}
public Criteria andCarUserIn(List<Byte> values) {
addCriterion("car_user in", values, "carUser");
return (Criteria) this;
}
public Criteria andCarUserNotIn(List<Byte> values) {
addCriterion("car_user not in", values, "carUser");
return (Criteria) this;
}
public Criteria andCarUserBetween(Byte value1, Byte value2) {
addCriterion("car_user between", value1, value2, "carUser");
return (Criteria) this;
}
public Criteria andCarUserNotBetween(Byte value1, Byte value2) {
addCriterion("car_user not between", value1, value2, "carUser");
return (Criteria) this;
}
public Criteria andUserIdIsNull() {
addCriterion("user_id is null");
return (Criteria) this;
}
public Criteria andUserIdIsNotNull() {
addCriterion("user_id is not null");
return (Criteria) this;
}
public Criteria andUserIdEqualTo(Long value) {
addCriterion("user_id =", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotEqualTo(Long value) {
addCriterion("user_id <>", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThan(Long value) {
addCriterion("user_id >", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThanOrEqualTo(Long value) {
addCriterion("user_id >=", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLessThan(Long value) {
addCriterion("user_id <", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLessThanOrEqualTo(Long value) {
addCriterion("user_id <=", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdIn(List<Long> values) {
addCriterion("user_id in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotIn(List<Long> values) {
addCriterion("user_id not in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdBetween(Long value1, Long value2) {
addCriterion("user_id between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotBetween(Long value1, Long value2) {
addCriterion("user_id not between", value1, value2, "userId");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

7
wisdomcar/src/main/java/com/ccsens/wisdomcar/service/IOtherRecordsService.java

@ -10,10 +10,11 @@ public interface IOtherRecordsService {
/**
* 上传图片和记录
* @param
* @throws
* @param param 参数
* @param userId 用户id
* @param carOrUser 类型:平车或用户
*/
void upload(OtherRecordsDto.PicturesAndRecords param,Long userId);
void upload(OtherRecordsDto.PicturesAndRecords param,Long userId,Byte carOrUser);
/**
* 查询上传图片和记录

4
wisdomcar/src/main/java/com/ccsens/wisdomcar/service/OtherRecordsService.java

@ -56,7 +56,7 @@ public class OtherRecordsService implements IOtherRecordsService {
@Override
public void upload(OtherRecordsDto.PicturesAndRecords param,Long userId) {
public void upload(OtherRecordsDto.PicturesAndRecords param,Long userId,Byte carOrUser) {
//通过t_patient_information_record里面的分解任务id 找到患者平车id 最新的 拿到患者平车id t_patient_information_record
//拿到患者平车id
ProjectVo.BindCar bindCar = stepTaskDao.getBindCarTaskId(param.getId());
@ -73,6 +73,8 @@ public class OtherRecordsService implements IOtherRecordsService {
patientInformationRecord.setTaskSubId(param.getId());
patientInformationRecord.setPatientCarId(bindCar == null ? 0 : bindCar.getId());
patientInformationRecord.setContent(param.getStartTime().toString());
patientInformationRecord.setCarUser(carOrUser);
patientInformationRecord.setUserId(userId);
patientInformationRecordMapper.insertSelective(patientInformationRecord);
ProjectDto.Start start = new ProjectDto.Start();
start.setStartTime(param.getStartTime());

18
wisdomcar/src/main/java/com/ccsens/wisdomcar/service/RecordService.java

@ -11,6 +11,7 @@ import com.ccsens.util.bean.message.common.InMessage;
import com.ccsens.util.bean.message.common.MessageConstant;
import com.ccsens.util.bean.message.common.MessageRule;
import com.ccsens.wisdomcar.bean.dto.Message.CarRecordMessageDto;
import com.ccsens.wisdomcar.bean.dto.OtherRecordsDto;
import com.ccsens.wisdomcar.bean.dto.RecordDto;
import com.ccsens.wisdomcar.bean.po.*;
import com.ccsens.wisdomcar.bean.vo.Message.CarRecordMessageVo;
@ -65,6 +66,10 @@ public class RecordService implements IRecordService{
private StepTaskDao stepTaskDao;
@Resource
private IProjectService projectService;
@Resource
private IOtherRecordsService otherRecordsService;
@Resource
private PatientInformationRecordMapper recordMapper;
@Value("#{T(java.lang.Long).parseLong('${wisdom.weight:10000}')}")
private Long weightMinus;
@ -158,6 +163,19 @@ public class RecordService implements IRecordService{
// TODO 异步推送数据
StepTask stepTask = stepTaskDao.getByCarAndStep(wisdomCarRecord.getCarId(), step.getId(), wisdomCarRecord.getTime());
if (stepTask != null) {
//如果已经有该平车的数据则不存入
PatientInformationRecordExample recordExample = new PatientInformationRecordExample();
recordExample.createCriteria().andTaskSubIdEqualTo(stepTask.getTaskSubId()).andCarUserEqualTo((byte)0).andInformationTypeEqualTo((byte)3);
List<PatientInformationRecord> recordList = recordMapper.selectByExample(recordExample);
if (CollectionUtil.isNotEmpty(recordList)){
log.info("已有该平车数据{}",recordList);
return;
}
OtherRecordsDto.PicturesAndRecords informationRecord = new OtherRecordsDto.PicturesAndRecords();
informationRecord.setId(stepTask.getTaskSubId());
informationRecord.setStartTime(System.currentTimeMillis());
otherRecordsService.upload(informationRecord,wisdomCarRecord.getId(),Constant.OPERATION_CAR);
projectService.saveData(wisdomCarRecord.getTime(), stepTask, wisdomCarRecord.getId(), Constant.OPERATION_CAR);
}

42
wisdomcar/src/main/resources/mapper_raw/PatientInformationRecordMapper.xml

@ -10,6 +10,8 @@
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="rec_status" jdbcType="TINYINT" property="recStatus" />
<result column="car_user" jdbcType="TINYINT" property="carUser" />
<result column="user_id" jdbcType="BIGINT" property="userId" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -71,7 +73,7 @@
</sql>
<sql id="Base_Column_List">
id, patient_car_id, task_sub_id, information_type, content, created_at, updated_at,
rec_status
rec_status, car_user, user_id
</sql>
<select id="selectByExample" parameterType="com.ccsens.wisdomcar.bean.po.PatientInformationRecordExample" resultMap="BaseResultMap">
select
@ -106,10 +108,12 @@
<insert id="insert" parameterType="com.ccsens.wisdomcar.bean.po.PatientInformationRecord">
insert into t_patient_information_record (id, patient_car_id, task_sub_id,
information_type, content, created_at,
updated_at, rec_status)
updated_at, rec_status, car_user,
user_id)
values (#{id,jdbcType=BIGINT}, #{patientCarId,jdbcType=BIGINT}, #{taskSubId,jdbcType=BIGINT},
#{informationType,jdbcType=TINYINT}, #{content,jdbcType=VARCHAR}, #{createdAt,jdbcType=TIMESTAMP},
#{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT})
#{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT}, #{carUser,jdbcType=TINYINT},
#{userId,jdbcType=BIGINT})
</insert>
<insert id="insertSelective" parameterType="com.ccsens.wisdomcar.bean.po.PatientInformationRecord">
insert into t_patient_information_record
@ -138,6 +142,12 @@
<if test="recStatus != null">
rec_status,
</if>
<if test="carUser != null">
car_user,
</if>
<if test="userId != null">
user_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -164,6 +174,12 @@
<if test="recStatus != null">
#{recStatus,jdbcType=TINYINT},
</if>
<if test="carUser != null">
#{carUser,jdbcType=TINYINT},
</if>
<if test="userId != null">
#{userId,jdbcType=BIGINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.ccsens.wisdomcar.bean.po.PatientInformationRecordExample" resultType="java.lang.Long">
@ -199,6 +215,12 @@
<if test="record.recStatus != null">
rec_status = #{record.recStatus,jdbcType=TINYINT},
</if>
<if test="record.carUser != null">
car_user = #{record.carUser,jdbcType=TINYINT},
</if>
<if test="record.userId != null">
user_id = #{record.userId,jdbcType=BIGINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -213,7 +235,9 @@
content = #{record.content,jdbcType=VARCHAR},
created_at = #{record.createdAt,jdbcType=TIMESTAMP},
updated_at = #{record.updatedAt,jdbcType=TIMESTAMP},
rec_status = #{record.recStatus,jdbcType=TINYINT}
rec_status = #{record.recStatus,jdbcType=TINYINT},
car_user = #{record.carUser,jdbcType=TINYINT},
user_id = #{record.userId,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -242,6 +266,12 @@
<if test="recStatus != null">
rec_status = #{recStatus,jdbcType=TINYINT},
</if>
<if test="carUser != null">
car_user = #{carUser,jdbcType=TINYINT},
</if>
<if test="userId != null">
user_id = #{userId,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
@ -253,7 +283,9 @@
content = #{content,jdbcType=VARCHAR},
created_at = #{createdAt,jdbcType=TIMESTAMP},
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
rec_status = #{recStatus,jdbcType=TINYINT}
rec_status = #{recStatus,jdbcType=TINYINT},
car_user = #{carUser,jdbcType=TINYINT},
user_id = #{userId,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
Loading…
Cancel
Save