|
|
@@ -10,6 +10,7 @@ import cn.hnthyy.thmz.entity.his.*;
|
|
|
import cn.hnthyy.thmz.enums.PayMarkEnum;
|
|
|
import cn.hnthyy.thmz.enums.YesNoEnum;
|
|
|
import cn.hnthyy.thmz.pageDto.MzChargeDetailPageDto;
|
|
|
+import cn.hnthyy.thmz.pageDto.MzyReqrecPageDto;
|
|
|
import cn.hnthyy.thmz.pageDto.ZdUnitCodePageDto;
|
|
|
import cn.hnthyy.thmz.service.his.*;
|
|
|
import cn.hnthyy.thmz.vo.*;
|
|
|
@@ -56,6 +57,8 @@ public class MedicalViewApiController {
|
|
|
private MzyZdChargeTypeService mzyZdChargeTypeService;
|
|
|
@Autowired
|
|
|
private MzZdWorkTimeService mzZdWorkTimeService;
|
|
|
+ @Autowired
|
|
|
+ private MzyReqrecService mzyReqrecService;
|
|
|
|
|
|
//海慈身份证类型
|
|
|
private static final String ID_CARD_TYPE = "11";
|
|
|
@@ -879,8 +882,6 @@ public class MedicalViewApiController {
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* 预约号源统计信息查询
|
|
|
*
|
|
|
@@ -980,7 +981,6 @@ public class MedicalViewApiController {
|
|
|
}
|
|
|
MzZdWorkTime mzZdWorkTime=mzZdWorkTimeService.queryMzZdWorkTimeByCode(Constants.PM);
|
|
|
SimpleDateFormat simpleDateFormat=new SimpleDateFormat("HH:mm");
|
|
|
- //挂还开始时间取当前时间前15分钟
|
|
|
Date dateEndTime=simpleDateFormat.parse(mzZdWorkTime.getEndTime());
|
|
|
long tsEndTime =dateEndTime.getTime();
|
|
|
String realNowStr = simpleDateFormat.format(new Date());
|
|
|
@@ -991,12 +991,19 @@ public class MedicalViewApiController {
|
|
|
ampms.add(Constants.PM);
|
|
|
}
|
|
|
Date requestDayD = DateUtil.pase(requestDay,"yyyy-MM-dd");
|
|
|
+ Date toDay = DateUtil.pase(new Date(),"yyyy-MM-dd");
|
|
|
+ if(requestDayD.before(toDay)){
|
|
|
+ results.put("resultCode", -1);
|
|
|
+ results.put("resultMessage", "预约挂号时间已过,无法挂号,请重新选择!");
|
|
|
+ return results;
|
|
|
+ }
|
|
|
List<Map<String,Object>> list=mzyRequestService.queryDoctorByDateAndDept(requestDayD,ampms,unitCode);
|
|
|
if (list == null || list.size() == 0) {
|
|
|
results.put("resultCode", -1);
|
|
|
results.put("resultMessage", "没有医生排班信息");
|
|
|
return results;
|
|
|
}
|
|
|
+ List<Map<String,Object>> removeList = new ArrayList<>();
|
|
|
for(Map map :list){
|
|
|
BigDecimal fee = BigDecimal.ZERO;
|
|
|
String chargeType= (String) map.get("chargeType");
|
|
|
@@ -1025,6 +1032,7 @@ public class MedicalViewApiController {
|
|
|
map.remove("checkFee");
|
|
|
String doctorCode= (String) map.get("doctorCode");
|
|
|
if(StringUtils.isBlank(doctorCode)){
|
|
|
+ removeList.add(map);
|
|
|
continue;
|
|
|
}
|
|
|
Employee employee= employeeService.queryByUserCode(doctorCode);
|
|
|
@@ -1040,6 +1048,7 @@ public class MedicalViewApiController {
|
|
|
map.put("doctorTitle",zdEmpTitle.getName());
|
|
|
}
|
|
|
}
|
|
|
+ list.removeAll(removeList);
|
|
|
results.put("resultCode", 0);
|
|
|
results.put("resultMessage", "查询可以挂号的科室内医生信息成功");
|
|
|
results.put("data", list);
|
|
|
@@ -1050,12 +1059,277 @@ public class MedicalViewApiController {
|
|
|
results.put("resultMessage", "查询可以挂号的科室内医生信息失败");
|
|
|
return results;
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询可以挂号的医生号源信息
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/getRequestByDateAndDeptAndDoctor", method = {RequestMethod.GET})
|
|
|
+ public Map<String, Object> getRequestByDateAndDeptAndDoctor(@RequestParam("requestDay") String requestDay, @RequestParam("unitCode")String unitCode, @RequestParam("doctorCode")String doctorCode ) {
|
|
|
+ Map<String, Object> results = new HashMap<>();
|
|
|
+ try {
|
|
|
+ if(StringUtils.isBlank(requestDay)){
|
|
|
+ results.put("resultCode", -1);
|
|
|
+ results.put("resultMessage", "预约挂号时间不能为空");
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(unitCode)){
|
|
|
+ results.put("resultCode", -1);
|
|
|
+ results.put("resultMessage", "科室编码不能为空");
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(doctorCode)){
|
|
|
+ results.put("resultCode", -1);
|
|
|
+ results.put("resultMessage", "医生编码不能为空");
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ List<String> ampms=null;
|
|
|
+ int flg = DateUtil.IsAfternoon(java.util.Calendar.getInstance().getTime().getHours());
|
|
|
+ if (flg >= 0){
|
|
|
+ ampms=Arrays.asList(Constants.AM);
|
|
|
+ }
|
|
|
+ MzZdWorkTime mzZdWorkTime=mzZdWorkTimeService.queryMzZdWorkTimeByCode(Constants.PM);
|
|
|
+ SimpleDateFormat simpleDateFormat=new SimpleDateFormat("HH:mm");
|
|
|
+ Date dateEndTime=simpleDateFormat.parse(mzZdWorkTime.getEndTime());
|
|
|
+ long tsEndTime =dateEndTime.getTime();
|
|
|
+ String realNowStr = simpleDateFormat.format(new Date());
|
|
|
+ Date realHour = simpleDateFormat.parse(realNowStr);
|
|
|
+ long realHourTs = realHour.getTime();
|
|
|
+ if(realHourTs>tsEndTime){
|
|
|
+ ampms=new ArrayList<>(ampms);
|
|
|
+ ampms.add(Constants.PM);
|
|
|
+ }
|
|
|
+ Date requestDayD = DateUtil.pase(requestDay,"yyyy-MM-dd");
|
|
|
+ Date toDay = DateUtil.pase(new Date(),"yyyy-MM-dd");
|
|
|
+ if(requestDayD.before(toDay)){
|
|
|
+ results.put("resultCode", -1);
|
|
|
+ results.put("resultMessage", "预约挂号时间已过,无法挂号,请重新选择!");
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ List<Map<String,Object>> list=mzyRequestService.queryRequestByDateAndDeptAndDoctor(requestDayD,ampms,unitCode,doctorCode);
|
|
|
+ if (list == null || list.size() == 0) {
|
|
|
+ results.put("resultCode", -1);
|
|
|
+ results.put("resultMessage", "没有医生排班信息");
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ for(Map map :list){
|
|
|
+ BigDecimal fee = BigDecimal.ZERO;
|
|
|
+ String chargeType= (String) map.get("chargeType");
|
|
|
+ if(StringUtils.isNotBlank(chargeType)){
|
|
|
+ MzyZdChargeType mzyZdChargeType=mzyZdChargeTypeService.queryByCode(chargeType);
|
|
|
+ if(mzyZdChargeType!=null){
|
|
|
+ map.put("chargeType",mzyZdChargeType.getName());
|
|
|
+ if(mzyZdChargeType.getReqFee()==null){
|
|
|
+ mzyZdChargeType.setReqFee(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
+ if(mzyZdChargeType.getClinicFee()==null){
|
|
|
+ mzyZdChargeType.setClinicFee(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
+ if(mzyZdChargeType.getOthFee()==null){
|
|
|
+ mzyZdChargeType.setOthFee(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
+ fee=fee.add(mzyZdChargeType.getReqFee()).add(mzyZdChargeType.getClinicFee()).add(mzyZdChargeType.getOthFee());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ BigDecimal checkFee= (BigDecimal) map.get("checkFee");
|
|
|
+ if(checkFee==null){
|
|
|
+ checkFee=BigDecimal.ZERO;
|
|
|
+ }
|
|
|
+ fee=fee.add(checkFee);
|
|
|
+ map.put("fee",fee);
|
|
|
+ map.remove("checkFee");
|
|
|
+ Employee employee= employeeService.queryByUserCode(doctorCode);
|
|
|
+ if(employee!=null){
|
|
|
+ map.put("doctorName",employee.getEmployeeName());
|
|
|
+ if(StringUtils.isNotBlank(employee.getEmpTitCode())){
|
|
|
+ ZdEmpTitle zdEmpTitle=zdEmpTitleService.queryByCode(employee.getEmpTitCode());
|
|
|
+ if(zdEmpTitle!=null){
|
|
|
+ map.put("doctorTitle",zdEmpTitle.getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String ampm = (String) map.get("ampm");
|
|
|
+ if(Constants.AM.equals(ampm)){
|
|
|
+ ampm="上午";
|
|
|
+ }else if(Constants.PM.equals(ampm)){
|
|
|
+ ampm="下午";
|
|
|
+ }else if (Constants.DAY.equals(ampm)){
|
|
|
+ ampm="全天";
|
|
|
+ }
|
|
|
+ map.put("ampm",ampm);
|
|
|
+ }
|
|
|
+ results.put("resultCode", 0);
|
|
|
+ results.put("resultMessage", "查询可以挂号的医生号源信息成功");
|
|
|
+ results.put("data", list);
|
|
|
+ return results;
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ results.put("resultCode", -1);
|
|
|
+ results.put("resultMessage", "查询可以挂号的医生号源信息失败");
|
|
|
+ return results;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * 门诊挂号支付
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/payRegistrationFormHaiCi", method = {RequestMethod.POST})
|
|
|
+ public Map<String, Object> payRegistrationFormHaiCi(@RequestBody MzyReqrecPageDto mzyReqrecPageDto) {
|
|
|
+ Map<String, Object> resultMap = new HashMap<>();
|
|
|
+ try {
|
|
|
+ if(mzyReqrecPageDto==null || mzyReqrecPageDto.getMzyReqrec()==null){
|
|
|
+ resultMap.put("code", -1);
|
|
|
+ resultMap.put("message", "挂号参数不能为空");
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
+ MzyReqrec mzyReqrec = mzyReqrecPageDto.getMzyReqrec();
|
|
|
+ if(StringUtils.isBlank(mzyReqrec.getPatientId())){
|
|
|
+ resultMap.put("code", -1);
|
|
|
+ resultMap.put("message", "病人id不能为空");
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(mzyReqrec.getPaymode())){
|
|
|
+ resultMap.put("code", -1);
|
|
|
+ resultMap.put("message", "付款方式不能为空");
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
+ if (!Arrays.asList(WX, ZFB).contains(mzyReqrec.getPaymode())) {
|
|
|
+ resultMap.put("resultCode", -1);
|
|
|
+ resultMap.put("resultMessage", "支付方式有误,请联系管理员");
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(mzyReqrec.getAgtordnum())){
|
|
|
+ resultMap.put("code", -1);
|
|
|
+ resultMap.put("message", "流水号不能为空");
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(mzyReqrec.getPsordnum())){
|
|
|
+ resultMap.put("code", -1);
|
|
|
+ resultMap.put("message", "订单号不能为空");
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
+ if(mzyReqrecPageDto.getMzyRequestId()==null){
|
|
|
+ resultMap.put("code", -1);
|
|
|
+ resultMap.put("message", "门诊号表主键不能为空");
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
+ mzyReqrecPageDto.setResponceType("01");
|
|
|
+ MzyRequest mzyRequest= mzyRequestService.queryById(mzyReqrecPageDto.getMzyRequestId());
|
|
|
+ if(mzyRequest==null){
|
|
|
+ resultMap.put("code", -1);
|
|
|
+ resultMap.put("message", "挂号信息对应的号表不存在");
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
+ mzyReqrec.setAmpm(mzyRequest.getAmpm());
|
|
|
+ mzyReqrec.setUnitCode(mzyRequest.getUnitCode());
|
|
|
+ mzyReqrec.setChargeType(mzyRequest.getChargeType());
|
|
|
+ mzyReqrec.setDoctorCode(mzyRequest.getDoctorCode());
|
|
|
+ MzZdWorkTime mzZdWorkTime=mzZdWorkTimeService.queryMzZdWorkTimeByCode(mzyReqrec.getAmpm());
|
|
|
+ if(mzZdWorkTime==null){
|
|
|
+ resultMap.put("code", -1);
|
|
|
+ resultMap.put("message", "号段不存在");
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
+ mzyReqrec.setOpId(Constants.BRZZJF_CODE);
|
|
|
+ int num =mzyReqrecService.saveMzyReqrec(mzyReqrecPageDto);
|
|
|
+ if(num==0){
|
|
|
+ resultMap.put("code", -1);
|
|
|
+ resultMap.put("message", "挂号失败,请稍后重试!");
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
+ resultMap.put("code", 0);
|
|
|
+ resultMap.put("message", "保存挂号信息成功");
|
|
|
+ return resultMap;
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ resultMap.put("code", -1);
|
|
|
+ resultMap.put("message", StringUtils.isBlank(e.getMessage())?"挂号失败,系统出错,请联系管理员":e.getMessage());
|
|
|
+ log.error("挂号失败,系统异常,错误信息{}",e.getMessage());
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 门诊挂号订单支付状态查询
|
|
|
+ *
|
|
|
+ * @param haiciCharge
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/getPayStatusForRegistration", method = {RequestMethod.POST})
|
|
|
+ public Map<String, Object> getPayStatusForRegistration(@RequestBody HaiciCharge haiciCharge) {
|
|
|
+ Map<String, Object> results = new HashMap<>();
|
|
|
+ if (haiciCharge == null) {
|
|
|
+ results.put("resultCode", -1);
|
|
|
+ results.put("resultMessage", "门诊挂号订单支付状态查询参数为空");
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(haiciCharge.getPsOrdNum())) {
|
|
|
+ results.put("resultCode", -1);
|
|
|
+ results.put("resultMessage", "平台订单号不能为空");
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(haiciCharge.getPayMode())) {
|
|
|
+ results.put("resultCode", -1);
|
|
|
+ results.put("resultMessage", "支付方式不能为空");
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ if (!Arrays.asList(WX, ZFB).contains(haiciCharge.getPayMode())) {
|
|
|
+ results.put("resultCode", -1);
|
|
|
+ results.put("resultMessage", "支付方式有误,请联系管理员");
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ if (haiciCharge.getPayAmt() == null) {
|
|
|
+ results.put("resultCode", -1);
|
|
|
+ results.put("resultMessage", "支付金额不能为空");
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(haiciCharge.getAgtOrdNum())) {
|
|
|
+ results.put("resultCode", -1);
|
|
|
+ results.put("resultMessage", "支付机构流水号不能为空");
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ if (haiciCharge.getPayTime() == null) {
|
|
|
+ results.put("resultCode", -1);
|
|
|
+ results.put("resultMessage", "支付时间不能为空");
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ MzyReqrec mzyReqrec = mzyReqrecService.queryMzyReqrecByAgtordnum(haiciCharge.getPsOrdNum(), haiciCharge.getAgtOrdNum());
|
|
|
+ if (mzyReqrec != null) {
|
|
|
+ results.put("resultCode", 0);
|
|
|
+ results.put("resultMessage", "门诊挂号订单支付状态查询成功");
|
|
|
+ results.put("payStatus", "1");
|
|
|
+ results.put("guideListInfo", "");
|
|
|
+ results.put("receiptNum", "");
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ results.put("resultCode", 0);
|
|
|
+ results.put("resultMessage", "门诊挂号订单支付状态查询失败");
|
|
|
+ results.put("payStatus", "2");
|
|
|
+ results.put("guideListInfo", "");
|
|
|
+ results.put("receiptNum", "");
|
|
|
+ return results;
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ results.put("resultCode", -1);
|
|
|
+ results.put("resultMessage", "门诊挂号订单支付状态查询失败,请联系管理员");
|
|
|
+ log.error("系统异常,错误信息{}", e.getMessage());
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 查询门诊记录表 医患通已收费记录查询
|