dev
This commit is contained in:
parent
ebb3dab838
commit
97dca0fa15
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.syjiaer.clinic.server.common.constants;
|
||||||
|
|
||||||
|
public class Constants {
|
||||||
|
public static final String IPurchaseCodePrefix = "IP";
|
||||||
|
public static final String IInitCodePrefix = "II";
|
||||||
|
public static final String RetailFeedetlSn = "FFLS";
|
||||||
|
public static final Integer DetailPageSize = 20;
|
||||||
|
|
||||||
|
public static final String InitInventory = "初始化库存";
|
||||||
|
public static final String PurchaseInventory = "采购入库";
|
||||||
|
public static final String Sold = "售出";
|
||||||
|
public static final String Apply = "领用";
|
||||||
|
public static final String Social = "医保";
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
package com.syjiaer.clinic.server.common.enums;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum GoodUploadInterfaceEnum {
|
||||||
|
GoodsRecord(3501,"商品盘存"),
|
||||||
|
GoodsInventoryNumChange(3502,"商品库存变更"),
|
||||||
|
GoodsPurchase(3503,"商品采购"),
|
||||||
|
GoodsReturn(3504,"商品采购退货"),
|
||||||
|
GoodsSale(3505,"商品销售"),
|
||||||
|
GoodsSaleReturn(3506,"商品销售退货"),
|
||||||
|
GoodsDel(3507,"商品删除");
|
||||||
|
private final Integer interfaceNum;
|
||||||
|
private final String desc;
|
||||||
|
|
||||||
|
GoodUploadInterfaceEnum(Integer interfaceNum, String desc) {
|
||||||
|
this.interfaceNum = interfaceNum;
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
public static GoodUploadInterfaceEnum getByInterfaceNum(Integer interfaceNum) {
|
||||||
|
for (GoodUploadInterfaceEnum value : GoodUploadInterfaceEnum.values()) {
|
||||||
|
if (value.getInterfaceNum().equals(interfaceNum)) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.syjiaer.clinic.server.common.enums;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum GoodsPricingModelEnum {
|
||||||
|
Fixed(0,"固定售价"),
|
||||||
|
Bonus(1,"进价加成");
|
||||||
|
private final Integer pricingModel;
|
||||||
|
private final String desc;
|
||||||
|
public static GoodsPricingModelEnum getByPricingModel(Integer pricingModel)
|
||||||
|
{
|
||||||
|
for (GoodsPricingModelEnum value : values())
|
||||||
|
{
|
||||||
|
if (value.getPricingModel().equals(pricingModel))
|
||||||
|
{
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.syjiaer.clinic.server.common.enums;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum GoodsTrdnFlagEnum {
|
||||||
|
Allow(1,"允许拆零"),
|
||||||
|
NotAllow(0,"不允许拆零");
|
||||||
|
|
||||||
|
private final Integer trdnFlag;
|
||||||
|
private final String desc;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
package com.syjiaer.clinic.server.common.enums;
|
||||||
|
|
||||||
|
public enum GoodsTypeEnum {
|
||||||
|
otherGoods(0,"其他商品"),
|
||||||
|
patentMedicine(1301,"中西成药"),
|
||||||
|
chineseMedicine(1302,"中药饮片"),
|
||||||
|
medicalEquipment(1306,"医疗器材");
|
||||||
|
|
||||||
|
private final Integer type;
|
||||||
|
private final String desc;
|
||||||
|
|
||||||
|
GoodsTypeEnum(final Integer type, final String desc) {
|
||||||
|
this.type = type;
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDesc() {
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GoodsTypeEnum getByType(Integer type) {
|
||||||
|
for (GoodsTypeEnum goodsTypeEnum : GoodsTypeEnum.values()) {
|
||||||
|
if (goodsTypeEnum.getType().equals(type)) {
|
||||||
|
return goodsTypeEnum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.syjiaer.clinic.server.common.enums;
|
||||||
|
|
||||||
|
public enum InventoryRefererTypeEnum {
|
||||||
|
INIT(0, "库存初始化"),
|
||||||
|
STORE(1, "采购入库");
|
||||||
|
|
||||||
|
private Integer type;
|
||||||
|
private String desc;
|
||||||
|
|
||||||
|
InventoryRefererTypeEnum(Integer type, String desc) {
|
||||||
|
this.type = type;
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDesc() {
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.syjiaer.clinic.server.common.enums;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum InventorySocialTypeEnum {
|
||||||
|
|
||||||
|
TRANSFER_INBOUND(101, "调拨入库"),
|
||||||
|
DISPATCH_OUTBOUND(102, "调拨出库"),
|
||||||
|
INVENTORY_SURPLUS(103, "盘盈"),
|
||||||
|
INVENTORY_LOSS(104, "盘损"),
|
||||||
|
DESTRUCTION(105, "销毁"),
|
||||||
|
OTHER_INBOUND(106, "其他入库"),
|
||||||
|
OTHER_OUTBOUND(107, "其他出库"),
|
||||||
|
INITIAL_INBOUND(108, "初始化入库");
|
||||||
|
private final Integer type;
|
||||||
|
private final String desc;
|
||||||
|
|
||||||
|
InventorySocialTypeEnum(Integer type, String desc) {
|
||||||
|
this.type = type;
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static InventorySocialTypeEnum getByType(Integer type) {
|
||||||
|
for (InventorySocialTypeEnum inventorySocialTypeEnum : values()) {
|
||||||
|
if (inventorySocialTypeEnum.getType().equals(type)){
|
||||||
|
return inventorySocialTypeEnum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
package com.syjiaer.clinic.server.common.enums;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum InventoryTypeEnum {
|
||||||
|
|
||||||
|
INIT(1, "初始化"),
|
||||||
|
PURCHASE_IN(2, "采购入库"),
|
||||||
|
CHECK_IN(3, "盘盈入库"),
|
||||||
|
GRANT_OUT(4, "发药出库"),
|
||||||
|
APPLY_OUT(5, "领用出库"),
|
||||||
|
FORMLOSS_OUT(6, "报损出库"),
|
||||||
|
CHECK_OUT(7, "盘亏出库"),
|
||||||
|
RETURN_OUT(8, "退货出库"),
|
||||||
|
REFUND_IN(9, "零售退款入库");
|
||||||
|
private final Integer type;
|
||||||
|
private final String desc;
|
||||||
|
|
||||||
|
InventoryTypeEnum(Integer type, String desc) {
|
||||||
|
this.type = type;
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static InventoryTypeEnum getByType(Integer type) {
|
||||||
|
for (InventoryTypeEnum inventorySocialTypeEnum : values()) {
|
||||||
|
if (inventorySocialTypeEnum.getType().equals(type)){
|
||||||
|
return inventorySocialTypeEnum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.syjiaer.clinic.server.common.enums;
|
||||||
|
|
||||||
|
public enum MedicalRecordDetailTypeEnum {
|
||||||
|
|
||||||
|
item(1,"服务项目"),
|
||||||
|
goods(2,"药品耗材");
|
||||||
|
|
||||||
|
private final Integer type;
|
||||||
|
private final String desc;
|
||||||
|
|
||||||
|
MedicalRecordDetailTypeEnum(final Integer type, final String desc) {
|
||||||
|
this.type = type;
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDesc() {
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.syjiaer.clinic.server.common.enums;
|
||||||
|
|
||||||
|
public enum RetailOrderPayTypeEnum {
|
||||||
|
MEDICARE(1, "医保支付"),
|
||||||
|
WXPAY(2, "微信"),
|
||||||
|
ALIPAY(3, "支付宝"),
|
||||||
|
CASH(4, "现金"),
|
||||||
|
OTHER(5, "其他");;
|
||||||
|
|
||||||
|
private Integer code;
|
||||||
|
private String desc;
|
||||||
|
|
||||||
|
RetailOrderPayTypeEnum(Integer code, String desc) {
|
||||||
|
this.code = code;
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDesc() {
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
public static RetailOrderPayTypeEnum getByCode(Integer code){
|
||||||
|
for (RetailOrderPayTypeEnum retailOrderPayTypeEnum : RetailOrderPayTypeEnum.values()) {
|
||||||
|
if (retailOrderPayTypeEnum.getCode().equals(code)) {
|
||||||
|
return retailOrderPayTypeEnum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.syjiaer.clinic.server.common.enums;
|
||||||
|
|
||||||
|
public enum RetailOrderStatusEnum {
|
||||||
|
UNFINISHED(0, "未完成"),
|
||||||
|
FINISHED(1, "已完成"),
|
||||||
|
CANCELLED(2, "已取消"),
|
||||||
|
REFUNDED(3, "已退款");
|
||||||
|
|
||||||
|
private Integer code;
|
||||||
|
private String desc;
|
||||||
|
|
||||||
|
RetailOrderStatusEnum(Integer code, String desc) {
|
||||||
|
this.code = code;
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDesc() {
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
package com.syjiaer.clinic.server.common.enums;
|
||||||
|
|
||||||
|
public enum Type {
|
||||||
|
IN,
|
||||||
|
OUT
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
package com.syjiaer.clinic.server.common.enums;
|
||||||
|
|
||||||
|
public enum UploadStatusEnum {
|
||||||
|
NoUpload(0, "未上传"),
|
||||||
|
Uploaded(1, "已上传"),
|
||||||
|
UploadFailed(2, "上传失败"),
|
||||||
|
NotNeedUpload(3, "无需上传");
|
||||||
|
|
||||||
|
private final Integer status;
|
||||||
|
private final String desc;
|
||||||
|
|
||||||
|
UploadStatusEnum(Integer status, String desc) {
|
||||||
|
this.status = status;
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDesc() {
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static UploadStatusEnum getByStatus(Integer status) {
|
||||||
|
for (UploadStatusEnum uploadStatusEnum : UploadStatusEnum.values()) {
|
||||||
|
if (uploadStatusEnum.getStatus().equals(status)) {
|
||||||
|
return uploadStatusEnum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.syjiaer.clinic.server.common.enums;
|
||||||
|
|
||||||
|
public enum UserStatusEnum {
|
||||||
|
ENABLED(0, "启用"),
|
||||||
|
DISABLED(1, "禁用");
|
||||||
|
|
||||||
|
private int status;
|
||||||
|
private String desc;
|
||||||
|
|
||||||
|
UserStatusEnum(int status, String desc) {
|
||||||
|
this.status = status;
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDesc() {
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
package com.syjiaer.clinic.server.common.enums;
|
||||||
|
|
||||||
|
public enum UserTypeEnum {
|
||||||
|
ADMIN(0, "管理员"),
|
||||||
|
USER(1, "普通用户"),
|
||||||
|
DOCTOR(2, "医生");
|
||||||
|
|
||||||
|
private int type;
|
||||||
|
private String desc;
|
||||||
|
|
||||||
|
UserTypeEnum(int type, String desc) {
|
||||||
|
this.type = type;
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDesc() {
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
public static UserTypeEnum getByCode(int code) {
|
||||||
|
for (UserTypeEnum item : UserTypeEnum.values()) {
|
||||||
|
if (item.getType() == code) {
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,130 @@
|
||||||
|
package com.syjiaer.clinic.server.entity.goods;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 商品主表
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author NiuZiYuan
|
||||||
|
* @since 2025-04-11
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@ApiModel(value = "Goods对象", description = "商品主表")
|
||||||
|
public class Goods implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty("自增主键")
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty("商品名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty("商品类型")
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
@ApiModelProperty("通用名")
|
||||||
|
private String commonName;
|
||||||
|
|
||||||
|
@ApiModelProperty("医保目录编码")
|
||||||
|
private String hilistCode;
|
||||||
|
|
||||||
|
@ApiModelProperty("单价")
|
||||||
|
private BigDecimal unitPrice;
|
||||||
|
|
||||||
|
@ApiModelProperty("进货价")
|
||||||
|
private BigDecimal purchaseUnitPrice;
|
||||||
|
|
||||||
|
@ApiModelProperty("生厂商")
|
||||||
|
private String producer;
|
||||||
|
|
||||||
|
@ApiModelProperty("条形码")
|
||||||
|
private String barcode;
|
||||||
|
|
||||||
|
@ApiModelProperty("最小制剂单位")
|
||||||
|
private String medicineDosageUnit;
|
||||||
|
|
||||||
|
@ApiModelProperty("最小包装数量")
|
||||||
|
private Integer minPackagingNumber;
|
||||||
|
|
||||||
|
@ApiModelProperty("最小包装单位")
|
||||||
|
private String minPackagingUnit;
|
||||||
|
|
||||||
|
@ApiModelProperty("保质期")
|
||||||
|
private Integer expiryTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("国药准字")
|
||||||
|
private String approvalCode;
|
||||||
|
|
||||||
|
@ApiModelProperty("拓展字段")
|
||||||
|
private String extra;
|
||||||
|
|
||||||
|
@ApiModelProperty("分类ID")
|
||||||
|
private Integer cateId;
|
||||||
|
|
||||||
|
@ApiModelProperty("软删除 1为删除")
|
||||||
|
private Integer deleted;
|
||||||
|
|
||||||
|
@ApiModelProperty("利润分类")
|
||||||
|
private String profitCate;
|
||||||
|
|
||||||
|
@ApiModelProperty("标签")
|
||||||
|
private String tags;
|
||||||
|
|
||||||
|
@ApiModelProperty("备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@ApiModelProperty("利率")
|
||||||
|
private Double interestRate;
|
||||||
|
|
||||||
|
@ApiModelProperty("库存整数量 ")
|
||||||
|
private Integer inventoryWholeNumber;
|
||||||
|
|
||||||
|
@ApiModelProperty("标识码 由追溯码生成")
|
||||||
|
private String idCode;
|
||||||
|
|
||||||
|
@ApiModelProperty("库存分数量")
|
||||||
|
private Integer inventoryFragmentNumber;
|
||||||
|
|
||||||
|
@ApiModelProperty("0不允许拆零 1允许拆零")
|
||||||
|
private Boolean trdnFlag;
|
||||||
|
|
||||||
|
@ApiModelProperty("拆零价格")
|
||||||
|
private BigDecimal disassemblyPrice;
|
||||||
|
|
||||||
|
@ApiModelProperty("最小制剂数量")
|
||||||
|
private String medicineDosageNum;
|
||||||
|
|
||||||
|
@ApiModelProperty("包装单位")
|
||||||
|
private String packagingUnit;
|
||||||
|
|
||||||
|
@ApiModelProperty("售卖模式")
|
||||||
|
private Integer pricingModel;
|
||||||
|
|
||||||
|
@ApiModelProperty("加成率 30=30%")
|
||||||
|
private Integer makeUp;
|
||||||
|
|
||||||
|
@ApiModelProperty("0禁售 1可售")
|
||||||
|
private Boolean status;
|
||||||
|
|
||||||
|
@ApiModelProperty("库存预警数量")
|
||||||
|
private Integer inventoryWarnNumber;
|
||||||
|
|
||||||
|
@ApiModelProperty("到期预警天数")
|
||||||
|
private Integer expiryWarnDays;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
package com.syjiaer.clinic.server.entity.goods;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author NiuZiYuan
|
||||||
|
* @since 2025-03-04
|
||||||
|
*/
|
||||||
|
@TableName("goods_cate")
|
||||||
|
@ApiModel(value = "GoodsCate对象", description = "")
|
||||||
|
public class GoodsCate implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(Integer type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getSort() {
|
||||||
|
return sort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSort(Integer sort) {
|
||||||
|
this.sort = sort;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "GoodsCate{" +
|
||||||
|
"id = " + id +
|
||||||
|
", name = " + name +
|
||||||
|
", type = " + type +
|
||||||
|
", sort = " + sort +
|
||||||
|
"}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,93 @@
|
||||||
|
package com.syjiaer.clinic.server.entity.goods;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author NiuZiYuan
|
||||||
|
* @since 2025-04-07
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("goods_view")
|
||||||
|
@ApiModel(value = "GoodsView对象", description = "")
|
||||||
|
public class GoodsView implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
private String commonName;
|
||||||
|
|
||||||
|
private String hilistCode;
|
||||||
|
|
||||||
|
private BigDecimal unitPrice;
|
||||||
|
|
||||||
|
private BigDecimal purchaseUnitPrice;
|
||||||
|
|
||||||
|
private String producer;
|
||||||
|
|
||||||
|
private String barcode;
|
||||||
|
|
||||||
|
private String medicineDosageUnit;
|
||||||
|
|
||||||
|
private Integer minPackagingNumber;
|
||||||
|
|
||||||
|
private String minPackagingUnit;
|
||||||
|
|
||||||
|
private Integer expiryTime;
|
||||||
|
|
||||||
|
private String approvalCode;
|
||||||
|
|
||||||
|
private String extra;
|
||||||
|
|
||||||
|
private Integer cateId;
|
||||||
|
|
||||||
|
private Integer deleted;
|
||||||
|
|
||||||
|
private String profitCate;
|
||||||
|
|
||||||
|
private String tags;
|
||||||
|
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
private Double interestRate;
|
||||||
|
|
||||||
|
private Integer inventoryWholeNumber;
|
||||||
|
|
||||||
|
private String idCode;
|
||||||
|
|
||||||
|
private Integer inventoryFragmentNumber;
|
||||||
|
|
||||||
|
private Boolean trdnFlag;
|
||||||
|
|
||||||
|
private BigDecimal disassemblyPrice;
|
||||||
|
|
||||||
|
private String medicineDosageNum;
|
||||||
|
|
||||||
|
private String packagingUnit;
|
||||||
|
|
||||||
|
private Integer pricingModel;
|
||||||
|
|
||||||
|
private Integer makeUp;
|
||||||
|
|
||||||
|
private Boolean status;
|
||||||
|
|
||||||
|
private String cateName;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.syjiaer.clinic.server.entity.goods.dto;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
public class GoodsQuery {
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
private Integer cateId;
|
||||||
|
private Integer minInterestRate;
|
||||||
|
private Integer maxInterestRate;
|
||||||
|
private Integer inventoryNumber;
|
||||||
|
private boolean status;
|
||||||
|
private Integer pageSize;
|
||||||
|
private Integer pageNum;
|
||||||
|
private List<interestRateInterval> interestRateIntervalList;
|
||||||
|
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
public class interestRateInterval {
|
||||||
|
private Double min;
|
||||||
|
private Double max;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,86 @@
|
||||||
|
package com.syjiaer.clinic.server.entity.goods.vo;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class GoodsDetailVo {
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
private String commonName;
|
||||||
|
|
||||||
|
private String hilistCode;
|
||||||
|
|
||||||
|
private BigDecimal unitPrice;
|
||||||
|
|
||||||
|
private BigDecimal purchaseUnitPrice ;
|
||||||
|
|
||||||
|
private String producer;
|
||||||
|
|
||||||
|
private String barcode;
|
||||||
|
|
||||||
|
private String medicineDosageUnit;
|
||||||
|
|
||||||
|
private Integer minPackagingNumber;
|
||||||
|
|
||||||
|
private String minPackagingUnit;
|
||||||
|
|
||||||
|
private Integer expiryTime;
|
||||||
|
|
||||||
|
private String approvalCode;
|
||||||
|
|
||||||
|
private String extra;
|
||||||
|
|
||||||
|
private Integer cateId;
|
||||||
|
|
||||||
|
private Integer deleted;
|
||||||
|
|
||||||
|
private String profitCate;
|
||||||
|
|
||||||
|
private String tags;
|
||||||
|
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
private Double interestRate;
|
||||||
|
|
||||||
|
private Integer inventoryWholeNumber;
|
||||||
|
|
||||||
|
private String idCode;
|
||||||
|
|
||||||
|
private Integer inventoryFragmentNumber;
|
||||||
|
|
||||||
|
private Boolean trdnFlag;
|
||||||
|
|
||||||
|
private BigDecimal disassemblyPrice;
|
||||||
|
|
||||||
|
private String medicineDosageNum;
|
||||||
|
|
||||||
|
private String packagingUnit;
|
||||||
|
|
||||||
|
private Integer pricingModel;
|
||||||
|
|
||||||
|
private Integer makeUp;
|
||||||
|
|
||||||
|
private Boolean status;
|
||||||
|
|
||||||
|
private String cateName;
|
||||||
|
|
||||||
|
//最近效期
|
||||||
|
private LocalDate recentlyExpiryDate ;
|
||||||
|
//药品成本
|
||||||
|
private BigDecimal costPrice = BigDecimal.ZERO;
|
||||||
|
//医保限价
|
||||||
|
private BigDecimal hilistPricUplmtAmt = BigDecimal.ZERO;
|
||||||
|
//支付比例
|
||||||
|
private BigDecimal selfpayProp;
|
||||||
|
//限制说明
|
||||||
|
private String hilistLmtpricType;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,68 @@
|
||||||
|
package com.syjiaer.clinic.server.entity.medical;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author NiuZiYuan
|
||||||
|
* @since 2025-04-17
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("medical_record")
|
||||||
|
@ApiModel(value = "MedicalRecord对象", description = "")
|
||||||
|
public class MedicalRecord implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty("自增id")
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty("患者id")
|
||||||
|
private Integer patientId;
|
||||||
|
|
||||||
|
@ApiModelProperty("主诉")
|
||||||
|
private String mainAppeal;
|
||||||
|
|
||||||
|
@ApiModelProperty("现病史")
|
||||||
|
private String nowMedicalHistory;
|
||||||
|
|
||||||
|
@ApiModelProperty("往病史")
|
||||||
|
private String beforeMedicalHistory;
|
||||||
|
|
||||||
|
@ApiModelProperty("过敏史")
|
||||||
|
private String allergyHistory;
|
||||||
|
|
||||||
|
@ApiModelProperty("体检检查")
|
||||||
|
private String exam;
|
||||||
|
|
||||||
|
@ApiModelProperty("非通用字段")
|
||||||
|
private String json;
|
||||||
|
|
||||||
|
@ApiModelProperty("接诊医生id")
|
||||||
|
private Integer dockerId;
|
||||||
|
|
||||||
|
@ApiModelProperty("接诊医生姓名")
|
||||||
|
private String dockerName;
|
||||||
|
|
||||||
|
@ApiModelProperty("诊断详细数据")
|
||||||
|
private String diagnosisDetail;
|
||||||
|
|
||||||
|
@ApiModelProperty("诊断概况")
|
||||||
|
private String diagnosisSummary;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
package com.syjiaer.clinic.server.entity.medical;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author NiuZiYuan
|
||||||
|
* @since 2025-04-17
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("medical_record_detail")
|
||||||
|
@ApiModel(value = "MedicalRecordDetail对象", description = "")
|
||||||
|
public class MedicalRecordDetail implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty("自增主键")
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty("项目id(项目包含 goods表 item 表)")
|
||||||
|
private Integer projectId;
|
||||||
|
|
||||||
|
@ApiModelProperty("项目名称")
|
||||||
|
private String projectName;
|
||||||
|
|
||||||
|
@ApiModelProperty("项目医保码")
|
||||||
|
private String projectSocialCode;
|
||||||
|
|
||||||
|
@ApiModelProperty("项目单位")
|
||||||
|
private String projectUnit;
|
||||||
|
|
||||||
|
@ApiModelProperty("项目单价")
|
||||||
|
private BigDecimal projectUnitPrice;
|
||||||
|
|
||||||
|
@ApiModelProperty("病例id")
|
||||||
|
private Integer medicalRecordId;
|
||||||
|
|
||||||
|
@ApiModelProperty("1 服务项目(item表) 2药品(goods表)")
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
@ApiModelProperty("药品数量(type=2时不能为空)")
|
||||||
|
private Integer number;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,52 @@
|
||||||
|
package com.syjiaer.clinic.server.entity.medical.dto;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class MedicalRecordSaveDto {
|
||||||
|
@ApiModelProperty("自增id")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty("患者id")
|
||||||
|
private Integer patientId;
|
||||||
|
|
||||||
|
@ApiModelProperty("主诉")
|
||||||
|
private String mainAppeal;
|
||||||
|
|
||||||
|
@ApiModelProperty("现病史")
|
||||||
|
private String nowMedicalHistory;
|
||||||
|
|
||||||
|
@ApiModelProperty("往病史")
|
||||||
|
private String beforeMedicalHistory;
|
||||||
|
|
||||||
|
@ApiModelProperty("过敏史")
|
||||||
|
private String allergyHistory;
|
||||||
|
|
||||||
|
@ApiModelProperty("体检检查")
|
||||||
|
private String exam;
|
||||||
|
|
||||||
|
@ApiModelProperty("非通用字段")
|
||||||
|
private String json;
|
||||||
|
|
||||||
|
@ApiModelProperty("接诊医生id")
|
||||||
|
private Integer dockerId;
|
||||||
|
|
||||||
|
@ApiModelProperty("接诊医生姓名")
|
||||||
|
private String dockerName;
|
||||||
|
|
||||||
|
@ApiModelProperty("诊断详细数据")
|
||||||
|
private String diagnosisDetail;
|
||||||
|
|
||||||
|
@ApiModelProperty("诊断概况")
|
||||||
|
private String diagnosisSummary;
|
||||||
|
|
||||||
|
@ApiModelProperty("服务项目列表")
|
||||||
|
private List<Integer> itemList;
|
||||||
|
@ApiModelProperty("药品耗材列表")
|
||||||
|
private Map<Integer,Integer> goodsMap;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,51 @@
|
||||||
|
package com.syjiaer.clinic.server.entity.patient;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 患者信息
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author NiuZiYuan
|
||||||
|
* @since 2025-04-17
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("patient_info")
|
||||||
|
@ApiModel(value = "PatientInfo对象", description = "患者信息 ")
|
||||||
|
public class PatientInfo implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty("自增id")
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty("患者姓名")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty("手机号")
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
@ApiModelProperty("身份证号")
|
||||||
|
private String certno;
|
||||||
|
|
||||||
|
@ApiModelProperty("性别")
|
||||||
|
private String sex;
|
||||||
|
|
||||||
|
@ApiModelProperty("年龄")
|
||||||
|
private Integer age;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,73 @@
|
||||||
|
package com.syjiaer.clinic.server.entity.patient;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 挂号表
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author NiuZiYuan
|
||||||
|
* @since 2025-04-10
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("patient_registration")
|
||||||
|
@ApiModel(value = "Registration对象", description = "挂号表")
|
||||||
|
public class PatientRegistration implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty("科室id")
|
||||||
|
private Integer organizationSectionId;
|
||||||
|
|
||||||
|
@ApiModelProperty("医生id")
|
||||||
|
private Integer organizationDoctorId;
|
||||||
|
|
||||||
|
@ApiModelProperty("就诊类型")
|
||||||
|
private Integer visitType;
|
||||||
|
|
||||||
|
@ApiModelProperty("挂号时间")
|
||||||
|
private LocalDateTime createDatetime;
|
||||||
|
|
||||||
|
@ApiModelProperty("推荐")
|
||||||
|
private String recommendations;
|
||||||
|
|
||||||
|
@ApiModelProperty("备注")
|
||||||
|
private String memo;
|
||||||
|
|
||||||
|
@ApiModelProperty("预诊")
|
||||||
|
private String advanceDiagnosis;
|
||||||
|
|
||||||
|
@ApiModelProperty("挂号费")
|
||||||
|
private BigDecimal registrationMoney;
|
||||||
|
|
||||||
|
@ApiModelProperty("逻辑删除")
|
||||||
|
private Integer delFlag;
|
||||||
|
|
||||||
|
@ApiModelProperty("挂号类型")
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
@ApiModelProperty("病人id")
|
||||||
|
private Integer patientInfoId;
|
||||||
|
|
||||||
|
@ApiModelProperty("挂号状态 1候诊 2在诊 3已诊 0取消")
|
||||||
|
private Integer status;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
package com.syjiaer.clinic.server.entity.patient.dto;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class RegistrationQuery {
|
||||||
|
private Integer status;
|
||||||
|
private Integer pageNum ;
|
||||||
|
private Integer pageSize ;
|
||||||
|
private String keyword;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,63 @@
|
||||||
|
package com.syjiaer.clinic.server.entity.patient.param;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class PatientRegistrationParam {
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty("科室id")
|
||||||
|
private Integer organizationSectionId;
|
||||||
|
|
||||||
|
@ApiModelProperty("医生id")
|
||||||
|
private Integer organizationDoctorId;
|
||||||
|
|
||||||
|
@ApiModelProperty("患者姓名")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty("患者年龄")
|
||||||
|
private Integer age;
|
||||||
|
|
||||||
|
@ApiModelProperty("患者手机号")
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
@ApiModelProperty("就诊类型")
|
||||||
|
private Short visitType;
|
||||||
|
|
||||||
|
@ApiModelProperty("挂号时间")
|
||||||
|
private LocalDateTime createDatetime;
|
||||||
|
|
||||||
|
@ApiModelProperty("推荐")
|
||||||
|
private String recommendations;
|
||||||
|
|
||||||
|
@ApiModelProperty("备注")
|
||||||
|
private String memo;
|
||||||
|
|
||||||
|
@ApiModelProperty("预诊")
|
||||||
|
private String advanceDiagnosis;
|
||||||
|
|
||||||
|
@ApiModelProperty("挂号费")
|
||||||
|
private BigDecimal registrationMoney;
|
||||||
|
|
||||||
|
@ApiModelProperty("逻辑删除")
|
||||||
|
private Short delFlag;
|
||||||
|
|
||||||
|
@ApiModelProperty("挂号类型")
|
||||||
|
private Short type;
|
||||||
|
|
||||||
|
@ApiModelProperty("性别")
|
||||||
|
private String gender;
|
||||||
|
|
||||||
|
@ApiModelProperty("病人id")
|
||||||
|
private Integer patientInfoId;
|
||||||
|
|
||||||
|
@ApiModelProperty("挂号状态 1候诊 2在诊 3已诊 0取消")
|
||||||
|
private Integer status;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.syjiaer.clinic.server.mapper.goods;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.syjiaer.clinic.server.entity.goods.GoodsCate;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author NiuZiYuan
|
||||||
|
* @since 2025-03-04
|
||||||
|
*/
|
||||||
|
public interface GoodsCateMapper extends BaseMapper<GoodsCate> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.syjiaer.clinic.server.mapper.goods;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.syjiaer.clinic.server.entity.goods.Goods;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 商品 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author NiuZiYuan
|
||||||
|
* @since 2025-02-21
|
||||||
|
*/
|
||||||
|
public interface GoodsMapper extends BaseMapper<Goods> {
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.syjiaer.clinic.server.mapper.goods;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.syjiaer.clinic.server.entity.goods.GoodsView;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author NiuZiYuan
|
||||||
|
* @since 2025-03-06
|
||||||
|
*/
|
||||||
|
public interface GoodsViewMapper extends BaseMapper<GoodsView> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.syjiaer.clinic.server.mapper.medical;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.syjiaer.clinic.server.entity.medical.MedicalRecordDetail;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author NiuZiYuan
|
||||||
|
* @since 2025-04-17
|
||||||
|
*/
|
||||||
|
public interface MedicalRecordDetailMapper extends BaseMapper<MedicalRecordDetail> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.syjiaer.clinic.server.mapper.medical;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.syjiaer.clinic.server.entity.medical.MedicalRecord;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author NiuZiYuan
|
||||||
|
* @since 2025-04-17
|
||||||
|
*/
|
||||||
|
public interface MedicalRecordMapper extends BaseMapper<MedicalRecord> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.syjiaer.clinic.server.mapper.patient;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.syjiaer.clinic.server.entity.patient.PatientInfo;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 患者信息 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author NiuZiYuan
|
||||||
|
* @since 2025-04-17
|
||||||
|
*/
|
||||||
|
public interface PatientInfoMapper extends BaseMapper<PatientInfo> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.syjiaer.clinic.server.mapper.patient;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.syjiaer.clinic.server.entity.patient.PatientRegistration;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 挂号表 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author NiuZiYuan
|
||||||
|
* @since 2025-04-10
|
||||||
|
*/
|
||||||
|
public interface RegistrationMapper extends BaseMapper<PatientRegistration> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -2,6 +2,9 @@ package com.syjiaer.clinic.server.mapper.social;
|
||||||
|
|
||||||
import com.syjiaer.clinic.server.entity.social.SocialDirectoryLimit;
|
import com.syjiaer.clinic.server.entity.social.SocialDirectoryLimit;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -14,5 +17,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
*/
|
*/
|
||||||
public interface SocialDirectoryLimitMapper extends BaseMapper<SocialDirectoryLimit> {
|
public interface SocialDirectoryLimitMapper extends BaseMapper<SocialDirectoryLimit> {
|
||||||
|
|
||||||
|
Map<String, Object> getByCode(@Param("code") String hilistCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -53,31 +53,21 @@ public abstract class BaseService {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ManagerUser getManagerUser() {
|
protected ManagerUser getManagerUser() {
|
||||||
Map<String, String> headers = getHeaders();
|
Map<String, Object> map = infoUtil.getMap();
|
||||||
String token = headers.get("authorization");
|
if (map == null || map.get("manager_id") == null) {
|
||||||
if (token == null || token.isEmpty()) {
|
|
||||||
throw new VerifyException("登陆令牌不存在,请重新登陆");
|
|
||||||
}
|
|
||||||
Jws<Claims> claimsJws = null;
|
|
||||||
try {
|
|
||||||
claimsJws = Jwts.parser()
|
|
||||||
.verifyWith(Keys.hmacShaKeyFor(jwtSecret.getBytes()))
|
|
||||||
.build()
|
|
||||||
.parseSignedClaims(token);
|
|
||||||
} catch (JwtException e) {
|
|
||||||
throw new VerifyException("用户身份验证已失效,请重新登陆");
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new VerifyException("未知验证错误,请重新登陆");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (claimsJws == null) {
|
|
||||||
throw new VerifyException("用户身份验证已失效,请重新登陆");
|
|
||||||
}
|
|
||||||
Claims claims = claimsJws.getPayload();
|
|
||||||
ManagerUser managerUser = new ManagerUser();
|
ManagerUser managerUser = new ManagerUser();
|
||||||
managerUser.setId(Integer.parseInt(claims.getSubject()));
|
managerUser.setId(0);
|
||||||
managerUser.setUsername(claims.get("username", String.class));
|
managerUser.setName("test");
|
||||||
managerUser.setName(claims.get("name", String.class));
|
managerUser.setUsername("test");
|
||||||
|
return managerUser;
|
||||||
|
}
|
||||||
|
Object managerId = map.get("manager_id");
|
||||||
|
Object name = map.get("manager_name");
|
||||||
|
Object userName = map.get("manager_userName");
|
||||||
|
ManagerUser managerUser = new ManagerUser();
|
||||||
|
managerUser.setId(Integer.parseInt(managerId.toString()));
|
||||||
|
managerUser.setName(name.toString());
|
||||||
|
managerUser.setUsername(userName.toString());
|
||||||
return managerUser;
|
return managerUser;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,58 @@
|
||||||
|
package com.syjiaer.clinic.server.service.goods;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
|
import com.syjiaer.clinic.server.common.vo.Result;
|
||||||
|
import com.syjiaer.clinic.server.entity.goods.Goods;
|
||||||
|
import com.syjiaer.clinic.server.entity.goods.GoodsCate;
|
||||||
|
import com.syjiaer.clinic.server.mapper.goods.GoodsCateMapper;
|
||||||
|
import com.syjiaer.clinic.server.mapper.goods.GoodsMapper;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class GoodsCateService {
|
||||||
|
@Autowired
|
||||||
|
private GoodsCateMapper goodsCateMapper;
|
||||||
|
@Autowired
|
||||||
|
private GoodsMapper goodsMapper;
|
||||||
|
/*
|
||||||
|
* 获取分类列表
|
||||||
|
* 参数 type 分类类型
|
||||||
|
*/
|
||||||
|
public List<GoodsCate> list(int type){
|
||||||
|
QueryWrapper<GoodsCate> queryWrapper=new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("type",type);
|
||||||
|
queryWrapper.orderByAsc("sort");
|
||||||
|
return goodsCateMapper.selectList(queryWrapper);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* 获取所有分类列表
|
||||||
|
*/
|
||||||
|
public Map<Integer,List<GoodsCate>> getAllList(){
|
||||||
|
List<GoodsCate> list=goodsCateMapper.selectList(new QueryWrapper<>());
|
||||||
|
return list.stream().collect(Collectors.groupingBy(GoodsCate::getType));
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* 删除分类
|
||||||
|
* 参数 id 分类id
|
||||||
|
*/
|
||||||
|
public void del(int id){
|
||||||
|
goodsCateMapper.deleteById(id);
|
||||||
|
UpdateWrapper<Goods> updateWrapper = new UpdateWrapper<>();
|
||||||
|
updateWrapper.set("cate_id",-1);
|
||||||
|
updateWrapper.eq("cate_id",id);
|
||||||
|
goodsMapper.update(updateWrapper);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* 保存/修改分类
|
||||||
|
* 参数 cateList 分类列表
|
||||||
|
*/
|
||||||
|
public void save(List<GoodsCate> cateList){
|
||||||
|
goodsCateMapper.insertOrUpdate(cateList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,345 @@
|
||||||
|
package com.syjiaer.clinic.server.service.goods;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.syjiaer.clinic.server.common.api.input.IM3501;
|
||||||
|
import com.syjiaer.clinic.server.common.api.input.IM3502;
|
||||||
|
import com.syjiaer.clinic.server.common.api.request.SocialRequest;
|
||||||
|
import com.syjiaer.clinic.server.common.constants.Constants;
|
||||||
|
import com.syjiaer.clinic.server.common.enums.GoodsPricingModelEnum;
|
||||||
|
import com.syjiaer.clinic.server.common.enums.GoodsTypeEnum;
|
||||||
|
import com.syjiaer.clinic.server.common.enums.InventorySocialTypeEnum;
|
||||||
|
import com.syjiaer.clinic.server.common.exception.MessageException;
|
||||||
|
import com.syjiaer.clinic.server.common.vo.Page;
|
||||||
|
import com.syjiaer.clinic.server.entity.goods.Goods;
|
||||||
|
import com.syjiaer.clinic.server.entity.goods.dto.GoodsQuery;
|
||||||
|
import com.syjiaer.clinic.server.entity.goods.vo.GoodsDetailVo;
|
||||||
|
import com.syjiaer.clinic.server.entity.inventory.Inventory;
|
||||||
|
import com.syjiaer.clinic.server.entity.social.SocialDirectory;
|
||||||
|
import com.syjiaer.clinic.server.entity.social.dto.SocialDirectoryView;
|
||||||
|
import com.syjiaer.clinic.server.mapper.goods.GoodsMapper;
|
||||||
|
import com.syjiaer.clinic.server.mapper.inventory.InventoryMapper;
|
||||||
|
import com.syjiaer.clinic.server.service.social.SocialDirectoryService;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class GoodsService {
|
||||||
|
@Autowired
|
||||||
|
private GoodsMapper goodsMapper;
|
||||||
|
@Autowired
|
||||||
|
private SocialRequest socialRequest;
|
||||||
|
@Autowired
|
||||||
|
private InventoryMapper inventoryMapper;
|
||||||
|
@Autowired
|
||||||
|
private SocialDirectoryService socialDirectoryService;
|
||||||
|
/*
|
||||||
|
* 新建商品
|
||||||
|
* @param goods 商品信息
|
||||||
|
*/
|
||||||
|
public void createGoods(Goods goods) {
|
||||||
|
if (goods.getPricingModel().equals(GoodsPricingModelEnum.Bonus.getPricingModel())) {
|
||||||
|
//进价加成 更新固定售价
|
||||||
|
goods.setUnitPrice(goods.getPurchaseUnitPrice()
|
||||||
|
.multiply(new BigDecimal(goods.getMakeUp() + 100)).divide(new BigDecimal(100), 6, RoundingMode.HALF_DOWN));
|
||||||
|
}
|
||||||
|
if (goods.getTrdnFlag()==null||!goods.getTrdnFlag()){
|
||||||
|
goods.setDisassemblyPrice(null);
|
||||||
|
}
|
||||||
|
if (goods.getInventoryWholeNumber() == null) {
|
||||||
|
goods.setInventoryWholeNumber(0);
|
||||||
|
}
|
||||||
|
if (goods.getInventoryFragmentNumber() == null) {
|
||||||
|
goods.setInventoryFragmentNumber(0);
|
||||||
|
}
|
||||||
|
Double goodsInterestRate = goods.getUnitPrice().subtract(goods.getPurchaseUnitPrice()
|
||||||
|
).divide(goods.getUnitPrice(), 4, RoundingMode.HALF_DOWN).doubleValue();
|
||||||
|
goods.setInterestRate(goodsInterestRate);
|
||||||
|
//初始化库存
|
||||||
|
if (goods.getId() == null) {
|
||||||
|
//新建档
|
||||||
|
goodsMapper.insert(goods);
|
||||||
|
} else {
|
||||||
|
//修改建档信息
|
||||||
|
Goods dbGoods = goodsMapper.selectById(goods.getId());
|
||||||
|
goodsMapper.updateById(goods);
|
||||||
|
if (!dbGoods.getTrdnFlag().equals(goods.getTrdnFlag())) {
|
||||||
|
// todo 拆零标志变化 重新初始化医保库存
|
||||||
|
requestReturnInit(goods);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* 重新初始化医保库存
|
||||||
|
*/
|
||||||
|
public void returnInit(Goods goods) {
|
||||||
|
// todo 重新初始化医保库存
|
||||||
|
requestReturnInit(goods);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* 重新初始化医保库存
|
||||||
|
* @param goods 商品信息
|
||||||
|
*/
|
||||||
|
public void requestReturnInit(Goods goods) {
|
||||||
|
if (goods.getType().equals(GoodsTypeEnum.otherGoods.getType())) {
|
||||||
|
//其他商品无需上报
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//获取最近的一条入库记录
|
||||||
|
QueryWrapper<Inventory> inventoryWrapper = new QueryWrapper<>();
|
||||||
|
inventoryWrapper.eq("good_id", goods.getId());
|
||||||
|
inventoryWrapper.orderByDesc("id");
|
||||||
|
List<Inventory> inventories = inventoryMapper.selectList(inventoryWrapper);
|
||||||
|
if (inventories.isEmpty()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Inventory latestInventory = inventories.get(0);
|
||||||
|
SocialDirectory socialDirectory = socialDirectoryService.getByCode(goods.getHilistCode());
|
||||||
|
IM3501 im3501 = new IM3501();
|
||||||
|
BigDecimal number = new BigDecimal(goods.getInventoryWholeNumber());
|
||||||
|
BigDecimal price =goods.getUnitPrice();
|
||||||
|
if (goods.getTrdnFlag()) {
|
||||||
|
number = number.multiply(new BigDecimal(goods.getMinPackagingNumber())).add(new BigDecimal(goods.getInventoryFragmentNumber()));
|
||||||
|
price = goods.getDisassemblyPrice();
|
||||||
|
}
|
||||||
|
com.alibaba.fastjson2.JSONObject jsonObject = JSONObject.parseObject(socialDirectory.getData());
|
||||||
|
im3501.setMedListCodg(socialDirectory.getCode())
|
||||||
|
.setMedListCodg(socialDirectory.getCode())
|
||||||
|
.setFixmedinsHilistId(String.valueOf(socialDirectory.getId()))
|
||||||
|
.setFixmedinsHilistName(goods.getName())
|
||||||
|
.setFixmedinsBchno(latestInventory.getInventoryPurchaseCode())
|
||||||
|
.setInvdate(LocalDate.now())
|
||||||
|
.setInvCnt(number)
|
||||||
|
.setManuDate(latestInventory.getProductionDate())
|
||||||
|
.setExpyEnd(latestInventory.getExpiryDate())
|
||||||
|
.setRxFlag((String) jsonObject.get("rx_flag"));
|
||||||
|
socialRequest.call3501(im3501);
|
||||||
|
IM3502 im3502 = new IM3502();
|
||||||
|
im3502.setPric(price)
|
||||||
|
.setMedListCodg(socialDirectory.getCode())
|
||||||
|
.setInvChgType(String.valueOf(InventorySocialTypeEnum.INITIAL_INBOUND.getType()))
|
||||||
|
.setFixmedinsHilistId(String.valueOf(socialDirectory.getId()))
|
||||||
|
.setFixmedinsHilistName(goods.getName())
|
||||||
|
.setFixmedinsBchno(String.valueOf(latestInventory.getInventoryPurchaseCode()))
|
||||||
|
.setRxFlag((String) jsonObject.get("rx_flag"))
|
||||||
|
.setInvChgTime(latestInventory.getCreateDatetime())
|
||||||
|
.setTrdnFlag(goods.getTrdnFlag()?"1":"0")
|
||||||
|
.setCnt(number);
|
||||||
|
socialRequest.call3502(im3502);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* 获取商品详情
|
||||||
|
* @param goodsQuery 商品查询条件
|
||||||
|
*/
|
||||||
|
public Page<GoodsDetailVo> searchGoodeDetail(GoodsQuery goodsQuery) {
|
||||||
|
QueryWrapper<Goods> queryWrapper = new QueryWrapper<>();
|
||||||
|
if (goodsQuery.getPageSize() == null || goodsQuery.getPageSize() == 0) {
|
||||||
|
goodsQuery.setPageSize(Constants.DetailPageSize);
|
||||||
|
}
|
||||||
|
if (goodsQuery.getPageNum() == null || goodsQuery.getPageNum() == 0) {
|
||||||
|
goodsQuery.setPageNum(1);
|
||||||
|
}
|
||||||
|
if (goodsQuery.getName() != null && !goodsQuery.getName().isEmpty()) {
|
||||||
|
queryWrapper.like("name", goodsQuery.getName());
|
||||||
|
}
|
||||||
|
if (goodsQuery.getMinInterestRate() != null) {
|
||||||
|
queryWrapper.ge("interest_rate*100", goodsQuery.getMinInterestRate());
|
||||||
|
}
|
||||||
|
if (goodsQuery.getMaxInterestRate() != null) {
|
||||||
|
queryWrapper.le("interest_rate*100", goodsQuery.getMaxInterestRate());
|
||||||
|
}
|
||||||
|
if (goodsQuery.getCateId() != null) {
|
||||||
|
queryWrapper.eq("cate_id", goodsQuery.getCateId());
|
||||||
|
}
|
||||||
|
if (goodsQuery.isStatus()){
|
||||||
|
//是否只查询可售商品
|
||||||
|
queryWrapper.eq("status", goodsQuery.isStatus());
|
||||||
|
}
|
||||||
|
if (goodsQuery.getInventoryNumber() != null){
|
||||||
|
queryWrapper.and(wrapper ->{
|
||||||
|
wrapper.gt("inventory_whole_number", goodsQuery.getInventoryNumber());
|
||||||
|
wrapper.or().gt("inventory_fragment_number", goodsQuery.getInventoryNumber());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (goodsQuery.getInterestRateIntervalList() != null && !goodsQuery.getInterestRateIntervalList().isEmpty()) {
|
||||||
|
queryWrapper.and(wrapper -> {
|
||||||
|
for (GoodsQuery.interestRateInterval interestRateInterval : goodsQuery.getInterestRateIntervalList()) {
|
||||||
|
if (interestRateInterval.getMin() != null) {
|
||||||
|
wrapper.gt("interest_rate", interestRateInterval.getMin());
|
||||||
|
}
|
||||||
|
if (interestRateInterval.getMax() != null) {
|
||||||
|
wrapper.le("interest_rate", interestRateInterval.getMax());
|
||||||
|
}
|
||||||
|
wrapper.or();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
Page<Goods> page = selectPage(goodsQuery, queryWrapper);
|
||||||
|
List<GoodsDetailVo> goodsDetailVoList = new ArrayList<>();
|
||||||
|
for (Goods goods:page.getList()){
|
||||||
|
GoodsDetailVo goodsDetailVo = new GoodsDetailVo();
|
||||||
|
BeanUtils.copyProperties(goods, goodsDetailVo);
|
||||||
|
QueryWrapper<Inventory> inventoryQuery = new QueryWrapper<>();
|
||||||
|
inventoryQuery.eq("good_id", goods.getId());
|
||||||
|
inventoryQuery.orderByAsc("expiry_date");
|
||||||
|
List<Inventory> inventoryList = inventoryMapper.selectList(inventoryQuery);
|
||||||
|
if (!inventoryList.isEmpty()){
|
||||||
|
goodsDetailVo.setRecentlyExpiryDate(inventoryList.get(0).getExpiryDate());
|
||||||
|
|
||||||
|
BigDecimal costPrice = inventoryList.stream()
|
||||||
|
.map(inventory -> inventory.getPurchaseUnitPrice()
|
||||||
|
.multiply(new BigDecimal(inventory.getWholeNumber()))
|
||||||
|
.add(inventory.getFragmentPrice()
|
||||||
|
.multiply(new BigDecimal(inventory.getFragmentNumber()))))
|
||||||
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
|
goodsDetailVo.setCostPrice(costPrice);
|
||||||
|
}
|
||||||
|
SocialDirectoryView dbSocialInfo = socialDirectoryService.fullInfo(goods.getHilistCode());
|
||||||
|
if (dbSocialInfo != null){
|
||||||
|
goodsDetailVo.setHilistPricUplmtAmt(dbSocialInfo.getHilistPricUplmtAmt());
|
||||||
|
goodsDetailVo.setHilistLmtpricType(dbSocialInfo.getHilistLmtpricType());
|
||||||
|
goodsDetailVo.setSelfpayProp(dbSocialInfo.getSelfpayProp());
|
||||||
|
goodsDetailVoList.add(goodsDetailVo);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
Page<GoodsDetailVo> result = new Page<>();
|
||||||
|
result.setList(goodsDetailVoList);
|
||||||
|
result.setTotal_count(page.getTotal_count());
|
||||||
|
result.setTotal_page(page.getTotal_page());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* 分页查询商品
|
||||||
|
* @param goodsQuery 查询条件
|
||||||
|
* @param queryWrapper 查询条件
|
||||||
|
*/
|
||||||
|
private Page<Goods> selectPage(GoodsQuery goodsQuery, QueryWrapper<Goods> queryWrapper) {
|
||||||
|
long totalCount = goodsMapper.selectCount(queryWrapper);
|
||||||
|
int totalPage = (int) Math.ceil((double) totalCount / goodsQuery.getPageSize());
|
||||||
|
int offset = (goodsQuery.getPageNum() - 1) * goodsQuery.getPageSize();
|
||||||
|
Integer limit = goodsQuery.getPageSize();
|
||||||
|
queryWrapper.orderByDesc("id");
|
||||||
|
queryWrapper.last("limit " + limit + " offset " + offset);
|
||||||
|
Page<Goods> page = new Page<>();
|
||||||
|
List<Goods> list = goodsMapper.selectList(queryWrapper);
|
||||||
|
page.setList(list);
|
||||||
|
page.setTotal_count(totalCount);
|
||||||
|
page.setTotal_page(totalPage);
|
||||||
|
return page;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* 根据关键字搜索商品
|
||||||
|
* @param keyword 关键字
|
||||||
|
*/
|
||||||
|
public List<Goods> search(String keyword) {
|
||||||
|
QueryWrapper<Goods> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.like("name", keyword);
|
||||||
|
queryWrapper.or();
|
||||||
|
queryWrapper.like("common_name", keyword);
|
||||||
|
queryWrapper.or();
|
||||||
|
queryWrapper.like("barcode", keyword);
|
||||||
|
queryWrapper.or();
|
||||||
|
queryWrapper.like("hilist_code", keyword);
|
||||||
|
queryWrapper.or();
|
||||||
|
queryWrapper.like("producer", keyword);
|
||||||
|
queryWrapper.last("limit 1000");
|
||||||
|
return goodsMapper.selectList(queryWrapper);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* 根据id获取商品信息
|
||||||
|
* @param id 商品id
|
||||||
|
*/
|
||||||
|
public Goods get(int id) {
|
||||||
|
Goods goods = goodsMapper.selectById(id);
|
||||||
|
if (goods == null) {
|
||||||
|
throw new MessageException("id不存在");
|
||||||
|
}
|
||||||
|
return goods;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* 添加标识码
|
||||||
|
* 参数 goodsId 商品ID
|
||||||
|
* 参数 idCode 标识码
|
||||||
|
*/
|
||||||
|
public void addIdCode(int goodsId, String idCode){
|
||||||
|
Goods dbGoods = goodsMapper.selectById(goodsId);
|
||||||
|
if (dbGoods == null){
|
||||||
|
throw new MessageException("商品不存在");
|
||||||
|
}
|
||||||
|
List<String> idCodeList = null;
|
||||||
|
if (dbGoods.getIdCode() == null){
|
||||||
|
idCodeList = new ArrayList<>();
|
||||||
|
}else {
|
||||||
|
idCodeList = new ArrayList<>(Arrays.asList(dbGoods.getIdCode().split(",")));
|
||||||
|
}
|
||||||
|
if (idCodeList.contains(idCode)){
|
||||||
|
//重复标识码
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
idCodeList.add(idCode);
|
||||||
|
Goods updateGoods = new Goods();
|
||||||
|
updateGoods.setId(dbGoods.getId());
|
||||||
|
updateGoods.setIdCode(String.join(",",idCodeList));
|
||||||
|
goodsMapper.updateById(updateGoods);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* 获取二级分类绑定的商品数量
|
||||||
|
* 参数 cateId 二级分类ID
|
||||||
|
*/
|
||||||
|
public Long getByCateId(int cateId) {
|
||||||
|
QueryWrapper<Goods> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("cate_id", cateId);
|
||||||
|
return goodsMapper.selectCount(queryWrapper);
|
||||||
|
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* 更新商品库存信息
|
||||||
|
* 参数 id 商品ID
|
||||||
|
*/
|
||||||
|
public void updateInventoryInfoById(Integer id){
|
||||||
|
Goods dbGoods = goodsMapper.selectById(id);
|
||||||
|
if (dbGoods==null){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QueryWrapper<Inventory> goodWrapper = new QueryWrapper<>();
|
||||||
|
goodWrapper.eq("good_id", id);
|
||||||
|
goodWrapper.orderByDesc("id");
|
||||||
|
List<Inventory> inventories = inventoryMapper.selectList(goodWrapper);
|
||||||
|
if (inventories==null||inventories.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Goods updateGoods = new Goods();
|
||||||
|
updateGoods.setId(dbGoods.getId());
|
||||||
|
//更新最近进货价格
|
||||||
|
updateGoods.setPurchaseUnitPrice(inventories.get(0).getPurchaseUnitPrice());
|
||||||
|
if (dbGoods.getPricingModel().equals(GoodsPricingModelEnum.Bonus.getPricingModel())){
|
||||||
|
//更新售价
|
||||||
|
updateGoods.setUnitPrice(updateGoods.getPurchaseUnitPrice()
|
||||||
|
.multiply(new BigDecimal(dbGoods.getMakeUp() + 100))
|
||||||
|
.divide(new BigDecimal(100), 6, RoundingMode.HALF_DOWN));
|
||||||
|
}
|
||||||
|
//更新库存
|
||||||
|
Integer totalWholeNumber = 0;
|
||||||
|
Integer totalFragmentNumber = 0;
|
||||||
|
for (Inventory inventory : inventories){
|
||||||
|
totalWholeNumber += inventory.getWholeNumber();
|
||||||
|
totalFragmentNumber += inventory.getFragmentNumber();
|
||||||
|
}
|
||||||
|
updateGoods.setInventoryWholeNumber(totalWholeNumber);
|
||||||
|
updateGoods.setInventoryFragmentNumber(totalFragmentNumber);
|
||||||
|
goodsMapper.updateById(updateGoods);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,128 @@
|
||||||
|
package com.syjiaer.clinic.server.service.inventory;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSONArray;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.syjiaer.clinic.server.common.constants.Constants;
|
||||||
|
import com.syjiaer.clinic.server.common.enums.InventorySocialTypeEnum;
|
||||||
|
import com.syjiaer.clinic.server.common.enums.InventoryTypeEnum;
|
||||||
|
import com.syjiaer.clinic.server.common.enums.Type;
|
||||||
|
import com.syjiaer.clinic.server.common.exception.MessageException;
|
||||||
|
import com.syjiaer.clinic.server.common.vo.Page;
|
||||||
|
import com.syjiaer.clinic.server.common.vo.Result;
|
||||||
|
import com.syjiaer.clinic.server.entity.inventory.InventoryApply;
|
||||||
|
import com.syjiaer.clinic.server.entity.inventory.InventoryApplyLog;
|
||||||
|
import com.syjiaer.clinic.server.entity.inventory.InventoryLog;
|
||||||
|
import com.syjiaer.clinic.server.entity.manager.ManagerUser;
|
||||||
|
import com.syjiaer.clinic.server.mapper.inventory.InventoryApplyLogMapper;
|
||||||
|
import com.syjiaer.clinic.server.mapper.inventory.InventoryApplyMapper;
|
||||||
|
import com.syjiaer.clinic.server.mapper.inventory.InventoryLogMapper;
|
||||||
|
import com.syjiaer.clinic.server.service.BaseService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class InventoryApplyService extends BaseService {
|
||||||
|
@Autowired
|
||||||
|
private InventoryService inventoryService;
|
||||||
|
private InventoryLogMapper inventoryLogMapper;
|
||||||
|
@Autowired
|
||||||
|
private InventoryApplyMapper inventoryApplyMapper;
|
||||||
|
@Autowired
|
||||||
|
private InventoryApplyLogMapper inventoryApplyLogMapper;
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void create(List<Map> mapList, InventoryApply useInfo) {
|
||||||
|
ManagerUser user = getManagerUser();
|
||||||
|
System.out.println(mapList);
|
||||||
|
String applyCode = getApplyCode();
|
||||||
|
useInfo.setUseCode(applyCode);
|
||||||
|
useInfo.setStatus( 1);
|
||||||
|
useInfo.setCreateDatetime(LocalDateTime.now());
|
||||||
|
inventoryApplyMapper.insert(useInfo);
|
||||||
|
InventoryApplyLog applyLog = new InventoryApplyLog();
|
||||||
|
applyLog.setApplyId(useInfo.getId());
|
||||||
|
applyLog.setData(JSONArray.toJSONString(mapList));
|
||||||
|
inventoryApplyLogMapper.insert(applyLog);
|
||||||
|
for (Map map : mapList){
|
||||||
|
List<Map> children= (List) map.get("children");
|
||||||
|
|
||||||
|
if (children.size()==0){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for (Map child : children){
|
||||||
|
Integer inventoryId = (Integer) child.get("id");
|
||||||
|
Integer outWholeNumber = (Integer) child.get("outWholeNumber");
|
||||||
|
Integer outFragmentNumber = (Integer) child.get("outFragmentNumber");
|
||||||
|
if(outWholeNumber == null){
|
||||||
|
outWholeNumber =0;
|
||||||
|
}
|
||||||
|
if (outFragmentNumber == null){
|
||||||
|
outFragmentNumber =0 ;
|
||||||
|
}
|
||||||
|
InventoryLog log = inventoryService.changeNumber(inventoryId, Type.OUT, outWholeNumber, outFragmentNumber, Constants.Apply);
|
||||||
|
if (log.getChangeWholeNumber()<0 || log.getChangeFragmentNumber()<0){
|
||||||
|
log.setType(InventoryTypeEnum.APPLY_OUT.getType());
|
||||||
|
log.setSocialType(InventorySocialTypeEnum.OTHER_OUTBOUND.getType());
|
||||||
|
log.setOperateId(user.getId());
|
||||||
|
log.setOperateName(user.getName());
|
||||||
|
inventoryLogMapper.insert(log);
|
||||||
|
}else {
|
||||||
|
throw new MessageException("领用错误,领用不能增加库存");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private String getApplyCode() {
|
||||||
|
return "LY"+ new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询领用单
|
||||||
|
*/
|
||||||
|
// @RequestMapping("/list")
|
||||||
|
// public Result<Page> list() {
|
||||||
|
// ApplyOrderQuery query = parmsUtil.getObject("query", ApplyOrderQuery.class);
|
||||||
|
// if (query == null){
|
||||||
|
// return error("没有带查询条件");
|
||||||
|
// }
|
||||||
|
// QueryWrapper<InventoryApply> queryWrapper = new QueryWrapper<>();
|
||||||
|
// if(query.getPageNum() == null || query.getPageNum() == 0){
|
||||||
|
// query.setPageNum(1);
|
||||||
|
// }
|
||||||
|
// if (query.getPageSize() == null || query.getPageSize() == 0){
|
||||||
|
// query.setPageSize(Constants.DetailPageSize);
|
||||||
|
// }
|
||||||
|
// long totalCount = iInventoryApplyService.count(queryWrapper);
|
||||||
|
// int totalPage = (int) Math.ceil((double) totalCount / query.getPageSize());
|
||||||
|
// int offset = (query.getPageNum() - 1) * query.getPageSize();
|
||||||
|
// Integer limit = query.getPageSize();
|
||||||
|
// queryWrapper.orderByDesc("create_datetime");
|
||||||
|
// queryWrapper.last("limit " + limit + " offset " + offset);
|
||||||
|
// Page page = new Page();
|
||||||
|
// page.setTotal_count(totalCount);
|
||||||
|
// page.setTotal_page(totalPage);
|
||||||
|
// List<InventoryApply> inventoryApplies = iInventoryApplyService.list(queryWrapper);
|
||||||
|
// page.setList(inventoryApplies);
|
||||||
|
// return success(page);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 获取领用单详情
|
||||||
|
// */
|
||||||
|
// @RequestMapping("/getApplyDetail")
|
||||||
|
// public Result<String> getCheckDetail(){
|
||||||
|
// Integer applyId = parmsUtil.getInteger("id", "id不能为空");
|
||||||
|
// QueryWrapper<InventoryApplyLog> queryWrapper=new QueryWrapper();
|
||||||
|
// queryWrapper.eq("apply_id", applyId);
|
||||||
|
// InventoryApplyLog InventoryApplyLog = iInventoryApplyLogService.getOne(queryWrapper);
|
||||||
|
// return success(InventoryApplyLog.getData());
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,450 @@
|
||||||
|
package com.syjiaer.clinic.server.service.inventory;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
|
import com.syjiaer.clinic.server.common.enums.InventorySocialTypeEnum;
|
||||||
|
import com.syjiaer.clinic.server.common.enums.InventoryTypeEnum;
|
||||||
|
import com.syjiaer.clinic.server.common.enums.Type;
|
||||||
|
import com.syjiaer.clinic.server.common.enums.UploadStatusEnum;
|
||||||
|
import com.syjiaer.clinic.server.common.exception.MessageException;
|
||||||
|
import com.syjiaer.clinic.server.common.util.DateUtil;
|
||||||
|
import com.syjiaer.clinic.server.common.vo.Result;
|
||||||
|
import com.syjiaer.clinic.server.entity.goods.Goods;
|
||||||
|
import com.syjiaer.clinic.server.entity.inventory.Inventory;
|
||||||
|
import com.syjiaer.clinic.server.entity.inventory.InventoryLog;
|
||||||
|
import com.syjiaer.clinic.server.entity.inventory.InventoryPurchase;
|
||||||
|
import com.syjiaer.clinic.server.entity.inventory.InventoryPurchaseLog;
|
||||||
|
import com.syjiaer.clinic.server.entity.manager.ManagerUser;
|
||||||
|
import com.syjiaer.clinic.server.mapper.goods.GoodsMapper;
|
||||||
|
import com.syjiaer.clinic.server.mapper.inventory.InventoryLogMapper;
|
||||||
|
import com.syjiaer.clinic.server.mapper.inventory.InventoryMapper;
|
||||||
|
import com.syjiaer.clinic.server.mapper.inventory.InventoryPurchaseLogMapper;
|
||||||
|
import com.syjiaer.clinic.server.mapper.inventory.InventoryPurchaseMapper;
|
||||||
|
import com.syjiaer.clinic.server.service.BaseService;
|
||||||
|
import com.syjiaer.clinic.server.service.goods.GoodsService;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class InventoryService extends BaseService {
|
||||||
|
@Autowired
|
||||||
|
private GoodsMapper goodsMapper;
|
||||||
|
@Autowired
|
||||||
|
private GoodsService goodsService;
|
||||||
|
@Autowired
|
||||||
|
private InventoryMapper inventoryMapper;
|
||||||
|
@Autowired
|
||||||
|
private InventoryLogMapper inventoryLogMapper;
|
||||||
|
@Autowired
|
||||||
|
private InventoryPurchaseMapper inventoryPurchaseMapper;
|
||||||
|
@Autowired
|
||||||
|
private InventoryPurchaseLogMapper inventoryPurchaseLogMapper;
|
||||||
|
|
||||||
|
public List<Inventory> listByOrderCode(String orderCode) {
|
||||||
|
QueryWrapper<Inventory> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("inventory_purchase_code", orderCode);
|
||||||
|
return inventoryMapper.selectList(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据goodsId 获取该goods的所有库存信息 带库存总量
|
||||||
|
*/
|
||||||
|
public Map<String, Object> getByGoodsId(int goodsId) {
|
||||||
|
Goods goods = goodsMapper.selectById(goodsId);
|
||||||
|
if (goods == null) {
|
||||||
|
throw new MessageException("商品不存在");
|
||||||
|
}
|
||||||
|
Map<String, Object> goodsMap = JSON.parseObject(JSON.toJSONString(goods), Map.class);
|
||||||
|
List<Inventory> list = inventoryMapper.selectList(new QueryWrapper<Inventory>().eq("good_id", goodsId).orderByDesc("create_datetime"));
|
||||||
|
List<Map<String, Object>> listMap = new ArrayList<>();
|
||||||
|
for (Inventory inventory : list) {
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
map.put("id", inventory.getId());
|
||||||
|
map.put("wholeNumber", inventory.getWholeNumber());
|
||||||
|
map.put("fragmentNumber", inventory.getFragmentNumber());
|
||||||
|
map.put("productionBatchCode", inventory.getProductionBatchCode());
|
||||||
|
map.put("productionDate", inventory.getProductionDate());
|
||||||
|
map.put("expiryDate", inventory.getExpiryDate());
|
||||||
|
map.put("purchaseUnitPrice", inventory.getPurchaseUnitPrice());
|
||||||
|
listMap.add(map);
|
||||||
|
}
|
||||||
|
goodsMap.put("inventoryGoodsList", listMap);
|
||||||
|
Map<String, Integer> map = totalNumber(goodsId);
|
||||||
|
goodsMap.putAll(map);
|
||||||
|
return goodsMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, Integer> totalNumber(int goods_id) {
|
||||||
|
Goods goods = goodsMapper.selectById(goods_id);
|
||||||
|
if (goods == null) {
|
||||||
|
throw new MessageException("关联商品不存在");
|
||||||
|
}
|
||||||
|
int minPackaging = goods.getMinPackagingNumber();
|
||||||
|
QueryWrapper<Inventory> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("good_id", goods_id);
|
||||||
|
List<Inventory> list = inventoryMapper.selectList(queryWrapper);
|
||||||
|
int totalFragment = 0;
|
||||||
|
for (Inventory inventory : list) {
|
||||||
|
totalFragment += inventory.getWholeNumber() * minPackaging + inventory.getFragmentNumber();
|
||||||
|
}
|
||||||
|
int actualWhole = totalFragment / minPackaging;
|
||||||
|
int actualFragment = totalFragment % minPackaging;
|
||||||
|
|
||||||
|
Map<String, Integer> map = new HashMap<>();
|
||||||
|
map.put("wholeNumber", actualWhole);
|
||||||
|
map.put("fragmentNumber", actualFragment);
|
||||||
|
map.put("totalFragment", totalFragment);
|
||||||
|
map.put("listSize", list.size());
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据goodsId 获取该goods的所有库存信息
|
||||||
|
*/
|
||||||
|
public List<Inventory> getListByGoodsId(int goodsId) {
|
||||||
|
Goods goods = goodsMapper.selectById(goodsId);
|
||||||
|
if (goods == null) {
|
||||||
|
throw new MessageException("商品不存在");
|
||||||
|
}
|
||||||
|
return inventoryMapper.selectList(new QueryWrapper<Inventory>().eq("good_id", goodsId).orderByDesc("create_datetime"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id集合获取库存信息
|
||||||
|
*/
|
||||||
|
public List<Inventory> getListByIds(List<Integer> ids) {
|
||||||
|
if (ids == null || ids.isEmpty()) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
return inventoryMapper.selectByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 进销存统计
|
||||||
|
*/
|
||||||
|
public List<LineModel> getInventoryStatistics(int goods_id, LocalDateTime startDateTime, LocalDateTime endDateTime) {
|
||||||
|
|
||||||
|
Goods goods = goodsMapper.selectById(goods_id);
|
||||||
|
if (goods == null) {
|
||||||
|
throw new MessageException("商品不存在");
|
||||||
|
}
|
||||||
|
QueryWrapper<Inventory> inventoryQueryWrapper = new QueryWrapper<>();
|
||||||
|
inventoryQueryWrapper
|
||||||
|
.eq("good_id", goods.getId())
|
||||||
|
.between("create_datetime", startDateTime, endDateTime)
|
||||||
|
.orderByAsc("create_datetime");
|
||||||
|
|
||||||
|
List<Inventory> inventories = inventoryMapper.selectList(inventoryQueryWrapper);
|
||||||
|
Map<String, LineModel> map = new HashMap<>();
|
||||||
|
LineModel startLine = new LineModel().setName("期初");
|
||||||
|
LineModel endLine = new LineModel().setName("期末");
|
||||||
|
LineModel Type1Line = new LineModel().setName("初始化");
|
||||||
|
LineModel Type2Line = new LineModel().setName("采购入库");
|
||||||
|
LineModel Type3Line = new LineModel().setName("盘盈");
|
||||||
|
LineModel Type4Line = new LineModel().setName("发药");
|
||||||
|
LineModel Type5Line = new LineModel().setName("领用");
|
||||||
|
LineModel Type7Line = new LineModel().setName("盘亏");
|
||||||
|
LineModel Type8Line = new LineModel().setName("退货");
|
||||||
|
for (Inventory inventory : inventories) {
|
||||||
|
int inventory_id = inventory.getId();
|
||||||
|
List<InventoryLog> InventoryLogList = inventoryLogMapper.selectList(new QueryWrapper<InventoryLog>().eq("inventory_id", inventory_id));
|
||||||
|
if (InventoryLogList.isEmpty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
InventoryLog firstLog = InventoryLogList.get(0);
|
||||||
|
startLine.setWholeNumber(startLine.getWholeNumber() + firstLog.getBeforeWholeNumber());
|
||||||
|
int firstLogFragmentNumber = firstLog.getBeforeWholeNumber() * goods.getMinPackagingNumber() + firstLog.getBeforeFragmentNumber();
|
||||||
|
startLine.setFragmentNumber(startLine.getFragmentNumber() + firstLogFragmentNumber);
|
||||||
|
|
||||||
|
InventoryLog lastLog = InventoryLogList.get(InventoryLogList.size() - 1);
|
||||||
|
endLine.setWholeNumber(endLine.getWholeNumber() + lastLog.getAfterWholeNumber());
|
||||||
|
int afterLogFragmentNumber = lastLog.getAfterWholeNumber() * goods.getMinPackagingNumber() + lastLog.getAfterFragmentNumber();
|
||||||
|
endLine.setFragmentNumber(endLine.getFragmentNumber() + afterLogFragmentNumber);
|
||||||
|
endLine.setCostPrice(endLine.getCostPrice().add(inventory.getFragmentPrice().multiply(new BigDecimal(afterLogFragmentNumber))));
|
||||||
|
if (!goods.getTrdnFlag()) {
|
||||||
|
endLine.setSellingPrice(endLine.getSellingPrice().add(goods.getUnitPrice().multiply(new BigDecimal(lastLog.getAfterWholeNumber()))));
|
||||||
|
} else {
|
||||||
|
endLine.setSellingPrice(endLine.getSellingPrice().add(goods.getDisassemblyPrice().multiply(new BigDecimal(afterLogFragmentNumber))));
|
||||||
|
System.out.println(endLine.getSellingPrice());
|
||||||
|
}
|
||||||
|
for (InventoryLog inventoryLog : InventoryLogList) {
|
||||||
|
if (inventoryLog.getType() == 1) {
|
||||||
|
updateLineModel(Type1Line, inventoryLog, inventory, goods);
|
||||||
|
}
|
||||||
|
if (inventoryLog.getType() == 2) {
|
||||||
|
updateLineModel(Type2Line, inventoryLog, inventory, goods);
|
||||||
|
}
|
||||||
|
if (inventoryLog.getType() == 3) {
|
||||||
|
updateLineModel(Type3Line, inventoryLog, inventory, goods);
|
||||||
|
}
|
||||||
|
if (inventoryLog.getType() == 4) {
|
||||||
|
updateLineModel(Type4Line, inventoryLog, inventory, goods);
|
||||||
|
}
|
||||||
|
if (inventoryLog.getType() == 5) {
|
||||||
|
updateLineModel(Type5Line, inventoryLog, inventory, goods);
|
||||||
|
}
|
||||||
|
if (inventoryLog.getType() == 7) {
|
||||||
|
updateLineModel(Type7Line, inventoryLog, inventory, goods);
|
||||||
|
}
|
||||||
|
if (inventoryLog.getType() == 8) {
|
||||||
|
updateLineModel(Type8Line, inventoryLog, inventory, goods);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
List<LineModel> list = new ArrayList<>();
|
||||||
|
list.add(startLine);
|
||||||
|
list.add(Type1Line);
|
||||||
|
list.add(Type2Line);
|
||||||
|
list.add(Type3Line);
|
||||||
|
list.add(Type4Line);
|
||||||
|
list.add(Type5Line);
|
||||||
|
list.add(Type7Line);
|
||||||
|
list.add(Type8Line);
|
||||||
|
list.add(endLine);
|
||||||
|
|
||||||
|
//信息汇总
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateLineModel(LineModel lineModel, InventoryLog inventoryLog, Inventory inventory, Goods goods) {
|
||||||
|
lineModel.setWholeNumber(lineModel.getWholeNumber() + inventoryLog.getChangeWholeNumber());
|
||||||
|
int changeFragmentNumber = inventoryLog.getChangeWholeNumber() * goods.getMinPackagingNumber() + inventoryLog.getChangeFragmentNumber();
|
||||||
|
lineModel.setFragmentNumber(lineModel.getFragmentNumber() + changeFragmentNumber);
|
||||||
|
lineModel.setCostPrice(lineModel.getCostPrice().add(inventory.getFragmentPrice().multiply(new BigDecimal(changeFragmentNumber))));
|
||||||
|
if (!goods.getTrdnFlag()) {
|
||||||
|
lineModel.setSellingPrice(lineModel.getSellingPrice().add(goods.getUnitPrice().multiply(new BigDecimal(inventoryLog.getChangeWholeNumber()))));
|
||||||
|
} else {
|
||||||
|
lineModel.setSellingPrice(lineModel.getSellingPrice().add(goods.getDisassemblyPrice().multiply(new BigDecimal(changeFragmentNumber))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class LineModel {
|
||||||
|
private int wholeNumber;
|
||||||
|
private int fragmentNumber;
|
||||||
|
private BigDecimal costPrice;
|
||||||
|
private BigDecimal sellingPrice;
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
public LineModel() {
|
||||||
|
wholeNumber = 0;
|
||||||
|
fragmentNumber = 0;
|
||||||
|
this.costPrice = new BigDecimal(0);
|
||||||
|
this.sellingPrice = new BigDecimal(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 采购单 采购项修改
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void update(List<Inventory> list) {
|
||||||
|
ManagerUser user = getManagerUser();
|
||||||
|
if (list == null || list.isEmpty()) {
|
||||||
|
throw new MessageException("没有修改的数据");
|
||||||
|
}
|
||||||
|
for (Inventory updateGoods : list) {
|
||||||
|
Inventory dbInventory = inventoryMapper.selectById(updateGoods.getId());
|
||||||
|
|
||||||
|
if (dbInventory == null) {
|
||||||
|
throw new MessageException("错误的id");
|
||||||
|
}
|
||||||
|
InventoryPurchase inventoryOrder = inventoryPurchaseMapper.selectById(dbInventory.getInventoryPurchaseCode());
|
||||||
|
if (inventoryOrder == null) {
|
||||||
|
throw new MessageException("订单不存在");
|
||||||
|
}
|
||||||
|
InventoryLog log = null;
|
||||||
|
if (!updateGoods.getWholeNumber().equals(dbInventory.getWholeNumber())) {
|
||||||
|
log = adjustNumber(updateGoods.getId(),
|
||||||
|
updateGoods.getWholeNumber(), updateGoods.getFragmentNumber(), "库存调整");
|
||||||
|
|
||||||
|
InventorySocialTypeEnum inventorySocialTypeEnum = null;
|
||||||
|
if (log.getChangeWholeNumber() < 0 || log.getChangeFragmentNumber() < 0) {
|
||||||
|
log.setType(InventoryTypeEnum.CHECK_OUT.getType());
|
||||||
|
inventorySocialTypeEnum = inventorySocialTypeEnum.OTHER_OUTBOUND;
|
||||||
|
} else {
|
||||||
|
log.setType(InventoryTypeEnum.CHECK_IN.getType());
|
||||||
|
inventorySocialTypeEnum = inventorySocialTypeEnum.OTHER_INBOUND;
|
||||||
|
}
|
||||||
|
log.setSocialType(inventorySocialTypeEnum.getType());
|
||||||
|
log.setOperateId(user.getId());
|
||||||
|
log.setOperateName(user.getName());
|
||||||
|
inventoryLogMapper.insert(log);
|
||||||
|
//记录日志
|
||||||
|
InventoryPurchaseLog inventoryPurchaseLog = new InventoryPurchaseLog();
|
||||||
|
inventoryPurchaseLog.setNumber(log.getChangeWholeNumber());
|
||||||
|
inventoryPurchaseLog.setInventoryPurchaseCode(dbInventory.getInventoryPurchaseCode());
|
||||||
|
inventoryPurchaseLog.setSocialType(inventorySocialTypeEnum.getType());
|
||||||
|
inventoryPurchaseLog.setInventoryId(dbInventory.getId());
|
||||||
|
inventoryPurchaseLog.setUploadStatus(UploadStatusEnum.NoUpload.getStatus());
|
||||||
|
inventoryPurchaseLogMapper.insert(inventoryPurchaseLog);
|
||||||
|
}
|
||||||
|
|
||||||
|
//更新订单总价
|
||||||
|
QueryWrapper<Inventory> queryGoods = new QueryWrapper<>();
|
||||||
|
queryGoods.eq("inventory_purchase_code", dbInventory.getInventoryPurchaseCode());
|
||||||
|
List<Inventory> goodsList = inventoryMapper.selectList(queryGoods);
|
||||||
|
final BigDecimal[] totalPrice = {new BigDecimal(0)};
|
||||||
|
if (!goodsList.isEmpty()) {
|
||||||
|
goodsList.forEach(inventoryGoods -> {
|
||||||
|
BigDecimal multiply = inventoryGoods.getPurchaseUnitPrice().multiply(new BigDecimal(inventoryGoods.getWholeNumber()));
|
||||||
|
totalPrice[0] = totalPrice[0].add(multiply);
|
||||||
|
});
|
||||||
|
UpdateWrapper<InventoryPurchase> updateOrder = new UpdateWrapper<>();
|
||||||
|
updateOrder.set("total_price", totalPrice[0]);
|
||||||
|
updateOrder.eq("code", dbInventory.getInventoryPurchaseCode());
|
||||||
|
inventoryPurchaseMapper.update(null, updateOrder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public InventoryLog adjustNumber(Integer id, Integer finalWholeNumber, Integer finalFragmentNumber, String remark) {
|
||||||
|
// 1. 校验参数有效性
|
||||||
|
if (finalWholeNumber == null || finalWholeNumber < 0) {
|
||||||
|
throw new MessageException("整件数量不能为空且必须大于等于0");
|
||||||
|
}
|
||||||
|
if (finalFragmentNumber == null || finalFragmentNumber < 0) {
|
||||||
|
throw new MessageException("零散数量不能为空且必须大于等于0");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 获取库存记录和商品信息
|
||||||
|
Inventory inventory = inventoryMapper.selectById(id);
|
||||||
|
if (inventory == null) {
|
||||||
|
throw new MessageException("库存记录不存在");
|
||||||
|
}
|
||||||
|
Goods goods = goodsMapper.selectById(inventory.getGoodId());
|
||||||
|
if (goods == null) {
|
||||||
|
throw new MessageException("关联商品不存在");
|
||||||
|
}
|
||||||
|
// 3. 自动处理超量零散数量(如:24瓶=1箱)
|
||||||
|
int minPackaging = goods.getMinPackagingNumber();
|
||||||
|
int totalFragment = finalWholeNumber * minPackaging + finalFragmentNumber;
|
||||||
|
int actualWhole = totalFragment / minPackaging;
|
||||||
|
int actualFragment = totalFragment % minPackaging;
|
||||||
|
|
||||||
|
// 4. 计算变化量(用于记录日志)
|
||||||
|
int changeWhole = actualWhole - inventory.getWholeNumber();
|
||||||
|
int changeFragment = actualFragment - inventory.getFragmentNumber();
|
||||||
|
while (changeWhole < 0 && changeFragment > 0) {
|
||||||
|
changeFragment = changeFragment - minPackaging;
|
||||||
|
changeWhole = changeWhole + 1;
|
||||||
|
}
|
||||||
|
while (changeWhole > 0 && changeFragment < 0) {
|
||||||
|
changeFragment = changeFragment + minPackaging;
|
||||||
|
changeWhole = changeWhole - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5. 记录日志
|
||||||
|
InventoryLog log = new InventoryLog();
|
||||||
|
log.setGoodsId(inventory.getGoodId())
|
||||||
|
.setInventoryId(id)
|
||||||
|
.setBeforeWholeNumber(inventory.getWholeNumber())
|
||||||
|
.setBeforeFragmentNumber(inventory.getFragmentNumber())
|
||||||
|
.setChangeWholeNumber(changeWhole)
|
||||||
|
.setChangeFragmentNumber(changeFragment)
|
||||||
|
.setAfterWholeNumber(finalWholeNumber)
|
||||||
|
.setAfterFragmentNumber(finalFragmentNumber)
|
||||||
|
.setRemark(remark)
|
||||||
|
.setCreateTime(LocalDateTime.now());
|
||||||
|
UploadStatusEnum uploadStatus = UploadStatusEnum.NoUpload;
|
||||||
|
if (goods.getType().equals(UploadStatusEnum.NotNeedUpload.getStatus())) {
|
||||||
|
uploadStatus = UploadStatusEnum.NotNeedUpload;
|
||||||
|
}
|
||||||
|
log.setUploadStatus(uploadStatus.getStatus());
|
||||||
|
// 6. 更新库存
|
||||||
|
inventory.setWholeNumber(finalWholeNumber);
|
||||||
|
inventory.setFragmentNumber(finalFragmentNumber);
|
||||||
|
inventoryMapper.updateById(inventory);
|
||||||
|
|
||||||
|
//7.更新药品表库存
|
||||||
|
goodsService.updateInventoryInfoById(goods.getId());
|
||||||
|
return log;
|
||||||
|
}
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public InventoryLog changeNumber(Integer id, Type type, Integer changeWholeNumber, Integer changeFragmentNumber, String remark) {
|
||||||
|
// 1. 获取库存记录
|
||||||
|
Inventory inventory = inventoryMapper.selectById(id);
|
||||||
|
if (inventory == null) {
|
||||||
|
throw new MessageException("库存记录不存在");
|
||||||
|
}
|
||||||
|
String inventoryOrderCode = inventory.getInventoryPurchaseCode();
|
||||||
|
// 2. 获取商品信息
|
||||||
|
Goods goods = goodsMapper.selectById(inventory.getGoodId());
|
||||||
|
if (goods == null) {
|
||||||
|
throw new MessageException("关联商品不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
int minPackaging = goods.getMinPackagingNumber();
|
||||||
|
System.out.println("inventory");
|
||||||
|
// 3. 计算总库存量(转换为最小单位)
|
||||||
|
System.out.println(inventory);
|
||||||
|
int currentTotal = inventory.getWholeNumber() * minPackaging + inventory.getFragmentNumber();
|
||||||
|
int deductTotal = changeWholeNumber * minPackaging + changeFragmentNumber;
|
||||||
|
|
||||||
|
// 4. 库存校验
|
||||||
|
if (type == Type.OUT && currentTotal < deductTotal) {
|
||||||
|
throw new MessageException("库存不足,当前库存:"
|
||||||
|
+ inventory.getWholeNumber() + goods.getPackagingUnit()
|
||||||
|
+ inventory.getFragmentNumber() + goods.getMinPackagingUnit());
|
||||||
|
}
|
||||||
|
int remainingTotal = 0;
|
||||||
|
// 5. 计算新库存
|
||||||
|
if (type == Type.OUT) {
|
||||||
|
remainingTotal = currentTotal - deductTotal;
|
||||||
|
} else {
|
||||||
|
remainingTotal = currentTotal + deductTotal;
|
||||||
|
}
|
||||||
|
|
||||||
|
int newWholeNumber = remainingTotal / minPackaging;
|
||||||
|
int newFragmentNumber = remainingTotal % minPackaging;
|
||||||
|
|
||||||
|
//添加日志
|
||||||
|
InventoryLog log = new InventoryLog();
|
||||||
|
log.setGoodsId(inventory.getGoodId());
|
||||||
|
log.setInventoryId(inventory.getId());
|
||||||
|
if (type == Type.OUT) {
|
||||||
|
log.setChangeWholeNumber(-changeWholeNumber);
|
||||||
|
log.setChangeFragmentNumber(-changeFragmentNumber);
|
||||||
|
} else {
|
||||||
|
log.setChangeWholeNumber(changeWholeNumber);
|
||||||
|
log.setChangeFragmentNumber(changeFragmentNumber);
|
||||||
|
}
|
||||||
|
log.setBeforeWholeNumber(inventory.getWholeNumber());
|
||||||
|
log.setBeforeFragmentNumber(inventory.getFragmentNumber());
|
||||||
|
log.setAfterWholeNumber(newWholeNumber);
|
||||||
|
log.setAfterFragmentNumber(newFragmentNumber);
|
||||||
|
log.setRemark(remark);
|
||||||
|
log.setCreateTime(LocalDateTime.now());
|
||||||
|
UploadStatusEnum uploadStatus = UploadStatusEnum.NoUpload;
|
||||||
|
if (goods.getType().equals(UploadStatusEnum.NotNeedUpload.getStatus())) {
|
||||||
|
uploadStatus = UploadStatusEnum.NotNeedUpload;
|
||||||
|
}
|
||||||
|
log.setUploadStatus(uploadStatus.getStatus());
|
||||||
|
inventory.setWholeNumber(newWholeNumber);
|
||||||
|
inventory.setFragmentNumber(newFragmentNumber);
|
||||||
|
inventoryMapper.updateById(inventory);
|
||||||
|
// 6. 更新库存
|
||||||
|
goodsService.updateInventoryInfoById(goods.getId());
|
||||||
|
return log;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -50,18 +50,29 @@ public class ItemGroupService extends BaseService {
|
||||||
* @param itemGroupParam 项目组参数
|
* @param itemGroupParam 项目组参数
|
||||||
*/
|
*/
|
||||||
public void saveItemGroup(ItemGroupParam itemGroupParam) {
|
public void saveItemGroup(ItemGroupParam itemGroupParam) {
|
||||||
if(itemGroupParam == null || itemGroupParam.getIds() ==null || itemGroupParam.getIds().isEmpty()){
|
if (itemGroupParam.getId() != null) {
|
||||||
throw new MessageException("ids不能为空");
|
QueryWrapper<ItemGroup> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("name", itemGroupParam.getName()).ne("id", itemGroupParam.getId()).eq("del_flag", false);
|
||||||
|
List<ItemGroup> itemGroups = itemGroupMapper.selectList(queryWrapper);
|
||||||
|
if (!itemGroups.isEmpty()) {
|
||||||
|
throw new MessageException("项目分组名称已存在");
|
||||||
}
|
}
|
||||||
ItemGroup itemGroup = getItemGroup(itemGroupParam);
|
ItemGroup itemGroup = getItemGroup(itemGroupParam);
|
||||||
if (itemGroupParam.getId() != null) {
|
|
||||||
itemGroup.setId(itemGroupParam.getId());
|
itemGroup.setId(itemGroupParam.getId());
|
||||||
itemGroupMapper.updateById(itemGroup);
|
itemGroupMapper.updateById(itemGroup);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
QueryWrapper<ItemGroup> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("name", itemGroupParam.getName()).eq("del_flag", false);
|
||||||
|
List<ItemGroup> itemGroups = itemGroupMapper.selectList(queryWrapper);
|
||||||
|
if (!itemGroups.isEmpty()) {
|
||||||
|
throw new MessageException("项目分组名称已存在");
|
||||||
|
}
|
||||||
|
ItemGroup itemGroup = getItemGroup(itemGroupParam);
|
||||||
itemGroupMapper.insert(itemGroup);
|
itemGroupMapper.insert(itemGroup);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* 获取项目组
|
* 生成项目组
|
||||||
* @param itemGroupParam 项目组参数
|
* @param itemGroupParam 项目组参数
|
||||||
*/
|
*/
|
||||||
private ItemGroup getItemGroup(ItemGroupParam itemGroupParam) {
|
private ItemGroup getItemGroup(ItemGroupParam itemGroupParam) {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
package com.syjiaer.clinic.server.service.medical;
|
||||||
|
|
||||||
|
public class MedicalRecordDetailService {
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,61 @@
|
||||||
|
package com.syjiaer.clinic.server.service.medical;
|
||||||
|
|
||||||
|
import com.syjiaer.clinic.server.common.enums.MedicalRecordDetailTypeEnum;
|
||||||
|
import com.syjiaer.clinic.server.entity.item.Item;
|
||||||
|
import com.syjiaer.clinic.server.entity.medical.MedicalRecord;
|
||||||
|
import com.syjiaer.clinic.server.entity.medical.MedicalRecordDetail;
|
||||||
|
import com.syjiaer.clinic.server.entity.medical.dto.MedicalRecordSaveDto;
|
||||||
|
import com.syjiaer.clinic.server.mapper.item.ItemMapper;
|
||||||
|
import com.syjiaer.clinic.server.mapper.medical.MedicalRecordDetailMapper;
|
||||||
|
import com.syjiaer.clinic.server.mapper.medical.MedicalRecordMapper;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class MedicalRecordService {
|
||||||
|
@Autowired
|
||||||
|
private ItemMapper itemMapper;
|
||||||
|
@Autowired
|
||||||
|
private MedicalRecordMapper medicalRecordMapper;
|
||||||
|
@Autowired
|
||||||
|
private MedicalRecordDetailMapper medicalRecordDetailMapper;
|
||||||
|
/*
|
||||||
|
* 保存
|
||||||
|
* @param saveDto 病历信息
|
||||||
|
*/
|
||||||
|
public void save(MedicalRecordSaveDto saveDto) {
|
||||||
|
MedicalRecord medicalRecord = new MedicalRecord();
|
||||||
|
BeanUtils.copyProperties(saveDto, medicalRecord);
|
||||||
|
List<MedicalRecordDetail> detailList = new ArrayList<>();
|
||||||
|
for (Integer id : saveDto.getItemList()){
|
||||||
|
Item dbItem = itemMapper.selectById(id);
|
||||||
|
MedicalRecordDetail detail = new MedicalRecordDetail();
|
||||||
|
detail.setProjectId(id);
|
||||||
|
detail.setProjectName(dbItem.getItemName());
|
||||||
|
detail.setProjectSocialCode(dbItem.getItemSocialCode());
|
||||||
|
detail.setProjectUnit(dbItem.getUnit());
|
||||||
|
detail.setProjectUnitPrice(dbItem.getUnitPrice());
|
||||||
|
detail.setType(MedicalRecordDetailTypeEnum.item.getType());
|
||||||
|
detailList.add(detail);
|
||||||
|
}
|
||||||
|
for (Map.Entry<Integer,Integer> itemMap : saveDto.getGoodsMap().entrySet()){
|
||||||
|
Goods dbGoods = iGoodsService.getById(itemMap.getKey());
|
||||||
|
MedicalRecordDetail detail = new MedicalRecordDetail();
|
||||||
|
detail.setProjectId(itemMap.getKey());
|
||||||
|
detail.setProjectName(dbGoods.getName());
|
||||||
|
detail.setProjectSocialCode(dbGoods.getHilistCode());
|
||||||
|
detail.setProjectUnit(dbGoods.getPackagingUnit());
|
||||||
|
detail.setProjectUnitPrice(dbGoods.getUnitPrice());
|
||||||
|
detail.setType(MedicalRecordDetailTypeEnum.goods.getType());
|
||||||
|
detail.setNumber(itemMap.getValue());
|
||||||
|
detailList.add(detail);
|
||||||
|
}
|
||||||
|
medicalRecordMapper.insert(medicalRecord);
|
||||||
|
medicalRecordDetailMapper.insert(detailList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
package com.syjiaer.clinic.server.service.patient;
|
||||||
|
|
||||||
|
public class PatientInfoService {
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,141 @@
|
||||||
|
package com.syjiaer.clinic.server.service.patient;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.syjiaer.clinic.server.common.constants.Constants;
|
||||||
|
import com.syjiaer.clinic.server.common.exception.MessageException;
|
||||||
|
import com.syjiaer.clinic.server.common.util.DateUtil;
|
||||||
|
import com.syjiaer.clinic.server.common.vo.Page;
|
||||||
|
import com.syjiaer.clinic.server.entity.patient.PatientInfo;
|
||||||
|
import com.syjiaer.clinic.server.entity.patient.PatientRegistration;
|
||||||
|
import com.syjiaer.clinic.server.entity.patient.dto.RegistrationQuery;
|
||||||
|
import com.syjiaer.clinic.server.entity.patient.param.PatientRegistrationParam;
|
||||||
|
import com.syjiaer.clinic.server.mapper.patient.PatientInfoMapper;
|
||||||
|
import com.syjiaer.clinic.server.mapper.patient.RegistrationMapper;
|
||||||
|
import com.syjiaer.clinic.server.service.BaseService;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 挂号服务
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class RegistrationService extends BaseService {
|
||||||
|
@Autowired
|
||||||
|
private RegistrationMapper registrationMapper;
|
||||||
|
@Autowired
|
||||||
|
private PatientInfoMapper patientInfoMapper;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 挂号
|
||||||
|
* @param patientRegistrationParam 挂号信息
|
||||||
|
*/
|
||||||
|
public void registration(PatientRegistrationParam patientRegistrationParam) {
|
||||||
|
//TODO 挂号和患者 记录身份证号非必填
|
||||||
|
PatientRegistration patientRegistration = new PatientRegistration();
|
||||||
|
BeanUtils.copyProperties(patientRegistrationParam, patientRegistration);
|
||||||
|
if (patientRegistrationParam.getId() == null) {
|
||||||
|
patientRegistration.setRegistrationMoney(new BigDecimal("0"));
|
||||||
|
patientRegistration.setCreateDatetime(LocalDateTime.now());
|
||||||
|
patientRegistration.setType(1);
|
||||||
|
patientRegistration.setStatus(1);
|
||||||
|
registrationMapper.insert(patientRegistration);
|
||||||
|
}else {
|
||||||
|
registrationMapper.updateById(patientRegistration);
|
||||||
|
}
|
||||||
|
//将患者添加到患者表
|
||||||
|
QueryWrapper<PatientInfo> patientInfoQuery = new QueryWrapper<>();
|
||||||
|
patientInfoQuery.eq("phone", patientRegistrationParam.getPhone());
|
||||||
|
PatientInfo patientInfo = new PatientInfo();
|
||||||
|
patientInfo.setName(patientRegistrationParam.getName());
|
||||||
|
patientInfo.setPhone(patientRegistrationParam.getPhone());
|
||||||
|
patientInfo.setSex(patientRegistrationParam.getGender());
|
||||||
|
patientInfo.setAge(patientRegistrationParam.getAge());
|
||||||
|
List<PatientInfo> patientInfoList = patientInfoMapper.selectList(patientInfoQuery);
|
||||||
|
if (patientInfoList.isEmpty()) {
|
||||||
|
patientInfoMapper.insert(patientInfo);
|
||||||
|
} else {
|
||||||
|
patientInfo.setId(patientInfoList.get(0).getId());
|
||||||
|
patientInfoMapper.updateById(patientInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* 挂号列表
|
||||||
|
* @param pageNum 页码
|
||||||
|
* @param pageSize 每页数量
|
||||||
|
* @param date 日期
|
||||||
|
*/
|
||||||
|
public Page<PatientRegistration> list(int pageNum, int pageSize, String date) {
|
||||||
|
if (date == null || date.isEmpty()) {
|
||||||
|
date = LocalDate.now().toString();
|
||||||
|
}
|
||||||
|
String startDate = date + " 00:00:00";
|
||||||
|
String endDate = date + " 23:59:59";
|
||||||
|
QueryWrapper<PatientRegistration> queryWrapper = new QueryWrapper<>();
|
||||||
|
//查询条件
|
||||||
|
queryWrapper.between("create_datetime", DateUtil.getDateTime(startDate), DateUtil.getDateTime(endDate));
|
||||||
|
queryWrapper.eq("del_flag", 0);
|
||||||
|
Page<PatientRegistration> pageResult = pageHelper(pageNum, pageSize, queryWrapper, registrationMapper);
|
||||||
|
return pageResult;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* 删除挂号信息
|
||||||
|
* @param id 挂号id
|
||||||
|
*/
|
||||||
|
public void delete(int id) {
|
||||||
|
PatientRegistration patientRegistration = registrationMapper.selectById(id);
|
||||||
|
if (patientRegistration == null) {
|
||||||
|
throw new MessageException("id不存在");
|
||||||
|
}
|
||||||
|
patientRegistration.setDelFlag(1);
|
||||||
|
registrationMapper.updateById(patientRegistration);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* 根据id查询挂号信息
|
||||||
|
* @param id 挂号id
|
||||||
|
*/
|
||||||
|
public PatientRegistration getById(int id) {
|
||||||
|
PatientRegistration patientRegistration = registrationMapper.selectById(id);
|
||||||
|
return patientRegistration;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* 获取所有已删除挂号信息
|
||||||
|
* @param id 挂号id
|
||||||
|
*/
|
||||||
|
public List<PatientRegistration> allList() {
|
||||||
|
QueryWrapper<PatientRegistration> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("del_flag", 1);
|
||||||
|
List<PatientRegistration> list = registrationMapper.selectList(queryWrapper);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* 根据查询条件查询挂号信息
|
||||||
|
* @param query 查询条件
|
||||||
|
*/
|
||||||
|
public Page<PatientRegistration> getListByType(RegistrationQuery query) {
|
||||||
|
QueryWrapper<PatientRegistration> regisQuery = new QueryWrapper<>();
|
||||||
|
regisQuery.eq("del_flag", 0);
|
||||||
|
regisQuery.orderByAsc("create_datetime");
|
||||||
|
if (query.getStatus() != null) {
|
||||||
|
regisQuery.eq("status", query.getStatus());
|
||||||
|
}
|
||||||
|
if (query.getKeyword() != null) {
|
||||||
|
regisQuery.like("name", query.getKeyword());
|
||||||
|
regisQuery.or().like("phone", query.getKeyword());
|
||||||
|
}
|
||||||
|
if (query.getPageNum() == null) {
|
||||||
|
query.setPageNum(1);
|
||||||
|
}
|
||||||
|
if (query.getPageSize() == null) {
|
||||||
|
query.setPageSize(Constants.DetailPageSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
Page<PatientRegistration> registrationPage = pageHelper(query.getPageNum(), query.getPageSize(), regisQuery, registrationMapper);
|
||||||
|
return registrationPage;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -13,6 +13,7 @@ import com.syjiaer.clinic.server.entity.social.*;
|
||||||
import com.syjiaer.clinic.server.entity.social.dto.SocialDirectoryView;
|
import com.syjiaer.clinic.server.entity.social.dto.SocialDirectoryView;
|
||||||
import com.syjiaer.clinic.server.mapper.social.*;
|
import com.syjiaer.clinic.server.mapper.social.*;
|
||||||
import com.syjiaer.clinic.server.service.BaseService;
|
import com.syjiaer.clinic.server.service.BaseService;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|
@ -27,8 +28,9 @@ import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 医保目录
|
* 医保目录
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class SocialDirectoryService extends BaseService {
|
public class SocialDirectoryService extends BaseService {
|
||||||
|
|
@ -59,7 +61,7 @@ public class SocialDirectoryService extends BaseService {
|
||||||
* @param version_name 版本名称
|
* @param version_name 版本名称
|
||||||
* @param type 类型
|
* @param type 类型
|
||||||
*/
|
*/
|
||||||
public Map<String, Object> download(String version_name, int type){
|
public Map<String, Object> download(String version_name, int type) {
|
||||||
Integer[] type_list = {1301, 1302, 1305, 1306, 1307, 1309, 1314, 1315, 1320, 1321};
|
Integer[] type_list = {1301, 1302, 1305, 1306, 1307, 1309, 1314, 1315, 1320, 1321};
|
||||||
//判断type在数组中
|
//判断type在数组中
|
||||||
if (!Arrays.asList(type_list).contains(type)) {
|
if (!Arrays.asList(type_list).contains(type)) {
|
||||||
|
|
@ -69,10 +71,10 @@ public class SocialDirectoryService extends BaseService {
|
||||||
input.put("ver", version_name);
|
input.put("ver", version_name);
|
||||||
String infno = String.valueOf(type);
|
String infno = String.valueOf(type);
|
||||||
System.out.println("上个版本号:" + version_name);
|
System.out.println("上个版本号:" + version_name);
|
||||||
JSONObject result=null;
|
JSONObject result = null;
|
||||||
try {
|
try {
|
||||||
result = httpUtil.callBackMsgId(infno,"data", input);
|
result = httpUtil.callBackMsgId(infno, "data", input);
|
||||||
}catch (Exception e){
|
} catch (Exception e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -91,7 +93,7 @@ public class SocialDirectoryService extends BaseService {
|
||||||
input_dw.put("file_qury_no", file_qury_no);
|
input_dw.put("file_qury_no", file_qury_no);
|
||||||
input_dw.put("fixmedins_code", fixmedins_code);
|
input_dw.put("fixmedins_code", fixmedins_code);
|
||||||
input_dw.put("filename", filename);
|
input_dw.put("filename", filename);
|
||||||
System.out.println("文件地址:"+path+"/"+filename);
|
System.out.println("文件地址:" + path + "/" + filename);
|
||||||
httpUtil.callToFile("9102", "fsDownloadIn", input_dw, path + "/" + filename);
|
httpUtil.callToFile("9102", "fsDownloadIn", input_dw, path + "/" + filename);
|
||||||
List<String> file_list = fileUtil.unzip(path, filename);
|
List<String> file_list = fileUtil.unzip(path, filename);
|
||||||
List<String> read_list = fileUtil.readToList(file_list);
|
List<String> read_list = fileUtil.readToList(file_list);
|
||||||
|
|
@ -213,10 +215,10 @@ public class SocialDirectoryService extends BaseService {
|
||||||
input.put("ver", pre_version_name);
|
input.put("ver", pre_version_name);
|
||||||
String infno = String.valueOf(type);
|
String infno = String.valueOf(type);
|
||||||
logger.info("上个版本号:" + pre_version_name);
|
logger.info("上个版本号:" + pre_version_name);
|
||||||
JSONObject result=null;
|
JSONObject result = null;
|
||||||
try {
|
try {
|
||||||
result = httpUtil.callBackMsgId(infno,"data", input);
|
result = httpUtil.callBackMsgId(infno, "data", input);
|
||||||
}catch (Exception e){
|
} catch (Exception e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
|
|
@ -304,23 +306,24 @@ public class SocialDirectoryService extends BaseService {
|
||||||
hashMap.put("pre_version_name", pre_version_name);
|
hashMap.put("pre_version_name", pre_version_name);
|
||||||
return hashMap;
|
return hashMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 搜索接口
|
* 搜索接口
|
||||||
* @param keyword 关键字
|
* @param keyword 关键字
|
||||||
*/
|
*/
|
||||||
public Page<SocialDirectoryView> search(String keyword,int type,int pageNum,int pageSize) {
|
public Page<SocialDirectoryView> search(String keyword, int type, int pageNum, int pageSize) {
|
||||||
return search(keyword, List.of(type),pageNum,pageSize);
|
return search(keyword, List.of(type), pageNum, pageSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 搜索接口
|
* 搜索接口
|
||||||
* @param keyword 关键字
|
* @param keyword 关键字
|
||||||
*/
|
*/
|
||||||
public Page<SocialDirectoryView> search(String keyword,List<Integer> typeList,int pageNum,int pageSize){
|
public Page<SocialDirectoryView> search(String keyword, List<Integer> typeList, int pageNum, int pageSize) {
|
||||||
QueryWrapper<SocialDirectory> codeqw = new QueryWrapper<>();
|
QueryWrapper<SocialDirectory> codeqw = new QueryWrapper<>();
|
||||||
if (typeList.size() == 1) {
|
if (typeList.size() == 1) {
|
||||||
codeqw.eq("type", typeList.get(0));
|
codeqw.eq("type", typeList.get(0));
|
||||||
}else {
|
} else {
|
||||||
codeqw.in("type", typeList);
|
codeqw.in("type", typeList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -334,10 +337,10 @@ public class SocialDirectoryService extends BaseService {
|
||||||
|
|
||||||
// return success(SelectPage(queryWrapper, page, size, iSocialDirectoryService));
|
// return success(SelectPage(queryWrapper, page, size, iSocialDirectoryService));
|
||||||
codeqw.select("code");
|
codeqw.select("code");
|
||||||
long count=socialDirectoryMapper.selectCount(codeqw);
|
long count = socialDirectoryMapper.selectCount(codeqw);
|
||||||
codeqw.last("LIMIT " + pageSize + " OFFSET " + (pageNum - 1) * pageSize);
|
codeqw.last("LIMIT " + pageSize + " OFFSET " + (pageNum - 1) * pageSize);
|
||||||
List<String> codeList = socialDirectoryMapper.selectObjs(codeqw);
|
List<String> codeList = socialDirectoryMapper.selectObjs(codeqw);
|
||||||
if(codeList.isEmpty()){
|
if (codeList.isEmpty()) {
|
||||||
Page<SocialDirectoryView> empty_result = new Page<>();
|
Page<SocialDirectoryView> empty_result = new Page<>();
|
||||||
empty_result.setList(new ArrayList<>());
|
empty_result.setList(new ArrayList<>());
|
||||||
empty_result.setTotal_count(0);
|
empty_result.setTotal_count(0);
|
||||||
|
|
@ -347,10 +350,10 @@ public class SocialDirectoryService extends BaseService {
|
||||||
QueryWrapper queryWrapper = new QueryWrapper();
|
QueryWrapper queryWrapper = new QueryWrapper();
|
||||||
queryWrapper.in("code", codeList);
|
queryWrapper.in("code", codeList);
|
||||||
//第一步 拿到字典表数据
|
//第一步 拿到字典表数据
|
||||||
List<SocialDirectory> socialDirectoryList=socialDirectoryMapper.selectList(queryWrapper);
|
List<SocialDirectory> socialDirectoryList = socialDirectoryMapper.selectList(queryWrapper);
|
||||||
List<SocialDirectoryUpinfo> socialDirectoryUpinfoList=socialDirectoryUpinfoMapper.selectList(queryWrapper);
|
List<SocialDirectoryUpinfo> socialDirectoryUpinfoList = socialDirectoryUpinfoMapper.selectList(queryWrapper);
|
||||||
List<SocialDirectoryLimit> socialDirectoryLimitList=socialDirectoryLimitMapper.selectList(queryWrapper);
|
List<SocialDirectoryLimit> socialDirectoryLimitList = socialDirectoryLimitMapper.selectList(queryWrapper);
|
||||||
List<SocialDirectorySelf> socialDirectorySelfList=socialDirectorySelfMapper.selectList(queryWrapper);
|
List<SocialDirectorySelf> socialDirectorySelfList = socialDirectorySelfMapper.selectList(queryWrapper);
|
||||||
|
|
||||||
Map<String, SocialDirectoryUpinfo> stringSocialDirectoryUpinfoMap = socialDirectoryUpinfoList.stream()
|
Map<String, SocialDirectoryUpinfo> stringSocialDirectoryUpinfoMap = socialDirectoryUpinfoList.stream()
|
||||||
.collect(Collectors.toMap(SocialDirectoryUpinfo::getCode, socialDirectoryUpinfo -> socialDirectoryUpinfo));
|
.collect(Collectors.toMap(SocialDirectoryUpinfo::getCode, socialDirectoryUpinfo -> socialDirectoryUpinfo));
|
||||||
|
|
@ -362,9 +365,9 @@ public class SocialDirectoryService extends BaseService {
|
||||||
.collect(Collectors.toMap(SocialDirectorySelf::getCode, socialDirectorySelf -> socialDirectorySelf));
|
.collect(Collectors.toMap(SocialDirectorySelf::getCode, socialDirectorySelf -> socialDirectorySelf));
|
||||||
|
|
||||||
//第二部 构建新的返回List
|
//第二部 构建新的返回List
|
||||||
List<SocialDirectoryView> socialDirectoryViewList=new ArrayList<>();
|
List<SocialDirectoryView> socialDirectoryViewList = new ArrayList<>();
|
||||||
for(SocialDirectory socialDirectory:socialDirectoryList){
|
for (SocialDirectory socialDirectory : socialDirectoryList) {
|
||||||
SocialDirectoryView socialDirectoryView=JSONObject.parseObject(JSONObject.toJSONString(socialDirectory), SocialDirectoryView.class);
|
SocialDirectoryView socialDirectoryView = JSONObject.parseObject(JSONObject.toJSONString(socialDirectory), SocialDirectoryView.class);
|
||||||
SocialDirectoryUpinfo socialDirectoryUpinfo = stringSocialDirectoryUpinfoMap.get(socialDirectory.getCode());
|
SocialDirectoryUpinfo socialDirectoryUpinfo = stringSocialDirectoryUpinfoMap.get(socialDirectory.getCode());
|
||||||
if (socialDirectoryUpinfo != null) {
|
if (socialDirectoryUpinfo != null) {
|
||||||
socialDirectoryView.setBegndate(socialDirectoryUpinfo.getBegndate());
|
socialDirectoryView.setBegndate(socialDirectoryUpinfo.getBegndate());
|
||||||
|
|
@ -373,28 +376,29 @@ public class SocialDirectoryService extends BaseService {
|
||||||
socialDirectoryView.setPinyin(socialDirectoryUpinfo.getPinyin());
|
socialDirectoryView.setPinyin(socialDirectoryUpinfo.getPinyin());
|
||||||
}
|
}
|
||||||
SocialDirectoryLimit socialDirectoryLimit = stringSocialDirectoryLimitMap.get(socialDirectory.getCode());
|
SocialDirectoryLimit socialDirectoryLimit = stringSocialDirectoryLimitMap.get(socialDirectory.getCode());
|
||||||
if(socialDirectoryLimit!=null){
|
if (socialDirectoryLimit != null) {
|
||||||
socialDirectoryView.setHilistLmtpricType(socialDirectoryLimit.getHilistLmtpricType());
|
socialDirectoryView.setHilistLmtpricType(socialDirectoryLimit.getHilistLmtpricType());
|
||||||
socialDirectoryView.setHilistPricUplmtAmt(socialDirectoryLimit.getHilistPricUplmtAmt());
|
socialDirectoryView.setHilistPricUplmtAmt(socialDirectoryLimit.getHilistPricUplmtAmt());
|
||||||
}
|
}
|
||||||
SocialDirectorySelf socialDirectorySelf = stringSocialDirectorySelfMap.get(socialDirectory.getCode());
|
SocialDirectorySelf socialDirectorySelf = stringSocialDirectorySelfMap.get(socialDirectory.getCode());
|
||||||
if(socialDirectorySelf!=null){
|
if (socialDirectorySelf != null) {
|
||||||
socialDirectoryView.setSelfpayPropType(socialDirectorySelf.getSelfpayPropType());
|
socialDirectoryView.setSelfpayPropType(socialDirectorySelf.getSelfpayPropType());
|
||||||
socialDirectoryView.setSelfpayProp(socialDirectorySelf.getSelfpayProp());
|
socialDirectoryView.setSelfpayProp(socialDirectorySelf.getSelfpayProp());
|
||||||
}
|
}
|
||||||
socialDirectoryViewList.add(socialDirectoryView);
|
socialDirectoryViewList.add(socialDirectoryView);
|
||||||
}
|
}
|
||||||
Page<SocialDirectoryView> result=new Page<>();
|
Page<SocialDirectoryView> result = new Page<>();
|
||||||
result.setTotal_page((int) Math.ceil((double) count / pageSize));
|
result.setTotal_page((int) Math.ceil((double) count / pageSize));
|
||||||
result.setTotal_count(count);
|
result.setTotal_count(count);
|
||||||
result.setList(socialDirectoryViewList);
|
result.setList(socialDirectoryViewList);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 列表接口
|
* 列表接口
|
||||||
* @param type 类型
|
* @param type 类型
|
||||||
*/
|
*/
|
||||||
public Page<SocialDirectoryView> list(int type,int pageNum,int pageSize){
|
public Page<SocialDirectoryView> list(int type, int pageNum, int pageSize) {
|
||||||
return search(null, type, pageNum, pageSize);
|
return search(null, type, pageNum, pageSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -445,5 +449,62 @@ public class SocialDirectoryService extends BaseService {
|
||||||
return resultList;
|
return resultList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 批量补全信息为列表
|
||||||
|
*/
|
||||||
|
public List<SocialDirectoryView> fullList(List<String> codeList) {
|
||||||
|
List<SocialDirectoryView> socialDirectoryViewList = new ArrayList<>();
|
||||||
|
for (String code : codeList) {
|
||||||
|
SocialDirectoryView socialDirectoryView = fullInfo(code);
|
||||||
|
socialDirectoryViewList.add(socialDirectoryView);
|
||||||
|
}
|
||||||
|
return socialDirectoryViewList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 批量补全信息为map
|
||||||
|
*/
|
||||||
|
public Map<String, SocialDirectoryView> fullMap(List<String> codeList) {
|
||||||
|
Map<String, SocialDirectoryView> socialDirectoryViewMap = new HashMap<>();
|
||||||
|
for (String code : codeList) {
|
||||||
|
SocialDirectoryView socialDirectoryView = fullInfo(code);
|
||||||
|
socialDirectoryViewMap.put(socialDirectoryView.getCode(), socialDirectoryView);
|
||||||
|
}
|
||||||
|
return socialDirectoryViewMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 补全信息接口
|
||||||
|
* @param codeList code列表
|
||||||
|
*/
|
||||||
|
public SocialDirectoryView fullInfo(String code) {
|
||||||
|
QueryWrapper<SocialDirectory> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("code", code);
|
||||||
|
SocialDirectory socialDirectory = socialDirectoryMapper.selectOne(queryWrapper);
|
||||||
|
if (socialDirectory == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
SocialDirectoryView socialDirectoryView = JSONObject.parseObject(JSONObject.toJSONString(socialDirectory), SocialDirectoryView.class);
|
||||||
|
SocialDirectoryUpinfo socialDirectoryUpinfo = socialDirectoryUpinfoMapper.selectById(code);
|
||||||
|
if (socialDirectoryUpinfo != null) {
|
||||||
|
BeanUtils.copyProperties(socialDirectoryUpinfo, socialDirectoryView);
|
||||||
|
}
|
||||||
|
SocialDirectoryLimit socialDirectoryLimit = socialDirectoryLimitMapper.selectById(code);
|
||||||
|
if (socialDirectoryLimit != null) {
|
||||||
|
BeanUtils.copyProperties(socialDirectoryLimit, socialDirectoryView);
|
||||||
|
}
|
||||||
|
SocialDirectorySelf socialDirectorySelf = socialDirectorySelfMapper.selectById(code);
|
||||||
|
if (socialDirectorySelf != null) {
|
||||||
|
BeanUtils.copyProperties(socialDirectorySelf, socialDirectoryView);
|
||||||
|
}
|
||||||
|
return socialDirectoryView;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public SocialDirectory getByCode(String hilistCode) {
|
||||||
|
QueryWrapper<SocialDirectory> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("code", hilistCode)
|
||||||
|
.last("limit 1");
|
||||||
|
return socialDirectoryMapper.selectOne(queryWrapper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?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.syjiaer.clinic.server.mapper.goods.GoodsCateMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?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.syjiaer.clinic.server.mapper.goods.GoodsMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?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.syjiaer.clinic.server.mapper.medical.MedicalRecordDetailMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?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.syjiaer.clinic.server.mapper.medical.MedicalRecordMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?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.syjiaer.clinic.server.mapper.patient.PatientInfoMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?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.syjiaer.clinic.server.mapper.patient.RegistrationMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
@ -2,4 +2,13 @@
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.syjiaer.clinic.server.mapper.social.SocialDirectoryLimitMapper">
|
<mapper namespace="com.syjiaer.clinic.server.mapper.social.SocialDirectoryLimitMapper">
|
||||||
|
|
||||||
|
<select id="getByCode" resultType="java.util.Map">
|
||||||
|
select
|
||||||
|
social_directory_limit.hilist_lmtpric_type as hilist_lmtpric_type,
|
||||||
|
social_directory_limit.hilist_pric_uplmt_amt as hilist_pric_uplmt_amt,
|
||||||
|
social_directory_self.selfpay_prop_type as selfpay_prop_type,
|
||||||
|
from social_directory_limit
|
||||||
|
left join social_directory_selfpay on social_directory_limit.code = social_directory_selfpay.code
|
||||||
|
where code = #{code}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue