ltkj-admin/src/main/java/com/ltkj/web/controller/system/JsonController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjCustomerMapper.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
ltkj-hosp/src/main/java/com/ltkj/hosp/service/ITjCustomerService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/TjCustomerServiceImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
ltkj-admin/src/main/java/com/ltkj/web/controller/system/JsonController.java
New file @@ -0,0 +1,73 @@ package com.ltkj.web.controller.system; import cn.hutool.core.date.DateUtil; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.ltkj.common.core.controller.BaseController; import com.ltkj.common.core.domain.AjaxResult; import com.ltkj.hosp.domain.TjCustomer; import com.ltkj.hosp.service.ITjCustomerService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import java.io.Serializable; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.util.Date; import java.util.List; /** * @Company: 西安路泰科技有限公司 * @Author: lige * @Date: 2023/12/13 19:33 */ @RestController @RequestMapping("/json/parse") public class JsonController extends BaseController implements Serializable { @Resource private ITjCustomerService tjCustomerService; /** * 化验检查页面列表 */ @GetMapping("/huaYangetProList") @ApiOperation("影像/化验检查页面列表") public AjaxResult huaYangetProList(@RequestParam String deptId, @RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer pageSize, @RequestParam String cusName, @RequestParam String tjNumber) { return AjaxResult.success(tjCustomerService.getJsonParseCustomerList(deptId, page, pageSize, cusName, tjNumber)); } /** * 将结果集信息转换为JSON数组的形式 * * @param rs sql语句查询出来的结果集 * @return 返回一个JSON数组 * @throws Exception */ public static JSONArray formatRsToJsonArray(ResultSet rs) throws Exception { ResultSetMetaData md = rs.getMetaData(); int num = md.getColumnCount(); JSONArray array = new JSONArray(); while (rs.next()) { JSONObject mapOfColValues = new JSONObject(); for (int i = 1; i <= num; i++) { Object o = rs.getObject(i); mapOfColValues.put(md.getColumnName(i), rs.getObject(i)); } array.add(mapOfColValues); } return array; } } ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjCustomerMapper.java
@@ -1,5 +1,6 @@ package com.ltkj.hosp.mapper; import java.sql.ResultSet; import java.util.List; import com.baomidou.mybatisplus.core.mapper.BaseMapper; @@ -70,4 +71,8 @@ @Select("SELECT * FROM tj_customer WHERE cus_idcard = #{cusIdCard}") TjCustomer getTjCustomerByCusIdCard(String cusIdCard); @Select("SELECT * FROM tj_customer WHERE cus_idcard = #{cusIdCard}") ResultSet getJsonParseCustomerList(String deptId, Integer page, Integer pageSize, String cusName, String tjNumber); } ltkj-hosp/src/main/java/com/ltkj/hosp/service/ITjCustomerService.java
@@ -1,5 +1,6 @@ package com.ltkj.hosp.service; import java.sql.ResultSet; import java.util.List; import com.baomidou.mybatisplus.extension.service.IService; @@ -63,4 +64,6 @@ List<TjCustomer> getTjCustomerList(String name); TjCustomer getTjCustomerByCusIdCard(String cusIdCard); ResultSet getJsonParseCustomerList(String deptId, Integer page, Integer pageSize, String cusName, String tjNumber); } ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/TjCustomerServiceImpl.java
@@ -1,5 +1,6 @@ package com.ltkj.hosp.service.impl; import java.sql.ResultSet; import java.util.List; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -100,4 +101,9 @@ public TjCustomer getTjCustomerByCusIdCard(String cusIdCard) { return tjCustomerMapper.getTjCustomerByCusIdCard(cusIdCard); } @Override public ResultSet getJsonParseCustomerList(String deptId, Integer page, Integer pageSize, String cusName, String tjNumber) { return tjCustomerMapper.getJsonParseCustomerList(deptId,page,pageSize,cusName,tjNumber); } }