diff --git a/pom.xml b/pom.xml index 39dce84..ed23b4a 100644 --- a/pom.xml +++ b/pom.xml @@ -17,7 +17,7 @@ UTF-8 1.8 1.8 - 6.7.0 + 6.7.4 2.14.1 1.2.83 @@ -59,17 +59,12 @@ compile - + ch.qos.logback logback-classic - 1.2.13 - - - slf4j-api - org.slf4j - - + 1.3.15 + compile diff --git a/src/main/java/com/ynxbd/ali/helper/AliMessageHelper.java b/src/main/java/com/ynxbd/ali/helper/AliMessageHelper.java index 33289be..22673aa 100644 --- a/src/main/java/com/ynxbd/ali/helper/AliMessageHelper.java +++ b/src/main/java/com/ynxbd/ali/helper/AliMessageHelper.java @@ -42,7 +42,7 @@ public class AliMessageHelper { return; } - Patient patient = new PatientService().getMyself(openid); + Patient patient = new PatientService().queryMyself(openid); if (patient == null || patient.getName() == null) { log.error("[支付宝]消息推送 trueName为空"); return; diff --git a/src/main/java/com/ynxbd/common/action/AliAction.java b/src/main/java/com/ynxbd/common/action/AliAction.java index f7debab..51fe253 100644 --- a/src/main/java/com/ynxbd/common/action/AliAction.java +++ b/src/main/java/com/ynxbd/common/action/AliAction.java @@ -66,7 +66,7 @@ public class AliAction extends BaseAction { } else { user = new User(); user.setOpenid(openid); - user.setPatientList(new PatientService().getPatientList(openid, null, true)); + user.setPatientList(new PatientService().queryPatientList(openid, null, true)); cache.put(openid, user); } @@ -80,7 +80,7 @@ public class AliAction extends BaseAction { } if (user.getPatientList() == null) { - user.setPatientList(new PatientService().getPatientList(openid, null, true)); + user.setPatientList(new PatientService().queryPatientList(openid, null, true)); } AliCacheHelper.setUserAccessToken(scopes, user, accessToken); diff --git a/src/main/java/com/ynxbd/common/action/ApiAction.java b/src/main/java/com/ynxbd/common/action/ApiAction.java index 0608681..9235dae 100644 --- a/src/main/java/com/ynxbd/common/action/ApiAction.java +++ b/src/main/java/com/ynxbd/common/action/ApiAction.java @@ -57,9 +57,6 @@ public class ApiAction extends BaseAction { return Result.success(resp); } - public static void main(String[] args) { - System.out.println(DesEncryptHelper.deCode("98EBC51EB92C6BC416BE23AE0622CC7445CCB4559637127984C5759A422DC4B81251FC4C8B32A9DB9743601A4C4D66A31FA5186B9BF10CBCF7ACB00A82EBC37122FD51700AC9D16D596D147FFC4D4973792E04B406288B88D08C6ACE9654DA3801B31D2F6B996D3572A3BA1E8124A5CE43394DF49E1B5F0DC7793566C06524A854161F38FF064F3B")); - } @Action("getWxJsapiTicket") public Result getWxJsapiTicket() { @@ -214,6 +211,7 @@ public class ApiAction extends BaseAction { @Action("version") public Result version() { + log.info(VersionHelper.getAppVersion()); return Result.success(VersionHelper.getAppVersion()); } @@ -270,4 +268,6 @@ public class ApiAction extends BaseAction { return respEnd("ERROR:发送失败"); } + + } diff --git a/src/main/java/com/ynxbd/common/action/MedToolAction.java b/src/main/java/com/ynxbd/common/action/MedToolAction.java new file mode 100644 index 0000000..5331770 --- /dev/null +++ b/src/main/java/com/ynxbd/common/action/MedToolAction.java @@ -0,0 +1,32 @@ +package com.ynxbd.common.action; + +import com.ynxbd.common.action.base.BaseAction; +import com.ynxbd.common.result.Result; +import com.ynxbd.common.result.ResultEnum; +import com.ynxbd.common.service.MedToolService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.ObjectUtils; +import org.apache.struts2.convention.annotation.Action; +import org.apache.struts2.convention.annotation.Namespace; + +@Slf4j +@Namespace("/medTool") +public class MedToolAction extends BaseAction { + /** + * [就医助手]修改流程标记 + */ + @Action("saveMedToolMarkByTreatNum") + public Result saveMedToolMarkByTreatNum(String treatNum, Integer type, String processMark) { + treatNum = getDecodeString(treatNum); + log.info("[就医助手]根据就诊号修改流程标记 treatNum={}, type={}, processMark={}", treatNum, type, processMark); + if (ObjectUtils.isEmpty(treatNum) || processMark == null) { + return Result.error(ResultEnum.PARAM_IS_DEFECT); + } + try { + boolean isOK = new MedToolService().saveMedToolMarkByTreatNum(treatNum, type, processMark); + return Result.isOK(isOK); + } catch (Exception e) { + return Result.error(e); + } + } +} diff --git a/src/main/java/com/ynxbd/common/action/PatientAction.java b/src/main/java/com/ynxbd/common/action/PatientAction.java index 4a41240..39f207a 100644 --- a/src/main/java/com/ynxbd/common/action/PatientAction.java +++ b/src/main/java/com/ynxbd/common/action/PatientAction.java @@ -12,14 +12,11 @@ import com.ynxbd.common.result.Result; import com.ynxbd.common.result.ResultEnum; import com.ynxbd.common.result.ServiceException; import com.ynxbd.common.service.PatientService; -import com.ynxbd.wx.utils.DesEncryptHelper; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.ObjectUtils; import org.apache.struts2.convention.annotation.Action; import org.apache.struts2.convention.annotation.Namespace; -import java.io.UnsupportedEncodingException; -import java.nio.charset.StandardCharsets; import java.util.List; import java.util.UUID; @@ -246,7 +243,7 @@ public class PatientAction extends BaseAction { mIDCardNo = getString("mIDCardNo"); Result result = new PatientService().noCardBind(fTel, fName, fIDCardNo, mTel, mName, mIDCardNo); - if (!result.isSuccess()) { + if (!result.isOK()) { return result; } } else { diff --git a/src/main/java/com/ynxbd/common/action/RecipeAction.java b/src/main/java/com/ynxbd/common/action/RecipeAction.java index a1f8645..fff5795 100644 --- a/src/main/java/com/ynxbd/common/action/RecipeAction.java +++ b/src/main/java/com/ynxbd/common/action/RecipeAction.java @@ -19,6 +19,7 @@ import com.ynxbd.common.result.ResultEnum; import com.ynxbd.common.service.RecipeService; import com.ynxbd.wx.config.WeChatConfig; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.ObjectUtils; import org.apache.struts2.convention.annotation.Action; import org.apache.struts2.convention.annotation.Namespace; @@ -43,26 +44,109 @@ public class RecipeAction extends BaseAction { */ @Action("getPayedList") public Result getPayedList(String patientId, String personNo, String begDate, String endDate) { - log.info("[处方]已缴费项目查询 patientId={}, begDate={}, endDate={}, personNo-{}", patientId, begDate, endDate,personNo); + log.info("[处方]已缴费项目查询 patientId={}, begDate={}, endDate={}, personNo-{}", patientId, begDate, endDate, personNo); + patientId = getDecodeString(patientId); if (patientId == null || begDate == null || endDate == null) { return Result.error(ResultEnum.PARAM_IS_DEFECT); } - patientId = getDecodeString(patientId); - List recipeList = new HisRecipeDao().getPaidRecipeList(patientId, begDate, endDate,personNo); + List recipeList = new HisRecipeDao().getPaidRecipeList(patientId, begDate, endDate, personNo); return Result.success(recipeList); } + /** + * 查询已缴费项目 + */ + @Action("getRxPaidList") + public Result getRxPaidList(String patientId, String personNo, String begDate, String endDate) { + log.info("[处方]查询已缴费项目 patientId={}, begDate={}, endDate={}, personNo-{}", patientId, begDate, endDate, personNo); + patientId = getDecodeString(patientId); + if (patientId == null || begDate == null || endDate == null) { + return Result.error(ResultEnum.PARAM_IS_DEFECT); + } + if (!ObjectUtils.isEmpty(personNo)) { + personNo = getDecodeString(personNo); + if (personNo == null) { + return Result.error(ResultEnum.PARAM_IS_INVALID); + } + } + + List hisRecipeList = new HisRecipeDao().getPaidRecipeList(patientId, begDate, endDate, personNo); + List dataList = new ArrayList<>(); + HisRecipe treatItem; + List groupList; + for (HisRecipe item : hisRecipeList) { + String treatNum = item.getMzNum(); + if (ObjectUtils.isEmpty(treatNum)) { + continue; + } + String execDate = item.getExecDate(); + item.setTreatNum(treatNum); + + HisRecipe findTreat = dataList.stream().filter(o -> o.getTreatNum().equals(treatNum)).findFirst().orElse(null); + if (findTreat == null) { + treatItem = new HisRecipe(); + treatItem.setTreatNum(treatNum); + treatItem.setDate(execDate); + groupList = new ArrayList<>(); + groupList.add(item); + treatItem.setGroupList(groupList); + dataList.add(treatItem); + } else { + if (findTreat.getGroupList() == null) { + findTreat.setGroupList(new ArrayList<>()); + } + Boolean isGreaterThan = DateHelper.leftGreaterThanRight(execDate, findTreat.getDate(), null); + if (isGreaterThan != null && isGreaterThan) { + findTreat.setDate(execDate); + } + findTreat.getGroupList().add(item); + } + } + return Result.success(dataList); + } + /** * 获取未缴费项目 */ - @Action("getUnPayList") - public Result getUnPayList(String patientId, String personNo, String begDate, String endDate ) { - log.info("[处方]未缴费项目查询 patientId={},personNo-{}, begDate={}, endDate={}", patientId, personNo, begDate, endDate); + @Action("getRxUnPayList") + public Result getRxUnPayList(String patientId, String personNo, String begDate, String endDate) { + log.info("[处方]未缴费项目查询 patientId={}, personNo={}, begDate={}, endDate={}", patientId, personNo, begDate, endDate); + patientId = getDecodeString(patientId); if (patientId == null || begDate == null || endDate == null) { return Result.error(ResultEnum.PARAM_IS_DEFECT); } + if (!ObjectUtils.isEmpty(personNo)) { + personNo = getDecodeString(personNo); + if (personNo == null) { + return Result.error(ResultEnum.PARAM_IS_INVALID); + } + } + + int days = DateHelper.intervalDays(begDate, endDate, true); + List hisRecipes = new HisRecipeDao().getUnPayRecipe(patientId, personNo, days); + + List resultList = new ArrayList<>(); + for (HisRecipe hisRecipe : hisRecipes) { + hisRecipe.setTreatNum(hisRecipe.getMzNum()); + if (hisRecipe.getDate() != null && DateHelper.inDateRange(begDate, endDate, hisRecipe.getDate(), DateHelper.DateEnum.yyyy_MM_dd) + && !"1".equals(hisRecipe.getSTDFlag()) && (!"1".equals(hisRecipe.getInternetHospFlag()) || "1".equals(hisRecipe.getYJSAuditFlag()))) { + resultList.add(hisRecipe); + } + } + return Result.success(resultList); + } + + /** + * 获取未缴费项目(旧) + */ + @Action("getUnPayList") + public Result getUnPayList(String patientId, String personNo, String begDate, String endDate) { + log.info("[处方]未缴费项目查询 patientId={}, personNo={}, begDate={}, endDate={}", patientId, personNo, begDate, endDate); patientId = getDecodeString(patientId); + if (patientId == null || begDate == null || endDate == null) { + return Result.error(ResultEnum.PARAM_IS_DEFECT); + } int days = DateHelper.intervalDays(begDate, endDate, true); List hisRecipes = new HisRecipeDao().getUnPayRecipe(patientId, personNo, days); @@ -77,19 +161,20 @@ public class RecipeAction extends BaseAction { /** * 获取所以未缴费订单 包括互联网医院未审核,医保双通道订单 + * * @param patientId patientId - * @param begDate 开始时间 - * @param endDate 结束时间 + * @param begDate 开始时间 + * @param endDate 结束时间 */ @Action("getMedicalRecipe") - public Result getMedicalRecipe(String patientId, String begDate, String endDate ) { + public Result getMedicalRecipe(String patientId, String begDate, String endDate) { log.info("[处方]未缴费项目查询 patientId={}", patientId); + patientId = getDecodeString(patientId); if (patientId == null) { return Result.error(ResultEnum.PARAM_IS_DEFECT); } - patientId = getDecodeString(patientId); int days = DateHelper.intervalDays(begDate, endDate, true); - List hisRecipes = new HisRecipeDao().getUnPayRecipe(patientId,"",days); + List hisRecipes = new HisRecipeDao().getUnPayRecipe(patientId, "", days); List resultList = new ArrayList<>(); for (HisRecipe hisRecipe : hisRecipes) { if (hisRecipe.getDate() != null && DateHelper.inDateRange(begDate, endDate, hisRecipe.getDate(), DateHelper.DateEnum.yyyy_MM_dd)) { @@ -101,17 +186,18 @@ public class RecipeAction extends BaseAction { /** * 将订单上传到医保双通道 + * * @param treatNum 门诊号 * @param personID 身份证 - * @param recipes 处方号合集,中间用英文逗号隔开 + * @param recipes 处方号合集,中间用英文逗号隔开 */ @Action("uploadMedicalRecipe") - public Result uploadMedicalRecipe(String treatNum, String personID, String recipes){ + public Result uploadMedicalRecipe(String treatNum, String personID, String recipes) { log.info("[互联网医院]处方医保双通道流转 treatNum={},personNo-{}, recipes={}", treatNum, personID, recipes); - if(treatNum==null||personID==null||recipes==null){ + if (treatNum == null || personID == null || recipes == null) { return Result.error(ResultEnum.PARAM_IS_DEFECT); } - return new HisRecipeDao().uploadMedicalRecipe(treatNum,personID,recipes); + return new HisRecipeDao().uploadMedicalRecipe(treatNum, personID, recipes); } // /** @@ -139,32 +225,33 @@ public class RecipeAction extends BaseAction { /** * 预约体检his缴费 - * @param treatNum 体检号 - * @param payMoney 缴费金额 - * @param payDate 缴费日期 - * @param payTime 缴费时间 + * + * @param treatNum 体检号 + * @param payMoney 缴费金额 + * @param payDate 缴费日期 + * @param payTime 缴费时间 * @param bankTransNo bankTransNo - * @param outTranNo outTranNo + * @param outTranNo outTranNo */ @Action("peisHisPay") - public Result peisHisPay(String treatNum,String payMoney,String payDate,String payTime,String bankTransNo,String outTranNo){ - log.info("[体检预约请求his计费]treatNum-{},payMoney-{},payDate-{},payTime-{},bankTransNo-{},outTranNo-{}",treatNum,payMoney,payDate,payTime,bankTransNo,outTranNo); - if("".equals(treatNum)||"".equals(outTranNo)){ + public Result peisHisPay(String treatNum, String payMoney, String payDate, String payTime, String bankTransNo, String outTranNo) { + log.info("[体检预约请求his计费]treatNum-{},payMoney-{},payDate-{},payTime-{},bankTransNo-{},outTranNo-{}", treatNum, payMoney, payDate, payTime, bankTransNo, outTranNo); + if ("".equals(treatNum) || "".equals(outTranNo)) { return Result.error(ResultEnum.PARAM_IS_DEFECT); } - Recipe recipe = new PeisDao().selectByOutTradeNo(outTranNo); - if(recipe==null){ + Recipe recipe = new PeisDao().selectByOutTradeNo(outTranNo); + if (recipe == null) { return Result.error(ResultEnum.DATA_NOT_FOUND); } - if(!recipe.getBankTransNo().equals(bankTransNo)){ - log.info("[体检预约请求his计费]体检系统跟微信支付系统两笔订单不一致,体检系统:bankTransNo-{},微信系统:bankTransNo-{}",bankTransNo,recipe.getBankTransNo()); + if (!recipe.getBankTransNo().equals(bankTransNo)) { + log.info("[体检预约请求his计费]体检系统跟微信支付系统两笔订单不一致,体检系统:bankTransNo-{},微信系统:bankTransNo-{}", bankTransNo, recipe.getBankTransNo()); return Result.error(ResultEnum.DATA_IS_WRONG); } - Map params = new HashMap<>(); + Map params = new HashMap<>(); params.put("MZNum", "0"); params.put("PatientID", "0"); - params.put("TJBH",treatNum); - params.put("GroupFlag","1"); + params.put("TJBH", treatNum); + params.put("GroupFlag", "1"); params.put("PayMoney", payMoney); params.put("PayDate", payDate); params.put("PayTime", payTime); @@ -175,7 +262,7 @@ public class RecipeAction extends BaseAction { params.put("OpenId", recipe.getOpenid()); params.put("Token", WeChatConfig.TOKEN); JsonResult result = HisHelper.getJsonResult(HisEnum.AP_Pay_Invoice, params, MerchantEnum.WX); - return result.success()?Result.success(result):Result.error(result.getMessage()); + return result.success() ? Result.success(result) : Result.error(result.getMessage()); } /** diff --git a/src/main/java/com/ynxbd/common/action/RegisterAction.java b/src/main/java/com/ynxbd/common/action/RegisterAction.java index 6e055bc..3abfa66 100644 --- a/src/main/java/com/ynxbd/common/action/RegisterAction.java +++ b/src/main/java/com/ynxbd/common/action/RegisterAction.java @@ -6,14 +6,19 @@ import com.ynxbd.ali.helper.AliUploadHelper; import com.ynxbd.common.action.base.BaseAction; import com.ynxbd.common.bean.Dept; import com.ynxbd.common.bean.Doctor; +import com.ynxbd.common.bean.Patient; +import com.ynxbd.common.bean.RegSign; import com.ynxbd.common.bean.enums.MerchantEnum; import com.ynxbd.common.bean.pay.Register; import com.ynxbd.common.dao.RegisterDao; import com.ynxbd.common.dao.his.HisRegisterDao; import com.ynxbd.common.helper.common.DateHelper; +import com.ynxbd.common.result.JsonResult; import com.ynxbd.common.result.Result; import com.ynxbd.common.result.ResultEnum; import com.ynxbd.common.service.DoctorService; +import com.ynxbd.common.service.MedToolService; +import com.ynxbd.common.service.PatientService; import com.ynxbd.common.service.RegService; import com.ynxbd.wx.wxfactory.ReqParamHelper; import lombok.extern.slf4j.Slf4j; @@ -200,7 +205,7 @@ public class RegisterAction extends BaseAction { if (patientId == null || begDate == null || endDate == null) { return Result.error(ResultEnum.PARAM_IS_DEFECT); } - List resultList = new HisRegisterDao().getRegReserveHistory(patientId, null); + List resultList = new HisRegisterDao().getRegReserveRecords(patientId, null); return Result.success(resultList); } @@ -216,7 +221,7 @@ public class RegisterAction extends BaseAction { } patientId = getDecodeString(patientId); - List regRecords = new RegService().getHisRegRecords(patientId, begDate, endDate); + List regRecords = new RegService().getHisRegRecordsByRegDate(patientId, begDate, endDate); return Result.success(regRecords); } catch (Exception e) { return Result.error(e); @@ -224,10 +229,10 @@ public class RegisterAction extends BaseAction { } /** - * [挂号]查询挂号历史 + * [挂号]查询挂号历史记录 */ - @Action("getHisRegRecords") - public Result getRegHistory(String begDate, String endDate, String patientId) { + @Action("getRegHistoryRecords") + public Result getRegHistoryRecords(String begDate, String endDate, String patientId) { try { log.info("[挂号]查询挂号记录 patientId={}, begDate={},endDate={}", patientId, begDate, endDate); if (patientId == null || begDate == null || endDate == null) { @@ -235,7 +240,7 @@ public class RegisterAction extends BaseAction { } patientId = getDecodeString(patientId); - List regRecords = new RegService().getHisRegRecords(patientId, begDate, endDate); + List regRecords = new RegService().getHisRegRecordsByRegDate(patientId, begDate, endDate); return Result.success(regRecords); } catch (Exception e) { return Result.error(e); @@ -243,7 +248,7 @@ public class RegisterAction extends BaseAction { } /** - * [预约挂号]获取预约记录 + * [预约挂号]查询预约记录 */ @Action("getHisRegReserveRecords") public Result getHisRegReserveRecords(String begDate, String endDate, String patientId) { @@ -371,7 +376,7 @@ public class RegisterAction extends BaseAction { begDate = DateHelper.getCurDate() + " 06:00:00"; endDate = DateHelper.getCurDate() + " 23:59:59"; } - JSONArray dataList = new HisRegisterDao().getReLineSignInRecord(begDate, endDate); + JSONArray dataList = new HisRegisterDao().getRegLineSignInRecordsOld(begDate, endDate); Map dataMap = new HashMap<>(); dataMap.put("date", DateHelper.getCurDateTime()); if (dataList == null || dataList.isEmpty()) { @@ -383,8 +388,47 @@ public class RegisterAction extends BaseAction { return Result.success(dataMap); } + /** - * 执行预约签到 + * 根据患者id,查询挂号待签到记录 + * + * @param begDate 开始时间 + * @param endDate 结束时间 + * @return 待预约记录 + */ + @Action("getRegSignInByPatientId") + public Result getRegSignInByPatientId(String patientId, String begDate, String endDate) { + patientId = getDecodeString(patientId); + log.info("[挂号待签到记录]查询 patientId={} begDate={}, endDate={}", patientId, begDate, endDate); + if (patientId == null) { + return Result.error(ResultEnum.PARAM_IS_INVALID); + } + List records = new RegService().getRegLineSignInRecordsByPatientId(patientId, begDate, endDate); + return Result.success(records); + } + + /** + * 根据门诊号,查询挂号待签到记录 + * + * @param treatNum 门诊号 + * @return 待预约记录 + */ + @Action("getRegSignInByTreatNum") + public Result getRegSignInByTreatNum(String treatNum) { + treatNum = getDecodeString(treatNum); + log.info("[挂号待签到记录]查询 treatNum={}", treatNum); + if (treatNum == null) { + return Result.error(ResultEnum.PARAM_IS_INVALID); + } + RegSign record = new RegService().getRegLineSignInRecordByTreatNum(treatNum); + if (record == null) { + return Result.error(ResultEnum.DATA_NOT_FOUND); + } + return Result.success(record); + } + + /** + * 执行预约签到(将废弃) * * @param treatNum 门诊号 * @return 预约签到结果 @@ -398,6 +442,28 @@ public class RegisterAction extends BaseAction { return Result.success(new HisRegisterDao().handleLineSignIn(treatNum)); } + /** + * 执行预约签到 + * + * @param treatNum 门诊号 + * @return 预约签到结果 + */ + @Action("regSignIn") + public Result regSignIn(String treatNum) { + log.info("[执行挂号签到(只进行分诊叫号)] treatNum={}", treatNum); + if (treatNum == null) { + return Result.error(ResultEnum.PARAM_IS_DEFECT); + } + JsonResult jsonResult = new HisRegisterDao().handleLineSignIn(treatNum); + if (!jsonResult.success()) { + return Result.error(jsonResult.getMessage()); + } + String fzNum = jsonResult.getDataMapString("FZNum"); // 分诊号 + Map dataMap = new HashMap<>(); + dataMap.put("fzNum", fzNum); + return Result.success(dataMap); + } + /** * 查询预约今天号源的患者信息,用以推送候诊信息 * @@ -416,25 +482,54 @@ public class RegisterAction extends BaseAction { /** - * [就医助手]根据挂号日期范围,查询挂号记录 + * [就医助手]根据日期范围,查询待诊的挂号记录 */ - @Action("getRegRecordsByOpenId") - public Result getRegRecordsByOpenId(String begDate, String endDate, String openid) { + @Action("getHisWaitRegRecords") + public Result getHisWaitRegRecords(String openid) { try { - log.info("[就医助手]根据挂号日期范围,查询挂号记录 begDate={}, endDate={}, openid={}", begDate, endDate, openid); - if (begDate == null || endDate == null || openid == null) { + log.info("[就医助手]根据挂号日期范围,查询待诊的挂号记录 openid={}", openid); + if (openid == null) { return Result.error(ResultEnum.PARAM_IS_DEFECT); } - List regList = new RegisterDao().selectListByRegDate(begDate, endDate, openid); - for (Register item : regList) { - item.setEnId(ReqParamHelper.encode(String.valueOf(item.getId()))); - item.setId(null); - item.filterInfo(); // 数据过滤 + + List regList = new ArrayList<>(); + List patients = new PatientService().queryPatientIdsByOpenId(openid); + if (patients.isEmpty()) { + return Result.success(regList); + } + + String curDate = DateHelper.getCurDate(); + for (Patient pItem : patients) { + String patientId = pItem.getPatientId(); + List hisWaitRegRecords = new RegService().getHisWaitRegRecords(patientId); + if (hisWaitRegRecords != null && !hisWaitRegRecords.isEmpty()) { + for (Register regItem : hisWaitRegRecords) { + if (regItem.hasIsTake(-1) || regItem.hasIsTreat(-1)) { // 过滤退号的挂号数据 + continue; + } + String regDate = regItem.getRegDate(); + if (!ObjectUtils.isEmpty(regDate)) { + Date date = DateHelper.strToDate(regDate, DateHelper.DateEnum.yyyy_MM_dd); + if (date != null) { + regItem.setQueryBegDate(DateHelper.getMoveDate(date, -7)); + regItem.setQueryEndDate(DateHelper.getMoveDate(date, 7)); + } + } + + regItem.setCurDate(curDate); + regItem.setPatientId(patientId); + regItem.setEnPatientId(ReqParamHelper.encode(patientId)); + regItem.setPatientName(pItem.getName()); + regItem.setBirthday(pItem.getBirthday()); + regItem.setSex(pItem.getSex()); + regItem.setIdCardNo(pItem.getIdCardNo()); + regItem.setTel(pItem.getTel()); + regItem.filterInfo(); + regList.add(regItem); + } + } } - Map dataMap = new HashMap<>(); - dataMap.put("date", DateHelper.getCurDateTime()); - dataMap.put("list", regList); - return Result.success(dataMap); + return Result.success(regList); } catch (Exception e) { return Result.error(e); } @@ -451,34 +546,76 @@ public class RegisterAction extends BaseAction { return Result.error(ResultEnum.PARAM_IS_DEFECT); } try { - Register record = new RegService().findHisRegRecord(patientId, regDate, hisTransNo); - Map dataMap = new HashMap<>(); - dataMap.put("date", DateHelper.getCurDateTime()); - dataMap.put("info", record); - return Result.success(dataMap); + Register record = new RegService().findHisRegRecordByHisTransNo(patientId, regDate, hisTransNo); + return Result.success(record); } catch (Exception e) { return Result.error(e); } } /** - * [就医助手]修改流程状态 + * [挂号订单]查询信息 */ - @Action("updateRegMedToolMark") - public Result updateRegMedToolMark(String id, String medToolMark, String openId) { - id = getDecodeString(id); - log.info("[就医助手]修改流程状态 id={}, medToolMark={}, openId={}", id, medToolMark, openId); - if (ObjectUtils.isEmpty(id) || medToolMark == null) { + @Action("getRegOrder") + public Result getRegOrder(String patientId, String tradeNo, String hisTransNo) { + patientId = getDecodeString(patientId); + log.info("[挂号订单]查询信息 patientId={}, tradeNo={}, hisTransNo={}", patientId, tradeNo, hisTransNo); + if (ObjectUtils.isEmpty(patientId) || ObjectUtils.isEmpty(hisTransNo)) { return Result.error(ResultEnum.PARAM_IS_DEFECT); } try { - boolean isOK = new RegService().updateRegMedToolMark(id, medToolMark, openId); - return Result.isOK(isOK); + Register register = new RegService().queryRegByHisInfo(patientId, tradeNo, hisTransNo); + if (register == null) { + return Result.error("未找到[线上挂号]的订单信息"); + } + register.filterInfo(); + return Result.success(register); + } catch (Exception e) { + return Result.error(e); + } + } + + /** + * [就医助手]修改流程标记 + */ + @Action("completeRegTreatNum") + public Result completeRegTreatNum(String treatNum, String processMark, String openId, String patientId, String tradeNo, String hisTransNo, String orderFromOwner) { + try { + patientId = getDecodeString(patientId); + log.info("[就医助手]修改流程标记 treatNum={}, processMark={}, openId={}, patientId={}, tradeNo={}, hisTransNo={}, orderFromOwner={}", treatNum, processMark, openId, patientId, tradeNo, hisTransNo, orderFromOwner); + if (ObjectUtils.isEmpty(treatNum) || ObjectUtils.isEmpty(patientId)) { + return Result.error(ResultEnum.PARAM_IS_DEFECT); + } + new RegService().completeRegTreatNum(treatNum, openId, patientId, tradeNo, hisTransNo, orderFromOwner); + new MedToolService().saveMedToolMarkByTreatNum(treatNum, 1, processMark); + return Result.success(); } catch (Exception e) { return Result.error(e); } } +// /** +// * [就医助手]根据挂号日期范围,查询挂号记录 +// */ +// @Action("getRegRecordsByOpenId") +// public Result getRegRecordsByOpenId(String begDate, String endDate, String openid) { +// try { +// log.info("[就医助手]根据挂号日期范围,查询挂号记录 begDate={}, endDate={}, openid={}", begDate, endDate, openid); +// if (begDate == null || endDate == null || openid == null) { +// return Result.error(ResultEnum.PARAM_IS_DEFECT); +// } +// List regList = new RegisterDao().selectListByRegDate(begDate, endDate, openid); +// for (Register item : regList) { +// item.setEnId(ReqParamHelper.encode(String.valueOf(item.getId()))); +// item.setId(null); +// item.filterInfo(); // 数据过滤 +// } +// return Result.success(regList); +// } catch (Exception e) { +// return Result.error(e); +// } +// } + // /** // * [预约挂号]获取指定科室医生信息 diff --git a/src/main/java/com/ynxbd/common/action/SmsAction.java b/src/main/java/com/ynxbd/common/action/SmsAction.java index e72e495..1577c0b 100644 --- a/src/main/java/com/ynxbd/common/action/SmsAction.java +++ b/src/main/java/com/ynxbd/common/action/SmsAction.java @@ -195,12 +195,13 @@ public class SmsAction extends BaseAction { /** * 天助平台短信推送(红河州第一人民医院(影像报告使用)) + * 备注:2025-05-07 只有放射科会发短信 * @param tel 电话号码 * @param content 内容 * @return 返回发送结果 */ @Action("danMiSms") - public Result DanMiSms(String tel, String content) { + public Result danMiSms(String tel, String content) { log.info("[天助平台短信]url-{}, content={}", tel, content); if (tel == null || content == null) { return Result.error(ResultEnum.PARAM_IS_INVALID); diff --git a/src/main/java/com/ynxbd/common/action/base/BaseAction.java b/src/main/java/com/ynxbd/common/action/base/BaseAction.java index 28df31c..61972c4 100644 --- a/src/main/java/com/ynxbd/common/action/base/BaseAction.java +++ b/src/main/java/com/ynxbd/common/action/base/BaseAction.java @@ -5,6 +5,7 @@ import com.ynxbd.common.helper.common.HttpHelper; import com.ynxbd.common.helper.common.JsonHelper; import com.ynxbd.wx.wxfactory.ReqParamHelper; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; import org.apache.struts2.ServletActionContext; import org.apache.struts2.action.ServletRequestAware; diff --git a/src/main/java/com/ynxbd/common/action/pay/MedicalAction.java b/src/main/java/com/ynxbd/common/action/pay/MedicalAction.java index eef453a..d39986d 100644 --- a/src/main/java/com/ynxbd/common/action/pay/MedicalAction.java +++ b/src/main/java/com/ynxbd/common/action/pay/MedicalAction.java @@ -45,7 +45,7 @@ public class MedicalAction extends BaseAction { @Action("getFeeDetails") public Result getFeeDetails(String callNo, String payCode, String openid, String qrCode, String patientId, String cardNo, String realName, BigDecimal totalFee, Boolean isTime, String ybAttrib, String ybBZCode, String ybBZName) { try { - log.info("【医保】上传明细下单 callNo={}, payCode={}, openid={}, qrCode={}, patientId={}, totalFee={}, ybAttrib={}, ybBZCode={}, ybBZName={}", callNo, payCode, openid, qrCode, patientId, totalFee, ybAttrib, ybBZCode, ybBZName); + log.info("[医保]上传明细下单 callNo={}, payCode={}, openid={}, qrCode={}, patientId={}, totalFee={}, ybAttrib={}, ybBZCode={}, ybBZName={}", callNo, payCode, openid, qrCode, patientId, totalFee, ybAttrib, ybBZCode, ybBZName); if (callNo == null || payCode == null || openid == null || qrCode == null || patientId == null || cardNo == null || totalFee == null) { return Result.error(ResultEnum.PARAM_IS_DEFECT); } @@ -162,7 +162,7 @@ public class MedicalAction extends BaseAction { public Result order(String callNo, String payCode, String openid, String patientId, String cardNo, String realName, String treatNum, String payOrdId, String payAuthNo, String mdTrtId, String chrgBchno, String mdUserId, BigDecimal totalFee, BigDecimal acctFee, BigDecimal hifpFee, BigDecimal insuranceFee, BigDecimal cashFee, String notifyType) { try { - log.info("【医保】下单 callNo={}, payCode={}, openid={}, patientId={}, totalFee={}", callNo, payCode, openid, patientId, totalFee); + log.info("[医保]下单 callNo={}, payCode={}, openid={}, patientId={}, totalFee={}", callNo, payCode, openid, patientId, totalFee); if (callNo == null || payCode == null || openid == null || patientId == null || cardNo == null || totalFee == null) { return Result.error(ResultEnum.PARAM_IS_DEFECT); } @@ -223,7 +223,7 @@ public class MedicalAction extends BaseAction { BigDecimal hifpFee = recipe.getHifpFee(); if (payStatus == null || hisStatus == null || chrgBchno == null || bankTransNo == null || mdUserId == null || cashFee == null || acctFee == null || hifpFee == null) { - log.info("【医保】退费参数缺失 outTradeNo={}, bankTransNo={}, payStatus={}, hisStatus={}, chrgBchno={}, cashFee={}, acctFee={}, hifpFee={}", outTradeNo, bankTransNo, payStatus, hisStatus, chrgBchno, cashFee, acctFee, hifpFee); + log.info("[医保]退费参数缺失 outTradeNo={}, bankTransNo={}, payStatus={}, hisStatus={}, chrgBchno={}, cashFee={}, acctFee={}, hifpFee={}", outTradeNo, bankTransNo, payStatus, hisStatus, chrgBchno, cashFee, acctFee, hifpFee); return Result.error(ResultEnum.PAY_ORDER_PARAMS_IS_DEFECT); } @@ -238,11 +238,11 @@ public class MedicalAction extends BaseAction { Result result = MedicalService.refund(userInfo.getPayAuthNo(), chrgBchno.substring(1), outTradeNo, bankTransNo, tradeNo, mdUserId, cashFee, insuranceFee); - String message = result.isSuccess() ? WxPayHelper.OK : result.getMessage(); + String message = result.isOK() ? WxPayHelper.OK : result.getMessage(); if (!recipeDao.updateRefundByTradeNo(tradeNo, message)) { - log.info("【医保】修改退费信息失败 [{}] outTradeNo={}, tradeNo={}", message, outTradeNo, tradeNo); + log.info("[医保]修改退费信息失败 [{}] outTradeNo={}, tradeNo={}", message, outTradeNo, tradeNo); } - if (result.isSuccess()) { + if (result.isOK()) { return Result.success(); } return Result.error(); @@ -286,7 +286,7 @@ public class MedicalAction extends BaseAction { */ @Action("queryOrder") public Result queryOrder(String outTradeNo, String medTransId) { - log.info("【医保】查询订单 outTradeNo={}, medTransId={}", outTradeNo, medTransId); + log.info("[医保]查询订单 outTradeNo={}, medTransId={}", outTradeNo, medTransId); MedicalOrder order = WxMedicalHelper.queryOrder(WxCacheHelper.getAccessToken(), outTradeNo, medTransId); if (order.isOk()) { return Result.success(order); @@ -334,24 +334,23 @@ public class MedicalAction extends BaseAction { String notifyType = notifyInfo.getAttach(); - log.info("【医保】[{}] 收到通知 outTradeNo={}, bankTransNo={}, notifyType={}", + log.info("[医保][{}] 收到通知 outTradeNo={}, bankTransNo={}, notifyType={}", notifyType, outTradeNo, bankTransNo, notifyType); switch (PEnum.toEnum(notifyType)) { case RECIPE: - MedicalService.recipePay(MerchantEnum.WX, outTradeNo, bankTransNo, payDate, payTime, openid, payInfo); + MedicalService.recipePayNotify(MerchantEnum.WX, outTradeNo, bankTransNo, payDate, payTime, openid, payInfo); break; case REG: // 挂号 - MedicalService.regPay(MerchantEnum.WX, outTradeNo, bankTransNo, payDate, payTime, openid, payInfo); + MedicalService.regPayNotify(MerchantEnum.WX, outTradeNo, bankTransNo, payDate, payTime, openid, payInfo); break; case IN_HOSP: - break; default: - log.info("【医保】通知类型错误"); + log.info("[医保]通知类型错误"); break; } diff --git a/src/main/java/com/ynxbd/common/action/pay/MedicalTestAction.java b/src/main/java/com/ynxbd/common/action/pay/MedicalTestAction.java index 0d689af..74d8d55 100644 --- a/src/main/java/com/ynxbd/common/action/pay/MedicalTestAction.java +++ b/src/main/java/com/ynxbd/common/action/pay/MedicalTestAction.java @@ -113,7 +113,7 @@ public class MedicalTestAction extends BaseAction { */ @Action("queryWxOrder") public Result queryWxOrder(String accessToken, String outTradeNo, String medTransId) { - log.info("【医保】现金退费 outTradeNo={}, medTransId={}", outTradeNo, medTransId); + log.info("[医保]现金退费 outTradeNo={}, medTransId={}", outTradeNo, medTransId); MedicalOrder order = WxMedicalHelper.queryOrder(accessToken, outTradeNo, medTransId); if (order.isOk()) { diff --git a/src/main/java/com/ynxbd/common/action/pay/PayAction.java b/src/main/java/com/ynxbd/common/action/pay/PayAction.java index 12d66a9..c07449d 100644 --- a/src/main/java/com/ynxbd/common/action/pay/PayAction.java +++ b/src/main/java/com/ynxbd/common/action/pay/PayAction.java @@ -95,7 +95,7 @@ public class PayAction extends BaseAction { } Result result = recipeService.recipeHand(merchantEnum, openid, patientId, treatNum, totalFee, recipeJson, payWay, awaitSecond); - if (!result.isSuccess() || result.getData() != null) { // 业务错误 || 存在返回数据-需提前返回 + if (!result.isOK() || result.getData() != null) { // 业务错误 || 存在返回数据-需提前返回 return result; } @@ -189,7 +189,7 @@ public class PayAction extends BaseAction { } String pushMessage = "已申请退款,原因:患者主动取消退费,订单号:" + outTradeNo + "orderNo:" + recipeId; Result result = peisService.peisAutoRefund(recipeId, merchantEnum, outTradeNo, new BigDecimal(totalFee), pushMessage, new Date(), openid); - if (result.isSuccess()) { + if (result.isOK()) { peisService.peisRefund(recipeId, "OK", ""); } else { peisService.peisRefund(recipeId, "FAIL", result.getMessage()); @@ -323,7 +323,7 @@ public class PayAction extends BaseAction { /** - * 【医保】微信现金退费 + * [医保]微信现金退费 * * @param callNo 调用码 { recipe:处方;register:挂号;in_hosp:住院预交金 } * @param payOrdId 医保订单号 diff --git a/src/main/java/com/ynxbd/common/action/LisReportAction.java b/src/main/java/com/ynxbd/common/action/report/LisReportAction.java similarity index 93% rename from src/main/java/com/ynxbd/common/action/LisReportAction.java rename to src/main/java/com/ynxbd/common/action/report/LisReportAction.java index 4d4e25b..af72e1d 100644 --- a/src/main/java/com/ynxbd/common/action/LisReportAction.java +++ b/src/main/java/com/ynxbd/common/action/report/LisReportAction.java @@ -1,320 +1,323 @@ -/* - * * - * * @Project 微信公众号 - * * @Author 张剑峰 - * * @Date 2020/12/3 下午4:35 - * * @Description - * * @Version v1.0.0 - * * @Copyright @ 2020 云南新八达科技有限公司 All rights reserved. - * - */ - -package com.ynxbd.common.action; - -import com.ynxbd.common.action.base.BaseAction; -import com.ynxbd.common.bean.enums.ReportEnum; -import com.ynxbd.common.bean.lis.XBDLisBactResult; -import com.ynxbd.common.bean.lis.XBDLisImageResult; -import com.ynxbd.common.bean.lis.XBDLisReport; -import com.ynxbd.common.bean.lis.XBDLisResult; -import com.ynxbd.common.dao.ReportDao; -import com.ynxbd.common.dao.lis.RMLisDao; -import com.ynxbd.common.dao.lis.XBDLisDao; -import com.ynxbd.common.helper.common.Base64Helper; -import com.ynxbd.common.helper.common.ImageHelper; -import com.ynxbd.common.helper.common.NumHelper; -import com.ynxbd.common.result.Result; -import com.ynxbd.common.result.ResultEnum; -import com.ynxbd.common.service.ReportService; -import com.ynxbd.wx.config.WeChatConfig; -import com.ynxbd.wx.wxfactory.ReqParamHelper; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.codec.digest.DigestUtils; -import org.apache.commons.lang3.ObjectUtils; -import org.apache.struts2.convention.annotation.Action; -import org.apache.struts2.convention.annotation.Namespace; - -import java.io.File; -import java.io.FileInputStream; -import java.util.ArrayList; -import java.util.List; - - -@Slf4j -@Namespace("/lis") -public class LisReportAction extends BaseAction { - - /** - * 查询报告列表 - * - * @return 报告列表 - */ - @Action("report") - public Result getReportList(String treatNum, String treatNumPrefix, String flag, String patientType, String startTime, String endTime) { - treatNum = getDecodeString(treatNum); - log.info("[Lis报告单]查询: flag={{}}, treatNumPrefix={{}}, treatNum={{}}, patientType={{}}", flag, treatNumPrefix, treatNum, patientType); - if (flag == null || patientType == null || treatNum == null) { - return Result.error(ResultEnum.PARAM_IS_DEFECT); - } - if (!ObjectUtils.isEmpty(treatNumPrefix)) { // 瑞美lis报告前缀 - treatNum = treatNumPrefix + treatNum; - } - try { - List lstReport = new ArrayList<>(); - switch (flag) { - case "1": // 新八达 - lstReport = new XBDLisDao().getReport(treatNum, patientType); - break; - case "2": // 瑞美 - lstReport = new XBDLisDao().getReport4RM(treatNum); - - String reportId; - for (XBDLisReport reportItem : lstReport) { - // 倒叙->base64->md5 - reportId = NumHelper.numDesc(reportItem.getId()); - if (reportId != null) { - reportId = Base64Helper.encode(reportId); - reportId = DigestUtils.md5Hex(reportId); - reportItem.setRm_cipherText(reportId); - } - } - break; - case "3": // 科华 - if (WeChatConfig.APP_ID.equals("wxc01532c55273dc6b")) { // 红河州妇幼门诊号从bed_no查 - lstReport = new XBDLisDao().getReport4KH_Hhzfy(treatNum, patientType); - } else { - lstReport = new XBDLisDao().getReport4KH(treatNum, patientType); - } - break; - case "4": // 石林 - lstReport = new XBDLisDao().getReport4Sl(treatNum, patientType); - break; - case "5": - lstReport = RMLisDao.getReportList("1", treatNum, startTime, endTime, "0"); - break; - case "6": - lstReport = new XBDLisDao().getReport7RM(treatNum); - String report7Id; - for (XBDLisReport reportItem : lstReport) { - // 倒叙->base64->md5 - report7Id = NumHelper.numDesc(reportItem.getId()); - if (report7Id != null) { - report7Id = Base64Helper.encode(report7Id); - report7Id = DigestUtils.md5Hex(report7Id); - reportItem.setRm_cipherText(report7Id); - } - } - break; - } - - if (lstReport != null) { - for (XBDLisReport item : lstReport) { - if (item.getId() != null) { - item.setEnReportId(ReqParamHelper.encode(item.getId())); - } - if (item.getSampleCode() != null) { - item.setEnSampleCode(ReqParamHelper.encode(item.getSampleCode())); - } - } - } - - new ReportService().updateReportLisCount(); - return Result.success(lstReport); - } catch (Exception e) { - return Result.error(ResultEnum.LIS_SELECT_DATA_ERROR); - } - } - - - /** - * 普通报告 - */ - @Action("result") - public Result getResult(String reportId, String sampleCode, String flag, String testDate, String openid) { - reportId = getDecodeString(reportId); - sampleCode = getDecodeString(sampleCode); - - log.info("[Lis结果]查询: flag={{}}, reportId={}, testDate={{}}, sampleCode={{}}", flag, reportId, testDate, sampleCode); - - if ("1".equals(flag) && (testDate == null || sampleCode == null)) { - return Result.error(ResultEnum.PARAM_IS_BLANK); - } - - if (("2".equals(flag) || "4".equals(flag)) && reportId == null) { - return Result.error(ResultEnum.PARAM_IS_BLANK); - } - - try { - List lstResult = new ArrayList<>(); - switch (flag) { - case "1": // 新八达 - lstResult = new XBDLisDao().getResult(testDate, sampleCode); - break; - case "2": // 瑞美 - lstResult = new XBDLisDao().getResult4RM(Integer.parseInt(reportId)); - break; - case "3": // 科华 - lstResult = new XBDLisDao().getResult4KH(testDate, sampleCode); - break; - case "4": - lstResult = new XBDLisDao().getResult4Sl(reportId); - break; - case "5": - lstResult = RMLisDao.getReportResult(reportId); - break; - case "6": - lstResult = new XBDLisDao().getResult7RM(reportId); - break; - } - return Result.success(lstResult); - } catch (Exception e) { - return Result.success(ResultEnum.LIS_SELECT_DATA_ERROR); - } - } - - /** - * 图像报告 - */ - @Action("image") - public Result getImage(String reportId, String sampleCode, String flag, String testDate, String openid) { - reportId = getDecodeString(reportId); - sampleCode = getDecodeString(sampleCode); - - log.info("查询Lis图像: flag={{}}, reportId={}, testDate={{}}, sampleCode={{}}", flag, reportId, testDate, sampleCode); - if ("1".equals(flag) && (testDate == null || sampleCode == null)) { - return Result.error(ResultEnum.PARAM_IS_BLANK); - } - - if (("2".equals(flag) || "4".equals(flag)) && reportId == null) { - return Result.error(ResultEnum.PARAM_IS_BLANK); - } - - List lstImage = new ArrayList<>(); - try { - switch (flag) { - case "1": - lstImage = new XBDLisDao().getImage(testDate, sampleCode); - break; - case "2": - lstImage = new XBDLisDao().getImage4RM(Integer.parseInt(reportId)); - break; - case "3": - lstImage = new XBDLisDao().getImage4KH(testDate, sampleCode); - break; - case "4": - lstImage = new XBDLisDao().getImage4Sl(reportId); - break; - case "6": - lstImage = new XBDLisDao().getImage7RM(reportId); - break; - } - } catch (Exception e) { - return Result.error(ResultEnum.LIS_SELECT_DATA_ERROR); - } - - FileInputStream fis = null; - byte[] bytes; - List resultList = new ArrayList<>(); - for (XBDLisImageResult item : lstImage) { - if (item.getImage() == null && item.getUrl() != null) { - try { - fis = new FileInputStream(new File(item.getUrl())); - bytes = new byte[fis.available()]; - //将文件内容写入字节数组 - fis.read(bytes); - item.setImage(bytes); - item.setUrl(null); - - // 将图片字节码进行压缩 - byte[] decompressPicByte = ImageHelper.decompressPicByte(item.getImage(), 0); // 0:按100*200压缩、1:按原图片的50%压缩 - // 将图片字节进行base64编码(在word文档中显示图片时会用到base64转码) - if (decompressPicByte != null) { - item.setImageBase64( - "data:image/jpg;base64," + ImageHelper.converPicBase64(decompressPicByte)); - } - item.setImage(null); - resultList.add(item); - } catch (Exception e) { - e.printStackTrace(); - } finally { - try { - if (fis != null) { - fis.close(); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - } - } - return Result.success(resultList); - } - - /** - * 细菌报告 - */ - @Action("bact") - public Result getBactResult(String reportId, String sampleCode, String flag, String testDate, String openid) { - reportId = getDecodeString(reportId); - sampleCode = getDecodeString(sampleCode); - - log.info("[Lis微生物结果]查询: flag={{}}, reportId={}, testDate={{}}, sampleCode={{}}", flag, reportId, testDate, sampleCode); - - if ("1".equals(flag) && (testDate == null || sampleCode == null)) { - return Result.error(ResultEnum.PARAM_IS_BLANK); - } - - if (("2".equals(flag) || "4".equals(flag)) && reportId == null) { - return Result.error(ResultEnum.PARAM_IS_BLANK); - } - - try { - List bactResults = new ArrayList<>(); - switch (flag) { - case "1": - bactResults = new XBDLisDao().getBactResult(testDate, sampleCode); - break; - case "2": - bactResults = new XBDLisDao().getBactResult4RM(Integer.parseInt(reportId)); - break; - case "3": - bactResults = new XBDLisDao().getBactResult4KH(testDate, sampleCode); - break; - case "4": - bactResults = new XBDLisDao().getBactResult4Sl(reportId); - break; - case "5": - bactResults = RMLisDao.getBactResult(reportId); - break; - } - return Result.success(bactResults); - } catch (Exception e) { - return Result.error(ResultEnum.LIS_SELECT_DATA_ERROR); - } - } - - /** - * 下载报告 - */ - @Action("downLisReport") - public Result downLisReport(String callNo) { - // LIS类型 { 1:新八达LIS 2:瑞美LIS(需要加前缀M,红河不用加) 3:科华LIS } - log.info("[LIS报告]下载: callNo={{}}", callNo); - if ("2".equals(callNo)) { // 瑞美 - String queryCode = getString("queryCode"); - String queryType = getString("queryType"); - return RMLisDao.downLisReport(queryType, queryCode); - } - return Result.error(); - } - - /** - * 展示报告 瑞美专用 - */ - @Action("showLisReport") - public Result showLisReport(String queryCode) { - queryCode = getDecodeString(queryCode); - String queryType = "1"; //ReportID 报告单ID - return RMLisDao.downLisReport(queryType, queryCode); - } -} +/* + * * + * * @Project 微信公众号 + * * @Author 张剑峰 + * * @Date 2020/12/3 下午4:35 + * * @Description + * * @Version v1.0.0 + * * @Copyright @ 2020 云南新八达科技有限公司 All rights reserved. + * + */ + +package com.ynxbd.common.action.report; + +import com.ynxbd.common.action.base.BaseAction; +import com.ynxbd.common.bean.lis.XBDLisBactResult; +import com.ynxbd.common.bean.lis.XBDLisImageResult; +import com.ynxbd.common.bean.lis.XBDLisReport; +import com.ynxbd.common.bean.lis.XBDLisResult; +import com.ynxbd.common.dao.lis.RMLisDao; +import com.ynxbd.common.dao.lis.XBDLisDao; +import com.ynxbd.common.helper.common.Base64Helper; +import com.ynxbd.common.helper.common.ImageHelper; +import com.ynxbd.common.helper.common.NumHelper; +import com.ynxbd.common.result.Result; +import com.ynxbd.common.result.ResultEnum; +import com.ynxbd.common.service.ReportService; +import com.ynxbd.wx.config.WeChatConfig; +import com.ynxbd.wx.wxfactory.ReqParamHelper; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.codec.digest.DigestUtils; +import org.apache.commons.lang3.ObjectUtils; +import org.apache.struts2.convention.annotation.Action; +import org.apache.struts2.convention.annotation.Namespace; + +import java.io.File; +import java.io.FileInputStream; +import java.util.ArrayList; +import java.util.List; + + +@Slf4j +@Namespace("/lis") +public class LisReportAction extends BaseAction { + + /** + * 查询报告列表 + * + * @return 报告列表 + */ + @Action("report") + public Result getReportList(String treatNum, String treatNumPrefix, String flag, String patientType, String startTime, String endTime) { + treatNum = getDecodeString(treatNum); + log.info("[Lis报告单]查询: flag={{}}, treatNumPrefix={{}}, treatNum={{}}, patientType={{}}", flag, treatNumPrefix, treatNum, patientType); + if (flag == null || patientType == null || treatNum == null) { + return Result.error(ResultEnum.PARAM_IS_DEFECT); + } + if (!ObjectUtils.isEmpty(treatNumPrefix)) { // 瑞美lis报告前缀 + treatNum = treatNumPrefix + treatNum; + } + try { + List lstReport = new ArrayList<>(); + switch (flag) { + case "1": // 新八达 + lstReport = new XBDLisDao().getReport(treatNum, patientType); + break; + case "2": // 瑞美 + lstReport = new XBDLisDao().getReport4RM(treatNum); + + String reportId; + for (XBDLisReport reportItem : lstReport) { + // 倒叙->base64->md5 + reportId = NumHelper.numDesc(reportItem.getId()); + if (reportId != null) { + reportId = Base64Helper.encode(reportId); + reportId = DigestUtils.md5Hex(reportId); + reportItem.setRm_cipherText(reportId); + } + } + break; + case "3": // 科华 + if (WeChatConfig.APP_ID.equals("wxc01532c55273dc6b")) { // 红河州妇幼门诊号从bed_no查 + lstReport = new XBDLisDao().getReport4KH_Hhzfy(treatNum, patientType); + } else { + lstReport = new XBDLisDao().getReport4KH(treatNum, patientType); + } + break; + case "4": // 石林 + lstReport = new XBDLisDao().getReport4Sl(treatNum, patientType); + break; + case "5": + lstReport = RMLisDao.getReportList("1", treatNum, startTime, endTime, "0"); + break; + case "6": + lstReport = new XBDLisDao().getReport7RM(treatNum); + String report7Id; + for (XBDLisReport reportItem : lstReport) { + // 倒叙->base64->md5 + report7Id = NumHelper.numDesc(reportItem.getId()); + if (report7Id != null) { + report7Id = Base64Helper.encode(report7Id); + report7Id = DigestUtils.md5Hex(report7Id); + reportItem.setRm_cipherText(report7Id); + } + } + break; + } + + if (lstReport != null) { + for (XBDLisReport item : lstReport) { + if (item.getId() != null) { + item.setEnReportId(ReqParamHelper.encode(item.getId())); + } + if (item.getSampleCode() != null) { + item.setEnSampleCode(ReqParamHelper.encode(item.getSampleCode())); + } + } + } + + new ReportService().updateReportLisCount(); + return Result.success(lstReport); + } catch (Exception e) { + return Result.error(ResultEnum.LIS_SELECT_DATA_ERROR); + } + } + + + /** + * 普通报告 + */ + @Action("result") + public Result getResult(String reportId, String sampleCode, String flag, String testDate, String openid) { + reportId = getDecodeString(reportId); + sampleCode = getDecodeString(sampleCode); + + log.info("[Lis结果]查询: flag={{}}, reportId={}, testDate={{}}, sampleCode={{}}", flag, reportId, testDate, sampleCode); + + if ("1".equals(flag) && (testDate == null || sampleCode == null)) { + return Result.error(ResultEnum.PARAM_IS_BLANK); + } + + if (("2".equals(flag) || "4".equals(flag)) && reportId == null) { + return Result.error(ResultEnum.PARAM_IS_BLANK); + } + + try { + List lstResult = new ArrayList<>(); + switch (flag) { + case "1": // 新八达 + lstResult = new XBDLisDao().getResult(testDate, sampleCode); + break; + case "2": // 瑞美 + lstResult = new XBDLisDao().getResult4RM(Integer.parseInt(reportId)); + break; + case "3": // 科华 + lstResult = new XBDLisDao().getResult4KH(testDate, sampleCode); + break; + case "4": + lstResult = new XBDLisDao().getResult4Sl(reportId); + break; + case "5": + lstResult = RMLisDao.getReportResult(reportId); + break; + case "6": + lstResult = new XBDLisDao().getResult7RM(reportId); + break; + } + return Result.success(lstResult); + } catch (Exception e) { + return Result.success(ResultEnum.LIS_SELECT_DATA_ERROR); + } + } + + /** + * 图像报告 + */ + @Action("image") + public Result getImage(String reportId, String sampleCode, String flag, String testDate, String openid) { + reportId = getDecodeString(reportId); + sampleCode = getDecodeString(sampleCode); + + log.info("查询Lis图像: flag={{}}, reportId={}, testDate={{}}, sampleCode={{}}", flag, reportId, testDate, sampleCode); + if ("1".equals(flag) && (testDate == null || sampleCode == null)) { + return Result.error(ResultEnum.PARAM_IS_BLANK); + } + + if (("2".equals(flag) || "4".equals(flag)) && reportId == null) { + return Result.error(ResultEnum.PARAM_IS_BLANK); + } + + List lstImage = new ArrayList<>(); + try { + switch (flag) { + case "1": + lstImage = new XBDLisDao().getImage(testDate, sampleCode); + break; + case "2": + lstImage = new XBDLisDao().getImage4RM(Integer.parseInt(reportId)); + break; + case "3": + lstImage = new XBDLisDao().getImage4KH(testDate, sampleCode); + break; + case "4": + lstImage = new XBDLisDao().getImage4Sl(reportId); + break; + case "6": + lstImage = new XBDLisDao().getImage7RM(reportId); + break; + } + } catch (Exception e) { + return Result.error(ResultEnum.LIS_SELECT_DATA_ERROR); + } + + FileInputStream fis = null; + byte[] bytes; + List resultList = new ArrayList<>(); + for (XBDLisImageResult item : lstImage) { + if (item.getImage() == null && item.getUrl() != null) { + try { + fis = new FileInputStream(new File(item.getUrl())); + bytes = new byte[fis.available()]; + //将文件内容写入字节数组 + fis.read(bytes); + item.setImage(bytes); + item.setUrl(null); + + // 将图片字节码进行压缩 + byte[] decompressPicByte = ImageHelper.decompressPicByte(item.getImage(), 0); // 0:按100*200压缩、1:按原图片的50%压缩 + // 将图片字节进行base64编码(在word文档中显示图片时会用到base64转码) + if (decompressPicByte != null) { + item.setImageBase64( + "data:image/jpg;base64," + ImageHelper.converPicBase64(decompressPicByte)); + } + item.setImage(null); + resultList.add(item); + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + if (fis != null) { + fis.close(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + } + } + return Result.success(resultList); + } + + /** + * 细菌报告 + */ + @Action("bact") + public Result getBactResult(String reportId, String sampleCode, String flag, String testDate, String openid) { + reportId = getDecodeString(reportId); + sampleCode = getDecodeString(sampleCode); + + log.info("[Lis微生物结果]查询: flag={{}}, reportId={}, testDate={{}}, sampleCode={{}}", flag, reportId, testDate, sampleCode); + + if ("1".equals(flag) && (testDate == null || sampleCode == null)) { + return Result.error(ResultEnum.PARAM_IS_BLANK); + } + + if (("2".equals(flag) || "4".equals(flag)) && reportId == null) { + return Result.error(ResultEnum.PARAM_IS_BLANK); + } + + try { + List bactResults = new ArrayList<>(); + switch (flag) { + case "1": + bactResults = new XBDLisDao().getBactResult(testDate, sampleCode); + break; + case "2": + bactResults = new XBDLisDao().getBactResult4RM(Integer.parseInt(reportId)); + break; + case "3": + bactResults = new XBDLisDao().getBactResult4KH(testDate, sampleCode); + break; + case "4": + bactResults = new XBDLisDao().getBactResult4Sl(reportId); + break; + case "5": + bactResults = RMLisDao.getBactResult(reportId); + break; + } + return Result.success(bactResults); + } catch (Exception e) { + return Result.error(ResultEnum.LIS_SELECT_DATA_ERROR); + } + } + + /** + * 下载报告 + * + * @param callNo 调用类型 + * @param queryType 查询类型 + * @param reportId 报告单ID + * @return + */ + @Action("downLisReport") + public Result downLisReport(String callNo, String queryType, String reportId) { + // LIS类型 { 1:新八达LIS 2:瑞美LIS(需要加前缀M,红河不用加) 3:科华LIS } + reportId = getDecodeString(reportId); + log.info("[LIS报告]下载: callNo={}, queryType={}, reportId={}", callNo, queryType, reportId); + if ("2".equals(callNo)) { // 瑞美 + if (queryType == null) queryType = "1"; + return RMLisDao.downLisReport(queryType, reportId); + } + return Result.error(); + } + + /** + * 展示报告 瑞美专用 + */ + @Action("showLisReport") + public Result showLisReport(String queryCode) { + queryCode = getDecodeString(queryCode); // ReportID 报告单ID + String queryType = "1"; + return RMLisDao.downLisReport(queryType, queryCode); + } +} diff --git a/src/main/java/com/ynxbd/common/action/PacsReportAction.java b/src/main/java/com/ynxbd/common/action/report/PacsReportAction.java similarity index 76% rename from src/main/java/com/ynxbd/common/action/PacsReportAction.java rename to src/main/java/com/ynxbd/common/action/report/PacsReportAction.java index d0a190d..91fccd4 100644 --- a/src/main/java/com/ynxbd/common/action/PacsReportAction.java +++ b/src/main/java/com/ynxbd/common/action/report/PacsReportAction.java @@ -1,4 +1,4 @@ -package com.ynxbd.common.action; +package com.ynxbd.common.action.report; import com.ynxbd.common.action.base.BaseAction; import com.ynxbd.common.bean.pacs.RISPacsReportInfo; @@ -13,13 +13,13 @@ import org.apache.struts2.convention.annotation.Action; import org.apache.struts2.convention.annotation.Namespace; import javax.servlet.ServletOutputStream; -import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import java.io.IOException; import java.util.ArrayList; import java.util.List; /** + * 上海岱嘉PACS + * * @author 李进才 * @ClassName PacsRisAction * @Description description @@ -32,27 +32,27 @@ public class PacsReportAction extends BaseAction { @Action("/list") - public Result list(String outPatientNum, String inPatientNum,Integer pageNum){ + public Result list(String outPatientNum, String inPatientNum, Integer pageNum) { outPatientNum = ReqParamHelper.decode(outPatientNum); inPatientNum = ReqParamHelper.decode(inPatientNum); - if(outPatientNum==null&&inPatientNum==null){ + if (outPatientNum == null && inPatientNum == null) { return Result.error(ResultEnum.PARAM_IS_BLANK); } List risPacsReportInfos = new ArrayList<>(); - if(outPatientNum!=null){ + if (outPatientNum != null) { risPacsReportInfos = new RISPacsDao().getReportInfoForOutPatientNum(outPatientNum); } - if(inPatientNum!=null){ - risPacsReportInfos =new RISPacsDao().getReportInfoForInPatientNum(inPatientNum); + if (inPatientNum != null) { + risPacsReportInfos = new RISPacsDao().getReportInfoForInPatientNum(inPatientNum); } - Integer pageTotal = risPacsReportInfos.size(); - if(pageTotal>1){ - risPacsReportInfos = risPacsReportInfos.subList(pageNum-1,pageNum); + int pageTotal = risPacsReportInfos.size(); + if (pageTotal > 1) { + risPacsReportInfos = risPacsReportInfos.subList(pageNum - 1, pageNum); } List resultList = new ArrayList<>(); - for(RISPacsReportInfo risPacsReportInfo : risPacsReportInfos) { + for (RISPacsReportInfo risPacsReportInfo : risPacsReportInfos) { try { - log.info("[Pacs]报告单路径-{},报告单Id-{}",risPacsReportInfo.getReportFile(),risPacsReportInfo.getReportId()); + log.info("[Pacs]报告单路径-{}, 报告单Id-{}", risPacsReportInfo.getReportFile(), risPacsReportInfo.getReportId()); risPacsReportInfo.setReportFile("data:application/jpg;base64," + ImageHelper.convertPDFtoImageBase64( RISPacsHelper.smbHelper.smbGet("smb:" + @@ -62,7 +62,7 @@ public class PacsReportAction extends BaseAction { throw new RuntimeException(e); } } - return Result.success(resultList,pageTotal); + return Result.success(resultList, pageTotal); } @Action("/download") @@ -71,10 +71,10 @@ public class PacsReportAction extends BaseAction { response.setContentType("application/octet-stream"); response.setHeader("Content-Disposition", "attachment; filename=file.pdf"); ServletOutputStream outputStream = response.getOutputStream(); - byte[] fileByte = RISPacsHelper.smbHelper.smbGet("smb:"+ + byte[] fileByte = RISPacsHelper.smbHelper.smbGet("smb:" + new RISPacsDao(). getReportPath(reportId). - replaceAll("\\\\","/")); + replaceAll("\\\\", "/")); outputStream.write(fileByte); outputStream.flush(); return Result.success(); @@ -87,7 +87,7 @@ public class PacsReportAction extends BaseAction { images.add("2"); images.add("2"); images.add("2"); - images = images.subList(1,2); + images = images.subList(1, 2); return Result.success(images); } } diff --git a/src/main/java/com/ynxbd/common/action/ReportAction.java b/src/main/java/com/ynxbd/common/action/report/ReportAction.java similarity index 61% rename from src/main/java/com/ynxbd/common/action/ReportAction.java rename to src/main/java/com/ynxbd/common/action/report/ReportAction.java index c8a0726..f0d8d2a 100644 --- a/src/main/java/com/ynxbd/common/action/ReportAction.java +++ b/src/main/java/com/ynxbd/common/action/report/ReportAction.java @@ -1,267 +1,396 @@ -package com.ynxbd.common.action; - -import com.ynxbd.common.action.base.BaseAction; -import com.ynxbd.common.bean.TreatRecord; -import com.ynxbd.common.bean.lis.XBDLisReport; -import com.ynxbd.common.bean.report.CheckReport; -import com.ynxbd.common.bean.report.InspectionReport; -import com.ynxbd.common.bean.report.PEIS; -import com.ynxbd.common.dao.his.HisReportDao; -import com.ynxbd.common.helper.common.DateHelper; -import com.ynxbd.common.result.Result; -import com.ynxbd.common.result.ResultEnum; -import com.ynxbd.common.service.ReportService; -import com.ynxbd.wx.wxfactory.ReqParamHelper; -import lombok.extern.slf4j.Slf4j; -import org.apache.struts2.convention.annotation.Action; -import org.apache.struts2.convention.annotation.Namespace; - -import java.util.ArrayList; -import java.util.Comparator; -import java.util.List; - -/** - * @Author wsq - * @Date 2020/8/15 12:35 - * @Copyright @ 2020 云南新八达科技有限公司 All rights reserved. - */ -@Slf4j -@Namespace("/report") -public class ReportAction extends BaseAction { - - /** - * [体检报告] - */ - @Action("getPEISByPatient") - public Result getPEISByPatient(String name, String idCardNo, String patientId, String begDate, String endDate) { - // http://localhost:8080/wx/report/getPEISByPatient.do?patientId=153671&idCardNo=533103198212184014&name=%E8%82%96%E7%81%BF&token=123 - try { - log.info("[体检报告]查询:patientId={}, idCardNo={}, name={}, begDate={}, endDate={}", patientId, idCardNo, name, begDate, endDate); - if (patientId == null || idCardNo == null || name == null || begDate == null || endDate == null) { - return Result.error(ResultEnum.PARAM_IS_DEFECT); - } - - List reportList = new HisReportDao().getPEISReportByPatient(name, idCardNo, begDate, endDate); - List resultList = new ArrayList<>(); - for (PEIS report : reportList) { - if (report.getExamDate() != null && DateHelper.inDateRange(begDate, endDate, report.getExamDate(), DateHelper.DateEnum.yyyy_MM_dd)) { - resultList.add(report); - } - } - return Result.success(resultList); - } catch (Exception e) { - return Result.error(ResultEnum.INTERFACE_HIS_INVOKE_ERROR); - } - } - - - /** - * [检查报告] - */ - @Action("getCheckByPatient") - public Result getCheckByPatient(String begDate, String endDate, String patientId, String openid) { - try { - patientId = getDecodeString(patientId); - // http://localhost:8080/wx/report/getCheckByPatient.do?patientId=153671&token=123 - log.info("[检查报告]查询 patientId={}, begDate={}, endDate={}", patientId, begDate, endDate); - if (patientId == null || begDate == null || endDate == null) { - return Result.error(ResultEnum.PARAM_IS_DEFECT); - } - - List reportList = new HisReportDao().getCheckByPatient(patientId, begDate, endDate); - - List resultList = new ArrayList<>(); - for (CheckReport report : reportList) { - if (report.getApplyDate() != null && DateHelper.inDateRange(begDate, endDate, report.getApplyDate(), DateHelper.DateEnum.yyyy_MM_dd)) { - resultList.add(report); - } - } - new ReportService().updateReportPacsCount(); - - return Result.success(resultList); - } catch (Exception e) { - return Result.error(ResultEnum.INTERFACE_HIS_INVOKE_ERROR); - } - } - - - /** - * [就诊记录]查询 - * - * @param begDate 开始日期 - * @param endDate 结束日期 - * @param patientId 患者id - * @param patientType 0:全部,1:门诊号,2:住院号 - * @param reportType 0:全部,1:检查,2:检验,3:检查+检验 - * @param isLately 是否只查询最近一条记录 - */ - @Action("getTreatRecordList") - public Result getTreatRecordList(String begDate, String endDate, String patientId, String patientType, String reportType, Boolean isLately, String deptCode) { - try { - patientId = getDecodeString(patientId); - // http://localhost:8081/wx/report/getTreatRecordList.do?patientId=406212&begDate=201801-01&endDate=2020-08-12&patientType=0&reportType=2 - if (patientId == null || begDate == null || endDate == null) { - return Result.error(ResultEnum.PARAM_IS_DEFECT); - } - - List records = new HisReportDao().getTreatRecordList(patientId, begDate, endDate, patientType, reportType, deptCode); - - if (!records.isEmpty() && isLately != null && isLately) { - List resultList = new ArrayList<>(); - records.stream().max(Comparator.comparing(TreatRecord::getConsultDate)).ifPresent(resultList::add); - return Result.success(resultList); - } - - for (TreatRecord record : records) { - if (record.getTreatNum() != null) { - record.setEnTreatNum(ReqParamHelper.encode(record.getTreatNum())); - } - } - return Result.success(records); - } catch (Exception e) { - return Result.error(ResultEnum.INTERFACE_HIS_INVOKE_ERROR); - } - - } - - - /** - * [患者]查询化验(检验)结果 - */ - @Action("getInspectByPatient") - public Result getInspectByPatient(String openid, String patientId, String begDate, String endDate) { - try { - patientId = getDecodeString(patientId); - - // http://localhost:8080/wx/report/getInspectByPatient.do?patientId=153671&token=123 - log.info("化验(检验)结果查询:patientId={}, begDate={}, endDate={}", patientId, begDate, endDate); - if (patientId == null || begDate == null || endDate == null) { - return Result.error(ResultEnum.PARAM_IS_DEFECT); - } - - List reportList = new HisReportDao().getInspectByPatient(patientId); - - List resultList = new ArrayList<>(); - for (InspectionReport report : reportList) { - if (report.getApplyDate() != null && DateHelper.inDateRange(begDate, endDate, report.getApplyDate(), DateHelper.DateEnum.yyyy_MM_dd)) { - resultList.add(report); - } - } - return Result.success(resultList); - } catch (Exception e) { - return Result.error(ResultEnum.INTERFACE_HIS_INVOKE_ERROR); - } - } - - /** - * [门诊号]根据门诊号查询化验(检验)结果 - */ - @Action("getInspectByTreatNum") - public Result getInspectByTreatNum(String type, String treatNum, String patientId) { - try { - treatNum = getDecodeString(treatNum); - patientId = getDecodeString(patientId); - // http://localhost:8080/wx/report/getInspectByTreatNum.do?patientId=153671&token=123 - log.info("[化验(检验)]结果查询:patientId={}, type={}, treatNum={}", patientId, type, treatNum); - if (patientId == null || type == null || treatNum == null) { - return Result.error(ResultEnum.PARAM_IS_BLANK); - } - - String mzNum = null, zyNum = null; - if ("1".equals(type)) { - mzNum = treatNum; - } else { - zyNum = treatNum; - } - - ArrayList resultList = new ArrayList<>(); - XBDLisReport xbdLisReport; - List reports = new HisReportDao().getInspectByTreatNum(patientId, zyNum, mzNum); - for (InspectionReport report : reports) { - xbdLisReport = new XBDLisReport(); - xbdLisReport.setReportName(report.getName()); - xbdLisReport.setSpecimenName(report.getType()); - xbdLisReport.setReportDate(report.getReportDate()); - xbdLisReport.setReporter(report.getReportDoctName()); - xbdLisReport.setItem(report.getItem()); - xbdLisReport.setTreatId(report.getMzNum() != null ? report.getMzNum() : report.getZyNum()); - xbdLisReport.setBedNo(report.getBedNum()); - - resultList.add(xbdLisReport); - } - return Result.success(resultList); - } catch (Exception e) { - return Result.error(ResultEnum.INTERFACE_HIS_INVOKE_ERROR); - } - } - - -// /** -// * 根据openid查询检查报告 -// */ -// @Action("getCheckAll") -// public String getCheckAll() { -// String openid = getString("openid"); -// log.info("根据openid查询检查报告 openid={}", openid); -// if (openid == null) { -// return Result.error(ResultEnum.PARAM_NOT_COMPLETE); -// } -// -// List patients = new PatientDao().selectListByOpenid(openid); -// -// List> reports = new ArrayList<>(); -// HisReportDao hisReportDao = new HisReportDao(); -// for (Patient patient : patients) { -// List reportItem = hisReportDao.getCheckByPatient(patient); -// reports.add(reportItem); -// } -// return Result.success(reports); -// } -// -// /** -// * 根据openid查询体检报告 -// */ -// @Action("getPEISReportAll") -// public String getPEISReportAll() { -// String openid = getString("openid"); -// log.info("根据openid查询体检报告 openid={}", openid); -// if (openid == null) { -// return Result.error(ResultEnum.PARAM_NOT_COMPLETE); -// } -// -// List patients = new PatientDao().selectListByOpenid(openid); -// -// List> reports = new ArrayList<>(); -// HisReportDao hisReportDao = new HisReportDao(); -// for (Patient patient : patients) { -// List reportItem = hisReportDao.getPEISReportByPatient(patient); -// reports.add(reportItem); -// } -// -// -// return Result.success(reports); -// } -// -// /** -// * 根据openid查询检验结果 -// */ -// @Action("getInspectionAll") -// public String getInspectionAll() { -// String openid = getString("openid"); -// log.info("根据openid查询检验结果,openid={}", openid); -// if (openid == null) { -// return Result.error(ResultEnum.PARAM_NOT_COMPLETE); -// } -// -// List patients = new PatientDao().selectListByOpenid(openid); -// -// List> reports = new ArrayList<>(); -// HisReportDao hisReportDao = new HisReportDao(); -// for (Patient patient : patients) { -// List reportItem = hisReportDao.getInspectByPatient(patient.getPatientId()); -// reports.add(reportItem); -// } -// return Result.success(reports); -// } - -} +package com.ynxbd.common.action.report; + +import com.ynxbd.common.action.base.BaseAction; +import com.ynxbd.common.bean.TreatRecord; +import com.ynxbd.common.bean.lis.XBDLisReport; +import com.ynxbd.common.bean.report.CheckReport; +import com.ynxbd.common.bean.report.InspectionReport; +import com.ynxbd.common.bean.report.PEIS; +import com.ynxbd.common.dao.his.HisReportDao; +import com.ynxbd.common.helper.common.DateHelper; +import com.ynxbd.common.result.Result; +import com.ynxbd.common.result.ResultEnum; +import com.ynxbd.common.service.ReportService; +import com.ynxbd.wx.wxfactory.ReqParamHelper; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.ObjectUtils; +import org.apache.struts2.convention.annotation.Action; +import org.apache.struts2.convention.annotation.Namespace; + +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @Author wsq + * @Date 2020/8/15 12:35 + * @Copyright @ 2020 云南新八达科技有限公司 All rights reserved. + */ +@Slf4j +@Namespace("/report") +public class ReportAction extends BaseAction { + + /** + * [体检报告] + */ + @Action("getPEISByPatient") + public Result getPEISByPatient(String name, String idCardNo, String patientId, String begDate, String endDate) { + // http://localhost:8080/wx/report/getPEISByPatient.do?patientId=153671&idCardNo=533103198212184014&name=%E8%82%96%E7%81%BF&token=123 + try { + log.info("[体检报告]查询:patientId={}, idCardNo={}, name={}, begDate={}, endDate={}", patientId, idCardNo, name, begDate, endDate); + if (patientId == null || idCardNo == null || name == null || begDate == null || endDate == null) { + return Result.error(ResultEnum.PARAM_IS_DEFECT); + } + + List reportList = new HisReportDao().getPEISReportByPatient(name, idCardNo, begDate, endDate); + List resultList = new ArrayList<>(); + for (PEIS report : reportList) { + if (report.getExamDate() != null && DateHelper.inDateRange(begDate, endDate, report.getExamDate(), DateHelper.DateEnum.yyyy_MM_dd)) { + resultList.add(report); + } + } + return Result.success(resultList); + } catch (Exception e) { + return Result.error(ResultEnum.INTERFACE_HIS_INVOKE_ERROR); + } + } + + + /** + * [检查报告] + * + * @param begDate 开始日期 + * @param endDate 结束日期 + * @param patientId 患者id + * @param treatNum 门诊号(可选) + * @param openid openid + * @return list + */ + @Action("getCheckByPatient") + public Result getCheckByPatient(String begDate, String endDate, String patientId, String treatNum, String openid) { + try { + patientId = getDecodeString(patientId); + // http://localhost:8080/wx/report/getCheckByPatient.do?patientId=153671&token=123 + log.info("[检查报告]查询 patientId={}, begDate={}, endDate={}, treatNum={}", patientId, begDate, endDate, treatNum); + if (patientId == null || begDate == null || endDate == null) { + return Result.error(ResultEnum.PARAM_IS_DEFECT); + } + + List reportList = new HisReportDao().getCheckByPatient(patientId, begDate, endDate); + new ReportService().updateReportPacsCount(); + if (reportList.isEmpty()) { + return Result.success(reportList); + } + List dataList = new ArrayList<>(); + String reportTreatNum; + for (CheckReport report : reportList) { + reportTreatNum = report.getMzNum(); + if (!ObjectUtils.isEmpty(reportTreatNum)) { + report.setTreatType("1"); // 门诊 + } else { + reportTreatNum = report.getZyNum(); + if (!ObjectUtils.isEmpty(reportTreatNum)) { + report.setTreatType("2"); // 住院 + } + } + report.setReportName(report.getName()); + report.setReportType(report.getType()); + report.setTreatNum(reportTreatNum); + report.setEnTreatNum(ReqParamHelper.encode(reportTreatNum)); + if (report.getApplyDate() != null && DateHelper.inDateRange(begDate, endDate, report.getApplyDate(), DateHelper.DateEnum.yyyy_MM_dd)) { + dataList.add(report); + } + } + + if (!dataList.isEmpty() && treatNum != null) { + dataList = reportList.stream().filter(o -> treatNum.equals(o.getTreatNum())).collect(Collectors.toList()); + } + return Result.success(dataList); + } catch (Exception e) { + return Result.error(ResultEnum.INTERFACE_HIS_INVOKE_ERROR); + } + } + + /** + * [检查报告] + * + * @param begDate 开始日期 + * @param endDate 结束日期 + * @param patientId 患者id + * @param treatNum 门诊号(可选) + * @param isDistinctTreat 是否去重就诊记录 + * @param openid openid + * @return list + */ + @Action("getHisCheckByTreat") + public Result getHisCheckByTreat(String begDate, String endDate, String patientId, String treatNum, Boolean isDistinctTreat, String openid) { + try { + patientId = getDecodeString(patientId); + // http://localhost:8080/wx/report/getCheckByPatient.do?patientId=153671&token=123 + log.info("[检查报告]查询 patientId={}, begDate={}, endDate={}, treatNum={}, isDistinctTreat={}", patientId, begDate, endDate, treatNum, isDistinctTreat); + if (patientId == null || begDate == null || endDate == null) { + return Result.error(ResultEnum.PARAM_IS_DEFECT); + } + + List reportList = new HisReportDao().getCheckByPatient(patientId, begDate, endDate); + if (reportList.isEmpty()) { + return Result.success(reportList); + } + + // 查询就诊记录 + if (isDistinctTreat != null && isDistinctTreat) { // 就诊记录去重 + List treatList = new ArrayList<>(); + for (CheckReport item : reportList) { + item.filterInfo(); // 敏感数据过滤 + item.filterWebData(); + if (ObjectUtils.isEmpty(item.getTreatNum())) { + continue; + } + if (item.getApplyDate() != null && DateHelper.inDateRange(begDate, endDate, item.getApplyDate(), DateHelper.DateEnum.yyyy_MM_dd)) { + CheckReport findTreat = treatList.stream().filter(o -> item.getTreatNum().equals(o.getTreatNum())).findFirst().orElse(null); + if (findTreat == null) { + treatList.add(item); + } + } + } + return Result.success(treatList); + } + + new ReportService().updateReportPacsCount(); + + List dataList = new ArrayList<>(); + if (!reportList.isEmpty() && treatNum != null) { + for (CheckReport item : reportList) { + item.filterWebData(); // 位置不能变 + if (treatNum.equals(item.getTreatNum())) { + dataList.add(item); + } + } + } + return Result.success(dataList); + } catch (Exception e) { + return Result.error(ResultEnum.INTERFACE_HIS_INVOKE_ERROR); + } + } + + /** + * [就诊记录]查询 + * + * @param begDate 开始日期 + * @param endDate 结束日期 + * @param patientId 患者id + * @param patientType 0:全部,1:门诊号,2:住院号 + * @param reportType 0:全部,1:检查,2:检验,3:检查+检验 + * @param isLately 是否只查询最近一条记录 + */ + @Action("getTreatRecordList") + public Result getTreatRecordList(String begDate, String endDate, String patientId, String patientType, String reportType, Boolean isLately, String deptCode) { + try { + patientId = getDecodeString(patientId); + // http://localhost:8081/wx/report/getTreatRecordList.do?patientId=406212&begDate=201801-01&endDate=2020-08-12&patientType=0&reportType=2 + if (patientId == null || begDate == null || endDate == null) { + return Result.error(ResultEnum.PARAM_IS_DEFECT); + } + + List records = new HisReportDao().getReportTreatRecords(patientId, begDate, endDate, patientType, reportType, deptCode); + + if (!records.isEmpty() && isLately != null && isLately) { + List resultList = new ArrayList<>(); + records.stream().max(Comparator.comparing(TreatRecord::getConsultDate)).ifPresent(resultList::add); + return Result.success(resultList); + } + + for (TreatRecord record : records) { + if (record.getTreatNum() != null) { + record.setEnTreatNum(ReqParamHelper.encode(record.getTreatNum())); + } + } + return Result.success(records); + } catch (Exception e) { + return Result.error(ResultEnum.INTERFACE_HIS_INVOKE_ERROR); + } + } + + + /** + * [就诊记录]查询 + * + * @param begDate 开始日期 + * @param endDate 结束日期 + * @param patientId 患者id + * @param treatType 0:全部,1:门诊号,2:住院号 + * @param reportType 0:全部,1:检查,2:检验,3:检查+检验 + * @param isLately 是否只查询最近一条记录 + */ + @Action("getReportTreatRecords") + public Result getReportTreatRecords(String begDate, String endDate, String patientId, String treatType, String reportType, Boolean isLately, String deptCode) { + try { + patientId = getDecodeString(patientId); + // http://localhost:8081/wx/report/getTreatRecords.do?patientId=406212&begDate=201801-01&endDate=2020-08-12&treatType=0&reportType=2 + if (patientId == null || begDate == null || endDate == null) { + return Result.error(ResultEnum.PARAM_IS_DEFECT); + } + + List records = new HisReportDao().getReportTreatRecords(patientId, begDate, endDate, treatType, reportType, deptCode); + if (records == null || records.isEmpty()) { + return Result.success(new ArrayList<>()); + } + for (TreatRecord record : records) { + if (record.getTreatNum() != null) { + record.setEnTreatNum(ReqParamHelper.encode(record.getTreatNum())); + } + } + + if (isLately != null && isLately) { + List resultList = new ArrayList<>(); + records.stream().max(Comparator.comparing(TreatRecord::getConsultDate)).ifPresent(resultList::add); + return Result.success(resultList); + } + return Result.success(records); + } catch (Exception e) { + return Result.error(ResultEnum.INTERFACE_HIS_INVOKE_ERROR); + } + } + + + /** + * [患者]查询化验(检验)结果 + */ + @Action("getInspectByPatient") + public Result getInspectByPatient(String openid, String patientId, String begDate, String endDate) { + try { + patientId = getDecodeString(patientId); + + // http://localhost:8080/wx/report/getInspectByPatient.do?patientId=153671&token=123 + log.info("化验(检验)结果查询:patientId={}, begDate={}, endDate={}", patientId, begDate, endDate); + if (patientId == null || begDate == null || endDate == null) { + return Result.error(ResultEnum.PARAM_IS_DEFECT); + } + + List reportList = new HisReportDao().getInspectByPatient(patientId); + + List resultList = new ArrayList<>(); + for (InspectionReport report : reportList) { + if (report.getApplyDate() != null && DateHelper.inDateRange(begDate, endDate, report.getApplyDate(), DateHelper.DateEnum.yyyy_MM_dd)) { + resultList.add(report); + } + } + return Result.success(resultList); + } catch (Exception e) { + return Result.error(ResultEnum.INTERFACE_HIS_INVOKE_ERROR); + } + } + + /** + * [门诊号]通过HIS根据门诊号查询化验(检验)结果 + */ + @Action("getInspectByTreatNum") + public Result getInspectByTreatNum(String type, String treatNum, String patientId) { + try { + treatNum = getDecodeString(treatNum); + patientId = getDecodeString(patientId); + // http://localhost:8080/wx/report/getInspectByTreatNum.do?patientId=153671&token=123 + log.info("[化验(检验)]结果查询:patientId={}, type={}, treatNum={}", patientId, type, treatNum); + if (patientId == null || type == null || treatNum == null) { + return Result.error(ResultEnum.PARAM_IS_BLANK); + } + + String mzNum = null, zyNum = null; + if ("1".equals(type)) { + mzNum = treatNum; + } else { + zyNum = treatNum; + } + + ArrayList resultList = new ArrayList<>(); + XBDLisReport xbdLisReport; + List reports = new HisReportDao().getInspectByTreatNum(patientId, zyNum, mzNum); + for (InspectionReport report : reports) { + xbdLisReport = new XBDLisReport(); + xbdLisReport.setReportName(report.getName()); + xbdLisReport.setSpecimenName(report.getType()); + xbdLisReport.setReportDate(report.getReportDate()); + xbdLisReport.setReporter(report.getReportDoctName()); + xbdLisReport.setItem(report.getItem()); + xbdLisReport.setTreatId(report.getMzNum() != null ? report.getMzNum() : report.getZyNum()); + xbdLisReport.setBedNo(report.getBedNum()); + + resultList.add(xbdLisReport); + } + return Result.success(resultList); + } catch (Exception e) { + return Result.error(ResultEnum.INTERFACE_HIS_INVOKE_ERROR); + } + } + + +// /** +// * 根据openid查询检查报告 +// */ +// @Action("getCheckAll") +// public String getCheckAll() { +// String openid = getString("openid"); +// log.info("根据openid查询检查报告 openid={}", openid); +// if (openid == null) { +// return Result.error(ResultEnum.PARAM_NOT_COMPLETE); +// } +// +// List patients = new PatientDao().selectListByOpenid(openid); +// +// List> reports = new ArrayList<>(); +// HisReportDao hisReportDao = new HisReportDao(); +// for (Patient patient : patients) { +// List reportItem = hisReportDao.getCheckByPatient(patient); +// reports.add(reportItem); +// } +// return Result.success(reports); +// } +// +// /** +// * 根据openid查询体检报告 +// */ +// @Action("getPEISReportAll") +// public String getPEISReportAll() { +// String openid = getString("openid"); +// log.info("根据openid查询体检报告 openid={}", openid); +// if (openid == null) { +// return Result.error(ResultEnum.PARAM_NOT_COMPLETE); +// } +// +// List patients = new PatientDao().selectListByOpenid(openid); +// +// List> reports = new ArrayList<>(); +// HisReportDao hisReportDao = new HisReportDao(); +// for (Patient patient : patients) { +// List reportItem = hisReportDao.getPEISReportByPatient(patient); +// reports.add(reportItem); +// } +// +// +// return Result.success(reports); +// } +// +// /** +// * 根据openid查询检验结果 +// */ +// @Action("getInspectionAll") +// public String getInspectionAll() { +// String openid = getString("openid"); +// log.info("根据openid查询检验结果,openid={}", openid); +// if (openid == null) { +// return Result.error(ResultEnum.PARAM_NOT_COMPLETE); +// } +// +// List patients = new PatientDao().selectListByOpenid(openid); +// +// List> reports = new ArrayList<>(); +// HisReportDao hisReportDao = new HisReportDao(); +// for (Patient patient : patients) { +// List reportItem = hisReportDao.getInspectByPatient(patient.getPatientId()); +// reports.add(reportItem); +// } +// return Result.success(reports); +// } + +} diff --git a/src/main/java/com/ynxbd/common/action/TestAction.java b/src/main/java/com/ynxbd/common/action/test/TestAction.java similarity index 91% rename from src/main/java/com/ynxbd/common/action/TestAction.java rename to src/main/java/com/ynxbd/common/action/test/TestAction.java index 2fd01c7..03c104d 100644 --- a/src/main/java/com/ynxbd/common/action/TestAction.java +++ b/src/main/java/com/ynxbd/common/action/test/TestAction.java @@ -1,167 +1,163 @@ -package com.ynxbd.common.action; - -import com.ynxbd.common.action.base.BaseAction; -import com.ynxbd.common.bean.enums.MerchantEnum; -import com.ynxbd.common.helper.common.DateHelper; -import com.ynxbd.common.result.Result; -import com.ynxbd.common.result.ResultEnum; -import com.ynxbd.common.result.ServiceException; -import com.ynxbd.common.service.MedicalService; -import com.ynxbd.common.service.OutCollectService; -import com.ynxbd.wx.wxfactory.WxMedicalHelper; -import com.ynxbd.wx.wxfactory.bean.MedicalOrder; -import com.ynxbd.wx.wxfactory.medical.MdConfig; -import lombok.extern.slf4j.Slf4j; -import org.apache.struts2.convention.annotation.Action; -import org.apache.struts2.convention.annotation.Namespace; - -import java.math.BigDecimal; -import java.util.Date; - - -/** - * @Author wsq - * @Date 2021/3/17 10:57 - * @Copyright @ 2020 云南新八达科技有限公司 All rights reserved. - */ - -@Slf4j -@Namespace("/test02") -public class TestAction extends BaseAction { - - -// @Action("a") -// public String a() { -// String sql = "select * from a limit 0, 100"; -// List data = DataBase.select(sql, A.class); -// for (A a : data) { -// System.out.println(data); -// } -// return Result.success(data); -// StringBuilder sb = new StringBuilder(); -// sb.append("http://10.20.10.60:8123/MessagePlatform/DaoYiXun?"); -// sb.append("templateId="); -// sb.append("6hpr5eY-nnCIkFu2ZeuvFjd0YG1ZwlHOo_ikRSXJUg4"); -// // -// sb.append("&patientName="); -// sb.append("患者"); -// // -// sb.append("&content="); -// sb.append("内容"); -// // -// sb.append("&openId="); -// sb.append("32EBE22EF6C9437575AB7A043E456D25704583EFA5E6BE1B5CB899A6F3B7075A"); -// // -// sb.append("&deptName="); -// sb.append("科室"); -// // -// sb.append("&deptCode="); -// sb.append("1234"); -// ResponseEntity responseEntity = new RestTemplate().getForEntity("http://10.20.10.60:8123/MessagePlatform/DaoYiXun?templateId=6hpr5eY-nnCIkFu2ZeuvFjd0YG1ZwlHOo_ikRSXJUg4&patientName=王绍全&content=挂号时间&openId=32EBE22EF6C9437575AB7A043E456D25704583EFA5E6BE1B5CB899A6F3B7075A&deptName=方便门诊&deptCode=5201", String.class); -// -// String body = responseEntity.getBody(); -// System.out.println(body); -// System.out.println(responseEntity); -// return Result.error(); -// } - - -// @Action("ocPay") -// public Result ocPay(String outTradeNo) throws ServiceException { -// new OutCollectService().ocPayNotify(MerchantEnum.WX, "123", new BigDecimal("0.01"), outTradeNo, "123", "123"); -// return Result.success(); -// } - - - @Action("test03") - public Result test03() throws ServiceException { - System.out.println("开关" + MdConfig.IS_AUTO_REFUND); - log.info("日志测试"); - return Result.success(); - } - - @Action("md_refund_test") - public Result md_refund_test() throws ServiceException { -// WxMedicalHelper.refundCash("", "", new BigDecimal("0.440"), "系统繁忙缴费失败,自动退费"); - return Result.success(); - } - - -// @Action("lock") -// public String lock() { -// return Result.success(update()); -// } -// public synchronized Integer update(){ -// int update = DataBase.update("update pay set remark = ? where outTradeNo= ?, updateTime=now()", ps -> { -// ps.setString(1, CodeHelper.getRandomCode(8)); -// ps.setString(2, "00015d3064434d8c8c4a016b84602f89"); -// }); -// return null; -// } - - -// @Action("api") -// public Result api(String callNo, String patientId, String refundDesc, String payOrdId) { -// String verify = request.getHeader("verify"); -// Map map = new HashMap<>(); -// -// map.put("callNo", callNo); -// map.put("patientId", patientId); -// map.put("refundDesc", refundDesc); -// map.put("payOrdId", payOrdId); -// map.put("verify", verify); -// -// map.put("transNo", "transNo123"); -// map.put("payWay", 4); -// map.put("bankTransNo", "bankTransNo123"); -// map.put("payMoney", new BigDecimal("0.01")); -// -// if (patientId != null && payOrdId != null) { -// String piMd5 = patientId + payOrdId + "xbd"; -// map.put("wx_verify", DigestUtils.md5Hex(piMd5).toUpperCase()); -// } -// return Result.success(map); -// } - -// @Action(value = "api2") -// public Result api2(String id) { -// String post = HttpClientHelper.post("http://127.0.0.1:8081/wx/test02/api.do?a=123", null, null); -// return Result.success(post); -// } - - - @Action("test") - public Result test(String billDate) { - if (!DateHelper.isValidDate(billDate, DateHelper.DateEnum.yyyy_MM_dd)) { - return Result.error(ResultEnum.PARAM_DATE_ERROR); - } - - System.out.println(DateHelper.getMoveDate(new Date(), -1)); - if (billDate.equals(DateHelper.getMoveDate(new Date(), -1))) { - if (!DateHelper.isCurTimeOver("03:00:00")) { - return Result.error("查询前一天的数据,需要在今天9点15之后"); - } - } - return Result.success(); - } - -// -// @Action("refundReg") -// public Result refundReg() { -// -// List orders = new RegisterDao().selectRefundList("2022-09-22", "2022-09-29"); -// log.info("退费笔数{}", orders.size()); -// if (orders.size() > 60) { -// return Result.error("退费数量过多"); -// } -// String payCode = "wx"; -// for (Order item : orders) { -// String openid = item.getOpenid(); -// if (openid != null && openid.length() == 16) { -// payCode = "ali"; -// } -// new RegService().cancelRegReserve(payCode, item.getPatientId(), item.getTradeNo(), item.getHisTransNo()); -// } -// return Result.success(); -// } +package com.ynxbd.common.action.test; + +import com.ynxbd.common.action.base.BaseAction; +import com.ynxbd.common.helper.common.DateHelper; +import com.ynxbd.common.result.Result; +import com.ynxbd.common.result.ResultEnum; +import com.ynxbd.common.result.ServiceException; +import com.ynxbd.wx.wxfactory.WxMedicalHelper; +import com.ynxbd.wx.wxfactory.medical.MdConfig; +import lombok.extern.slf4j.Slf4j; +import org.apache.struts2.convention.annotation.Action; +import org.apache.struts2.convention.annotation.Namespace; + +import java.math.BigDecimal; +import java.util.Date; + + +/** + * @Author wsq + * @Date 2021/3/17 10:57 + * @Copyright @ 2020 云南新八达科技有限公司 All rights reserved. + */ + +@Slf4j +@Namespace("/test02") +public class TestAction extends BaseAction { + + +// @Action("a") +// public String a() { +// String sql = "select * from a limit 0, 100"; +// List data = DataBase.select(sql, A.class); +// for (A a : data) { +// System.out.println(data); +// } +// return Result.success(data); +// StringBuilder sb = new StringBuilder(); +// sb.append("http://10.20.10.60:8123/MessagePlatform/DaoYiXun?"); +// sb.append("templateId="); +// sb.append("6hpr5eY-nnCIkFu2ZeuvFjd0YG1ZwlHOo_ikRSXJUg4"); +// // +// sb.append("&patientName="); +// sb.append("患者"); +// // +// sb.append("&content="); +// sb.append("内容"); +// // +// sb.append("&openId="); +// sb.append("32EBE22EF6C9437575AB7A043E456D25704583EFA5E6BE1B5CB899A6F3B7075A"); +// // +// sb.append("&deptName="); +// sb.append("科室"); +// // +// sb.append("&deptCode="); +// sb.append("1234"); +// ResponseEntity responseEntity = new RestTemplate().getForEntity("http://10.20.10.60:8123/MessagePlatform/DaoYiXun?templateId=6hpr5eY-nnCIkFu2ZeuvFjd0YG1ZwlHOo_ikRSXJUg4&patientName=王绍全&content=挂号时间&openId=32EBE22EF6C9437575AB7A043E456D25704583EFA5E6BE1B5CB899A6F3B7075A&deptName=方便门诊&deptCode=5201", String.class); +// +// String body = responseEntity.getBody(); +// System.out.println(body); +// System.out.println(responseEntity); +// return Result.error(); +// } + + +// @Action("ocPay") +// public Result ocPay(String outTradeNo) throws ServiceException { +// new OutCollectService().ocPayNotify(MerchantEnum.WX, "123", new BigDecimal("0.01"), outTradeNo, "123", "123"); +// return Result.success(); +// } + + + @Action("test03") + public Result test03() throws ServiceException { + System.out.println("开关" + MdConfig.IS_AUTO_REFUND); + log.info("日志测试"); + return Result.success(); + } + + @Action("md_refund_test") + public Result md_refund_test() throws ServiceException { + WxMedicalHelper.refundCash("WX_M202f622bb3444a033f7a014a421b", "ORD530100202505100932115202726", new BigDecimal("183.390"), "人工退费"); + return Result.success(); + } + + +// @Action("lock") +// public String lock() { +// return Result.success(update()); +// } +// public synchronized Integer update(){ +// int update = DataBase.update("update pay set remark = ? where outTradeNo= ?, updateTime=now()", ps -> { +// ps.setString(1, CodeHelper.getRandomCode(8)); +// ps.setString(2, "00015d3064434d8c8c4a016b84602f89"); +// }); +// return null; +// } + + +// @Action("api") +// public Result api(String callNo, String patientId, String refundDesc, String payOrdId) { +// String verify = request.getHeader("verify"); +// Map map = new HashMap<>(); +// +// map.put("callNo", callNo); +// map.put("patientId", patientId); +// map.put("refundDesc", refundDesc); +// map.put("payOrdId", payOrdId); +// map.put("verify", verify); +// +// map.put("transNo", "transNo123"); +// map.put("payWay", 4); +// map.put("bankTransNo", "bankTransNo123"); +// map.put("payMoney", new BigDecimal("0.01")); +// +// if (patientId != null && payOrdId != null) { +// String piMd5 = patientId + payOrdId + "xbd"; +// map.put("wx_verify", DigestUtils.md5Hex(piMd5).toUpperCase()); +// } +// return Result.success(map); +// } + +// @Action(value = "api2") +// public Result api2(String id) { +// String post = HttpClientHelper.post("http://127.0.0.1:8081/wx/test02/api.do?a=123", null, null); +// return Result.success(post); +// } + + + @Action("test") + public Result test(String billDate) { + if (!DateHelper.isValidDate(billDate, DateHelper.DateEnum.yyyy_MM_dd)) { + return Result.error(ResultEnum.PARAM_DATE_ERROR); + } + + System.out.println(DateHelper.getMoveDate(new Date(), -1)); + if (billDate.equals(DateHelper.getMoveDate(new Date(), -1))) { + if (!DateHelper.isCurTimeOver("03:00:00")) { + return Result.error("查询前一天的数据,需要在今天9点15之后"); + } + } + return Result.success(); + } + +// +// @Action("refundReg") +// public Result refundReg() { +// +// List orders = new RegisterDao().selectRefundList("2022-09-22", "2022-09-29"); +// log.info("退费笔数{}", orders.size()); +// if (orders.size() > 60) { +// return Result.error("退费数量过多"); +// } +// String payCode = "wx"; +// for (Order item : orders) { +// String openid = item.getOpenid(); +// if (openid != null && openid.length() == 16) { +// payCode = "ali"; +// } +// new RegService().cancelRegReserve(payCode, item.getPatientId(), item.getTradeNo(), item.getHisTransNo()); +// } +// return Result.success(); +// } } \ No newline at end of file diff --git a/src/main/java/com/ynxbd/common/bean/CommonOption.java b/src/main/java/com/ynxbd/common/bean/CommonOption.java new file mode 100644 index 0000000..f8b9576 --- /dev/null +++ b/src/main/java/com/ynxbd/common/bean/CommonOption.java @@ -0,0 +1,18 @@ +package com.ynxbd.common.bean; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +import java.io.Serializable; + +@Setter +@Getter +@ToString +@NoArgsConstructor +public class CommonOption implements Serializable { + private String optId; + private String value; + private String text; +} diff --git a/src/main/java/com/ynxbd/common/bean/Dept.java b/src/main/java/com/ynxbd/common/bean/Dept.java index 5c32c93..e6fb6ae 100644 --- a/src/main/java/com/ynxbd/common/bean/Dept.java +++ b/src/main/java/com/ynxbd/common/bean/Dept.java @@ -22,7 +22,7 @@ import java.util.List; @ToString @NoArgsConstructor public class Dept implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 202504141516002L; private Integer id; // 科室编码 diff --git a/src/main/java/com/ynxbd/common/bean/Doctor.java b/src/main/java/com/ynxbd/common/bean/Doctor.java index e785515..313b255 100644 --- a/src/main/java/com/ynxbd/common/bean/Doctor.java +++ b/src/main/java/com/ynxbd/common/bean/Doctor.java @@ -16,7 +16,7 @@ import java.util.List; @ToString @NoArgsConstructor public class Doctor implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 202504141516003L; private Long id; // 科室代码 diff --git a/src/main/java/com/ynxbd/common/bean/HisRecipe.java b/src/main/java/com/ynxbd/common/bean/HisRecipe.java index b875270..6122878 100644 --- a/src/main/java/com/ynxbd/common/bean/HisRecipe.java +++ b/src/main/java/com/ynxbd/common/bean/HisRecipe.java @@ -42,6 +42,8 @@ public class HisRecipe { private String execDate; // 门诊号 private String mzNum; + // 门诊号 + private String treatNum; // 执行位置 private String address; // 备注 @@ -59,24 +61,23 @@ public class HisRecipe { // 院区名称 private String hospitalAreaName; - //互联网医院 - + // 互联网医院处方标识 private String internetHospFlag; - + // 是否为双通道处方 [1:双通道处方] private String sTDFlag; - private String sTDUploadDate; - + // 处方是否已经审核 private String yJSAuditFlag; + private String ybAttrib; // 医保属性[4:为慢性病,5:为特殊病] - private String ybAttrib; //医保属性,值域:4为慢性病,5为特殊病 - - private Integer ybJsFlag; //是否允许医保支付 + private Integer ybJsFlag; // 是否允许医保支付 - private String ybBZCode; //病种编码 + private String ybBZCode; // 病种编码 - private String ybBZName; //病种名称 + private String ybBZName; // 病种名称 private List item; + // 处方集合 + private List groupList; } diff --git a/src/main/java/com/ynxbd/common/bean/MedTool.java b/src/main/java/com/ynxbd/common/bean/MedTool.java new file mode 100644 index 0000000..8c4b3e3 --- /dev/null +++ b/src/main/java/com/ynxbd/common/bean/MedTool.java @@ -0,0 +1,46 @@ +package com.ynxbd.common.bean; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; +import org.apache.commons.lang3.ObjectUtils; + +import java.io.Serializable; +import java.time.LocalDateTime; + +// 就医助手 + +@Setter +@Getter +@ToString +@NoArgsConstructor +public class MedTool implements Serializable { + private Long id; + // 类型:1.挂号;2.问诊 + private Integer type; + // 就诊号 + private String treatNum; + // 进度标识 + private String processMark; + // 修改时间 + private LocalDateTime updateTime; + + + // 拼接进度状态 + public String spliceProcessMark(String addMark) { + if (ObjectUtils.isEmpty(addMark)) { + return null; + } + String dbMark = this.processMark; + String updateMark = addMark; + if (!ObjectUtils.isEmpty(dbMark)) { + if (dbMark.contains(addMark)) { // 已存在 + return null; + } else { + updateMark = dbMark + "," + addMark; + } + } + return updateMark; + } +} diff --git a/src/main/java/com/ynxbd/common/bean/RegSign.java b/src/main/java/com/ynxbd/common/bean/RegSign.java new file mode 100644 index 0000000..972aebf --- /dev/null +++ b/src/main/java/com/ynxbd/common/bean/RegSign.java @@ -0,0 +1,29 @@ +package com.ynxbd.common.bean; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +@Setter +@Getter +@ToString +@NoArgsConstructor +public class RegSign { + private String treatNum; + private String patientId; + private String patientName; + private String deptCode; + private String deptName; + private String doctCode; + private String doctName; + + // 号源日期 + private String scheduleDate; + private String begTime; + private String endTime; + // His挂号日期 + private String regDateTime; + // His挂号预约日期(预约挂号才有) + private String reservationDate; +} diff --git a/src/main/java/com/ynxbd/common/bean/TreatRecord.java b/src/main/java/com/ynxbd/common/bean/TreatRecord.java index 7c43ab0..dca13c2 100644 --- a/src/main/java/com/ynxbd/common/bean/TreatRecord.java +++ b/src/main/java/com/ynxbd/common/bean/TreatRecord.java @@ -24,6 +24,8 @@ public class TreatRecord implements Serializable { private String inOutState; private String treatNum; + // 就诊类型[1:门诊; 2:住院] + private String treatType; // 加密的患者id private String enPatientId; // 加密的就诊号 diff --git a/src/main/java/com/ynxbd/common/bean/pay/Order.java b/src/main/java/com/ynxbd/common/bean/pay/Order.java index a1b9623..5604966 100644 --- a/src/main/java/com/ynxbd/common/bean/pay/Order.java +++ b/src/main/java/com/ynxbd/common/bean/pay/Order.java @@ -10,6 +10,7 @@ import org.apache.commons.lang3.ObjectUtils; import java.io.Serializable; import java.math.BigDecimal; +import java.time.LocalDateTime; import java.util.Date; /** @@ -27,6 +28,8 @@ public class Order implements Serializable { private static final long serialVersionUID = 3666666777881604L; private Long id; + // 加密的id + private String enId; // 修改时间 private Date updateTime; // openid @@ -59,6 +62,8 @@ public class Order implements Serializable { private String tradeTime; // 门诊号 | 住院号 private String treatNum; + // 加密的门诊号 + private String enTreatNum; // 支付方式统计(微信:{0:程序内;1:扫码;2:盒子支付;3:native支付};支付宝:{10:程序内,11:扫码:12:盒子支付}) private String payWay; // 商户名称 @@ -128,6 +133,11 @@ public class Order implements Serializable { private String mdTrtId; // 医保-用户ID private String mdUserId; + // 今天日期 + private String curDate; + // 查询报告的日期范围 + private String queryBegDate; + private String queryEndDate; // 缴费订单类型 private String orderType; @@ -135,12 +145,16 @@ public class Order implements Serializable { // PEIS通知状态 private Integer peisStatus; - // PEIS返回提示 private String peisResult; public void filterInfo() { + if (id != null) { + this.enId = ReqParamHelper.encode(String.valueOf(id)); + this.id = null; + } + String _cardNo = this.idCardNo; if (!ObjectUtils.isEmpty(_cardNo)) { this.idCardNo = null; @@ -158,5 +172,10 @@ public class Order implements Serializable { if (!ObjectUtils.isEmpty(this.patientId)) { this.enPatientId = ReqParamHelper.encode(this.patientId); } + + if (!ObjectUtils.isEmpty(treatNum)) { + this.enTreatNum = ReqParamHelper.encode(String.valueOf(treatNum)); + } } + } diff --git a/src/main/java/com/ynxbd/common/bean/pay/Register.java b/src/main/java/com/ynxbd/common/bean/pay/Register.java index 274d94f..eb8e198 100644 --- a/src/main/java/com/ynxbd/common/bean/pay/Register.java +++ b/src/main/java/com/ynxbd/common/bean/pay/Register.java @@ -18,7 +18,6 @@ import java.math.BigDecimal; @NoArgsConstructor public class Register extends Order { private Long id; - private String enId; private String deptCode; private String subDeptCode; @@ -56,7 +55,7 @@ public class Register extends Order { private String sourceId; private String begTime; private String endTime; - // 【今日挂号】是否就诊[0:未就诊,1:已就诊,-1:退号] + // 【今日挂号】是否就诊[0:未就诊,1:已就诊,-1:已退号] private Integer isTreat; // 【预约挂号】是否取号[0:未取号,1:已取号,-1:取消预约] private Integer isTake; @@ -66,16 +65,22 @@ public class Register extends Order { private Integer sourceCount; // 剩余号源数 private Integer remainCount; - // 0-没有号源不允许挂号,1-有号源可以挂号 + // 0:没有号源不允许挂号;1:有号源可以挂号 private Integer allowReg; // 是否被占用 private Integer isUsed; // 院区 private String hospitalArea; - // 挂号订单来源 + // 挂号订单来源平台 private String orderFromOwner; // 判断是否为分时段挂号 private Boolean isSplitTime; - // 就医助手流程标记 - private String medToolMark; + + public boolean hasIsTake(int val) { + return isTake != null && isTake == val; + } + + public boolean hasIsTreat(int val) { + return isTreat != null && isTreat == val; + } } diff --git a/src/main/java/com/ynxbd/common/bean/report/CheckReport.java b/src/main/java/com/ynxbd/common/bean/report/CheckReport.java index 5b51a69..402b5c7 100644 --- a/src/main/java/com/ynxbd/common/bean/report/CheckReport.java +++ b/src/main/java/com/ynxbd/common/bean/report/CheckReport.java @@ -1,9 +1,13 @@ package com.ynxbd.common.bean.report; +import com.ynxbd.wx.wxfactory.ReqParamHelper; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import lombok.ToString; +import org.apache.commons.lang3.ObjectUtils; + +import java.io.Serializable; /** * @Author wsq @@ -14,8 +18,8 @@ import lombok.ToString; @Getter @ToString @NoArgsConstructor -public class CheckReport { - private static final long serialVersionUID = 1L; +public class CheckReport implements Serializable { + private static final long serialVersionUID = 202504141516001L; private String id; private String name; private String type; @@ -38,8 +42,45 @@ public class CheckReport { private String bodyPart; private String description; private String conclusion; - private String note; + private String note; // 描述 private String diagnose; private String reportDoctName; private String reportDate; + // 就诊号 + private String treatNum; + private String enTreatNum; + // 就诊类型[1:门诊; 2:住院] + private String treatType; + private String reportName; + private String reportType; + private String reportState; + + public void filterInfo() { + this.diagnose = null; + this.note = null; + this.conclusion = null; + this.description = null; + this.reportName = null; + this.name = null; + this.bodyPart = null; + } + + + + // web数据过滤 + public void filterWebData() { + String reportTreatNum = this.mzNum; + if (!ObjectUtils.isEmpty(reportTreatNum)) { + this.treatType = "1"; // 门诊 + } else { + reportTreatNum = this.zyNum; + if (!ObjectUtils.isEmpty(reportTreatNum)) { + this.treatType = "2"; // 住院 + } + } + this.treatNum = reportTreatNum; + this.reportName = this.name; + this.reportType = this.type; + this.enTreatNum = ReqParamHelper.encode(reportTreatNum); + } } diff --git a/src/main/java/com/ynxbd/common/bean/report/InspectionItem.java b/src/main/java/com/ynxbd/common/bean/report/InspectionItem.java index 2c1f61f..401a245 100644 --- a/src/main/java/com/ynxbd/common/bean/report/InspectionItem.java +++ b/src/main/java/com/ynxbd/common/bean/report/InspectionItem.java @@ -13,7 +13,7 @@ import java.io.Serializable; @NoArgsConstructor public class InspectionItem implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 202504141516004L; private String specimen; private String assayCode; private String assayName; diff --git a/src/main/java/com/ynxbd/common/bean/report/InspectionReport.java b/src/main/java/com/ynxbd/common/bean/report/InspectionReport.java index 56de63b..05c614e 100644 --- a/src/main/java/com/ynxbd/common/bean/report/InspectionReport.java +++ b/src/main/java/com/ynxbd/common/bean/report/InspectionReport.java @@ -13,7 +13,7 @@ import java.util.List; @ToString @NoArgsConstructor public class InspectionReport implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 202504141516006L; private String id; private String name; private String type; diff --git a/src/main/java/com/ynxbd/common/bean/wxMessage/WaitReg.java b/src/main/java/com/ynxbd/common/bean/wxMessage/WaitReg.java index e7d3e98..837d73d 100644 --- a/src/main/java/com/ynxbd/common/bean/wxMessage/WaitReg.java +++ b/src/main/java/com/ynxbd/common/bean/wxMessage/WaitReg.java @@ -13,7 +13,7 @@ import java.io.Serializable; @ToString @NoArgsConstructor public class WaitReg implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 202504141516009L; // openId public String openId; // 患者姓名 diff --git a/src/main/java/com/ynxbd/common/dao/MedToolDao.java b/src/main/java/com/ynxbd/common/dao/MedToolDao.java new file mode 100644 index 0000000..3879c16 --- /dev/null +++ b/src/main/java/com/ynxbd/common/dao/MedToolDao.java @@ -0,0 +1,37 @@ +package com.ynxbd.common.dao; + +import com.ynxbd.common.bean.MedTool; +import com.ynxbd.common.config.db.DataBase; + +public class MedToolDao { + + public boolean add(String treatNum, Integer type, String processMark) { + String sql = "insert into med_tool(updateTime, treatNum, type, processMark) values(now(), ?, ?, ?)"; + return DataBase.update(sql, ps -> { + ps.setString(1, treatNum); + ps.setInt(2, type); + ps.setString(3, processMark); + }) > 0; + } + + // LOCATE未找到返回0 + public boolean updateProcessMark(String treatNum, Integer type, String addMark, String updateMark) { + String sql = "update med_tool set processMark=?, updateTime=now() where treatNum=? and type=? and Locate(?, ifNull(processMark, '')) = 0"; + return DataBase.update(sql, ps -> { + ps.setString(1, updateMark); + ps.setString(2, treatNum); + ps.setInt(3, type); + ps.setString(4, addMark); + }) > 0; + } + + + + public MedTool selectByTreatNumAndType(String treatNum, Integer type) { + String sql = "select * from med_tool where treatNum=? and type=?"; + return DataBase.selectOne(sql, MedTool.class, ps -> { + ps.setString(1, treatNum); + ps.setInt(2, type); + }); + } +} diff --git a/src/main/java/com/ynxbd/common/dao/NatRecordDao.java b/src/main/java/com/ynxbd/common/dao/NatRecordDao.java index 733ee8e..2e89607 100644 --- a/src/main/java/com/ynxbd/common/dao/NatRecordDao.java +++ b/src/main/java/com/ynxbd/common/dao/NatRecordDao.java @@ -44,9 +44,9 @@ public class NatRecordDao { */ public boolean hasRecord(String patientId, String updateTime) { String sql = "select * from nat_record where patientId=? and CONCAT(date_format(updateTime,'%Y-%m-%d'), '')=?"; - return DataBase.select(sql, NatRecord.class, ps -> { + return !DataBase.select(sql, NatRecord.class, ps -> { ps.setString(1, patientId); ps.setString(2, updateTime); - }).size() > 0; + }).isEmpty(); } } diff --git a/src/main/java/com/ynxbd/common/dao/PatientDao.java b/src/main/java/com/ynxbd/common/dao/PatientDao.java index b1f6f6a..1744fbb 100644 --- a/src/main/java/com/ynxbd/common/dao/PatientDao.java +++ b/src/main/java/com/ynxbd/common/dao/PatientDao.java @@ -1,5 +1,6 @@ package com.ynxbd.common.dao; +import com.ynxbd.common.bean.CommonOption; import com.ynxbd.common.bean.Patient; import com.ynxbd.common.bean.PatientLink; import com.ynxbd.common.bean.enums.HCardTypeEnum; @@ -113,7 +114,7 @@ public class PatientDao { /** - * 根据身份证查询患者 + * 查询患者本人 * * @param openid openid * @return 患者信息 @@ -123,7 +124,7 @@ public class PatientDao { List resultList = DataBase.select(sql, Patient.class, ps -> { ps.setString(1, openid); }); - return resultList.size() > 0 ? resultList.get(0) : null; + return !resultList.isEmpty() ? resultList.get(0) : null; } @@ -140,7 +141,20 @@ public class PatientDao { ps.setString(1, openid); ps.setString(2, patientId); }); - return resultList.size() > 0 ? resultList.get(0) : null; + return !resultList.isEmpty() ? resultList.get(0) : null; + } + + /** + * 查询患者本人 + * + * @param openId openId + * @return 患者信息 + */ + public List selectPatientsByOpenId(String openId) { + String sql = "select patientId, name, sex, birthday, idCardNo, tel from patientBase where openId= ? and deletedState = 0 order by isDefault desc"; + return DataBase.select(sql, Patient.class, ps -> { + ps.setString(1, openId); + }); } /** @@ -310,7 +324,7 @@ public class PatientDao { ps.setString(1, patientId); }); - if (dataList.size() == 0) { + if (dataList.isEmpty()) { return new ArrayList<>(); } return dataList; @@ -321,7 +335,7 @@ public class PatientDao { ps.setString(1, cardNo); }); - if (dataList.size() == 0) { + if (dataList.isEmpty()) { return new ArrayList<>(); } return dataList; @@ -332,7 +346,7 @@ public class PatientDao { ps.setString(1, patientId); }); - if (dataList.size() == 0) { + if (dataList.isEmpty()) { return new ArrayList<>(); } return dataList; diff --git a/src/main/java/com/ynxbd/common/dao/RegisterDao.java b/src/main/java/com/ynxbd/common/dao/RegisterDao.java index 5172fab..8310b95 100644 --- a/src/main/java/com/ynxbd/common/dao/RegisterDao.java +++ b/src/main/java/com/ynxbd/common/dao/RegisterDao.java @@ -25,7 +25,6 @@ import java.util.List; @Slf4j public class RegisterDao { - /** * 获取今日挂号的所有患者的openId用作到诊推送 * @@ -49,13 +48,13 @@ public class RegisterDao { if (doctCode != null && !"".equals(doctCode)) { String sqlCode = "select title, customTitle, metaTitle, meta tel, skill, headImg, description, pym, isDisabled, deletedState from doctor where doctCode='" + doctCode + "'"; resultList = DataBase.select(sqlCode, Doctor.class); - if (resultList.size() > 0) { + if (!resultList.isEmpty()) { return resultList.get(0); } else { if (doctName != null && !"".equals(doctName)) { String sqlName = "select title, customTitle, tel, skill, headImg, description, pym, isDisabled, deletedState from doctor where doctName='" + doctName + "'"; resultList = DataBase.select(sqlName, Doctor.class); - return resultList.size() > 0 ? resultList.get(0) : null; + return !resultList.isEmpty() ? resultList.get(0) : null; } } } @@ -68,7 +67,7 @@ public class RegisterDao { * @return 医生信息 */ public List selectDocListByCodes(List docList) { - if (docList == null || docList.size() == 0) { + if (docList == null || docList.isEmpty()) { return new ArrayList<>(); } @@ -84,7 +83,7 @@ public class RegisterDao { } String codeStr = sb.toString(); - if (codeStr.length() == 0) { + if (codeStr.isEmpty()) { return new ArrayList<>(); } @@ -147,9 +146,9 @@ public class RegisterDao { */ public boolean isMerPaidByOutTradeNo(String outTradeNo) { String sql = "select hisStatus from register where outTradeNo= ? and payStatus = 0"; - return DataBase.select(sql, Register.class, ps -> { + return !DataBase.select(sql, Register.class, ps -> { ps.setString(1, outTradeNo); - }).size() > 0; + }).isEmpty(); } /** @@ -197,7 +196,7 @@ public class RegisterDao { } /** - * 根据hisTransNo获取挂号信息 + * 根据[hisTransNo]查询挂号信息 * * @param hisTransNo hisTransNo */ @@ -206,7 +205,35 @@ public class RegisterDao { List resultList = DataBase.select(sql, Register.class, ps -> { ps.setString(1, hisTransNo); }); - return resultList.size() > 0 ? resultList.get(0) : null; + return resultList.isEmpty() ? null : resultList.get(0); + } + + /** + * 根据[tradeNo]查询挂号信息 + * + * @param tradeNo tradeNo + */ + public Register selectRegByPatientIdAndTradeNo(String patientId, String tradeNo) { + String sql = "select * from register where tradeNo= ? and patientId=? and hisStatus= 0 and refundTime is null"; + return DataBase.selectOne(sql, Register.class, ps -> { + ps.setString(1, tradeNo); + ps.setString(2, patientId); + }); + } + + /** + * 防止 hisTransNo不唯一(第一次挂号失败,第二次挂号后可能会返回相同的号) + * + * @param patientId 患者id + * @param hisTransNo His交易流水号 + * @return list + */ + public List selectListByPatientIdAndHisTransNo(String patientId, String hisTransNo) { + String sql = "select * from register where hisTransNo= ? and patientId= ? and hisStatus= 0 and refundTime is null"; + return DataBase.select(sql, Register.class, ps -> { + ps.setString(1, hisTransNo); + ps.setString(2, patientId); + }); } @@ -641,9 +668,9 @@ public class RegisterDao { /** * 查询订单状态异常订单 * - * @param bankTransNo - * @param tradeNo - * @param timePoint + * @param bankTransNo 支付订单号 + * @param tradeNo HIS交易流水号 + * @param timePoint 时间点 * @return */ public Register selectStatusErrOrder(String bankTransNo, String tradeNo, String timePoint) { @@ -735,12 +762,11 @@ public class RegisterDao { } // LOCATE未找到返回0 - public int updateRegMedToolMark(String id, String addMedToolMark, String updateMedToolMark) { - String sql = "update register set medToolMark=? where id=? and Locate(?, ifNull(medToolMark, '')) = 0"; + public int updateTreatNum(Long id, String treatNum) { + String sql = "update register set treatNum=? where id=? and ifNull(treatNum, '') = ''"; return DataBase.update(sql, ps -> { - ps.setString(1, updateMedToolMark); - ps.setString(2, id); - ps.setString(3, addMedToolMark); + ps.setString(1, treatNum); + ps.setLong(2, id); }); } @@ -750,4 +776,5 @@ public class RegisterDao { ps.setString(1, id); }); } + } diff --git a/src/main/java/com/ynxbd/common/dao/his/HisRecipeDao.java b/src/main/java/com/ynxbd/common/dao/his/HisRecipeDao.java index 34ae297..b536307 100644 --- a/src/main/java/com/ynxbd/common/dao/his/HisRecipeDao.java +++ b/src/main/java/com/ynxbd/common/dao/his/HisRecipeDao.java @@ -47,7 +47,7 @@ public class HisRecipeDao { * @param endDate 结束日期 * @return 已缴费项目 */ - public List getPaidRecipeList(String patientId, String begDate, String endDate,String personNo) { + public List getPaidRecipeList(String patientId, String begDate, String endDate, String personNo) { List resultList = new ArrayList<>(); Map params = new HashMap<>(); @@ -55,7 +55,7 @@ public class HisRecipeDao { params.put("RecipeID", ""); params.put("StartTime", begDate); params.put("EndTime", endDate); - params.put("PersonNo",personNo); + params.put("PersonNo", personNo); JsonResult jsonResult = HisHelper.getJsonResult(HisEnum.AP_Query_OutpatientFee, params); if (!jsonResult.success()) { // 请求失败 @@ -80,9 +80,9 @@ public class HisRecipeDao { JsonResult jsonResult = HisHelper.getJsonResult(HisEnum.AP_Query_UnPay_Invoice, params -> { params.put("PatientID", patientId); - params.put("PersonNo",personNo); + params.put("PersonNo", personNo); params.put("IsLastWeekFlag", days <= 7 ? "1" : ""); - params.put("CallNo",HisHelper.CALL_NO); + params.put("CallNo", HisHelper.CALL_NO); }); if (!jsonResult.success()) { // 失败 @@ -100,17 +100,17 @@ public class HisRecipeDao { List resultList = new ArrayList<>(); JsonResult jsonResult = HisHelper.getMdJsonResult(HisEnum.XK_MEDICAL_RECIPE, params -> { - params.put("PersonID",personID); + params.put("PersonID", personID); params.put("MZNum", treatNum); - params.put("CallNo",HisHelper.CALL_NO); - params.put("CFNums",recipes); + params.put("CallNo", HisHelper.CALL_NO); + params.put("CFNums", recipes); }); if (!jsonResult.success()) { // 失败 return Result.error(jsonResult.getMessage()); } - List medicalRecipe = jsonResult.getDataMapList(medicalRecipe.class, "CFNums","Item"); + List medicalRecipe = jsonResult.getDataMapList(medicalRecipe.class, "CFNums", "Item"); if (medicalRecipe != null) { resultList = medicalRecipe; } @@ -118,7 +118,6 @@ public class HisRecipeDao { } - /** * HIS申请单预缴费 * @@ -154,11 +153,10 @@ public class HisRecipeDao { params.put("BankTransNo", UUID.randomUUID().toString().replace("-", "")); params.put("PayWay", merchantEnum.HIS_PAY_WAY); - },merchantEnum); + }, merchantEnum); } - /** * 缴费:更新recipeId参数为List,支持多个处方单同时缴费 * @@ -171,16 +169,16 @@ public class HisRecipeDao { * @param payTime 支付时间 * @param tradeNo HIS交易流水号 * @param payDeviceId payDeviceID - * @param transId 银行流水号 + * @param transId 银行流水号 * @return bean */ - public static JsonResult payInvoice(String openid, String patientId, String treatNum, List recipeIds, String payMoney,String totalFee, + public static JsonResult payInvoice(String openid, String patientId, String treatNum, List recipeIds, String payMoney, String totalFee, String payDate, String payTime, String tradeNo, String payDeviceId, String transId, MerchantEnum merchantEnum, String feeId, String feeInfo) { String fpOrderId = (tradeNo != null && tradeNo.indexOf("ORD") == 0 ? tradeNo : transId); if (ObjectUtils.isNotEmpty(feeId) - && ObjectUtils.isNotEmpty(feeInfo)){ // 新版本预缴费 + && ObjectUtils.isNotEmpty(feeInfo)) { // 新版本预缴费 log.info("[预结算]回调 feeId={}", feeId); return HisHelper.getJsonResult(HisEnum.AP_Pay_Invoice_New, params -> { params.put("PatientID", patientId); @@ -192,7 +190,7 @@ public class HisRecipeDao { // 预结算 params.put("FeeID", feeId); params.put("FeeInfo", feeInfo); - },merchantEnum); + }, merchantEnum); } StringBuilder recipeIdsXml = new StringBuilder(); @@ -200,7 +198,7 @@ public class HisRecipeDao { recipeIdsXml.append("").append(id).append(""); } - Map params = new HashMap<>(); + Map params = new HashMap<>(); params.put("Recipe", recipeIdsXml.toString()); params.put("PatientID", patientId); params.put("MZNum", treatNum); @@ -213,16 +211,16 @@ public class HisRecipeDao { params.put("BankTransNo", fpOrderId); // 商户订单号 params.put("OpenId", openid); params.put("Token", WeChatConfig.TOKEN); - if(treatNum.contains("P-")){ - log.info("[{}支付回调-体检,体检号-{}]",merchantEnum.NAME,treatNum); + if (treatNum.contains("P-")) { + log.info("[{}支付回调-体检,体检号-{}]", merchantEnum.NAME, treatNum); params.put("MZNum", "0"); params.put("PatientID", "0"); - params.put("TJBH",treatNum.split("-")[1]); - params.put("GroupFlag","1"); + params.put("TJBH", treatNum.split("-")[1]); + params.put("GroupFlag", "1"); params.remove("Recipe"); params.put("PayMoney", totalFee); //如果是体检支付就传入总金额 } - return HisHelper.getJsonResult(HisEnum.AP_Pay_Invoice, params,merchantEnum); + return HisHelper.getJsonResult(HisEnum.AP_Pay_Invoice, params, merchantEnum); } diff --git a/src/main/java/com/ynxbd/common/dao/his/HisRegisterDao.java b/src/main/java/com/ynxbd/common/dao/his/HisRegisterDao.java index 40caafc..88f16ea 100644 --- a/src/main/java/com/ynxbd/common/dao/his/HisRegisterDao.java +++ b/src/main/java/com/ynxbd/common/dao/his/HisRegisterDao.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.ynxbd.common.bean.Dept; import com.ynxbd.common.bean.Doctor; +import com.ynxbd.common.bean.RegSign; import com.ynxbd.common.bean.enums.MerchantEnum; import com.ynxbd.common.bean.pay.Register; import com.ynxbd.common.dao.RegisterDao; @@ -455,7 +456,7 @@ public class HisRegisterDao { * @param patientId 患者id * @return 挂号记录 */ - public List getRegTodayHistory(String patientId, String regDate) { + public List getHisRegHistoryRecords(String patientId, String regDate) { List resultList = new ArrayList<>(); Map params = new HashMap<>(); params.put("PatientID", patientId); @@ -511,7 +512,7 @@ public class HisRegisterDao { * @param regDate 挂号日期 * @return 预约记录 */ - public List getRegReserveHistory(String patientId, String regDate) { + public List getRegReserveRecords(String patientId, String regDate) { List resultList = new ArrayList<>(); Map params = new HashMap<>(); params.put("PatientID", patientId); @@ -620,7 +621,7 @@ public class HisRegisterDao { * @return boolean */ public List hasRegSite(String patientId, String regDate) { - return getRegTodayHistory(patientId, regDate); + return getHisRegHistoryRecords(patientId, regDate); } /** @@ -631,7 +632,7 @@ public class HisRegisterDao { * @return boolean */ public List hasRegReserve(String patientId, String regDate) { - return getRegReserveHistory(patientId, regDate); + return getRegReserveRecords(patientId, regDate); } @@ -958,7 +959,6 @@ public class HisRegisterDao { */ public JSONArray getDoctorSchedule(String begDate, String endDate, String doctCode) { - JsonResult jsonResult = HisHelper.getJsonResult(HisEnum.AP_Doctor_Schedule, params -> { params.put("BegDate", begDate); params.put("EndDate", endDate); @@ -1008,7 +1008,7 @@ public class HisRegisterDao { * @param endDate 结束时间 * @return 待签到记录 */ - public JSONArray getReLineSignInRecord(String begDate, String endDate) { + public JSONArray getRegLineSignInRecordsOld(String begDate, String endDate) { JsonResult jsonResult = HisHelper.getJsonResult(HisEnum.AP_Query_Line_SignIn, params -> { params.put("BegDate", begDate); params.put("EndDate", endDate); @@ -1019,6 +1019,48 @@ public class HisRegisterDao { return null; } + /** + * 查询预约待签到记录(包含今日挂号的) + * + * @param begDate 开始时间 + * @param endDate 结束时间 + * @return list + */ + public List getRegLineSignInRecords(String begDate, String endDate) { + JsonResult jsonResult = HisHelper.getJsonResult(HisEnum.AP_Query_Line_SignIn, params -> { + params.put("BegDate", begDate); + params.put("EndDate", endDate); + }); + if (jsonResult.success()) { + List regSignList = new ArrayList<>(); + JSONArray jsonArray = jsonResult.getJsonArray("Items", "Item"); + + RegSign regSign; + JSONObject item; + for (int i = 0; i < jsonArray.size(); i++) { + item = jsonArray.getJSONObject(i); + regSign = new RegSign(); + regSign.setTreatNum(item.getString("MZNum")); + regSign.setPatientId(item.getString("PatientId")); + regSign.setPatientName(item.getString("PatientName")); + regSign.setDeptCode(item.getString("DeptCode")); + regSign.setDeptName(item.getString("DeptName")); + regSign.setDoctCode(item.getString("DoctCode")); + regSign.setDoctName(item.getString("DoctName")); + regSign.setBegTime(item.getString("BegTime")); + regSign.setEndTime(item.getString("EndTime")); + regSign.setReservationDate(item.getString("ReservationDate")); + regSign.setScheduleDate(item.getString("ScheduleDate")); + regSign.setRegDateTime(item.getString("RegistDate")); + regSignList.add(regSign); + } + return regSignList; + } + return null; + } + + + /** * 执行预约签到(只执行分时段) * diff --git a/src/main/java/com/ynxbd/common/dao/his/HisReportDao.java b/src/main/java/com/ynxbd/common/dao/his/HisReportDao.java index 67ae11a..96b5e66 100644 --- a/src/main/java/com/ynxbd/common/dao/his/HisReportDao.java +++ b/src/main/java/com/ynxbd/common/dao/his/HisReportDao.java @@ -66,6 +66,10 @@ public class HisReportDao { }); if (!jsonResult.success()) { + String message = jsonResult.getMessage(); + if (message != null && message.contains("没有查询到")) { + return new ArrayList<>(); + } throw new ServiceException(jsonResult.getMessage()); } return jsonResult.getDataMapList(CheckReport.class, "Report"); @@ -133,17 +137,21 @@ public class HisReportDao { * * @return 就诊记录 */ - public List getTreatRecordList(String patientId, String begDate, String endDate, String patientType, String reportType, String deptCode) throws ServiceException { + public List getReportTreatRecords(String patientId, String begDate, String endDate, String treatType, String reportType, String deptCode) throws ServiceException { JsonResult jsonResult = HisHelper.getJsonResult(HisEnum.Query_TreatRecords, params -> { params.put("PatientId", patientId); params.put("BegDate", begDate); params.put("EndDate", endDate); params.put("DeptCode", deptCode); - params.put("InOutState", patientType == null ? "0" : patientType); // 0:全部; 1:门诊号; 2:住院号 + params.put("InOutState", treatType == null ? "0" : treatType); // 0:全部; 1:门诊号; 2:住院号 params.put("CheckOrInspection", reportType == null ? "0" : reportType); // 0:全部; 1:检查; 2:检验; 3:检查+检验 }); if (!jsonResult.success()) { + String message = jsonResult.getMessage(); + if (message != null && message.contains("没有要查找的记录")) { + return new ArrayList<>(); + } throw new ServiceException(jsonResult.getMessage()); } List resultList = new ArrayList<>(); @@ -155,6 +163,7 @@ public class HisReportDao { item = new TreatRecord(); item.setInOutState(nodeItem.getString("InOutState")); + item.setTreatType(nodeItem.getString("InOutState")); // 就诊类型 item.setTreatNum(nodeItem.getString("MZNum")); item.setDeptCode(nodeItem.getString("DeptCode")); // 职称 item.setDeptName(nodeItem.getString("DeptName")); // diff --git a/src/main/java/com/ynxbd/common/dao/pacs/RISPacsDao.java b/src/main/java/com/ynxbd/common/dao/pacs/RISPacsDao.java index 47df30c..7db1662 100644 --- a/src/main/java/com/ynxbd/common/dao/pacs/RISPacsDao.java +++ b/src/main/java/com/ynxbd/common/dao/pacs/RISPacsDao.java @@ -13,35 +13,35 @@ import java.util.List; */ public class RISPacsDao { - public List getReportInfoForOutPatientNum(String outPatientNum){ - return getReportInfo(outPatientNum,null); + public List getReportInfoForOutPatientNum(String outPatientNum) { + return getReportInfo(outPatientNum, null); } - public List getReportInfoForInPatientNum(String inPatientNum){ - return getReportInfo(null,inPatientNum); + public List getReportInfoForInPatientNum(String inPatientNum) { + return getReportInfo(null, inPatientNum); } - public List getReportInfo(String outPatientNum, String inPatientNum){ - if(outPatientNum!=null){ + public List getReportInfo(String outPatientNum, String inPatientNum) { + if (outPatientNum != null) { return PacsDB.select("select * from V_PACS_ReportInfo where outPatientNum = ? and ReportFile is not null", RISPacsReportInfo.class, - ps ->{ - ps.setString(1,outPatientNum); + ps -> { + ps.setString(1, outPatientNum); }); } return PacsDB.select("select * from V_PACS_ReportInfo where inPatientNum = ? and ReportFile is not null", RISPacsReportInfo.class, - ps ->{ - ps.setString(1,inPatientNum); + ps -> { + ps.setString(1, inPatientNum); }); } - public String getReportPath(String reportId){ + public String getReportPath(String reportId) { return PacsDB.select("select reportFile from V_PACS_ReportInfo where ReportID = ?", String.class, - ps ->{ - ps.setString(1,reportId); + ps -> { + ps.setString(1, reportId); }).get(0); } } diff --git a/src/main/java/com/ynxbd/common/helper/common/DateHelper.java b/src/main/java/com/ynxbd/common/helper/common/DateHelper.java index 0298041..920ec7d 100644 --- a/src/main/java/com/ynxbd/common/helper/common/DateHelper.java +++ b/src/main/java/com/ynxbd/common/helper/common/DateHelper.java @@ -8,6 +8,7 @@ import java.text.DateFormat; import java.text.ParseException; import java.text.ParsePosition; import java.text.SimpleDateFormat; +import java.time.LocalDate; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.Calendar; @@ -40,6 +41,7 @@ public class DateHelper { } } + public static LocalDateTime strToLocalDateTime(String date) { try { return LocalDateTime.parse(date, DateTimeFormatter.ofPattern(DateEnum.yyyy_MM_dd_HH_mm_ss.TYPE)); @@ -50,7 +52,7 @@ public class DateHelper { } public static String DateTimeToString(Date date) { - if(date==null||"".equals(date.toString())){ + if (date == null || "".equals(date.toString())) { return ""; } DateFormat df = new SimpleDateFormat(DateEnum.yyyy_MM_dd_HH_mm_ss.TYPE); @@ -589,4 +591,18 @@ public class DateHelper { } } + + public static Boolean leftGreaterThanRight(String dateStr1, String dateStr2, String format) { + if (ObjectUtils.isEmpty(dateStr1) && ObjectUtils.isEmpty(dateStr2)) { + return null; + } + if (format == null) { + format = "yyyy-MM-dd HH:mm:ss"; + } + DateTimeFormatter formatter = DateTimeFormatter.ofPattern(format); + LocalDateTime date1 = LocalDateTime.parse(dateStr1, formatter); + LocalDateTime date2 = LocalDateTime.parse(dateStr2, formatter); + return date1.isAfter(date2); + } + } diff --git a/src/main/java/com/ynxbd/common/helper/common/SmbHelper.java b/src/main/java/com/ynxbd/common/helper/common/SmbHelper.java index 5c89ccc..add1762 100644 --- a/src/main/java/com/ynxbd/common/helper/common/SmbHelper.java +++ b/src/main/java/com/ynxbd/common/helper/common/SmbHelper.java @@ -25,7 +25,6 @@ public class SmbHelper { private final String user; private final String pass; - public byte[] smbGet(String shareUrl) throws Exception { CIFSContext base = SingletonContext.getInstance(); CIFSContext auth = base.withCredentials(new NtlmPasswordAuthentication(base,null, user, pass)); diff --git a/src/main/java/com/ynxbd/common/helper/his/HisEnum.java b/src/main/java/com/ynxbd/common/helper/his/HisEnum.java index de04409..088cd17 100644 --- a/src/main/java/com/ynxbd/common/helper/his/HisEnum.java +++ b/src/main/java/com/ynxbd/common/helper/his/HisEnum.java @@ -108,9 +108,6 @@ public enum HisEnum { AP_Query_Line_SignIn("[在线签到]查询已挂号未签到记录","7009","AP_Query_LineSignIn",true), AP_Line_SignIN("[在线签到]执行挂号患者签到","7010","AP_LineSignIn",true), - - - ; public final String NAME; diff --git a/src/main/java/com/ynxbd/common/helper/his/HisHelper.java b/src/main/java/com/ynxbd/common/helper/his/HisHelper.java index 722bed8..0f53d80 100644 --- a/src/main/java/com/ynxbd/common/helper/his/HisHelper.java +++ b/src/main/java/com/ynxbd/common/helper/his/HisHelper.java @@ -164,7 +164,7 @@ public class HisHelper { } /** - * 医保环境 + * 测试环境 * * @param hisEnum 枚举 * @param params 发送的参数 diff --git a/src/main/java/com/ynxbd/common/helper/pacs/RISPacsHelper.java b/src/main/java/com/ynxbd/common/helper/pacs/RISPacsHelper.java index 279f69f..e2e1a9b 100644 --- a/src/main/java/com/ynxbd/common/helper/pacs/RISPacsHelper.java +++ b/src/main/java/com/ynxbd/common/helper/pacs/RISPacsHelper.java @@ -1,9 +1,6 @@ package com.ynxbd.common.helper.pacs; -import com.ynxbd.common.config.db.PacsDB; -import com.ynxbd.common.dao.pacs.RISPacsDao; import com.ynxbd.common.helper.ProperHelper; -import com.ynxbd.common.helper.common.FtpHelper; import com.ynxbd.common.helper.common.SmbHelper; import lombok.extern.slf4j.Slf4j; @@ -18,16 +15,15 @@ public class RISPacsHelper { private static final String FTP_USER; private static final String FTP_PASS; public static SmbHelper smbHelper; + static { ProperHelper config = new ProperHelper().read("pacs.properties"); FTP_USER = config.getString("ris.ftpUser"); FTP_PASS = config.getString("ris.ftpPass"); - if(FTP_USER ==null){ + if (FTP_USER == null) { log.error("上海岱嘉PACS配置文件读取失败"); - } - else { - smbHelper = new SmbHelper(FTP_USER,FTP_PASS); + } else { + smbHelper = new SmbHelper(FTP_USER, FTP_PASS); } } - } diff --git a/src/main/java/com/ynxbd/common/helper/xbd/XBDHelper.java b/src/main/java/com/ynxbd/common/helper/xbd/XBDHelper.java index c9f14d4..361a8c4 100644 --- a/src/main/java/com/ynxbd/common/helper/xbd/XBDHelper.java +++ b/src/main/java/com/ynxbd/common/helper/xbd/XBDHelper.java @@ -12,7 +12,7 @@ import lombok.extern.slf4j.Slf4j; */ @Slf4j public class XBDHelper { - private static final String CLOUD_FILM_LINK; + private static final String CLOUD_FILM_URL; public static final String MED_RECORD_COPY_URL; public static final String XBD_PEIS; public static OutTeamDao outTeamDao; @@ -20,12 +20,12 @@ public class XBDHelper { static { ProperHelper config = new ProperHelper().read("xbd.properties"); - CLOUD_FILM_LINK = config.getString("xbd.200.cloud_film_link"); + CLOUD_FILM_URL = config.getString("xbd.200.cloud_film_url"); MED_RECORD_COPY_URL = config.getString("xbd.200.med_record_copy_url"); XBD_PEIS = config.getString("xbd.100.peis_url"); - if (CLOUD_FILM_LINK == null) { + if (CLOUD_FILM_URL == null) { log.error("新八达200团队配置文件读取失败"); } - outTeamDao = new OutTeamDao(CLOUD_FILM_LINK); + outTeamDao = new OutTeamDao(CLOUD_FILM_URL); } } diff --git a/src/main/java/com/ynxbd/common/result/JsonResult.java b/src/main/java/com/ynxbd/common/result/JsonResult.java index 30a9e6f..431ebf5 100644 --- a/src/main/java/com/ynxbd/common/result/JsonResult.java +++ b/src/main/java/com/ynxbd/common/result/JsonResult.java @@ -336,7 +336,7 @@ public class JsonResult { JSONObject jsonObject; for (String node : nodes) { jsonArray = JsonHelper.parseArray(result); - if (jsonArray == null || jsonArray.size() == 0) { + if (jsonArray == null || jsonArray.isEmpty()) { return new JSONArray(); } if (jsonArray.size() == 1) { // 如果只有一个值继续处理 @@ -439,7 +439,7 @@ public class JsonResult { String result = rootObj == null ? new JSONObject().toJSONString() : rootObj.toString(); try { JSONArray jsonArray = JSONArray.parseArray(result); - if (jsonArray == null || jsonArray.size() == 0) { + if (jsonArray == null || jsonArray.isEmpty()) { return new JSONObject(); } diff --git a/src/main/java/com/ynxbd/common/result/Result.java b/src/main/java/com/ynxbd/common/result/Result.java index 89ea5f6..a7161ab 100644 --- a/src/main/java/com/ynxbd/common/result/Result.java +++ b/src/main/java/com/ynxbd/common/result/Result.java @@ -2,9 +2,15 @@ package com.ynxbd.common.result; import com.alibaba.fastjson.annotation.JSONField; import com.fasterxml.jackson.annotation.JsonIgnore; +import com.ynxbd.common.helper.common.DateHelper; import com.ynxbd.common.result.struts2.BaseResult; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; import lombok.extern.slf4j.Slf4j; +import java.time.LocalDate; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -12,20 +18,26 @@ import java.util.Map; @Slf4j +@Setter +@Getter +@ToString +@NoArgsConstructor public class Result extends BaseResult { private static final long serialVersionUID = -1005L; // + private Integer code; private String message; private Object data; + private String date; /** * 判断是否成功 */ @JsonIgnore @JSONField(serialize = false) - public boolean isSuccess() { + public boolean isOK() { return ResultEnum.SUCCESS.status.equals(this.code); } @@ -153,51 +165,17 @@ public class Result extends BaseResult { return new Result(resultEnum.status, resultEnum.message); } - public Result() { - } - private Result(Integer code, String message) { this.code = code; this.message = message; + this.date = DateHelper.getCurDateTime(); } public Result(Integer code, String message, Object data) { this.code = code; this.message = message; this.data = data; - } - - @Override - public String toString() { - return "Result{" + - "code=" + code + - ", message='" + message + '\'' + - ", data=" + data + - '}'; - } - - public Integer getCode() { - return code; - } - - public void setCode(Integer code) { - this.code = code; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public Object getData() { - return data; - } - - public void setData(Object data) { - this.data = data; + this.date = DateHelper.getCurDateTime(); } diff --git a/src/main/java/com/ynxbd/common/service/MedToolService.java b/src/main/java/com/ynxbd/common/service/MedToolService.java new file mode 100644 index 0000000..5c93b6e --- /dev/null +++ b/src/main/java/com/ynxbd/common/service/MedToolService.java @@ -0,0 +1,21 @@ +package com.ynxbd.common.service; + +import com.ynxbd.common.bean.MedTool; +import com.ynxbd.common.dao.MedToolDao; + +public class MedToolService { + + public boolean saveMedToolMarkByTreatNum(String treatNum, Integer type, String processMark) { + MedToolDao medToolDao = new MedToolDao(); + MedTool medTool = medToolDao.selectByTreatNumAndType(treatNum, type); + if (medTool == null) { + return medToolDao.add(treatNum, type, processMark); + } else { + String mark = medTool.spliceProcessMark(processMark); + if (mark == null) { // 为空说明无需修改 + return true; + } + return medToolDao.updateProcessMark(treatNum, type, processMark, mark); + } + } +} diff --git a/src/main/java/com/ynxbd/common/service/MedicalService.java b/src/main/java/com/ynxbd/common/service/MedicalService.java index b657979..ea4c314 100644 --- a/src/main/java/com/ynxbd/common/service/MedicalService.java +++ b/src/main/java/com/ynxbd/common/service/MedicalService.java @@ -284,7 +284,7 @@ public class MedicalService { } /** - * [医保]处方缴费 + * [医保]挂号回调通知 * * @param merchantEnum 类型 * @param outTradeNo 订单号 @@ -294,7 +294,7 @@ public class MedicalService { * @param openid openid * @param payInfo 支付信息 */ - public static boolean regPay(MerchantEnum merchantEnum, String outTradeNo, String bankTransNo, String payDate, String payTime, String openid, String payInfo) { + public static boolean regPayNotify(MerchantEnum merchantEnum, String outTradeNo, String bankTransNo, String payDate, String payTime, String openid, String payInfo) { if (outTradeNo == null || bankTransNo == null || payDate == null || payTime == null) { log.info("[医保][挂号]HIS结算参数缺失 outTradeNo={}, bankTransNo={}, payDate={}, payTime={}", outTradeNo, bankTransNo, payDate, payTime); return false; @@ -393,7 +393,7 @@ public class MedicalService { * @param openid openid * @param payInfo 支付信息 */ - public static boolean recipePay(MerchantEnum merchantEnum, String outTradeNo, String bankTransNo, String payDate, String payTime, String openid, String payInfo) { + public static boolean recipePayNotify(MerchantEnum merchantEnum, String outTradeNo, String bankTransNo, String payDate, String payTime, String openid, String payInfo) { if (outTradeNo == null || bankTransNo == null || payDate == null || payTime == null) { log.info("[医保][处方]HIS结算参数缺失 outTradeNo={}, bankTransNo={}, payDate={}, payTime={}", outTradeNo, bankTransNo, payDate, payTime); return false; @@ -502,16 +502,16 @@ public class MedicalService { */ public static Result refund(String payAuthNo, String fpNum, String outTradeNo, String bankTransNo, String tradeNo, String mdUserId, BigDecimal cashFee, BigDecimal insuranceFee) { if (insuranceFee.compareTo(BigDecimal.ZERO) == 0 && cashFee.compareTo(BigDecimal.ZERO) == 0) { - log.info("【医保】[处方]退费金额为0不退费"); - return Result.error("【医保】[处方]金额为0不退费"); + log.info("[医保][处方]退费金额为0不退费"); + return Result.error("[医保][处方]金额为0不退费"); } // 医保退费-必须先执行 - log.info("【医保】[处方][个账]退费开始 tradeNo={}, payAuthNo={}, fpNum={}", tradeNo, payAuthNo, fpNum); + log.info("[医保][处方][个账]退费开始 tradeNo={}, payAuthNo={}, fpNum={}", tradeNo, payAuthNo, fpNum); JsonResult jsonResult = HisMedicalDao.mdRefund(payAuthNo, fpNum, bankTransNo, ("R" + tradeNo), cashFee); if (!jsonResult.success()) { // 失败 - log.info("【医保】[处方][个账]退费失败 outTradeNo={}, bankTransNo={}, tradeNo={}", outTradeNo, bankTransNo, tradeNo); + log.info("[医保][处方][个账]退费失败 outTradeNo={}, bankTransNo={}, tradeNo={}", outTradeNo, bankTransNo, tradeNo); String message = jsonResult.getMessage(); if (message != null && !message.contains("已医保全部退款")) { return Result.error(message); @@ -523,7 +523,7 @@ public class MedicalService { // 现金退费 if (cashFee.compareTo(BigDecimal.ZERO) != 0) { - log.info("【医保】[处方]现金开始退费"); + log.info("[医保][处方]现金开始退费"); // MedicalInfo info = getMedicalAccounts(mdUserId); // if (info == null) { // return Result.error("[订单]未找到结算信息"); diff --git a/src/main/java/com/ynxbd/common/service/PatientService.java b/src/main/java/com/ynxbd/common/service/PatientService.java index 3644b76..1509a6f 100644 --- a/src/main/java/com/ynxbd/common/service/PatientService.java +++ b/src/main/java/com/ynxbd/common/service/PatientService.java @@ -32,7 +32,7 @@ import java.util.UUID; @Slf4j public class PatientService { - public Patient getMyself(String openid) { + public Patient queryMyself(String openid) { return new PatientDao().selectMyself(openid); } @@ -42,13 +42,23 @@ public class PatientService { return null; } List patientList = user.getPatientList(); - if (patientList == null || patientList.size() == 0) { + if (patientList == null || patientList.isEmpty()) { return null; } return patientList.stream().filter(Patient::getIsMyself).findFirst().orElse(null); } - public List getPatientList(String openid, String unionId, boolean isEnPid) { + /** + * 根据openId查询患者ids + * + * @param openId openId + * @return ids + */ + public List queryPatientIdsByOpenId(String openId) { + return new PatientDao().selectPatientsByOpenId(openId); + } + + public List queryPatientList(String openid, String unionId, boolean isEnPid) { List patients = new PatientDao().selectListByToken(openid, unionId); if (isEnPid) { for (Patient item : patients) { diff --git a/src/main/java/com/ynxbd/common/service/RecipeService.java b/src/main/java/com/ynxbd/common/service/RecipeService.java index 5775e29..294ed6a 100644 --- a/src/main/java/com/ynxbd/common/service/RecipeService.java +++ b/src/main/java/com/ynxbd/common/service/RecipeService.java @@ -647,7 +647,7 @@ public class RecipeService { } Integer payStatus = recipe.getPayStatus(); if (payStatus == null || payStatus != 0) { - log.info("【医保】退费参数缺失 payOrdId={}, payStatus={}", payOrdId, payStatus); + log.info("[医保]退费参数缺失 payOrdId={}, payStatus={}", payOrdId, payStatus); return Result.error(ResultEnum.PAY_ORDER_PARAMS_IS_DEFECT); } diff --git a/src/main/java/com/ynxbd/common/service/RegService.java b/src/main/java/com/ynxbd/common/service/RegService.java index 5d1e540..905fd71 100644 --- a/src/main/java/com/ynxbd/common/service/RegService.java +++ b/src/main/java/com/ynxbd/common/service/RegService.java @@ -5,6 +5,7 @@ import com.ynxbd.ali.enums.AliMsgEnum; import com.ynxbd.ali.helper.AliHelper; import com.ynxbd.ali.helper.AliMessageHelper; import com.ynxbd.common.action.pay.PEnum; +import com.ynxbd.common.bean.RegSign; import com.ynxbd.common.bean.enums.HospEnum; import com.ynxbd.common.bean.enums.MerchantEnum; import com.ynxbd.common.bean.pay.Order; @@ -394,7 +395,6 @@ public class RegService { } Register reg = new RegisterDao().selectRegByHisTransNo(hisTransNo); - if (reg == null) { log.info("[挂号][取消预约]失败, 未查询到挂号支付信息"); return Result.error(ResultEnum.DATA_NOT_FOUND); @@ -444,7 +444,7 @@ public class RegService { } MessagePushConfig.regCancelPush(merchantEnum, reg); - if (result.isSuccess()) { + if (result.isOK()) { result.setMessage(merchantEnum.NAME + "取消成功,挂号费用将在24小时内退回!"); // 修改返回提示的信息 } @@ -529,7 +529,7 @@ public class RegService { } MessagePushConfig.regCancelPush(merchantEnum, reg); - if (result.isSuccess()) { + if (result.isOK()) { result.setMessage(merchantEnum.NAME + "取消成功,挂号费用将在24小时内退回!"); // 修改返回提示的信息 } @@ -808,17 +808,17 @@ public class RegService { return new RegisterDao().updateMicroOrderState(outTradeNo, bankTransNo, openid); } - + // 查询挂号预约记录 public List getHisRegReserveRecords(String patientId, String regDate) { - return new HisRegisterDao().getRegReserveHistory(patientId, regDate); + return new HisRegisterDao().getRegReserveRecords(patientId, regDate); } - - public List getHisRegRecords(String patientId, String begDate, String endDate) throws ServiceException { + // 查询挂号历史记录 + public List getHisRegRecordsByRegDate(String patientId, String begDate, String endDate) throws ServiceException { if (begDate == null || endDate == null) { throw new ServiceException("查询日期异常"); } - List hisRegList = new HisRegisterDao().getRegTodayHistory(patientId, begDate.equals(endDate) ? begDate : null); // 起止日期相同时,传递挂号日期 + List hisRegList = new HisRegisterDao().getHisRegHistoryRecords(patientId, begDate.equals(endDate) ? begDate : null); // 起止日期相同时,传递挂号日期 List dataList = new ArrayList<>(); String regDate; @@ -834,22 +834,123 @@ public class RegService { return dataList; } + /** + * 根据HIS流水号查询订单 + * + * @param hisTransNo HIS流水号 + * @return bean + */ + public Register queryRegByHisTransNo(String hisTransNo) { + return new RegisterDao().selectRegByHisTransNo(hisTransNo); + } + + + /** + * 根据HIS流水号查询订单 + * + * @param hisTransNo HIS流水号 + * @return bean + */ + public Register queryRegByPatientIdAndHisTransNo(String patientId, String hisTransNo) throws ServiceException { + List dataList = new RegisterDao().selectListByPatientIdAndHisTransNo(patientId, hisTransNo); + if (dataList.isEmpty()) { + return null; + } + if (dataList.size() > 1) { + throw new ServiceException("错误:查询到多条订单信息"); + } + return dataList.get(0); + } + + /** + * 查询订单 + * + * @param tradeNo HIS订单号 + * @return bean + */ + public Register queryRegByTradeNoAndPatientId(String patientId, String tradeNo) { + return new RegisterDao().selectRegByPatientIdAndTradeNo(patientId, tradeNo); + } + + /** + * 根据HIS挂号订单信息查询 + * + * @param hisTransNo HIS流水号 + * @return bean + */ + public Register queryRegByHisInfo(String patientId, String tradeNo, String hisTransNo) throws ServiceException { + Register register; + log.info("[挂号订单]根据信息查询订单 patientId={}, hisTransNo={} tradeNo={}", patientId, hisTransNo, tradeNo); + if (ObjectUtils.isEmpty(patientId)) { + return null; + } + if (ObjectUtils.isEmpty(tradeNo) && ObjectUtils.isEmpty(hisTransNo)) { + return null; + } + if (ObjectUtils.isEmpty(tradeNo)) { + register = queryRegByPatientIdAndHisTransNo(patientId, hisTransNo); + } else { + register = queryRegByTradeNoAndPatientId(patientId, tradeNo); + } + return register; + } + - public Register findHisRegRecord(String patientId, String regDate, String hisTransNo) throws ServiceException { - if (ObjectUtils.isEmpty(hisTransNo) || ObjectUtils.isEmpty(regDate)) { + /** + * 查询HIS待就诊记录(今日挂号和预约挂号记录) + * + * @param patientId 患者id + */ + public List getHisWaitRegRecords(String patientId) throws ServiceException { + if (ObjectUtils.isEmpty(patientId)) { throw new ServiceException(ResultEnum.PARAM_IS_BLANK); } + String curDate = DateHelper.getCurDate(); + // 挂号历史记录(今日) + List hisRegRecords = getHisRegRecordsByRegDate(patientId, curDate, curDate); + if (hisRegRecords == null) { + hisRegRecords = new ArrayList<>(); + } + // 预约挂号 + List hisRegReserveRecords = getHisRegReserveRecords(patientId, null); + if (hisRegReserveRecords != null && !hisRegReserveRecords.isEmpty()) { + hisRegRecords.addAll(hisRegReserveRecords); + } + return hisRegRecords; + } + /** + * 根据挂号日期查询挂号记录 + * + * @param patientId 患者id + * @param regDate 挂号日期 + */ + public List getHisRegRecordsByRegDate(String patientId, String regDate) throws ServiceException { + if (ObjectUtils.isEmpty(patientId) || ObjectUtils.isEmpty(regDate)) { + throw new ServiceException(ResultEnum.PARAM_IS_BLANK); + } String curDate = DateHelper.getCurDate(); List hisRegRecords; - if (curDate.equals(regDate)) { // 今日挂号及以前 - hisRegRecords = getHisRegRecords(patientId, regDate, regDate); + if (curDate.equals(regDate)) { // 今日挂号 + hisRegRecords = getHisRegRecordsByRegDate(patientId, regDate, regDate); } else { // 预约挂号 hisRegRecords = getHisRegReserveRecords(patientId, regDate); } + return hisRegRecords; + } + + + public Register findHisRegRecordByHisTransNo(String patientId, String regDate, String hisTransNo) throws ServiceException { + if (ObjectUtils.isEmpty(regDate) || ObjectUtils.isEmpty(hisTransNo)) { + throw new ServiceException(ResultEnum.PARAM_IS_BLANK); + } + String tip; + List hisRegRecords = getHisRegRecordsByRegDate(patientId, regDate); if (hisRegRecords.isEmpty()) { - throw new ServiceException("错误:HIS中未查询到挂号记录 日期:" + regDate); + tip = "HIS中未查询到挂号记录"; + log.info("[挂号]{} patientId={}, regDate={}, hisTransNo={}", tip, patientId, regDate, hisTransNo); + throw new ServiceException("错误:" + tip + " 日期:" + regDate); } List filterList = hisRegRecords.stream().filter(o -> hisTransNo.equals(o.getHisTransNo())).collect(Collectors.toList()); @@ -857,26 +958,151 @@ public class RegService { return filterList.get(0); } - throw new ServiceException(filterList.isEmpty() - ? "错误:HIS中未找到对应的挂号信息" - : "错误:HIS中同一科室查询到多条挂号记录"); + tip = filterList.isEmpty() ? "HIS中未匹配到挂号记录" : "HIS中同一科室查询到多条挂号记录"; + log.info("[挂号]{} patientId={}, regDate={}, hisTransNo={}", tip, patientId, regDate, hisTransNo); + throw new ServiceException("错误:" + tip + " 日期:" + regDate); } - public boolean updateRegMedToolMark(String id, String addMedToolMark, String openId) throws ServiceException { + public Register findHisRegRecordByTreatNum(String patientId, String regDate, String treatNum) throws ServiceException { + if (ObjectUtils.isEmpty(regDate) || ObjectUtils.isEmpty(treatNum)) { + throw new ServiceException(ResultEnum.PARAM_IS_BLANK); + } + List hisRegRecords = getHisRegRecordsByRegDate(patientId, regDate, regDate); + String tip; + if (hisRegRecords.isEmpty()) { + tip = "HIS中未查询到挂号记录"; + log.info("[挂号]{} patientId={}, regDate={}, treatNum={}", tip, patientId, regDate, treatNum); + throw new ServiceException("错误:" + tip + " 日期:" + regDate); + } + + List filterList = hisRegRecords.stream().filter(o -> treatNum.equals(o.getTreatNum())).collect(Collectors.toList()); + if (filterList.size() == 1) { + return filterList.get(0); + } + + tip = filterList.isEmpty() ? "HIS中未匹配到挂号记录" : "HIS中同一科室查询到多条挂号记录"; + log.info("[挂号]{} patientId={}, regDate={}, treatNum={}", tip, patientId, regDate, treatNum); + throw new ServiceException("错误:" + tip + " 日期:" + regDate); + } + + /** + * 查询数据库挂号记录 + * + * @param patientId 患者id + * @param regDate 挂号日期 + * @param treatNum 门诊号 + * @return bean + */ + public Register findDBRegRecordByTreatNum(String patientId, String regDate, String treatNum) { + try { + Register hisRegRecord = findHisRegRecordByTreatNum(patientId, regDate, treatNum); + if (hisRegRecord == null) { + log.info("[挂号]根据门诊号查询失败,未找到HIS挂号记录 patientId={}, regDate={} treatNum={}", patientId, regDate, treatNum); + return null; + } + String hisTransNo = hisRegRecord.getHisTransNo(); + if (ObjectUtils.isEmpty(hisTransNo)) { + log.info("[挂号]根据门诊号查询失败 HisTransNo为空 patientId={}, regDate={} treatNum={}", patientId, regDate, treatNum); + return null; + } + return queryRegByHisTransNo(hisTransNo); + } catch (Exception e) { + return null; + } + } + + + /** + * 补充挂号门诊号 + * + * @param treatNum 门诊号 + * @param openId openId + */ + public boolean completeRegTreatNum(String treatNum, String openId, String patientId, String tradeNo, String hisTransNo, String orderFromOwner) throws ServiceException { + if (!ObjectUtils.isEmpty(orderFromOwner) && !"蓝旗".equals(orderFromOwner)) { + return true; + } RegisterDao regDao = new RegisterDao(); - Register findInfo = regDao.selectRegisterById(id); + Register findInfo = queryRegByHisInfo(patientId, tradeNo, hisTransNo); if (findInfo == null) { throw new ServiceException("未找到挂号信息"); } - String dbMedToolMark = findInfo.getMedToolMark(); - String updateMedToolMark = addMedToolMark; - if (!ObjectUtils.isEmpty(dbMedToolMark)) { - if (dbMedToolMark.contains(addMedToolMark)) { // 已存在 - throw new ServiceException("状态已存在"); - } else { - updateMedToolMark = dbMedToolMark + "," + addMedToolMark; - } + Long id = findInfo.getId(); + String curDate = DateHelper.getCurDate(); + if (!curDate.equals(findInfo.getRegDate())) { + throw new ServiceException("不是今日就诊"); } - return regDao.updateRegMedToolMark(id, addMedToolMark, updateMedToolMark) > 0; + if (!ObjectUtils.isEmpty(findInfo.getTreatNum())) { //就诊号不为空=>无需补充门诊号 + return true; + } + return regDao.updateTreatNum(id, treatNum) > 0; } + + +// public boolean updateRegMedToolMarkByTreatNum(String treatNum, String patientId, String addMedToolMark) throws ServiceException { +// RegisterDao regDao = new RegisterDao(); +// String curDate = DateHelper.getCurDate(); +// +// Register findInfo = findDBRegRecordByTreatNum(patientId, curDate, treatNum); +// if (findInfo == null) { +// throw new ServiceException("未找到挂号信息"); +// } +// if (!curDate.equals(findInfo.getRegDate())) { +// throw new ServiceException("不是今日就诊"); +// } +// Long id = findInfo.getId(); +// if (!ObjectUtils.isEmpty(findInfo.getTreatNum())) { // 就诊号不为空=>无需补充门诊号 +// treatNum = null; +// } +// +// String dbMedToolMark = findInfo.getMedToolMark(); +// String updateMedToolMark = addMedToolMark; +// if (!ObjectUtils.isEmpty(dbMedToolMark)) { +// if (dbMedToolMark.contains(addMedToolMark)) { // 已存在 +// throw new ServiceException("状态已存在"); +// } else { +// updateMedToolMark = dbMedToolMark + "," + addMedToolMark; +// } +// } +// return regDao.updateTreatNum(String.valueOf(id), treatNum) > 0; +// } + + + public List getRegLineSignInRecords(String begDate, String endDate) { + if (begDate == null || endDate == null) { // 只查询今日 + begDate = DateHelper.getCurDate() + " 06:00:00"; + endDate = DateHelper.getCurDate() + " 23:59:59"; + } + return new HisRegisterDao().getRegLineSignInRecords(begDate, endDate); + } + + /** + * 根据患者id,查询预约待签到记录 + * + * @param patientId patientId + * @return list + */ + public List getRegLineSignInRecordsByPatientId(String patientId, String begDate, String endDate) { + List records = getRegLineSignInRecords(null, null); + if (records.isEmpty()) { + return new ArrayList<>(); + } + return records.stream().filter(o -> patientId.equals(o.getPatientId())).collect(Collectors.toList()); + } + + + /** + * 根据treatNum,查询预约待签到记录 + * + * @param treatNum 门诊号 + * @return bean + */ + public RegSign getRegLineSignInRecordByTreatNum(String treatNum) { + List records = getRegLineSignInRecords(null, null); + if (records.isEmpty()) { + return null; + } + return records.stream().filter(o -> treatNum.equals(o.getTreatNum())).findFirst().orElse(null); + } + } diff --git a/src/main/java/com/ynxbd/common/service/ReportService.java b/src/main/java/com/ynxbd/common/service/ReportService.java index 6a9d3da..df40e13 100644 --- a/src/main/java/com/ynxbd/common/service/ReportService.java +++ b/src/main/java/com/ynxbd/common/service/ReportService.java @@ -17,53 +17,56 @@ public class ReportService { /** * 更新lis查看报告单数量 + * * @return 是否更新成功 */ - public boolean updateReportLisCount(){ - return updateReportCount(ReportEnum.ReportLis); + public boolean updateReportLisCount() { + return updateReportCount(ReportEnum.ReportLis); } /** * 更新pacs查看报告单数量 + * * @return 是否更新成功 */ - public boolean updateReportPacsCount(){ + public boolean updateReportPacsCount() { return updateReportCount(ReportEnum.ReportPacs); } /** * 更新体检查看报告单数量 + * * @return 是否更新成功 */ - public boolean updateReportPeisCount(){ + public boolean updateReportPeisCount() { return updateReportCount(ReportEnum.ReportPies); } /** * 更新云胶片查看数量 + * * @return 是否更新成功 */ - public boolean updateReportCloudCount(){ + public boolean updateReportCloudCount() { return updateReportCount(ReportEnum.ReportCloud); } /** * 查看报告单数量统计更新 + * * @return 是否更新成功 */ - public boolean updateReportCount(ReportEnum reportEnum){ + public boolean updateReportCount(ReportEnum reportEnum) { try { - if(new ReportDao().existToday(reportEnum.CODE)){ - log.info("[报表数量统计] {}-有今日数据,今日数据量+1",reportEnum.TYPE); + if (new ReportDao().existToday(reportEnum.CODE)) { + log.info("[报表数量统计] {}-有今日数据,今日数据量+1", reportEnum.TYPE); return new ReportDao().updateCount(reportEnum.CODE); + } else { + log.info("[报表数量统计] {}-无今日数据,插入一条新的数据", reportEnum.TYPE); + return new ReportDao().insertToday(1, reportEnum.CODE, ""); } - else { - log.info("[报表数量统计] {}-无今日数据,插入一条新的数据",reportEnum.TYPE); - return new ReportDao().insertToday(1,reportEnum.CODE,""); - } - } - catch (Exception exception){ - log.error("[报表数量统计] {}-错误:{}",reportEnum.TYPE,exception.toString()); + } catch (Exception exception) { + log.error("[报表数量统计] {}-错误:{}", reportEnum.TYPE, exception.toString()); return false; } } diff --git a/src/main/java/com/ynxbd/common/test/Test01.java b/src/main/java/com/ynxbd/common/test/Test01.java deleted file mode 100644 index 0870dee..0000000 --- a/src/main/java/com/ynxbd/common/test/Test01.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.ynxbd.common.test; - -import com.ynxbd.common.helper.common.AesHelper; -import com.ynxbd.wx.wxfactory.ReqParamHelper; - -public class Test01 { - - public static void main(String[] args) { - // 患者id - System.out.println(ReqParamHelper.encode("282466")); - } -} diff --git a/src/main/java/com/ynxbd/wx/servlet/test/RefundTest.java b/src/main/java/com/ynxbd/wx/servlet/test/RefundTest.java index 0a55e24..ade6ef5 100644 --- a/src/main/java/com/ynxbd/wx/servlet/test/RefundTest.java +++ b/src/main/java/com/ynxbd/wx/servlet/test/RefundTest.java @@ -4,14 +4,9 @@ import com.ynxbd.wx.wxfactory.WxPayHelper; import java.math.BigDecimal; -/** - * @author 李进才 - * @ClassName RefundTest - * @Description TODO - * @date 2023/12/20 11:51:00 - */ +// 退费 public class RefundTest { - public static void main(String[] args) { - WxPayHelper.refund("WX34361d8ce54248773cf9acf4bdf8", "4200002138202312203358207528", new BigDecimal("0.800"), new BigDecimal("0.800"), "手动退费"); - } +// public static void main(String[] args) { +// WxPayHelper.refund("WX34361d8ce54248773cf9acf4bdf8", "4200002138202312203358207528", new BigDecimal("0.800"), new BigDecimal("0.800"), "手动退费"); +// } } diff --git a/src/main/java/com/ynxbd/wx/wxfactory/ReqParamHelper.java b/src/main/java/com/ynxbd/wx/wxfactory/ReqParamHelper.java index e7079e6..3772edd 100644 --- a/src/main/java/com/ynxbd/wx/wxfactory/ReqParamHelper.java +++ b/src/main/java/com/ynxbd/wx/wxfactory/ReqParamHelper.java @@ -1,8 +1,7 @@ package com.ynxbd.wx.wxfactory; import com.ynxbd.common.helper.common.AesHelper; - -import java.math.BigDecimal; +import org.apache.commons.lang3.ObjectUtils; /** * 请求参数处理-此处为参数解密 @@ -17,11 +16,11 @@ public class ReqParamHelper { } public static String decode(String enData) { + if (ObjectUtils.isEmpty(enData)) return null; return AesHelper.decryptHex(enData, KEY, IV); } public static void main(String[] args) { - System.out.println(encode("164649")); - System.out.println(decode("1D9BD9BA3A6DC0A9B40BE40234497596")); + System.out.println(encode("397631")); } } diff --git a/src/main/java/com/ynxbd/wx/wxfactory/WxAuthHelper.java b/src/main/java/com/ynxbd/wx/wxfactory/WxAuthHelper.java index 7f8f7d1..96c10c9 100644 --- a/src/main/java/com/ynxbd/wx/wxfactory/WxAuthHelper.java +++ b/src/main/java/com/ynxbd/wx/wxfactory/WxAuthHelper.java @@ -52,7 +52,7 @@ public class WxAuthHelper { user.setOpenid(openid); user.setIsSnapShotUser(snsToken.getIsSnapShotUser()); - user.setPatientList(new PatientService().getPatientList(openid, unionId, true)); + user.setPatientList(new PatientService().queryPatientList(openid, unionId, true)); if (isUserInfo) { SnsUserInfo snsUser = WxFactory.Base.OAuth().snsUserInfo(snsToken.getAccessToken(), openid, "zh_CN", 3); diff --git a/src/main/java/com/ynxbd/wx/wxfactory/WxMedicalHelper.java b/src/main/java/com/ynxbd/wx/wxfactory/WxMedicalHelper.java index 00e448c..1d87428 100644 --- a/src/main/java/com/ynxbd/wx/wxfactory/WxMedicalHelper.java +++ b/src/main/java/com/ynxbd/wx/wxfactory/WxMedicalHelper.java @@ -55,7 +55,7 @@ public class WxMedicalHelper { } tip = String.format("医保卡绑定人是:【%s】,当前支付的订单属于患者:【%s】,该订单不属于医保卡本人,禁止支付", userName, realName); } - log.info("【医保】不是本人禁止支付"); + log.info("[医保]不是本人禁止支付"); throw new ServiceException(ResultEnum.PAY_NO_SELF_NO_PAY, tip); } } @@ -74,22 +74,22 @@ public class WxMedicalHelper { // 转换数据对象 Map paramsMap = WxSignHelper.getReqXmlParamsMap(request); if (paramsMap == null) { - throw new ServiceException("【医保】回调通知下单信息返回错误"); + throw new ServiceException("[医保]回调通知下单信息返回错误"); } // 签名验证 if (!WxSignHelper.validateSign(paramsMap, MdConfig.PAY_KEY)) { // 验证未通过,通知支付失败 - throw new ServiceException("【医保】回调通知签名验证未通过!"); + throw new ServiceException("[医保]回调通知签名验证未通过!"); } String json = JsonHelper.toJsonString(paramsMap); if ("".equals(json)) { - throw new ServiceException("【医保】回调通知下单信息为空"); + throw new ServiceException("[医保]回调通知下单信息为空"); } MedicalNotify notifyInfo = JsonHelper.parseObject(json, MedicalNotify.class); if (notifyInfo == null) { - throw new ServiceException("【医保】回调通知下单信息转换失败"); + throw new ServiceException("[医保]回调通知下单信息转换失败"); } String openid = notifyInfo.getOpenid(); @@ -101,12 +101,12 @@ public class WxMedicalHelper { String timeEnd = notifyInfo.getTimeEnd(); if (openid == null || outTradeNo == null || medTransId == null || totalFee == null || cashFee == null || insuranceFee == null || timeEnd == null) { - throw new ServiceException(String.format("【医保】下单信息返回错误 outTradeNo={%s}", outTradeNo)); + throw new ServiceException(String.format("[医保]下单信息返回错误 outTradeNo={%s}", outTradeNo)); } // 已处理 去重 if (KEYS.isContainsKey(medTransId)) { - throw new ServiceException(ResultEnum.PAY_NOTIFY_REPEAT, String.format("【医保】[重复请求]下单信息去重 outTradeNo={%s}", outTradeNo)); + throw new ServiceException(ResultEnum.PAY_NOTIFY_REPEAT, String.format("[医保][重复请求]下单信息去重 outTradeNo={%s}", outTradeNo)); } String info = WxSignHelper.getMapInfo(paramsMap, "response_content"); @@ -126,7 +126,7 @@ public class WxMedicalHelper { throw e; } ErrorHelper.println(e); - throw new ServiceException(String.format("【医保】支付通知异常:[%s]", e.getMessage())); + throw new ServiceException(String.format("[医保]支付通知异常:[%s]", e.getMessage())); } } @@ -172,9 +172,9 @@ public class WxMedicalHelper { body, attach); - log.info("【医保】创建订单 {}", order); + log.info("[医保]创建订单 {}", order); if (order == null) { - throw new ServiceException("【医保】请求失败"); + throw new ServiceException("[医保]请求失败"); } if (!order.isOk()) { @@ -183,7 +183,7 @@ public class WxMedicalHelper { String payUrl = order.getPayUrl(); if (payUrl == null) { - throw new ServiceException("【医保】下单链接为空"); + throw new ServiceException("[医保]下单链接为空"); } log.info("[医保]下单url payUrl={}", payUrl); map.put("payUrl", payUrl); @@ -238,7 +238,7 @@ public class WxMedicalHelper { /** - * [医保]退费 + * [医保]HIS调用退费 */ public static MedicalOrder refund(String outTradeNo, String outRefundNo, String payOrdId, BigDecimal cashFee, String reason) { return WxFactory.Medical.Common().refund( diff --git a/src/main/java/com/ynxbd/wx/wxfactory/medical/Client.java b/src/main/java/com/ynxbd/wx/wxfactory/medical/Client.java index 3c3a6da..b9e6d06 100644 --- a/src/main/java/com/ynxbd/wx/wxfactory/medical/Client.java +++ b/src/main/java/com/ynxbd/wx/wxfactory/medical/Client.java @@ -84,7 +84,7 @@ public class Client { payType = 3; // 医保+现金 } } catch (Exception e) { - log.error("【医保】金额转换异常: {}", e.getMessage()); + log.error("[医保]金额转换异常: {}", e.getMessage()); return null; } diff --git a/src/main/java/com/ynxbd/wx/wxfactory/utils/MdRespHelper.java b/src/main/java/com/ynxbd/wx/wxfactory/utils/MdRespHelper.java index c02eb1d..c14180b 100644 --- a/src/main/java/com/ynxbd/wx/wxfactory/utils/MdRespHelper.java +++ b/src/main/java/com/ynxbd/wx/wxfactory/utils/MdRespHelper.java @@ -25,7 +25,7 @@ public class MdRespHelper { * 成功响应 */ public static String respOk(String mdPayKey) { - log.info("【医保】回调通知成功"); + log.info("[医保]回调通知成功"); try { Map map = new HashMap<>(); map.put("return_code", "SUCCESS"); @@ -45,7 +45,7 @@ public class MdRespHelper { * 成功响应 */ public static String respFail(String message, String mdPayKey) { - log.info("【医保】回调通知:{}", message); + log.info("[医保]回调通知:{}", message); if (message == null) { message = "FAIL"; } diff --git a/src/main/resources/ehcache.xml b/src/main/resources/ehcache.xml index 0e53095..71fbd9c 100644 --- a/src/main/resources/ehcache.xml +++ b/src/main/resources/ehcache.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://www.ehcache.org/v3 http://www.ehcache.org/schema/ehcache-core.xsd"> - + java.lang.String diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml index b25aa77..8479cad 100644 --- a/src/main/resources/logback.xml +++ b/src/main/resources/logback.xml @@ -1,7 +1,7 @@ - - + + diff --git a/src/main/resources/webservice.properties b/src/main/resources/webservice.properties index e86b532..44b70d6 100644 --- a/src/main/resources/webservice.properties +++ b/src/main/resources/webservice.properties @@ -1 +1 @@ -# 开启处方预结算(第2开关)(注意该配置需联系his开发者确认支持才能开启,否则存在风险!) his.is_recipe_prepay=false lis.url= 192.168.1.185:8090 lis.unifiedEntrance = true # 本地 #his.url=127.0.0.1:8888 # 测试环境 # 是否强制打印webservice的xml返回数据 his.is_log_resp=true # 是否传递openid给his推送消息 his.is_push_msg=false #------------------------------------------------------------- #本地 his.md_url=127.0.0.1:7777 his.dev_url=127.0.0.1:7777 his.url=192.168.1.131:8888 ali_code = 675448357 # 公司测试 #his.url=192.168.12.10:8888 # 红河 #his.url=10.20.10.6:8888 # 红河医保 #his.url=10.20.10.6:8888 #his.url=192.168.12.10:8888 #his.md_url=192.168.1.128:7885 #his.dev_url=10.20.10.6:9988 # 永胜 #his.url=200.200.200.20:8888 # 德宏中医 #his.url=200.200.200.60:8888 # 华坪 #his.url=192.168.1.115:8888 # 蒙自中医 #his.url=192.168.0.228:8888 # 玉龙 #his.url=192.168.0.17:8888 # 云龙 #his.url=200.200.200.69:8888 # #his.url=172.16.10.15:8888 # 禄劝钟爱 #his.url=200.200.200.5:8888 # 蒙自市人民医院 #his.url=200.200.200.174:8080 # 元谋 #his.url=200.200.200.29:8888 # 元谋医保 #his.dev_url=200.200.200.36:9999 # 芒市 #his.url=192.168.100.8:8888 # 红河妇幼保健院 #his.url=192.168.1.204:8888 # 芒市妇幼 #his.url=192.168.11.7:8888 # #his.url=10.10.11.23:8888 # 石林 #his.url=192.168.10.10:8888 # 富民 #his.url=200.200.201.27:8888 # 西双版纳 #his.url=10.10.11.23:8888 #wx.password=ynxbd@6910 \ No newline at end of file +# \u5F00\u542F\u5904\u65B9\u9884\u7ED3\u7B97\uFF08\u7B2C2\u5F00\u5173\uFF09\uFF08\u6CE8\u610F\u8BE5\u914D\u7F6E\u9700\u8054\u7CFBhis\u5F00\u53D1\u8005\u786E\u8BA4\u652F\u6301\u624D\u80FD\u5F00\u542F\uFF0C\u5426\u5219\u5B58\u5728\u98CE\u9669\uFF01\uFF09 his.is_recipe_prepay=false lis.url=192.168.1.185:8090 lis.unifiedEntrance=true # \u672C\u5730 #his.url=127.0.0.1:8888 # \u6D4B\u8BD5\u73AF\u5883 # \u662F\u5426\u5F3A\u5236\u6253\u5370webservice\u7684xml\u8FD4\u56DE\u6570\u636E his.is_log_resp=true # \u662F\u5426\u4F20\u9012openid\u7ED9his\u63A8\u9001\u6D88\u606F his.is_push_msg=false #------------------------------------------------------------- #\u672C\u5730 his.md_url=127.0.0.1:7777 his.dev_url=127.0.0.1:7777 his.url=200.200.200.60:8888 ali_code=675448357 # \u516C\u53F8\u6D4B\u8BD5 #his.url=192.168.12.10:8888 # \u7EA2\u6CB3 #his.url=10.20.10.6:8888 # \u7EA2\u6CB3\u533B\u4FDD #his.url=10.20.10.6:8888 #his.url=192.168.12.10:8888 #his.md_url=192.168.1.128:7885 #his.dev_url=10.20.10.6:9988 # \u6C38\u80DC #his.url=200.200.200.20:8888 # \u5FB7\u5B8F\u4E2D\u533B #his.url=200.200.200.60:8888 # \u534E\u576A #his.url=192.168.1.115:8888 # \u8499\u81EA\u4E2D\u533B #his.url=192.168.0.228:8888 # \u7389\u9F99 #his.url=192.168.0.17:8888 # \u4E91\u9F99 #his.url=200.200.200.69:8888 # #his.url=172.16.10.15:8888 # \u7984\u529D\u949F\u7231 #his.url=200.200.200.5:8888 # \u8499\u81EA\u5E02\u4EBA\u6C11\u533B\u9662 #his.url=200.200.200.174:8080 # \u5143\u8C0B #his.url=200.200.200.29:8888 # \u5143\u8C0B\u533B\u4FDD #his.dev_url=200.200.200.36:9999 # \u8292\u5E02 #his.url=192.168.100.8:8888 # \u7EA2\u6CB3\u5987\u5E7C\u4FDD\u5065\u9662 #his.url=192.168.1.204:8888 # \u8292\u5E02\u5987\u5E7C #his.url=192.168.11.7:8888 # #his.url=10.10.11.23:8888 # \u77F3\u6797 #his.url=192.168.10.10:8888 # \u5BCC\u6C11 #his.url=200.200.201.27:8888 # \u897F\u53CC\u7248\u7EB3 #his.url=10.10.11.23:8888 #wx.password=ynxbd@6910 \ No newline at end of file diff --git a/src/main/resources/xbd.properties b/src/main/resources/xbd.properties index 7079d1c..a1612d5 100644 --- a/src/main/resources/xbd.properties +++ b/src/main/resources/xbd.properties @@ -1,5 +1,5 @@ # \u4E91\u80F6\u7247\u5730\u5740 -xbd.200.token_url=http://10.20.10.41:8082 +xbd.200.cloud_film_url=http://192.168.0.183:3307/wx3307 # \u75C5\u5386\u590D\u5370 xbd.200.med_record_copy_url=http://192.168.12.66:8081 # \u4F53\u68C0 diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml index ab3d076..4c7bd92 100644 --- a/src/main/webapp/WEB-INF/web.xml +++ b/src/main/webapp/WEB-INF/web.xml @@ -10,6 +10,11 @@ com.ynxbd.common.config.WebContextLister + + logbackConfigLocation + classpath:logback.xml + + struts2 org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter