门诊挂号

This commit is contained in:
Wang.Huan
2025-03-07 11:18:07 +08:00
parent 278994c46a
commit 5982969401
19 changed files with 242 additions and 26 deletions

View File

@@ -17,14 +17,9 @@ import com.core.common.core.domain.R;
import com.core.common.utils.AgeCalculatorUtil; import com.core.common.utils.AgeCalculatorUtil;
import com.core.common.utils.MessageUtils; import com.core.common.utils.MessageUtils;
import com.core.common.utils.bean.BeanUtils; import com.core.common.utils.bean.BeanUtils;
import com.openhis.administration.domain.Encounter; import com.openhis.administration.domain.*;
import com.openhis.administration.domain.EncounterLocation;
import com.openhis.administration.domain.EncounterParticipant;
import com.openhis.administration.domain.Patient;
import com.openhis.administration.mapper.PatientMapper; import com.openhis.administration.mapper.PatientMapper;
import com.openhis.administration.service.IEncounterLocationService; import com.openhis.administration.service.*;
import com.openhis.administration.service.IEncounterParticipantService;
import com.openhis.administration.service.IEncounterService;
import com.openhis.clinical.domain.ConditionDefinition; import com.openhis.clinical.domain.ConditionDefinition;
import com.openhis.clinical.mapper.ConditionDefinitionMapper; import com.openhis.clinical.mapper.ConditionDefinitionMapper;
import com.openhis.common.constant.CommonConstants; import com.openhis.common.constant.CommonConstants;
@@ -74,6 +69,12 @@ public class IOutpatientRegistrationAppServiceImpl implements IOutpatientRegistr
@Resource @Resource
IEncounterParticipantService iEncounterParticipantService; IEncounterParticipantService iEncounterParticipantService;
@Resource
IAccountService iAccountService;
@Resource
IChargeItemService iChargeItemService;
/** /**
* 门诊挂号 - 查询患者信息 * 门诊挂号 - 查询患者信息
* *
@@ -217,6 +218,10 @@ public class IOutpatientRegistrationAppServiceImpl implements IOutpatientRegistr
// 就诊参数者管理-表单数据 // 就诊参数者管理-表单数据
EncounterParticipantFormData encounterParticipantFormData = EncounterParticipantFormData encounterParticipantFormData =
outpatientRegistrationAddParam.getEncounterParticipantFormData(); outpatientRegistrationAddParam.getEncounterParticipantFormData();
// 就诊账户管理-表单数据
AccountFormData accountFormData = outpatientRegistrationAddParam.getAccountFormData();
// 费用项管理-表单数据
ChargeItemFormData chargeItemFormData = outpatientRegistrationAddParam.getChargeItemFormData();
// 患者ID // 患者ID
Long patientId = encounterFormData.getPatientId(); Long patientId = encounterFormData.getPatientId();
@@ -227,22 +232,33 @@ public class IOutpatientRegistrationAppServiceImpl implements IOutpatientRegistr
if (num > 0) { if (num > 0) {
return R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00008, null)); return R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00008, null));
} }
// 保存就诊信息 // 保存就诊信息
Encounter encounter = new Encounter(); Encounter encounter = new Encounter();
BeanUtils.copyProperties(encounterFormData, encounter); BeanUtils.copyProperties(encounterFormData, encounter);
// 就诊ID // 就诊ID
Long encounterId = iEncounterService.saveEncounter(encounter); Long encounterId = iEncounterService.saveEncounterByRegister(encounter);
// 保存就诊位置信息 // 保存就诊位置信息
encounterLocationFormData.setEncounterId(encounterId); encounterLocationFormData.setEncounterId(encounterId);
EncounterLocation encounterLocation = new EncounterLocation(); EncounterLocation encounterLocation = new EncounterLocation();
BeanUtils.copyProperties(encounterLocationFormData, encounterLocation); BeanUtils.copyProperties(encounterLocationFormData, encounterLocation);
iEncounterLocationService.saveEncounterLocation(encounterLocation); iEncounterLocationService.saveEncounterLocationByRegister(encounterLocation);
// 保存就诊参数者信息 // 保存就诊参数者信息
encounterParticipantFormData.setEncounterId(encounterId); encounterParticipantFormData.setEncounterId(encounterId);
EncounterParticipant encounterParticipant = new EncounterParticipant(); EncounterParticipant encounterParticipant = new EncounterParticipant();
BeanUtils.copyProperties(encounterParticipantFormData, encounterParticipant); BeanUtils.copyProperties(encounterParticipantFormData, encounterParticipant);
iEncounterParticipantService.saveEncounterParticipant(encounterParticipant); iEncounterParticipantService.saveEncounterParticipantByRegister(encounterParticipant);
// 保存就诊账户信息
accountFormData.setEncounterId(encounterId);
Account account = new Account();
BeanUtils.copyProperties(accountFormData, account);
// 账户ID
Long accountId = iAccountService.saveAccountByRegister(account);
// 保存就诊费用项
chargeItemFormData.setEncounterId(encounterId);
chargeItemFormData.setAccountId(accountId);
ChargeItem chargeItem = new ChargeItem();
BeanUtils.copyProperties(chargeItemFormData, chargeItem);
iChargeItemService.saveChargeItemByRegister(chargeItem);
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"挂号"})); return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"挂号"}));
} }

View File

@@ -0,0 +1,62 @@
package com.openhis.web.outpatientservice.dto;
import java.math.BigDecimal;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.openhis.common.enums.AccountBillingStatus;
import com.openhis.common.enums.AccountStatus;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 就诊账号 表单数据
*/
@Data
@Accessors(chain = true)
public class AccountFormData {
/**
* 就诊ID
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long encounterId;
/** 患者id */
@JsonSerialize(using = ToStringSerializer.class)
private Long patientId;
/** 状态枚举 */
private Integer statusEnum;
/** 结账状态枚举 */
private Integer billingStatusEnum;
/** 账户类型编码 */
private String typeCode; // 1:个人现金账户, 2:医保账户
/** 名称 */
private String name; // 刷医保卡时应该会带出该信息
/** 账户余额 */
private BigDecimal balanceAmount; // 刷医保卡时应该会带出该信息
/** 医保区域编码 */
private String ybAreaNo; // 刷医保卡时应该会带出该信息
/** 合同编码 */
private String contractNo; // 从选择的费用性质里选择合同编码
/** 欠费限制额度 */
private BigDecimal limitAccount; // 刷医保卡时应该会带出该信息
/**
* 设置默认值
*/
public AccountFormData() {
this.statusEnum = AccountStatus.ACTIVE.getValue();
this.billingStatusEnum = AccountBillingStatus.OPEN.getValue();
}
}

View File

@@ -0,0 +1,87 @@
package com.openhis.web.outpatientservice.dto;
import java.math.BigDecimal;
import java.util.Date;
import com.core.common.utils.SecurityUtils;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.openhis.common.constant.CommonConstants;
import com.openhis.common.enums.ChargeItemStatus;
import com.openhis.common.enums.EncounterClass;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 费用项管理 表单数据
*/
@Data
@Accessors(chain = true)
public class ChargeItemFormData {
/**
* 就诊ID
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long encounterId;
/** 患者id */
@JsonSerialize(using = ToStringSerializer.class)
private Long patientId;
/** 层级 */
private String busNo;
/** 状态 */
private Integer statusEnum;
/** 类别 */
private Integer contextEnum;
/** 发生时间 */
private Date occurrenceTime;
/** 执行人Id */
@JsonSerialize(using = ToStringSerializer.class)
private Long performerId;
/** 费用定价ID */
@JsonSerialize(using = ToStringSerializer.class)
private Long definitionId;
/** 开立人ID */
@JsonSerialize(using = ToStringSerializer.class)
private Long entererId;
/** 开立时间 */
private Date enteredDate;
/** 医疗服务类型 */
private String serviceTable;
/** 医疗服务ID */
@JsonSerialize(using = ToStringSerializer.class)
private Long serviceId;
/** 总价 */
private BigDecimal totalPrice;
/** 关联账户ID */
@JsonSerialize(using = ToStringSerializer.class)
private Long accountId;
/**
* 设置默认值
*/
public ChargeItemFormData() {
this.statusEnum = ChargeItemStatus.BILLED.getValue();
this.contextEnum = EncounterClass.AMB.getValue();
this.occurrenceTime = new Date();
this.performerId = SecurityUtils.getLoginUser().getUserId();
this.entererId = SecurityUtils.getLoginUser().getUserId();
this.enteredDate = new Date();
this.serviceTable = CommonConstants.TableName.ADM_HEALTHCARE_SERVICE;
}
}

View File

@@ -33,9 +33,10 @@ public class OutpatientRegistrationAddParam {
/** /**
* 就诊账户管理-表单数据 * 就诊账户管理-表单数据
*/ */
private AccountFormData accountFormData;
/** /**
* 费用项管理-表单数据 * 费用项管理-表单数据
*/ */
private ChargeItemFormData chargeItemFormData;
} }

View File

@@ -6,7 +6,7 @@ import lombok.Getter;
@Getter @Getter
@AllArgsConstructor @AllArgsConstructor
public enum AccountBillingStatus { public enum AccountBillingStatus implements HisEnumInterface {
OPEN (1, "open", "可用"), OPEN (1, "open", "可用"),

View File

@@ -6,7 +6,7 @@ import lombok.Getter;
@Getter @Getter
@AllArgsConstructor @AllArgsConstructor
public enum ChargeItemStatus { public enum ChargeItemStatus implements HisEnumInterface {
PLANNED (1, "planned", "待收费"), PLANNED (1, "planned", "待收费"),
BILLABLE(2, "billable", "待结算"), BILLABLE(2, "billable", "待结算"),

View File

@@ -6,7 +6,7 @@ import lombok.Getter;
@Getter @Getter
@AllArgsConstructor @AllArgsConstructor
public enum EncounterType { public enum EncounterType implements HisEnumInterface {
INITIAL(1, "initial", "初诊"), INITIAL(1, "initial", "初诊"),
FOLLOW_UP(2, "follow-up", "复诊"); FOLLOW_UP(2, "follow-up", "复诊");

View File

@@ -30,7 +30,7 @@ public class ChargeItem extends HisBaseEntity {
private Long id; private Long id;
/** 状态 */ /** 状态 */
private ChargeItemStatus statusEnum; private Integer statusEnum;
/** 层级 */ /** 层级 */
private String busNo; private String busNo;

View File

@@ -105,4 +105,9 @@ public class Encounter extends HisBaseEntity {
*/ */
private Integer displayOrder; private Integer displayOrder;
/**
* 初复诊
*/
private Integer firstEnum;
} }

View File

@@ -11,4 +11,11 @@ import com.openhis.administration.domain.Account;
*/ */
public interface IAccountService extends IService<Account> { public interface IAccountService extends IService<Account> {
/**
* 门诊挂号时保存账号信息
*
* @param account 账号信息
*/
Long saveAccountByRegister(Account account);
} }

View File

@@ -25,4 +25,11 @@ public interface IChargeItemService extends IService<ChargeItem> {
* @return 更新结果 * @return 更新结果
*/ */
boolean updateChargeItem(ChargeItem chargeItem); boolean updateChargeItem(ChargeItem chargeItem);
/**
* 门诊挂号时保存 费用项
*
* @param chargeItem 费用项
*/
void saveChargeItemByRegister(ChargeItem chargeItem);
} }

View File

@@ -12,10 +12,10 @@ import com.openhis.administration.domain.EncounterLocation;
public interface IEncounterLocationService extends IService<EncounterLocation> { public interface IEncounterLocationService extends IService<EncounterLocation> {
/** /**
* 保存就诊位置信息 * 门诊挂号时保存就诊位置信息
* *
* @param encounterLocation 就诊位置信息 * @param encounterLocation 就诊位置信息
*/ */
void saveEncounterLocation(EncounterLocation encounterLocation); void saveEncounterLocationByRegister(EncounterLocation encounterLocation);
} }

View File

@@ -12,10 +12,10 @@ import com.openhis.administration.domain.EncounterParticipant;
public interface IEncounterParticipantService extends IService<EncounterParticipant> { public interface IEncounterParticipantService extends IService<EncounterParticipant> {
/** /**
* 保存就诊参与者 * 门诊挂号时保存就诊参与者
* *
* @param encounterParticipant 就诊参与者信息 * @param encounterParticipant 就诊参与者信息
*/ */
void saveEncounterParticipant(EncounterParticipant encounterParticipant); void saveEncounterParticipantByRegister(EncounterParticipant encounterParticipant);
} }

View File

@@ -16,6 +16,6 @@ public interface IEncounterService extends IService<Encounter> {
* @param encounter 就诊信息 * @param encounter 就诊信息
* @return 保存后的信息 * @return 保存后的信息
*/ */
Long saveEncounter(Encounter encounter); Long saveEncounterByRegister(Encounter encounter);
} }

View File

@@ -16,4 +16,15 @@ import com.openhis.administration.service.IAccountService;
@Service @Service
public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> implements IAccountService { public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> implements IAccountService {
/**
* 门诊挂号时保存账号信息
*
* @param account 账号信息
*/
@Override
public Long saveAccountByRegister(Account account) {
baseMapper.insert(account);
return account.getId();
}
} }

View File

@@ -55,4 +55,14 @@ public class ChargeItemServiceImpl extends ServiceImpl<ChargeItemMapper, ChargeI
return false; return false;
} }
} }
/**
* 门诊挂号时保存 费用项
*
* @param chargeItem 费用项
*/
@Override
public void saveChargeItemByRegister(ChargeItem chargeItem) {
baseMapper.insert(chargeItem);
}
} }

View File

@@ -18,12 +18,12 @@ public class EncounterLocationServiceImpl extends ServiceImpl<EncounterLocationM
implements IEncounterLocationService { implements IEncounterLocationService {
/** /**
* 保存就诊位置信息 * 门诊挂号时保存就诊位置信息
* *
* @param encounterLocation 就诊位置信息 * @param encounterLocation 就诊位置信息
*/ */
@Override @Override
public void saveEncounterLocation(EncounterLocation encounterLocation) { public void saveEncounterLocationByRegister(EncounterLocation encounterLocation) {
baseMapper.insert(encounterLocation); baseMapper.insert(encounterLocation);
} }

View File

@@ -18,12 +18,12 @@ public class EncounterParticipantServiceImpl extends ServiceImpl<EncounterPartic
implements IEncounterParticipantService { implements IEncounterParticipantService {
/** /**
* 保存就诊参与者 * 门诊挂号时保存就诊参与者
* *
* @param encounterParticipant 就诊参与者信息 * @param encounterParticipant 就诊参与者信息
*/ */
@Override @Override
public void saveEncounterParticipant(EncounterParticipant encounterParticipant) { public void saveEncounterParticipantByRegister(EncounterParticipant encounterParticipant) {
baseMapper.insert(encounterParticipant); baseMapper.insert(encounterParticipant);
} }

View File

@@ -2,10 +2,12 @@ package com.openhis.administration.service.impl;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.openhis.administration.domain.Encounter; import com.openhis.administration.domain.Encounter;
import com.openhis.administration.mapper.EncounterMapper; import com.openhis.administration.mapper.EncounterMapper;
import com.openhis.administration.service.IEncounterService; import com.openhis.administration.service.IEncounterService;
import com.openhis.common.enums.EncounterType;
/** /**
* 就诊管理Service业务层处理 * 就诊管理Service业务层处理
@@ -23,10 +25,18 @@ public class EncounterServiceImpl extends ServiceImpl<EncounterMapper, Encounter
* @return 保存后的信息 * @return 保存后的信息
*/ */
@Override @Override
public Long saveEncounter(Encounter encounter) { public Long saveEncounterByRegister(Encounter encounter) {
// 生产就诊编码 // 生产就诊编码
// 生产就诊序号 // 生产就诊序号
// 患者ID
Long patientId = encounter.getPatientId();
// 初复诊
Long count = baseMapper.selectCount(new LambdaQueryWrapper<Encounter>().eq(Encounter::getPatientId, patientId));
if (count > 0L) {
encounter.setFirstEnum(EncounterType.FOLLOW_UP.getValue());
}
baseMapper.insert(encounter); baseMapper.insert(encounter);
return encounter.getId(); return encounter.getId();
} }