Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
d0cb4d6a62
|
|
@ -0,0 +1,13 @@
|
|||
package com.syjiaer.clinic.server.common.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum ChargeSourceEnum {
|
||||
CHARGE(0,"门诊收费");
|
||||
private final Integer type;
|
||||
private final String desc;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package com.syjiaer.clinic.server.common.enums;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum ChargeTypeEnum {
|
||||
CHARGE(1,"收费"),
|
||||
REFUND(0,"退费");
|
||||
private final Integer chargeType;
|
||||
private final String desc;
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -6,16 +6,16 @@ public enum RegistrationStatusEnum {
|
|||
complete(3,"已诊"),
|
||||
cancel(0,"取消");
|
||||
|
||||
private final Integer type;
|
||||
private final Integer status;
|
||||
private final String desc;
|
||||
|
||||
RegistrationStatusEnum(final Integer type, final String desc) {
|
||||
this.type = type;
|
||||
RegistrationStatusEnum(final Integer status, final String desc) {
|
||||
this.status = status;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public Integer getType() {
|
||||
return type;
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
|
|
@ -24,7 +24,7 @@ public enum RegistrationStatusEnum {
|
|||
|
||||
public static RegistrationStatusEnum getByType(Integer type) {
|
||||
for (RegistrationStatusEnum goodsTypeEnum : RegistrationStatusEnum.values()) {
|
||||
if (goodsTypeEnum.getType().equals(type)) {
|
||||
if (goodsTypeEnum.getStatus().equals(type)) {
|
||||
return goodsTypeEnum;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,10 @@ package com.syjiaer.clinic.server.controller.charge;
|
|||
import com.syjiaer.clinic.server.common.api.output.OM2206A;
|
||||
import com.syjiaer.clinic.server.common.api.output.OM2207A;
|
||||
import com.syjiaer.clinic.server.common.util.DateUtil;
|
||||
import com.syjiaer.clinic.server.common.vo.Page;
|
||||
import com.syjiaer.clinic.server.common.vo.Result;
|
||||
import com.syjiaer.clinic.server.controller.BaseController;
|
||||
import com.syjiaer.clinic.server.entity.charge.ChargeLog;
|
||||
import com.syjiaer.clinic.server.entity.charge.ChargeOrder;
|
||||
import com.syjiaer.clinic.server.entity.charge.dto.ChargeQuery;
|
||||
import com.syjiaer.clinic.server.entity.charge.dto.ChargeSaveDto;
|
||||
|
|
@ -15,6 +17,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
|
|
@ -79,7 +82,7 @@ public class ChargeController extends BaseController {
|
|||
* 每日收费报表
|
||||
*/
|
||||
@RequestMapping("/dailyChargingReport")
|
||||
public Result<Map<String, RetailOrderDailyChargingReportVo>> dailyChargingReport() {
|
||||
public Result<List<RetailOrderDailyChargingReportVo>> dailyChargingReport() {
|
||||
String startDateStr = parmsUtil.getString("startDate", "请选择开始时间");
|
||||
String endDateStr = parmsUtil.getString("endDate", "请选择结束时间");
|
||||
LocalDateTime startDateTime = DateUtil.getDateTime(startDateStr);
|
||||
|
|
@ -89,4 +92,21 @@ public class ChargeController extends BaseController {
|
|||
return success(chargeService.dailyChargingReport(startDateTime, endDateTime));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@RequestMapping("/getListByPatientId")
|
||||
public Result<List<ChargeOrder>> getListByPatientId() {
|
||||
Integer patientId = parmsUtil.getInteger("patientId");
|
||||
return success(chargeService.getListByPatientId(patientId));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@RequestMapping("/getChargeRecord")
|
||||
public Result<Page<ChargeLog>> getChargeRecord() {
|
||||
return success(chargeService.getChargeRecordPageList());
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,9 @@ import com.syjiaer.clinic.server.common.vo.Result;
|
|||
import com.syjiaer.clinic.server.controller.BaseController;
|
||||
import com.syjiaer.clinic.server.entity.diagnosis.dto.ChargeQueueQuery;
|
||||
import com.syjiaer.clinic.server.entity.diagnosis.dto.MedicalRecordSaveDto;
|
||||
import com.syjiaer.clinic.server.entity.diagnosis.vo.ChargeQueueVo;
|
||||
import com.syjiaer.clinic.server.entity.diagnosis.vo.MedicalRecordVo;
|
||||
import com.syjiaer.clinic.server.entity.patient.vo.SeeDoctorInfoVo;
|
||||
import com.syjiaer.clinic.server.service.diagnosis.MedicalRecordService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
|
@ -54,9 +56,26 @@ public class MedicalRecordController extends BaseController {
|
|||
* 获取收费队列
|
||||
*/
|
||||
@RequestMapping("/getChargeQueue")
|
||||
public Result<Page<MedicalRecordVo>> getChargeQueue() {
|
||||
public Result<Page<ChargeQueueVo>> getChargeQueue() {
|
||||
ChargeQueueQuery query = parmsUtil.getObject("query", ChargeQueueQuery.class);
|
||||
|
||||
return success( medicalRecordService.getChargeQueue(query));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取就诊信息
|
||||
*/
|
||||
@RequestMapping("/getSeeDockerInfo")
|
||||
public Result<SeeDoctorInfoVo> getSeeDockerInfo() {
|
||||
Integer regisId = parmsUtil.getInteger("regisId", "挂单id不能为空");
|
||||
return success( medicalRecordService.getSeeDockerInfo(regisId));
|
||||
}
|
||||
|
||||
@RequestMapping("/getByDiagnosisCode")
|
||||
public Result<MedicalRecordVo> getByDiagnosisCode() {
|
||||
String diagnosisCode = parmsUtil.getString("diagnosisCode", "诊断code不能为空");
|
||||
return success( medicalRecordService.getByDiagnosisCode(diagnosisCode));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,11 @@ 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.controller.BaseController;
|
||||
import com.syjiaer.clinic.server.entity.charge.dto.ChargeQuery;
|
||||
import com.syjiaer.clinic.server.entity.organization.OrganizationMember;
|
||||
import com.syjiaer.clinic.server.entity.organization.dto.DockerSearchQuery;
|
||||
import com.syjiaer.clinic.server.entity.organization.dto.OrganizationMemberSaveDto;
|
||||
import com.syjiaer.clinic.server.entity.organization.vo.MemberVo;
|
||||
import com.syjiaer.clinic.server.service.organization.OrganizationMemberService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
|
@ -56,8 +59,9 @@ public class OrganizationMemberController extends BaseController {
|
|||
return success(organizationMemberService.get(id));
|
||||
}
|
||||
|
||||
@RequestMapping("/allDoctorList")
|
||||
public Result<List<OrganizationMember>> allDoctorList() {
|
||||
return success(organizationMemberService.doctorList());
|
||||
@RequestMapping("/search")
|
||||
public Result<List<MemberVo>> allDoctorList() {
|
||||
DockerSearchQuery dockerSearchQuery = parmsUtil.getObject("query", DockerSearchQuery.class);
|
||||
return success(organizationMemberService.doctorList(dockerSearchQuery));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,86 @@
|
|||
package com.syjiaer.clinic.server.controller.patient;
|
||||
|
||||
import com.syjiaer.clinic.server.common.vo.Page;
|
||||
import com.syjiaer.clinic.server.common.vo.Result;
|
||||
import com.syjiaer.clinic.server.controller.BaseController;
|
||||
import com.syjiaer.clinic.server.entity.patient.PatientInfo;
|
||||
import com.syjiaer.clinic.server.entity.vip.Vip;
|
||||
import com.syjiaer.clinic.server.service.patient.PatientInfoService;
|
||||
import com.syjiaer.clinic.server.service.vip.VipLevelConfigService;
|
||||
import com.syjiaer.clinic.server.service.vip.VipService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 商品 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author NiuZiYuan
|
||||
* @since 2025-02-21
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/vip/vip")
|
||||
public class PatientController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private PatientInfoService patientInfoService;
|
||||
|
||||
@RequestMapping("/create")
|
||||
public Result<Object> create() {
|
||||
PatientInfo patientInfo = parmsUtil.getObject("vipInfo", PatientInfo.class);
|
||||
patientInfoService.create(patientInfo);
|
||||
|
||||
return success();
|
||||
}
|
||||
|
||||
@RequestMapping("/update")
|
||||
public Result<Object> update() {
|
||||
PatientInfo patientInfo = parmsUtil.getObject("vipInfo", PatientInfo.class);
|
||||
patientInfoService.update(patientInfo);
|
||||
return success();
|
||||
}
|
||||
|
||||
@RequestMapping("/delete")
|
||||
public Result<Integer> delete() {
|
||||
int patientId = parmsUtil.getInteger("id", "ID不能为空");
|
||||
return success(patientInfoService.removeById(patientId));
|
||||
}
|
||||
|
||||
@RequestMapping("/list")
|
||||
public Result<Page<PatientInfo>> selectList() {
|
||||
String keyword = parmsUtil.getString("keyword");
|
||||
int page = parmsUtil.getInteger("page", "请输入页码");
|
||||
int pageSize = parmsUtil.getInteger("pageSize", "请输入每页条数");
|
||||
Page<PatientInfo> list = patientInfoService.pageList(keyword, page, pageSize);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
@RequestMapping("/get")
|
||||
public Result<PatientInfo> get() {
|
||||
int id = parmsUtil.getInteger("id", "ID不能为空");
|
||||
PatientInfo patientInfo = patientInfoService.getById(id);
|
||||
return success(patientInfo);
|
||||
}
|
||||
|
||||
@RequestMapping("/search")
|
||||
public Result<List<PatientInfo>> search() {
|
||||
String keyword = parmsUtil.getString("keyword", "关键字不能为空");
|
||||
List<PatientInfo> list = patientInfoService.search(keyword);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
@RequestMapping("/changeLevel")
|
||||
public Result<Object> changeLevel() {
|
||||
int vipId = parmsUtil.getInteger("vipId", "会员ID不能为空");
|
||||
int levelId = parmsUtil.getInteger("levelId", "等级id不能为空");
|
||||
patientInfoService.changeLevel(vipId, levelId);
|
||||
|
||||
return success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -6,7 +6,9 @@ import com.syjiaer.clinic.server.common.vo.Result;
|
|||
import com.syjiaer.clinic.server.controller.BaseController;
|
||||
import com.syjiaer.clinic.server.entity.patient.PatientRegistration;
|
||||
import com.syjiaer.clinic.server.entity.patient.dto.RegistrationQuery;
|
||||
import com.syjiaer.clinic.server.entity.patient.dto.RegistrationSaveDto;
|
||||
import com.syjiaer.clinic.server.entity.patient.vo.PatientAndRegistrationInfoVo;
|
||||
import com.syjiaer.clinic.server.entity.patient.vo.PatientRegistrationVo;
|
||||
import com.syjiaer.clinic.server.service.patient.PatientInfoService;
|
||||
import com.syjiaer.clinic.server.service.patient.PatientRegistrationService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -30,7 +32,7 @@ public class RegistrationController extends BaseController {
|
|||
@RequestMapping("/add")
|
||||
public Result<?> registration() {
|
||||
|
||||
PatientRegistration registrationParam = parmsUtil.getObjectWithCheck("data", PatientRegistration.class);
|
||||
RegistrationSaveDto registrationParam = parmsUtil.getObjectWithCheck("data", RegistrationSaveDto.class);
|
||||
String mdtrtCertNo = parmsUtil.getString("mdtrtCertNo");
|
||||
String mdtrtCertType = parmsUtil.getString("mdtrtCertType");
|
||||
patientRegistrationService.registration(registrationParam,mdtrtCertType,mdtrtCertNo);
|
||||
|
|
@ -84,12 +86,12 @@ public class RegistrationController extends BaseController {
|
|||
* @return
|
||||
*/
|
||||
@RequestMapping("/getById")
|
||||
public Result<PatientRegistration> getById() {
|
||||
public Result<PatientRegistrationVo> getById() {
|
||||
Integer id = parmsUtil.getInteger("id");
|
||||
if (id == null) {
|
||||
throw new MessageException("id参数为空");
|
||||
}
|
||||
PatientRegistration result = patientRegistrationService.getById(id);
|
||||
PatientRegistrationVo result = patientRegistrationService.getById(id);
|
||||
return success(result);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ import com.syjiaer.clinic.server.controller.BaseController;
|
|||
import com.syjiaer.clinic.server.entity.goods.Goods;
|
||||
import com.syjiaer.clinic.server.entity.statistics.PersonPayOverviewVo;
|
||||
import com.syjiaer.clinic.server.entity.statistics.RevenueOverviewVo;
|
||||
import com.syjiaer.clinic.server.entity.statistics.SalePersonReportVo;
|
||||
import com.syjiaer.clinic.server.entity.statistics.TipCountVo;
|
||||
import com.syjiaer.clinic.server.service.goods.GoodsService;
|
||||
import com.syjiaer.clinic.server.service.inventory.InventoryService;
|
||||
import com.syjiaer.clinic.server.service.statistics.StatisticsService;
|
||||
|
|
@ -14,11 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -49,6 +47,8 @@ public class StatisticsController extends BaseController {
|
|||
public Result<List<Goods>> numberEarlyWarning() {
|
||||
QueryWrapper<Goods> goodsQuery = new QueryWrapper<>();
|
||||
goodsQuery.apply("inventory_whole_number <= inventory_warn_number");
|
||||
goodsQuery.orderByAsc("inventory_whole_number","type");
|
||||
goodsQuery.last("limit 20");
|
||||
List<Goods> list = goodsService.list(goodsQuery);
|
||||
return success(list);
|
||||
}
|
||||
|
|
@ -70,5 +70,21 @@ public class StatisticsController extends BaseController {
|
|||
|
||||
}
|
||||
|
||||
@RequestMapping("/salePerson")
|
||||
public Result<List<SalePersonReportVo>> salePerson() {
|
||||
return success( statisticsService.salePersonReport());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取收费队列 就诊队列数量
|
||||
*/
|
||||
@RequestMapping("/getTipCount")
|
||||
public Result<TipCountVo> getChargeQueueCount() {
|
||||
String begin = parmsUtil.getString("beginTime", "开始时间为空");
|
||||
String end = parmsUtil.getString("endTime", "结束时间为空");
|
||||
LocalDateTime beginTime = DateUtil.getDateTime(begin);
|
||||
LocalDateTime endTime = DateUtil.getDateTime(end);
|
||||
return success( statisticsService.getWaitCount(beginTime, endTime));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,77 +14,77 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 商品 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author NiuZiYuan
|
||||
* @since 2025-02-21
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/vip/vip")
|
||||
public class VipController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private VipService vipService;
|
||||
@Autowired
|
||||
private VipLevelConfigService vipLevelConfigService;
|
||||
|
||||
@RequestMapping("/create")
|
||||
public Result<Object> create() {
|
||||
Vip vip = parmsUtil.getObject("vipInfo", Vip.class);
|
||||
vipService.create(vip);
|
||||
|
||||
return success();
|
||||
}
|
||||
|
||||
@RequestMapping("/update")
|
||||
public Result<Object> update() {
|
||||
Vip vip = parmsUtil.getObject("vipInfo", Vip.class);
|
||||
|
||||
vipService.update(vip);
|
||||
|
||||
return success();
|
||||
}
|
||||
|
||||
@RequestMapping("/delete")
|
||||
public Result<Integer> delete() {
|
||||
int vipId = parmsUtil.getInteger("id", "ID不能为空");
|
||||
return success(vipService.removeById(vipId));
|
||||
}
|
||||
|
||||
@RequestMapping("/list")
|
||||
public Result<Page<Vip>> selectList() {
|
||||
String keyword = parmsUtil.getString("keyword");
|
||||
int page = parmsUtil.getInteger("page", "请输入页码");
|
||||
int pageSize = parmsUtil.getInteger("pageSize", "请输入每页条数");
|
||||
Page<Vip> list = vipService.pageList(keyword, page, pageSize);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
@RequestMapping("/get")
|
||||
public Result<Vip> get() {
|
||||
int id = parmsUtil.getInteger("id", "ID不能为空");
|
||||
Vip vip = vipService.getById(id);
|
||||
return success(vip);
|
||||
}
|
||||
|
||||
@RequestMapping("/search")
|
||||
public Result<List<Vip>> search() {
|
||||
String keyword = parmsUtil.getString("keyword", "关键字不能为空");
|
||||
List<Vip> list = vipService.search(keyword);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
@RequestMapping("/changeLevel")
|
||||
public Result changeLevel() {
|
||||
int vipId = parmsUtil.getInteger("vipId", "会员ID不能为空");
|
||||
int levelId = parmsUtil.getInteger("levelId", "等级id不能为空");
|
||||
vipService.changeLevel(vipId, levelId);
|
||||
|
||||
return success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
///**
|
||||
// * <p>
|
||||
// * 商品 前端控制器
|
||||
// * </p>
|
||||
// *
|
||||
// * @author NiuZiYuan
|
||||
// * @since 2025-02-21
|
||||
// */
|
||||
//@RestController
|
||||
//@RequestMapping("/vip/vip")
|
||||
//public class VipController extends BaseController {
|
||||
//
|
||||
// @Autowired
|
||||
// private VipService vipService;
|
||||
// @Autowired
|
||||
// private VipLevelConfigService vipLevelConfigService;
|
||||
//
|
||||
// @RequestMapping("/create")
|
||||
// public Result<Object> create() {
|
||||
// Vip vip = parmsUtil.getObject("vipInfo", Vip.class);
|
||||
// vipService.create(vip);
|
||||
//
|
||||
// return success();
|
||||
// }
|
||||
//
|
||||
// @RequestMapping("/update")
|
||||
// public Result<Object> update() {
|
||||
// Vip vip = parmsUtil.getObject("vipInfo", Vip.class);
|
||||
//
|
||||
// vipService.update(vip);
|
||||
//
|
||||
// return success();
|
||||
// }
|
||||
//
|
||||
// @RequestMapping("/delete")
|
||||
// public Result<Integer> delete() {
|
||||
// int vipId = parmsUtil.getInteger("id", "ID不能为空");
|
||||
// return success(vipService.removeById(vipId));
|
||||
// }
|
||||
//
|
||||
// @RequestMapping("/list")
|
||||
// public Result<Page<Vip>> selectList() {
|
||||
// String keyword = parmsUtil.getString("keyword");
|
||||
// int page = parmsUtil.getInteger("page", "请输入页码");
|
||||
// int pageSize = parmsUtil.getInteger("pageSize", "请输入每页条数");
|
||||
// Page<Vip> list = vipService.pageList(keyword, page, pageSize);
|
||||
// return success(list);
|
||||
// }
|
||||
//
|
||||
// @RequestMapping("/get")
|
||||
// public Result<Vip> get() {
|
||||
// int id = parmsUtil.getInteger("id", "ID不能为空");
|
||||
// Vip vip = vipService.getById(id);
|
||||
// return success(vip);
|
||||
// }
|
||||
//
|
||||
// @RequestMapping("/search")
|
||||
// public Result<List<Vip>> search() {
|
||||
// String keyword = parmsUtil.getString("keyword", "关键字不能为空");
|
||||
// List<Vip> list = vipService.search(keyword);
|
||||
// return success(list);
|
||||
// }
|
||||
//
|
||||
// @RequestMapping("/changeLevel")
|
||||
// public Result changeLevel() {
|
||||
// int vipId = parmsUtil.getInteger("vipId", "会员ID不能为空");
|
||||
// int levelId = parmsUtil.getInteger("levelId", "等级id不能为空");
|
||||
// vipService.changeLevel(vipId, levelId);
|
||||
//
|
||||
// return success();
|
||||
// }
|
||||
//
|
||||
//
|
||||
//}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,10 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|||
import com.syjiaer.clinic.server.common.vo.Page;
|
||||
import com.syjiaer.clinic.server.common.vo.Result;
|
||||
import com.syjiaer.clinic.server.controller.BaseController;
|
||||
import com.syjiaer.clinic.server.entity.patient.PatientInfo;
|
||||
import com.syjiaer.clinic.server.entity.vip.VipIntegralLog;
|
||||
import com.syjiaer.clinic.server.entity.vip.dto.VipIntegralLogQuery;
|
||||
import com.syjiaer.clinic.server.service.patient.PatientInfoService;
|
||||
import com.syjiaer.clinic.server.service.vip.VipIntegralLogService;
|
||||
import com.syjiaer.clinic.server.service.vip.VipService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -17,17 +19,17 @@ import java.util.List;
|
|||
@RestController
|
||||
@RequestMapping("/vip/integral")
|
||||
public class VipIntegralController extends BaseController {
|
||||
@Autowired
|
||||
private VipService vipService;
|
||||
@Autowired
|
||||
private VipIntegralLogService vipIntegralLogService;
|
||||
@Autowired
|
||||
private PatientInfoService patientInfoService;
|
||||
|
||||
@RequestMapping("/add")
|
||||
public Result add(){
|
||||
Integer vipId = parmsUtil.getInteger("vipId","请输入会员id");
|
||||
Integer Integral = parmsUtil.getInteger("integral","请输入积分");
|
||||
String remark = parmsUtil.getString("remark","请输入备注");
|
||||
vipService.changeIntegral(vipId,Integral,remark);
|
||||
patientInfoService.changeIntegral(vipId,Integral,remark);
|
||||
return success();
|
||||
}
|
||||
@RequestMapping("/list")
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ import lombok.experimental.Accessors;
|
|||
* </p>
|
||||
*
|
||||
* @author NiuZiYuan
|
||||
* @since 2025-04-27
|
||||
* @since 2025-04-29
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
|
|
@ -73,4 +73,7 @@ public class ChargeOrder implements Serializable {
|
|||
|
||||
@ApiModelProperty("总成本")
|
||||
private BigDecimal totalCost;
|
||||
|
||||
@ApiModelProperty("销售人id")
|
||||
private Integer salePersonId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,5 +7,6 @@ public class ChargeQuery {
|
|||
private String patientName;
|
||||
private Integer pageNum;
|
||||
private Integer pageSize;
|
||||
private Integer patientId;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.syjiaer.clinic.server.entity.charge.vo;
|
||||
|
||||
import com.syjiaer.clinic.server.entity.charge.ChargeGoodsList;
|
||||
import com.syjiaer.clinic.server.entity.charge.ChargeItemList;
|
||||
import com.syjiaer.clinic.server.entity.diagnosis.DiagnosisMedicalRecord;
|
||||
import com.syjiaer.clinic.server.entity.patient.PatientInfo;
|
||||
|
|
@ -60,6 +61,6 @@ public class ChargeDetailVo {
|
|||
@ApiModelProperty("诊疗服务")
|
||||
private List<ChargeItemList> serviceDetail;
|
||||
@ApiModelProperty("药品耗材")
|
||||
private List<ChargeGoodsListVo> goodsDetail;
|
||||
private List<ChargeGoodsList> goodsDetail;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,4 +7,5 @@ public class ChargeQueueQuery {
|
|||
private String patientName;
|
||||
private Integer pageNum;
|
||||
private Integer pageSize;
|
||||
private Integer status;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,10 @@
|
|||
package com.syjiaer.clinic.server.entity.diagnosis.dto;
|
||||
|
||||
import com.syjiaer.clinic.server.entity.diagnosis.DiagnosisMedicalRecord;
|
||||
import com.syjiaer.clinic.server.entity.item.Item;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
|
|
@ -19,7 +17,7 @@ public class MedicalRecordSaveDto {
|
|||
private Integer patientId;
|
||||
|
||||
@ApiModelProperty("接诊医生id")
|
||||
private Integer dockerId;
|
||||
private Integer doctorId;
|
||||
|
||||
@ApiModelProperty("挂单id")
|
||||
private Integer registrationId;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
package com.syjiaer.clinic.server.entity.diagnosis.vo;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
@Data
|
||||
public class ChargeQueueVo {
|
||||
|
||||
@ApiModelProperty("自增id")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty("患者id")
|
||||
private Integer patientId;
|
||||
|
||||
@ApiModelProperty("诊断code")
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty("挂单id")
|
||||
private Integer registrationId;
|
||||
@ApiModelProperty("状态")
|
||||
private Integer status;
|
||||
@ApiModelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@ApiModelProperty("患者名称")
|
||||
private String patientName;
|
||||
@ApiModelProperty("患者性别")
|
||||
private Integer patientGender;
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package com.syjiaer.clinic.server.entity.organization.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DockerSearchQuery {
|
||||
private String keyword;
|
||||
private Integer role;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
package com.syjiaer.clinic.server.entity.organization.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
@Data
|
||||
public class MemberVo {
|
||||
@ApiModelProperty("自增主键")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty("成员电话")
|
||||
private String tel;
|
||||
|
||||
@ApiModelProperty("医保人员代码")
|
||||
private String socialMemberCode;
|
||||
|
||||
@ApiModelProperty("电子签名")
|
||||
private String electronicSignature;
|
||||
|
||||
@ApiModelProperty("性别")
|
||||
private String gender;
|
||||
|
||||
@ApiModelProperty("年龄")
|
||||
private String age;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
private LocalDateTime createDatetime;
|
||||
|
||||
@ApiModelProperty("身份证号")
|
||||
private String idCardNumber;
|
||||
|
||||
@ApiModelProperty("所属科室")
|
||||
private Integer sectionId;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
private String memo;
|
||||
|
||||
@ApiModelProperty("管理员id")
|
||||
private Integer managerUserId;
|
||||
|
||||
@ApiModelProperty("成员名")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("角色")
|
||||
private Integer role;
|
||||
|
||||
@ApiModelProperty("删除标记")
|
||||
private Boolean delFlag;
|
||||
|
||||
@ApiModelProperty("科室名称")
|
||||
private String sectionName;
|
||||
|
||||
}
|
||||
|
|
@ -5,20 +5,21 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
|||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
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
|
||||
* @since 2025-04-30
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
|
|
@ -40,12 +41,51 @@ public class PatientInfo implements Serializable {
|
|||
@ApiModelProperty("手机号")
|
||||
private String phone;
|
||||
|
||||
@ApiModelProperty("身份证号")
|
||||
private String certno;
|
||||
@ApiModelProperty("证件号码")
|
||||
private String certNo;
|
||||
|
||||
@ApiModelProperty("性别")
|
||||
private String sex;
|
||||
private Integer sex;
|
||||
|
||||
@ApiModelProperty("年龄")
|
||||
private Integer age;
|
||||
|
||||
@ApiModelProperty("证件类型")
|
||||
private String certType;
|
||||
|
||||
@ApiModelProperty("来源")
|
||||
private String source;
|
||||
|
||||
@ApiModelProperty("民族")
|
||||
private String nation;
|
||||
|
||||
@ApiModelProperty("地区")
|
||||
private String area;
|
||||
|
||||
@ApiModelProperty("地址")
|
||||
private String address;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty("创建日期")
|
||||
private LocalDateTime createDatetime;
|
||||
|
||||
@ApiModelProperty("会员等级")
|
||||
private Integer levelId;
|
||||
|
||||
@ApiModelProperty("经验值")
|
||||
private Integer exp;
|
||||
|
||||
@ApiModelProperty("积分余额")
|
||||
private Integer integralBalance;
|
||||
|
||||
@ApiModelProperty("0没绑医保 1已绑定")
|
||||
private Integer isBindSocial;
|
||||
|
||||
@ApiModelProperty("余额")
|
||||
private BigDecimal balance;
|
||||
|
||||
@ApiModelProperty("生日")
|
||||
private LocalDate birthday;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import lombok.experimental.Accessors;
|
|||
* </p>
|
||||
*
|
||||
* @author NiuZiYuan
|
||||
* @since 2025-04-23
|
||||
* @since 2025-04-30
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
|
|
@ -48,7 +48,7 @@ public class PatientRegistration implements Serializable {
|
|||
@ApiModelProperty("患者手机号")
|
||||
private String phone;
|
||||
|
||||
@ApiModelProperty("就诊类型")
|
||||
@ApiModelProperty("就诊类型 初诊 复诊")
|
||||
private Short visitType;
|
||||
|
||||
@ApiModelProperty("挂号时间")
|
||||
|
|
@ -69,11 +69,11 @@ public class PatientRegistration implements Serializable {
|
|||
@ApiModelProperty("逻辑删除")
|
||||
private Integer delFlag;
|
||||
|
||||
@ApiModelProperty("挂号类型")
|
||||
@ApiModelProperty("挂号类型 1普通挂号 2医保挂号")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty("性别")
|
||||
private String gender;
|
||||
@ApiModelProperty("1男 2女")
|
||||
private Integer gender;
|
||||
|
||||
@ApiModelProperty("病人id")
|
||||
private Integer patientInfoId;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,79 @@
|
|||
package com.syjiaer.clinic.server.entity.patient.dto;
|
||||
|
||||
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 RegistrationSaveDto {
|
||||
@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 Integer delFlag;
|
||||
|
||||
@ApiModelProperty("挂号类型")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty("性别")
|
||||
private Integer gender;
|
||||
|
||||
@ApiModelProperty("病人id")
|
||||
private Integer patientInfoId;
|
||||
|
||||
@ApiModelProperty("挂号状态 1候诊 2在诊 3已诊 0取消")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty("人员编号")
|
||||
private String psnNo;
|
||||
|
||||
@ApiModelProperty("险种类型")
|
||||
private String insutype;
|
||||
|
||||
@ApiModelProperty("就诊id 挂号后医保返会")
|
||||
private String mdtrtId;
|
||||
|
||||
@ApiModelProperty("流水号")
|
||||
private String fstNo;
|
||||
|
||||
@ApiModelProperty("证件号码")
|
||||
private String certNo;
|
||||
@ApiModelProperty("证件类型")
|
||||
private String certType;
|
||||
}
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
package com.syjiaer.clinic.server.entity.patient.vo;
|
||||
|
||||
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 PatientRegistrationVo {
|
||||
|
||||
@ApiModelProperty("挂号id")
|
||||
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 Integer delFlag;
|
||||
|
||||
@ApiModelProperty("挂号类型 1普通挂号 2医保挂号")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty("1男 2女")
|
||||
private Integer gender;
|
||||
|
||||
@ApiModelProperty("病人id")
|
||||
private Integer patientInfoId;
|
||||
|
||||
@ApiModelProperty("挂号状态 1候诊 2在诊 3已诊 0取消")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty("人员编号")
|
||||
private String psnNo;
|
||||
|
||||
@ApiModelProperty("险种类型")
|
||||
private String insutype;
|
||||
|
||||
@ApiModelProperty("就诊id 挂号后医保返会")
|
||||
private String mdtrtId;
|
||||
|
||||
@ApiModelProperty("流水号")
|
||||
private String fstNo;
|
||||
|
||||
@ApiModelProperty("证件类型")
|
||||
private String certType;
|
||||
@ApiModelProperty("证件号码")
|
||||
private String certNo;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.syjiaer.clinic.server.entity.patient.vo;
|
||||
|
||||
import com.syjiaer.clinic.server.entity.patient.PatientInfo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
@Data
|
||||
public class SeeDoctorInfoVo {
|
||||
//患者信息
|
||||
private PatientInfo patientInfo;
|
||||
//挂号医生id
|
||||
private Integer dockerId;
|
||||
//挂号医生姓名
|
||||
private String dockerName;
|
||||
//医生科室名称
|
||||
private String sectionName;
|
||||
//上一次接诊时间
|
||||
private LocalDateTime lastSeeDoctorTime;
|
||||
//就诊次数
|
||||
private Integer seeDoctorCount;
|
||||
//医保余额
|
||||
private BigDecimal socialBalance;
|
||||
}
|
||||
|
|
@ -7,6 +7,7 @@ import java.math.BigDecimal;
|
|||
@Getter
|
||||
@Setter
|
||||
public class PayTypeRevenue {
|
||||
private Integer payType;
|
||||
private BigDecimal totalRevenue;
|
||||
private String name;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,16 +14,18 @@ import java.util.List;
|
|||
public class RevenueOverviewVo {
|
||||
//总营业额
|
||||
private BigDecimal totalRevenue;
|
||||
//会员销售额
|
||||
private BigDecimal vipRevenue;
|
||||
//医保销售额
|
||||
private BigDecimal socialRevenue;
|
||||
//总完成单数
|
||||
private Long totalOrderCount;
|
||||
//会员单数
|
||||
private Long vipOrderCount;
|
||||
//医保单数
|
||||
private Long socialOrderCount;
|
||||
|
||||
private List<GoodsTypeRevenue> goodsTypeRevenue;
|
||||
|
||||
private List<PayTypeRevenue> payTypeRevenue;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
package com.syjiaer.clinic.server.entity.statistics;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class SalePersonReportVo {
|
||||
private Integer salePersonId;
|
||||
private String salePersonName;
|
||||
private BigDecimal totalIncome;
|
||||
private BigDecimal wechatIncome;
|
||||
private BigDecimal aliPayIncome;
|
||||
private BigDecimal cashIncome;
|
||||
private BigDecimal otherIncome;
|
||||
private BigDecimal socialIncome;
|
||||
private Long count;
|
||||
|
||||
public SalePersonReportVo() {
|
||||
this.totalIncome = BigDecimal.ZERO;
|
||||
this.wechatIncome = BigDecimal.ZERO;
|
||||
this.aliPayIncome = BigDecimal.ZERO;
|
||||
this.cashIncome = BigDecimal.ZERO;
|
||||
this.otherIncome = BigDecimal.ZERO;
|
||||
this.socialIncome = BigDecimal.ZERO;
|
||||
this.count = 0L;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.syjiaer.clinic.server.entity.statistics;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TipCountVo {
|
||||
//待诊断数量
|
||||
private Long waitDiagnosisCount;
|
||||
//在诊数量
|
||||
private Long diagnosingCount;
|
||||
//完诊数量
|
||||
private Long completeDiaCount;
|
||||
//已收费数量
|
||||
private Long chargedCount;
|
||||
//未收费数量
|
||||
private Long unchargedCount;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -4,6 +4,9 @@ import com.syjiaer.clinic.server.entity.charge.ChargeOrder;
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
|
@ -16,6 +19,7 @@ import org.apache.ibatis.annotations.Select;
|
|||
public interface ChargeOrderMapper extends BaseMapper<ChargeOrder> {
|
||||
@Select("select * from charge_order where code = #{code}")
|
||||
ChargeOrder selectByCode(String code);
|
||||
|
||||
@Select("SELECT sale_person_id,pay_type,\"sum\"(total_price) ,\"count\"(0) FROM \"public\".\"charge_order\" GROUP BY sale_person_id,pay_type")
|
||||
List<Map<String, Object>> selectSaleReport();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public interface InventoryMapper extends BaseMapper<Inventory> {
|
|||
@Select("SELECT" +
|
||||
" inventory.*,goods.expiry_warn_days,goods.unit_price,EXTRACT(EPOCH FROM AGE(expiry_date, CURRENT_DATE)) / 86400 AS remaining_days" +
|
||||
" FROM inventory LEFT JOIN goods ON inventory.good_id = goods.id" +
|
||||
" WHERE CURRENT_DATE + INTERVAL '1 day' * goods.expiry_warn_days >= inventory.expiry_date AND inventory.whole_number !=0")
|
||||
" WHERE CURRENT_DATE + INTERVAL '1 day' * goods.expiry_warn_days >= inventory.expiry_date AND inventory.whole_number !=0 ORDER BY inventory.expiry_date ASC LIMIT 20 ")
|
||||
List<Map<String, Object>> selectExpiryWarn();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,13 @@ package com.syjiaer.clinic.server.mapper.organization;
|
|||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.syjiaer.clinic.server.entity.organization.OrganizationMember;
|
||||
import com.syjiaer.clinic.server.entity.organization.dto.DockerSearchQuery;
|
||||
import com.syjiaer.clinic.server.entity.organization.vo.MemberVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -16,5 +20,7 @@ import java.io.Serializable;
|
|||
* @since 2025-04-11
|
||||
*/
|
||||
public interface OrganizationMemberMapper extends BaseMapper<OrganizationMember> {
|
||||
|
||||
List<MemberVo> selectDetailByQuery(DockerSearchQuery query);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,16 +10,11 @@ import com.syjiaer.clinic.server.common.api.output.OM2207A;
|
|||
import com.syjiaer.clinic.server.common.api.request.SocialRequest;
|
||||
import com.syjiaer.clinic.server.common.config.Config;
|
||||
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.RetailOrderPayTypeEnum;
|
||||
import com.syjiaer.clinic.server.common.enums.RetailOrderStatusEnum;
|
||||
import com.syjiaer.clinic.server.common.enums.*;
|
||||
import com.syjiaer.clinic.server.common.exception.MessageException;
|
||||
import com.syjiaer.clinic.server.common.util.StringUtil;
|
||||
import com.syjiaer.clinic.server.common.vo.Page;
|
||||
import com.syjiaer.clinic.server.entity.charge.ChargeGoodsList;
|
||||
import com.syjiaer.clinic.server.entity.charge.ChargeItemList;
|
||||
import com.syjiaer.clinic.server.entity.charge.ChargeOrder;
|
||||
import com.syjiaer.clinic.server.entity.charge.*;
|
||||
import com.syjiaer.clinic.server.entity.charge.dto.ChargeQuery;
|
||||
import com.syjiaer.clinic.server.entity.charge.dto.ChargeSaveDto;
|
||||
import com.syjiaer.clinic.server.entity.charge.vo.ChargeDetailVo;
|
||||
|
|
@ -35,12 +30,12 @@ import com.syjiaer.clinic.server.entity.item.Item;
|
|||
import com.syjiaer.clinic.server.entity.manager.ManagerUser;
|
||||
import com.syjiaer.clinic.server.entity.organization.OrganizationMember;
|
||||
import com.syjiaer.clinic.server.entity.organization.OrganizationSection;
|
||||
import com.syjiaer.clinic.server.entity.patient.PatientInfo;
|
||||
import com.syjiaer.clinic.server.entity.patient.PatientRegistration;
|
||||
import com.syjiaer.clinic.server.entity.social.SocialDirectory;
|
||||
import com.syjiaer.clinic.server.entity.social.SocialItem;
|
||||
import com.syjiaer.clinic.server.mapper.charge.ChargeGoodsListMapper;
|
||||
import com.syjiaer.clinic.server.mapper.charge.ChargeItemListMapper;
|
||||
import com.syjiaer.clinic.server.mapper.charge.ChargeOrderMapper;
|
||||
import com.syjiaer.clinic.server.entity.social.SocialUser;
|
||||
import com.syjiaer.clinic.server.mapper.charge.*;
|
||||
import com.syjiaer.clinic.server.mapper.diagnosis.DiagnosisMapper;
|
||||
import com.syjiaer.clinic.server.mapper.diagnosis.DiagnosisMedicalGoodsListMapper;
|
||||
import com.syjiaer.clinic.server.mapper.diagnosis.DiagnosisMedicalItemListMapper;
|
||||
|
|
@ -54,6 +49,7 @@ import com.syjiaer.clinic.server.mapper.patient.PatientInfoMapper;
|
|||
import com.syjiaer.clinic.server.mapper.patient.PatientRegistrationMapper;
|
||||
import com.syjiaer.clinic.server.mapper.social.SocialDirectoryMapper;
|
||||
import com.syjiaer.clinic.server.mapper.social.SocialItemMapper;
|
||||
import com.syjiaer.clinic.server.mapper.social.SocialUserMapper;
|
||||
import com.syjiaer.clinic.server.service.BaseService;
|
||||
import com.syjiaer.clinic.server.service.charge.vo.PaymentMethodVo;
|
||||
import com.syjiaer.clinic.server.service.charge.vo.RetailOrderDailyChargingReportVo;
|
||||
|
|
@ -69,16 +65,19 @@ import java.math.BigDecimal;
|
|||
import java.math.RoundingMode;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
public class ChargeService extends BaseService {
|
||||
@Autowired
|
||||
private ChargeOrderMapper chargeOrderMapper;
|
||||
@Autowired
|
||||
private ChargeLogMapper chargeLogMapper;
|
||||
@Autowired
|
||||
private ChargeInventoryLogMapper chargeInventoryLogMapper;
|
||||
@Autowired
|
||||
private SocialUserMapper socialUserMapper;
|
||||
@Autowired
|
||||
private ChargeItemListMapper chargeItemListMapper;
|
||||
@Autowired
|
||||
private ChargeGoodsListMapper chargeGoodsListMapper;
|
||||
|
|
@ -248,6 +247,7 @@ public class ChargeService extends BaseService {
|
|||
chargeOrder.setStatus(RetailOrderStatusEnum.UNFINISHED.getCode());
|
||||
chargeOrder.setPatientId(dto.getPatientInfo().getId());
|
||||
chargeOrder.setDiagnosisCode(dto.getDiagnosisMedicalRecord().getDiagnosisCode());
|
||||
chargeOrder.setSalePersonId(dto.getPatientRegistration().getOrganizationDoctorId());
|
||||
chargeOrderMapper.insert(chargeOrder);
|
||||
return chargeOrder;
|
||||
|
||||
|
|
@ -265,16 +265,19 @@ public class ChargeService extends BaseService {
|
|||
if (query.getPatientName() != null) {
|
||||
queryWrapper.like("patient_name", query.getPatientName());
|
||||
}
|
||||
if (query.getPatientId() != null){
|
||||
queryWrapper.eq("patient_id", query.getPatientId());
|
||||
}
|
||||
Page<ChargeOrder> orderPage = pageHelper(query.getPageNum(), query.getPageSize(), queryWrapper, chargeOrderMapper, "create_datetime", false);
|
||||
List<ChargeDetailVo> voList = new ArrayList<>();
|
||||
for (ChargeOrder chargeOrder : orderPage.getList()) {
|
||||
ChargeDetailVo detailVo = new ChargeDetailVo();
|
||||
BeanUtils.copyProperties(chargeOrder, detailVo);
|
||||
detailVo.setDiagnosisMedicalRecord(diagnosisMedicalRecordMapper.selectByDiagnosisCode(chargeOrder.getDiagnosisCode()));
|
||||
detailVo.setPatientInfo(patientInfoMapper.selectById(chargeOrder.getPatientId()));
|
||||
detailVo.setServiceDetail(chargeItemListMapper.selectList(new QueryWrapper<ChargeItemList>()
|
||||
.eq("charge_order_code", chargeOrder.getCode())));
|
||||
detailVo.setServiceDetail(chargeItemListMapper.selectByCode(chargeOrder.getCode()));
|
||||
|
||||
detailVo.setGoodsDetail(chargeGoodsListMapper.selectDetailByCode(chargeOrder.getCode()));
|
||||
detailVo.setGoodsDetail(chargeGoodsListMapper.selectByCode(chargeOrder.getCode()));
|
||||
voList.add(detailVo);
|
||||
}
|
||||
Page<ChargeDetailVo> resultPage = new Page<>();
|
||||
|
|
@ -330,6 +333,8 @@ public class ChargeService extends BaseService {
|
|||
updateOrder.setPayType(payType);
|
||||
updateOrder.setPayTime(LocalDateTime.now());
|
||||
chargeOrderMapper.updateById(updateOrder);
|
||||
|
||||
order = chargeOrderMapper.selectById(id);
|
||||
//扣除商品库存
|
||||
List<ChargeGoodsListVo> goodsLists = chargeGoodsListMapper.selectDetailByCode(order.getCode());
|
||||
for (ChargeGoodsListVo goodsList : goodsLists) {
|
||||
|
|
@ -347,7 +352,11 @@ public class ChargeService extends BaseService {
|
|||
log.setSocialType(InventorySocialTypeEnum.INVENTORY_SURPLUS.getType());
|
||||
}
|
||||
inventoryLogMapper.insert(logs);
|
||||
this.recordChargeInventoryLog(logs,order);
|
||||
}
|
||||
//记录收费日志
|
||||
this.recordChargeLog(order, ChargeSourceEnum.CHARGE, ChargeTypeEnum.CHARGE);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -494,8 +503,8 @@ public class ChargeService extends BaseService {
|
|||
* @param endDateTime
|
||||
* @return
|
||||
*/
|
||||
public Map<String, RetailOrderDailyChargingReportVo> dailyChargingReport(LocalDateTime startDateTime, LocalDateTime endDateTime) {
|
||||
Map<String, RetailOrderDailyChargingReportVo> result = new HashMap<>();
|
||||
public List<RetailOrderDailyChargingReportVo> dailyChargingReport(LocalDateTime startDateTime, LocalDateTime endDateTime) {
|
||||
Map<String, RetailOrderDailyChargingReportVo> result = new TreeMap<>();
|
||||
QueryWrapper<ChargeOrder> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.between("create_datetime", startDateTime, endDateTime)
|
||||
.eq("status", RetailOrderStatusEnum.FINISHED.getCode())
|
||||
|
|
@ -518,13 +527,21 @@ public class ChargeService extends BaseService {
|
|||
}
|
||||
result.put(dateKey, retailOrderDailyChargingReportVo);
|
||||
}
|
||||
|
||||
List<RetailOrderDailyChargingReportVo> voList = new ArrayList<>();
|
||||
result.forEach((key, value) -> {
|
||||
BigDecimal grossMargin = value.getTotalMoney().subtract(value.getTotalCost());
|
||||
value.setGrossMargin(grossMargin);
|
||||
BigDecimal divisor = value.getTotalMoney();
|
||||
if (divisor.compareTo(BigDecimal.ZERO) == 0) {
|
||||
// 处理除数为零的情况,例如抛出自定义异常或返回默认值
|
||||
value.setGrossProfitRate("0.00%");
|
||||
}else {
|
||||
value.setGrossProfitRate(String.format("%.2f%%", grossMargin.divide(value.getTotalMoney(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100"))));
|
||||
}
|
||||
value.setDate(LocalDate.parse(key));
|
||||
voList.add(value);
|
||||
});
|
||||
return result;
|
||||
return voList;
|
||||
}
|
||||
|
||||
//获取各支付方式支付的金额
|
||||
|
|
@ -555,4 +572,96 @@ public class ChargeService extends BaseService {
|
|||
queryWrapper.eq("code", code);
|
||||
return chargeOrderMapper.selectOne(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询患者消费记录
|
||||
*
|
||||
* @param patientId
|
||||
* @return
|
||||
*/
|
||||
public List<ChargeOrder> getListByPatientId(Integer patientId) {
|
||||
QueryWrapper<ChargeOrder> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("patient_id", patientId);
|
||||
return chargeOrderMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 收款 退款 记录
|
||||
*/
|
||||
public void recordChargeLog(ChargeOrder chargeOrder, ChargeSourceEnum sourceEnum, ChargeTypeEnum chargeType){
|
||||
ChargeLog chargeLog = new ChargeLog();
|
||||
String customer = null;
|
||||
if (chargeOrder.getPatientId() != null){
|
||||
PatientInfo patient = patientInfoMapper.selectById(chargeOrder.getPatientId());
|
||||
customer = patient.getName();
|
||||
}else if (chargeOrder.getSocialUserId() != null){
|
||||
SocialUser socialUser = socialUserMapper.selectById(chargeOrder.getSocialUserId());
|
||||
customer = socialUser.getPsnName();
|
||||
}else {
|
||||
customer = "-";
|
||||
}
|
||||
chargeLog.setSource(sourceEnum.getType());
|
||||
chargeLog.setCustomer(customer);
|
||||
chargeLog.setType(chargeType.getChargeType());
|
||||
chargeLog.setOriginalPrice(chargeOrder.getPreTotalPrice());
|
||||
chargeLog.setReceivable(chargeOrder.getTotalPrice());
|
||||
chargeLog.setNetReceipts(chargeOrder.getTotalPrice());
|
||||
chargeLog.setDiscount(chargeOrder.getTotalPrice().subtract(chargeOrder.getPreTotalPrice()));
|
||||
chargeLog.setPayType(chargeOrder.getPayType());
|
||||
if (chargeOrder.getSalePersonId() != null){
|
||||
OrganizationMember organizationMember = organizationMemberMapper.selectById(chargeOrder.getSalePersonId());
|
||||
chargeLog.setSalePersonName(organizationMember.getName());
|
||||
chargeLog.setSalePersonId(chargeOrder.getSalePersonId());
|
||||
}
|
||||
chargeLog.setChargeTime(LocalDateTime.now());
|
||||
chargeLog.setProjectCode(chargeOrder.getCode());
|
||||
chargeLogMapper.insert(chargeLog);
|
||||
}
|
||||
/**
|
||||
* 销售库存变更 日志
|
||||
*/
|
||||
public void recordChargeInventoryLog(List<InventoryLog> logs,ChargeOrder chargeOrder){
|
||||
List<ChargeInventoryLog> chargeInventoryLogs = new ArrayList<>();
|
||||
for (InventoryLog log : logs){
|
||||
ChargeInventoryLog chargeInventoryLog = new ChargeInventoryLog();
|
||||
chargeInventoryLog.setChargeOrderCode(chargeOrder.getCode());
|
||||
chargeInventoryLog.setGoodsId(log.getGoodsId());
|
||||
chargeInventoryLog.setInventoryId(log.getInventoryId());
|
||||
chargeInventoryLog.setNumber(log.getChangeWholeNumber());
|
||||
Goods dbGoods = goodsMapper.selectById(log.getGoodsId());
|
||||
chargeInventoryLog.setTrdnFlag(false);
|
||||
chargeInventoryLog.setUnit(dbGoods.getPackagingUnit());
|
||||
chargeInventoryLog.setNumber(log.getChangeWholeNumber());
|
||||
if (log.getChangeFragmentNumber() != 0 ){
|
||||
chargeInventoryLog.setTrdnFlag(true);
|
||||
chargeInventoryLog.setUnit(dbGoods.getMinPackagingUnit());
|
||||
chargeInventoryLog.setNumber(log.getChangeWholeNumber()*dbGoods.getMinPackagingNumber()+log.getChangeFragmentNumber());
|
||||
}
|
||||
QueryWrapper<ChargeGoodsList> listWrapper = new QueryWrapper<>();
|
||||
listWrapper.eq("charge_order_code",chargeOrder.getCode());
|
||||
listWrapper.eq("goods_id",log.getGoodsId());
|
||||
ChargeGoodsList chargeGoodsList = chargeGoodsListMapper.selectOne(listWrapper);
|
||||
chargeInventoryLog.setFeedetlSn(chargeGoodsList.getFeedetlSn());
|
||||
chargeInventoryLog.setCreateTime(LocalDateTime.now());
|
||||
chargeInventoryLog.setGoodsType(chargeGoodsList.getType());
|
||||
chargeInventoryLog.setUploadStatus(UploadStatusEnum.NoUpload.getStatus());
|
||||
chargeInventoryLog.setType(ChargeTypeEnum.CHARGE.getChargeType());
|
||||
|
||||
chargeInventoryLogs.add(chargeInventoryLog);
|
||||
|
||||
}
|
||||
chargeInventoryLogMapper.insert(chargeInventoryLogs);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取收费记录
|
||||
* @return
|
||||
*/
|
||||
public Page<ChargeLog> getChargeRecordPageList() {
|
||||
QueryWrapper<ChargeLog> queryWrapper = new QueryWrapper<>();
|
||||
Page<ChargeLog> page = pageHelper(1, 20, queryWrapper, chargeLogMapper, "charge_time", false);
|
||||
return page;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ import java.time.LocalDate;
|
|||
|
||||
@Data
|
||||
public class RetailOrderDailyChargingReportVo {
|
||||
//日期
|
||||
private LocalDate date;
|
||||
//总金额
|
||||
private BigDecimal totalMoney;
|
||||
//总成本
|
||||
|
|
|
|||
|
|
@ -10,12 +10,12 @@ import com.syjiaer.clinic.server.common.enums.RegistrationStatusEnum;
|
|||
import com.syjiaer.clinic.server.common.exception.MessageException;
|
||||
import com.syjiaer.clinic.server.common.util.StringUtil;
|
||||
import com.syjiaer.clinic.server.common.vo.Page;
|
||||
import com.syjiaer.clinic.server.entity.charge.vo.ChargeDetailVo;
|
||||
import com.syjiaer.clinic.server.entity.charge.vo.ChargeGoodsListVo;
|
||||
import com.syjiaer.clinic.server.entity.charge.vo.ChargeItemListVo;
|
||||
import com.syjiaer.clinic.server.entity.diagnosis.Diagnosis;
|
||||
import com.syjiaer.clinic.server.entity.diagnosis.dto.ChargeQueueQuery;
|
||||
import com.syjiaer.clinic.server.entity.diagnosis.dto.ItemRetailDto;
|
||||
import com.syjiaer.clinic.server.entity.diagnosis.vo.ChargeQueueVo;
|
||||
import com.syjiaer.clinic.server.entity.goods.Goods;
|
||||
import com.syjiaer.clinic.server.entity.item.Item;
|
||||
import com.syjiaer.clinic.server.entity.manager.ManagerUser;
|
||||
|
|
@ -29,6 +29,7 @@ import com.syjiaer.clinic.server.entity.organization.OrganizationMember;
|
|||
import com.syjiaer.clinic.server.entity.organization.OrganizationSection;
|
||||
import com.syjiaer.clinic.server.entity.patient.PatientInfo;
|
||||
import com.syjiaer.clinic.server.entity.patient.PatientRegistration;
|
||||
import com.syjiaer.clinic.server.entity.patient.vo.SeeDoctorInfoVo;
|
||||
import com.syjiaer.clinic.server.mapper.diagnosis.DiagnosisMapper;
|
||||
import com.syjiaer.clinic.server.mapper.goods.GoodsMapper;
|
||||
import com.syjiaer.clinic.server.mapper.item.ItemMapper;
|
||||
|
|
@ -79,13 +80,19 @@ public class MedicalRecordService extends BaseService {
|
|||
private DiagnosisMapper diagnosisMapper;
|
||||
@Autowired
|
||||
private PatientInfoMapper patientInfoMapper;
|
||||
|
||||
/*
|
||||
* 保存
|
||||
* @param saveDto 病历信息
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void save(MedicalRecordSaveDto saveDto) {
|
||||
|
||||
if (saveDto == null){
|
||||
throw new MessageException("参数不能为空");
|
||||
}
|
||||
if (saveDto.getDiagnosisMedicalRecord().getDiagnosisDetail() == null){
|
||||
throw new MessageException("请填写诊断详情");
|
||||
}
|
||||
//改变挂号单状态
|
||||
PatientRegistration dbRegis = patientRegistrationMapper.selectById(saveDto.getRegistrationId());
|
||||
if (dbRegis == null) {
|
||||
|
|
@ -93,12 +100,13 @@ public class MedicalRecordService extends BaseService {
|
|||
}
|
||||
PatientRegistration updateRegis = new PatientRegistration();
|
||||
updateRegis.setId(dbRegis.getId());
|
||||
updateRegis.setStatus(RegistrationStatusEnum.complete.getType());
|
||||
updateRegis.setStatus(RegistrationStatusEnum.complete.getStatus());
|
||||
patientRegistrationMapper.updateById(updateRegis);
|
||||
//诊断主表
|
||||
Diagnosis diagnosis = new Diagnosis();
|
||||
QueryWrapper<Diagnosis> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("registration_id", saveDto.getRegistrationId());
|
||||
queryWrapper.last("limit 1");
|
||||
Diagnosis dbDiagnosis = diagnosisMapper.selectOne(queryWrapper);
|
||||
if (dbDiagnosis != null) {
|
||||
diagnosis.setId(dbDiagnosis.getId());
|
||||
|
|
@ -168,6 +176,7 @@ public class MedicalRecordService extends BaseService {
|
|||
|
||||
/**
|
||||
* 根据患者的id查询病历
|
||||
*
|
||||
* @param patientId
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -199,6 +208,7 @@ public class MedicalRecordService extends BaseService {
|
|||
|
||||
/**
|
||||
* 根据挂单号回显病历信息
|
||||
*
|
||||
* @param regisId
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -281,25 +291,63 @@ public class MedicalRecordService extends BaseService {
|
|||
|
||||
|
||||
}
|
||||
/*
|
||||
获取收费队列
|
||||
*/
|
||||
public Page<MedicalRecordVo> getChargeQueue(ChargeQueueQuery query) {
|
||||
QueryWrapper<Diagnosis> queryWrapper = new QueryWrapper<>();
|
||||
|
||||
|
||||
public Page<ChargeQueueVo> getChargeQueue(ChargeQueueQuery query) {
|
||||
QueryWrapper<Diagnosis> queryWrapper = new QueryWrapper<>();
|
||||
if (query.getStatus() != null) {
|
||||
queryWrapper.eq("status", query.getStatus());
|
||||
}
|
||||
Page<Diagnosis> diagnosisList = pageHelper(query.getPageNum(), query.getPageSize(), queryWrapper, diagnosisMapper, "create_time", false);
|
||||
|
||||
List<MedicalRecordVo> list = new ArrayList<>();
|
||||
List<ChargeQueueVo> list = new ArrayList<>();
|
||||
for (Diagnosis diagnosis : diagnosisList.getList()) {
|
||||
MedicalRecordVo vo = new MedicalRecordVo();
|
||||
vo = getDetailByRegisId(diagnosis.getRegistrationId());
|
||||
ChargeQueueVo vo = new ChargeQueueVo();
|
||||
BeanUtils.copyProperties(diagnosis, vo);
|
||||
PatientRegistration registration = patientRegistrationMapper.selectById(diagnosis.getRegistrationId());
|
||||
vo.setPatientId(registration.getPatientInfoId());
|
||||
vo.setPatientName(registration.getName());
|
||||
vo.setPatientGender(registration.getGender());
|
||||
list.add(vo);
|
||||
}
|
||||
|
||||
Page<MedicalRecordVo> page = new Page<>();
|
||||
Page<ChargeQueueVo> page = new Page<>();
|
||||
page.setList(list);
|
||||
page.setTotal_page(diagnosisList.getTotal_page());
|
||||
page.setTotal_count(diagnosisList.getTotal_count());
|
||||
return page;
|
||||
}
|
||||
|
||||
public SeeDoctorInfoVo getSeeDockerInfo(Integer regisId) {
|
||||
|
||||
PatientRegistration registration = patientRegistrationMapper.selectById(regisId);
|
||||
if (registration == null) {
|
||||
throw new MessageException("挂号单不存在");
|
||||
}
|
||||
SeeDoctorInfoVo vo = new SeeDoctorInfoVo();
|
||||
vo.setPatientInfo(patientInfoMapper.selectById(registration.getPatientInfoId()));
|
||||
|
||||
OrganizationMember docker = organizationMemberMapper.selectById(registration.getOrganizationDoctorId());
|
||||
vo.setDockerId(docker.getId());
|
||||
vo.setDockerName(docker.getName());
|
||||
if (docker.getSectionId() != null) {
|
||||
OrganizationSection section = organizationSectionMapper.selectById(docker.getSectionId());
|
||||
vo.setSectionName(section.getName());
|
||||
}
|
||||
QueryWrapper<Diagnosis> diagnosisQueryWrapper = new QueryWrapper<>();
|
||||
diagnosisQueryWrapper.eq("patient_id", vo.getPatientInfo().getId());
|
||||
diagnosisQueryWrapper.orderByDesc("create_time");
|
||||
List<Diagnosis> diagnosisList = diagnosisMapper.selectList(diagnosisQueryWrapper);
|
||||
if (!diagnosisList.isEmpty()) {
|
||||
vo.setLastSeeDoctorTime(diagnosisList.get(0).getCreateTime());
|
||||
vo.setSeeDoctorCount(diagnosisList.size());
|
||||
}
|
||||
vo.setSocialBalance(BigDecimal.ZERO);
|
||||
return vo;
|
||||
}
|
||||
|
||||
public MedicalRecordVo getByDiagnosisCode(String diagnosisCode) {
|
||||
Diagnosis diagnosis = diagnosisMapper.selectByCode(diagnosisCode);
|
||||
return getDetailByRegisId(diagnosis.getRegistrationId());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,12 +2,16 @@ package com.syjiaer.clinic.server.service.organization;
|
|||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.syjiaer.clinic.server.common.api.annotations.IMField;
|
||||
import com.syjiaer.clinic.server.common.exception.MessageException;
|
||||
import com.syjiaer.clinic.server.common.util.FileUtil;
|
||||
import com.syjiaer.clinic.server.common.vo.Page;
|
||||
import com.syjiaer.clinic.server.entity.charge.dto.ChargeQuery;
|
||||
import com.syjiaer.clinic.server.entity.manager.ManagerUser;
|
||||
import com.syjiaer.clinic.server.entity.organization.OrganizationMember;
|
||||
import com.syjiaer.clinic.server.entity.organization.dto.DockerSearchQuery;
|
||||
import com.syjiaer.clinic.server.entity.organization.dto.OrganizationMemberSaveDto;
|
||||
import com.syjiaer.clinic.server.entity.organization.vo.MemberVo;
|
||||
import com.syjiaer.clinic.server.mapper.manager.ManagerUserMapper;
|
||||
import com.syjiaer.clinic.server.mapper.organization.OrganizationMemberMapper;
|
||||
import com.syjiaer.clinic.server.service.BaseService;
|
||||
|
|
@ -145,9 +149,10 @@ public class OrganizationMemberService extends BaseService {
|
|||
/*
|
||||
* 获取医生列表
|
||||
*/
|
||||
public List<OrganizationMember> doctorList() {
|
||||
QueryWrapper<OrganizationMember> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("role", 1);
|
||||
return organizationMemberMapper.selectList(queryWrapper);
|
||||
public List<MemberVo> doctorList(DockerSearchQuery dockerSearchQuery) {
|
||||
if (dockerSearchQuery == null){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return organizationMemberMapper.selectDetailByQuery(dockerSearchQuery);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,26 +1,273 @@
|
|||
package com.syjiaer.clinic.server.service.patient;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.syjiaer.clinic.server.common.exception.MessageException;
|
||||
import com.syjiaer.clinic.server.common.vo.Page;
|
||||
import com.syjiaer.clinic.server.entity.patient.PatientInfo;
|
||||
import com.syjiaer.clinic.server.entity.vip.Vip;
|
||||
import com.syjiaer.clinic.server.entity.vip.VipExpLog;
|
||||
import com.syjiaer.clinic.server.entity.vip.VipIntegralLog;
|
||||
import com.syjiaer.clinic.server.entity.vip.VipLevelConfig;
|
||||
import com.syjiaer.clinic.server.mapper.patient.PatientInfoMapper;
|
||||
import com.syjiaer.clinic.server.mapper.vip.VipExpLogMapper;
|
||||
import com.syjiaer.clinic.server.mapper.vip.VipIntegralLogMapper;
|
||||
import com.syjiaer.clinic.server.mapper.vip.VipLevelConfigMapper;
|
||||
import com.syjiaer.clinic.server.service.BaseService;
|
||||
import com.syjiaer.clinic.server.service.vip.VipLevelConfigService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class PatientInfoService extends BaseService {
|
||||
@Autowired
|
||||
@Lazy
|
||||
private PatientInfoService patientInfoService;
|
||||
@Autowired
|
||||
private PatientInfoMapper patientInfoMapper;
|
||||
@Autowired
|
||||
private VipLevelConfigMapper vipLevelConfigMapper;
|
||||
@Autowired
|
||||
@Lazy
|
||||
private VipLevelConfigService vipLevelConfigService;
|
||||
@Autowired
|
||||
private VipExpLogMapper vipExpLogMapper;
|
||||
@Autowired
|
||||
private VipIntegralLogMapper vipIntegralLogMapper;
|
||||
|
||||
public PatientInfo save(PatientInfo patientInfo){
|
||||
patientInfo.setCreateDatetime(LocalDateTime.now());
|
||||
if (patientInfo.getBirthday() != null) {
|
||||
int currentYear = LocalDate.now().getYear();
|
||||
int birthYear = patientInfo.getBirthday().getYear();
|
||||
patientInfo.setAge(currentYear - birthYear);
|
||||
}
|
||||
VipLevelConfig level = vipLevelConfigService.getByExp(patientInfo.getExp());
|
||||
if (level != null){
|
||||
patientInfo.setLevelId(level.getLevelId());
|
||||
}else {
|
||||
patientInfo.setLevelId(0);
|
||||
}
|
||||
|
||||
public void save(PatientInfo patientInfo){
|
||||
QueryWrapper<PatientInfo> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("phone", patientInfo.getPhone());
|
||||
queryWrapper.eq("cert_no", patientInfo.getCertNo());
|
||||
PatientInfo dbInfo = patientInfoMapper.selectOne(queryWrapper);
|
||||
if (dbInfo != null){
|
||||
patientInfo.setId(dbInfo.getId());
|
||||
patientInfo.setExp(null);
|
||||
patientInfo.setLevelId(null);
|
||||
patientInfo.setIntegralBalance(null);
|
||||
patientInfo.setBalance(null);
|
||||
}
|
||||
patientInfoMapper.insertOrUpdate(patientInfo);
|
||||
return patientInfo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 改变会员经验值
|
||||
* @param patientId
|
||||
* @param changeExp
|
||||
* @param remark
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void changeExp(int patientId, int changeExp, String remark){
|
||||
PatientInfo patientInfo = patientInfoMapper.selectById(patientId);
|
||||
if(patientInfo==null){
|
||||
throw new MessageException("会员不存在");
|
||||
}
|
||||
int start_exp = patientInfo.getExp();
|
||||
int end_exp = start_exp + changeExp;
|
||||
if(end_exp<0){
|
||||
end_exp=0;
|
||||
changeExp = -start_exp;
|
||||
}
|
||||
patientInfo.setExp(end_exp);
|
||||
// 记录日志
|
||||
VipExpLog vipExpLog = new VipExpLog();
|
||||
vipExpLog.setStartExp(start_exp);
|
||||
vipExpLog.setChangeExp(changeExp);
|
||||
vipExpLog.setEndExp(end_exp);
|
||||
vipExpLog.setVipId(patientId);
|
||||
vipExpLog.setCreateDatetime(LocalDateTime.now());
|
||||
vipExpLog.setRemark(remark);
|
||||
//更新VIP等级
|
||||
QueryWrapper<VipLevelConfig> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.orderByDesc("start_exp");
|
||||
List<VipLevelConfig> vipLevelConfigs = vipLevelConfigMapper.selectList(queryWrapper);
|
||||
for (VipLevelConfig vipLevelConfig : vipLevelConfigs) {
|
||||
if(end_exp>=vipLevelConfig.getStartExp()){
|
||||
patientInfo.setLevelId(vipLevelConfig.getLevelId());
|
||||
System.out.println(vipLevelConfig.getLevelId());
|
||||
System.out.println(end_exp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
UpdateWrapper<PatientInfo> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.eq("id",patientId);
|
||||
updateWrapper.set("level_id",patientInfo.getLevelId());
|
||||
updateWrapper.set("exp",patientInfo.getExp());
|
||||
// 保存
|
||||
patientInfoMapper.update(updateWrapper);
|
||||
vipExpLogMapper.insert(vipExpLog);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 改变vip积分
|
||||
* @param patientId
|
||||
* @param addIntegral
|
||||
* @param remark
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void changeIntegral(int patientId, int addIntegral, String remark) {
|
||||
PatientInfo patientInfo = patientInfoMapper.selectById(patientId);
|
||||
if(patientInfo==null){
|
||||
throw new MessageException("会员不存在");
|
||||
}
|
||||
Integer beforeIntegral = patientInfo.getIntegralBalance();
|
||||
Integer finalIntegral = beforeIntegral + addIntegral;
|
||||
PatientInfo updatePatient = new PatientInfo();
|
||||
updatePatient.setId(patientId);
|
||||
updatePatient.setIntegralBalance(finalIntegral);
|
||||
patientInfoMapper.updateById(updatePatient);
|
||||
//记录日志
|
||||
VipIntegralLog vipIntegralLog = new VipIntegralLog();
|
||||
vipIntegralLog.setBeforeIntegral(beforeIntegral);
|
||||
vipIntegralLog.setAfterIntegral(finalIntegral);
|
||||
vipIntegralLog.setChangeIntegral(addIntegral);
|
||||
vipIntegralLog.setRemark(remark);
|
||||
vipIntegralLog.setCreateTime(LocalDateTime.now());
|
||||
vipIntegralLog.setVipId(patientId);
|
||||
vipIntegralLogMapper.insert(vipIntegralLog);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 新建vip
|
||||
* @param patientInfo
|
||||
*/
|
||||
public void create(PatientInfo patientInfo) {
|
||||
patientInfo.setCreateDatetime(LocalDateTime.now());
|
||||
Integer exp = patientInfo.getExp();
|
||||
if (patientInfo.getBirthday() != null) {
|
||||
int currentYear = LocalDate.now().getYear();
|
||||
int birthYear = patientInfo.getBirthday().getYear();
|
||||
patientInfo.setAge(currentYear - birthYear);
|
||||
}
|
||||
patientInfo.setExp(0);
|
||||
VipLevelConfig level = vipLevelConfigService.getByExp(patientInfo.getExp());
|
||||
if (level != null){
|
||||
patientInfo.setLevelId(level.getLevelId());
|
||||
}else {
|
||||
patientInfo.setLevelId(0);
|
||||
}
|
||||
|
||||
patientInfoMapper.insert(patientInfo);
|
||||
if (exp != null && exp > 0){
|
||||
patientInfoService.changeExp(patientInfo.getId(), exp, "会员创建");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 更新vip基本信息 经验值和积分不更新
|
||||
* @param patientInfo
|
||||
*/
|
||||
public void update(PatientInfo patientInfo) {
|
||||
patientInfo.setExp(null);
|
||||
patientInfo.setLevelId(null);
|
||||
patientInfoMapper.updateById(patientInfo);
|
||||
}
|
||||
|
||||
public int removeById(int vipId) {
|
||||
return patientInfoMapper.deleteById(vipId);
|
||||
}
|
||||
|
||||
/**
|
||||
* vip分页查询
|
||||
* @param keyword
|
||||
* @param pageNum
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
public Page<PatientInfo> pageList(String keyword, int pageNum, int pageSize) {
|
||||
QueryWrapper<PatientInfo> queryWrapper = new QueryWrapper<>();
|
||||
if (keyword != null && !keyword.isEmpty()){
|
||||
queryWrapper.like("name",keyword);
|
||||
queryWrapper.or().like("phone",keyword);
|
||||
queryWrapper.or().like("cert_no",keyword);
|
||||
}
|
||||
return pageHelper(pageNum, pageSize, queryWrapper, patientInfoMapper, "create_datetime", false);
|
||||
}
|
||||
|
||||
public PatientInfo getById(int id) {
|
||||
return patientInfoMapper.selectById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据名称 手机号 身份证搜索vip
|
||||
* @param keyword
|
||||
* @return
|
||||
*/
|
||||
public List<PatientInfo> search(String keyword) {
|
||||
QueryWrapper<PatientInfo> query = new QueryWrapper<>();
|
||||
query.like("name", keyword);
|
||||
query.or().like("phone", keyword);
|
||||
query.or().like("cert_no", keyword);
|
||||
return patientInfoMapper.selectList(query);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 改变vip等级
|
||||
* @param patientId
|
||||
* @param levelId
|
||||
*/
|
||||
public void changeLevel(int patientId, int levelId) {
|
||||
QueryWrapper<VipLevelConfig> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("level_id", levelId);
|
||||
VipLevelConfig levelConfig = vipLevelConfigMapper.selectOne(queryWrapper);
|
||||
if (levelConfig == null) {
|
||||
throw new MessageException("等级不存在");
|
||||
}
|
||||
PatientInfo patientInfo = patientInfoMapper.selectById(patientId);
|
||||
int changeExp = levelConfig.getStartExp() - patientInfo.getExp();
|
||||
patientInfoService.changeExp(patientId, changeExp, "会员等级修改");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 刷新所有vip等级信息
|
||||
*/
|
||||
public void reFreshAllVipLevel() {
|
||||
//更新所有vip的等级
|
||||
QueryWrapper<PatientInfo> patientQuery = new QueryWrapper<>();
|
||||
patientQuery.select("id,exp");
|
||||
List<PatientInfo> patientList = patientInfoMapper.selectList(patientQuery);
|
||||
Iterator<PatientInfo> iterator = patientList.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
PatientInfo patientInfo = iterator.next();
|
||||
VipLevelConfig levelConfig = vipLevelConfigService.getByExp(patientInfo.getExp());
|
||||
if (levelConfig != null) {
|
||||
patientInfo.setLevelId(levelConfig.getLevelId());
|
||||
} else {
|
||||
patientInfo.setLevelId(0);
|
||||
}
|
||||
patientInfo.setExp(null);
|
||||
|
||||
}
|
||||
patientInfoMapper.updateById(patientList);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,9 @@ import com.syjiaer.clinic.server.entity.organization.OrganizationSection;
|
|||
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.dto.RegistrationSaveDto;
|
||||
import com.syjiaer.clinic.server.entity.patient.vo.PatientAndRegistrationInfoVo;
|
||||
import com.syjiaer.clinic.server.entity.patient.vo.PatientRegistrationVo;
|
||||
import com.syjiaer.clinic.server.mapper.organization.OrganizationMemberMapper;
|
||||
import com.syjiaer.clinic.server.mapper.organization.OrganizationSectionMapper;
|
||||
import com.syjiaer.clinic.server.mapper.patient.PatientInfoMapper;
|
||||
|
|
@ -43,6 +45,8 @@ public class PatientRegistrationService extends BaseService {
|
|||
@Autowired
|
||||
private PatientInfoMapper patientInfoMapper;
|
||||
@Autowired
|
||||
private PatientInfoService patientInfoService;
|
||||
@Autowired
|
||||
private OrganizationMemberMapper organizationMemberMapper;
|
||||
@Autowired
|
||||
private OrganizationSectionMapper organizationSectionMapper;
|
||||
|
|
@ -58,11 +62,18 @@ public class PatientRegistrationService extends BaseService {
|
|||
* @param patientRegistrationParam 挂号信息
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public PatientRegistration registration(PatientRegistration registrationParam,String mdtrtCertType, String mdtrtCertNo) {
|
||||
//TODO 挂号和患者 记录身份证号非必填
|
||||
public PatientRegistration registration(RegistrationSaveDto registrationParam, String mdtrtCertType, String mdtrtCertNo) {
|
||||
if (registrationParam == null) {
|
||||
throw new MessageException("data参数为空");
|
||||
}
|
||||
if (registrationParam.getCertType() == null){
|
||||
throw new MessageException("证件类型不能为空");
|
||||
}
|
||||
if (registrationParam.getCertNo() == null){
|
||||
throw new MessageException("证件号码不能为空");
|
||||
}
|
||||
|
||||
|
||||
LocalDateTime now =LocalDateTime.now();
|
||||
String fstNo = StringUtil.getCode("FSN");
|
||||
if (registrationParam.getPatientInfoId() == null){
|
||||
|
|
@ -73,17 +84,11 @@ public class PatientRegistrationService extends BaseService {
|
|||
patientInfo.setPhone(registrationParam.getPhone());
|
||||
patientInfo.setSex(registrationParam.getGender());
|
||||
patientInfo.setAge(registrationParam.getAge());
|
||||
patientInfo.setCertType(registrationParam.getCertType());
|
||||
patientInfo.setCertNo(registrationParam.getCertNo());
|
||||
PatientInfo dbPatientInfo = patientInfoService.save(patientInfo);
|
||||
|
||||
QueryWrapper<PatientInfo> patientInfoQuery = new QueryWrapper<>();
|
||||
patientInfoQuery.eq("phone", registrationParam.getPhone());
|
||||
List<PatientInfo> patientInfoList = patientInfoMapper.selectList(patientInfoQuery);
|
||||
if (patientInfoList.isEmpty()) {
|
||||
patientInfoMapper.insert(patientInfo);
|
||||
} else {
|
||||
patientInfo.setId(patientInfoList.get(0).getId());
|
||||
patientInfoMapper.updateById(patientInfo);
|
||||
}
|
||||
registrationParam.setPatientInfoId(patientInfo.getId());
|
||||
registrationParam.setPatientInfoId(dbPatientInfo.getId());
|
||||
}
|
||||
PatientRegistration registration = new PatientRegistration();
|
||||
BeanUtils.copyProperties(registrationParam, registration);
|
||||
|
|
@ -120,14 +125,11 @@ public class PatientRegistrationService extends BaseService {
|
|||
regisWrapper.set("type",2);
|
||||
regisWrapper.eq("id",registration.getId());
|
||||
patientRegistrationMapper.update(null,regisWrapper);
|
||||
|
||||
|
||||
|
||||
return registration;
|
||||
|
||||
}
|
||||
public PatientRegistration regisByDockerAndPatient(OrganizationMember docker, PatientInfo patient, Short type, Integer status){
|
||||
PatientRegistration registration = new PatientRegistration();
|
||||
RegistrationSaveDto registration = new RegistrationSaveDto();
|
||||
//病人信息
|
||||
registration.setPatientInfoId(patient.getId());
|
||||
registration.setName(patient.getName());
|
||||
|
|
@ -143,6 +145,8 @@ public class PatientRegistrationService extends BaseService {
|
|||
registration.setCreateDatetime(LocalDateTime.now());
|
||||
registration.setRegistrationMoney(BigDecimal.valueOf(0));
|
||||
registration.setDelFlag(0);
|
||||
|
||||
|
||||
return patientRegistrationService.registration(registration,null,null);
|
||||
}
|
||||
|
||||
|
|
@ -181,8 +185,19 @@ public class PatientRegistrationService extends BaseService {
|
|||
* 根据id查询挂号信息
|
||||
* @param id 挂号id
|
||||
*/
|
||||
public PatientRegistration getById(int id) {
|
||||
return patientRegistrationMapper.selectById(id);
|
||||
public PatientRegistrationVo getById(int id) {
|
||||
PatientRegistrationVo registrationVo = new PatientRegistrationVo();
|
||||
PatientRegistration registration = patientRegistrationMapper.selectById(id);
|
||||
if (registration == null){
|
||||
throw new MessageException("id不存在");
|
||||
}
|
||||
BeanUtils.copyProperties(registration, registrationVo);
|
||||
PatientInfo patientInfo = patientInfoMapper.selectById(registration.getPatientInfoId());
|
||||
if (patientInfo != null){
|
||||
registrationVo.setCertNo(patientInfo.getCertNo());
|
||||
registrationVo.setCertType(patientInfo.getCertType());
|
||||
}
|
||||
return registrationVo;
|
||||
}
|
||||
/*
|
||||
* 获取所有已删除挂号信息
|
||||
|
|
@ -292,10 +307,10 @@ public class PatientRegistrationService extends BaseService {
|
|||
if (patientRegistration == null){
|
||||
throw new MessageException("挂号单不存在");
|
||||
}
|
||||
if (statusEnum.equals(RegistrationStatusEnum.waiting) && !patientRegistration.getStatus().equals(RegistrationStatusEnum.inProgress.getType())){
|
||||
if (statusEnum.equals(RegistrationStatusEnum.waiting) && !patientRegistration.getStatus().equals(RegistrationStatusEnum.inProgress.getStatus())){
|
||||
throw new MessageException("初始状态不对");
|
||||
}
|
||||
if (statusEnum.equals(RegistrationStatusEnum.cancel) && !patientRegistration.getStatus().equals(RegistrationStatusEnum.inProgress.getType())){
|
||||
if (statusEnum.equals(RegistrationStatusEnum.cancel) && !patientRegistration.getStatus().equals(RegistrationStatusEnum.inProgress.getStatus())){
|
||||
throw new MessageException("初始状态不对");
|
||||
}
|
||||
PatientRegistration updateRegistration = new PatientRegistration();
|
||||
|
|
|
|||
|
|
@ -2,18 +2,21 @@ package com.syjiaer.clinic.server.service.statistics;
|
|||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.syjiaer.clinic.server.common.enums.GoodsTypeEnum;
|
||||
import com.syjiaer.clinic.server.common.enums.RegistrationStatusEnum;
|
||||
import com.syjiaer.clinic.server.common.enums.RetailOrderPayTypeEnum;
|
||||
import com.syjiaer.clinic.server.common.enums.RetailOrderStatusEnum;
|
||||
import com.syjiaer.clinic.server.common.util.DateUtil;
|
||||
import com.syjiaer.clinic.server.entity.charge.ChargeGoodsList;
|
||||
import com.syjiaer.clinic.server.entity.charge.ChargeItemList;
|
||||
import com.syjiaer.clinic.server.entity.charge.ChargeOrder;
|
||||
import com.syjiaer.clinic.server.entity.statistics.GoodsTypeRevenue;
|
||||
import com.syjiaer.clinic.server.entity.statistics.PayTypeRevenue;
|
||||
import com.syjiaer.clinic.server.entity.statistics.PersonPayOverviewVo;
|
||||
import com.syjiaer.clinic.server.entity.statistics.RevenueOverviewVo;
|
||||
import com.syjiaer.clinic.server.entity.diagnosis.Diagnosis;
|
||||
import com.syjiaer.clinic.server.entity.organization.OrganizationMember;
|
||||
import com.syjiaer.clinic.server.entity.patient.PatientRegistration;
|
||||
import com.syjiaer.clinic.server.entity.statistics.*;
|
||||
import com.syjiaer.clinic.server.mapper.charge.ChargeGoodsListMapper;
|
||||
import com.syjiaer.clinic.server.mapper.charge.ChargeOrderMapper;
|
||||
import com.syjiaer.clinic.server.mapper.diagnosis.DiagnosisMapper;
|
||||
import com.syjiaer.clinic.server.mapper.organization.OrganizationMemberMapper;
|
||||
import com.syjiaer.clinic.server.mapper.patient.PatientRegistrationMapper;
|
||||
import com.syjiaer.clinic.server.service.BaseService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -29,6 +32,13 @@ public class StatisticsService extends BaseService {
|
|||
private ChargeOrderMapper chargeOrderMapper;
|
||||
@Autowired
|
||||
private ChargeGoodsListMapper chargeGoodsListMapper;
|
||||
@Autowired
|
||||
private OrganizationMemberMapper organizationMemberMapper;
|
||||
@Autowired
|
||||
private PatientRegistrationMapper patientRegistrationMapper;
|
||||
@Autowired
|
||||
private DiagnosisMapper diagnosisMapper;
|
||||
|
||||
public RevenueOverviewVo getRevenueOverview(LocalDateTime begin, LocalDateTime end) {
|
||||
RevenueOverviewVo overviewVo = new RevenueOverviewVo();
|
||||
QueryWrapper<ChargeOrder> queryWrapper = new QueryWrapper<>();
|
||||
|
|
@ -39,11 +49,19 @@ public class StatisticsService extends BaseService {
|
|||
Map<String, Object> map = chargeOrderMapper.selectMaps(queryWrapper).get(0);
|
||||
overviewVo.setTotalRevenue((BigDecimal) map.getOrDefault("total_revenue", new BigDecimal(0)));
|
||||
overviewVo.setTotalOrderCount((Long) map.getOrDefault("total_order_count", new BigDecimal(0)));
|
||||
//
|
||||
// queryWrapper.isNotNull("vip_id");
|
||||
// Map<String, Object> vipMap = retailOrderService.getMap(queryWrapper);
|
||||
// overviewVo.setVipRevenue((BigDecimal) vipMap.getOrDefault("total_revenue",new BigDecimal(0)));
|
||||
// overviewVo.setVipOrderCount((Long) vipMap.getOrDefault("total_order_count",new BigDecimal(0)));
|
||||
|
||||
//医保概况数据
|
||||
QueryWrapper<ChargeOrder> socialQuery = new QueryWrapper<>();
|
||||
socialQuery.select("sum(total_price) as total_revenue,count(*) as total_order_count");
|
||||
socialQuery.ge("pay_time", begin);
|
||||
socialQuery.le("pay_time", end);
|
||||
socialQuery.eq("pay_type", RetailOrderPayTypeEnum.MEDICARE.getCode());
|
||||
socialQuery.eq("status", RetailOrderStatusEnum.FINISHED.getCode());
|
||||
Map<String, Object> socialMap = chargeOrderMapper.selectMaps(socialQuery).get(0);
|
||||
overviewVo.setSocialRevenue((BigDecimal) socialMap.getOrDefault("total_revenue", new BigDecimal(0)));
|
||||
overviewVo.setSocialOrderCount((Long) socialMap.getOrDefault("total_order_count", new BigDecimal(0)));
|
||||
|
||||
|
||||
|
||||
QueryWrapper<ChargeOrder> payTypeQuery = new QueryWrapper<>();
|
||||
payTypeQuery.ge("pay_time", begin);
|
||||
|
|
@ -58,6 +76,7 @@ public class StatisticsService extends BaseService {
|
|||
List<PayTypeRevenue> payTypeRevenueList = new ArrayList<>();
|
||||
for (Map<String, Object> payTypeMap : payTypeMaps) {
|
||||
PayTypeRevenue revenue = new PayTypeRevenue();
|
||||
revenue.setPayType((Integer) payTypeMap.get("pay_type"));
|
||||
revenue.setName(RetailOrderPayTypeEnum.getByCode((Integer) payTypeMap.get("pay_type")).getDesc());
|
||||
revenue.setTotalRevenue((BigDecimal) payTypeMap.getOrDefault("total_revenue", new BigDecimal(0)));
|
||||
payTypeRevenueList.add(revenue);
|
||||
|
|
@ -87,6 +106,7 @@ public class StatisticsService extends BaseService {
|
|||
|
||||
|
||||
|
||||
|
||||
return overviewVo;
|
||||
}
|
||||
|
||||
|
|
@ -130,4 +150,90 @@ public class StatisticsService extends BaseService {
|
|||
return personPayOverview;
|
||||
|
||||
}
|
||||
|
||||
public List<SalePersonReportVo> salePersonReport() {
|
||||
List<Map<String, Object>> maps = chargeOrderMapper.selectSaleReport();
|
||||
Map<Integer, SalePersonReportVo> voMaps = new HashMap<>();
|
||||
for (Map<String, Object> map : maps) {
|
||||
Integer salePersonId = (Integer) map.get("sale_person_id");
|
||||
SalePersonReportVo vo = voMaps.getOrDefault(salePersonId, new SalePersonReportVo());
|
||||
vo.setSalePersonId(salePersonId);
|
||||
if (salePersonId != null){
|
||||
OrganizationMember organizationMember = organizationMemberMapper.selectById(salePersonId);
|
||||
vo.setSalePersonName(organizationMember.getName());
|
||||
}
|
||||
vo.setTotalIncome(vo.getTotalIncome().add((BigDecimal) map.get("sum")));
|
||||
vo.setCount(vo.getCount()+(Long) map.get("count"));
|
||||
RetailOrderPayTypeEnum payType = RetailOrderPayTypeEnum.getByCode((Integer) map.get("pay_type"));
|
||||
if (payType == null){
|
||||
continue;
|
||||
}
|
||||
switch (payType) {
|
||||
case WXPAY:
|
||||
vo.setWechatIncome(vo.getWechatIncome().add((BigDecimal) map.get("sum")));
|
||||
break;
|
||||
case ALIPAY:
|
||||
vo.setAliPayIncome(vo.getAliPayIncome().add((BigDecimal) map.get("sum")));
|
||||
break;
|
||||
case CASH:
|
||||
vo.setCashIncome(vo.getCashIncome().add((BigDecimal) map.get("sum")));
|
||||
break;
|
||||
case OTHER:
|
||||
vo.setOtherIncome(vo.getOtherIncome().add((BigDecimal) map.get("sum")));
|
||||
break;
|
||||
case MEDICARE:
|
||||
vo.setSocialIncome(vo.getSocialIncome().add((BigDecimal) map.get("sum")));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
voMaps.put(salePersonId, vo);
|
||||
}
|
||||
List<SalePersonReportVo> result = voMaps.values().stream().toList();
|
||||
return result;
|
||||
}
|
||||
|
||||
public TipCountVo getWaitCount(LocalDateTime beginTime, LocalDateTime endTime) {
|
||||
TipCountVo tipCountVo = new TipCountVo();
|
||||
RegistrationStatusEnum registrationStatusEnum = RegistrationStatusEnum.waiting;
|
||||
QueryWrapper<PatientRegistration> registrationWrapper = new QueryWrapper<>();
|
||||
registrationWrapper.lt("create_datetime", endTime);
|
||||
registrationWrapper.ge("create_datetime", beginTime);
|
||||
registrationWrapper.eq("status", registrationStatusEnum.getStatus());
|
||||
registrationWrapper.eq("del_flag",0);
|
||||
tipCountVo.setWaitDiagnosisCount(patientRegistrationMapper.selectCount(registrationWrapper));
|
||||
|
||||
registrationStatusEnum = RegistrationStatusEnum.inProgress;
|
||||
registrationWrapper = new QueryWrapper<>();
|
||||
registrationWrapper.lt("create_datetime", endTime);
|
||||
registrationWrapper.ge("create_datetime", beginTime);
|
||||
registrationWrapper.eq("status", registrationStatusEnum.getStatus());
|
||||
registrationWrapper.eq("del_flag",0);
|
||||
tipCountVo.setDiagnosingCount(patientRegistrationMapper.selectCount(registrationWrapper));
|
||||
|
||||
registrationStatusEnum = RegistrationStatusEnum.complete;
|
||||
registrationWrapper = new QueryWrapper<>();
|
||||
registrationWrapper.lt("create_datetime", endTime);
|
||||
registrationWrapper.ge("create_datetime", beginTime);
|
||||
registrationWrapper.eq("status", registrationStatusEnum.getStatus());
|
||||
registrationWrapper.eq("del_flag",0);
|
||||
tipCountVo.setCompleteDiaCount(patientRegistrationMapper.selectCount(registrationWrapper));
|
||||
|
||||
|
||||
QueryWrapper<Diagnosis> diagnosisWrapper = new QueryWrapper<>();
|
||||
diagnosisWrapper.lt("create_time", endTime);
|
||||
diagnosisWrapper.ge("create_time", beginTime);
|
||||
diagnosisWrapper.eq("status", 0);
|
||||
tipCountVo.setUnchargedCount(diagnosisMapper.selectCount(diagnosisWrapper));
|
||||
|
||||
diagnosisWrapper = new QueryWrapper<>();
|
||||
diagnosisWrapper.lt("create_time", endTime);
|
||||
diagnosisWrapper.ge("create_time", beginTime);
|
||||
diagnosisWrapper.eq("status", 1);
|
||||
tipCountVo.setChargedCount(diagnosisMapper.selectCount(diagnosisWrapper));
|
||||
|
||||
return tipCountVo;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,9 +4,11 @@ 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.vo.Page;
|
||||
import com.syjiaer.clinic.server.entity.patient.PatientInfo;
|
||||
import com.syjiaer.clinic.server.entity.vip.Vip;
|
||||
import com.syjiaer.clinic.server.entity.vip.VipIntegralLog;
|
||||
import com.syjiaer.clinic.server.entity.vip.dto.VipIntegralLogQuery;
|
||||
import com.syjiaer.clinic.server.mapper.patient.PatientInfoMapper;
|
||||
import com.syjiaer.clinic.server.mapper.vip.VipIntegralLogMapper;
|
||||
import com.syjiaer.clinic.server.mapper.vip.VipLevelConfigMapper;
|
||||
import com.syjiaer.clinic.server.mapper.vip.VipMapper;
|
||||
|
|
@ -18,12 +20,10 @@ import java.util.List;
|
|||
|
||||
@Service
|
||||
public class VipIntegralLogService extends BaseService {
|
||||
@Autowired
|
||||
private VipMapper vipMapper;
|
||||
@Autowired
|
||||
private VipLevelConfigMapper vipLevelConfigMapper;
|
||||
@Autowired
|
||||
private VipIntegralLogMapper vipIntegralLogMapper;
|
||||
@Autowired
|
||||
private PatientInfoMapper patientInfoMapper;
|
||||
|
||||
public Page<VipIntegralLog> pageList(VipIntegralLogQuery query) {
|
||||
if (query == null){
|
||||
|
|
@ -35,12 +35,12 @@ public class VipIntegralLogService extends BaseService {
|
|||
if (query.getPageSize() == null || query.getPageSize() == 0){
|
||||
query.setPageSize(Constants.DetailPageSize);
|
||||
}
|
||||
Vip vip = null;
|
||||
PatientInfo patientInfo = null;
|
||||
if (query.getVipId() != null){
|
||||
vip = vipMapper.selectById(query.getVipId());
|
||||
patientInfo = patientInfoMapper.selectById(query.getVipId());
|
||||
}
|
||||
if (vip == null){
|
||||
throw new MessageException("会员不存在");
|
||||
if (patientInfo == null){
|
||||
throw new MessageException("患者不存在");
|
||||
}
|
||||
|
||||
QueryWrapper<VipIntegralLog> queryWrapper = new QueryWrapper<>();
|
||||
|
|
|
|||
|
|
@ -5,7 +5,9 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|||
import com.syjiaer.clinic.server.entity.vip.VipLevelConfig;
|
||||
import com.syjiaer.clinic.server.mapper.vip.VipLevelConfigMapper;
|
||||
import com.syjiaer.clinic.server.service.BaseService;
|
||||
import com.syjiaer.clinic.server.service.patient.PatientInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
|
@ -17,7 +19,7 @@ public class VipLevelConfigService extends BaseService {
|
|||
@Autowired
|
||||
private VipLevelConfigMapper vipLevelConfigMapper;
|
||||
@Autowired
|
||||
private VipService vipService;
|
||||
private PatientInfoService patientInfoService;
|
||||
|
||||
/**
|
||||
* 根据经验值获取会员等级
|
||||
|
|
@ -102,14 +104,14 @@ public class VipLevelConfigService extends BaseService {
|
|||
for (VipLevelConfig levelConfig : insertList){
|
||||
vipLevelConfigMapper.insert(levelConfig);
|
||||
}
|
||||
vipService.reFreshAllVipLevel();
|
||||
patientInfoService.reFreshAllVipLevel();
|
||||
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer delete(int id) {
|
||||
Integer count = vipLevelConfigMapper.deleteById(id);
|
||||
vipService.reFreshAllVipLevel();
|
||||
patientInfoService.reFreshAllVipLevel();
|
||||
return count;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,4 +2,17 @@
|
|||
<!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.organization.OrganizationMemberMapper">
|
||||
|
||||
<select id="selectDetailByQuery" resultType="com.syjiaer.clinic.server.entity.organization.vo.MemberVo">
|
||||
SELECT om.*,os.name AS section_name
|
||||
FROM organization_member AS om LEFT JOIN organization_section AS os ON om.section_id = os.id
|
||||
<where>
|
||||
<if test="keyword != null and keyword != ''">
|
||||
(om.name LIKE concat('%', #{keyword}, '%')
|
||||
or os.name LIKE concat('%', #{keyword}, '%'))
|
||||
</if>
|
||||
<if test="role != null">
|
||||
And om.role = #{role}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
*
|
||||
!.gitignore
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
package com.syjiaer.clinic.server;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.syjiaer.clinic.server.common.api.input.IM9001;
|
||||
import com.syjiaer.clinic.server.common.api.request.SocialRequest;
|
||||
import com.syjiaer.clinic.server.service.charge.ChargeService;
|
||||
import com.syjiaer.clinic.server.service.diagnosis.MedicalRecordService;
|
||||
import com.syjiaer.clinic.server.service.social.SocialDiagnoseService;
|
||||
import com.syjiaer.clinic.server.service.social.SocialItemService;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@SpringBootTest
|
||||
class ServerApplicationTests {
|
||||
|
||||
@Autowired
|
||||
private MedicalRecordService medicalRecordService;
|
||||
@Autowired
|
||||
private SocialDiagnoseService socialDiagnoseService;
|
||||
@Autowired
|
||||
private SocialItemService socialItemService;
|
||||
@Autowired
|
||||
private ChargeService chargeService;
|
||||
@Autowired
|
||||
private SocialRequest socialRequest;
|
||||
@Test
|
||||
void contextLoads() {
|
||||
// chargeService.uploadCostDetails("CO20250424130233778296");
|
||||
// String meCode = "AD1537643";
|
||||
// String medType = "03";
|
||||
// String in = "310";
|
||||
// chargeService.socialPrePay("CO20250424130233778296",medType,meCode,"310");
|
||||
String meCode = "AD1537643|eZFLx0k4i8izV3NdLvOKRF16BQ6yCj3Cv+PS4dyDK/fy4l30EzRhIDFV5W0E+jZVkPFpsUkVVUU0WX+58IafhGQxzYO25uuEaZkwhDFyPF+RbV14gcURcjR7BjU8m+xWQV1jmrEygKcJ0fbjtdEZrjZRgjNtiz+KCqw5qeWlkvtfcI/pnYeD6Y0CI64KnBGFfMxd9n2pM2GnZp08tJRb/50KnDqwZY1tHLNmiCX0Cnk=";
|
||||
chargeService.socialRealPay("CO20250424130233778296","03",meCode,"310");
|
||||
|
||||
}
|
||||
@Test
|
||||
void text(){
|
||||
IM9001 im9001 = new IM9001();
|
||||
im9001.setOpter_no("0");
|
||||
im9001.setMac("00-FF-F2-10-61-2D");
|
||||
im9001.setIp("10.42.131.10");
|
||||
socialRequest.call9001(im9001);
|
||||
}
|
||||
@Test
|
||||
void test(){
|
||||
socialItemService.download("F002_20210915000001_A");
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue