Commit 2ae0a9b8 by zhu.zewen

完善实体字段注释

统一各业务单“已完成”状态
新增药品专账交接单
parent 32440598
Showing with 555 additions and 161 deletions
package com.jmai.physic.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jmai.physic.dto.*;
import com.jmai.physic.entity.PhysicBill;
import com.jmai.physic.entity.PhysicRecord;
import com.jmai.physic.mapper.PhysicBillMapper;
import com.jmai.physic.entity.PhysicBillHandover;
import com.jmai.physic.service.PhysicBillService;
import com.jmai.physic.vo.BillInfoVO;
import com.jmai.physic.vo.BillQueryVO;
import com.jmai.physic.vo.PhysicApplyVO;
import com.jmai.sys.aop.Auth;
import com.jmai.sys.dto.ResponseData;
import io.swagger.annotations.Api;
......@@ -35,22 +34,50 @@ public class PhysicBillController {
private PhysicBillService physicBillService;
@GetMapping("/list")
@ApiOperation(value = "专账")
@ApiOperation(value = "专账-列表")
public ResponseData<List<BillInfoVO> > list(String physicName) {
List<BillInfoVO> billInfoVOS = physicBillService.listBill(physicName);
return ResponseData.ok(billInfoVOS);
}
@PostMapping("/listDetailPage")
@ApiOperation(value = "专账详情")
@ApiOperation(value = "专账-详情列表")
public Page<BillQueryVO> listPage(@RequestBody PhysicBillQueryReq req){
return physicBillService.listPage(req);
}
@PostMapping("/sign")
@ApiOperation(value = "签名")
@ApiOperation(value = "专账-签名")
public ResponseData<PhysicBill> sign(@RequestBody PhysicBillSignReq physicBillSignReq) {
PhysicBill bill = physicBillService.sign(physicBillSignReq);
return ResponseData.ok(bill);
}
@PostMapping("/createHandover")
@ApiOperation(value = "交接单-新建")
public ResponseData<PhysicBillHandover> createHandover(@RequestBody @Valid PhysicBillHandoverCreateReq req) {
PhysicBillHandover handover = physicBillService.handover(req);
return ResponseData.ok(handover);
}
@PostMapping("/listHandoverPage")
@ApiOperation(value = "交接单-分页查询")
public ResponseData<IPage<PhysicBillHandover>> listHandoverPage(@RequestBody @Valid PhysicBillHandoverQueryReq req) {
IPage<PhysicBillHandover> page = physicBillService.listHandoverPage(req);
return ResponseData.ok(page);
}
@PostMapping("/getHandoverPhysicBills")
@ApiOperation(value = "交接单-获取已交接的专账列表")
public ResponseData<List<PhysicBill>> getHandoverBills(@RequestParam("handoverId") Long handoverId) {
List<PhysicBill> bills = physicBillService.getHandoverPhysicBills(handoverId);
return ResponseData.ok(bills);
}
@PostMapping("/getPendingHandoverBills")
@ApiOperation(value = "交接单-获取待交接的专账列表")
public ResponseData<List<PhysicBill>> getPendingHandoverBills() {
List<PhysicBill> bills = physicBillService.getPendingHandoverPhysicBills();
return ResponseData.ok(bills);
}
}
\ No newline at end of file
package com.jmai.physic.controller;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jmai.physic.dto.PhysicRecordCreateReq;
import com.jmai.physic.dto.PhysicRecordQueryReq;
import com.jmai.physic.dto.PhysicQueryReq;
import com.jmai.physic.dto.PhysicRecordSignReq;
import com.google.common.collect.ImmutableList;
import com.jmai.api.exception.ServiceException;
import com.jmai.physic.dto.*;
import com.jmai.physic.entity.PhysicRecord;
import com.jmai.physic.service.PhysicRecordService;
import com.jmai.physic.vo.PhysicRecordVO;
import com.jmai.physic.vo.PhysicVO;
import com.jmai.sys.AbstractService;
import com.jmai.sys.aop.Auth;
import com.jmai.sys.doc.importer.DefaultImporter;
import com.jmai.sys.doc.importer.ImportField;
import com.jmai.sys.doc.importer.ImportItemBatchHandler;
import com.jmai.sys.doc.importer.ImportResult;
import com.jmai.sys.dto.ResponseData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.List;
import java.util.*;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.stream.Collectors;
@Slf4j
@Auth
......@@ -33,7 +36,7 @@ import java.util.List;
@RequestMapping("/physicRecord")
@Api(tags = "药品专用登记")
@ApiImplicitParams({@ApiImplicitParam(paramType = "header", name = "Access-Token", value = "凭证", required = true, dataType = "string")})
public class PhysicRecordController {
public class PhysicRecordController extends AbstractService {
@Resource
private PhysicRecordService physicRecordService;
......@@ -65,4 +68,50 @@ public class PhysicRecordController {
return ResponseData.ok(page);
}
private static final List<ImportField> PRESCRIPTION_FIELDS = ImmutableList.of(
new ImportField("prescriptionNumber", "*处方编号", true, true),
new ImportField("prescriptionDoctor", "*处方医生", true, false),
new ImportField("sickName", "*患者姓名", true, false),
new ImportField("sickSex", "性别", false, false),
new ImportField("sickAge", "年龄", false, false),
new ImportField("sickIdCard", "身份证号", true, false),
new ImportField("hospitalNumber", "*住院号/门诊号", true, false),
new ImportField("diseaseName", "*疾病名称", true, false)
);
@ApiOperation("解析处方(患者)信息")
@PostMapping("/parsePrescription")
public ResponseData<Collection<PrescriptionDTO>> parsePrescription(@RequestParam(value = "file") MultipartFile file) {
String bizKey = "parsePrescription:"+ nextId();
ConcurrentLinkedQueue<PrescriptionDTO> prescriptions = new ConcurrentLinkedQueue<>();
ImportItemBatchHandler<PrescriptionDTO> itemBatchHandler = items -> {
prescriptions.addAll(items);
return items.stream()
.collect(Collectors.toMap(
PrescriptionDTO::getPrescriptionNumber,
e -> ""
));
};
DefaultImporter<PrescriptionDTO> importer = new DefaultImporter<>(bizKey,
PrescriptionDTO.class, PRESCRIPTION_FIELDS, itemBatchHandler, file, ac);
ImportResult result = execWithLock(bizKey, importer::run);
if (ObjectUtil.equals(result.getStat().getSuccessNum().get(), result.getStat().getTotalNum().get())) {
// 成功
return ResponseData.ok(prescriptions);
} else {
throw new ServiceException("解析失败:" + toJSONString(result));
}
}
@ApiOperation("下载解析处方(患者)模板")
@PostMapping("/parsePrescription/template")
public ResponseData<Void> parsePrescriptionTemplate(HttpServletResponse response) {
List<ImportField> importFields = PRESCRIPTION_FIELDS;
downloadImportTemplate(importFields, response);
return ResponseData.ok();
}
}
\ No newline at end of file
package com.jmai.physic.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "BillDTO", description = "药品专账")
public class BillDTO {
@ApiModelProperty(value = "部门id")
private Long deptId;
......
......@@ -5,16 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class PhysicAmpouleSignReq {
@ApiModelProperty(value = "签名token")
private String encryptedToken;
@ApiModelProperty(value = "签名账号")
private String relBizNo;
@ApiModelProperty(value = "签名base64图片")
private String base64SourceData;
public class PhysicAmpouleSignReq extends SignReq {
@ApiModelProperty(value = "药库空安瓿id")
private Long physicAmpouleId;
}
......@@ -5,16 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class PhysicApplySignReq {
@ApiModelProperty(value = "签名token")
private String encryptedToken;
@ApiModelProperty(value = "签名账号")
private String relBizNo;
@ApiModelProperty(value = "签名base64图片")
private String base64SourceData;
public class PhysicApplySignReq extends SignReq {
@ApiModelProperty(value = "药品申请id")
private Long physicApplyId;
}
package com.jmai.physic.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(description = "药品专账-交接单")
public class PhysicBillHandoverCreateReq {
@ApiModelProperty(value = "备注")
private String remark;
}
\ No newline at end of file
package com.jmai.physic.dto;
import com.jmai.sys.dto.PageReq;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;
@Data
@ApiModel(description = "药品专账-交接单")
public class PhysicBillHandoverQueryReq extends PageReq {
@ApiModelProperty(value = "部门")
private Long deptId;
@ApiModelProperty(value = "状态:0-待移交、1-待接收、100-已完成(0-99审核中)")
private Integer status;
@ApiModelProperty(value = "开始完成时间")
private LocalDateTime startFinishTime;
@ApiModelProperty(value = "结束完成时间")
private LocalDateTime endFinishTime;
}
\ No newline at end of file
......@@ -5,16 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class PhysicBillSignReq {
@ApiModelProperty(value = "签名token")
private String encryptedToken;
@ApiModelProperty(value = "签名账号")
private String relBizNo;
@ApiModelProperty(value = "签名base64图片")
private String base64SourceData;
public class PhysicBillSignReq extends SignReq {
@ApiModelProperty(value = "专账id")
private Long physicBillId;
}
......@@ -18,6 +18,8 @@ public class PhysicDestroyCheckCreateReq {
private String applyTitle;
@ApiModelProperty(value = "申请理由")
private String applyReason;
@ApiModelProperty(value = "图片")
private List<Long> images;
@ApiModelProperty(value = "申请明细列表")
private List<PhysicDestroyCheckDetail> checkDetailList = Collections.emptyList();
}
......@@ -5,16 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class PhysicDestroySignReq {
@ApiModelProperty(value = "签名token")
private String encryptedToken;
@ApiModelProperty(value = "签名账号")
private String relBizNo;
@ApiModelProperty(value = "签名base64图片")
private String base64SourceData;
public class PhysicDestroySignReq extends SignReq {
@ApiModelProperty(value = "药品销毁id")
private Long physicDestroyId;
}
......@@ -20,11 +20,45 @@ public class PhysicInfoDTO {
@ApiModelProperty(value = "药品类型描述")
private String physicTypeDesc;
@ApiModelProperty(value = "包装规格")
private String pkgSpecCrit;
@ApiModelProperty(value = "制剂类型描述")
private String prepnTypeDesc;
@ApiModelProperty(value = "供应商")
private String supplyName;
@ApiModelProperty(value = "批号")
private String batchNo;
// @ApiField("approval_licence_no")
// @ApiModelProperty(value = "批准文号 - 药品的批准文号,是国家药品监督管理部门批准药品生产企业生产该药品的批准证明文件编号")
// private String approvalLicenceNo;
//
// @ApiField("drug_ent_base_info_id")
// @ApiModelProperty(value = "药品企业基础信息ID - 阿里码上放心系统中药品企业基础信息的唯一标识ID")
// private String drugEntBaseInfoId;
//
// @ApiField("exprie")
// @ApiModelProperty(value = "失效时间 - 药品的失效日期,格式为YYYY-MM-DD")
// private String exprie;
//
// @ApiField("physic_name")
// @ApiModelProperty(value = "药品名称 - 药品的通用名称")
// private String physicName;
//
// @ApiField("physic_type_desc")
// @ApiModelProperty(value = "药品类型描述 - 药品类型的详细描述,如处方药、非处方药等")
// private String physicTypeDesc;
//
// @ApiField("pkg_spec_crit")
// @ApiModelProperty(value = "包装规格 - 药品的包装规格信息")
// private String pkgSpecCrit;
//
// @ApiField("prepn_spec")
// @ApiModelProperty(value = "制剂规格 - 药品制剂的规格信息,如每片含量、每支容量等")
// private String prepnSpec;
//
// @ApiField("prepn_type_desc")
// @ApiModelProperty(value = "制剂类型描述 - 药品制剂类型的详细描述,如片剂、胶囊剂、注射剂等")
// private String prepnTypeDesc;
}
\ No newline at end of file
......@@ -25,12 +25,14 @@ public class PhysicRecordCreateReq {
private String prescriptionNumber;
@ApiModelProperty(value = "处方医生")
private String prescriptionDoctor;
@ApiModelProperty(value = "处方图片")
private List<Long> prescriptionImages;
@ApiModelProperty(value = "药品记录集")
private List<Physic> physicList;
@ApiModelProperty(value = "签名")
private String sign;
@Data
public static class Physic{
......
......@@ -5,16 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class PhysicRecordSignReq {
@ApiModelProperty(value = "签名token")
private String encryptedToken;
@ApiModelProperty(value = "签名账号")
private String relBizNo;
@ApiModelProperty(value = "签名base64图片")
private String base64SourceData;
public class PhysicRecordSignReq extends SignReq {
@ApiModelProperty(value = "药品登记id")
private Long physicRecordId;
}
......@@ -24,6 +24,9 @@ public class PhysicStorageAmpouleCreateReq {
@ApiModelProperty(value = "药品记录集")
private List<PhysicStorageAmpouleCreateReq.Physic> physicList;
@ApiModelProperty(value = "签名")
private String sign;
@Data
public static class Physic{
@ApiModelProperty(value = "药品名称")
......
......@@ -5,16 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class PhysicWarehouseSignReq {
@ApiModelProperty(value = "签名token")
private String encryptedToken;
@ApiModelProperty(value = "签名账号")
private String relBizNo;
@ApiModelProperty(value = "签名base64图片")
private String base64SourceData;
public class PhysicWarehouseSignReq extends SignReq {
@ApiModelProperty(value = "入库id")
private Long physicWarehouseId;
......
package com.jmai.physic.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
@ApiModel(value = "PrescriptionDTO", description = "处方(患者)信息")
public class PrescriptionDTO {
@ApiModelProperty(value = "患者姓名")
private String sickName;
@ApiModelProperty(value = "患者性别")
private Integer sickSex;
@ApiModelProperty(value = "患者年龄")
private Integer sickAge;
@ApiModelProperty(value = "患者身份证号")
private String sickIdCard;
@ApiModelProperty(value = "住院号")
private String hospitalNumber;
@ApiModelProperty(value = "疾病名称")
private String diseaseName;
@ApiModelProperty(value = "处方编号")
private String prescriptionNumber;
@ApiModelProperty(value = "处方医生")
private String prescriptionDoctor;
@ApiModelProperty(value = "处方图片")
private List<Long> prescriptionImages;
}
package com.jmai.physic.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class SignReq {
@ApiModelProperty(value = "签名token")
private String encryptedToken;
@ApiModelProperty(value = "签名账号")
private String relBizNo;
@ApiModelProperty(value = "签名base64图片")
private String base64SourceData;
@ApiModelProperty(value = "药库空安瓿id")
private Long physicAmpouleId;
}
......@@ -40,11 +40,13 @@ public class PhysicAmpoule extends BaseVersionEntity {
private Integer batchBalance;
private Integer physicBalance;
@ApiModelProperty(value = "状态:0-待接受退回、1-待退回复核、100-已完成(0-99审核中)")
private Integer status;
@ApiModelProperty(value = "接受退回处理人签名")
private String chUser;
@ApiModelProperty(value = "复核人签名")
private String fhUser;
@ApiModelProperty(value = "0-待处理 1-接受退回处理 2-复核人处理")
private Integer status;
private String remark;
}
......@@ -40,9 +40,8 @@ public class PhysicApply extends BaseVersionEntity{
@ApiModelProperty(value = "领药部门")
private Long lyDeptId;
@ApiModelProperty(value = "状态 0 -待领药 1-待审核 2-待发药 3 -待复核 4 -完成")
@ApiModelProperty(value = "状态 0 -待领药、1-待审核、2-待发药、3 -待复核、100 -已完成(0-99审核中)")
private Integer status;
@ApiModelProperty(value = "领药人")
private String lyUser;
@ApiModelProperty(value = "审核人")
......
......@@ -42,10 +42,11 @@ public class PhysicBill extends BaseVersionEntity {
@ApiModelProperty(value = "相关申请、入库id")
private Long refId;
@ApiModelProperty(value = "状态 0 -待验收 1 -已完成")
@ApiModelProperty(value = "状态 0 -待领药、1-待复核、100-已完成(0-99审核中)")
private Integer status;
@ApiModelProperty(value = "领药人")
private String lyUser;
@ApiModelProperty(value = "复核人")
private String fhUser;
@ApiModelProperty(value = "结存")
......
package com.jmai.physic.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.jmai.sys.entity.BaseVersionEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;
@Data
@ApiModel(description = "药品专账-交接单")
@TableName("physic_bill_handover")
public class PhysicBillHandover extends BaseVersionEntity {
@ApiModelProperty(value = "部门")
private Long deptId;
@ApiModelProperty(value = "起始转账ID(不包含,上次交接的截止转账ID)")
private Long startBillId;
@ApiModelProperty(value = "截止转账ID(包含)")
private Long endBillId;
@ApiModelProperty(value = "状态:0-待移交、1-待接收、100-已完成(0-99审核中)")
private Integer status;
@ApiModelProperty(value = "移交人签名(transferor)")
private String yjUser;
@ApiModelProperty(value = "接收人签名(receiver)")
private String jsUser;
@ApiModelProperty(value = "完成时间")
private LocalDateTime finishTime;
@ApiModelProperty(value = "备注")
private String remark;
}
\ No newline at end of file
......@@ -23,12 +23,13 @@ public class PhysicDestroy extends BaseVersionEntity {
private String surplus;
@ApiModelProperty(value = "状态 0-代操作 1-待复核 2-已完成")
@ApiModelProperty(value = "状态:0-待操作、1-待复核、100-已完成( 0-99审核中)")
private Integer status;
@ApiModelProperty(value = "操作人")
private String czUser;
@ApiModelProperty(value = "复核人")
private String fhUser;
@ApiModelProperty(value = "图片")
private String images;
@ApiModelProperty(value = "销毁时间")
......
......@@ -24,9 +24,8 @@ public class PhysicDestroyCheck extends BaseVersionEntity {
@ApiModelProperty(value = "销毁数量")
private Integer destroyNum;
@ApiModelProperty(value = "销毁状态:0-5审批中, 6-已销毁 ")
@ApiModelProperty(value = "销毁状态:0-99审批中, 100-已完成/已销毁")
private Integer status;
@ApiModelProperty(value = "销毁人")
private String xhUser;
@ApiModelProperty(value = "监督人")
......
......@@ -9,7 +9,6 @@ import lombok.Data;
@Data
@ApiModel(description = "药品专用登记")
@TableName("physic_record")
public class PhysicRecord extends BaseVersionEntity {
@ApiModelProperty(value = "部门ID")
private Long deptId;
......@@ -34,28 +33,29 @@ public class PhysicRecord extends BaseVersionEntity {
@ApiModelProperty(value = "患者姓名")
private String sickName;
@ApiModelProperty(value = "患者性别")
private Integer sickSex;
@ApiModelProperty(value = "患者年龄")
private Integer sickAge;
@ApiModelProperty(value = "患者身份证号")
private String sickIdCard;
@ApiModelProperty(value = "住院号")
private String hospitalNumber;
@ApiModelProperty(value = "疾病名称")
private String diseaseName;
@ApiModelProperty(value = "处方编号")
private String prescriptionNumber;
@ApiModelProperty(value = "处方医生")
private String prescriptionDoctor;
@ApiModelProperty(value = "状态 0-待调配 1-待发药 2-已完成")
@ApiModelProperty(value = "状态:0-待调配、1-待发药、2- 待验收、3- 待复核、100-已完成")
private Integer status;
@ApiModelProperty(value = "调配人")
private String dpUser;
@ApiModelProperty(value = "发药人")
private String fyUser;
@ApiModelProperty(value = "验收人")
private String ysUser;
@ApiModelProperty(value = "复核人")
private String fhUser;
}
......@@ -8,7 +8,7 @@ import lombok.Data;
@Data
@ApiModel(description = "药品专用登记-药库")
@ApiModel(description = "药品专用登记-药库(空安瓿登记)")
@TableName("physic_storage_ampoule")
public class PhysicStorageAmpoule extends BaseVersionEntity {
......@@ -50,12 +50,12 @@ public class PhysicStorageAmpoule extends BaseVersionEntity {
private Integer batchBalance;
private Integer physicBalance;
@ApiModelProperty(value = "状态:0-待接收、1-待退回、100-完成(0-99审核中)")
private Integer status;
@ApiModelProperty(value = "接收人")
private String jsUser;
@ApiModelProperty(value = "退回人")
private String thUser;
@ApiModelProperty(value = "状态:0-待处理、1-退出人处理、2-接收人处理")
private Integer status;
private String remark;
}
......@@ -35,9 +35,8 @@ public class PhysicWarehouse extends BaseVersionEntity{
@ApiModelProperty(value = "药品数量")
private Integer physicNum;
@ApiModelProperty(value = "状态 0 -待验收 1-待复核 2 -待保管 3 -完成")
@ApiModelProperty(value = "状态:0 -待验收、1-待复核、2-待保管、100-完成(0-99审核中)")
private Integer status;
@ApiModelProperty(value = "验收人")
private String ysUser;
@ApiModelProperty(value = "复核人")
......
package com.jmai.physic.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jmai.physic.entity.PhysicBillHandover;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface PhysicBillHandoverMapper extends BaseMapper<PhysicBillHandover> {
}
\ No newline at end of file
package com.jmai.physic.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jmai.physic.dto.BillDTO;
import com.jmai.physic.dto.PhysicBillQueryReq;
import com.jmai.physic.dto.PhysicBillSignReq;
import com.jmai.physic.dto.*;
import com.jmai.physic.entity.PhysicBill;
import com.jmai.physic.entity.PhysicBillHandover;
import com.jmai.physic.vo.BillInfoVO;
import com.jmai.physic.vo.BillQueryVO;
import java.util.List;
public interface PhysicBillService {
// 专账
void createBill(BillDTO billDTO);
List<BillInfoVO> listBill(String physicName);
Page<BillQueryVO> listPage(PhysicBillQueryReq req);
PhysicBill sign(PhysicBillSignReq physicBillSignReq);
// 交接单
IPage<PhysicBillHandover> listHandoverPage(PhysicBillHandoverQueryReq req);
List<PhysicBill> getHandoverPhysicBills(Long handoverId);
List<PhysicBill> getPendingHandoverPhysicBills();
PhysicBillHandover handover(PhysicBillHandoverCreateReq req);
}
......@@ -90,7 +90,7 @@ public class PhysicAmpouleServiceImpl extends AbstractService implements PhysicA
@Override
public PhysicAmpoule sign(PhysicAmpouleSignReq physicAmpouleSignReq) {
Boolean f = false;
Boolean finished = false;
Long userId = SpringContextUtils.getUserId();
String getstamp = cloudsignService.sign(physicAmpouleSignReq.getEncryptedToken(), physicAmpouleSignReq.getRelBizNo(), physicAmpouleSignReq.getBase64SourceData());
PhysicAmpoule ampoule = getInfo(physicAmpouleSignReq.getPhysicAmpouleId());
......@@ -106,12 +106,15 @@ public class PhysicAmpouleServiceImpl extends AbstractService implements PhysicA
if (!RoleTypeEum.isPass(sysUser.getRoleAsList(), RoleTypeEum.FH)) {
throw new ServiceException("需要复核人权限才可进行签名");
}
ampoule.setStatus(2);
ampoule.setStatus(100);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(), userId);
ampoule.setFhUser(JSONUtil.toJsonStr(signInfoDTO));
f=true;
// 完成
finished=true;
}
if(f){
if(finished){
// 完成 => 转账生成
BillDTO billDTO = new BillDTO();
BeanUtil.copyProperties(ampoule,billDTO);
billDTO.setType(ampoule.getType().equals("1")?5:6);
......
......@@ -162,7 +162,7 @@ public class PhysicApplyServiceImpl extends AbstractService implements PhysicApp
@Transactional
@Override
public PhysicApplyVO sign(PhysicApplySignReq physicApplySignReq) {
Boolean f =false;
Boolean finished =false;
Long userId = SpringContextUtils.getUserId();
SysUser sysUser = sysUserMapper.selectById(userId);
String getstamp = cloudsignService.sign(physicApplySignReq.getEncryptedToken(), physicApplySignReq.getRelBizNo(), physicApplySignReq.getBase64SourceData());
......@@ -196,13 +196,16 @@ public class PhysicApplyServiceImpl extends AbstractService implements PhysicApp
if(!RoleTypeEum.isPass(sysUser.getRoleAsList(),RoleTypeEum.FH)){
throw new ServiceException("需要复核人权限才可进行签名");
}
physicApply.setStatus(4);
physicApply.setStatus(100);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(),userId);;
physicApply.setFhUser(JSONUtil.toJsonStr(signInfoDTO));
f = true;
// 完成
finished = true;
}
physicApplyMapper.updateById(physicApply);
if(f){
if(finished){
// 完成 => 转账生成
BillDTO billDTO = new BillDTO();
BeanUtil.copyProperties(physicApply,billDTO);
billDTO.setType(2);
......
......@@ -3,14 +3,15 @@ package com.jmai.physic.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jmai.api.exception.ServiceException;
import com.jmai.physic.cloudsign.CloudsignService;
import com.jmai.physic.dto.BillDTO;
import com.jmai.physic.dto.PhysicBillQueryReq;
import com.jmai.physic.dto.PhysicBillSignReq;
import com.jmai.physic.dto.SignInfoDTO;
import com.jmai.physic.dto.*;
import com.jmai.physic.entity.PhysicBill;
import com.jmai.physic.entity.PhysicBillHandover;
import com.jmai.physic.mapper.PhysicBillHandoverMapper;
import com.jmai.physic.mapper.PhysicBillMapper;
import com.jmai.physic.service.PhysicBillService;
import com.jmai.physic.vo.BillInfoVO;
......@@ -25,13 +26,17 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
@Service
public class PhysicBillServiceImpl extends AbstractService implements PhysicBillService {
@Resource
private PhysicBillMapper physicBillMapper;
@Resource
private PhysicBillHandoverMapper physicBillHandoverMapper;
@Resource
private CloudsignService cloudsignService;
......@@ -81,7 +86,7 @@ public class PhysicBillServiceImpl extends AbstractService implements PhysicBill
@Override
public PhysicBill sign(PhysicBillSignReq physicBillSignReq) {
Boolean f = false;
Boolean finished = false;
Long userId = SpringContextUtils.getUserId();
String getstamp = cloudsignService.sign(physicBillSignReq.getEncryptedToken(), physicBillSignReq.getRelBizNo(), physicBillSignReq.getBase64SourceData());
PhysicBill bill = physicBillMapper.selectById(physicBillSignReq.getPhysicBillId());
......@@ -97,11 +102,126 @@ public class PhysicBillServiceImpl extends AbstractService implements PhysicBill
if(!RoleTypeEum.isPass(sysUser.getRoleAsList(),RoleTypeEum.FH)){
throw new ServiceException("需要复核人权限才可进行签名");
}
bill.setStatus(2);
bill.setStatus(100);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(), userId);
bill.setFhUser(JSONUtil.toJsonStr(signInfoDTO));
// 完成
finished = true;
}
physicBillMapper.updateById(bill);
return bill;
}
@Override
public IPage<PhysicBillHandover> listHandoverPage(PhysicBillHandoverQueryReq req) {
Page<PhysicBillHandover> page = buildEmptyPage(req);
return physicBillHandoverMapper.selectPage(page, Wrappers.<PhysicBillHandover>lambdaQuery()
.eq(PhysicBillHandover::getDeptId, req.getDeptId())
.eq(PhysicBillHandover::getStatus, req.getStatus())
.ge(ObjectUtil.isNotEmpty(req.getStartFinishTime()), PhysicBillHandover::getFinishTime, req.getStartFinishTime())
.lt(ObjectUtil.isNotEmpty(req.getEndFinishTime()), PhysicBillHandover::getFinishTime, req.getEndFinishTime())
.orderByDesc(PhysicBillHandover::getId));
}
/**
* 获取已交接的专账
*/
@Override
public List<PhysicBill> getHandoverPhysicBills(Long handoverId) {
PhysicBillHandover billHandover = physicBillHandoverMapper.selectById(handoverId);
if (ObjectUtil.isEmpty(billHandover)) {
throw new ServiceException("未找到交接单:" + handoverId);
}
List<PhysicBill> billList = physicBillMapper.selectList(Wrappers.<PhysicBill>lambdaQuery()
.gt(PhysicBill::getId, billHandover.getStartBillId())
.le(PhysicBill::getId, billHandover.getEndBillId())
.orderByAsc(PhysicBill::getId));
return billList;
}
/**
* 获取待交接的专账
*/
@Override
public List<PhysicBill> getPendingHandoverPhysicBills() {
Long lastHandoverBillId = 0L;
// 获取最新的交接单
PhysicBillHandover lastHandover = physicBillHandoverMapper.selectOne(Wrappers.lambdaQuery(PhysicBillHandover.class)
.orderByDesc(PhysicBillHandover::getId));
if (ObjectUtil.isNotEmpty(lastHandover)) {
if (ObjectUtil.isEmpty(lastHandover.getFinishTime())) {
throw new ServiceException("存在未完成交接单");
}
lastHandoverBillId = lastHandover.getEndBillId();
}
// TODO:是否会有未完成的专账?
List<PhysicBill> billList = physicBillMapper.selectList(Wrappers.<PhysicBill>lambdaQuery()
.gt(PhysicBill::getId, lastHandoverBillId)
.orderByAsc(PhysicBill::getId));
return billList;
}
/**
* 获取最新已交接单
*/
public Optional<PhysicBillHandover> getLastHandover() {
PhysicBillHandover lastHandover = physicBillHandoverMapper.selectOne(Wrappers.lambdaQuery(PhysicBillHandover.class)
.orderByDesc(PhysicBillHandover::getId));
if (ObjectUtil.isEmpty(lastHandover)) {
return Optional.empty();
}
if (ObjectUtil.isEmpty(lastHandover.getFinishTime())) {
throw new ServiceException("存在未完成交接单");
}
return Optional.of(lastHandover);
}
/**
* 获取最新已交接单的专账
*/
private List<PhysicBill> getLastHandoverPhysicBills() {
// 获取最新的交接单
PhysicBillHandover lastHandover = physicBillHandoverMapper.selectOne(Wrappers.lambdaQuery(PhysicBillHandover.class)
.orderByDesc(PhysicBillHandover::getId));
if (ObjectUtil.isEmpty(lastHandover)) {
return Collections.emptyList();
}
if (ObjectUtil.isEmpty(lastHandover.getFinishTime())) {
throw new ServiceException("存在未完成交接单");
}
List<PhysicBill> billList = physicBillMapper.selectList(Wrappers.<PhysicBill>lambdaQuery()
.gt(PhysicBill::getId, lastHandover.getStartBillId())
.le(PhysicBill::getId, lastHandover.getEndBillId())
.orderByAsc(PhysicBill::getId));
return billList;
}
@Override
public PhysicBillHandover handover(PhysicBillHandoverCreateReq req) {
Optional<PhysicBillHandover> lastHandover = getLastHandover();
Long startBillId = lastHandover.map(PhysicBillHandover::getEndBillId).orElse(0L);
Long endBillId = startBillId;
List<PhysicBill> billList = getPendingHandoverPhysicBills();
if (ObjectUtil.isNotEmpty(billList)) {
endBillId = billList.get(billList.size() - 1).getId();
}
PhysicBillHandover billHandover = new PhysicBillHandover();
billHandover.setDeptId(SpringContextUtils.getDeptId());
billHandover.setStartBillId(startBillId);
billHandover.setEndBillId(endBillId);
billHandover.setStatus(0);
billHandover.setRemark(req.getRemark());
physicBillHandoverMapper.insert(billHandover);
return billHandover;
}
}
......@@ -114,7 +114,7 @@ public class PhysicDestroyCheckServiceImpl extends BaseServiceImpl<PhysicDestroy
@Override
public PhysicDestroyCheck sign(PhysicDestroyCheckSignReq physicDestroyCheckSignReq) {
Boolean f = false;
boolean finished = false;
Long userId = SpringContextUtils.getUserId();
SysUser sysUser = sysUserMapper.selectById(userId);
String getstamp = cloudsignService.sign(physicDestroyCheckSignReq.getEncryptedToken(), physicDestroyCheckSignReq.getRelBizNo(), physicDestroyCheckSignReq.getBase64SourceData());
......@@ -158,19 +158,24 @@ public class PhysicDestroyCheckServiceImpl extends BaseServiceImpl<PhysicDestroy
if (!RoleTypeEum.isPass(sysUser.getRoleAsList(), RoleTypeEum.ZGYZ)) {
throw new ServiceException("需要主管院长权限才可进行签名");
}
physicDestroyCheck.setStatus(6);
physicDestroyCheck.setStatus(100);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(), userId);
physicDestroyCheck.setZgyzUser(JSONUtil.toJsonStr(signInfoDTO));
f = true;
// 完成
finished = true;
}
if(f){
if(finished){
// 完成 => 转账生成
BillDTO billDTO = new BillDTO();
BeanUtil.copyProperties(physicDestroyCheck,billDTO);
billDTO.setType(7);
billDTO.setDeptId(physicDestroyCheck.getApplyDeptId());
billDTO.setRefId(physicDestroyCheck.getId());
physicBillService.createBill(billDTO);
//创建销毁
List<PhysicDestroyCheckDetail> list = physicDestroyCheckDetailService.list(new LambdaQueryWrapper<PhysicDestroyCheckDetail>().eq(PhysicDestroyCheckDetail::getCheckId, physicDestroyCheck.getId()));
for (PhysicDestroyCheckDetail physicDestroyCheckDetail : list) {
......
......@@ -17,6 +17,7 @@ import com.jmai.sys.ctx.SpringContextUtils;
import com.jmai.sys.entity.SysUser;
import com.jmai.sys.mapper.SysUserMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.time.LocalDateTime;
......@@ -37,6 +38,7 @@ public class PhysicDestroyServiceImpl extends AbstractService implements PhysicD
private PhysicBillService physicBillService;
@Override
@Transactional(rollbackFor = Exception.class)
public void create(PhysicDestroyCreateReq req) {
String orderNo = sysManager.newOrderNo(PhysicDestroy.class);
PhysicDestroy destroy = new PhysicDestroy();
......@@ -57,8 +59,9 @@ public class PhysicDestroyServiceImpl extends AbstractService implements PhysicD
}
@Override
@Transactional(rollbackFor = Exception.class)
public PhysicDestroy sign(PhysicDestroySignReq physicDestroySignReq) {
Boolean f = false;
boolean finished = false;
Long userId = SpringContextUtils.getUserId();
String getstamp = cloudsignService.sign(physicDestroySignReq.getEncryptedToken(), physicDestroySignReq.getRelBizNo(), physicDestroySignReq.getBase64SourceData());
PhysicDestroy physicDestroy = physicDestroyMapper.selectById(physicDestroySignReq.getPhysicDestroyId());
......@@ -74,13 +77,17 @@ public class PhysicDestroyServiceImpl extends AbstractService implements PhysicD
if(!RoleTypeEum.isPass(sysUser.getRoleAsList(),RoleTypeEum.FH)){
throw new ServiceException("需要复核人权限才可进行签名");
}
physicDestroy.setStatus(2);
physicDestroy.setStatus(100);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(),userId);;
physicDestroy.setFhUser(JSONUtil.toJsonStr(signInfoDTO));
f = true;
// 完成
finished = true;
}
if(f){
if(finished){
// 完成 => 转账生成
BillDTO billDTO = new BillDTO();
BeanUtil.copyProperties(physicDestroy,billDTO);
billDTO.setType(7);
......
......@@ -36,25 +36,19 @@ import java.util.List;
@Service
public class PhysicRecordServiceImpl extends AbstractService implements PhysicRecordService {
@Resource
private PhysicRecordMapper physicRecordMapper;
@Resource
private BizFileService bizFileService;
@Resource
private CloudsignService cloudsignService;
@Resource
private SysUserMapper sysUserMapper;
@Resource
private PhysicBillService physicBillService;
@Transactional
@Override
@Transactional(rollbackFor = Exception.class)
public List<PhysicRecord> physicRecordCreate(PhysicRecordCreateReq req) {
List<PhysicRecord> records = new ArrayList<>();
for (PhysicRecordCreateReq.Physic physic : req.getPhysicList()) {
......@@ -69,6 +63,24 @@ public class PhysicRecordServiceImpl extends AbstractService implements PhysicRe
record.setExpireDate(physic.getExpireDate());
record.setBatchNo(physic.getBatchNo());
record.setPhysicNum(physic.getPhysicNum());
record.setSickName(req.getSickName());
record.setSickSex(req.getSickSex());
record.setSickAge(req.getSickAge());
record.setSickIdCard(req.getSickIdCard());
record.setHospitalNumber(req.getHospitalNumber());
record.setDiseaseName(req.getDiseaseName());
record.setPrescriptionNumber(req.getPrescriptionNumber());
record.setPrescriptionDoctor(req.getPrescriptionDoctor());
// TODO:sign - 签名
record.setDpUser(null);
record.setFyUser(null);
record.setYsUser(null);
record.setFhUser(null);
record.setStatus(0);
physicRecordMapper.insert(record);
if (ObjectUtil.isNotEmpty(req.getPrescriptionImages())) {
if (CollectionUtils.isNotEmpty(req.getPrescriptionImages())) {
......@@ -97,32 +109,54 @@ public class PhysicRecordServiceImpl extends AbstractService implements PhysicRe
}
@Override
@Transactional(rollbackFor = Exception.class)
public PhysicRecord sign(PhysicRecordSignReq physicRecordSignReq) {
Boolean f = false;
boolean finished = false;
Long userId = SpringContextUtils.getUserId();
String getstamp = cloudsignService.sign(physicRecordSignReq.getEncryptedToken(), physicRecordSignReq.getRelBizNo(), physicRecordSignReq.getBase64SourceData());
PhysicRecord physicRecord = getInfo(physicRecordSignReq.getPhysicRecordId());
SysUser sysUser = sysUserMapper.selectById(userId);
if(physicRecord.getStatus().equals(0)){
if(!RoleTypeEum.isPass(sysUser.getRoleAsList(),RoleTypeEum.FY)){
if (ObjectUtil.equals(physicRecord.getStatus(), 0)) {
// 1)发药人签名
if (!RoleTypeEum.isPass(sysUser.getRoleAsList(), RoleTypeEum.FY)) {
throw new ServiceException("需要发药人权限才可进行签名");
}
physicRecord.setStatus(1);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(),userId);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(), userId);
physicRecord.setDpUser(JSONUtil.toJsonStr(signInfoDTO));
}else if(physicRecord.getStatus().equals(1)) {
} else if (ObjectUtil.equals(physicRecord.getStatus(), 1)) {
if (!RoleTypeEum.isPass(sysUser.getRoleAsList(), RoleTypeEum.DP)) {
throw new ServiceException("需要调配人权限才可进行签名");
}
physicRecord.setStatus(2);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(), userId);
physicRecord.setFyUser(JSONUtil.toJsonStr(signInfoDTO));
f=true;
finished = true;
} else if (ObjectUtil.equals(physicRecord.getStatus(), 2)) {
// 2)验收人签名
if (!RoleTypeEum.isPass(sysUser.getRoleAsList(), RoleTypeEum.YS)) {
throw new ServiceException("需要医生权限才可进行签名");
}
physicRecord.setStatus(3);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(), userId);
physicRecord.setYsUser(JSONUtil.toJsonStr(signInfoDTO));
} else if (ObjectUtil.equals(physicRecord.getStatus(), 3)) {
// 3)复核人签名
if (!RoleTypeEum.isPass(sysUser.getRoleAsList(), RoleTypeEum.FH)) {
throw new ServiceException("需要复核人权限才可进行签名");
}
if(f){
physicRecord.setStatus(100);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(), userId);
physicRecord.setFhUser(JSONUtil.toJsonStr(signInfoDTO));
// 完成
finished = true;
}
if (finished) {
// 5)完成 => 生成专账
BillDTO billDTO = new BillDTO();
BeanUtil.copyProperties(physicRecord,billDTO);
BeanUtil.copyProperties(physicRecord, billDTO);
billDTO.setType(4);
billDTO.setDeptId(physicRecord.getDeptId());
billDTO.setRefId(physicRecord.getId());
......
......@@ -82,6 +82,7 @@ public class PhysicStorageAmpouleServiceImpl extends AbstractService implements
ampoule.setBatchBalance(batchNoSum+physic.getPhysicNum());
ampoule.setPhysicNum(physicSum+physic.getPhysicNum());
// TODO:签名
ampoule.setJsUser(null);
ampoule.setThUser(null);
......@@ -120,6 +121,7 @@ public class PhysicStorageAmpouleServiceImpl extends AbstractService implements
ampoule.setBatchBalance(batchNoSum);
ampoule.setPhysicNum(physicSum);
// TODO:sign - 签名
ampoule.setJsUser(null);
ampoule.setThUser(null);
......@@ -150,8 +152,9 @@ public class PhysicStorageAmpouleServiceImpl extends AbstractService implements
}
@Override
@Transactional(rollbackFor = Exception.class)
public PhysicStorageAmpoule sign(PhysicStorageAmpouleSignReq physicStorageAmpouleSignReq) {
Boolean f = false;
boolean finished = false;
Long userId = SpringContextUtils.getUserId();
String getstamp = cloudsignService.sign(physicStorageAmpouleSignReq.getEncryptedToken(), physicStorageAmpouleSignReq.getRelBizNo(), physicStorageAmpouleSignReq.getBase64SourceData());
PhysicStorageAmpoule ampoule = getInfo(physicStorageAmpouleSignReq.getPhysicStorageAmpouleId());
......@@ -170,15 +173,19 @@ public class PhysicStorageAmpouleServiceImpl extends AbstractService implements
if (!RoleTypeEum.isPass(sysUser.getRoleAsList(), RoleTypeEum.TH)) {
throw new ServiceException("需要退回人权限才可进行签名");
}
ampoule.setStatus(2);
ampoule.setStatus(100);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(), userId);
ampoule.setThUser(JSONUtil.toJsonStr(signInfoDTO));
f=true;
// 完成
finished=true;
}
if(f){
if(finished){
// 完成 => 转账生成
BillDTO billDTO = new BillDTO();
BeanUtil.copyProperties(ampoule,billDTO);
billDTO.setType(ampoule.getType().equals("1")?5:7);
billDTO.setType(ampoule.getType().equals("1") ? 5 : 7);
billDTO.setDeptId(ampoule.getAcceptDeptId());
billDTO.setRefId(ampoule.getId());
physicBillService.createBill(billDTO);
......
......@@ -24,6 +24,7 @@ import com.jmai.sys.ctx.SpringContextUtils;
import com.jmai.sys.entity.SysUser;
import com.jmai.sys.mapper.SysUserMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
......@@ -86,8 +87,9 @@ public class PhysicWarehouseServiceImpl extends AbstractService implements Phys
}
@Override
@Transactional(rollbackFor = Exception.class)
public PhysicWarehouseVO sign(PhysicWarehouseSignReq physicWarehouseSignReq) {
Boolean f = false;
boolean finished = false;
Long userId = SpringContextUtils.getUserId();
String getstamp = cloudsignService.sign(physicWarehouseSignReq.getEncryptedToken(), physicWarehouseSignReq.getRelBizNo(), physicWarehouseSignReq.getBase64SourceData());
PhysicWarehouse physicWarehouse = physicWarehouseMapper.selectById(physicWarehouseSignReq.getPhysicWarehouseId());
......@@ -111,19 +113,21 @@ public class PhysicWarehouseServiceImpl extends AbstractService implements Phys
if(!RoleTypeEum.isPass(sysUser.getRoleAsList(),RoleTypeEum.BG)){
throw new ServiceException("需要保管权限才可进行签名");
}
physicWarehouse.setStatus(3);
physicWarehouse.setStatus(100);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(),userId);;
physicWarehouse.setBgUser(JSONUtil.toJsonStr(signInfoDTO));
f = true;
// 完成
finished = true;
}
if(f){
if(finished){
// 完成 => 转账生成
BillDTO billDTO = new BillDTO();
BeanUtil.copyProperties(physicWarehouse,billDTO);
billDTO.setType(1);
billDTO.setDeptId(physicWarehouse.getDeptId());
billDTO.setRefId(physicWarehouse.getId());
physicBillService.createBill(billDTO);
}
physicWarehouseMapper.updateById(physicWarehouse);
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jmai.physic.mapper.PhysicBillHandoverMapper">
</mapper>
\ No newline at end of file
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