|
|
@@ -23,6 +23,7 @@ import cn.hnthyy.thmz.mapper.his.yp.YpMzFytjMapper;
|
|
|
import cn.hnthyy.thmz.mapper.his.zd.JcZdItemMapper;
|
|
|
import cn.hnthyy.thmz.mapper.his.zd.MzZdYpYshMapper;
|
|
|
import cn.hnthyy.thmz.mapper.thmz.ClinicMapper;
|
|
|
+import cn.hnthyy.thmz.mapper.thmz.ConfigMapper;
|
|
|
import cn.hnthyy.thmz.mapper.thmz.WindowsMapper;
|
|
|
import cn.hnthyy.thmz.pageDto.MzChargeDetailPageDto;
|
|
|
import cn.hnthyy.thmz.service.his.ResponceTypeService;
|
|
|
@@ -121,6 +122,9 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
private WindowsMapper windowsMapper;
|
|
|
@SuppressWarnings("all")
|
|
|
@Autowired
|
|
|
+ private ConfigMapper configMapper;
|
|
|
+ @SuppressWarnings("all")
|
|
|
+ @Autowired
|
|
|
private MzYpFydlMapper mzYpFydlMapper;
|
|
|
@SuppressWarnings("all")
|
|
|
@Autowired
|
|
|
@@ -2378,6 +2382,12 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
if (num > 0) {
|
|
|
throw new MzException("您在今天已经采过样了,请不要重复申请!");
|
|
|
}
|
|
|
+
|
|
|
+ String title="核酸单人单管申请";
|
|
|
+ String hybirdNumberKey="single_hybird_number";
|
|
|
+ String hybirdTimeKey="single_hybird_time";
|
|
|
+ int totalNum=mzYjReqMapper.selectTotalReqByCode(DateUtil.getFirstSecond(),DateUtil.getLastSecond());
|
|
|
+ checkHybrid(title, hybirdNumberKey, hybirdTimeKey, totalNum);
|
|
|
//自助开核酸的时候更新病人年龄
|
|
|
if (mzPatientMi.getBirthDay() != null) {
|
|
|
int age = DateUtil.getAge(mzPatientMi.getBirthDay());
|
|
|
@@ -2423,6 +2433,9 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
|
|
|
@Override
|
|
|
public Clinic hybridTestApplication(String patientId, String opId) throws MzException {
|
|
|
+ //单人单管最大人数
|
|
|
+ int personNumber = 20;
|
|
|
+ //int personNumber = 2;
|
|
|
MzPatientMi mzPatientMi = mzPatientMiMapper.selectByPatientId(patientId);
|
|
|
if (mzPatientMi == null) {
|
|
|
throw new MzException("当前挂号的病人信息不存在,请先保存病人信息!");
|
|
|
@@ -2431,6 +2444,11 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
if (num > 0) {
|
|
|
throw new MzException("您在今天已经采过样了,请不要重复申请!");
|
|
|
}
|
|
|
+ String title="混采";
|
|
|
+ String hybirdNumberKey="hybird_number";
|
|
|
+ String hybirdTimeKey="hybird_time";
|
|
|
+ int totalNum=mzChargeDetailMapper.selectTotalReqByCode(Constants.HYBRID_TEST_CHARGE_CODE,DateUtil.getFirstSecond(),DateUtil.getLastSecond());
|
|
|
+ checkHybrid(title, hybirdNumberKey, hybirdTimeKey, totalNum/personNumber);
|
|
|
//自助开核酸的时候更新病人年龄
|
|
|
if (mzPatientMi.getBirthDay() != null) {
|
|
|
int age = DateUtil.getAge(mzPatientMi.getBirthDay());
|
|
|
@@ -2489,6 +2507,37 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
return savePrescription(mzPrescriptionVo, null);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 校验核酸申请是否已经达到最大值
|
|
|
+ * @param title
|
|
|
+ * @param hybirdNumberKey
|
|
|
+ * @param hybirdTimeKey
|
|
|
+ * @param totalNum
|
|
|
+ * @throws MzException
|
|
|
+ */
|
|
|
+ private void checkHybrid(String title, String hybirdNumberKey, String hybirdTimeKey, int totalNum) throws MzException {
|
|
|
+ Config config=configMapper.selectUserByKey(hybirdNumberKey);
|
|
|
+ if(config==null || StringUtils.isBlank(config.getConfigValue())){
|
|
|
+ throw new MzException(title+"最大数参数为空!");
|
|
|
+ }
|
|
|
+ Integer hybirdNumber =Integer.valueOf(config.getConfigValue());
|
|
|
+ if(totalNum>=hybirdNumber){
|
|
|
+ throw new MzException("抱歉,"+title+"人数以达到最大数值,无法继续采样!");
|
|
|
+ }
|
|
|
+ config=configMapper.selectUserByKey(hybirdTimeKey);
|
|
|
+ if(config==null || StringUtils.isBlank(config.getConfigValue())){
|
|
|
+ throw new MzException(title+"时间参数为空!");
|
|
|
+ }
|
|
|
+ String [] arr =config.getConfigValue().replaceAll(":","").split("-");
|
|
|
+ if(arr==null || arr.length!=2){
|
|
|
+ throw new MzException(title+"时间参数错误!");
|
|
|
+ }
|
|
|
+ Integer currentTimes = Integer.valueOf(DateUtil.fomart(new Date(),"HH:mm").replace(":",""));
|
|
|
+ if(currentTimes<Integer.valueOf(arr[0]) || currentTimes> Integer.valueOf(arr[1])){
|
|
|
+ throw new MzException("当前时间段无法进行"+title+",请选择其他核酸检验或者改日进行!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public Clinic nucleicOnlyYellowAcidApplication(String patientId, String opId) throws MzException {
|
|
|
return getNucleicAcidApplication(patientId, opId, Constants.NUCLEIC_ORDER_ONLY_YELLOW_CODE);
|