|
|
|
|
package com.ynxbd.common.action.xk;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.ynxbd.common.action.base.BaseAction;
|
|
|
|
|
import com.ynxbd.common.bean.his.HisTreat;
|
|
|
|
|
import com.ynxbd.common.config.interceptor.AesDecode;
|
|
|
|
|
import com.ynxbd.common.dao.his.HisTreatDao;
|
|
|
|
|
import com.ynxbd.common.dao.his.HisXKDao;
|
|
|
|
|
import com.ynxbd.common.result.JsonResult;
|
|
|
|
|
import com.ynxbd.common.result.Result;
|
|
|
|
|
import com.ynxbd.common.result.ResultEnum;
|
|
|
|
|
import com.ynxbd.wx.wxfactory.AesWxHelper;
|
|
|
|
|
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.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Slf4j
|
|
|
|
|
@Namespace("/xk")
|
|
|
|
|
public class XKAction extends BaseAction {
|
|
|
|
|
|
|
|
|
|
@Action("getRxDict")
|
|
|
|
|
public Result getRxDict(String callNo, String type, String key, String yfCode) {
|
|
|
|
|
if (!"xbd2026".equals(callNo)) {
|
|
|
|
|
return Result.error(ResultEnum.PARAM_IS_INVALID);
|
|
|
|
|
}
|
|
|
|
|
log.info("[开方]字典查询 type={}, yfCode={}", type, yfCode);
|
|
|
|
|
if (type == null) {
|
|
|
|
|
return Result.error(ResultEnum.PARAM_IS_DEFECT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<?> dataList = new HisXKDao().queryHisRxDict(type, key, yfCode);
|
|
|
|
|
return Result.success(dataList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Action("createHisRx")
|
|
|
|
|
public Result createHisRx() {
|
|
|
|
|
try {
|
|
|
|
|
JSONObject body = getBody();
|
|
|
|
|
if (body == null) {
|
|
|
|
|
return Result.error(ResultEnum.PARAM_IS_DEFECT);
|
|
|
|
|
}
|
|
|
|
|
String doctCode = body.getString("doctCode");
|
|
|
|
|
String treatNum = body.getString("treatNum");
|
|
|
|
|
String rxDrugType = body.getString("rxDrugType"); // 处方药品类型
|
|
|
|
|
String rxTypeCode = body.getString("rxTypeCode");
|
|
|
|
|
String rxDiagnose = body.getString("rxDiagnose");
|
|
|
|
|
String weight = body.getString("weight");
|
|
|
|
|
String note = body.getString("note");
|
|
|
|
|
String ybAttrib = body.getString("ybAttrib");
|
|
|
|
|
String bzCode = body.getString("bzCode");
|
|
|
|
|
String bzName = body.getString("bzName");
|
|
|
|
|
String items = body.getString("items");
|
|
|
|
|
// 中药=============================================
|
|
|
|
|
String tcmTtName = body.getString("tcmTtName");
|
|
|
|
|
String tcmUseName = body.getString("tcmUseName");
|
|
|
|
|
String tcmCFCount = body.getString("tcmCFCount");
|
|
|
|
|
String tcmCFUseCount = body.getString("tcmCFUseCount");
|
|
|
|
|
String tcmUseCountForDay = body.getString("tcmUseCountForDay");
|
|
|
|
|
|
|
|
|
|
log.info("[处方开立]doctCode={}, treatNum={}, rxDrugType={}, weight={}, items={}", doctCode, treatNum, rxDrugType, weight, items);
|
|
|
|
|
if (ObjectUtils.isEmpty(doctCode) || ObjectUtils.isEmpty(treatNum) || ObjectUtils.isEmpty(rxDrugType) || ObjectUtils.isEmpty(weight) || ObjectUtils.isEmpty(items)) {
|
|
|
|
|
return Result.error(ResultEnum.PARAM_IS_DEFECT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
JsonResult resp = new HisXKDao().createHisRx(items, doctCode, treatNum, rxDrugType, rxTypeCode, rxDiagnose, weight, note, ybAttrib, bzCode, bzName,
|
|
|
|
|
tcmTtName, tcmUseName, tcmCFCount, tcmCFUseCount, tcmUseCountForDay);
|
|
|
|
|
if (!resp.success()) {
|
|
|
|
|
return Result.error(resp.getMessage());
|
|
|
|
|
}
|
|
|
|
|
String rxCode = resp.getDataMapString("CFNum");
|
|
|
|
|
String amount = resp.getDataMapString("Amount");
|
|
|
|
|
if (ObjectUtils.isEmpty(rxCode) || ObjectUtils.isEmpty(amount)) {
|
|
|
|
|
return Result.error("处方开立未返回处方号或金额");
|
|
|
|
|
}
|
|
|
|
|
Map<String, Object> data = new HashMap<>();
|
|
|
|
|
data.put("rxCode", rxCode);
|
|
|
|
|
data.put("enRxCode", AesWxHelper.encode(rxCode));
|
|
|
|
|
data.put("enAmount", AesWxHelper.encode(amount));
|
|
|
|
|
return Result.success(data);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
return Result.error(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Action("updateHisTreat")
|
|
|
|
|
public Result updateHisTreat(@AesDecode String openId, @AesDecode String treatNum, String symptom, String subjComplaint, String disDescription, String treatMeas,
|
|
|
|
|
String tcmDdCode, String tcmDdName, String tcmSdCode, String tcmSdName, String mdDisCode, String mdDisName,
|
|
|
|
|
String pastHist, String presentHist, String alleHist, String disCode1, String disName1, String disCode2, String disName2) {
|
|
|
|
|
try {
|
|
|
|
|
log.info("[HIS更新就诊记录] openId={}, treatNum={}, symptom={}, subjComplaint={}, disDescription={}, treatMeas={}, tcmDdCode={}, tcmDdName={}, tcmSdCode={}, tcmSdName={}, mdDisCode={}, mdDisName={}",
|
|
|
|
|
openId, treatNum, symptom, subjComplaint, disDescription, treatMeas, tcmDdCode, tcmDdName, tcmSdCode, tcmSdName, mdDisCode, mdDisName);
|
|
|
|
|
|
|
|
|
|
if (ObjectUtils.isEmpty(openId) || ObjectUtils.isEmpty(treatNum)) {
|
|
|
|
|
return Result.error(ResultEnum.PARAM_IS_INVALID);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ObjectUtils.isEmpty(subjComplaint) || ObjectUtils.isEmpty(disDescription) || ObjectUtils.isEmpty(treatMeas)) {
|
|
|
|
|
return Result.error(ResultEnum.PARAM_IS_DEFECT);
|
|
|
|
|
}
|
|
|
|
|
if (ObjectUtils.isEmpty(tcmDdCode) && ObjectUtils.isEmpty(mdDisCode)) {
|
|
|
|
|
return Result.error("请选择中医或西医诊断");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!ObjectUtils.isEmpty(tcmDdCode)) {
|
|
|
|
|
if (ObjectUtils.isEmpty(tcmSdName)) {
|
|
|
|
|
return Result.error("中医诊断名称[tcmSdName]缺失");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ObjectUtils.isEmpty(tcmSdCode) || ObjectUtils.isEmpty(tcmSdName)) {
|
|
|
|
|
return Result.error("中医证侯诊断[tcmSdCode]缺失");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!ObjectUtils.isEmpty(mdDisCode) && ObjectUtils.isEmpty(mdDisName)) {
|
|
|
|
|
return Result.error("西医诊断名称[mdDisName]缺失");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HisTreat data = new HisTreatDao().updateHisTreat(treatNum, symptom, subjComplaint, disDescription, treatMeas, tcmDdCode, tcmDdName, tcmSdCode, tcmSdName, mdDisCode, mdDisName, pastHist, presentHist, alleHist, disCode1, disName1, disCode2, disName2);
|
|
|
|
|
if (data == null) {
|
|
|
|
|
return Result.error();
|
|
|
|
|
}
|
|
|
|
|
return Result.success(data);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
return Result.error(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* [问诊]删除处方
|
|
|
|
|
*/
|
|
|
|
|
@Action("delRx")
|
|
|
|
|
public Result delRx(@AesDecode String treatNum, @AesDecode String rxCode, @AesDecode String doctCode) {
|
|
|
|
|
log.info("[问诊]删除处方 treatNum={}, rxCode={}, doctCode={}", treatNum, rxCode, doctCode);
|
|
|
|
|
try {
|
|
|
|
|
new HisXKDao().delRx(treatNum, rxCode, doctCode);
|
|
|
|
|
return Result.success();
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
return Result.error(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* [问诊]查询问诊挂号-咨询费用[未使用]
|
|
|
|
|
*
|
|
|
|
|
* @param code 收费项目代码
|
|
|
|
|
*/
|
|
|
|
|
@Action("queryOLRegConsultFee")
|
|
|
|
|
public Result queryOLRegConsultFee(String code) {
|
|
|
|
|
log.info("[问诊]查询问诊挂号-咨询费用");
|
|
|
|
|
try {
|
|
|
|
|
return Result.success(new HisTreatDao().queryOLRegConsultFee(code));
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
return Result.error(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* [问诊]查询问诊挂号-复诊费用
|
|
|
|
|
*
|
|
|
|
|
* @param code 号别
|
|
|
|
|
*/
|
|
|
|
|
@Action("queryOLRegRevisitFee")
|
|
|
|
|
public Result queryOLRegRevisitFee(String code) {
|
|
|
|
|
log.info("[问诊]查询问诊挂号-复诊费用");
|
|
|
|
|
try {
|
|
|
|
|
return Result.success(new HisTreatDao().queryOLRegRevisitFee(code));
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
return Result.error(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Action("notifyHisOLReg")
|
|
|
|
|
public Result createInquiry(String patientId, String patientName, String payMoney, String payDate, String payTime, String transNo, String payDeviceId, String bankTransNo, String deptCode, String doctCode, String feeCode, String payWay, String ID, String begTime, String endTime, String IDCardNo, String remark, String doctTitleCode, String hospitalArea, String treatNum, String firstTreatNum, String openId) {
|
|
|
|
|
// log.info("[互联网医院]问诊挂号缴费 patientId-{},patientName-{},payMoney-{},payDate-{},payTime-{},transNo-{},payDeviceId-{},bankTransNo-{},deptCode-{},doctCode-{},feeCode-{},payWay-{},ID-{},begTime-{},endTime-{},IDCardNo-{},remark-{},doctTitleCode-{},hospitalArea-{},treatNum-{},firstTreatNum-{},openId-{}", patientId, patientName, payMoney, payDate, payTime, transNo, payDeviceId, bankTransNo, deptCode, doctCode, feeCode, payWay, ID, begTime, endTime, IDCardNo, remark, doctTitleCode, hospitalArea, treatNum, firstTreatNum, openId);
|
|
|
|
|
// if (patientId == null || patientName == null || payMoney == null || payDate == null || payTime == null || transNo == null || deptCode == null || doctCode == null || feeCode == null || payWay == null || ID == null || begTime == null || endTime == null) {
|
|
|
|
|
// return Result.error(ResultEnum.PARAM_IS_DEFECT);
|
|
|
|
|
// }
|
|
|
|
|
// JsonResult result = new HisTreatDao().hisOLRegPay(patientId, patientName, payMoney, payDate, payTime, transNo, payDeviceId, bankTransNo, deptCode, doctCode, feeCode, payWay, ID, begTime, endTime, IDCardNo, remark, doctTitleCode, hospitalArea, treatNum, firstTreatNum, openId);
|
|
|
|
|
// if (!result.success()) {
|
|
|
|
|
// return Result.error(result.getMessage());
|
|
|
|
|
// }
|
|
|
|
|
// Map<String, String> response = new HashMap<>();
|
|
|
|
|
// response.put("invoiceTransNo", result.getDataMapString("InvoiceTransNo"));
|
|
|
|
|
// response.put("hisTransNo", result.getDataMapString("HISTransNo"));
|
|
|
|
|
// return Result.success(response);
|
|
|
|
|
return Result.success();
|
|
|
|
|
}
|
|
|
|
|
}
|