Commit 30444162 by zhu.zewen

科室创建专账同时药房也创建一条对应专账

parent 8dbe3e15
......@@ -9,12 +9,11 @@ import javax.validation.constraints.NotBlank;
@Data
public class PhysicRecordQueryReq extends PageReq {
@ApiModelProperty("关键字")
private String keyword;
@ApiModelProperty(value = "类型:2-药房,3-科室(参考组织部门)")
private Integer type;
@ApiModelProperty(value = "状态 0-待调配 1-待发药 2-已完成")
private Integer status;
......
......@@ -31,6 +31,9 @@ public class PhysicRecord extends BaseVersionEntity {
@ApiModelProperty(value = "药品数量")
private Integer physicNum;
@ApiModelProperty(value = "类型:2-药房,3-科室(参考组织部门)")
private Integer type;
@ApiModelProperty(value = "患者姓名")
private String sickName;
@ApiModelProperty(value = "患者性别")
......
......@@ -52,6 +52,39 @@ public class PhysicRecordServiceImpl extends AbstractService implements PhysicRe
public List<PhysicRecord> physicRecordCreate(PhysicRecordCreateReq req) {
List<PhysicRecord> records = new ArrayList<>();
for (PhysicRecordCreateReq.Physic physic : req.getPhysicList()) {
// 1)科室专账
// 专账类型:2-药房,3-科室(参考组织部门)
PhysicRecord record = newRecord(req, physic, 3);
physicRecordMapper.insert(record);
if (ObjectUtil.isNotEmpty(req.getPrescriptionImages())) {
if (CollectionUtils.isNotEmpty(req.getPrescriptionImages())) {
bizFileService.addBizFilesIfAbsent(BizFileTypes.PHYSIC_RECORD_IMAGE, record.getId().toString(), req.getPrescriptionImages());
}
}
// 调配人签名
if (ObjectUtil.isNotEmpty(req.getSign())) {
PhysicRecordSignReq signReq = new PhysicRecordSignReq();
copyTo(req.getSign(), signReq);
signReq.setPhysicRecordId(record.getId());
sign(signReq);
}
records.add(record);
// 2)药房专账
PhysicRecord dupRecord = newRecord(req, physic, 2);
physicRecordMapper.insert(dupRecord);
if (ObjectUtil.isNotEmpty(req.getPrescriptionImages())) {
if (CollectionUtils.isNotEmpty(req.getPrescriptionImages())) {
bizFileService.addBizFilesIfAbsent(BizFileTypes.PHYSIC_RECORD_IMAGE, dupRecord.getId().toString(), req.getPrescriptionImages());
}
}
}
return records;
}
private PhysicRecord newRecord(PhysicRecordCreateReq req, PhysicRecordCreateReq.Physic physic, Integer type) {
PhysicRecord record = new PhysicRecord();
BeanUtil.copyProperties(req, record);
record.setDeptId(SpringContextUtils.getDeptId());
......@@ -64,6 +97,8 @@ public class PhysicRecordServiceImpl extends AbstractService implements PhysicRe
record.setBatchNo(physic.getBatchNo());
record.setPhysicNum(physic.getPhysicNum());
record.setType(type);
record.setSickName(req.getSickName());
record.setSickSex(req.getSickSex());
record.setSickAge(req.getSickAge());
......@@ -79,24 +114,7 @@ public class PhysicRecordServiceImpl extends AbstractService implements PhysicRe
record.setYsUser(null);
record.setFhUser(null);
physicRecordMapper.insert(record);
if (ObjectUtil.isNotEmpty(req.getPrescriptionImages())) {
if (CollectionUtils.isNotEmpty(req.getPrescriptionImages())) {
bizFileService.addBizFilesIfAbsent(BizFileTypes.PHYSIC_RECORD_IMAGE, record.getId().toString(), req.getPrescriptionImages());
}
}
// 调配人签名
if (ObjectUtil.isNotEmpty(req.getSign())) {
PhysicRecordSignReq signReq = new PhysicRecordSignReq();
copyTo(req.getSign(), signReq);
signReq.setPhysicRecordId(record.getId());
sign(signReq);
}
records.add(record);
}
return records;
return record;
}
@Override
......
......@@ -5,6 +5,9 @@
<select id="selectRecordPage" resultType="com.jmai.physic.vo.PhysicRecordVO">
select a.*,b.name as createName from physic_record a left join sys_user b on a.create_by =b.id
where a.del_flag =0
<if test="req.type !=null">
AND a.type=#{req.type}
</if>
<if test="req.status !=null">
and a.status=#{req.status}
</if>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment