dev
This commit is contained in:
parent
c0e343a34c
commit
7526810a13
|
|
@ -8,8 +8,10 @@ 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.MedicalHistoryVo;
|
||||
import com.syjiaer.clinic.server.entity.diagnosis.vo.MedicalRecordVo;
|
||||
import com.syjiaer.clinic.server.entity.patient.PatientRegistration;
|
||||
import com.syjiaer.clinic.server.entity.patient.vo.SeeDoctorInfoVo;
|
||||
import com.syjiaer.clinic.server.service.diagnosis.MedicalRecordService;
|
||||
import com.syjiaer.clinic.server.service.patient.PatientRegistrationService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
|
@ -22,16 +24,18 @@ public class MedicalRecordController extends BaseController {
|
|||
|
||||
@Autowired
|
||||
private MedicalRecordService medicalRecordService;
|
||||
@Autowired
|
||||
private PatientRegistrationService patientRegistrationService;
|
||||
|
||||
/**
|
||||
* 保存病历
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/save")
|
||||
public Result<Object> save() {
|
||||
public Result<PatientRegistration> save() {
|
||||
MedicalRecordSaveDto saveDto = parmsUtil.getObject("data", MedicalRecordSaveDto.class);
|
||||
medicalRecordService.save(saveDto);
|
||||
return success();
|
||||
return success( patientRegistrationService.getById(saveDto.getRegistrationId()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ public class RegistrationController extends BaseController {
|
|||
if (id == null) {
|
||||
throw new MessageException("id参数为空");
|
||||
}
|
||||
PatientRegistrationVo result = patientRegistrationService.getById(id);
|
||||
PatientRegistrationVo result = patientRegistrationService.getVoById(id);
|
||||
return success(result);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,12 @@
|
|||
package com.syjiaer.clinic.server.entity.statistics;
|
||||
|
||||
import com.syjiaer.clinic.server.common.enums.GoodsTypeEnum;
|
||||
import com.syjiaer.clinic.server.common.enums.RetailOrderPayTypeEnum;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -25,7 +28,53 @@ public class RevenueOverviewVo {
|
|||
|
||||
private List<PayTypeRevenue> payTypeRevenue;
|
||||
|
||||
public RevenueOverviewVo() {
|
||||
|
||||
this.totalRevenue = new BigDecimal(0);
|
||||
this.socialRevenue = new BigDecimal(0);
|
||||
this.totalOrderCount = 0L;
|
||||
this.socialOrderCount = 0L;
|
||||
List<PayTypeRevenue> PayTypeRevenueList = new ArrayList<>();
|
||||
for (RetailOrderPayTypeEnum payTypeEnum: RetailOrderPayTypeEnum.values()){
|
||||
PayTypeRevenue payTypeRevenue = new PayTypeRevenue();
|
||||
payTypeRevenue.setPayType(payTypeEnum.getCode());
|
||||
payTypeRevenue.setName(payTypeEnum.getDesc());
|
||||
payTypeRevenue.setTotalRevenue(new BigDecimal(0));
|
||||
PayTypeRevenueList.add(payTypeRevenue);
|
||||
}
|
||||
this.payTypeRevenue = PayTypeRevenueList;
|
||||
|
||||
List<GoodsTypeRevenue> goodsTypeRevenueList = new ArrayList<>();
|
||||
for (GoodsTypeEnum typeEnum : GoodsTypeEnum.values()){
|
||||
GoodsTypeRevenue goodsTypeRevenue = new GoodsTypeRevenue();
|
||||
goodsTypeRevenue.setName(typeEnum.getDesc());
|
||||
goodsTypeRevenue.setTotalRevenue(new BigDecimal(0));
|
||||
goodsTypeRevenueList.add(goodsTypeRevenue);
|
||||
}
|
||||
this.goodsTypeRevenue = goodsTypeRevenueList;
|
||||
}
|
||||
|
||||
public void setPayType(Integer payType, BigDecimal totalRevenue){
|
||||
RetailOrderPayTypeEnum payTypeEnum = RetailOrderPayTypeEnum.getByCode(payType);
|
||||
if (payTypeEnum == null){
|
||||
return;
|
||||
}
|
||||
for (PayTypeRevenue payTypeRevenue : payTypeRevenue){
|
||||
if (payTypeRevenue.getPayType().equals(payType)){
|
||||
payTypeRevenue.setTotalRevenue(payTypeRevenue.getTotalRevenue().add(totalRevenue));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setGoodsType(Integer goodsType, BigDecimal totalRevenue){
|
||||
GoodsTypeEnum typeEnum = GoodsTypeEnum.getByType(goodsType);
|
||||
if (typeEnum == null){
|
||||
return;
|
||||
}
|
||||
for (GoodsTypeRevenue goodsTypeRevenue : goodsTypeRevenue){
|
||||
if (goodsTypeRevenue.getName().equals(typeEnum.getDesc())){
|
||||
goodsTypeRevenue.setTotalRevenue(goodsTypeRevenue.getTotalRevenue().add(totalRevenue));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ public class PatientRegistrationService extends BaseService {
|
|||
* 根据id查询挂号信息
|
||||
* @param id 挂号id
|
||||
*/
|
||||
public PatientRegistrationVo getById(int id) {
|
||||
public PatientRegistrationVo getVoById(int id) {
|
||||
PatientRegistrationVo registrationVo = new PatientRegistrationVo();
|
||||
PatientRegistration registration = patientRegistrationMapper.selectById(id);
|
||||
if (registration == null){
|
||||
|
|
@ -178,6 +178,13 @@ public class PatientRegistrationService extends BaseService {
|
|||
}
|
||||
return registrationVo;
|
||||
}
|
||||
public PatientRegistration getById(int id) {
|
||||
PatientRegistration registration = patientRegistrationMapper.selectById(id);
|
||||
if (registration == null){
|
||||
throw new MessageException("id不存在");
|
||||
}
|
||||
return registration;
|
||||
}
|
||||
/*
|
||||
* 获取所有已删除挂号信息
|
||||
* @param id 挂号id
|
||||
|
|
@ -292,6 +299,9 @@ public class PatientRegistrationService extends BaseService {
|
|||
if (patientRegistration == null){
|
||||
throw new MessageException("挂号单不存在");
|
||||
}
|
||||
if (statusEnum==null){
|
||||
throw new MessageException("状态值不对");
|
||||
}
|
||||
if (statusEnum.equals(RegistrationStatusEnum.waiting) && !patientRegistration.getStatus().equals(RegistrationStatusEnum.inProgress.getStatus())){
|
||||
throw new MessageException("初始状态不对");
|
||||
}
|
||||
|
|
@ -304,4 +314,5 @@ public class PatientRegistrationService extends BaseService {
|
|||
patientRegistrationMapper.updateById(updateRegistration);
|
||||
return patientRegistrationMapper.selectById(regisId);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,15 +73,9 @@ public class StatisticsService extends BaseService {
|
|||
payTypeQuery.groupBy("pay_type");
|
||||
|
||||
List<Map<String, Object>> payTypeMaps = chargeOrderMapper.selectMaps(payTypeQuery);
|
||||
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);
|
||||
overviewVo.setPayType((Integer) payTypeMap.get("pay_type"), (BigDecimal) payTypeMap.getOrDefault("total_revenue", new BigDecimal(0)));
|
||||
}
|
||||
overviewVo.setPayTypeRevenue(payTypeRevenueList);
|
||||
List<String> retailOrderCodes = chargeOrders.stream().map(ChargeOrder::getCode).toList();
|
||||
QueryWrapper<ChargeGoodsList> retailListQuery = new QueryWrapper<>();
|
||||
retailListQuery.select("type,sum(sub_total_price) as total_revenue");
|
||||
|
|
@ -94,15 +88,9 @@ public class StatisticsService extends BaseService {
|
|||
goodsTypeMaps = chargeGoodsListMapper.selectMaps(retailListQuery);
|
||||
}
|
||||
|
||||
|
||||
List<GoodsTypeRevenue> goodsTypeRevenuesList = new ArrayList<>();
|
||||
for (Map<String, Object> goodsTypeMap : goodsTypeMaps) {
|
||||
GoodsTypeRevenue goodsTypeRevenue = new GoodsTypeRevenue();
|
||||
goodsTypeRevenue.setName(GoodsTypeEnum.getByType((Integer) goodsTypeMap.get("type")).getDesc());
|
||||
goodsTypeRevenue.setTotalRevenue((BigDecimal) goodsTypeMap.getOrDefault("total_revenue", new BigDecimal(0)));
|
||||
goodsTypeRevenuesList.add(goodsTypeRevenue);
|
||||
overviewVo.setGoodsType((Integer) goodsTypeMap.get("type"), (BigDecimal) goodsTypeMap.getOrDefault("total_revenue", new BigDecimal(0)));
|
||||
}
|
||||
overviewVo.setGoodsTypeRevenue(goodsTypeRevenuesList);
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue