dev
This commit is contained in:
parent
d128d8dede
commit
4d0327aa8d
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.syjiaer.clinic.server.common.api.input;
|
||||||
|
|
||||||
|
import com.syjiaer.clinic.server.common.api.annotations.IMField;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class IM2202 extends BaseInputModel{
|
||||||
|
@IMField(key = "psn_no", name = "人员编号", required = true)
|
||||||
|
private String psnNo;
|
||||||
|
@IMField(key = "mdtrt_id", name = "就诊ID", required = true)
|
||||||
|
private String mdtrtId;
|
||||||
|
@IMField(key = "ipt_otp_no", name = "住院/门诊号", required = true)
|
||||||
|
private String iptOtpNo;
|
||||||
|
@IMField(key = "exp_content", name = "字段扩展")
|
||||||
|
private String expContent;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.syjiaer.clinic.server.common.api.input;
|
||||||
|
|
||||||
|
import com.syjiaer.clinic.server.common.api.annotations.IMField;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class IM2208 extends BaseInputModel{
|
||||||
|
@IMField(key = "setl_id", name = "结算ID", required = true)
|
||||||
|
private String setlId;
|
||||||
|
@IMField(key = "mdtrt_id", name = "就诊ID", required = true)
|
||||||
|
private String mdtrtId;
|
||||||
|
@IMField(key = "psn_no", name = "人员编号", required = true)
|
||||||
|
private String psnNo;
|
||||||
|
@IMField(key = "exp_content", name = "字段扩展")
|
||||||
|
private String expContent;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,96 @@
|
||||||
|
package com.syjiaer.clinic.server.common.api.output;
|
||||||
|
|
||||||
|
import com.syjiaer.clinic.server.common.api.annotations.OMField;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class OM2208 extends BaseOutputModel{
|
||||||
|
private String msgId;
|
||||||
|
private Setlinfo setlinfo;
|
||||||
|
private List<Setldetail> setldetail;
|
||||||
|
@Data
|
||||||
|
public static class Setlinfo {
|
||||||
|
@OMField(key = "mdtrt_id", name = "就诊ID")
|
||||||
|
private String mdtrt_id;
|
||||||
|
@OMField(key = "setl_id", name = "结算ID")
|
||||||
|
private String setl_id;
|
||||||
|
@OMField(key = "clr_optins", name = "清算经办机构")
|
||||||
|
private String clr_optins;
|
||||||
|
@OMField(key = "setl_time", name = "结算时间")
|
||||||
|
private LocalDateTime setl_time;
|
||||||
|
@OMField(key = "medfee_sumamt", name = "医疗费总额")
|
||||||
|
private BigDecimal medfee_sumamt;
|
||||||
|
@OMField(key = "fulamt_ownpay_amt", name = "全自费金额")
|
||||||
|
private BigDecimal fulamt_ownpay_amt;
|
||||||
|
@OMField(key = "overlmt_selfpay", name = "超限价自费费用")
|
||||||
|
private BigDecimal overlmt_selfpay;
|
||||||
|
@OMField(key = "preselfpay_amt", name = "先行自付金额")
|
||||||
|
private BigDecimal preselfpay_amt;
|
||||||
|
@OMField(key = "inscp_scp_amt", name = "符合政策范围金额")
|
||||||
|
private BigDecimal inscp_scp_amt;
|
||||||
|
@OMField(key = "act_pay_dedc", name = "实际支付起付线")
|
||||||
|
private BigDecimal act_pay_dedc;
|
||||||
|
@OMField(key = "hifp_pay", name = "基本医疗保险统筹基金支出")
|
||||||
|
private BigDecimal hifp_pay;
|
||||||
|
@OMField(key = "pool_prop_selfpay", name = "基本医疗保险统筹基金支付比例")
|
||||||
|
private BigDecimal pool_prop_selfpay;
|
||||||
|
@OMField(key = "cvlserv_pay", name = "公务员医疗补助资金支出")
|
||||||
|
private BigDecimal cvlserv_pay;
|
||||||
|
@OMField(key = "hifes_pay", name = "企业补充医疗保险基金支出")
|
||||||
|
private BigDecimal hifes_pay;
|
||||||
|
@OMField(key = "hifmi_pay", name = "居民大病保险资金支出")
|
||||||
|
private BigDecimal hifmi_pay;
|
||||||
|
@OMField(key = "hifob_pay", name = "职工大额医疗费用补助基金支出")
|
||||||
|
private BigDecimal hifob_pay;
|
||||||
|
@OMField(key = "maf_pay", name = "医疗救助基金支出")
|
||||||
|
private BigDecimal maf_pay;
|
||||||
|
@OMField(key = "oth_pay", name = "其他支出")
|
||||||
|
private BigDecimal oth_pay;
|
||||||
|
@OMField(key = "fund_pay_sumamt", name = "基金支付总额")
|
||||||
|
private BigDecimal fund_pay_sumamt;
|
||||||
|
@OMField(key = "psn_part_amt", name = "个人负担总金额")
|
||||||
|
private BigDecimal psn_part_amt;
|
||||||
|
@OMField(key = "acct_pay", name = "个人账户支出")
|
||||||
|
private BigDecimal acct_pay;
|
||||||
|
@OMField(key = "balc", name = "余额")
|
||||||
|
private BigDecimal balc;
|
||||||
|
@OMField(key = "acct_mulaid_pay", name = "其中个人账户共济支付金额")
|
||||||
|
private BigDecimal acct_mulaid_pay;
|
||||||
|
@OMField(key = "hosp_part_amt", name = "医院负担金额")
|
||||||
|
private BigDecimal hosp_part_amt;
|
||||||
|
@OMField(key = "medins_setl_id", name = "医药机构结算ID")
|
||||||
|
private String medins_setl_id;
|
||||||
|
@OMField(key = "psn_cash_pay", name = "个人现金支出")
|
||||||
|
private BigDecimal psn_cash_pay;
|
||||||
|
@OMField(key = "exp_content", name = "字段扩展")
|
||||||
|
private String exp_content;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class Setldetail {
|
||||||
|
|
||||||
|
@OMField(key = "fund_pay_type", name = "基金支付类型")
|
||||||
|
private String fund_pay_type;
|
||||||
|
@OMField(key = "inscp_scp_amt", name = "符合政策范围金额")
|
||||||
|
private BigDecimal inscp_scp_amt;
|
||||||
|
@OMField(key = "crt_payb_lmt_amt", name = "本次可支付限额金额")
|
||||||
|
private BigDecimal crt_payb_lmt_amt;
|
||||||
|
@OMField(key = "fund_payamt", name = "基金支付金额")
|
||||||
|
private BigDecimal fund_payamt;
|
||||||
|
@OMField(key = "fund_pay_type_name", name = "基金支付类型名称")
|
||||||
|
private String fund_pay_type_name;
|
||||||
|
@OMField(key = "setl_proc_info", name = "结算过程信息")
|
||||||
|
private String setl_proc_info;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -229,4 +229,17 @@ public class SocialRequest {
|
||||||
public void call3506(IM3506 im3506) {
|
public void call3506(IM3506 im3506) {
|
||||||
httpUtil.callBackMsgId("3506", im3506.buildToMap());
|
httpUtil.callBackMsgId("3506", im3506.buildToMap());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void call2202(IM2202 im2202) {
|
||||||
|
httpUtil.call("2202", "data",im2202.buildToMap(), 10000);
|
||||||
|
}
|
||||||
|
|
||||||
|
public OM2208 call2208(IM2208 im2208) {
|
||||||
|
JSONObject jsonObject = httpUtil.call("2208", "data", im2208.buildToMap(), 10000);
|
||||||
|
OM2208 om2208=new OM2208();
|
||||||
|
om2208.setSetlinfo(JSONObject.parseObject(jsonObject.get("setlinfo").toString(), OM2208.Setlinfo.class));
|
||||||
|
om2208.setSetldetail(JSONArray.parseArray(jsonObject.get("setldetail").toString(), OM2208.Setldetail.class));
|
||||||
|
return om2208;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import lombok.Getter;
|
||||||
@Getter
|
@Getter
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public enum ChargeSourceEnum {
|
public enum ChargeSourceEnum {
|
||||||
|
REFUND(1,"门诊退费"),
|
||||||
CHARGE(0,"门诊收费");
|
CHARGE(0,"门诊收费");
|
||||||
private final Integer type;
|
private final Integer type;
|
||||||
private final String desc;
|
private final String desc;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
package com.syjiaer.clinic.server.common.enums;
|
||||||
|
|
||||||
|
public enum RegistrationTypeEnum {
|
||||||
|
Social(2,"医保"),
|
||||||
|
Common(1,"普通挂号");
|
||||||
|
private final Integer type;
|
||||||
|
private final String desc;
|
||||||
|
|
||||||
|
RegistrationTypeEnum(Integer type, String desc) {
|
||||||
|
this.type = type;
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDesc() {
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
public static RegistrationTypeEnum getByType(Integer type) {
|
||||||
|
for (RegistrationTypeEnum registrationTypeEnum : RegistrationTypeEnum.values()) {
|
||||||
|
if (registrationTypeEnum.getType().equals(type)) {
|
||||||
|
return registrationTypeEnum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -27,24 +27,40 @@ import java.util.Map;
|
||||||
public class ChargeController extends BaseController {
|
public class ChargeController extends BaseController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ChargeService chargeService;
|
private ChargeService chargeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存收费订单
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@RequestMapping("/save")
|
@RequestMapping("/save")
|
||||||
public Result<Object> save() {
|
public Result<Object> save() {
|
||||||
ChargeSaveDto dto = parmsUtil.getObject("data", ChargeSaveDto.class);
|
ChargeSaveDto dto = parmsUtil.getObject("data", ChargeSaveDto.class);
|
||||||
ChargeOrder chargeOrder = chargeService.save(dto);
|
ChargeOrder chargeOrder = chargeService.save(dto);
|
||||||
return success(chargeOrder.getCode());
|
return success(chargeOrder.getCode());
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
查询list 带详情
|
||||||
|
*/
|
||||||
@RequestMapping("/listDetail")
|
@RequestMapping("/listDetail")
|
||||||
public Result<Page<ChargeDetailVo>> listDetail() {
|
public Result<Page<ChargeDetailVo>> listDetail() {
|
||||||
ChargeQuery chargeQuery = parmsUtil.getObject("query", ChargeQuery.class);
|
ChargeQuery chargeQuery = parmsUtil.getObject("query", ChargeQuery.class);
|
||||||
return success(chargeService.pageDetailList(chargeQuery));
|
return success(chargeService.pageDetailList(chargeQuery));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询list 只有订单信息
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@RequestMapping("/list")
|
@RequestMapping("/list")
|
||||||
public Result<Page<ChargeOrder>> list() {
|
public Result<Page<ChargeOrder>> list() {
|
||||||
ChargeQuery chargeQuery = parmsUtil.getObject("query", ChargeQuery.class);
|
ChargeQuery chargeQuery = parmsUtil.getObject("query", ChargeQuery.class);
|
||||||
return success(chargeService.pageList(chargeQuery));
|
return success(chargeService.pageList(chargeQuery));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 完成订单
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@RequestMapping("/completeOrder")
|
@RequestMapping("/completeOrder")
|
||||||
public Result<Object> completeOrder() {
|
public Result<Object> completeOrder() {
|
||||||
Integer id = parmsUtil.getInteger("id");
|
Integer id = parmsUtil.getInteger("id");
|
||||||
|
|
@ -52,6 +68,11 @@ public class ChargeController extends BaseController {
|
||||||
chargeService.completeOrder(id,payType);
|
chargeService.completeOrder(id,payType);
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据code查询订单详情
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@RequestMapping("/getByCode")
|
@RequestMapping("/getByCode")
|
||||||
public Result<ChargeDetailVo> getByCode() {
|
public Result<ChargeDetailVo> getByCode() {
|
||||||
String code = parmsUtil.getString("code");
|
String code = parmsUtil.getString("code");
|
||||||
|
|
@ -59,13 +80,21 @@ public class ChargeController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 医保上传支付明细
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@RequestMapping("/uploadCostDetails")
|
@RequestMapping("/uploadCostDetails")
|
||||||
public Result<Object> uploadCostDetails() {
|
public Result<Object> uploadCostDetails() {
|
||||||
String changeOrderCode = parmsUtil.getString("changeOrderCode");
|
String changeOrderCode = parmsUtil.getString("changeOrderCode");
|
||||||
chargeService.uploadCostDetails(changeOrderCode);
|
chargeService.uploadCostDetails(changeOrderCode);
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 医保预支付
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@RequestMapping("/socialPrePay")
|
@RequestMapping("/socialPrePay")
|
||||||
public Result<OM2206A> socialPrePay(){
|
public Result<OM2206A> socialPrePay(){
|
||||||
String changeOrderCode = parmsUtil.getString("changeOrderCode");
|
String changeOrderCode = parmsUtil.getString("changeOrderCode");
|
||||||
|
|
@ -75,7 +104,10 @@ public class ChargeController extends BaseController {
|
||||||
return success(chargeService.socialPrePay(changeOrderCode,mdtrtCertType,mdtrtCertNO,insutype));
|
return success(chargeService.socialPrePay(changeOrderCode,mdtrtCertType,mdtrtCertNO,insutype));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 医保真实支付
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@RequestMapping("/socialRealPay")
|
@RequestMapping("/socialRealPay")
|
||||||
public Result<OM2207A> socialRealPay(){
|
public Result<OM2207A> socialRealPay(){
|
||||||
String changeOrderCode = parmsUtil.getString("changeOrderCode");
|
String changeOrderCode = parmsUtil.getString("changeOrderCode");
|
||||||
|
|
@ -88,6 +120,16 @@ public class ChargeController extends BaseController {
|
||||||
chargeService.recordSocialInfo(om2207A, chargeService.getByCode(changeOrderCode), payType,curBalc);
|
chargeService.recordSocialInfo(om2207A, chargeService.getByCode(changeOrderCode), payType,curBalc);
|
||||||
return success( );
|
return success( );
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 订单退款
|
||||||
|
*/
|
||||||
|
@RequestMapping("/refund")
|
||||||
|
public Result<Object> refund() {
|
||||||
|
String changeOrderCode = parmsUtil.getString("changeOrderCode");
|
||||||
|
chargeService.refund(changeOrderCode);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 每日收费报表
|
* 每日收费报表
|
||||||
|
|
@ -104,7 +146,10 @@ public class ChargeController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 病人付费记录
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@RequestMapping("/getListByPatientId")
|
@RequestMapping("/getListByPatientId")
|
||||||
public Result<List<ChargeOrder>> getListByPatientId() {
|
public Result<List<ChargeOrder>> getListByPatientId() {
|
||||||
Integer patientId = parmsUtil.getInteger("patientId");
|
Integer patientId = parmsUtil.getInteger("patientId");
|
||||||
|
|
@ -112,7 +157,10 @@ public class ChargeController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收费记录
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@RequestMapping("/getChargeRecord")
|
@RequestMapping("/getChargeRecord")
|
||||||
public Result<Page<ChargeLog>> getChargeRecord() {
|
public Result<Page<ChargeLog>> getChargeRecord() {
|
||||||
return success(chargeService.getChargeRecordPageList());
|
return success(chargeService.getChargeRecordPageList());
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,15 @@ public class RegistrationController extends BaseController {
|
||||||
Page<PatientRegistration> pageResult = patientRegistrationService.listPage(page, size, startDate,endDate);
|
Page<PatientRegistration> pageResult = patientRegistrationService.listPage(page, size, startDate,endDate);
|
||||||
return success(pageResult);
|
return success(pageResult);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
*取消挂号
|
||||||
|
*/
|
||||||
|
@RequestMapping("/cancel")
|
||||||
|
public Result<?> cancel() {
|
||||||
|
Integer id = parmsUtil.getInteger("id");
|
||||||
|
patientRegistrationService.cancel(id);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改挂号信息
|
* 修改挂号信息
|
||||||
|
|
@ -132,4 +141,5 @@ public class RegistrationController extends BaseController {
|
||||||
Integer status= parmsUtil.getInteger("status","目标状态");
|
Integer status= parmsUtil.getInteger("status","目标状态");
|
||||||
return success( patientRegistrationService.changeStatus(regisId,status));
|
return success( patientRegistrationService.changeStatus(regisId,status));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,18 +15,18 @@ import lombok.ToString;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
*
|
* 收费商品详情
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author NiuZiYuan
|
* @author NiuZiYuan
|
||||||
* @since 2025-04-23
|
* @since 2025-05-12
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@ToString
|
@ToString
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@TableName("charge_goods_list")
|
@TableName("charge_goods_list")
|
||||||
@ApiModel(value = "ChargeGoodsList对象", description = "")
|
@ApiModel(value = "ChargeGoodsList对象", description = "收费商品详情")
|
||||||
public class ChargeGoodsList implements Serializable {
|
public class ChargeGoodsList implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
|
||||||
|
|
@ -13,18 +13,18 @@ import lombok.ToString;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
*
|
* 收费商品库存变化日志
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author NiuZiYuan
|
* @author NiuZiYuan
|
||||||
* @since 2025-04-22
|
* @since 2025-05-12
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@ToString
|
@ToString
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@TableName("charge_inventory_log")
|
@TableName("charge_inventory_log")
|
||||||
@ApiModel(value = "ChargeInventoryLog对象", description = "")
|
@ApiModel(value = "ChargeInventoryLog对象", description = "收费商品库存变化日志")
|
||||||
public class ChargeInventoryLog implements Serializable {
|
public class ChargeInventoryLog implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
@ -74,4 +74,7 @@ public class ChargeInventoryLog implements Serializable {
|
||||||
|
|
||||||
@ApiModelProperty("0未完成 1销售 2退货")
|
@ApiModelProperty("0未完成 1销售 2退货")
|
||||||
private Integer type;
|
private Integer type;
|
||||||
|
|
||||||
|
@ApiModelProperty("追溯码信息")
|
||||||
|
private String traceabilityCode;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,18 +14,18 @@ import lombok.ToString;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
*
|
* 医保收费记录
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author NiuZiYuan
|
* @author NiuZiYuan
|
||||||
* @since 2025-05-09
|
* @since 2025-05-12
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@ToString
|
@ToString
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@TableName("charge_social_pay_log")
|
@TableName("charge_social_pay_log")
|
||||||
@ApiModel(value = "ChargeSocialPayLog对象", description = "")
|
@ApiModel(value = "ChargeSocialPayLog对象", description = "医保收费记录")
|
||||||
public class ChargeSocialPayLog implements Serializable {
|
public class ChargeSocialPayLog implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
@ -116,7 +116,7 @@ public class ChargeSocialPayLog implements Serializable {
|
||||||
private Integer chargeType;
|
private Integer chargeType;
|
||||||
|
|
||||||
@ApiModelProperty("原有余额")
|
@ApiModelProperty("原有余额")
|
||||||
private String originalBalc;
|
private BigDecimal originalBalc;
|
||||||
|
|
||||||
@ApiModelProperty("证件号码")
|
@ApiModelProperty("证件号码")
|
||||||
private String certno;
|
private String certno;
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class ChargeGoodsListVo {
|
public class ChargeGoodsListVo {
|
||||||
|
|
@ -114,5 +115,7 @@ public class ChargeGoodsListVo {
|
||||||
private Integer selectedNum;
|
private Integer selectedNum;
|
||||||
@ApiModelProperty("选择的单位")
|
@ApiModelProperty("选择的单位")
|
||||||
private String selectedUnit;
|
private String selectedUnit;
|
||||||
|
@ApiModelProperty("追溯码列表")
|
||||||
|
private List<String> traceAbilityCodeList;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,18 @@
|
||||||
package com.syjiaer.clinic.server.service.charge;
|
package com.syjiaer.clinic.server.service.charge;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.syjiaer.clinic.server.common.api.input.IM2204;
|
import com.syjiaer.clinic.server.common.api.annotations.IMField;
|
||||||
import com.syjiaer.clinic.server.common.api.input.IM2205;
|
import com.syjiaer.clinic.server.common.api.input.*;
|
||||||
import com.syjiaer.clinic.server.common.api.input.IM2206A;
|
|
||||||
import com.syjiaer.clinic.server.common.api.input.IM2207A;
|
|
||||||
import com.syjiaer.clinic.server.common.api.output.OM2206A;
|
import com.syjiaer.clinic.server.common.api.output.OM2206A;
|
||||||
import com.syjiaer.clinic.server.common.api.output.OM2207A;
|
import com.syjiaer.clinic.server.common.api.output.OM2207A;
|
||||||
|
import com.syjiaer.clinic.server.common.api.output.OM2208;
|
||||||
import com.syjiaer.clinic.server.common.api.request.SocialRequest;
|
import com.syjiaer.clinic.server.common.api.request.SocialRequest;
|
||||||
import com.syjiaer.clinic.server.common.config.Config;
|
import com.syjiaer.clinic.server.common.config.Config;
|
||||||
import com.syjiaer.clinic.server.common.constants.Constants;
|
import com.syjiaer.clinic.server.common.constants.Constants;
|
||||||
import com.syjiaer.clinic.server.common.enums.*;
|
import com.syjiaer.clinic.server.common.enums.*;
|
||||||
import com.syjiaer.clinic.server.common.exception.MessageException;
|
import com.syjiaer.clinic.server.common.exception.MessageException;
|
||||||
|
import com.syjiaer.clinic.server.common.util.InfoUtil;
|
||||||
|
import com.syjiaer.clinic.server.common.util.ManagerUtil;
|
||||||
import com.syjiaer.clinic.server.common.util.StringUtil;
|
import com.syjiaer.clinic.server.common.util.StringUtil;
|
||||||
import com.syjiaer.clinic.server.common.vo.Page;
|
import com.syjiaer.clinic.server.common.vo.Page;
|
||||||
import com.syjiaer.clinic.server.entity.charge.*;
|
import com.syjiaer.clinic.server.entity.charge.*;
|
||||||
|
|
@ -25,6 +26,7 @@ import com.syjiaer.clinic.server.entity.diagnosis.DiagnosisMedicalGoodsList;
|
||||||
import com.syjiaer.clinic.server.entity.diagnosis.DiagnosisMedicalItemList;
|
import com.syjiaer.clinic.server.entity.diagnosis.DiagnosisMedicalItemList;
|
||||||
import com.syjiaer.clinic.server.entity.diagnosis.DiagnosisMedicalRecord;
|
import com.syjiaer.clinic.server.entity.diagnosis.DiagnosisMedicalRecord;
|
||||||
import com.syjiaer.clinic.server.entity.goods.Goods;
|
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.InventoryLog;
|
||||||
import com.syjiaer.clinic.server.entity.item.Item;
|
import com.syjiaer.clinic.server.entity.item.Item;
|
||||||
import com.syjiaer.clinic.server.entity.manager.ManagerUser;
|
import com.syjiaer.clinic.server.entity.manager.ManagerUser;
|
||||||
|
|
@ -42,6 +44,7 @@ import com.syjiaer.clinic.server.mapper.diagnosis.DiagnosisMedicalItemListMapper
|
||||||
import com.syjiaer.clinic.server.mapper.goods.GoodsMapper;
|
import com.syjiaer.clinic.server.mapper.goods.GoodsMapper;
|
||||||
import com.syjiaer.clinic.server.mapper.inventory.InventoryLogMapper;
|
import com.syjiaer.clinic.server.mapper.inventory.InventoryLogMapper;
|
||||||
import com.syjiaer.clinic.server.mapper.diagnosis.DiagnosisMedicalRecordMapper;
|
import com.syjiaer.clinic.server.mapper.diagnosis.DiagnosisMedicalRecordMapper;
|
||||||
|
import com.syjiaer.clinic.server.mapper.inventory.InventoryMapper;
|
||||||
import com.syjiaer.clinic.server.mapper.item.ItemMapper;
|
import com.syjiaer.clinic.server.mapper.item.ItemMapper;
|
||||||
import com.syjiaer.clinic.server.mapper.organization.OrganizationMemberMapper;
|
import com.syjiaer.clinic.server.mapper.organization.OrganizationMemberMapper;
|
||||||
import com.syjiaer.clinic.server.mapper.organization.OrganizationSectionMapper;
|
import com.syjiaer.clinic.server.mapper.organization.OrganizationSectionMapper;
|
||||||
|
|
@ -119,65 +122,79 @@ public class ChargeService extends BaseService {
|
||||||
private ChargeSocialPayLogMapper chargeSocialPayLogMapper;
|
private ChargeSocialPayLogMapper chargeSocialPayLogMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private Config config;
|
private Config config;
|
||||||
|
@Autowired
|
||||||
|
private InventoryMapper inventoryMapper;
|
||||||
|
@Autowired
|
||||||
|
private InfoUtil infoUtil;
|
||||||
|
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public ChargeOrder save(ChargeSaveDto dto) {
|
public ChargeOrder save(ChargeSaveDto dto) {
|
||||||
ChargeOrder dbOrder = chargeOrderMapper.selectById(dto.getId());
|
Diagnosis diagnosis = diagnosisMapper.selectById(dto.getId());
|
||||||
|
if (diagnosis == null) {
|
||||||
|
throw new RuntimeException("该诊断不存在");
|
||||||
|
}
|
||||||
|
QueryWrapper<ChargeOrder> orderWrapper = new QueryWrapper<>();
|
||||||
|
orderWrapper.eq("diagnosis_code", diagnosis.getCode());
|
||||||
|
orderWrapper.last("limit 1");
|
||||||
|
|
||||||
|
ChargeOrder dbOrder = chargeOrderMapper.selectOne(orderWrapper);
|
||||||
if (dbOrder != null) {
|
if (dbOrder != null) {
|
||||||
//编辑 清除已有的订单
|
//编辑 清除已有的订单
|
||||||
chargeItemListMapper.delete(new QueryWrapper<ChargeItemList>().eq("charge_order_code", dbOrder.getCode()));
|
chargeItemListMapper.delete(new QueryWrapper<ChargeItemList>().eq("charge_order_code", dbOrder.getCode()));
|
||||||
chargeGoodsListMapper.delete(new QueryWrapper<ChargeGoodsList>().eq("charge_order_code", dbOrder.getCode()));
|
chargeGoodsListMapper.delete(new QueryWrapper<ChargeGoodsList>().eq("charge_order_code", dbOrder.getCode()));
|
||||||
}
|
}
|
||||||
Diagnosis diagnosis = diagnosisMapper.selectById(dto.getId());
|
|
||||||
//清除该诊断的病例信息
|
|
||||||
if (diagnosis != null) {
|
|
||||||
String diaCode = diagnosis.getCode();
|
|
||||||
diagnosisMedicalGoodsListMapper.delete(new QueryWrapper<DiagnosisMedicalGoodsList>().eq("diagnosis_code", diaCode));
|
|
||||||
diagnosisMedicalItemListMapper.delete(new QueryWrapper<DiagnosisMedicalItemList>().eq("diagnosis_code", diaCode));
|
|
||||||
//重新插入
|
|
||||||
DiagnosisMedicalRecord medicalRecord = new DiagnosisMedicalRecord();
|
|
||||||
BeanUtils.copyProperties(dto.getDiagnosisMedicalRecord(), medicalRecord);
|
|
||||||
diagnosisMedicalRecordMapper.updateById(medicalRecord);
|
|
||||||
List<DiagnosisMedicalItemList> mdItmeList = new ArrayList<>();
|
|
||||||
for (ChargeItemListVo item : dto.getItemDetail()) {
|
|
||||||
DiagnosisMedicalItemList itemDetail = new DiagnosisMedicalItemList();
|
|
||||||
itemDetail.setItemId(item.getId());
|
|
||||||
itemDetail.setDiagnosisCode(diaCode);
|
|
||||||
itemDetail.setNumber(item.getSelectedNum());
|
|
||||||
itemDetail.setName(item.getItemName());
|
|
||||||
itemDetail.setSocialCode(item.getItemSocialCode());
|
|
||||||
itemDetail.setUnit(item.getSelectedUnit());
|
|
||||||
itemDetail.setUnitPrice(item.getSelectedPrice());
|
|
||||||
mdItmeList.add(itemDetail);
|
|
||||||
}
|
|
||||||
diagnosisMedicalItemListMapper.insert(mdItmeList);
|
|
||||||
List<DiagnosisMedicalGoodsList> mdGoodsList = new ArrayList<>();
|
|
||||||
for (ChargeGoodsListVo goods : dto.getGoodsDetail()) {
|
|
||||||
DiagnosisMedicalGoodsList goodDetail = new DiagnosisMedicalGoodsList();
|
|
||||||
goodDetail.setGoodsId(goods.getId());
|
|
||||||
goodDetail.setDiagnosisCode(diaCode);
|
|
||||||
goodDetail.setName(goods.getName());
|
|
||||||
goodDetail.setSocialCode(goods.getHilistCode());
|
|
||||||
goodDetail.setUnit(goods.getSelectedUnit());
|
|
||||||
goodDetail.setUnitPrice(goods.getSelectedPrice());
|
|
||||||
goodDetail.setNumber(goods.getSelectedNum());
|
|
||||||
mdGoodsList.add(goodDetail);
|
|
||||||
}
|
|
||||||
diagnosisMedicalGoodsListMapper.insert(mdGoodsList);
|
|
||||||
|
|
||||||
|
//清除该诊断的病例信息
|
||||||
|
String diaCode = diagnosis.getCode();
|
||||||
|
diagnosisMedicalGoodsListMapper.delete(new QueryWrapper<DiagnosisMedicalGoodsList>().eq("diagnosis_code", diaCode));
|
||||||
|
diagnosisMedicalItemListMapper.delete(new QueryWrapper<DiagnosisMedicalItemList>().eq("diagnosis_code", diaCode));
|
||||||
|
//重新插入
|
||||||
|
DiagnosisMedicalRecord medicalRecord = new DiagnosisMedicalRecord();
|
||||||
|
BeanUtils.copyProperties(dto.getDiagnosisMedicalRecord(), medicalRecord);
|
||||||
|
diagnosisMedicalRecordMapper.updateById(medicalRecord);
|
||||||
|
List<DiagnosisMedicalItemList> mdItmeList = new ArrayList<>();
|
||||||
|
for (ChargeItemListVo item : dto.getItemDetail()) {
|
||||||
|
DiagnosisMedicalItemList itemDetail = new DiagnosisMedicalItemList();
|
||||||
|
itemDetail.setItemId(item.getId());
|
||||||
|
itemDetail.setDiagnosisCode(diaCode);
|
||||||
|
itemDetail.setNumber(item.getSelectedNum());
|
||||||
|
itemDetail.setName(item.getItemName());
|
||||||
|
itemDetail.setSocialCode(item.getItemSocialCode());
|
||||||
|
itemDetail.setUnit(item.getSelectedUnit());
|
||||||
|
itemDetail.setUnitPrice(item.getSelectedPrice());
|
||||||
|
mdItmeList.add(itemDetail);
|
||||||
}
|
}
|
||||||
|
diagnosisMedicalItemListMapper.insert(mdItmeList);
|
||||||
|
List<DiagnosisMedicalGoodsList> mdGoodsList = new ArrayList<>();
|
||||||
|
for (ChargeGoodsListVo goods : dto.getGoodsDetail()) {
|
||||||
|
DiagnosisMedicalGoodsList goodDetail = new DiagnosisMedicalGoodsList();
|
||||||
|
goodDetail.setGoodsId(goods.getId());
|
||||||
|
goodDetail.setDiagnosisCode(diaCode);
|
||||||
|
goodDetail.setName(goods.getName());
|
||||||
|
goodDetail.setSocialCode(goods.getHilistCode());
|
||||||
|
goodDetail.setUnit(goods.getSelectedUnit());
|
||||||
|
goodDetail.setUnitPrice(goods.getSelectedPrice());
|
||||||
|
goodDetail.setNumber(goods.getSelectedNum());
|
||||||
|
mdGoodsList.add(goodDetail);
|
||||||
|
}
|
||||||
|
diagnosisMedicalGoodsListMapper.insert(mdGoodsList);
|
||||||
|
|
||||||
|
|
||||||
QueryWrapper<ChargeOrder> listWrapper = new QueryWrapper<>();
|
QueryWrapper<ChargeOrder> listWrapper = new QueryWrapper<>();
|
||||||
listWrapper.eq("diagnosis_code", dto.getDiagnosisMedicalRecord().getDiagnosisCode());
|
listWrapper.eq("diagnosis_code", dto.getDiagnosisMedicalRecord().
|
||||||
|
|
||||||
|
getDiagnosisCode());
|
||||||
listWrapper.eq("status", RetailOrderStatusEnum.FINISHED.getCode());
|
listWrapper.eq("status", RetailOrderStatusEnum.FINISHED.getCode());
|
||||||
List<ChargeOrder> dbList = chargeOrderMapper.selectList(listWrapper);
|
List<ChargeOrder> dbList = chargeOrderMapper.selectList(listWrapper);
|
||||||
if (!dbList.isEmpty()) {
|
if (!dbList.isEmpty()) {
|
||||||
throw new MessageException("该诊断已完成收费");
|
throw new MessageException("该诊断已完成收费");
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryWrapper<ChargeOrder> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<ChargeOrder> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.eq("diagnosis_code", dto.getDiagnosisMedicalRecord().getDiagnosisCode());
|
queryWrapper.eq("diagnosis_code", dto.getDiagnosisMedicalRecord().
|
||||||
|
|
||||||
|
getDiagnosisCode());
|
||||||
queryWrapper.eq("status", RetailOrderStatusEnum.UNFINISHED.getCode());
|
queryWrapper.eq("status", RetailOrderStatusEnum.UNFINISHED.getCode());
|
||||||
chargeOrderMapper.delete(queryWrapper);
|
chargeOrderMapper.delete(queryWrapper);
|
||||||
|
|
||||||
|
|
@ -188,7 +205,8 @@ public class ChargeService extends BaseService {
|
||||||
BigDecimal preTotalPrice = BigDecimal.ZERO;
|
BigDecimal preTotalPrice = BigDecimal.ZERO;
|
||||||
BigDecimal totalPrice = BigDecimal.ZERO;
|
BigDecimal totalPrice = BigDecimal.ZERO;
|
||||||
List<ChargeItemList> chargeServiceLists = new ArrayList<>();
|
List<ChargeItemList> chargeServiceLists = new ArrayList<>();
|
||||||
for (ChargeItemListVo service : dto.getItemDetail()) {
|
for (
|
||||||
|
ChargeItemListVo service : dto.getItemDetail()) {
|
||||||
ChargeItemList itemList = new ChargeItemList();
|
ChargeItemList itemList = new ChargeItemList();
|
||||||
String fsn = StringUtil.getCode("FSN");
|
String fsn = StringUtil.getCode("FSN");
|
||||||
itemList.setChargeOrderCode(code);
|
itemList.setChargeOrderCode(code);
|
||||||
|
|
@ -211,7 +229,8 @@ public class ChargeService extends BaseService {
|
||||||
chargeItemListMapper.insert(chargeServiceLists);
|
chargeItemListMapper.insert(chargeServiceLists);
|
||||||
|
|
||||||
List<ChargeGoodsList> chargeGoodsLists = new ArrayList<>();
|
List<ChargeGoodsList> chargeGoodsLists = new ArrayList<>();
|
||||||
for (ChargeGoodsListVo goods : dto.getGoodsDetail()) {
|
for (
|
||||||
|
ChargeGoodsListVo goods : dto.getGoodsDetail()) {
|
||||||
ChargeGoodsList itemList = new ChargeGoodsList();
|
ChargeGoodsList itemList = new ChargeGoodsList();
|
||||||
Goods dbGoods = goodsMapper.selectById(goods.getId());
|
Goods dbGoods = goodsMapper.selectById(goods.getId());
|
||||||
if (dbGoods == null) {
|
if (dbGoods == null) {
|
||||||
|
|
@ -235,6 +254,13 @@ public class ChargeService extends BaseService {
|
||||||
itemList.setCreateDate(nowLocalDate);
|
itemList.setCreateDate(nowLocalDate);
|
||||||
itemList.setCreateTime(nowLocalDateTime);
|
itemList.setCreateTime(nowLocalDateTime);
|
||||||
itemList.setType(dbGoods.getType());
|
itemList.setType(dbGoods.getType());
|
||||||
|
//添加追溯码
|
||||||
|
String traceabilityCode = null;
|
||||||
|
if (goods.getTraceAbilityCodeList() != null) {
|
||||||
|
traceabilityCode = String.join(",", goods.getTraceAbilityCodeList());
|
||||||
|
}
|
||||||
|
itemList.setTraceabilityCode(traceabilityCode);
|
||||||
|
|
||||||
chargeGoodsLists.add(itemList);
|
chargeGoodsLists.add(itemList);
|
||||||
preTotalPrice = preTotalPrice.add(subTotalPrice);
|
preTotalPrice = preTotalPrice.add(subTotalPrice);
|
||||||
totalPrice = totalPrice.add(subTotalPrice);
|
totalPrice = totalPrice.add(subTotalPrice);
|
||||||
|
|
@ -255,10 +281,11 @@ public class ChargeService extends BaseService {
|
||||||
return chargeOrder;
|
return chargeOrder;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Page<ChargeDetailVo> pageDetailList(ChargeQuery query) {
|
public Page<ChargeDetailVo> pageDetailList(ChargeQuery query) {
|
||||||
Page<ChargeOrder> page = pageList(query);
|
Page<ChargeOrder> page = pageList(query);
|
||||||
List<ChargeDetailVo> detailList = new ArrayList<>();
|
List<ChargeDetailVo> detailList = new ArrayList<>();
|
||||||
for (ChargeOrder chargeOrder : page.getList()){
|
for (ChargeOrder chargeOrder : page.getList()) {
|
||||||
detailList.add(getDetail(chargeOrder.getCode()));
|
detailList.add(getDetail(chargeOrder.getCode()));
|
||||||
}
|
}
|
||||||
Page<ChargeDetailVo> pageResult = new Page<>();
|
Page<ChargeDetailVo> pageResult = new Page<>();
|
||||||
|
|
@ -270,7 +297,6 @@ public class ChargeService extends BaseService {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Page<ChargeOrder> pageList(ChargeQuery query) {
|
public Page<ChargeOrder> pageList(ChargeQuery query) {
|
||||||
QueryWrapper<ChargeOrder> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<ChargeOrder> queryWrapper = new QueryWrapper<>();
|
||||||
if (query.getPageSize() == null || query.getPageSize() == 0) {
|
if (query.getPageSize() == null || query.getPageSize() == 0) {
|
||||||
|
|
@ -291,6 +317,7 @@ public class ChargeService extends BaseService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取订单详细信息
|
* 获取订单详细信息
|
||||||
|
*
|
||||||
* @param code
|
* @param code
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -491,6 +518,15 @@ public class ChargeService extends BaseService {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 医保真实支付
|
||||||
|
*
|
||||||
|
* @param chargeOrderCode
|
||||||
|
* @param mdtrtCertType
|
||||||
|
* @param mdtrtCertNo
|
||||||
|
* @param insutype
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public OM2207A socialRealPay(String chargeOrderCode, String mdtrtCertType, String mdtrtCertNo, String insutype) {
|
public OM2207A socialRealPay(String chargeOrderCode, String mdtrtCertType, String mdtrtCertNo, String insutype) {
|
||||||
ChargeOrder order = chargeOrderMapper.selectByCode(chargeOrderCode);
|
ChargeOrder order = chargeOrderMapper.selectByCode(chargeOrderCode);
|
||||||
Diagnosis diagnosis = diagnosisMapper.selectByCode(order.getDiagnosisCode());
|
Diagnosis diagnosis = diagnosisMapper.selectByCode(order.getDiagnosisCode());
|
||||||
|
|
@ -509,6 +545,19 @@ public class ChargeService extends BaseService {
|
||||||
data.setChrg_bchno(order.getCode());
|
data.setChrg_bchno(order.getCode());
|
||||||
data.setAcct_used_flag("1");
|
data.setAcct_used_flag("1");
|
||||||
data.setInsutype(insutype);
|
data.setInsutype(insutype);
|
||||||
|
Integer minpacunt_drug_trac_cnt = 0;
|
||||||
|
List<ChargeGoodsList> goodsList = chargeGoodsListMapper.selectByCode(chargeOrderCode);
|
||||||
|
for (ChargeGoodsList goodsListItem : goodsList) {
|
||||||
|
Goods goods = goodsMapper.selectById(goodsListItem.getGoodsId());
|
||||||
|
if (goodsListItem.getUnit().equals(goods.getPackagingUnit())) {
|
||||||
|
minpacunt_drug_trac_cnt += goodsListItem.getNumber();
|
||||||
|
} else {
|
||||||
|
double count = (double) goodsListItem.getNumber() / goods.getMinPackagingNumber();
|
||||||
|
minpacunt_drug_trac_cnt += (int) Math.ceil(count);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
data.setMinpacunt_drug_trac_cnt(BigDecimal.valueOf(minpacunt_drug_trac_cnt));
|
||||||
IM2207A.ExpContent expContent = new IM2207A.ExpContent();
|
IM2207A.ExpContent expContent = new IM2207A.ExpContent();
|
||||||
data.setExp_content(expContent);
|
data.setExp_content(expContent);
|
||||||
im2207A.setData(data);
|
im2207A.setData(data);
|
||||||
|
|
@ -590,6 +639,12 @@ public class ChargeService extends BaseService {
|
||||||
return paymentMethodVo;
|
return paymentMethodVo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据code查订单
|
||||||
|
*
|
||||||
|
* @param code
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public ChargeOrder getByCode(String code) {
|
public ChargeOrder getByCode(String code) {
|
||||||
QueryWrapper<ChargeOrder> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<ChargeOrder> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.eq("code", code);
|
queryWrapper.eq("code", code);
|
||||||
|
|
@ -647,6 +702,7 @@ public class ChargeService extends BaseService {
|
||||||
*/
|
*/
|
||||||
public void recordChargeInventoryLog(List<InventoryLog> logs, ChargeOrder chargeOrder) {
|
public void recordChargeInventoryLog(List<InventoryLog> logs, ChargeOrder chargeOrder) {
|
||||||
List<ChargeInventoryLog> chargeInventoryLogs = new ArrayList<>();
|
List<ChargeInventoryLog> chargeInventoryLogs = new ArrayList<>();
|
||||||
|
Map<Integer, List<String>> traceabilityCodeMap = new HashMap<>();
|
||||||
for (InventoryLog log : logs) {
|
for (InventoryLog log : logs) {
|
||||||
ChargeInventoryLog chargeInventoryLog = new ChargeInventoryLog();
|
ChargeInventoryLog chargeInventoryLog = new ChargeInventoryLog();
|
||||||
chargeInventoryLog.setChargeOrderCode(chargeOrder.getCode());
|
chargeInventoryLog.setChargeOrderCode(chargeOrder.getCode());
|
||||||
|
|
@ -666,6 +722,27 @@ public class ChargeService extends BaseService {
|
||||||
listWrapper.eq("charge_order_code", chargeOrder.getCode());
|
listWrapper.eq("charge_order_code", chargeOrder.getCode());
|
||||||
listWrapper.eq("goods_id", log.getGoodsId());
|
listWrapper.eq("goods_id", log.getGoodsId());
|
||||||
ChargeGoodsList chargeGoodsList = chargeGoodsListMapper.selectOne(listWrapper);
|
ChargeGoodsList chargeGoodsList = chargeGoodsListMapper.selectOne(listWrapper);
|
||||||
|
if (!traceabilityCodeMap.containsKey(log.getGoodsId())){
|
||||||
|
String traceabilityCode = chargeGoodsList.getTraceabilityCode();
|
||||||
|
List<String> traceabilityCodes = traceabilityCode==null?new ArrayList<>()
|
||||||
|
:new ArrayList<>(Arrays.asList(traceabilityCode.split(",")));
|
||||||
|
traceabilityCodeMap.put(log.getGoodsId(),traceabilityCodes);
|
||||||
|
}
|
||||||
|
Iterator<String> iterator = traceabilityCodeMap.get(log.getGoodsId()).iterator();
|
||||||
|
int count = 0;
|
||||||
|
Integer iteratorCount = 0;
|
||||||
|
if (chargeGoodsList.getUnit().equals(dbGoods.getPackagingUnit())){
|
||||||
|
iteratorCount=chargeGoodsList.getNumber();
|
||||||
|
}else {
|
||||||
|
iteratorCount = (int) Math.ceil((double) chargeGoodsList.getNumber() / dbGoods.getMinPackagingNumber());
|
||||||
|
}
|
||||||
|
List<String> selectedCode = new ArrayList<>();
|
||||||
|
while (iterator.hasNext() && count<iteratorCount) {
|
||||||
|
String traceabilityCode = iterator.next();
|
||||||
|
selectedCode.add(traceabilityCode);
|
||||||
|
iterator.remove();
|
||||||
|
}
|
||||||
|
chargeInventoryLog.setTraceabilityCode(String.join(",",selectedCode));
|
||||||
chargeInventoryLog.setFeedetlSn(chargeGoodsList.getFeedetlSn());
|
chargeInventoryLog.setFeedetlSn(chargeGoodsList.getFeedetlSn());
|
||||||
chargeInventoryLog.setCreateTime(LocalDateTime.now());
|
chargeInventoryLog.setCreateTime(LocalDateTime.now());
|
||||||
chargeInventoryLog.setGoodsType(chargeGoodsList.getType());
|
chargeInventoryLog.setGoodsType(chargeGoodsList.getType());
|
||||||
|
|
@ -695,11 +772,11 @@ public class ChargeService extends BaseService {
|
||||||
*/
|
*/
|
||||||
public List<ChargeLog> listChargeLog(LocalDateTime beginTime, LocalDateTime endTime, Integer userId) {
|
public List<ChargeLog> listChargeLog(LocalDateTime beginTime, LocalDateTime endTime, Integer userId) {
|
||||||
QueryWrapper<ChargeLog> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<ChargeLog> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.ge("charge_time",beginTime);
|
queryWrapper.ge("charge_time", beginTime);
|
||||||
queryWrapper.le("charge_time",endTime);
|
queryWrapper.le("charge_time", endTime);
|
||||||
if (userId!=null){
|
if (userId != null) {
|
||||||
queryWrapper.eq("sale_person_id",userId);
|
queryWrapper.eq("sale_person_id", userId);
|
||||||
queryWrapper.or().eq("docker_id",userId);
|
queryWrapper.or().eq("docker_id", userId);
|
||||||
}
|
}
|
||||||
return chargeLogMapper.selectList(queryWrapper);
|
return chargeLogMapper.selectList(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
@ -707,12 +784,13 @@ public class ChargeService extends BaseService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 记录医保收费信息
|
* 记录医保收费信息
|
||||||
|
*
|
||||||
* @param om2102A
|
* @param om2102A
|
||||||
* @param dbOrder
|
* @param dbOrder
|
||||||
* @param payType
|
* @param payType
|
||||||
* @param curBalc
|
* @param curBalc
|
||||||
*/
|
*/
|
||||||
public void recordSocialInfo(OM2207A om2102A, ChargeOrder dbOrder, Integer payType,String curBalc) {
|
public void recordSocialInfo(OM2207A om2102A, ChargeOrder dbOrder, Integer payType, String curBalc) {
|
||||||
ChargeSocialPayLog socialPayLog = new ChargeSocialPayLog();
|
ChargeSocialPayLog socialPayLog = new ChargeSocialPayLog();
|
||||||
OM2207A.Setlinfo setlinfo = om2102A.getSetlinfo();
|
OM2207A.Setlinfo setlinfo = om2102A.getSetlinfo();
|
||||||
socialPayLog.setChargeOrderCode(dbOrder.getCode());
|
socialPayLog.setChargeOrderCode(dbOrder.getCode());
|
||||||
|
|
@ -739,13 +817,121 @@ public class ChargeService extends BaseService {
|
||||||
socialPayLog.setClrOptins(setlinfo.getClr_optins());
|
socialPayLog.setClrOptins(setlinfo.getClr_optins());
|
||||||
socialPayLog.setSetlTime(setlinfo.getSetl_time());
|
socialPayLog.setSetlTime(setlinfo.getSetl_time());
|
||||||
socialPayLog.setMedType(setlinfo.getMed_type());
|
socialPayLog.setMedType(setlinfo.getMed_type());
|
||||||
socialPayLog.setInfno("2102A");
|
socialPayLog.setInfno("2207A");
|
||||||
socialPayLog.setMsgid(om2102A.getMsgId());
|
socialPayLog.setMsgid(om2102A.getMsgId());
|
||||||
socialPayLog.setChargeType(ChargeTypeEnum.CHARGE.getChargeType());
|
socialPayLog.setChargeType(ChargeTypeEnum.CHARGE.getChargeType());
|
||||||
socialPayLog.setOriginalBalc(curBalc);
|
socialPayLog.setOriginalBalc(setlinfo.getBalc().add(setlinfo.getAcct_pay()));
|
||||||
chargeSocialPayLogMapper.insert(socialPayLog);
|
chargeSocialPayLogMapper.insert(socialPayLog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录医保退费信息
|
||||||
|
*
|
||||||
|
* @param dbOrder
|
||||||
|
*/
|
||||||
|
public void recordSocialRefundInfo(OM2208 om2208, ChargeOrder dbOrder, ChargeSocialPayLog payLog) {
|
||||||
|
ChargeSocialPayLog socialPayLog = new ChargeSocialPayLog();
|
||||||
|
OM2208.Setlinfo setlinfo = om2208.getSetlinfo();
|
||||||
|
socialPayLog.setChargeOrderCode(dbOrder.getCode());
|
||||||
|
socialPayLog.setSetlId(setlinfo.getSetl_id());
|
||||||
|
socialPayLog.setPsnNo(payLog.getPsnNo());
|
||||||
|
socialPayLog.setName(payLog.getName());
|
||||||
|
socialPayLog.setBalc(setlinfo.getBalc());
|
||||||
|
socialPayLog.setFundPaySumamt(setlinfo.getFund_pay_sumamt());
|
||||||
|
socialPayLog.setHifpPay(setlinfo.getHifp_pay());
|
||||||
|
socialPayLog.setPoolPropSelfpay(setlinfo.getPool_prop_selfpay());
|
||||||
|
socialPayLog.setCvlservPay(setlinfo.getCvlserv_pay());
|
||||||
|
socialPayLog.setHifesPay(setlinfo.getHifes_pay());
|
||||||
|
socialPayLog.setHifmiPay(setlinfo.getHifmi_pay());
|
||||||
|
socialPayLog.setHifobPay(setlinfo.getHifob_pay());
|
||||||
|
socialPayLog.setMafPay(setlinfo.getMaf_pay());
|
||||||
|
socialPayLog.setOthPay(setlinfo.getOth_pay());
|
||||||
|
socialPayLog.setPsnPartAmt(setlinfo.getPsn_part_amt());
|
||||||
|
socialPayLog.setAcctPay(setlinfo.getAcct_pay());
|
||||||
|
socialPayLog.setPsnCashPay(setlinfo.getPsn_cash_pay());
|
||||||
|
socialPayLog.setPsPayType(payLog.getPsPayType());
|
||||||
|
socialPayLog.setMdtrtId(setlinfo.getMdtrt_id());
|
||||||
|
socialPayLog.setInsutype(payLog.getInsutype());
|
||||||
|
socialPayLog.setClrType(payLog.getClrType());
|
||||||
|
socialPayLog.setClrOptins(setlinfo.getClr_optins());
|
||||||
|
socialPayLog.setSetlTime(setlinfo.getSetl_time());
|
||||||
|
socialPayLog.setMedType(payLog.getMedType());
|
||||||
|
socialPayLog.setInfno("2208");
|
||||||
|
socialPayLog.setMsgid(om2208.getMsgId());
|
||||||
|
socialPayLog.setChargeType(ChargeTypeEnum.REFUND.getChargeType());
|
||||||
|
socialPayLog.setOriginalBalc(setlinfo.getBalc().add(payLog.getAcctPay()));
|
||||||
|
chargeSocialPayLogMapper.insert(socialPayLog);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void refund(String changeOrderCode) {
|
||||||
|
ChargeOrder chargeOrder = chargeOrderMapper.selectByCode(changeOrderCode);
|
||||||
|
if (chargeOrder == null) {
|
||||||
|
throw new MessageException("订单不存在");
|
||||||
|
}
|
||||||
|
if (!chargeOrder.getStatus().equals(RetailOrderStatusEnum.FINISHED.getCode())) {
|
||||||
|
throw new MessageException("订单状态不为已完成");
|
||||||
|
}
|
||||||
|
if (chargeOrder.getStatus().equals(RetailOrderStatusEnum.REFUNDED.getCode())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (chargeOrder.getPayType().equals(RetailOrderPayTypeEnum.MEDICARE.getCode())) {
|
||||||
|
ChargeSocialPayLog socialPayLog = chargeSocialPayLogMapper.selectOne(new QueryWrapper<ChargeSocialPayLog>().eq("charge_order_code", chargeOrder.getCode()).last("limit 1"));
|
||||||
|
if (socialPayLog == null) {
|
||||||
|
throw new MessageException("查询不到医保付费记录");
|
||||||
|
}
|
||||||
|
IM2208 im2208 = new IM2208();
|
||||||
|
im2208.setSetlId(socialPayLog.getSetlId());
|
||||||
|
im2208.setMdtrtId(socialPayLog.getMdtrtId());
|
||||||
|
im2208.setPsnNo(socialPayLog.getPsnNo());
|
||||||
|
OM2208 om2208 = socialRequest.call2208(im2208);
|
||||||
|
//记录医保退费日志
|
||||||
|
recordSocialRefundInfo(om2208, chargeOrder, socialPayLog);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ChargeOrder updateOrder = new ChargeOrder();
|
||||||
|
updateOrder.setId(chargeOrder.getId());
|
||||||
|
updateOrder.setStatus(RetailOrderStatusEnum.REFUNDED.getCode());
|
||||||
|
chargeOrderMapper.updateById(updateOrder);
|
||||||
|
//记录退费日志
|
||||||
|
recordChargeLog(chargeOrder, ChargeSourceEnum.REFUND, ChargeTypeEnum.REFUND);
|
||||||
|
//库存添加回去
|
||||||
|
|
||||||
|
//库存加回去
|
||||||
|
QueryWrapper<ChargeInventoryLog> chargeInventoryLogQueryWrapper = new QueryWrapper<>();
|
||||||
|
chargeInventoryLogQueryWrapper.eq("charge_order_code", chargeOrder.getCode());
|
||||||
|
List<ChargeInventoryLog> chargeOrderInventories = chargeInventoryLogMapper.selectList(chargeInventoryLogQueryWrapper);
|
||||||
|
for (ChargeInventoryLog chargeInventoryLog : chargeOrderInventories) {
|
||||||
|
Inventory dbInventory = inventoryMapper.selectById(chargeInventoryLog.getInventoryId());
|
||||||
|
Goods dbGoods = goodsMapper.selectById(chargeInventoryLog.getGoodsId());
|
||||||
|
InventoryLog log = null;
|
||||||
|
if (chargeInventoryLog.getUnit().equals(dbGoods.getPackagingUnit())) {
|
||||||
|
//没拆零
|
||||||
|
log = inventoryService.changeNumber(dbInventory.getId(), Type.IN, chargeInventoryLog.getNumber(), 0, "零售退款退货");
|
||||||
|
} else {
|
||||||
|
//拆零
|
||||||
|
log = inventoryService.changeNumber(dbInventory.getId(), Type.IN, 0, chargeInventoryLog.getNumber(), "零售退款退货");
|
||||||
|
}
|
||||||
|
log.setSocialType(InventorySocialTypeEnum.OTHER_INBOUND.getType());
|
||||||
|
log.setType(InventoryTypeEnum.REFUND_IN.getType());
|
||||||
|
ManagerUser user = getManagerUser();
|
||||||
|
log.setOperateName(user.getName());
|
||||||
|
log.setOperateId(user.getId());
|
||||||
|
inventoryLogMapper.insert(log);
|
||||||
|
//添加退款退货的记录
|
||||||
|
ChargeInventoryLog refundInventory = new ChargeInventoryLog();
|
||||||
|
BeanUtils.copyProperties(chargeOrder, refundInventory);
|
||||||
|
refundInventory.setType(RetailInventoryTypeEnum.Refund.getType());
|
||||||
|
refundInventory.setUploadStatus(UploadStatusEnum.NoUpload.getStatus());
|
||||||
|
refundInventory.setCreateTime(LocalDateTime.now());
|
||||||
|
refundInventory.setId(null);
|
||||||
|
chargeInventoryLogMapper.insert(refundInventory);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// public void recordSocialInfo(OM2103 om2103, RetailOrder dbOrder) {
|
// public void recordSocialInfo(OM2103 om2103, RetailOrder dbOrder) {
|
||||||
// QueryWrapper<RetailSocialPayLog> logQuery = new QueryWrapper<>();
|
// QueryWrapper<RetailSocialPayLog> logQuery = new QueryWrapper<>();
|
||||||
// logQuery.eq("retail_order_code", dbOrder.getCode());
|
// logQuery.eq("retail_order_code", dbOrder.getCode());
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,12 @@ import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
import com.syjiaer.clinic.server.common.api.input.IM2201;
|
import com.syjiaer.clinic.server.common.api.input.IM2201;
|
||||||
|
import com.syjiaer.clinic.server.common.api.input.IM2202;
|
||||||
|
import com.syjiaer.clinic.server.common.api.input.IM2203A;
|
||||||
import com.syjiaer.clinic.server.common.api.request.SocialRequest;
|
import com.syjiaer.clinic.server.common.api.request.SocialRequest;
|
||||||
import com.syjiaer.clinic.server.common.constants.Constants;
|
import com.syjiaer.clinic.server.common.constants.Constants;
|
||||||
import com.syjiaer.clinic.server.common.enums.RegistrationStatusEnum;
|
import com.syjiaer.clinic.server.common.enums.RegistrationStatusEnum;
|
||||||
|
import com.syjiaer.clinic.server.common.enums.RegistrationTypeEnum;
|
||||||
import com.syjiaer.clinic.server.common.exception.MessageException;
|
import com.syjiaer.clinic.server.common.exception.MessageException;
|
||||||
import com.syjiaer.clinic.server.common.util.DateUtil;
|
import com.syjiaer.clinic.server.common.util.DateUtil;
|
||||||
import com.syjiaer.clinic.server.common.util.StringUtil;
|
import com.syjiaer.clinic.server.common.util.StringUtil;
|
||||||
|
|
@ -66,17 +69,17 @@ public class PatientRegistrationService extends BaseService {
|
||||||
if (registrationParam == null) {
|
if (registrationParam == null) {
|
||||||
throw new MessageException("data参数为空");
|
throw new MessageException("data参数为空");
|
||||||
}
|
}
|
||||||
if (registrationParam.getCertType() == null){
|
if (registrationParam.getCertType() == null) {
|
||||||
throw new MessageException("证件类型不能为空");
|
throw new MessageException("证件类型不能为空");
|
||||||
}
|
}
|
||||||
if (registrationParam.getCertNo() == null){
|
if (registrationParam.getCertNo() == null) {
|
||||||
throw new MessageException("证件号码不能为空");
|
throw new MessageException("证件号码不能为空");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LocalDateTime now =LocalDateTime.now();
|
LocalDateTime now = LocalDateTime.now();
|
||||||
String fstNo = StringUtil.getCode("FSN");
|
String fstNo = StringUtil.getCode("FSN");
|
||||||
if (registrationParam.getPatientInfoId() == null){
|
if (registrationParam.getPatientInfoId() == null) {
|
||||||
//将患者添加到患者表
|
//将患者添加到患者表
|
||||||
|
|
||||||
PatientInfo patientInfo = new PatientInfo();
|
PatientInfo patientInfo = new PatientInfo();
|
||||||
|
|
@ -103,7 +106,7 @@ public class PatientRegistrationService extends BaseService {
|
||||||
registration.setOrganizationSectionId(section.getId());
|
registration.setOrganizationSectionId(section.getId());
|
||||||
patientRegistrationMapper.insert(registration);
|
patientRegistrationMapper.insert(registration);
|
||||||
//医保挂号
|
//医保挂号
|
||||||
if (mdtrtCertType == null || mdtrtCertNo == null || mdtrtCertType.isEmpty() || mdtrtCertNo.isEmpty()){
|
if (mdtrtCertType == null || mdtrtCertNo == null || mdtrtCertType.isEmpty() || mdtrtCertNo.isEmpty()) {
|
||||||
return registration;
|
return registration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -121,11 +124,11 @@ public class PatientRegistrationService extends BaseService {
|
||||||
im2201.setCaty(section.getCaty());
|
im2201.setCaty(section.getCaty());
|
||||||
JSONObject jsonObject = socialRequest.call2201(im2201);
|
JSONObject jsonObject = socialRequest.call2201(im2201);
|
||||||
UpdateWrapper<PatientRegistration> regisWrapper = new UpdateWrapper<>();
|
UpdateWrapper<PatientRegistration> regisWrapper = new UpdateWrapper<>();
|
||||||
regisWrapper.set("mdtrt_id",((JSONObject)jsonObject.get("data")).get("mdtrt_id"));
|
regisWrapper.set("mdtrt_id", ((JSONObject) jsonObject.get("data")).get("mdtrt_id"));
|
||||||
regisWrapper.set("type",2);
|
regisWrapper.set("type", 2);
|
||||||
regisWrapper.eq("id",registration.getId());
|
regisWrapper.eq("id", registration.getId());
|
||||||
patientRegistrationMapper.update(null,regisWrapper);
|
patientRegistrationMapper.update(null, regisWrapper);
|
||||||
return registration;
|
return registration;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -148,6 +151,7 @@ public class PatientRegistrationService extends BaseService {
|
||||||
Page<PatientRegistration> pageResult = pageHelper(pageNum, pageSize, queryWrapper, patientRegistrationMapper);
|
Page<PatientRegistration> pageResult = pageHelper(pageNum, pageSize, queryWrapper, patientRegistrationMapper);
|
||||||
return pageResult;
|
return pageResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 删除挂号信息
|
* 删除挂号信息
|
||||||
* @param id 挂号id
|
* @param id 挂号id
|
||||||
|
|
@ -160,6 +164,7 @@ public class PatientRegistrationService extends BaseService {
|
||||||
patientRegistration.setDelFlag(1);
|
patientRegistration.setDelFlag(1);
|
||||||
patientRegistrationMapper.updateById(patientRegistration);
|
patientRegistrationMapper.updateById(patientRegistration);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 根据id查询挂号信息
|
* 根据id查询挂号信息
|
||||||
* @param id 挂号id
|
* @param id 挂号id
|
||||||
|
|
@ -167,24 +172,26 @@ public class PatientRegistrationService extends BaseService {
|
||||||
public PatientRegistrationVo getVoById(int id) {
|
public PatientRegistrationVo getVoById(int id) {
|
||||||
PatientRegistrationVo registrationVo = new PatientRegistrationVo();
|
PatientRegistrationVo registrationVo = new PatientRegistrationVo();
|
||||||
PatientRegistration registration = patientRegistrationMapper.selectById(id);
|
PatientRegistration registration = patientRegistrationMapper.selectById(id);
|
||||||
if (registration == null){
|
if (registration == null) {
|
||||||
throw new MessageException("id不存在");
|
throw new MessageException("id不存在");
|
||||||
}
|
}
|
||||||
BeanUtils.copyProperties(registration, registrationVo);
|
BeanUtils.copyProperties(registration, registrationVo);
|
||||||
PatientInfo patientInfo = patientInfoMapper.selectById(registration.getPatientInfoId());
|
PatientInfo patientInfo = patientInfoMapper.selectById(registration.getPatientInfoId());
|
||||||
if (patientInfo != null){
|
if (patientInfo != null) {
|
||||||
registrationVo.setCertNo(patientInfo.getCertNo());
|
registrationVo.setCertNo(patientInfo.getCertNo());
|
||||||
registrationVo.setCertType(patientInfo.getCertType());
|
registrationVo.setCertType(patientInfo.getCertType());
|
||||||
}
|
}
|
||||||
return registrationVo;
|
return registrationVo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PatientRegistration getById(int id) {
|
public PatientRegistration getById(int id) {
|
||||||
PatientRegistration registration = patientRegistrationMapper.selectById(id);
|
PatientRegistration registration = patientRegistrationMapper.selectById(id);
|
||||||
if (registration == null){
|
if (registration == null) {
|
||||||
throw new MessageException("id不存在");
|
throw new MessageException("id不存在");
|
||||||
}
|
}
|
||||||
return registration;
|
return registration;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 获取所有已删除挂号信息
|
* 获取所有已删除挂号信息
|
||||||
* @param id 挂号id
|
* @param id 挂号id
|
||||||
|
|
@ -195,6 +202,7 @@ public class PatientRegistrationService extends BaseService {
|
||||||
List<PatientRegistration> list = patientRegistrationMapper.selectList(queryWrapper);
|
List<PatientRegistration> list = patientRegistrationMapper.selectList(queryWrapper);
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 根据查询条件查询挂号信息
|
* 根据查询条件查询挂号信息
|
||||||
* @param query 查询条件
|
* @param query 查询条件
|
||||||
|
|
@ -215,18 +223,19 @@ public class PatientRegistrationService extends BaseService {
|
||||||
if (query.getPageSize() == null) {
|
if (query.getPageSize() == null) {
|
||||||
query.setPageSize(Constants.DetailPageSize);
|
query.setPageSize(Constants.DetailPageSize);
|
||||||
}
|
}
|
||||||
if (query.getBeginTime() != null){
|
if (query.getBeginTime() != null) {
|
||||||
regisQuery.ge("create_datetime",query.getBeginTime());
|
regisQuery.ge("create_datetime", query.getBeginTime());
|
||||||
}
|
}
|
||||||
if (query.getEndTime() != null){
|
if (query.getEndTime() != null) {
|
||||||
regisQuery.le("create_datetime",query.getEndTime());
|
regisQuery.le("create_datetime", query.getEndTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
return pageHelper(query.getPageNum(), query.getPageSize(), regisQuery, patientRegistrationMapper,"create_datetime",false);
|
return pageHelper(query.getPageNum(), query.getPageSize(), regisQuery, patientRegistrationMapper, "create_datetime", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 按时间范围分页查询挂号信息
|
* 按时间范围分页查询挂号信息
|
||||||
|
*
|
||||||
* @param page
|
* @param page
|
||||||
* @param size
|
* @param size
|
||||||
* @param startDate
|
* @param startDate
|
||||||
|
|
@ -234,19 +243,19 @@ public class PatientRegistrationService extends BaseService {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public Page<PatientRegistration> listPage(int page, int size, String startDate,String endDate) {
|
public Page<PatientRegistration> listPage(int page, int size, String startDate, String endDate) {
|
||||||
|
|
||||||
QueryWrapper<PatientRegistration> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<PatientRegistration> queryWrapper = new QueryWrapper<>();
|
||||||
//查询条件
|
//查询条件
|
||||||
queryWrapper.between("create_datetime", DateUtil.getDateTime(startDate), DateUtil.getDateTime(endDate));
|
queryWrapper.between("create_datetime", DateUtil.getDateTime(startDate), DateUtil.getDateTime(endDate));
|
||||||
queryWrapper.eq("del_flag", 0);
|
queryWrapper.eq("del_flag", 0);
|
||||||
return pageHelper(page, size, queryWrapper, patientRegistrationMapper,"create_datetime",false);
|
return pageHelper(page, size, queryWrapper, patientRegistrationMapper, "create_datetime", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PatientRegistration> listAll() {
|
public List<PatientRegistration> listAll() {
|
||||||
QueryWrapper<PatientRegistration> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<PatientRegistration> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.eq("del_flag", 1);
|
queryWrapper.eq("del_flag", 1);
|
||||||
return patientRegistrationMapper.selectList(queryWrapper);
|
return patientRegistrationMapper.selectList(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -256,6 +265,7 @@ public class PatientRegistrationService extends BaseService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据挂号id 查询挂号详细信息
|
* 根据挂号id 查询挂号详细信息
|
||||||
|
*
|
||||||
* @param regisId
|
* @param regisId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -265,8 +275,8 @@ public class PatientRegistrationService extends BaseService {
|
||||||
|
|
||||||
PatientInfo patientInfo = patientInfoMapper.selectById(registration.getPatientInfoId());
|
PatientInfo patientInfo = patientInfoMapper.selectById(registration.getPatientInfoId());
|
||||||
PatientAndRegistrationInfoVo vo = new PatientAndRegistrationInfoVo();
|
PatientAndRegistrationInfoVo vo = new PatientAndRegistrationInfoVo();
|
||||||
if (patientInfo!=null){
|
if (patientInfo != null) {
|
||||||
BeanUtils.copyProperties(patientInfo,vo);
|
BeanUtils.copyProperties(patientInfo, vo);
|
||||||
}
|
}
|
||||||
|
|
||||||
OrganizationMember docker = organizationMemberMapper.selectById(registration.getOrganizationDoctorId());
|
OrganizationMember docker = organizationMemberMapper.selectById(registration.getOrganizationDoctorId());
|
||||||
|
|
@ -275,11 +285,11 @@ public class PatientRegistrationService extends BaseService {
|
||||||
vo.setDoctorSection(section.getName());
|
vo.setDoctorSection(section.getName());
|
||||||
|
|
||||||
QueryWrapper<PatientRegistration> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<PatientRegistration> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.eq("patient_info_id",registration.getPatientInfoId());
|
queryWrapper.eq("patient_info_id", registration.getPatientInfoId());
|
||||||
queryWrapper.eq("status",3);
|
queryWrapper.eq("status", 3);
|
||||||
queryWrapper.orderByDesc("create_datetime");
|
queryWrapper.orderByDesc("create_datetime");
|
||||||
List<PatientRegistration> PatientRegislist = patientRegistrationMapper.selectList(queryWrapper);
|
List<PatientRegistration> PatientRegislist = patientRegistrationMapper.selectList(queryWrapper);
|
||||||
if (!PatientRegislist.isEmpty()){
|
if (!PatientRegislist.isEmpty()) {
|
||||||
vo.setLastVisitTime(PatientRegislist.get(0).getCreateDatetime());
|
vo.setLastVisitTime(PatientRegislist.get(0).getCreateDatetime());
|
||||||
vo.setVisitCount(PatientRegislist.size());
|
vo.setVisitCount(PatientRegislist.size());
|
||||||
}
|
}
|
||||||
|
|
@ -287,7 +297,8 @@ public class PatientRegistrationService extends BaseService {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*改变挂号单状态
|
* 改变挂号单状态
|
||||||
|
*
|
||||||
* @param regisId
|
* @param regisId
|
||||||
* @param status
|
* @param status
|
||||||
* @return
|
* @return
|
||||||
|
|
@ -296,18 +307,18 @@ public class PatientRegistrationService extends BaseService {
|
||||||
RegistrationStatusEnum statusEnum = RegistrationStatusEnum.getByType(status);
|
RegistrationStatusEnum statusEnum = RegistrationStatusEnum.getByType(status);
|
||||||
|
|
||||||
PatientRegistration patientRegistration = patientRegistrationMapper.selectById(regisId);
|
PatientRegistration patientRegistration = patientRegistrationMapper.selectById(regisId);
|
||||||
if (patientRegistration == null){
|
if (patientRegistration == null) {
|
||||||
throw new MessageException("挂号单不存在");
|
throw new MessageException("挂号单不存在");
|
||||||
}
|
}
|
||||||
if (statusEnum==null){
|
if (statusEnum == null) {
|
||||||
throw new MessageException("状态值不对");
|
throw new MessageException("状态值不对");
|
||||||
}
|
}
|
||||||
if (statusEnum.equals(RegistrationStatusEnum.waiting) && !patientRegistration.getStatus().equals(RegistrationStatusEnum.inProgress.getStatus())){
|
if (statusEnum.equals(RegistrationStatusEnum.waiting) && !patientRegistration.getStatus().equals(RegistrationStatusEnum.inProgress.getStatus())) {
|
||||||
throw new MessageException("初始状态不对");
|
throw new MessageException("初始状态不对");
|
||||||
}
|
}
|
||||||
if (statusEnum.equals(RegistrationStatusEnum.cancel)
|
if (statusEnum.equals(RegistrationStatusEnum.cancel)
|
||||||
&& patientRegistration.getStatus().equals(RegistrationStatusEnum.inProgress.getStatus())
|
&& patientRegistration.getStatus().equals(RegistrationStatusEnum.inProgress.getStatus())
|
||||||
&& patientRegistration.getStatus().equals(RegistrationStatusEnum.complete.getStatus())){
|
&& patientRegistration.getStatus().equals(RegistrationStatusEnum.complete.getStatus())) {
|
||||||
throw new MessageException("初始状态不对");
|
throw new MessageException("初始状态不对");
|
||||||
}
|
}
|
||||||
PatientRegistration updateRegistration = new PatientRegistration();
|
PatientRegistration updateRegistration = new PatientRegistration();
|
||||||
|
|
@ -317,4 +328,36 @@ public class PatientRegistrationService extends BaseService {
|
||||||
return patientRegistrationMapper.selectById(regisId);
|
return patientRegistrationMapper.selectById(regisId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消挂号
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
public void cancel(Integer id) {
|
||||||
|
PatientRegistration registration = patientRegistrationMapper.selectById(id);
|
||||||
|
if (registration == null) {
|
||||||
|
throw new MessageException("挂号单不存在");
|
||||||
|
}
|
||||||
|
if (!registration.getStatus().equals(RegistrationStatusEnum.complete.getStatus())) {
|
||||||
|
throw new MessageException("该挂号已诊,不能撤销");
|
||||||
|
}
|
||||||
|
if (registration.getStatus().equals(RegistrationStatusEnum.cancel.getStatus())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!registration.getType().equals(RegistrationTypeEnum.Social.getType())){
|
||||||
|
//医保撤销
|
||||||
|
IM2202 im2202 = new IM2202();
|
||||||
|
im2202.setPsnNo(registration.getPsnNo());
|
||||||
|
im2202.setMdtrtId(registration.getMdtrtId());
|
||||||
|
im2202.setIptOtpNo(String.valueOf(registration.getId()));
|
||||||
|
socialRequest.call2202(im2202);
|
||||||
|
}
|
||||||
|
//本地撤销
|
||||||
|
PatientRegistration updateRegistration = new PatientRegistration();
|
||||||
|
updateRegistration.setId(id);
|
||||||
|
updateRegistration.setStatus(RegistrationStatusEnum.cancel.getStatus());
|
||||||
|
patientRegistrationMapper.updateById(updateRegistration);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,9 +44,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 医保进销存上报
|
* 医保进销存上报
|
||||||
|
|
@ -450,9 +448,9 @@ public class SocialInventoryUploadService extends BaseService {
|
||||||
SocialDirectory socialDirectory = socialDirectoryMapper.getByCode(goods.getHilistCode());
|
SocialDirectory socialDirectory = socialDirectoryMapper.getByCode(goods.getHilistCode());
|
||||||
JSONObject jsonObject = JSONObject.parseObject(socialDirectory.getData());
|
JSONObject jsonObject = JSONObject.parseObject(socialDirectory.getData());
|
||||||
String jsonRxFlag = (String) jsonObject.get("rx_flag");
|
String jsonRxFlag = (String) jsonObject.get("rx_flag");
|
||||||
String rxFlag = jsonRxFlag == null||jsonRxFlag.isEmpty() ? "0" : jsonRxFlag;
|
String rxFlag = jsonRxFlag == null || jsonRxFlag.isEmpty() ? "0" : jsonRxFlag;
|
||||||
|
|
||||||
if (orderInventory.getType().equals(RetailInventoryTypeEnum.Sale.getType())){
|
if (orderInventory.getType().equals(RetailInventoryTypeEnum.Sale.getType())) {
|
||||||
//销售 走3505
|
//销售 走3505
|
||||||
IM3505 im3505 = new IM3505();
|
IM3505 im3505 = new IM3505();
|
||||||
im3505.setMedListCodg(goods.getHilistCode());
|
im3505.setMedListCodg(goods.getHilistCode());
|
||||||
|
|
@ -463,7 +461,7 @@ public class SocialInventoryUploadService extends BaseService {
|
||||||
im3505.setPharName(docker.getName());
|
im3505.setPharName(docker.getName());
|
||||||
im3505.setPharPracCertNo(docker.getIdCardNumber());
|
im3505.setPharPracCertNo(docker.getIdCardNumber());
|
||||||
|
|
||||||
if (chargeOrder.getPayType().equals(RetailOrderPayTypeEnum.MEDICARE.getCode())){
|
if (chargeOrder.getPayType().equals(RetailOrderPayTypeEnum.MEDICARE.getCode())) {
|
||||||
//医保支付
|
//医保支付
|
||||||
ChargeSocialPayLog payLog = chargeSocialPayLogMapper.selectOne(new QueryWrapper<ChargeSocialPayLog>().
|
ChargeSocialPayLog payLog = chargeSocialPayLogMapper.selectOne(new QueryWrapper<ChargeSocialPayLog>().
|
||||||
eq("retail_order_code", orderInventory.getChargeOrderCode()).last("limit 1"));
|
eq("retail_order_code", orderInventory.getChargeOrderCode()).last("limit 1"));
|
||||||
|
|
@ -474,7 +472,7 @@ public class SocialInventoryUploadService extends BaseService {
|
||||||
im3505.setCertno(payLog.getCertno());
|
im3505.setCertno(payLog.getCertno());
|
||||||
im3505.setMdtrtSetlType("1");
|
im3505.setMdtrtSetlType("1");
|
||||||
|
|
||||||
}else {
|
} else {
|
||||||
im3505.setMdtrtSn(orderInventory.getFeedetlSn());
|
im3505.setMdtrtSn(orderInventory.getFeedetlSn());
|
||||||
im3505.setMdtrtSetlType("2");
|
im3505.setMdtrtSetlType("2");
|
||||||
}
|
}
|
||||||
|
|
@ -482,17 +480,27 @@ public class SocialInventoryUploadService extends BaseService {
|
||||||
im3505.setManuDate(inventory.getProductionDate());
|
im3505.setManuDate(inventory.getProductionDate());
|
||||||
im3505.setExpyEnd(inventory.getExpiryDate());
|
im3505.setExpyEnd(inventory.getExpiryDate());
|
||||||
im3505.setRxFlag(rxFlag);
|
im3505.setRxFlag(rxFlag);
|
||||||
im3505.setTrdnFlag(orderInventory.getTrdnFlag()?"0":"1");
|
im3505.setTrdnFlag(orderInventory.getTrdnFlag() ? "0" : "1");
|
||||||
im3505.setRtalDocno(orderInventory.getChargeOrderCode());
|
im3505.setRtalDocno(orderInventory.getChargeOrderCode());
|
||||||
im3505.setSelRetnTime(LocalDate.from(orderInventory.getCreateTime()));
|
im3505.setSelRetnTime(LocalDate.from(orderInventory.getCreateTime()));
|
||||||
im3505.setSelRetnCnt(BigDecimal.valueOf(orderInventory.getNumber()));
|
im3505.setSelRetnCnt(BigDecimal.valueOf(orderInventory.getNumber()));
|
||||||
im3505.setSelRetnOpterName(docker.getName());
|
im3505.setSelRetnOpterName(docker.getName());
|
||||||
List<Map<String,String>> drugtracinfo = new ArrayList<>();
|
|
||||||
|
|
||||||
|
List<Map<String, String>> drugtracinfo = new ArrayList<>();
|
||||||
|
List<String> TracCodgList = orderInventory.getTraceabilityCode() == null ? new ArrayList<>()
|
||||||
|
: Arrays.asList(orderInventory.getTraceabilityCode().split(","));
|
||||||
|
for (String tracCodg : TracCodgList) {
|
||||||
|
Map<String, String> map =new HashMap<>();
|
||||||
|
map.put("drug_trac_codg",tracCodg);
|
||||||
|
drugtracinfo.add(map);
|
||||||
|
}
|
||||||
|
|
||||||
im3505.setDrugtracinfo(drugtracinfo);
|
im3505.setDrugtracinfo(drugtracinfo);
|
||||||
socialRequest.call3505(im3505);
|
socialRequest.call3505(im3505);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (orderInventory.getType().equals(RetailInventoryTypeEnum.Refund.getType())){
|
if (orderInventory.getType().equals(RetailInventoryTypeEnum.Refund.getType())) {
|
||||||
//退款 走3506
|
//退款 走3506
|
||||||
IM3506 im3506 = new IM3506();
|
IM3506 im3506 = new IM3506();
|
||||||
im3506.setMedListCodg(goods.getHilistCode());
|
im3506.setMedListCodg(goods.getHilistCode());
|
||||||
|
|
@ -501,7 +509,7 @@ public class SocialInventoryUploadService extends BaseService {
|
||||||
im3506.setFixmedinsBchno(String.valueOf(orderInventory.getInventoryId()));
|
im3506.setFixmedinsBchno(String.valueOf(orderInventory.getInventoryId()));
|
||||||
im3506.setSelRetnOpterName(docker.getName());
|
im3506.setSelRetnOpterName(docker.getName());
|
||||||
|
|
||||||
if (chargeOrder.getPayType().equals(RetailOrderPayTypeEnum.MEDICARE.getCode())){
|
if (chargeOrder.getPayType().equals(RetailOrderPayTypeEnum.MEDICARE.getCode())) {
|
||||||
//医保支付
|
//医保支付
|
||||||
ChargeSocialPayLog payLog = chargeSocialPayLogMapper.selectOne(new QueryWrapper<ChargeSocialPayLog>().
|
ChargeSocialPayLog payLog = chargeSocialPayLogMapper.selectOne(new QueryWrapper<ChargeSocialPayLog>().
|
||||||
eq("retail_order_code", orderInventory.getChargeOrderCode()).last("limit 1"));
|
eq("retail_order_code", orderInventory.getChargeOrderCode()).last("limit 1"));
|
||||||
|
|
@ -511,19 +519,19 @@ public class SocialInventoryUploadService extends BaseService {
|
||||||
im3506.setPsnName(payLog.getName());
|
im3506.setPsnName(payLog.getName());
|
||||||
im3506.setCertno(payLog.getCertno());
|
im3506.setCertno(payLog.getCertno());
|
||||||
|
|
||||||
}else {
|
} else {
|
||||||
im3506.setMdtrtSn(orderInventory.getFeedetlSn());
|
im3506.setMdtrtSn(orderInventory.getFeedetlSn());
|
||||||
}
|
}
|
||||||
im3506.setManuLotnum(inventory.getProductionBatchCode());
|
im3506.setManuLotnum(inventory.getProductionBatchCode());
|
||||||
im3506.setManuDate(inventory.getProductionDate());
|
im3506.setManuDate(inventory.getProductionDate());
|
||||||
im3506.setExpyEnd(inventory.getExpiryDate());
|
im3506.setExpyEnd(inventory.getExpiryDate());
|
||||||
im3506.setRxFlag(rxFlag);
|
im3506.setRxFlag(rxFlag);
|
||||||
im3506.setTrdnFlag(orderInventory.getTrdnFlag()?"0":"1");
|
im3506.setTrdnFlag(orderInventory.getTrdnFlag() ? "0" : "1");
|
||||||
|
|
||||||
im3506.setSelRetnCnt(BigDecimal.valueOf(orderInventory.getNumber()));
|
im3506.setSelRetnCnt(BigDecimal.valueOf(orderInventory.getNumber()));
|
||||||
im3506.setSelRetnOpterName(docker.getName());
|
im3506.setSelRetnOpterName(docker.getName());
|
||||||
im3506.setSelRetnTime(LocalDateTime.now());
|
im3506.setSelRetnTime(LocalDateTime.now());
|
||||||
List<Map<String,String>> drugtracinfo = new ArrayList<>();
|
List<Map<String, String>> drugtracinfo = new ArrayList<>();
|
||||||
im3506.setDrugtracinfo(drugtracinfo);
|
im3506.setDrugtracinfo(drugtracinfo);
|
||||||
socialRequest.call3506(im3506);
|
socialRequest.call3506(im3506);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue