新疆部署初始版本

This commit is contained in:
佟明轩 2025-05-29 13:11:22 +08:00
parent a848710e08
commit f46d421a1c
9 changed files with 80 additions and 36 deletions

View File

@ -2,6 +2,7 @@ package com.syjiaer.clinic.server.common.util;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -10,7 +11,8 @@ import java.util.stream.Stream;
public class DateUtil { public class DateUtil {
public static final String DATE_FORMAT = "yyyy-MM-dd"; public static final String DATE_FORMAT = "yyyy-MM-dd";
public static final String DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss"; public static final String DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
private static final DateTimeFormatter INPUT_FORMATTER = DateTimeFormatter.ofPattern("EEE MMM dd HH:mm:ss z yyyy", Locale.ENGLISH);
private static final DateTimeFormatter OUTPUT_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
public LocalDateTime now() { public LocalDateTime now() {
return LocalDateTime.now(); return LocalDateTime.now();
} }
@ -76,4 +78,14 @@ public class DateUtil {
return Stream.iterate(startDate, date -> date.plusDays(1)) return Stream.iterate(startDate, date -> date.plusDays(1))
.limit(java.time.temporal.ChronoUnit.DAYS.between(startDate, endDate) + 1).toList(); .limit(java.time.temporal.ChronoUnit.DAYS.between(startDate, endDate) + 1).toList();
} }
/**
* 格式化 EEE MMM dd HH:mm:ss z yyyy yyyy-MM-dd HH:mm:ss
* @param dateStr
* @return
*/
public static String parseAndFormatDate(String dateStr) {
ZonedDateTime zonedDateTime = ZonedDateTime.parse(dateStr, INPUT_FORMATTER);
return zonedDateTime.format(OUTPUT_FORMATTER);
}
} }

View File

@ -4,6 +4,7 @@ import com.syjiaer.clinic.server.common.exception.MessageException;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.io.*; import java.io.*;
import java.nio.charset.Charset;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
@ -16,8 +17,10 @@ import java.util.zip.ZipOutputStream;
@Component @Component
public class FileUtil { public class FileUtil {
public List<String> unzip(String path, String filename) { public List<String> unzip(String path, String filename) {
List<String> file_list = new ArrayList<String>(); List<String> file_list = new ArrayList<>();
try (ZipInputStream zipInputStream = new ZipInputStream(new FileInputStream(path + "/" + filename))) { try (InputStream is = new FileInputStream(path + "/" + filename);
ZipInputStream zipInputStream = new ZipInputStream(new BufferedInputStream(is), Charset.forName("UTF-8"))) { // 强制指定编码为 UTF-8
byte[] buffer = new byte[4096]; byte[] buffer = new byte[4096];
ZipEntry zipEntry; ZipEntry zipEntry;

View File

@ -68,7 +68,7 @@ public class HttpUtil {
BufferedReader reader = null; BufferedReader reader = null;
String tempLine = null; String tempLine = null;
reader = new BufferedReader(new InputStreamReader(conn.getInputStream(), "GBK")); reader = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));
while ((tempLine = reader.readLine()) != null) { while ((tempLine = reader.readLine()) != null) {
resultBuffer.append(tempLine); resultBuffer.append(tempLine);
} }
@ -79,9 +79,7 @@ public class HttpUtil {
} }
logger.info("调用医保请求出参==》" + result); logger.info("调用医保请求出参==》" + result);
JSONObject result_json = JSON.parseObject(result); JSONObject result_json = JSON.parseObject(result);
if(result_json==null||result_json.isEmpty()){
throw new MessageException("医保接口返回数据异常");
}
if (!result_json.getString("err_msg").equals("成功") &&!result_json.getString("err_msg").equals("success") && !result_json.getString("err_msg").isEmpty()) { if (!result_json.getString("err_msg").equals("成功") &&!result_json.getString("err_msg").equals("success") && !result_json.getString("err_msg").isEmpty()) {
throw new MessageException(result_json.getString("err_msg")); throw new MessageException(result_json.getString("err_msg"));
} }
@ -275,8 +273,8 @@ public class HttpUtil {
map.put("msgid", config.get("social", "msgid") + now_str.format(now) + String.valueOf(randomNumber)); map.put("msgid", config.get("social", "msgid") + now_str.format(now) + String.valueOf(randomNumber));
map.put("infver", "V1.0"); map.put("infver", "V1.0");
map.put("inf_time", now.format(now_str2)); map.put("inf_time", now.format(now_str2));
map.put("opter", config.get("social", "opter")); map.put("opter",managerUser.getId().toString());
map.put("opter_name", config.get("social", "opterName")); map.put("opter_name", managerUser.getName());
map.put("opter_type", "1"); map.put("opter_type", "1");
map.put("fixmedins_code", config.get("social", "fixmedinsCode")); map.put("fixmedins_code", config.get("social", "fixmedinsCode"));
map.put("fixmedins_name", config.get("social", "fixmedinsName")); map.put("fixmedins_name", config.get("social", "fixmedinsName"));
@ -294,27 +292,27 @@ public class HttpUtil {
private JSONObject uploadFile(String posturl, String filePath) { private JSONObject uploadFile(String posturl, String filePath) {
// 写入请求正文 // 写入请求正文
try { try {
// 读取文件字节数组 // 读取文件字节数组
byte[] fileBytes = Files.readAllBytes(Paths.get(filePath)); byte[] fileBytes = Files.readAllBytes(Paths.get(filePath));
String fileName = Paths.get(filePath).getFileName().toString(); String fileName = Paths.get(filePath).getFileName().toString();
IM9101 im9101 = new IM9101(); IM9101 im9101 = new IM9101();
IM9101.FsUploadIn fsUploadIn = new IM9101.FsUploadIn(); IM9101.FsUploadIn fsUploadIn = new IM9101.FsUploadIn();
fsUploadIn.setIn(fileBytes); fsUploadIn.setIn(fileBytes);
fsUploadIn.setFilename(fileName); fsUploadIn.setFilename(fileName);
fsUploadIn.setFixmedins_code(config.get("social", "fixmedinsCode")); fsUploadIn.setFixmedins_code(config.get("social", "fixmedinsCode"));
im9101.setFsUploadIn(fsUploadIn); im9101.setFsUploadIn(fsUploadIn);
Map<String, Object> parms = getparms("9101", im9101.buildToMap()); Map<String, Object> parms = getparms("9101", im9101.buildToMap());
// 构建JSON参数部分 // 构建JSON参数部分
String jsonString = JSON.toJSONString(parms); String jsonString = JSON.toJSONString(parms);
// 写入JSON参数部分 // 写入JSON参数部分
JSONObject result = post(posturl, jsonString); JSONObject result = post(posturl, jsonString);
return result; return result;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return null; return null;
} }

View File

@ -12,6 +12,7 @@ import com.syjiaer.clinic.server.entity.manager.ManagerUser;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import java.time.format.DateTimeFormatter;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
@ -33,6 +34,7 @@ public abstract class BaseService {
@Value("${jwt.secret}") @Value("${jwt.secret}")
protected String jwtSecret; protected String jwtSecret;
protected static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
protected ManagerUser getManagerUser() { protected ManagerUser getManagerUser() {

View File

@ -590,7 +590,7 @@ public class ChargeService extends BaseService {
ChargeOrder order = chargeOrderMapper.selectByCode(changeOrderCode); ChargeOrder order = chargeOrderMapper.selectByCode(changeOrderCode);
Diagnosis diagnosis = diagnosisMapper.selectByCode(order.getDiagnosisCode()); Diagnosis diagnosis = diagnosisMapper.selectByCode(order.getDiagnosisCode());
//预支付只需要卡号 //预支付只需要卡号
String cardNumber = mdtrtCertNo.substring(0, mdtrtCertNo.indexOf("|")); String cardNumber = mdtrtCertNo;
PatientRegistration registration = patientRegistrationMapper.selectById(diagnosis.getRegistrationId()); PatientRegistration registration = patientRegistrationMapper.selectById(diagnosis.getRegistrationId());
IM2206A im2206A = new IM2206A(); IM2206A im2206A = new IM2206A();
@ -598,15 +598,15 @@ public class ChargeService extends BaseService {
data.setPsn_no(registration.getPsnNo()); data.setPsn_no(registration.getPsnNo());
data.setMdtrt_cert_type(mdtrtCertType); data.setMdtrt_cert_type(mdtrtCertType);
data.setMdtrt_cert_no(cardNumber); data.setMdtrt_cert_no(cardNumber);
data.setMed_type("12"); data.setMed_type(config.get("social", "medType"));
data.setMedfee_sumamt(order.getTotalPrice()); data.setMedfee_sumamt(order.getTotalPrice());
data.setPsn_setlway("01"); data.setPsn_setlway("01");
data.setMdtrt_id(registration.getMdtrtId()); data.setMdtrt_id(registration.getMdtrtId());
data.setChrg_bchno(order.getCode()); data.setChrg_bchno(order.getCode());
data.setAcct_used_flag("1"); data.setAcct_used_flag("1");
data.setInsutype(insutype); data.setInsutype(insutype);
IM2206A.ExpContent expContent = new IM2206A.ExpContent(); // IM2206A.ExpContent expContent = new IM2206A.ExpContent();
data.setExp_content(expContent); // data.setExp_content(expContent);
im2206A.setData(data); im2206A.setData(data);
return socialRequest.call2206A(im2206A); return socialRequest.call2206A(im2206A);

View File

@ -7,9 +7,12 @@ import com.syjiaer.clinic.server.common.api.request.SocialRequest;
import com.syjiaer.clinic.server.common.util.HttpUtil; import com.syjiaer.clinic.server.common.util.HttpUtil;
import com.syjiaer.clinic.server.entity.social.SocialDirectoryLimit; import com.syjiaer.clinic.server.entity.social.SocialDirectoryLimit;
import com.syjiaer.clinic.server.mapper.social.SocialDirectoryLimitMapper; import com.syjiaer.clinic.server.mapper.social.SocialDirectoryLimitMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -19,6 +22,7 @@ import java.util.logging.Logger;
* 目录有效期 * 目录有效期
*/ */
@Slf4j
@Service @Service
public class SocialDirectoryLimitService { public class SocialDirectoryLimitService {
@Autowired @Autowired
@ -83,8 +87,15 @@ public class SocialDirectoryLimitService {
} }
private JSONObject call(String updt_time, int page_num) { private JSONObject call(String updt_time, int page_num) {
ZonedDateTime zonedDateTime = ZonedDateTime.parse(updt_time);
// 定义目标格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
// 格式化输出
String formattedDate = zonedDateTime.format(formatter);
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("updt_time", updt_time); map.put("updt_time", formattedDate);
map.put("page_num", page_num); map.put("page_num", page_num);
map.put("page_size", 1000); map.put("page_size", 1000);
map.put("vali_flag", "1"); map.put("vali_flag", "1");

View File

@ -10,6 +10,8 @@ import com.syjiaer.clinic.server.mapper.social.SocialDirectorySelfMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -83,8 +85,15 @@ public class SocialDirectorySelfService {
} }
private JSONObject call(String updt_time, int page_num) { private JSONObject call(String updt_time, int page_num) {
ZonedDateTime zonedDateTime = ZonedDateTime.parse(updt_time);
// 定义目标格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
// 格式化输出
String formattedDate = zonedDateTime.format(formatter);
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("updt_time", updt_time); map.put("updt_time", formattedDate);
map.put("page_num", page_num); map.put("page_num", page_num);
map.put("page_size", 1000); map.put("page_size", 1000);
map.put("vali_flag", "1"); map.put("vali_flag", "1");

View File

@ -132,8 +132,8 @@ public class SocialDirectoryService extends BaseService {
if (type == 1302) { if (type == 1302) {
flag = line_array[13]; flag = line_array[13];
socialDirectory.setKeyword(line_array[19]+","+socialDirectory.getProducer()+","+socialDirectory.getName()+","+socialDirectory.getCode()); socialDirectory.setKeyword(line_array[19]+","+socialDirectory.getProducer()+","+socialDirectory.getName()+","+socialDirectory.getCode());
socialDirectory.setCreateDatetime(LocalDateTime.parse(line_array[15], dateTimeFormatter)); socialDirectory.setCreateDatetime(LocalDateTime.parse(DateUtil.parseAndFormatDate(line_array[15]), dateTimeFormatter));
socialDirectory.setUpdateDatetime(LocalDateTime.parse(line_array[16], dateTimeFormatter)); socialDirectory.setUpdateDatetime(LocalDateTime.parse(DateUtil.parseAndFormatDate(line_array[16]), dateTimeFormatter));
} }
if (type == 1306) { if (type == 1306) {
flag = line_array[67]; flag = line_array[67];

View File

@ -10,6 +10,8 @@ import com.syjiaer.clinic.server.mapper.social.SocialDirectoryUpinfoMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -83,8 +85,15 @@ public class SocialDirectoryUpinfoService {
} }
private JSONObject call(String updt_time, int page_num) { private JSONObject call(String updt_time, int page_num) {
ZonedDateTime zonedDateTime = ZonedDateTime.parse(updt_time);
// 定义目标格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
// 格式化输出
String formattedDate = zonedDateTime.format(formatter);
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("updt_time", updt_time); map.put("updt_time", formattedDate);
map.put("page_num", page_num); map.put("page_num", page_num);
map.put("page_size", 1000); map.put("page_size", 1000);
map.put("vali_flag", "1"); map.put("vali_flag", "1");