微信后端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

247 lines
10 KiB

package com.ynxbd.common.action;
import com.ynxbd.common.action.base.BaseAction;
import com.ynxbd.common.bean.HisRecipe;
import com.ynxbd.common.bean.NatRecord;
import com.ynxbd.common.bean.Patient;
import com.ynxbd.common.bean.xk.medicalRecipe;
import com.ynxbd.common.dao.NatRecordDao;
import com.ynxbd.common.dao.PatientDao;
import com.ynxbd.common.dao.his.HisRecipeDao;
import com.ynxbd.common.helper.common.DateHelper;
import com.ynxbd.common.result.Result;
import com.ynxbd.common.result.ResultEnum;
import com.ynxbd.common.service.RecipeService;
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.List;
/**
* 处方
*
* @Author wsq
* @Date 2020/11/6 9:45
* @Copyright @ 2020 云南新八达科技有限公司 All rights reserved.
*/
@Slf4j
@Namespace("/recipe")
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);
if (patientId == null || begDate == null || endDate == null) {
return Result.error(ResultEnum.PARAM_IS_DEFECT);
}
patientId = getDecodeString(patientId);
List<HisRecipe> recipeList = new HisRecipeDao().getPaidRecipeList(patientId, begDate, endDate,personNo);
return Result.success(recipeList);
}
/**
* 获取未缴费项目
*/
@Action("getUnPayList")
public Result getUnPayList(String patientId, String personNo, String begDate, String endDate ) {
log.info("[处方]未缴费项目查询 patientId={},personNo-{}, begDate={}, endDate={}", patientId, personNo, begDate, endDate);
if (patientId == null || begDate == null || endDate == null) {
return Result.error(ResultEnum.PARAM_IS_DEFECT);
}
patientId = getDecodeString(patientId);
int days = DateHelper.intervalDays(begDate, endDate, true);
List<HisRecipe> hisRecipes = new HisRecipeDao().getUnPayRecipe(patientId, personNo, days);
List<HisRecipe> resultList = new ArrayList<>();
for (HisRecipe hisRecipe : hisRecipes) {
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);
}
/**
* 获取所以未缴费订单 包括互联网医院未审核医保双通道订单
* @param patientId patientId
* @param begDate 开始时间
* @param endDate 结束时间
*/
@Action("getMedicalRecipe")
public Result getMedicalRecipe(String patientId, String begDate, String endDate ) {
log.info("[处方]未缴费项目查询 patientId={}", patientId);
if (patientId == null) {
return Result.error(ResultEnum.PARAM_IS_DEFECT);
}
patientId = getDecodeString(patientId);
int days = DateHelper.intervalDays(begDate, endDate, true);
List<HisRecipe> hisRecipes = new HisRecipeDao().getUnPayRecipe(patientId,"",days);
List<HisRecipe> resultList = new ArrayList<>();
for (HisRecipe hisRecipe : hisRecipes) {
if (hisRecipe.getDate() != null && DateHelper.inDateRange(begDate, endDate, hisRecipe.getDate(), DateHelper.DateEnum.yyyy_MM_dd)) {
resultList.add(hisRecipe);
}
}
return Result.success(resultList);
}
/**
* 将订单上传到医保双通道
* @param treatNum 门诊号
* @param personID 身份证
* @param recipes 处方号合集中间用英文逗号隔开
*/
@Action("uploadMedicalRecipe")
public Result uploadMedicalRecipe(String treatNum, String personID, String recipes){
log.info("[互联网医院]处方医保双通道流转 treatNum={},personNo-{}, recipes={}", treatNum, personID, recipes);
if(treatNum==null||personID==null||recipes==null){
return Result.error(ResultEnum.PARAM_IS_DEFECT);
}
List<medicalRecipe> medicalRecipe = new HisRecipeDao().uploadMedicalRecipe(treatNum,personID,recipes);
return Result.success(medicalRecipe);
}
// /**
// * 获取未缴费项目
// */
// @Action("getDevUnPayList")
// public Result getDevUnPayList(String patientId, String begDate, String endDate ) {
// log.info("[处方]未缴费项目查询 patientId={}, begDate={}, endDate={}", patientId, begDate, endDate);
// if (patientId == null || begDate == null || endDate == null) {
// return Result.error(ResultEnum.PARAM_IS_DEFECT);
// }
//
// int days = DateHelper.intervalDays(begDate, endDate, true);
// List<HisRecipe> hisRecipes = new DevHisRecipeDao().getDevUnPayRecipe(patientId, days);
//
// List<HisRecipe> resultList = new ArrayList<>();
// for (HisRecipe hisRecipe : hisRecipes) {
// if (hisRecipe.getDate() != null && DateHelper.inDateRange(begDate, endDate, hisRecipe.getDate(), DateHelper.DateEnum.yyyy_MM_dd)) {
// resultList.add(hisRecipe);
// }
// }
// return Result.success(resultList);
// }
/**
* 标准物价查询
*
* @param pageNum 页码
* @param pageSize 每页数量
* @param pyCode 拼音码
* @param type 类型 {1:检查治疗; 2:药品材料; 99:全部}
* @param groupFlag 组套标识 { 0不含组套 1包含组套 }
* @return 结果
*/
@Action("getStandardPrice")
public Result getStandardPrice(Integer pageNum, Integer pageSize, String pyCode, String type, String groupFlag) {
return new RecipeService().getStandardPrice(pageNum, pageSize, pyCode, type, groupFlag);
}
/**
* 添加核酸检测记录德宏
*/
@Action("addNatRecord")
public Result addNatRecord() {
String openid = getString("openid");
String patientId = getString("patientId");
if (patientId == null || openid == null) {
return Result.error(ResultEnum.PARAM_IS_DEFECT);
}
Boolean isRepeat = getBoolean("isRepeat"); // 开启重复填写检查
if (isRepeat == null) isRepeat = false;
NatRecordDao natRecordDao = new NatRecordDao();
if (isRepeat && natRecordDao.hasRecord(patientId, DateHelper.getCurDate())) {
return Result.success();
}
String temperature = getString("temperature"); // 体温
String country = getString("country"); // 国籍
String greenCode = getString("greenCode"); // 绿码情况
String tripCode = getString("tripCode"); // 行程码情况
String symptom = getString("symptom"); // 症状
String info = getString("info");
log.info("[核酸检测]记录 country={}, temperature={}, greenCode={}, tripCode={}, symptom={}", country, temperature, greenCode, tripCode, symptom);
if (temperature == null || greenCode == null || tripCode == null) {
return Result.error(ResultEnum.PARAM_IS_DEFECT);
}
Patient patient = new PatientDao().selectByOpenidAndPatientId(openid, patientId);
if (patient == null) {
return Result.error(ResultEnum.PATIENT_NOT_FOUND);
}
NatRecord natRecord = new NatRecord();
natRecord.setOperateUser("蓝旗");
natRecord.setPatientId(patientId);
natRecord.setIdCardNo(patient.getIdCardNo());
natRecord.setName(patient.getName());
natRecord.setTel(patient.getTel());
natRecord.setSex(patient.getSex());
//
natRecord.setCountry(country);
natRecord.setTemperature(temperature);
natRecord.setGreenCode(greenCode);
natRecord.setTripCode(tripCode);
natRecord.setSymptom(symptom);
//
natRecord.setInfo(info);
boolean isInsert = natRecordDao.insert(natRecord);
if (!isInsert) {
log.info("[核酸检测] 记录信息失败 patientId={}, openid={}", patientId, openid);
return Result.error();
}
return Result.success();
}
// /**
// * 核酸检测支付
// */
// @Action("payNat")
// public Result payNat() {
// String patientId = getString("patientId");
// Boolean isDoubleCollect = getBoolean("isDoubleCollect"); // 是否双采
// if (StringUtils.isEmpty(patientId)) {
// return Result.error(ResultEnum.PARAM_IS_DEFECT);
// }
//
// // 开申请单
// JsonResult JsonResult = new HisRecipeDao().payNat(patientId, isDoubleCollect);
// if (JsonResult.isTimeout()) { // 请求超时
// return Result.error(JsonResult.getMessage());
// }
//
// String mzNum = JsonResult.getDataMapString("MZNum");
// String recipeId = JsonResult.getDataMapString("RecipeId");
// if (ObjectUtils.isEmpty(recipeId) || ObjectUtils.isEmpty(mzNum)) {
// return Result.error(JsonResult.getMessage());
// }
//
// if (!JsonResult.success()) {
// return Result.error(ResultEnum.RECIPE_REPEAT_BILL, null, JsonResult.getMessage());
// }
//
// try {
// Map<String, Object> resultData = new HashMap<>();
// resultData.put("recipeId", Long.toString(Long.parseLong(recipeId) + 1000000000L));
// resultData.put("treatNum", mzNum);
// return Result.success(resultData);
// } catch (Exception e) {
// ErrorHelper.println(e);
// }
// return Result.error();
// }
}