4 天以前 | zhaowenxuan | ![]() |
4 天以前 | zhaowenxuan | ![]() |
4 天以前 | zhaowenxuan | ![]() |
4 天以前 | zjh | ![]() |
ltkj-admin/src/main/java/com/ltkj/web/controller/dto/PutAskMedicalHistoryDto.java
New file @@ -0,0 +1,289 @@ package com.ltkj.web.controller.dto; import cn.hutool.json.JSONArray; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.ltkj.common.annotation.Excel; import com.ltkj.common.mybatis.JsonStringArrayTypeHandler; import com.ltkj.hosp.domain.TjAskHistorys; import com.ltkj.hosp.domain.TjAskWorkLog; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.List; /** * @Company: 西安路泰科技有限公司 * @Author: zhaowenxuan * @Date: 2025/5/9 09:41 */ @Data public class PutAskMedicalHistoryDto { /** * 接触危害因素 */ private String tcwhyx; /** * 用工单位 */ private String ygdw; /** * askId */ @TableId(type= IdType.AUTO) @JsonSerialize(using = ToStringSerializer.class) private Long askId; /** * 客户id */ @ApiModelProperty(value = "客户id") @JsonSerialize(using = ToStringSerializer.class) private Long cusId; /** * 身份证号 */ @ApiModelProperty(value = "客户身份证号") @TableField(exist = false) private String cusIdCard; @ApiModelProperty(value = "客户性别") @TableField(exist = false) private String cusSex; /** * order表 tj_category字段值 * 字典表键 dict_tjtype */ @ApiModelProperty(value = "客户体检类型") @TableField(exist = false) private String tjLx; /** * 客户名 */ @ApiModelProperty(value = "客户名") @Excel(name = "客户名") private String cusName; @ApiModelProperty(value = "体检号") @Excel(name = "体检号") private String tjNum; /** * 职业 */ @ApiModelProperty(value = "职业") @Excel(name = "职业") private String work; /** * 工作状态 */ @ApiModelProperty(value = "工作状态") @Excel(name = "工作状态",dictType="tj_work_status") private String workStatus; /** * 既往病史 */ @ApiModelProperty(value = "既往病史") @Excel(name = "既往病史") private JSONArray medicalHistory; /** * 初潮 */ @ApiModelProperty(value = "初潮") @Excel(name = "初潮") private String chuchao; /** * 经期 */ @ApiModelProperty(value = "经期") @Excel(name = "经期") private String jingqi; /** * 周期 */ @ApiModelProperty(value = "周期") @Excel(name = "周期") private String zhouqi; /** * 末次月经或停经年龄 */ @ApiModelProperty(value = "末次月经或停经年龄") @Excel(name = "末次月经或停经年龄") private String mociage; @ApiModelProperty(value = "月经是否异常") private String yjsfyc; /** * 现有子女 */ @ApiModelProperty(value = "现有子女") @Excel(name = "现有子女") private String zinv; /** * 流产 */ @ApiModelProperty(value = "流产") @Excel(name = "流产") private String liuchan; /** * 早产 */ @ApiModelProperty(value = "早产") @Excel(name = "早产") private String zaochan; /** * 死产 */ @ApiModelProperty(value = "死产") @Excel(name = "死产") private String sichan; /** * 异常胎 */ @ApiModelProperty(value = "异常胎") @Excel(name = "异常胎") private String yichangtai; /** * 吸烟 * 是否吸烟 */ @ApiModelProperty(value = "吸烟") @Excel(name = "吸烟") private String xiyan; /** * 吸烟频率 */ @ApiModelProperty(value = "吸烟频率") @Excel(name = "吸烟频率") private String xiyanpinlv; /** * 吸烟时间 */ @ApiModelProperty(value = "吸烟时间") @Excel(name = "吸烟时间") private String xiyanyear; /** * 饮酒 */ @ApiModelProperty(value = "饮酒") @Excel(name = "饮酒") private String yinjiu; /** * 饮酒频率 */ @ApiModelProperty(value = "饮酒频率") @Excel(name = "饮酒频率") private String yinjiupinlv; /** * 饮酒时间 */ @ApiModelProperty(value = "饮酒时间") @Excel(name = "饮酒时间") private String yinjiuyear; /** * 其他 */ @ApiModelProperty(value = "其他") @Excel(name = "其他") private String qita; /** * 来源标志 */ @ApiModelProperty(value = "来源标志") @Excel(name = "来源标志") private String fromBy; /** * 职业历史 */ @ApiModelProperty(value = "职业历史") @TableField(exist = false) private List<TjAskWorkLog> workLogs; /** * 接触毒物 */ @ApiModelProperty(value = "接触毒物") @Excel(name = "接触毒物") private String contactPoison; /** * 体检类别 */ @TableField(exist = false) private String tjCategory; @ApiModelProperty(value = "症状数据集") @TableField(typeHandler = JsonStringArrayTypeHandler.class) private String[] zzsjj; @ApiModelProperty(value = "工种") private String gongZhong; @ApiModelProperty(value = "工龄") private String gongLing; @ApiModelProperty(value = "接害工龄") private String jhgl; /** * 单位名称 */ private String dwmc; /** * 既往病史其他说明 */ private String medicalHistoryOther; private List<TjAskHistorys> zhiyezzList; /** * 病史信息 */ @ApiModelProperty(value = "病史信息") @TableField(exist = false) private List<TjAskHistorys> tjAskHistorysList; } /** * 职业病史 */ @Data class MedicalHistoryDto{ private String id; private String icdname; } ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjAskMedicalHistoryController.java
@@ -5,10 +5,14 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import cn.hutool.core.bean.BeanUtil; import cn.hutool.json.JSONArray; import cn.hutool.json.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.ltkj.framework.config.MatchUtils; import com.ltkj.hosp.domain.*; import com.ltkj.hosp.service.*; import com.ltkj.web.controller.dto.PutAskMedicalHistoryDto; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.val; @@ -191,11 +195,82 @@ /** * pc端修改问诊 */ // @ApiOperation(value = "pc端修改问诊") // @Log(title = "问诊", businessType = BusinessType.UPDATE) // @PutMapping // @Transactional // public AjaxResult edit(@RequestBody TjAskMedicalHistory tjAskMedicalHistory) { // LambdaQueryWrapper<TjAskWorkLog> wq = new LambdaQueryWrapper<>(); // wq.eq(TjAskWorkLog::getTjNumber, tjAskMedicalHistory.getTjNum()); // tjAskWorkLogService.remove(wq); // LambdaQueryWrapper<TjHarmTypeLog> wq1 = new LambdaQueryWrapper<>(); // wq1.eq(TjHarmTypeLog::getTjNumber, tjAskMedicalHistory.getTjNum()); // tjHarmTypeLogService.remove(wq1); // // // boolean b = false; // tjAskMedicalHistory.setFromBy("PC端"); // if (tjAskMedicalHistory.getAskId() != null) { // b = tjAskMedicalHistoryService.updateById(tjAskMedicalHistory); // } else { // b = tjAskMedicalHistoryService.save(tjAskMedicalHistory); // } // if (b) { // List<TjAskHistorys> tjAskHistorysList = tjAskMedicalHistory.getTjAskHistorysList(); // if (tjAskHistorysList != null && tjAskHistorysList.size() > 0) { // for (TjAskHistorys tjAskHistorys : tjAskMedicalHistory.getTjAskHistorysList()) { // tjAskHistorys.setAskId(tjAskMedicalHistory.getAskId()); // boolean b1 = historysService.saveOrUpdate(tjAskHistorys); // if (!b1) { // return AjaxResult.error(); // } // } // } // // List<TjAskWorkLog> askWorkLogs = tjAskMedicalHistory.getWorkLogs(); // if (askWorkLogs != null && askWorkLogs.size() > 0) { // for (TjAskWorkLog askWorkLog : askWorkLogs) { // askWorkLog.setCusId(tjAskMedicalHistory.getCusId()); // askWorkLog.setCusName(tjAskMedicalHistory.getCusName()); // askWorkLog.setTjNumber(tjAskMedicalHistory.getTjNum()); // askWorkLog.setAskId(tjAskMedicalHistory.getAskId()); // boolean b1 = tjAskWorkLogService.saveOrUpdate(askWorkLog); // List<String> harmTypeLogs = askWorkLog.getHarmTypeLogs(); // if (harmTypeLogs != null) { // for (String harmTypeLog : harmTypeLogs) { // final TjHarmType byId = tjHarmTypeService.getById(harmTypeLog); // if (byId != null) { // TjHarmTypeLog log = new TjHarmTypeLog(); // log.setAid(byId.getAid()); // log.setCusId(tjAskMedicalHistory.getCusId()); // log.setCusName(tjAskMedicalHistory.getCusName()); // log.setTjNumber(tjAskMedicalHistory.getTjNum()); // log.setWorkId(askWorkLog.getId()); // tjHarmTypeLogService.save(log); // } // } // } // if (!b1) { // return AjaxResult.error(); // } // } // } // return AjaxResult.success(tjAskMedicalHistory); // } // return AjaxResult.error(); // //return toAjax(tjAskMedicalHistoryService.updateTjAskMedicalHistory(tjAskMedicalHistory)); // } /** * pc端修改问诊 */ @ApiOperation(value = "pc端修改问诊") @Log(title = "问诊", businessType = BusinessType.UPDATE) @PutMapping @Transactional public AjaxResult edit(@RequestBody TjAskMedicalHistory tjAskMedicalHistory) { public AjaxResult edit(@RequestBody PutAskMedicalHistoryDto askMedicalHistoryDto) { TjAskMedicalHistory tjAskMedicalHistory = new TjAskMedicalHistory(); BeanUtil.copyProperties(askMedicalHistoryDto,tjAskMedicalHistory,true); LambdaQueryWrapper<TjAskWorkLog> wq = new LambdaQueryWrapper<>(); wq.eq(TjAskWorkLog::getTjNumber, tjAskMedicalHistory.getTjNum()); tjAskWorkLogService.remove(wq); @@ -206,6 +281,19 @@ boolean b = false; tjAskMedicalHistory.setFromBy("PC端"); JSONArray medicalHistory = askMedicalHistoryDto.getMedicalHistory(); String medicalHistoryTxt = medicalHistory.stream().map(item -> { JSONObject entries = (JSONObject) item; return entries.getStr("icdname"); }).collect(Collectors.joining(",")); String medicalHistoryIds = medicalHistory.stream().map(item -> { JSONObject entries = (JSONObject) item; return entries.getStr("id"); }).collect(Collectors.joining(",")); tjAskMedicalHistory.setMedicalHistoryIds(medicalHistoryIds); tjAskMedicalHistory.setMedicalHistory(medicalHistoryTxt); if (tjAskMedicalHistory.getAskId() != null) { b = tjAskMedicalHistoryService.updateById(tjAskMedicalHistory); } else { @@ -213,9 +301,22 @@ } if (b) { List<TjAskHistorys> tjAskHistorysList = tjAskMedicalHistory.getTjAskHistorysList(); if (tjAskHistorysList != null && tjAskHistorysList.size() > 0) { if (tjAskHistorysList != null && !tjAskHistorysList.isEmpty()) { for (TjAskHistorys tjAskHistorys : tjAskMedicalHistory.getTjAskHistorysList()) { tjAskHistorys.setAskId(tjAskMedicalHistory.getAskId()); tjAskHistorys.setDataType(1); boolean b1 = historysService.saveOrUpdate(tjAskHistorys); if (!b1) { return AjaxResult.error(); } } } List<TjAskHistorys> zhiyezzList = askMedicalHistoryDto.getZhiyezzList(); if (zhiyezzList != null && !zhiyezzList.isEmpty()) { for (TjAskHistorys tjAskHistorys : zhiyezzList) { tjAskHistorys.setAskId(tjAskMedicalHistory.getAskId()); tjAskHistorys.setDataType(2); boolean b1 = historysService.saveOrUpdate(tjAskHistorys); if (!b1) { return AjaxResult.error(); @@ -224,7 +325,7 @@ } List<TjAskWorkLog> askWorkLogs = tjAskMedicalHistory.getWorkLogs(); if (askWorkLogs != null && askWorkLogs.size() > 0) { if (askWorkLogs != null && !askWorkLogs.isEmpty()) { for (TjAskWorkLog askWorkLog : askWorkLogs) { askWorkLog.setCusId(tjAskMedicalHistory.getCusId()); askWorkLog.setCusName(tjAskMedicalHistory.getCusName()); @@ -254,9 +355,17 @@ return AjaxResult.success(tjAskMedicalHistory); } return AjaxResult.error(); //return toAjax(tjAskMedicalHistoryService.updateTjAskMedicalHistory(tjAskMedicalHistory)); } /** * 删除病史或症状 * @param historyId * @return */ @PostMapping("/removeAskHistorys") public AjaxResult removeAskHistorys(@RequestBody List<String > historyId){ return toAjax(historysService.removeByIds(historyId)); } /** * 小程序根据客户身份证号获取问诊详细信息 @@ -288,9 +397,20 @@ LambdaQueryWrapper<TjAskHistorys> wqq111 = new LambdaQueryWrapper<>(); wqq111.eq(TjAskHistorys::getAskId, one.getAskId()); final List<TjAskHistorys> list11 = historysService.list(wqq111); wqq111.eq(TjAskHistorys::getDataType,1); List<TjAskHistorys> list11 = historysService.list(wqq111); one.setTjAskHistorysList(list11); wqq111 = new LambdaQueryWrapper<>(); wqq111.eq(TjAskHistorys::getAskId, one.getAskId()); wqq111.eq(TjAskHistorys::getDataType,2); list11 = historysService.list(wqq111); one.setZhiyezzList(list11); TjOrder order = tjOrderService.getOrderByTjNum(tjNumber); one.setTjLx(order.getTjCategory()); return AjaxResult.success(one); }else { TjAskMedicalHistory a = new TjAskMedicalHistory(); ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjCheckController.java
@@ -25,6 +25,7 @@ import com.ltkj.hosp.mapper.TestMapper; import com.ltkj.hosp.service.*; import com.ltkj.hosp.sqlDomain.*; import com.ltkj.hosp.vo.ProFcListVo; import com.ltkj.hosp.vodomain.CsProVo; import com.ltkj.hosp.vodomain.UpdateOrderRemarkVo; import com.ltkj.mall.mallOrderUtils.TjConstants; @@ -1001,105 +1002,18 @@ @ApiParam(value = "体检单号") @RequestParam(required = false) String tjNumber, @ApiParam(value = "单位") @RequestParam(required = false) Long compId, @ApiParam(value = "姓名)") @RequestParam(required = false) String name, @ApiParam(value = "审核医生)") @RequestParam(required = false) String shys, @ApiParam(value = "开始时间") @RequestParam(required = false) String beginTime, @ApiParam(value = "结束时间") @RequestParam(required = false) String endTime) { // String config = configService.selectConfigByKey("tj_confirm"); // DateTime beginTimes = null; // DateTime endTimes = null; // if (null != beginTime && null != endTime) { // beginTimes = DateUtil.beginOfDay(DateUtil.parse(beginTime)); // endTimes = DateUtil.endOfDay(DateUtil.parse(endTime)); // } // asyncService.checkSetCustomerLisByRedis(config); // //初始化体检订单表 // List<TjOrder> orderList = null; // List<TjCustomer> customerList = new ArrayList<>(); // Map<String, Object> map = new HashMap<>(); // // //姓名查询 // if (null != name && !"".equals(name)) { // List<TjCustomer> list = customerService.getTjCustomerList(name); // if (null != list && list.size() > 0) { // List<TjCustomer> lists = new ArrayList<>(); // for (TjCustomer customer : list) { // if ("Y".equals(config)) { // orderList = orderService.getCsTjOrderListByCusId1(customer.getCusId()); // } else { // orderList = orderService.getTjOrderListByCusId(customer.getCusId()); // } // if (null != orderList && orderList.size() > 0) { // for (TjOrder tjOrder : orderList) { // customer.setTjNumber(tjOrder.getTjNumber()); // customer.setTjStatus(Long.valueOf(tjOrder.getCheckStatus())); // customer.setOrderId(tjOrder.getOrderId()); // customer.setTjTime(tjOrder.getFinishTime()); // customer.setFinishTime(tjOrder.getFinishTime()); // customer.setCusName(MatchUtils.hideCusName(customer.getCusName())); // customer.setCusPhone(MatchUtils.hidePhoneNum(customer.getCusPhone())); // customer.setCusIdcard(MatchUtils.hideIdCardNum(customer.getCusIdcard())); // customer.setConfirmStatus(String.valueOf(tjOrder.getStatus())); // customer.setTjCategory(tjOrder.getTjCategory()); // if (tjOrder.getFirmId().equals("0")) { // customer.setTjCompName(null); // } else { // customer.setTjCompName(compService.selectDictCompByDrugManufacturerId(tjOrder.getFirmId()).getCnName()); // } // lists.add(customer); // } // } // } // List<TjCustomer> customers = null; // if (lists.size() > 0) { // customers = lists.stream().skip((long) (page - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); // } // map.put("customers", customers); // map.put("total", lists.size()); // return AjaxResult.success(map); // } // return AjaxResult.success("暂无数据"); // } // // //条件查询 // if (null != tjNumber || null != compId || (null != beginTime && null != endTime)) { // //判断是否开启初审 // if ("Y".equals(config)) { // orderList = orderService.getCsTjOrderList1(tjNumber, checkStatus, compId, beginTimes, endTimes); // } else { // orderList = orderService.getTjOrderList(tjNumber, checkStatus, compId, beginTimes, endTimes); // } // return getResult(page, pageSize, orderList, customerList, map); // } // // List<TjCustomer> customers = null; // if (null != checkStatus && checkStatus == 0) { // customers = redisCache.getCacheMapValue("check", "ws"); // } // if (null != checkStatus && checkStatus == 1) { // customers = redisCache.getCacheMapValue("check", "ys"); // } // if (customers != null && customers.size() > 0) { //// asyncService.addRedis(customers); // List<TjCustomer> customerLists = customers.stream().skip((long) (page - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); // map.put("customers", customerLists); // map.put("total", customers.size()); // return AjaxResult.success(map); // } else { // //判断是否开启初审 // if ("Y".equals(config)) { // orderList = orderService.getCsTjOrderList1(tjNumber, checkStatus, compId, beginTimes, endTimes); // } else { // orderList = orderService.getTjOrderList(tjNumber, checkStatus, compId, beginTimes, endTimes); // } // return getResult(page, pageSize, orderList, customerList, map); // } String value = String.valueOf(compId); if (tjNumber == null) tjNumber = ""; if (compId == null) value = ""; if (name == null) name = ""; if (shys == null) shys = ""; if (beginTime == null) beginTime = ""; if (endTime == null) endTime = ""; return AjaxResult.success(orderService.getCunChuGuoChengCustomerList(tjNumber, page, pageSize, checkStatus, value, beginTime, endTime, name)); return AjaxResult.success(orderService.getCunChuGuoChengCustomerList(tjNumber, page, pageSize, checkStatus, value, beginTime, endTime, name,shys)); } @@ -1976,5 +1890,30 @@ return AjaxResult.success(); } /** * 查询复查项目列表 * @param tjNum 体检号 * @param type 复查状态 0未复查状态 1复查状态 * @return */ @GetMapping("/getFcList") public AjaxResult getFcList(@RequestParam("tjNum") String tjNum,@RequestParam("type") Integer type){ TjOrder order = orderService.getOrderByTjNum(tjNum); if (order == null) return AjaxResult.error(); List<ProFcListVo> list = detailService.getFcList(order.getOrderId(),type); return AjaxResult.success(list); } /** * 复查项目提交 * @param json * @return */ @PostMapping("/UpdFcPro") public AjaxResult updFcPro(@RequestBody String json) { return detailService.updFcPro(json); } } ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjCustomerController.java
@@ -36,6 +36,7 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.DigestUtils; @@ -59,6 +60,7 @@ @RestController @RequestMapping("/hosp/customer") @Api(tags = "客户管理接口") @Slf4j public class TjCustomerController extends BaseController { @Resource private ITjCustomerService tjCustomerService; @@ -723,6 +725,75 @@ return AjaxResult.error(); } @Log(title = "注册客户信息", businessType = BusinessType.UPDATE) @PostMapping(value = "/zhuceTjCustomer") @ApiOperation(value = "修改客户信息") @Transactional @RepeatSubmit public AjaxResult zhuceTjCustomer(@RequestBody @ApiParam(value = "客户对象") TjCustomer tjCustomer) { try { TjCustomer customer = tjCustomerService.getById(tjCustomer.getCusId()); if(null==customer){ return AjaxResult.error("该人员不存在!"); } if(!customer.getPationId().equals("0")){ return AjaxResult.error("该人员已经注册!"); } String config = sysConfigService.selectConfigByKey("sfkqdyhis"); if (null != config && config.equals("Y")) { AjaxResult result = controller.Outpincreateapply(customer); String result1 = getAjaxResult(result); JSONObject object = getJSONObject(result1); String code = object.getStr("ResultCode"); if (code.equals("0")) { JSONArray resultDatass = object.getJSONArray("ResultData"); Map<String, Object> resultData = (Map<String, Object>) resultDatass.get(0); if (null != resultData && !resultData.isEmpty()) { String pationid = resultData.get("PationId").toString(); if (null != pationid) { customer.setPationId(pationid); //保存注册入参出参 resultData.put("cardId",pationid); JSONObject object4 = JSONUtil.parseObj(resultData); LambdaQueryWrapper<HisApiConfig> lambdaQueryWrapper = new LambdaQueryWrapper<>(); lambdaQueryWrapper.eq(HisApiConfig::getApiMethod, "Outpincreateapply"); HisApiConfig hisApiConfig = hisApiConfigService.getOne(lambdaQueryWrapper); hisApiGetMethodService.save(object4, "Outpincreateapply", hisApiConfig, JSONUtil.toJsonStr(BeanUtil.beanToMap(tjCustomer))); } } if (tjCustomerService.updateById(customer)) { return AjaxResult.success("注册成功"); } }else{ return AjaxResult.error("注册失败"); } } String s = sysConfigService.selectConfigByKey("is_request_common_his_api"); if (null != s && s.equals("Y")){ TjCustomer requestCommonHisApi = isRequestCommonHisApi(customer); if (null !=requestCommonHisApi){ if (tjCustomerService.updateById(customer)) { return AjaxResult.success("注册成功"); } }else { return AjaxResult.error("注册失败"); } } return AjaxResult.error("请先连接his服务"); } catch (Exception e) { log.error(e.toString()); throw new RuntimeException(e); } } /** * 删除客户信息 */ ltkj-admin/src/main/java/com/ltkj/web/controller/system/ZhiYeController.java
New file @@ -0,0 +1,653 @@ package com.ltkj.web.controller.system; import cn.hutool.core.codec.Base64; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.extra.pinyin.PinyinUtil; import cn.hutool.json.JSONArray; import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.ltkj.common.core.domain.AjaxResult; import com.ltkj.common.core.domain.entity.SysDept; import com.ltkj.common.core.domain.entity.SysUser; import com.ltkj.common.utils.SecurityUtils; import com.ltkj.hosp.domain.*; import com.ltkj.hosp.idutil.IdUtils; import com.ltkj.hosp.mapper.TjSamplingMapper; import com.ltkj.hosp.service.*; import com.ltkj.hosp.sqlDomain.LtkjMiddleHead; import com.ltkj.mall.domain.MallCheckLog; import com.ltkj.mall.domain.MallOrder; import com.ltkj.mall.mallOrderUtils.TjConstants; import com.ltkj.mall.service.IMallCheckLogService; import com.ltkj.mall.service.IMallOrderService; import com.ltkj.system.service.ISysConfigService; import com.ltkj.system.service.ISysDeptService; import com.ltkj.system.service.ISysDictDataService; import com.ltkj.system.service.ISysUserService; import com.ltkj.web.controller.his.HisApiMethod; import com.ltkj.web.controller.his.HisApiMethodService; import com.ltkj.web.controller.lis.LisApiMethod; import com.ltkj.web.wxUtils.HttpClientUtils; import io.swagger.annotations.ApiOperation; import jodd.util.StringUtil; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.NoTransactionException; import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.interceptor.TransactionAspectSupport; import org.springframework.web.bind.annotation.*; import java.io.File; import java.io.FileInputStream; import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.ReentrantLock; /** * @Company: 西安路泰科技有限公司 * @Author: zhaowenxuan * @Date: 2025/5/12 14:37 */ @Slf4j @RestController @RequestMapping("/zhiye/order") public class ZhiYeController { @Autowired private ISysUserService userService; @Autowired private ITjCustomerService tjCustomerService; @Autowired private ITjReservationService tjReservationService; @Autowired private IMallOrderService mallOrderService; @Autowired private ITjDwGroupingService dwGroupingService; @Autowired private ITbTransitionService transitionService; @Autowired private ITjOrderService tjOrderService; @Autowired private ISysConfigService configService; @Autowired private IdUtils idUtils; @Autowired private ITjReportGetAddressService tjReportGetAddressService; @Autowired private LtkjMiddleHeadService headService; @Autowired private IMallCheckLogService mallCheckLogService; @Autowired private ITjFlowingWaterService tjFlowingWaterService; @Autowired private HisApiMethodService controller; @Autowired private HisApiMethod hisApiMethod; @Autowired private LisApiMethod lisApiMethod; @Autowired private ITjAskMedicalHistoryService tjAskMedicalHistoryService; @Autowired private ITjOrderDetailService tjOrderDetailService; @Autowired private ITjOrderRemarkService remarkService; @Autowired private ITjXdPictureService xdPictureService; @Autowired private ITjSamplingService samplingService; @Autowired private ITjProjectService projectService; @Autowired private ISysDictDataService sysDictDataService; @Autowired private LisJyflhbService lisJyflhbService; @Autowired private TjSamplingMapper tjSamplingMapper; @Autowired private ITbTransitionService tbTransitionService; @Autowired private ISysDeptService sysDeptService; @Autowired private TjFlowingWaterHisService tjFlowingWaterHisService; ReentrantLock lock = new ReentrantLock(); @PostMapping @ApiOperation(value = "体检签到登记接口") @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED) public AjaxResult addOrderAndDetail(@RequestBody TjOrder tjOrder) throws Exception { Long userId = Long.valueOf(SecurityUtils.getLoginUser().getUserId()); SysUser sysUser = userService.getById(userId); LambdaQueryWrapper<TjCustomer> wq = new LambdaQueryWrapper<>(); wq.eq(TjCustomer::getCusId, tjOrder.getUserId()); TjCustomer tjCustomer = tjCustomerService.getOne(wq); if (tjCustomer == null) return AjaxResult.error("该客户未登记"); TjFlowingWater tjFlowingWater = new TjFlowingWater(); LambdaQueryWrapper<TjReservation> wq1 = new LambdaQueryWrapper<>(); wq1.eq(TjReservation::getIdCard, tjCustomer.getCusIdcard()); wq1.eq(TjReservation::getIsExpire, 2); TjReservation tjReservation = tjReservationService.getOne(wq1); MallOrder mallOrder = null; if (null != tjReservation) { tjOrder.setReservationId(tjReservation.getId()); mallOrder = mallOrderService.getOne(new LambdaQueryWrapper<MallOrder>().eq(MallOrder::getReservationId, tjReservation.getId())); if (DateUtil.endOfDay(DateUtil.offsetDay(tjReservation.getReservationTime(), tjReservation.getYxts())).before(new Date())) { tjReservation.setIsExpire(1); tjReservationService.updateById(tjReservation); return AjaxResult.error("对不起您的预约已超时请重新预约"); } if (null != tjReservation.getTeamNo()) tjOrder.setTeamNo(tjReservation.getTeamNo()); if (null != tjReservation.getCompanyId()) tjOrder.setFirmId(tjReservation.getCompanyId()); if (null != tjReservation.getCompany()) tjOrder.setFirmName(tjReservation.getCompany()); if (null != tjReservation.getDepartment()) tjOrder.setFirmDeptName(tjReservation.getDepartment()); if (null != tjReservation.getJobNo()) tjOrder.setFirmWorkId(tjReservation.getJobNo()); if (null != tjReservation.getPacId()) tjOrder.setPacId(tjReservation.getPacId()); if (null != tjReservation.getTjCategory()) tjOrder.setTjCategory(tjReservation.getTjCategory()); if (null != tjReservation.getGroupingId()) { TjDwGrouping dwGrouping = dwGroupingService.getById(tjReservation.getGroupingId()); tjOrder.setGroupId(tjReservation.getGroupingId()); tjOrder.setFirmDeptId(dwGrouping.getDwDeptId()); } tjReservation.setIsExpire(1); tjReservationService.updateById(tjReservation); if (null != tjReservation.getTeamNo() && tjOrder.getTjType().equals("1")) { tjOrder.setTjType("1"); } else if (tjOrder.getTjType().equals("2")) { tjOrder.setTjType("2"); } } if (StringUtil.isBlank(tjOrder.getFirmId())) { tjOrder.setFirmId("0"); } if (null != tjOrder.getPhoto()) { File file = new File(tjOrder.getPhoto()); if (file.isFile()) { FileInputStream fileInputStream = new FileInputStream(file); byte[] bytes = new byte[fileInputStream.available()]; fileInputStream.read(bytes); // 读取到 byte 里面 fileInputStream.close(); // 得到文件 之后转成beye 然后使用base64转码 String encode = Base64.encode(bytes); tjOrder.setPhoto(encode); } } if (null == tjOrder.getPacId() && null != transitionService.getTbTransitionPacIdByCusIdAndPac(String.valueOf(tjOrder.getUserId()))) { tjOrder.setPacId(transitionService.getTbTransitionPacIdByCusIdAndPac(String.valueOf(tjOrder.getUserId()))); } //判断小程序上预约是否付钱 if (null != mallOrder) tjOrder.setMallOrderId(String.valueOf(mallOrder.getId())); tjOrder.setStatus(TjConstants.TJ_BEGIN); tjOrder.setCardId(tjCustomer.getCardId()); if (null != tjOrder.getTjCategory() && tjOrder.getTjCategory().equals("13")) { tjOrder.setFinishTime(new Date()); tjOrder.setCheckStatus(1); tjOrder.setStatus(TjConstants.TJ_WAIT); // tjFlowingWater.setPayStasus(1L); } tjFlowingWater.setPayStasus(0L); try { boolean b = lock.tryLock(3, TimeUnit.MINUTES); if (b) { AjaxResult result = processOrderWithTransaction(tjOrder, tjCustomer, tjReservation, tjFlowingWater, mallOrder, sysUser); if (!result.get("code").toString().equals("200")) TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); tjOrderService.tjQiandaodengji(tjOrder.getTjNumber()); return result; } }catch (Exception e){ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); log.error(String.valueOf(e),e.getMessage()); e.printStackTrace(); } finally { lock.unlock(); } return AjaxResult.error(); } @Transactional(propagation = Propagation.REQUIRED) public AjaxResult processOrderWithTransaction(TjOrder tjOrder, TjCustomer tjCustomer, TjReservation tjReservation, TjFlowingWater tjFlowingWater, MallOrder mallOrder, SysUser sysUser) { //获取拼接前缀 String makeLisTmhPrefix = configService.selectConfigByKey("make_lis_tmh_prefix"); String tjNumber = null; int a =0; while (tjNumber ==null){ if(a>3){ throw new RuntimeException("前方拥挤,请稍等!!!"); } try { String newTjNumberRedisLockAndMysql = idUtils.getNewTjNumberRedisLockAndMysql(); if (StringUtil.isNotBlank(makeLisTmhPrefix)){ String tjh= makeLisTmhPrefix + newTjNumberRedisLockAndMysql; int countByTjNum = tjOrderService.getOrderCountByTjNum(tjh); if(countByTjNum==0){ tjNumber=tjh; } }else { int countByTjNum = tjOrderService.getOrderCountByTjNum(newTjNumberRedisLockAndMysql); if(countByTjNum==0){ tjNumber=newTjNumberRedisLockAndMysql; } } } catch (Exception e) { log.error(e.getMessage()); throw new IllegalStateException(); }finally { a++; } } tjOrder.setTjNumber(tjNumber); BigDecimal discount = BigDecimal.valueOf(Double.parseDouble(tjOrder.getTjFlowingWater().getDiscount())); tjOrder.setDiscount(discount.toString()); if (tjOrderService.save(tjOrder)) { //保存收货地址 if ("2".equals(tjOrder.getGetType())) { final TjReportGetAddress address = tjOrder.getAddAddress(); if (address != null) { address.setTjNumber(tjNumber); tjReportGetAddressService.save(address); } } Long cusNumber = tjCustomer.getCusNumber(); cusNumber += 1; tjCustomer.setCusNumber(cusNumber); if ("1".equals(tjOrder.getTjType())) { if (null != tjReservation && tjReservation.getPayType() == 1) { tjFlowingWater.setPayStasus(3L); } } //调用SQL server拿取收费情况 //根据配置调取存储过程 将临时表数据存入预约表2023.12.12 final String getInfoFromSqlData = configService.selectConfigByKey("getInfoFromSqlData"); final String isPay = configService.selectConfigByKey("isPay"); if ("Y".equals(getInfoFromSqlData)) { LtkjMiddleHead middleHead = headService.getMiddleHeadByPartId(tjCustomer.getCardId()); if (null != middleHead) { tjFlowingWater.setPayStasus(1L); } } tjFlowingWater.setOrderId(tjOrder.getOrderId()); Date date1 = new Date(System.currentTimeMillis()); String s1 = SecurityUtils.getUsername() + new SimpleDateFormat("yyMMddHHmmssSSS").format(date1); tjFlowingWater.setWaterId(PinyinUtil.getFirstLetter(tjCustomer.getCusName(), "").toUpperCase() + s1); BigDecimal copeWith = tjOrder.getTjFlowingWater().getCopeWith(); BigDecimal paidIn = tjOrder.getTjFlowingWater().getPaidIn(); tjFlowingWater.setCopeWith(copeWith); tjFlowingWater.setPaidIn(paidIn); tjFlowingWater.setDiscount(discount.toString()); BigDecimal subtract = paidIn.subtract(copeWith.multiply(discount.divide(BigDecimal.valueOf(10)))); log.info("签到登记体检人: " + tjOrder.getTjNumber() + " 应付: " + copeWith); log.info("签到登记体检人: " + tjOrder.getTjNumber() + " 折扣: " + discount); log.info("签到登记体检人: " + tjOrder.getTjNumber() + " 实付: " + paidIn); log.info("签到登记体检人: " + tjOrder.getTjNumber() + " 相差: " + subtract); if (isPay.equals("true")) { if (null != mallOrder) { if (mallOrder.getOrderStatus().equals(201L)) { tjFlowingWater.setCopeWith(mallOrder.getActualPrice()); tjFlowingWater.setPaidIn(mallOrder.getActualPrice()); tjFlowingWater.setDiscount(String.valueOf(1)); tjFlowingWater.setPayStasus(1L); tjFlowingWater.setPayType(3L); MallCheckLog checkLog = new MallCheckLog(); checkLog.setCheckBy(sysUser.getNickName()); checkLog.setUserId(mallOrder.getUserId()); checkLog.setConsignee(mallOrder.getConsignee()); checkLog.setIdCard(mallOrder.getIdCard()); checkLog.setOrderId(String.valueOf(mallOrder.getId())); checkLog.setOrderSn(mallOrder.getOrderSn()); checkLog.setCheckTime(new Date()); checkLog.setShipSn("HX" + s1); mallCheckLogService.save(checkLog); mallOrder.setOrderStatus(301L); mallOrderService.updateById(mallOrder); } } else { tjFlowingWater.setCopeWith(tjOrder.getTjFlowingWater().getCopeWith()); tjFlowingWater.setPaidIn(tjOrder.getTjFlowingWater().getPaidIn()); tjFlowingWater.setDiscount(tjOrder.getTjFlowingWater().getDiscount()); // tjFlowingWater.setPayStasus(0L); } } //修改临时表体检号 transitionService.updateTbTransitionTjNumByCusId(tjCustomer.getCusIdcard(), tjOrder.getTjNumber()); if (tjFlowingWaterService.save(tjFlowingWater)) { tjOrder.setTjSerialNumber(String.valueOf(tjFlowingWater.getTjSerialNumber())); tjOrderService.updateById(tjOrder); } /*调用his接口*/ String config = configService.selectConfigByKey("sfkqdyhis"); if (null != config && config.equals("Y")) { AjaxResult result = null; try { result = hisApiMethod.HisApiMethods(tjCustomer, tjOrder); if (!result.get("code").toString().equals("200")) { TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); Object jzh = result.get("jzh"); if (null != jzh && null != jzh.toString()) { hisApiMethod.ZfHisApiMethod(jzh.toString()); } log.info("该登记人挂号失败, 就诊号为: " + tjOrder.getCardId()); return AjaxResult.error("挂号失败!" + result.get("msg").toString()); } } catch (NoTransactionException e) { log.error(e.getMessage()); throw new RuntimeException(e); } log.info("该登记人的his就诊号是: " + tjOrder.getCardId()); // 查询 对接Lis、Pacs申请如果类型包含在配置内则使用对接lis、pacs try { if (lisApiMethod.isUseLisAndPacsRegister(tjOrder)) { // 这是上面个人方法引入数据 tjFlowingWater.setPayStasus(1L); newSaveextracted(tjOrder, tjCustomer, discount, sysUser, tjReservation, tjFlowingWater); AjaxResult ajaxResult = hisApiMethod.tijianshenqing(tjCustomer, DateUtil.format(date1, "yyyy-MM-dd HH:mm:ss"), tjOrder, sysUser, result); if (!ajaxResult.get("code").toString().equals("200")) return ajaxResult; tjOrderDetailService.updateTjOrderDetailsByOrderId(String.valueOf(tjOrder.getOrderId()), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), String.valueOf(tjFlowingWater.getTjSerialNumber())); remarkService.updateTjOrderRemarkSfbzByJxbzisnull(tjOrder.getOrderId().toString(), tjFlowingWater.getTjSerialNumber().toString()); List<TjXdPicture> xdPictureList = xdPictureService.saveTjXdPicture(tjOrder.getTjNumber()); xdPictureService.saveBatch(xdPictureList); } else { newSaveextracted(tjOrder, tjCustomer, discount, sysUser, tjReservation, tjFlowingWater); List<TjOrderDetail> detailList = tjOrderDetailService.getCaiYangDengJi(tjOrder.getOrderId()); addCaiYangDengJi(detailList, !detailList.isEmpty(), tjOrder, sysUser, null); hisApiMethod.tijianshenqing(tjCustomer, DateUtil.format(date1, "yyyy-MM-dd HH:mm:ss"), tjOrder.getCardId()); } return AjaxResult.success(tjNumber); } catch (Exception e) { log.error(e.getMessage()); throw new RuntimeException(e); } } else { tjCustomer.setCardId(tjOrder.getTjNumber()); tjCustomerService.updateById(tjCustomer); transitionService.updateCardIdByTjNumAndIdCard(tjCustomer.getCusIdcard(), tjOrder.getTjNumber(), tjOrder.getTjNumber()); tjOrder.setCardId(tjOrder.getTjNumber()); tjOrderService.updateById(tjOrder); } String drrysfsf = configService.selectConfigByKey("drrysfsf"); try { if (lisApiMethod.isUseLisAndPacsRegister(tjOrder)) { if(StringUtil.isNotBlank(drrysfsf) && drrysfsf.equalsIgnoreCase("Y")){ if(null != tjReservation){ return isUseLisAndPacsRegister(tjOrder, tjCustomer, tjReservation, tjFlowingWater, sysUser, discount, tjNumber); }else { newSaveextracted(tjOrder, tjCustomer, discount, sysUser, tjReservation, tjFlowingWater); AjaxResult error = isRequestCommonHisApi(tjOrder, tjCustomer, tjFlowingWater); if (error != null) return error; return AjaxResult.success(tjNumber); } } return isUseLisAndPacsRegister(tjOrder, tjCustomer, tjReservation, tjFlowingWater, sysUser, discount, tjNumber); } else { newSaveextracted(tjOrder, tjCustomer, discount, sysUser, tjReservation, tjFlowingWater); AjaxResult error = isRequestCommonHisApi(tjOrder, tjCustomer, tjFlowingWater); if (error != null) return error; } } catch (Exception e) { log.error(e.getMessage()); throw new RuntimeException(e); } return AjaxResult.success(tjNumber); } TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); return AjaxResult.error(); } public void newSaveextracted(TjOrder tjOrder, TjCustomer tjCustomer, BigDecimal discount, SysUser sysUser, TjReservation tjReservation, TjFlowingWater tjFlowingWater) { try { tjAskMedicalHistoryService.updateTjAskMedicalHistoryByCusId(tjOrder.getTjNumber(), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), String.valueOf(tjCustomer.getCusId())); if (null != tjOrder.getTjCategory() && tjOrder.getTjCategory().equals("13")) { tjOrderDetailService.saveJSYTjOrderDetailsByCusId(tjCustomer.getCusIdcard(), String.valueOf(tjOrder.getOrderId()), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), tjOrder.getCardId(), String.valueOf(tjFlowingWater.getTjSerialNumber())); } else { tjOrderDetailService.saveTjOrderDetailsByCusId(tjCustomer.getCusIdcard(), String.valueOf(tjOrder.getOrderId()), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), tjOrder.getCardId()); } tjOrderDetailService.saveTjPureToneTesByCusId(tjCustomer.getCusIdcard(), tjOrder.getTjNumber(), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), tjOrder.getCardId()); //添加remark表数据 if (null != tjOrder.getTjCategory() && tjOrder.getTjCategory().equals("13")) { remarkService.saveJSYTjOrderRemarkByOrderId(tjOrder.getTjNumber(), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), String.valueOf(tjOrder.getOrderId())); } else { remarkService.saveTjOrderRemarkByOrderId(tjOrder.getTjNumber(), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), String.valueOf(tjOrder.getOrderId())); } //判断是否交钱 if ("1".equals(tjOrder.getTjType())) { if (null != tjReservation && tjReservation.getPayType() == 1) { tjOrderDetailService.updateTjOrderDetailsByOrderId(String.valueOf(tjOrder.getOrderId()), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), String.valueOf(tjFlowingWater.getTjSerialNumber())); remarkService.updateTjOrderRemarkSfbzByJxbzisnull(tjOrder.getOrderId().toString(), tjFlowingWater.getTjSerialNumber().toString()); List<TjXdPicture> xdPictureList = xdPictureService.saveTjXdPicture(tjOrder.getTjNumber()); xdPictureService.saveBatch(xdPictureList); } } if (tjFlowingWater.getPayStasus() == 1L) { tjOrderDetailService.updateTjOrderDetailsByOrderId(String.valueOf(tjOrder.getOrderId()), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), String.valueOf(tjFlowingWater.getTjSerialNumber())); tjFlowingWater.setPaidIn(tjOrder.getTjFlowingWater().getPaidIn()); tjFlowingWater.setCopeWith(tjOrder.getTjFlowingWater().getCopeWith()); tjFlowingWater.setPayType(4L); tjFlowingWaterService.updateById(tjFlowingWater); remarkService.updateTjOrderRemarkSfbzByJxbzisnull(tjOrder.getOrderId().toString(), tjFlowingWater.getTjSerialNumber().toString()); // asyncService.addTjChargingStandard(tjOrder, transitionService.getTbTransitionListByCusId(tjCustomer.getCusIdcard(), tjOrder.getCardId()), sysUser); List<TjXdPicture> xdPictureList = xdPictureService.saveTjXdPicture(tjOrder.getTjNumber()); xdPictureService.saveBatch(xdPictureList); } } catch (Exception e) { log.error(e.getMessage()); throw new RuntimeException(e); } } public void addCaiYangDengJi(List<TjOrderDetail> detailList, boolean detailList1, TjOrder order, SysUser sysUser, String jxbz) { String lis_tmh_prefix = configService.selectConfigByKey("make_lis_tmh_prefix"); String config = configService.selectConfigByKey("sfkqdyhis"); Boolean lisAndPacsRegister = lisApiMethod.isUseLisAndPacsRegister(order); if (null != detailList && detailList1) { Date date = new Date(); String format = DateUtil.format(date, "yyMMddHHmmssSSS"); for (TjOrderDetail detail : detailList) { int i = samplingService.isExistProId(order.getTjNumber(), String.valueOf(detail.getProId())); if(i>0) continue; TjSampling sampling = new TjSampling(); if (null == projectService.getById(detail.getProId())) continue; TjProject project = projectService.getById(detail.getProId()); Long proParentId = project.getProParentId(); String dictLabel = sysDictDataService.selectDictLabel("sys_dict_specimen", project.getSpecimenType()); if (null != proParentId && proParentId == 0) { sampling.setJyxh(idUtils.generateLisID(lis_tmh_prefix)); sampling.setSpecimenTypeCode(project.getSpecimenType()); sampling.setSpecimenType(dictLabel); if (config.equals("Y") && lisAndPacsRegister) sampling.setJyxmdm(project.getLisXmbm()); else sampling.setJyxmdm(project.getProId().toString()); } else { TjProject project1 = projectService.getById(proParentId); sampling.setJyxh(idUtils.generateLisID(lis_tmh_prefix)); sampling.setSpecimenTypeCode(project1.getSpecimenType()); sampling.setSpecimenType(dictLabel); if (config.equals("Y") && lisAndPacsRegister) sampling.setJyxmdm(project1.getLisXmbm()); else sampling.setJyxmdm(project1.getProId().toString()); } sampling.setSamplingNumber(format); sampling.setTjNum(order.getTjNumber()); sampling.setCusId(String.valueOf(order.getUserId())); if (tjCustomerService.getById(String.valueOf(order.getUserId())) != null) { sampling.setCusName(tjCustomerService.getById(String.valueOf(order.getUserId())).getCusName()); } sampling.setApplicationTime(date); sampling.setTjTime(order.getCreateTime()); sampling.setProId(String.valueOf(detail.getProId())); sampling.setProName(projectService.getById(detail.getProId()).getProName()); sampling.setCreateBy(sysUser.getNickName()); sampling.setCreateTime(date); sampling.setUpdateBy(sysUser.getNickName()); sampling.setUpdateTime(date); sampling.setCreateId(String.valueOf(sysUser.getUserId())); sampling.setUpdateId(String.valueOf(sysUser.getUserId())); sampling.setJxbz(jxbz); samplingService.save(sampling); } } if (lisApiMethod.isUseLisAndPacsRegister(order) && (null != config && config.equals("Y"))) { AjaxResult ajaxResult = lisApiMethod.getJyFlHb(); if (ajaxResult.get("code").toString().equals("200")) { String str = ajaxResult.get("data").toString(); str = str.replace("=", ":"); JSONArray array = JSONUtil.parseArray(str); for (Object o : array) { JSONObject object = (JSONObject) o; LisJyflhb lisJyflhb = new LisJyflhb(); lisJyflhb.setHbhxm(object.getStr("hbhxm")); lisJyflhb.setFlmc(object.getStr("flmc")); lisJyflhb.setMc(object.getStr("mc")); lisJyflhb.setFlbm(object.getStr("flbm")); LambdaQueryWrapper<LisJyflhb> wrapper = new LambdaQueryWrapper<>(); wrapper.eq(LisJyflhb::getFlbm, lisJyflhb.getFlbm()); LisJyflhb jyflhb = lisJyflhbService.getOne(wrapper); if (jyflhb == null) { lisJyflhb.setId(IdUtil.getSnowflake().nextId()); lisJyflhbService.save(lisJyflhb); } else { lisJyflhb.setId(jyflhb.getId()); lisJyflhbService.updateById(lisJyflhb); } } } } if (StrUtil.isNotBlank(jxbz)) { tjSamplingMapper.updateUserIdByTjNumAndJxbz(order.getTjNumber(), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), jxbz); } else { tjSamplingMapper.updateUserIdByTjNum(order.getTjNumber(), sysUser.getNickName(), String.valueOf(sysUser.getUserId())); } } private AjaxResult isUseLisAndPacsRegister(TjOrder tjOrder, TjCustomer tjCustomer, TjReservation tjReservation, TjFlowingWater tjFlowingWater, SysUser sysUser, BigDecimal discount, String tjNumber) { try { log.info("签到登记进入未收费方法"); // 这是上面个人方法引入数据 tjFlowingWater.setPayStasus(1L); newSaveextracted(tjOrder, tjCustomer, discount, sysUser, tjReservation, tjFlowingWater); tjOrderDetailService.updateTjOrderDetailsByOrderId(String.valueOf(tjOrder.getOrderId()), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), String.valueOf(tjFlowingWater.getTjSerialNumber())); remarkService.updateTjOrderRemarkSfbzByJxbzisnull(tjOrder.getOrderId().toString(), tjFlowingWater.getTjSerialNumber().toString()); List<TjXdPicture> xdPictureList = xdPictureService.saveTjXdPicture(tjOrder.getTjNumber()); xdPictureService.saveBatch(xdPictureList); List<TjOrderDetail> detailList = tjOrderDetailService.getCaiYangDengJi(tjOrder.getOrderId()); log.info("签到登记:采样数据查询个数"+detailList.size()); addCaiYangDengJi(detailList, !detailList.isEmpty(), tjOrder, sysUser, null); return AjaxResult.success(tjNumber); } catch (Exception e) { log.error(e.getMessage()); throw new RuntimeException(e); } } private AjaxResult isRequestCommonHisApi(TjOrder tjOrder, TjCustomer tjCustomer, TjFlowingWater tjFlowingWater) { String s = configService.selectConfigByKey("is_request_common_his_api"); if (null != s && s.equals("Y")) { String apiUrl = configService.selectConfigByKey("common_api_url"); String hospbm = configService.selectConfigByKey("common_api_service_hospbm"); HashMap<String, Object> map = new HashMap<>(); map.put("pationId", tjCustomer.getPationId()); map.put("cardId", tjCustomer.getHisJzkh()); map.put("tjNum", tjFlowingWater.getTjSerialNumber()); map.put("kaiDanKs", "7805"); // 收费标志 1待售费 2待退费 map.put("shouTuiStatus", "1"); JSONArray array = JSONUtil.createArray(); LambdaQueryWrapper<TbTransition> wrapper = new LambdaQueryWrapper<>(); wrapper.eq(TbTransition::getTjNum, tjOrder.getTjNumber()); wrapper.eq(TbTransition::getCusId, tjCustomer.getCusIdcard()); wrapper.eq(TbTransition::getCardId, tjCustomer.getCardId()); wrapper.isNotNull(TbTransition::getNowPrice); wrapper.gt(TbTransition::getNowPrice, 0); List<TbTransition> list = tbTransitionService.list(wrapper); BigDecimal zongjia = new BigDecimal("0.0"); for (TbTransition transition : list) { LambdaQueryWrapper<TjProject> wrapper1 = new LambdaQueryWrapper<>(); wrapper1.eq(TjProject::getProId, transition.getProId()); TjProject project = projectService.getOne(wrapper1); LambdaQueryWrapper<SysDept> wrapper2 = new LambdaQueryWrapper<>(); wrapper2.eq(SysDept::getDeptId, project.getDeptId()); SysDept dept = sysDeptService.getOne(wrapper2); JSONObject obj = JSONUtil.createObj(); // Integer sl = project.getSl(); int sl = 1; BigDecimal danjia = transition.getNowPrice(); BigDecimal allPrice = danjia.multiply(new BigDecimal(sl)); obj.putOpt("danJia", danjia); obj.putOpt("jieSuanJe", allPrice); obj.putOpt("shuliang", sl); obj.putOpt("zhiXingKs", dept.getDeptId()); obj.putOpt("zhiXingKsMc", dept.getDeptName()); obj.putOpt("shouFeiXmId", project.getHisXmbm()); obj.putOpt("shouFeiXmMc", project.getHisXmmc()); array.add(obj); zongjia = zongjia.add(allPrice); } map.put("feiYongInfoList", array); log.info("调用His接口前 收费总价:{}", zongjia.toString()); String post = HttpClientUtils.sendPost(apiUrl + "/api/his/" + hospbm + "/creatCostInfo", map); JSONObject object = JSONUtil.parseObj(post); if (object.getInt("code") == 200) { JSONObject data = object.getJSONObject("data"); tjFlowingWater.setHisWaterId(data.getStr("feiYongId")); JSONArray mxList = data.getJSONArray("mxList"); if (mxList != null && !mxList.isEmpty()) { List<TjFlowingWaterHis> his = mxList.toList(TjFlowingWaterHis.class); tjFlowingWaterHisService.saveBatch(his); } tjFlowingWaterService.updateById(tjFlowingWater); } else { TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); return AjaxResult.error(); } } return null; } } ltkj-hosp/src/main/java/com/ltkj/hosp/domain/TjAskHistorys.java
@@ -88,6 +88,31 @@ @ApiModelProperty(value = "疾病类型") private String type; private Integer dataType; public Long getIcdId() { return icdId; } public void setIcdId(Long icdId) { this.icdId = icdId; } public String getType() { return type; } public void setType(String type) { this.type = type; } public Integer getDataType() { return dataType; } public void setDataType(Integer dataType) { this.dataType = dataType; } public void setDiseaseId(Long diseaseId) { this.diseaseId = diseaseId; ltkj-hosp/src/main/java/com/ltkj/hosp/domain/TjAskMedicalHistory.java
@@ -255,4 +255,27 @@ @ApiModelProperty(value = "接害工龄") private String jhgl; /** * 既往病史 ids */ private String medicalHistoryIds; /** * 既往病史 其他备注 */ private String medicalHistoryOther; /** * 单位名称 */ private String dwmc; /** * 用工单位 */ private String ygdw; @TableField(exist = false) private List<TjAskHistorys> zhiyezzList; } ltkj-hosp/src/main/java/com/ltkj/hosp/domain/TjOrder.java
@@ -458,6 +458,41 @@ @TableField(exist = false) private String zt; /** * 接害工龄年 */ private String zhiyeJhgln; /** * 接害工龄月 */ private String zhiyeJhgly; /** * 开始接害日期 */ private Date zhiyeKsjhrq; /** * 工号 */ private String zhiyeGh; /** * 车间 */ private String zhiyeCj; /** * 职业结论 */ private String zhiyeJl; /** * 职业结果 */ private String zhiyeJg; @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjOrderDetailMapper.java
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ltkj.hosp.domain.TjOrderDetail; import com.ltkj.hosp.domain.TjProject; import com.ltkj.hosp.vo.ProFcListVo; import com.ltkj.hosp.vodomain.ShenGaoTiZhongVo; import org.apache.ibatis.annotations.*; @@ -289,4 +290,11 @@ "a.update_time=SYSDATE()\n" + "WHERE a.order_id=#{orderId} and isnull(a.jxbz)") void updateTjOrderDetailsFlowingWaterIdByJxbzisnull(@Param("orderId") String orderId,@Param("ls")String ls); @Select("SELECT p.pro_id,p.pro_name,p.pro_parent_id,o.order_id,p.sl * p.pro_price as price,d.dept_id,d.dept_name\n" + " FROM tj_order_detail o \n" + " LEFT JOIN tj_project p ON o.pro_id = p.pro_id\n" + " LEFT JOIN sys_dept d ON p.dept_id = d.dept_id\n" + " WHERE order_id = #{orderId} AND p.pro_parent_id <>0 AND o.is_return = #{type}") List<ProFcListVo> getFcList(@Param("orderId") Long orderId, @Param("type") Integer type); } ltkj-hosp/src/main/java/com/ltkj/hosp/service/ITjOrderDetailService.java
@@ -4,9 +4,11 @@ import java.util.Map; import com.baomidou.mybatisplus.extension.service.IService; import com.ltkj.common.core.domain.AjaxResult; import com.ltkj.common.core.domain.entity.SysUser; import com.ltkj.hosp.domain.TjOrderDetail; import com.ltkj.hosp.domain.TjProject; import com.ltkj.hosp.vo.ProFcListVo; import com.ltkj.hosp.vodomain.ShenGaoTiZhongVo; import org.apache.ibatis.annotations.Select; @@ -146,4 +148,8 @@ void updateTjOrderDetailsFlowingWaterIdByJxbz(String orderId, String jxbz,String ls); void updateTjOrderDetailsFlowingWaterIdByJxbzisnull(String orderId,String ls); List<ProFcListVo> getFcList(Long orderId, Integer type); AjaxResult updFcPro(String json); } ltkj-hosp/src/main/java/com/ltkj/hosp/service/ITjOrderService.java
@@ -126,7 +126,7 @@ //存储过程专用接口(总检) Map<String,Object> getCunChuGuoChengCustomerList(String tjNumber,Integer page,Integer pageSize, Integer checkStatus, String compId, String beginTime, String endTime,String tjname); Integer checkStatus, String compId, String beginTime, String endTime,String tjname,String shys); //存储过程专用接口(初审) Map<String,Object> getCsCunChuGuoChengCustomerList(String tjNumber,Integer page,Integer pageSize, ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/TjOrderDetailServiceImpl.java
@@ -1,20 +1,29 @@ package com.ltkj.hosp.service.impl; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; import cn.hutool.json.JSONArray; import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ltkj.common.core.domain.AjaxResult; import com.ltkj.common.core.domain.entity.SysUser; import com.ltkj.common.utils.DateUtils; import com.ltkj.hosp.domain.TjProject; import com.ltkj.hosp.vo.ProFcListVo; import com.ltkj.hosp.vodomain.ShenGaoTiZhongVo; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ltkj.hosp.mapper.TjOrderDetailMapper; import com.ltkj.hosp.domain.TjOrderDetail; import com.ltkj.hosp.service.ITjOrderDetailService; import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.interceptor.TransactionAspectSupport; /** * 体检项目明细Service业务层处理 @@ -22,6 +31,7 @@ * @author ltkj * @date 2022-11-22 */ @Slf4j @Service public class TjOrderDetailServiceImpl extends ServiceImpl<TjOrderDetailMapper, TjOrderDetail> implements ITjOrderDetailService { @Autowired @@ -244,4 +254,55 @@ public void updateTjOrderDetailsFlowingWaterIdByJxbzisnull(String orderId,String ls) { tjOrderDetailMapper.updateTjOrderDetailsFlowingWaterIdByJxbzisnull(orderId,ls); } @Override public List<ProFcListVo> getFcList(Long orderId, Integer type) { return tjOrderDetailMapper.getFcList(orderId,type); } @Transactional @Override public AjaxResult updFcPro(String json) { try { JSONObject entries = JSONUtil.parseObj(json); System.out.println(JSONUtil.toJsonStr(entries)); String orderId = entries.getStr("orderId"); JSONArray array = entries.getJSONArray("data"); ArrayList<String> fcList = new ArrayList<>(); ArrayList<String> notFcList = new ArrayList<>(); for (Object o : array) { JSONObject object = (JSONObject) o; String proId = object.getStr("proId"); Integer type = object.getInt("type"); if (type == 1) { fcList.add(proId); } else { notFcList.add(proId); } } // System.out.println("fcList = " + fcList); // System.out.println("notFcList = " + notFcList); // if (true) // return AjaxResult.error(); if (!fcList.isEmpty()){ LambdaUpdateWrapper<TjOrderDetail> wrapper = new LambdaUpdateWrapper<>(); wrapper.set(TjOrderDetail::getIsReturn,1); wrapper.eq(TjOrderDetail::getOrderId,orderId); wrapper.in(TjOrderDetail::getProId,fcList); update(wrapper); } if (!notFcList.isEmpty()){ LambdaUpdateWrapper<TjOrderDetail> wrapper = new LambdaUpdateWrapper<>(); wrapper.set(TjOrderDetail::getIsReturn,0); wrapper.eq(TjOrderDetail::getOrderId,orderId); wrapper.in(TjOrderDetail::getProId,notFcList); update(wrapper); } }catch (Exception e){ log.error(String.valueOf(e),e.getMessage()); TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); return AjaxResult.error(); } return AjaxResult.success(); } } ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/TjOrderServiceImpl.java
@@ -226,7 +226,7 @@ @Override public Map<String,Object> getCunChuGuoChengCustomerList(String tjNumber, Integer page, Integer pageSize, Integer checkStatus, String compId, String beginTime, String endTime, String tjname) { String compId, String beginTime, String endTime, String tjname,String shys) { Map<String, Object> map = new HashMap<>(); map.put("checkStatus",checkStatus); @@ -235,6 +235,7 @@ map.put("tjNumber",tjNumber); map.put("compId",compId); map.put("tjname",tjname); map.put("shys",shys); map.put("beginTime",beginTime); map.put("endTime",endTime); List<List<?>> list = tjOrderMapper.getCunChuGuoChengCustomerList(map); ltkj-hosp/src/main/java/com/ltkj/hosp/vo/ProFcListVo.java
New file @@ -0,0 +1,19 @@ package com.ltkj.hosp.vo; import lombok.Data; /** * @Company: 西安路泰科技有限公司 * @Author: zhaowenxuan * @Date: 2025/5/9 14:35 */ @Data public class ProFcListVo { private String proParentId; private String proId; private String price; private String deptName; private String deptId; private String orderId; private String proName; } ltkj-hosp/src/main/resources/mapper/hosp/TjAskMedicalHistoryMapper.xml
@@ -36,10 +36,14 @@ <result property="deleted" column="deleted"/> <result property="fromBy" column="from_by"/> <result property="zzsjj" column="zzsjj" typeHandler="com.ltkj.common.mybatis.JsonStringArrayTypeHandler"/> <result property="contactPoison" column="contact_poison"/> <result property="gongZhong" column="gong_zhong"/> <result property="gongLing" column="gong_ling"/> <result property="jhgl" column="jhgl"/> <result property="contactPoison" column="contact_poison"/> <result property="gongZhong" column="gong_zhong"/> <result property="gongLing" column="gong_ling"/> <result property="jhgl" column="jhgl"/> <result property="medicalHistoryIds" column="medical_history_ids"/> <result property="medicalHistoryOther" column="medical_history_other"/> <result property="dwmc" column="dwmc"/> <result property="ygdw" column="ygdw"/> </resultMap> <resultMap id="TjAskMedicalHistoryTjAskHistorysResult" type="TjAskMedicalHistory" extends="TjAskMedicalHistoryResult"> @@ -65,7 +69,9 @@ <sql id="selectTjAskMedicalHistoryVo"> select ask_id, cus_id, cus_name, work, work_status, medical_history, chuchao, jingqi, zhouqi, mociage, zinv, liuchan, zaochan, sichan, yichangtai, xiyan, xiyanpinlv, xiyanyear, yinjiu, yinjiupinlv, yinjiuyear, qita, remark, create_by, create_time, update_by, update_time, deleted,from_by,zzsjj,contact_poison,gong_zhong,gong_ling,jhgl create_time, update_by, update_time, deleted,from_by,zzsjj,contact_poison,gong_zhong,gong_ling,jhgl, dwmc, ygdw from tj_ask_medical_history </sql> @@ -93,7 +99,9 @@ sub_create_time, b.update_by as sub_update_by, b.update_time as sub_update_time, b.deleted as sub_deleted sub_deleted, a.dwmc, a.ygdw from tj_ask_medical_history a left join tj_ask_historys b on b.ask_id = a.ask_id where a.ask_id = #{askId} @@ -159,6 +167,10 @@ </if> <if test="fromBy != null">from_by, </if> <if test="dwmc != null">dwmc, </if> <if test="ygdw != null">ygdw, </if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="cusId != null">#{cusId}, @@ -217,6 +229,10 @@ </if> <if test="fromBy != null">#{fromBy}, </if> <if test="dwmc != null">#{dwmc}, </if> <if test="ygdw != null">#{ygdw}, </if> </trim> </insert> @@ -307,6 +323,12 @@ <if test="fromBy != null">from_By = #{fromBy}, </if> <if test="dwmc != null">dwmc = #{dwmc}, </if> <if test="ygdw != null">ygdw = #{ygdw}, </if> </trim> where ask_id = #{askId} </update> ltkj-hosp/src/main/resources/mapper/hosp/TjOrderMapper.xml
@@ -36,6 +36,13 @@ <result property="confirmDoctor" column="confirm_doctor"/> <result property="confirmTime" column="confirm_time"/> <result property="confirmStatus" column="confirm_status"/> <result property="zhiyeJhgln" column="zhiye_jhgln"/> <result property="zhiyeJhgly" column="zhiye_jhgly"/> <result property="zhiyeKsjhrq" column="zhiye_ksjhrq"/> <result property="zhiyeGh" column="zhiye_gh"/> <result property="zhiyeCj" column="zhiye_cj"/> <result property="zhiyeJl" column="zhiye_jl"/> <result property="zhiyeJg" column="zhiye_jg"/> </resultMap> <sql id="selectTjOrderVo"> @@ -77,7 +84,7 @@ heshou_time, is_hz, get_type, tj_category tj_category,zhiye_jhgln,zhiye_jhgly,zhiye_ksjhrq,zhiye_gh,zhiye_cj,zhiye_jl,zhiye_jg from tj_order </sql> @@ -209,6 +216,13 @@ <if test="isHz != null">is_hz,</if> <if test="getType != null">get_type,</if> <if test="tjCategory != null">tj_category,</if> <if test="zhiyeJhgln != null">zhiye_jhgln,</if> <if test="zhiyeJhgly != null">zhiye_jhgly,</if> <if test="zhiyeKsjhrq != null">zhiye_ksjhrq,</if> <if test="zhiyeGh != null">zhiye_gh,</if> <if test="zhiyeCj != null">zhiye_cj,</if> <if test="zhiyeJl != null">zhiye_jl,</if> <if test="zhiyeJg != null">zhiye_jg,</if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="userId != null">#{userId},</if> @@ -249,6 +263,13 @@ <if test="isHz != null">#{isHz},</if> <if test="getType != null">#{getType},</if> <if test="tjCategory != null">#{tjCategory},</if> <if test="zhiyeJhgln != null">#{zhiyeJhgln},</if> <if test="zhiyeJhgly != null">#{zhiyeJhgly},</if> <if test="zhiyeKsjhrq != null">#{zhiyeKsjhrq},</if> <if test="zhiyeGh != null">#{zhiyeGh},</if> <if test="zhiyeCj != null">#{zhiyeCj},</if> <if test="zhiyeJl != null">#{zhiyeJl},</if> <if test="zhiyeJg != null">#{zhiyeJg},</if> </trim> </insert> @@ -294,6 +315,13 @@ <if test="isHz != null">is_hz = #{isHz},</if> <if test="getType != null">get_type = #{getType},</if> <if test="tjCategory != null">tj_category = #{tjCategory},</if> <if test="zhiyeJhgln != null">zhiye_jhgln = #{zhiyeJhgln},</if> <if test="zhiyeJhgly != null">zhiye_jhgly = #{zhiyeJhgly},</if> <if test="zhiyeKsjhrq != null">zhiye_ksjhrq = #{zhiyeKsjhrq},</if> <if test="zhiyeGh != null">zhiye_gh = #{zhiyeGh},</if> <if test="zhiyeCj != null">zhiye_cj = #{zhiyeCj},</if> <if test="zhiyeJl != null">zhiye_jl = #{zhiyeJl},</if> <if test="zhiyeJg != null">zhiye_jg = #{zhiyeJg},</if> </trim> where order_id = #{orderId} </update> @@ -334,6 +362,7 @@ #{tjNumber,mode=IN,jdbcType=VARCHAR}, #{compId,mode=IN,jdbcType=VARCHAR}, #{tjname,mode=IN,jdbcType=VARCHAR}, #{shys,mode=IN,jdbcType=VARCHAR}, #{beginTime,mode=IN,jdbcType=VARCHAR}, #{endTime,mode=IN,jdbcType=VARCHAR}, #{total,mode=OUT,jdbcType=INTEGER} ltkj-system/src/main/java/com/ltkj/system/service/impl/SysDictTypeServiceImpl.java
@@ -70,11 +70,11 @@ */ @Override public List<SysDictData> selectDictDataByType(String dictType) { List<SysDictData> dictDatas = DictUtils.getDictCache(dictType); if (StringUtils.isNotEmpty(dictDatas)) { return dictDatas; } dictDatas = dictDataMapper.selectDictDataByType(dictType); // List<SysDictData> dictDatas = DictUtils.getDictCache(dictType); // if (StringUtils.isNotEmpty(dictDatas)) { // return dictDatas; // } List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(dictType); if (StringUtils.isNotEmpty(dictDatas)) { DictUtils.setDictCache(dictType, dictDatas); return dictDatas;