Commit 2ae0a9b8 by zhu.zewen

完善实体字段注释

统一各业务单“已完成”状态
新增药品专账交接单
parent 32440598
Showing with 555 additions and 161 deletions
package com.jmai.physic.controller; package com.jmai.physic.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jmai.physic.dto.*; import com.jmai.physic.dto.*;
import com.jmai.physic.entity.PhysicBill; import com.jmai.physic.entity.PhysicBill;
import com.jmai.physic.entity.PhysicRecord; import com.jmai.physic.entity.PhysicBillHandover;
import com.jmai.physic.mapper.PhysicBillMapper;
import com.jmai.physic.service.PhysicBillService; import com.jmai.physic.service.PhysicBillService;
import com.jmai.physic.vo.BillInfoVO; import com.jmai.physic.vo.BillInfoVO;
import com.jmai.physic.vo.BillQueryVO; import com.jmai.physic.vo.BillQueryVO;
import com.jmai.physic.vo.PhysicApplyVO;
import com.jmai.sys.aop.Auth; import com.jmai.sys.aop.Auth;
import com.jmai.sys.dto.ResponseData; import com.jmai.sys.dto.ResponseData;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -35,22 +34,50 @@ public class PhysicBillController { ...@@ -35,22 +34,50 @@ public class PhysicBillController {
private PhysicBillService physicBillService; private PhysicBillService physicBillService;
@GetMapping("/list") @GetMapping("/list")
@ApiOperation(value = "专账") @ApiOperation(value = "专账-列表")
public ResponseData<List<BillInfoVO> > list(String physicName) { public ResponseData<List<BillInfoVO> > list(String physicName) {
List<BillInfoVO> billInfoVOS = physicBillService.listBill(physicName); List<BillInfoVO> billInfoVOS = physicBillService.listBill(physicName);
return ResponseData.ok(billInfoVOS); return ResponseData.ok(billInfoVOS);
} }
@PostMapping("/listDetailPage") @PostMapping("/listDetailPage")
@ApiOperation(value = "专账详情") @ApiOperation(value = "专账-详情列表")
public Page<BillQueryVO> listPage(@RequestBody PhysicBillQueryReq req){ public Page<BillQueryVO> listPage(@RequestBody PhysicBillQueryReq req){
return physicBillService.listPage(req); return physicBillService.listPage(req);
} }
@PostMapping("/sign") @PostMapping("/sign")
@ApiOperation(value = "签名") @ApiOperation(value = "专账-签名")
public ResponseData<PhysicBill> sign(@RequestBody PhysicBillSignReq physicBillSignReq) { public ResponseData<PhysicBill> sign(@RequestBody PhysicBillSignReq physicBillSignReq) {
PhysicBill bill = physicBillService.sign(physicBillSignReq); PhysicBill bill = physicBillService.sign(physicBillSignReq);
return ResponseData.ok(bill); 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; package com.jmai.physic.controller;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jmai.physic.dto.PhysicRecordCreateReq; import com.google.common.collect.ImmutableList;
import com.jmai.physic.dto.PhysicRecordQueryReq; import com.jmai.api.exception.ServiceException;
import com.jmai.physic.dto.PhysicQueryReq; import com.jmai.physic.dto.*;
import com.jmai.physic.dto.PhysicRecordSignReq;
import com.jmai.physic.entity.PhysicRecord; import com.jmai.physic.entity.PhysicRecord;
import com.jmai.physic.service.PhysicRecordService; import com.jmai.physic.service.PhysicRecordService;
import com.jmai.physic.vo.PhysicRecordVO; import com.jmai.physic.vo.PhysicRecordVO;
import com.jmai.physic.vo.PhysicVO; import com.jmai.physic.vo.PhysicVO;
import com.jmai.sys.AbstractService;
import com.jmai.sys.aop.Auth; 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 com.jmai.sys.dto.ResponseData;
import io.swagger.annotations.Api; import io.swagger.annotations.*;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.List; import java.util.*;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.stream.Collectors;
@Slf4j @Slf4j
@Auth @Auth
...@@ -33,7 +36,7 @@ import java.util.List; ...@@ -33,7 +36,7 @@ import java.util.List;
@RequestMapping("/physicRecord") @RequestMapping("/physicRecord")
@Api(tags = "药品专用登记") @Api(tags = "药品专用登记")
@ApiImplicitParams({@ApiImplicitParam(paramType = "header", name = "Access-Token", value = "凭证", required = true, dataType = "string")}) @ApiImplicitParams({@ApiImplicitParam(paramType = "header", name = "Access-Token", value = "凭证", required = true, dataType = "string")})
public class PhysicRecordController { public class PhysicRecordController extends AbstractService {
@Resource @Resource
private PhysicRecordService physicRecordService; private PhysicRecordService physicRecordService;
...@@ -65,4 +68,50 @@ public class PhysicRecordController { ...@@ -65,4 +68,50 @@ public class PhysicRecordController {
return ResponseData.ok(page); 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; package com.jmai.physic.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@Data @Data
@ApiModel(value = "BillDTO", description = "药品专账")
public class BillDTO { public class BillDTO {
@ApiModelProperty(value = "部门id") @ApiModelProperty(value = "部门id")
private Long deptId; private Long deptId;
......
...@@ -5,16 +5,7 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -5,16 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@Data @Data
public class PhysicAmpouleSignReq { public class PhysicAmpouleSignReq extends SignReq {
@ApiModelProperty(value = "签名token")
private String encryptedToken;
@ApiModelProperty(value = "签名账号")
private String relBizNo;
@ApiModelProperty(value = "签名base64图片")
private String base64SourceData;
@ApiModelProperty(value = "药库空安瓿id") @ApiModelProperty(value = "药库空安瓿id")
private Long physicAmpouleId; private Long physicAmpouleId;
} }
...@@ -5,16 +5,7 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -5,16 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@Data @Data
public class PhysicApplySignReq { public class PhysicApplySignReq extends SignReq {
@ApiModelProperty(value = "签名token")
private String encryptedToken;
@ApiModelProperty(value = "签名账号")
private String relBizNo;
@ApiModelProperty(value = "签名base64图片")
private String base64SourceData;
@ApiModelProperty(value = "药品申请id") @ApiModelProperty(value = "药品申请id")
private Long physicApplyId; 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; ...@@ -5,16 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@Data @Data
public class PhysicBillSignReq { public class PhysicBillSignReq extends SignReq {
@ApiModelProperty(value = "签名token")
private String encryptedToken;
@ApiModelProperty(value = "签名账号")
private String relBizNo;
@ApiModelProperty(value = "签名base64图片")
private String base64SourceData;
@ApiModelProperty(value = "专账id") @ApiModelProperty(value = "专账id")
private Long physicBillId; private Long physicBillId;
} }
...@@ -18,6 +18,8 @@ public class PhysicDestroyCheckCreateReq { ...@@ -18,6 +18,8 @@ public class PhysicDestroyCheckCreateReq {
private String applyTitle; private String applyTitle;
@ApiModelProperty(value = "申请理由") @ApiModelProperty(value = "申请理由")
private String applyReason; private String applyReason;
@ApiModelProperty(value = "图片")
private List<Long> images; private List<Long> images;
@ApiModelProperty(value = "申请明细列表")
private List<PhysicDestroyCheckDetail> checkDetailList = Collections.emptyList(); private List<PhysicDestroyCheckDetail> checkDetailList = Collections.emptyList();
} }
...@@ -5,16 +5,7 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -5,16 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@Data @Data
public class PhysicDestroySignReq { public class PhysicDestroySignReq extends SignReq {
@ApiModelProperty(value = "签名token")
private String encryptedToken;
@ApiModelProperty(value = "签名账号")
private String relBizNo;
@ApiModelProperty(value = "签名base64图片")
private String base64SourceData;
@ApiModelProperty(value = "药品销毁id") @ApiModelProperty(value = "药品销毁id")
private Long physicDestroyId; private Long physicDestroyId;
} }
...@@ -20,11 +20,45 @@ public class PhysicInfoDTO { ...@@ -20,11 +20,45 @@ public class PhysicInfoDTO {
@ApiModelProperty(value = "药品类型描述") @ApiModelProperty(value = "药品类型描述")
private String physicTypeDesc; private String physicTypeDesc;
@ApiModelProperty(value = "包装规格")
private String pkgSpecCrit; private String pkgSpecCrit;
@ApiModelProperty(value = "制剂类型描述")
private String prepnTypeDesc; private String prepnTypeDesc;
@ApiModelProperty(value = "供应商") @ApiModelProperty(value = "供应商")
private String supplyName; private String supplyName;
@ApiModelProperty(value = "批号") @ApiModelProperty(value = "批号")
private String batchNo; 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 { ...@@ -25,12 +25,14 @@ public class PhysicRecordCreateReq {
private String prescriptionNumber; private String prescriptionNumber;
@ApiModelProperty(value = "处方医生") @ApiModelProperty(value = "处方医生")
private String prescriptionDoctor; private String prescriptionDoctor;
@ApiModelProperty(value = "处方图片")
private List<Long> prescriptionImages; private List<Long> prescriptionImages;
@ApiModelProperty(value = "药品记录集") @ApiModelProperty(value = "药品记录集")
private List<Physic> physicList; private List<Physic> physicList;
@ApiModelProperty(value = "签名")
private String sign;
@Data @Data
public static class Physic{ public static class Physic{
......
...@@ -5,16 +5,7 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -5,16 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@Data @Data
public class PhysicRecordSignReq { public class PhysicRecordSignReq extends SignReq {
@ApiModelProperty(value = "签名token")
private String encryptedToken;
@ApiModelProperty(value = "签名账号")
private String relBizNo;
@ApiModelProperty(value = "签名base64图片")
private String base64SourceData;
@ApiModelProperty(value = "药品登记id") @ApiModelProperty(value = "药品登记id")
private Long physicRecordId; private Long physicRecordId;
} }
...@@ -24,6 +24,9 @@ public class PhysicStorageAmpouleCreateReq { ...@@ -24,6 +24,9 @@ public class PhysicStorageAmpouleCreateReq {
@ApiModelProperty(value = "药品记录集") @ApiModelProperty(value = "药品记录集")
private List<PhysicStorageAmpouleCreateReq.Physic> physicList; private List<PhysicStorageAmpouleCreateReq.Physic> physicList;
@ApiModelProperty(value = "签名")
private String sign;
@Data @Data
public static class Physic{ public static class Physic{
@ApiModelProperty(value = "药品名称") @ApiModelProperty(value = "药品名称")
......
...@@ -5,16 +5,7 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -5,16 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@Data @Data
public class PhysicWarehouseSignReq { public class PhysicWarehouseSignReq extends SignReq {
@ApiModelProperty(value = "签名token")
private String encryptedToken;
@ApiModelProperty(value = "签名账号")
private String relBizNo;
@ApiModelProperty(value = "签名base64图片")
private String base64SourceData;
@ApiModelProperty(value = "入库id") @ApiModelProperty(value = "入库id")
private Long physicWarehouseId; 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 { ...@@ -40,11 +40,13 @@ public class PhysicAmpoule extends BaseVersionEntity {
private Integer batchBalance; private Integer batchBalance;
private Integer physicBalance; private Integer physicBalance;
@ApiModelProperty(value = "状态:0-待接受退回、1-待退回复核、100-已完成(0-99审核中)")
private Integer status;
@ApiModelProperty(value = "接受退回处理人签名")
private String chUser; private String chUser;
@ApiModelProperty(value = "复核人签名")
private String fhUser; private String fhUser;
@ApiModelProperty(value = "0-待处理 1-接受退回处理 2-复核人处理")
private Integer status;
private String remark; private String remark;
} }
...@@ -40,9 +40,8 @@ public class PhysicApply extends BaseVersionEntity{ ...@@ -40,9 +40,8 @@ public class PhysicApply extends BaseVersionEntity{
@ApiModelProperty(value = "领药部门") @ApiModelProperty(value = "领药部门")
private Long lyDeptId; private Long lyDeptId;
@ApiModelProperty(value = "状态 0 -待领药 1-待审核 2-待发药 3 -待复核 4 -完成") @ApiModelProperty(value = "状态 0 -待领药、1-待审核、2-待发药、3 -待复核、100 -已完成(0-99审核中)")
private Integer status; private Integer status;
@ApiModelProperty(value = "领药人") @ApiModelProperty(value = "领药人")
private String lyUser; private String lyUser;
@ApiModelProperty(value = "审核人") @ApiModelProperty(value = "审核人")
......
...@@ -42,10 +42,11 @@ public class PhysicBill extends BaseVersionEntity { ...@@ -42,10 +42,11 @@ public class PhysicBill extends BaseVersionEntity {
@ApiModelProperty(value = "相关申请、入库id") @ApiModelProperty(value = "相关申请、入库id")
private Long refId; private Long refId;
@ApiModelProperty(value = "状态 0 -待验收 1 -已完成") @ApiModelProperty(value = "状态 0 -待领药、1-待复核、100-已完成(0-99审核中)")
private Integer status; private Integer status;
@ApiModelProperty(value = "领药人")
private String lyUser; private String lyUser;
@ApiModelProperty(value = "复核人")
private String fhUser; private String fhUser;
@ApiModelProperty(value = "结存") @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 { ...@@ -23,12 +23,13 @@ public class PhysicDestroy extends BaseVersionEntity {
private String surplus; private String surplus;
@ApiModelProperty(value = "状态 0-代操作 1-待复核 2-已完成") @ApiModelProperty(value = "状态:0-待操作、1-待复核、100-已完成( 0-99审核中)")
private Integer status; private Integer status;
@ApiModelProperty(value = "操作人") @ApiModelProperty(value = "操作人")
private String czUser; private String czUser;
@ApiModelProperty(value = "复核人") @ApiModelProperty(value = "复核人")
private String fhUser; private String fhUser;
@ApiModelProperty(value = "图片") @ApiModelProperty(value = "图片")
private String images; private String images;
@ApiModelProperty(value = "销毁时间") @ApiModelProperty(value = "销毁时间")
......
...@@ -24,9 +24,8 @@ public class PhysicDestroyCheck extends BaseVersionEntity { ...@@ -24,9 +24,8 @@ public class PhysicDestroyCheck extends BaseVersionEntity {
@ApiModelProperty(value = "销毁数量") @ApiModelProperty(value = "销毁数量")
private Integer destroyNum; private Integer destroyNum;
@ApiModelProperty(value = "销毁状态:0-5审批中, 6-已销毁 ") @ApiModelProperty(value = "销毁状态:0-99审批中, 100-已完成/已销毁")
private Integer status; private Integer status;
@ApiModelProperty(value = "销毁人") @ApiModelProperty(value = "销毁人")
private String xhUser; private String xhUser;
@ApiModelProperty(value = "监督人") @ApiModelProperty(value = "监督人")
......
...@@ -9,7 +9,6 @@ import lombok.Data; ...@@ -9,7 +9,6 @@ import lombok.Data;
@Data @Data
@ApiModel(description = "药品专用登记") @ApiModel(description = "药品专用登记")
@TableName("physic_record") @TableName("physic_record")
public class PhysicRecord extends BaseVersionEntity { public class PhysicRecord extends BaseVersionEntity {
@ApiModelProperty(value = "部门ID") @ApiModelProperty(value = "部门ID")
private Long deptId; private Long deptId;
...@@ -34,28 +33,29 @@ public class PhysicRecord extends BaseVersionEntity { ...@@ -34,28 +33,29 @@ public class PhysicRecord extends BaseVersionEntity {
@ApiModelProperty(value = "患者姓名") @ApiModelProperty(value = "患者姓名")
private String sickName; private String sickName;
@ApiModelProperty(value = "患者性别")
private Integer sickSex; private Integer sickSex;
@ApiModelProperty(value = "患者年龄")
private Integer sickAge; private Integer sickAge;
@ApiModelProperty(value = "患者身份证号")
private String sickIdCard; private String sickIdCard;
@ApiModelProperty(value = "住院号")
private String hospitalNumber; private String hospitalNumber;
@ApiModelProperty(value = "疾病名称") @ApiModelProperty(value = "疾病名称")
private String diseaseName; private String diseaseName;
@ApiModelProperty(value = "处方编号") @ApiModelProperty(value = "处方编号")
private String prescriptionNumber; private String prescriptionNumber;
@ApiModelProperty(value = "处方医生") @ApiModelProperty(value = "处方医生")
private String prescriptionDoctor; private String prescriptionDoctor;
@ApiModelProperty(value = "状态 0-待调配 1-待发药 2-已完成") @ApiModelProperty(value = "状态:0-待调配、1-待发药、2- 待验收、3- 待复核、100-已完成")
private Integer status; private Integer status;
@ApiModelProperty(value = "调配人")
private String dpUser; private String dpUser;
@ApiModelProperty(value = "发药人")
private String fyUser; private String fyUser;
@ApiModelProperty(value = "验收人")
private String ysUser;
@ApiModelProperty(value = "复核人")
private String fhUser;
} }
...@@ -8,7 +8,7 @@ import lombok.Data; ...@@ -8,7 +8,7 @@ import lombok.Data;
@Data @Data
@ApiModel(description = "药品专用登记-药库") @ApiModel(description = "药品专用登记-药库(空安瓿登记)")
@TableName("physic_storage_ampoule") @TableName("physic_storage_ampoule")
public class PhysicStorageAmpoule extends BaseVersionEntity { public class PhysicStorageAmpoule extends BaseVersionEntity {
...@@ -50,12 +50,12 @@ public class PhysicStorageAmpoule extends BaseVersionEntity { ...@@ -50,12 +50,12 @@ public class PhysicStorageAmpoule extends BaseVersionEntity {
private Integer batchBalance; private Integer batchBalance;
private Integer physicBalance; private Integer physicBalance;
@ApiModelProperty(value = "状态:0-待接收、1-待退回、100-完成(0-99审核中)")
private Integer status;
@ApiModelProperty(value = "接收人") @ApiModelProperty(value = "接收人")
private String jsUser; private String jsUser;
@ApiModelProperty(value = "退回人") @ApiModelProperty(value = "退回人")
private String thUser; private String thUser;
@ApiModelProperty(value = "状态:0-待处理、1-退出人处理、2-接收人处理")
private Integer status;
private String remark; private String remark;
} }
...@@ -35,9 +35,8 @@ public class PhysicWarehouse extends BaseVersionEntity{ ...@@ -35,9 +35,8 @@ public class PhysicWarehouse extends BaseVersionEntity{
@ApiModelProperty(value = "药品数量") @ApiModelProperty(value = "药品数量")
private Integer physicNum; private Integer physicNum;
@ApiModelProperty(value = "状态 0 -待验收 1-待复核 2 -待保管 3 -完成") @ApiModelProperty(value = "状态:0 -待验收、1-待复核、2-待保管、100-完成(0-99审核中)")
private Integer status; private Integer status;
@ApiModelProperty(value = "验收人") @ApiModelProperty(value = "验收人")
private String ysUser; private String ysUser;
@ApiModelProperty(value = "复核人") @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; package com.jmai.physic.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jmai.physic.dto.BillDTO; import com.jmai.physic.dto.*;
import com.jmai.physic.dto.PhysicBillQueryReq;
import com.jmai.physic.dto.PhysicBillSignReq;
import com.jmai.physic.entity.PhysicBill; import com.jmai.physic.entity.PhysicBill;
import com.jmai.physic.entity.PhysicBillHandover;
import com.jmai.physic.vo.BillInfoVO; import com.jmai.physic.vo.BillInfoVO;
import com.jmai.physic.vo.BillQueryVO; import com.jmai.physic.vo.BillQueryVO;
import java.util.List; import java.util.List;
public interface PhysicBillService { public interface PhysicBillService {
// 专账
void createBill(BillDTO billDTO); void createBill(BillDTO billDTO);
List<BillInfoVO> listBill(String physicName); List<BillInfoVO> listBill(String physicName);
Page<BillQueryVO> listPage(PhysicBillQueryReq req); Page<BillQueryVO> listPage(PhysicBillQueryReq req);
PhysicBill sign(PhysicBillSignReq physicBillSignReq); 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 ...@@ -90,7 +90,7 @@ public class PhysicAmpouleServiceImpl extends AbstractService implements PhysicA
@Override @Override
public PhysicAmpoule sign(PhysicAmpouleSignReq physicAmpouleSignReq) { public PhysicAmpoule sign(PhysicAmpouleSignReq physicAmpouleSignReq) {
Boolean f = false; Boolean finished = false;
Long userId = SpringContextUtils.getUserId(); Long userId = SpringContextUtils.getUserId();
String getstamp = cloudsignService.sign(physicAmpouleSignReq.getEncryptedToken(), physicAmpouleSignReq.getRelBizNo(), physicAmpouleSignReq.getBase64SourceData()); String getstamp = cloudsignService.sign(physicAmpouleSignReq.getEncryptedToken(), physicAmpouleSignReq.getRelBizNo(), physicAmpouleSignReq.getBase64SourceData());
PhysicAmpoule ampoule = getInfo(physicAmpouleSignReq.getPhysicAmpouleId()); PhysicAmpoule ampoule = getInfo(physicAmpouleSignReq.getPhysicAmpouleId());
...@@ -106,12 +106,15 @@ public class PhysicAmpouleServiceImpl extends AbstractService implements PhysicA ...@@ -106,12 +106,15 @@ public class PhysicAmpouleServiceImpl extends AbstractService implements PhysicA
if (!RoleTypeEum.isPass(sysUser.getRoleAsList(), RoleTypeEum.FH)) { if (!RoleTypeEum.isPass(sysUser.getRoleAsList(), RoleTypeEum.FH)) {
throw new ServiceException("需要复核人权限才可进行签名"); throw new ServiceException("需要复核人权限才可进行签名");
} }
ampoule.setStatus(2); ampoule.setStatus(100);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(), userId); SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(), userId);
ampoule.setFhUser(JSONUtil.toJsonStr(signInfoDTO)); ampoule.setFhUser(JSONUtil.toJsonStr(signInfoDTO));
f=true;
// 完成
finished=true;
} }
if(f){ if(finished){
// 完成 => 转账生成
BillDTO billDTO = new BillDTO(); BillDTO billDTO = new BillDTO();
BeanUtil.copyProperties(ampoule,billDTO); BeanUtil.copyProperties(ampoule,billDTO);
billDTO.setType(ampoule.getType().equals("1")?5:6); billDTO.setType(ampoule.getType().equals("1")?5:6);
......
...@@ -162,7 +162,7 @@ public class PhysicApplyServiceImpl extends AbstractService implements PhysicApp ...@@ -162,7 +162,7 @@ public class PhysicApplyServiceImpl extends AbstractService implements PhysicApp
@Transactional @Transactional
@Override @Override
public PhysicApplyVO sign(PhysicApplySignReq physicApplySignReq) { public PhysicApplyVO sign(PhysicApplySignReq physicApplySignReq) {
Boolean f =false; Boolean finished =false;
Long userId = SpringContextUtils.getUserId(); Long userId = SpringContextUtils.getUserId();
SysUser sysUser = sysUserMapper.selectById(userId); SysUser sysUser = sysUserMapper.selectById(userId);
String getstamp = cloudsignService.sign(physicApplySignReq.getEncryptedToken(), physicApplySignReq.getRelBizNo(), physicApplySignReq.getBase64SourceData()); String getstamp = cloudsignService.sign(physicApplySignReq.getEncryptedToken(), physicApplySignReq.getRelBizNo(), physicApplySignReq.getBase64SourceData());
...@@ -196,13 +196,16 @@ public class PhysicApplyServiceImpl extends AbstractService implements PhysicApp ...@@ -196,13 +196,16 @@ public class PhysicApplyServiceImpl extends AbstractService implements PhysicApp
if(!RoleTypeEum.isPass(sysUser.getRoleAsList(),RoleTypeEum.FH)){ if(!RoleTypeEum.isPass(sysUser.getRoleAsList(),RoleTypeEum.FH)){
throw new ServiceException("需要复核人权限才可进行签名"); throw new ServiceException("需要复核人权限才可进行签名");
} }
physicApply.setStatus(4); physicApply.setStatus(100);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(),userId);; SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(),userId);;
physicApply.setFhUser(JSONUtil.toJsonStr(signInfoDTO)); physicApply.setFhUser(JSONUtil.toJsonStr(signInfoDTO));
f = true;
// 完成
finished = true;
} }
physicApplyMapper.updateById(physicApply); physicApplyMapper.updateById(physicApply);
if(f){ if(finished){
// 完成 => 转账生成
BillDTO billDTO = new BillDTO(); BillDTO billDTO = new BillDTO();
BeanUtil.copyProperties(physicApply,billDTO); BeanUtil.copyProperties(physicApply,billDTO);
billDTO.setType(2); billDTO.setType(2);
......
...@@ -3,14 +3,15 @@ package com.jmai.physic.service.impl; ...@@ -3,14 +3,15 @@ package com.jmai.physic.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONUtil; 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.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jmai.api.exception.ServiceException; import com.jmai.api.exception.ServiceException;
import com.jmai.physic.cloudsign.CloudsignService; import com.jmai.physic.cloudsign.CloudsignService;
import com.jmai.physic.dto.BillDTO; import com.jmai.physic.dto.*;
import com.jmai.physic.dto.PhysicBillQueryReq;
import com.jmai.physic.dto.PhysicBillSignReq;
import com.jmai.physic.dto.SignInfoDTO;
import com.jmai.physic.entity.PhysicBill; 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.mapper.PhysicBillMapper;
import com.jmai.physic.service.PhysicBillService; import com.jmai.physic.service.PhysicBillService;
import com.jmai.physic.vo.BillInfoVO; import com.jmai.physic.vo.BillInfoVO;
...@@ -25,13 +26,17 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -25,13 +26,17 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Optional;
@Service @Service
public class PhysicBillServiceImpl extends AbstractService implements PhysicBillService { public class PhysicBillServiceImpl extends AbstractService implements PhysicBillService {
@Resource @Resource
private PhysicBillMapper physicBillMapper; private PhysicBillMapper physicBillMapper;
@Resource
private PhysicBillHandoverMapper physicBillHandoverMapper;
@Resource @Resource
private CloudsignService cloudsignService; private CloudsignService cloudsignService;
...@@ -81,7 +86,7 @@ public class PhysicBillServiceImpl extends AbstractService implements PhysicBill ...@@ -81,7 +86,7 @@ public class PhysicBillServiceImpl extends AbstractService implements PhysicBill
@Override @Override
public PhysicBill sign(PhysicBillSignReq physicBillSignReq) { public PhysicBill sign(PhysicBillSignReq physicBillSignReq) {
Boolean f = false; Boolean finished = false;
Long userId = SpringContextUtils.getUserId(); Long userId = SpringContextUtils.getUserId();
String getstamp = cloudsignService.sign(physicBillSignReq.getEncryptedToken(), physicBillSignReq.getRelBizNo(), physicBillSignReq.getBase64SourceData()); String getstamp = cloudsignService.sign(physicBillSignReq.getEncryptedToken(), physicBillSignReq.getRelBizNo(), physicBillSignReq.getBase64SourceData());
PhysicBill bill = physicBillMapper.selectById(physicBillSignReq.getPhysicBillId()); PhysicBill bill = physicBillMapper.selectById(physicBillSignReq.getPhysicBillId());
...@@ -97,11 +102,126 @@ public class PhysicBillServiceImpl extends AbstractService implements PhysicBill ...@@ -97,11 +102,126 @@ public class PhysicBillServiceImpl extends AbstractService implements PhysicBill
if(!RoleTypeEum.isPass(sysUser.getRoleAsList(),RoleTypeEum.FH)){ if(!RoleTypeEum.isPass(sysUser.getRoleAsList(),RoleTypeEum.FH)){
throw new ServiceException("需要复核人权限才可进行签名"); throw new ServiceException("需要复核人权限才可进行签名");
} }
bill.setStatus(2); bill.setStatus(100);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(), userId); SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(), userId);
bill.setFhUser(JSONUtil.toJsonStr(signInfoDTO)); bill.setFhUser(JSONUtil.toJsonStr(signInfoDTO));
// 完成
finished = true;
} }
physicBillMapper.updateById(bill); physicBillMapper.updateById(bill);
return 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 ...@@ -114,7 +114,7 @@ public class PhysicDestroyCheckServiceImpl extends BaseServiceImpl<PhysicDestroy
@Override @Override
public PhysicDestroyCheck sign(PhysicDestroyCheckSignReq physicDestroyCheckSignReq) { public PhysicDestroyCheck sign(PhysicDestroyCheckSignReq physicDestroyCheckSignReq) {
Boolean f = false; boolean finished = false;
Long userId = SpringContextUtils.getUserId(); Long userId = SpringContextUtils.getUserId();
SysUser sysUser = sysUserMapper.selectById(userId); SysUser sysUser = sysUserMapper.selectById(userId);
String getstamp = cloudsignService.sign(physicDestroyCheckSignReq.getEncryptedToken(), physicDestroyCheckSignReq.getRelBizNo(), physicDestroyCheckSignReq.getBase64SourceData()); String getstamp = cloudsignService.sign(physicDestroyCheckSignReq.getEncryptedToken(), physicDestroyCheckSignReq.getRelBizNo(), physicDestroyCheckSignReq.getBase64SourceData());
...@@ -158,19 +158,24 @@ public class PhysicDestroyCheckServiceImpl extends BaseServiceImpl<PhysicDestroy ...@@ -158,19 +158,24 @@ public class PhysicDestroyCheckServiceImpl extends BaseServiceImpl<PhysicDestroy
if (!RoleTypeEum.isPass(sysUser.getRoleAsList(), RoleTypeEum.ZGYZ)) { if (!RoleTypeEum.isPass(sysUser.getRoleAsList(), RoleTypeEum.ZGYZ)) {
throw new ServiceException("需要主管院长权限才可进行签名"); throw new ServiceException("需要主管院长权限才可进行签名");
} }
physicDestroyCheck.setStatus(6); physicDestroyCheck.setStatus(100);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(), userId); SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(), userId);
physicDestroyCheck.setZgyzUser(JSONUtil.toJsonStr(signInfoDTO)); physicDestroyCheck.setZgyzUser(JSONUtil.toJsonStr(signInfoDTO));
f = true;
// 完成
finished = true;
} }
if(f){
if(finished){
// 完成 => 转账生成
BillDTO billDTO = new BillDTO(); BillDTO billDTO = new BillDTO();
BeanUtil.copyProperties(physicDestroyCheck,billDTO); BeanUtil.copyProperties(physicDestroyCheck,billDTO);
billDTO.setType(7); billDTO.setType(7);
billDTO.setDeptId(physicDestroyCheck.getApplyDeptId()); billDTO.setDeptId(physicDestroyCheck.getApplyDeptId());
billDTO.setRefId(physicDestroyCheck.getId()); billDTO.setRefId(physicDestroyCheck.getId());
physicBillService.createBill(billDTO); physicBillService.createBill(billDTO);
//创建销毁 //创建销毁
List<PhysicDestroyCheckDetail> list = physicDestroyCheckDetailService.list(new LambdaQueryWrapper<PhysicDestroyCheckDetail>().eq(PhysicDestroyCheckDetail::getCheckId, physicDestroyCheck.getId())); List<PhysicDestroyCheckDetail> list = physicDestroyCheckDetailService.list(new LambdaQueryWrapper<PhysicDestroyCheckDetail>().eq(PhysicDestroyCheckDetail::getCheckId, physicDestroyCheck.getId()));
for (PhysicDestroyCheckDetail physicDestroyCheckDetail : list) { for (PhysicDestroyCheckDetail physicDestroyCheckDetail : list) {
......
...@@ -17,6 +17,7 @@ import com.jmai.sys.ctx.SpringContextUtils; ...@@ -17,6 +17,7 @@ import com.jmai.sys.ctx.SpringContextUtils;
import com.jmai.sys.entity.SysUser; import com.jmai.sys.entity.SysUser;
import com.jmai.sys.mapper.SysUserMapper; import com.jmai.sys.mapper.SysUserMapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.LocalDateTime; import java.time.LocalDateTime;
...@@ -37,6 +38,7 @@ public class PhysicDestroyServiceImpl extends AbstractService implements PhysicD ...@@ -37,6 +38,7 @@ public class PhysicDestroyServiceImpl extends AbstractService implements PhysicD
private PhysicBillService physicBillService; private PhysicBillService physicBillService;
@Override @Override
@Transactional(rollbackFor = Exception.class)
public void create(PhysicDestroyCreateReq req) { public void create(PhysicDestroyCreateReq req) {
String orderNo = sysManager.newOrderNo(PhysicDestroy.class); String orderNo = sysManager.newOrderNo(PhysicDestroy.class);
PhysicDestroy destroy = new PhysicDestroy(); PhysicDestroy destroy = new PhysicDestroy();
...@@ -57,8 +59,9 @@ public class PhysicDestroyServiceImpl extends AbstractService implements PhysicD ...@@ -57,8 +59,9 @@ public class PhysicDestroyServiceImpl extends AbstractService implements PhysicD
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public PhysicDestroy sign(PhysicDestroySignReq physicDestroySignReq) { public PhysicDestroy sign(PhysicDestroySignReq physicDestroySignReq) {
Boolean f = false; boolean finished = false;
Long userId = SpringContextUtils.getUserId(); Long userId = SpringContextUtils.getUserId();
String getstamp = cloudsignService.sign(physicDestroySignReq.getEncryptedToken(), physicDestroySignReq.getRelBizNo(), physicDestroySignReq.getBase64SourceData()); String getstamp = cloudsignService.sign(physicDestroySignReq.getEncryptedToken(), physicDestroySignReq.getRelBizNo(), physicDestroySignReq.getBase64SourceData());
PhysicDestroy physicDestroy = physicDestroyMapper.selectById(physicDestroySignReq.getPhysicDestroyId()); PhysicDestroy physicDestroy = physicDestroyMapper.selectById(physicDestroySignReq.getPhysicDestroyId());
...@@ -74,13 +77,17 @@ public class PhysicDestroyServiceImpl extends AbstractService implements PhysicD ...@@ -74,13 +77,17 @@ public class PhysicDestroyServiceImpl extends AbstractService implements PhysicD
if(!RoleTypeEum.isPass(sysUser.getRoleAsList(),RoleTypeEum.FH)){ if(!RoleTypeEum.isPass(sysUser.getRoleAsList(),RoleTypeEum.FH)){
throw new ServiceException("需要复核人权限才可进行签名"); throw new ServiceException("需要复核人权限才可进行签名");
} }
physicDestroy.setStatus(2); physicDestroy.setStatus(100);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(),userId);; SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(),userId);;
physicDestroy.setFhUser(JSONUtil.toJsonStr(signInfoDTO)); physicDestroy.setFhUser(JSONUtil.toJsonStr(signInfoDTO));
f = true;
// 完成
finished = true;
} }
if(f){
if(finished){
// 完成 => 转账生成
BillDTO billDTO = new BillDTO(); BillDTO billDTO = new BillDTO();
BeanUtil.copyProperties(physicDestroy,billDTO); BeanUtil.copyProperties(physicDestroy,billDTO);
billDTO.setType(7); billDTO.setType(7);
......
...@@ -36,25 +36,19 @@ import java.util.List; ...@@ -36,25 +36,19 @@ import java.util.List;
@Service @Service
public class PhysicRecordServiceImpl extends AbstractService implements PhysicRecordService { public class PhysicRecordServiceImpl extends AbstractService implements PhysicRecordService {
@Resource @Resource
private PhysicRecordMapper physicRecordMapper; private PhysicRecordMapper physicRecordMapper;
@Resource @Resource
private BizFileService bizFileService; private BizFileService bizFileService;
@Resource @Resource
private CloudsignService cloudsignService; private CloudsignService cloudsignService;
@Resource @Resource
private SysUserMapper sysUserMapper; private SysUserMapper sysUserMapper;
@Resource @Resource
private PhysicBillService physicBillService; private PhysicBillService physicBillService;
@Transactional
@Override @Override
@Transactional(rollbackFor = Exception.class)
public List<PhysicRecord> physicRecordCreate(PhysicRecordCreateReq req) { public List<PhysicRecord> physicRecordCreate(PhysicRecordCreateReq req) {
List<PhysicRecord> records = new ArrayList<>(); List<PhysicRecord> records = new ArrayList<>();
for (PhysicRecordCreateReq.Physic physic : req.getPhysicList()) { for (PhysicRecordCreateReq.Physic physic : req.getPhysicList()) {
...@@ -69,6 +63,24 @@ public class PhysicRecordServiceImpl extends AbstractService implements PhysicRe ...@@ -69,6 +63,24 @@ public class PhysicRecordServiceImpl extends AbstractService implements PhysicRe
record.setExpireDate(physic.getExpireDate()); record.setExpireDate(physic.getExpireDate());
record.setBatchNo(physic.getBatchNo()); record.setBatchNo(physic.getBatchNo());
record.setPhysicNum(physic.getPhysicNum()); 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); physicRecordMapper.insert(record);
if (ObjectUtil.isNotEmpty(req.getPrescriptionImages())) { if (ObjectUtil.isNotEmpty(req.getPrescriptionImages())) {
if (CollectionUtils.isNotEmpty(req.getPrescriptionImages())) { if (CollectionUtils.isNotEmpty(req.getPrescriptionImages())) {
...@@ -97,32 +109,54 @@ public class PhysicRecordServiceImpl extends AbstractService implements PhysicRe ...@@ -97,32 +109,54 @@ public class PhysicRecordServiceImpl extends AbstractService implements PhysicRe
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public PhysicRecord sign(PhysicRecordSignReq physicRecordSignReq) { public PhysicRecord sign(PhysicRecordSignReq physicRecordSignReq) {
Boolean f = false; boolean finished = false;
Long userId = SpringContextUtils.getUserId(); Long userId = SpringContextUtils.getUserId();
String getstamp = cloudsignService.sign(physicRecordSignReq.getEncryptedToken(), physicRecordSignReq.getRelBizNo(), physicRecordSignReq.getBase64SourceData()); String getstamp = cloudsignService.sign(physicRecordSignReq.getEncryptedToken(), physicRecordSignReq.getRelBizNo(), physicRecordSignReq.getBase64SourceData());
PhysicRecord physicRecord = getInfo(physicRecordSignReq.getPhysicRecordId()); PhysicRecord physicRecord = getInfo(physicRecordSignReq.getPhysicRecordId());
SysUser sysUser = sysUserMapper.selectById(userId); SysUser sysUser = sysUserMapper.selectById(userId);
if(physicRecord.getStatus().equals(0)){ if (ObjectUtil.equals(physicRecord.getStatus(), 0)) {
if(!RoleTypeEum.isPass(sysUser.getRoleAsList(),RoleTypeEum.FY)){ // 1)发药人签名
if (!RoleTypeEum.isPass(sysUser.getRoleAsList(), RoleTypeEum.FY)) {
throw new ServiceException("需要发药人权限才可进行签名"); throw new ServiceException("需要发药人权限才可进行签名");
} }
physicRecord.setStatus(1); physicRecord.setStatus(1);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(),userId); SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(), userId);
physicRecord.setDpUser(JSONUtil.toJsonStr(signInfoDTO)); 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)) { if (!RoleTypeEum.isPass(sysUser.getRoleAsList(), RoleTypeEum.DP)) {
throw new ServiceException("需要调配人权限才可进行签名"); throw new ServiceException("需要调配人权限才可进行签名");
} }
physicRecord.setStatus(2); physicRecord.setStatus(2);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(), userId); SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(), userId);
physicRecord.setFyUser(JSONUtil.toJsonStr(signInfoDTO)); 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(); BillDTO billDTO = new BillDTO();
BeanUtil.copyProperties(physicRecord,billDTO); BeanUtil.copyProperties(physicRecord, billDTO);
billDTO.setType(4); billDTO.setType(4);
billDTO.setDeptId(physicRecord.getDeptId()); billDTO.setDeptId(physicRecord.getDeptId());
billDTO.setRefId(physicRecord.getId()); billDTO.setRefId(physicRecord.getId());
......
...@@ -82,6 +82,7 @@ public class PhysicStorageAmpouleServiceImpl extends AbstractService implements ...@@ -82,6 +82,7 @@ public class PhysicStorageAmpouleServiceImpl extends AbstractService implements
ampoule.setBatchBalance(batchNoSum+physic.getPhysicNum()); ampoule.setBatchBalance(batchNoSum+physic.getPhysicNum());
ampoule.setPhysicNum(physicSum+physic.getPhysicNum()); ampoule.setPhysicNum(physicSum+physic.getPhysicNum());
// TODO:签名
ampoule.setJsUser(null); ampoule.setJsUser(null);
ampoule.setThUser(null); ampoule.setThUser(null);
...@@ -120,6 +121,7 @@ public class PhysicStorageAmpouleServiceImpl extends AbstractService implements ...@@ -120,6 +121,7 @@ public class PhysicStorageAmpouleServiceImpl extends AbstractService implements
ampoule.setBatchBalance(batchNoSum); ampoule.setBatchBalance(batchNoSum);
ampoule.setPhysicNum(physicSum); ampoule.setPhysicNum(physicSum);
// TODO:sign - 签名
ampoule.setJsUser(null); ampoule.setJsUser(null);
ampoule.setThUser(null); ampoule.setThUser(null);
...@@ -150,8 +152,9 @@ public class PhysicStorageAmpouleServiceImpl extends AbstractService implements ...@@ -150,8 +152,9 @@ public class PhysicStorageAmpouleServiceImpl extends AbstractService implements
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public PhysicStorageAmpoule sign(PhysicStorageAmpouleSignReq physicStorageAmpouleSignReq) { public PhysicStorageAmpoule sign(PhysicStorageAmpouleSignReq physicStorageAmpouleSignReq) {
Boolean f = false; boolean finished = false;
Long userId = SpringContextUtils.getUserId(); Long userId = SpringContextUtils.getUserId();
String getstamp = cloudsignService.sign(physicStorageAmpouleSignReq.getEncryptedToken(), physicStorageAmpouleSignReq.getRelBizNo(), physicStorageAmpouleSignReq.getBase64SourceData()); String getstamp = cloudsignService.sign(physicStorageAmpouleSignReq.getEncryptedToken(), physicStorageAmpouleSignReq.getRelBizNo(), physicStorageAmpouleSignReq.getBase64SourceData());
PhysicStorageAmpoule ampoule = getInfo(physicStorageAmpouleSignReq.getPhysicStorageAmpouleId()); PhysicStorageAmpoule ampoule = getInfo(physicStorageAmpouleSignReq.getPhysicStorageAmpouleId());
...@@ -170,15 +173,19 @@ public class PhysicStorageAmpouleServiceImpl extends AbstractService implements ...@@ -170,15 +173,19 @@ public class PhysicStorageAmpouleServiceImpl extends AbstractService implements
if (!RoleTypeEum.isPass(sysUser.getRoleAsList(), RoleTypeEum.TH)) { if (!RoleTypeEum.isPass(sysUser.getRoleAsList(), RoleTypeEum.TH)) {
throw new ServiceException("需要退回人权限才可进行签名"); throw new ServiceException("需要退回人权限才可进行签名");
} }
ampoule.setStatus(2); ampoule.setStatus(100);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(), userId); SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(), userId);
ampoule.setThUser(JSONUtil.toJsonStr(signInfoDTO)); ampoule.setThUser(JSONUtil.toJsonStr(signInfoDTO));
f=true;
// 完成
finished=true;
} }
if(f){
if(finished){
// 完成 => 转账生成
BillDTO billDTO = new BillDTO(); BillDTO billDTO = new BillDTO();
BeanUtil.copyProperties(ampoule,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.setDeptId(ampoule.getAcceptDeptId());
billDTO.setRefId(ampoule.getId()); billDTO.setRefId(ampoule.getId());
physicBillService.createBill(billDTO); physicBillService.createBill(billDTO);
......
...@@ -24,6 +24,7 @@ import com.jmai.sys.ctx.SpringContextUtils; ...@@ -24,6 +24,7 @@ import com.jmai.sys.ctx.SpringContextUtils;
import com.jmai.sys.entity.SysUser; import com.jmai.sys.entity.SysUser;
import com.jmai.sys.mapper.SysUserMapper; import com.jmai.sys.mapper.SysUserMapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -86,8 +87,9 @@ public class PhysicWarehouseServiceImpl extends AbstractService implements Phys ...@@ -86,8 +87,9 @@ public class PhysicWarehouseServiceImpl extends AbstractService implements Phys
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public PhysicWarehouseVO sign(PhysicWarehouseSignReq physicWarehouseSignReq) { public PhysicWarehouseVO sign(PhysicWarehouseSignReq physicWarehouseSignReq) {
Boolean f = false; boolean finished = false;
Long userId = SpringContextUtils.getUserId(); Long userId = SpringContextUtils.getUserId();
String getstamp = cloudsignService.sign(physicWarehouseSignReq.getEncryptedToken(), physicWarehouseSignReq.getRelBizNo(), physicWarehouseSignReq.getBase64SourceData()); String getstamp = cloudsignService.sign(physicWarehouseSignReq.getEncryptedToken(), physicWarehouseSignReq.getRelBizNo(), physicWarehouseSignReq.getBase64SourceData());
PhysicWarehouse physicWarehouse = physicWarehouseMapper.selectById(physicWarehouseSignReq.getPhysicWarehouseId()); PhysicWarehouse physicWarehouse = physicWarehouseMapper.selectById(physicWarehouseSignReq.getPhysicWarehouseId());
...@@ -111,19 +113,21 @@ public class PhysicWarehouseServiceImpl extends AbstractService implements Phys ...@@ -111,19 +113,21 @@ public class PhysicWarehouseServiceImpl extends AbstractService implements Phys
if(!RoleTypeEum.isPass(sysUser.getRoleAsList(),RoleTypeEum.BG)){ if(!RoleTypeEum.isPass(sysUser.getRoleAsList(),RoleTypeEum.BG)){
throw new ServiceException("需要保管权限才可进行签名"); throw new ServiceException("需要保管权限才可进行签名");
} }
physicWarehouse.setStatus(3); physicWarehouse.setStatus(100);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(),userId);; SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(),userId);;
physicWarehouse.setBgUser(JSONUtil.toJsonStr(signInfoDTO)); physicWarehouse.setBgUser(JSONUtil.toJsonStr(signInfoDTO));
f = true;
// 完成
finished = true;
} }
if(f){
if(finished){
// 完成 => 转账生成
BillDTO billDTO = new BillDTO(); BillDTO billDTO = new BillDTO();
BeanUtil.copyProperties(physicWarehouse,billDTO); BeanUtil.copyProperties(physicWarehouse,billDTO);
billDTO.setType(1); billDTO.setType(1);
billDTO.setDeptId(physicWarehouse.getDeptId()); billDTO.setDeptId(physicWarehouse.getDeptId());
billDTO.setRefId(physicWarehouse.getId()); billDTO.setRefId(physicWarehouse.getId());
physicBillService.createBill(billDTO); physicBillService.createBill(billDTO);
} }
physicWarehouseMapper.updateById(physicWarehouse); 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