From b1bd4cbd01cb8d7616de0b3c321439985a149e5e Mon Sep 17 00:00:00 2001 From: liusheng <337615773@qq.com> Date: 星期五, 13 十月 2023 14:15:06 +0800 Subject: [PATCH] 代码提交 --- smartor/src/main/java/com/smartor/service/IServiceThirdDataService.java | 22 + smartor/src/main/java/com/smartor/domain/DingTalkReqVo.java | 31 + ruoyi-admin/pom.xml | 44 ++ smartor/src/main/java/com/smartor/service/impl/DingTalkServiceImpl.java | 87 +++- ruoyi-admin/src/main/java/com/ruoyi/web/controller/read/PatientInfoImportController.java | 44 ++ ruoyi-admin/src/main/java/com/ruoyi/web/webservice/impl/PateintBaseServiceImpl.java | 31 + ruoyi-admin/src/main/resources/application.yml | 8 ruoyi-admin/src/main/java/com/ruoyi/web/webservice/PstientWSConfig.java | 39 ++ ruoyi-admin/src/main/java/com/ruoyi/web/core/config/TomcatConfig.java | 19 + ruoyi-system/src/main/java/com/ruoyi/system/service/impl/EquipmentinfoServiceImpl.java | 2 smartor/src/main/java/com/smartor/service/RemoteDataSaveService.java | 41 ++ ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java | 3 ruoyi-admin/src/main/java/com/ruoyi/web/webservice/PateintBaseService.java | 14 ruoyi-admin/src/main/resources/application-druid.yml | 9 ruoyi-admin/src/main/java/com/ruoyi/web/controller/socket/SocketCommunication.java | 199 +++++++++++ smartor/src/main/java/com/smartor/domain/ServiceThirdData.java | 74 ++++ smartor/src/main/java/com/smartor/service/impl/RemoteDataSaveServiceImpl.java | 121 +++++++ smartor/src/main/java/com/smartor/service/impl/ServiceThirdDataServiceImpl.java | 24 + smartor/src/main/resources/mapper/smartor/ServiceThirdDataMapper.xml | 55 +++ ruoyi-common/src/main/java/com/ruoyi/common/enums/FollowUpEnum.java | 74 ++++ ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java | 30 - smartor/src/main/java/com/smartor/mapper/ServiceThirdDataMapper.java | 32 + 22 files changed, 935 insertions(+), 68 deletions(-) diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml index 5308411..2c904b4 100644 --- a/ruoyi-admin/pom.xml +++ b/ruoyi-admin/pom.xml @@ -8,8 +8,9 @@ <version>3.8.5</version> </parent> <modelVersion>4.0.0</modelVersion> +<!-- <packaging>war</packaging>--> <packaging>jar</packaging> - <artifactId>ruoyi-admin</artifactId> + <artifactId>smartor-admin</artifactId> <description> web鏈嶅姟鍏ュ彛 @@ -17,7 +18,7 @@ <dependencies> - <!-- spring-boot-devtools --> + <!-- spring-boot-devtools --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> @@ -37,7 +38,7 @@ <version>1.6.2</version> </dependency> - <!-- Mysql椹卞姩鍖� --> + <!-- Mysql椹卞姩鍖� --> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> @@ -85,6 +86,41 @@ <artifactId>json</artifactId> <version>20210307</version> </dependency> + + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-web-services</artifactId> + </dependency> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-frontend-jaxws</artifactId> + <version>3.1.6</version> + </dependency> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-transports-http</artifactId> + <version>3.1.6</version> + </dependency> + <dependency> + <groupId>org.codehaus.woodstox</groupId> + <artifactId>stax2-api</artifactId> + <version>3.1.1</version> + </dependency> + + <!-- https://mvnrepository.com/artifact/ca.uhn.hapi/hapi-base --> + <dependency> + <groupId>ca.uhn.hapi</groupId> + <artifactId>hapi-base</artifactId> + <version>2.3</version> + </dependency> + <!-- https://mvnrepository.com/artifact/ca.uhn.hapi/hapi-structures-v24 --> + <dependency> + <groupId>ca.uhn.hapi</groupId> + <artifactId>hapi-structures-v24</artifactId> + <version>2.3</version> + </dependency> + + </dependencies> <build> @@ -112,7 +148,7 @@ <failOnMissingWebXml>false</failOnMissingWebXml> <warName>${project.artifactId}</warName> </configuration> - </plugin> + </plugin> </plugins> <finalName>${project.artifactId}</finalName> </build> diff --git a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java index 3ca92b2..6e1d70b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java @@ -1,5 +1,6 @@ package com.ruoyi; +import com.ruoyi.web.controller.socket.SocketCommunication; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; @@ -28,5 +29,7 @@ " | | \\ `' /| `-' / \n" + " | | \\ / \\ / \n" + " ''-' `'-' `-..-' "); + //寮�鍚疭OCKET + new SocketCommunication().socketCommunication(); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/read/PatientInfoImportController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/read/PatientInfoImportController.java new file mode 100644 index 0000000..a6d08d4 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/read/PatientInfoImportController.java @@ -0,0 +1,44 @@ +package com.ruoyi.web.controller.read; + +import com.ruoyi.common.core.controller.BaseController; +import com.smartor.service.IBaseTagService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Arrays; +import java.util.List; + +/** + * 鎮h�呬俊鎭鍏ワ紙鎺ユ敹鑱斾紬娑堟伅鎺ㄩ�侊級 + * + * @author ls + * @date 2023-08-03 + */ +@Slf4j +@Api(description = "鎮h�呬俊鎭鍏ワ紙鎺ユ敹鑱斾紬娑堟伅鎺ㄩ�侊級") +@RestController +@RequestMapping("/patient/read") +public class PatientInfoImportController extends BaseController { + @Autowired + private IBaseTagService baseTagService; + + /** + * 鎮h�呭熀鏈俊鎭� + */ + @ApiOperation("鎮h�呭熀鏈俊鎭�") + @PostMapping("/patientInfo") + public void patientBaseInfo(@RequestParam String pateintInfo) { + log.info("鎮h�呭熀鏈俊鎭� : {}", pateintInfo); + String[] split = pateintInfo.split("\\|"); + List<String> stringList = Arrays.asList(split); + System.out.println(stringList); + } + + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/socket/SocketCommunication.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/socket/SocketCommunication.java new file mode 100644 index 0000000..2fbb8ec --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/socket/SocketCommunication.java @@ -0,0 +1,199 @@ +package com.ruoyi.web.controller.socket; + +import ca.uhn.hl7v2.DefaultHapiContext; +import ca.uhn.hl7v2.HapiContext; +import ca.uhn.hl7v2.model.v24.message.ACK; +import ca.uhn.hl7v2.parser.Parser; +import com.ruoyi.common.utils.StringUtils; +import com.smartor.service.impl.RemoteDataSaveServiceImpl; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.RestController; + +import java.io.*; +import java.net.ServerSocket; +import java.net.Socket; +import java.text.SimpleDateFormat; +import java.time.Instant; +import java.time.ZoneId; +import java.time.ZonedDateTime; +import java.util.*; +import java.util.concurrent.Executor; +import java.util.concurrent.Executors; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +@RestController +@Slf4j +public class SocketCommunication { + + + public String socketCommunication() { + try { + // 鍒涘缓 ServerSocket 瀹炰緥锛岀洃鍚� 8080 绔彛 + ServerSocket serverSocket = new ServerSocket(8999); + //鍥哄畾绾跨▼姹犳潵鎺ユ敹澶勭悊 + Executor executor = Executors.newFixedThreadPool(3); + // 绛夊緟瀹㈡埛绔繛鎺� + while (true) { + Socket socket = serverSocket.accept(); +// new Thread(new MyRuns(socket)).start(); + executor.execute(new MyRuns(socket)); + } + + } catch (IOException e) { + e.printStackTrace(); + return "鍙戠敓寮傚父锛�" + e.getMessage(); + } + } + +} + +class MyRuns implements Runnable { + + + Socket socket; + BufferedReader reader; + PrintWriter writer = null; + // BufferedWriter writer; + + public MyRuns(Socket socket) { + super(); + this.socket = socket; + } + + public void run() { + Map<String, List> map = new HashMap<>(); + + try { + reader = new BufferedReader(new InputStreamReader(socket.getInputStream(), "UTF-8"));//璇诲彇瀹㈡埛绔秷鎭� + // writer = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())); + writer = new PrintWriter(new OutputStreamWriter(socket.getOutputStream()), true);//鍚戝鎴风鍐欐秷鎭� + + //鑾峰彇绗竴琛屾暟鎹� + String oneLine = reader.readLine(); + // 鍒涘缓HapiContext瀹炰緥 + HapiContext context = new DefaultHapiContext(); + // 鍒涘缓Parser瀹炰緥 + Parser parser = context.getPipeParser(); + + // 瑙f瀽HL7娑堟伅 + List<String> list = dataExplain(oneLine); + map.put(list.get(0).trim(), list); + + //鑾峰彇杩斿洖鏁版嵁 + String messageControlID = list.get(9); + String timeOfAnEvent = list.get(6); + String senderApp = list.get(2); + String senderFac = list.get(3); + + String dataType = list.get(8); + if (StringUtils.isNotEmpty(dataType)) { + int endIndex = dataType.lastIndexOf("^"); + dataType = dataType.substring(0, endIndex); + int endIndex2 = dataType.lastIndexOf("^"); + dataType = dataType.substring(endIndex2); + } + + //璁剧疆鏃堕棿鎴� + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("YYYYMMddHHmmss"); + String timestamp = simpleDateFormat.format(new Date()); + + //杩斿洖鍝嶅簲锛堝搷搴旀暟鎹繘琛岀粍瑁咃級 + ACK ack = new ACK(); + ack.initQuickstart("ACK", "2.4", "P"); + // 璁剧疆MSH娈电殑瀛楁 + ack.getMSH().getSendingApplication().getNamespaceID().setValue("HIS"); + ack.getMSH().getSendingFacility().getNamespaceID().setValue(senderFac); + ack.getMSH().getReceivingApplication().getNamespaceID().setValue(senderApp); + ack.getMSH().getReceivingFacility().getNamespaceID().setValue(senderFac); + ack.getMSH().getDateTimeOfMessage().getTimeOfAnEvent().setValue(timeOfAnEvent); + ack.getMSH().getMessageType().getMessageType().setValue("ACK"); + ack.getMSH().getMessageType().getTriggerEvent().setValue("ACK"); + ack.getMSH().getMessageControlID().setValue(timestamp); + ack.getMSH().getProcessingID().getProcessingID().setValue("P"); + ack.getMSH().getVersionID().getVersionID().setValue("2.4"); + // 璁剧疆MSA娈电殑瀛楁 + ack.getMSA().getAcknowledgementCode().setValue("AA"); + ack.getMSA().getMessageControlID().setValue(messageControlID); + ack.getMSA().getTextMessage().setValue(""); + + // 灏咥CK娑堟伅杞崲涓哄瓧绗︿覆 + String responseString = parser.encode(ack); + //鑾峰彇涓や釜ACK鐨勪綅缃� + int ack1 = responseString.indexOf("ACK", 0); + int i1 = responseString.lastIndexOf("^ACK"); + //缁欎袱涓狝CK涔嬮棿鍔犱笂鏁版嵁绫诲瀷 + responseString = responseString.substring(0, ack1 + 3) + dataType + responseString.substring(i1); + + //鍔犱笂寮�濮嬬鍜岀粨鏉熺 + char startSymbol = 0x0B; // 寮�濮嬬锛�0x0B锛� + char endSymbol = 0x1C; // 缁撴潫绗︼紙0x1C锛� + String backData = String.valueOf(startSymbol) + responseString + String.valueOf(endSymbol); + writer.println(backData); + + //澶勭悊浼犳潵鐨勬暟鎹� + String lineString = null; + String dataInfo = ""; + dataInfo += oneLine + "\r\n"; + while ((lineString = reader.readLine()) != null) { + // 瀵硅幏鍙栫殑鏁版嵁锛岃繘琛屾嫾鎺� + List<String> list2 = dataExplain(lineString); + if (!CollectionUtils.isEmpty(list2)) { + //key鏈夊彲鑳介噸澶嶏紝瀵艰嚧鏁版嵁琚鐩栵紝鎵�浠ワ紝寰�鏁版嵁搴撲繚瀛樻暟鎹殑鏃跺�欙紝鐢╯tringBuilder閲岀殑鏁版嵁 + map.put(list2.get(0).trim(), list2); + } + dataInfo += lineString + "\r\n"; + + } + //鍘绘帀鏈�鍚庝竴涓崲琛� + int i = dataInfo.lastIndexOf("\r\n"); + dataInfo = dataInfo.substring(0, i); + + //鎵撳嵃涓�涓嬫敹鍒版暟鎹椂闂� + SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("YYYY-MM-dd HH:mm:ss"); + String date = simpleDateFormat1.format(new Date()); + System.out.println(date + " 鏀跺埌鏁版嵁鏃堕棿,鍐呭 : " + dataInfo); + + RemoteDataSaveServiceImpl remoteDataSaveService = new RemoteDataSaveServiceImpl(); + remoteDataSaveService.dealData(map, dataInfo); + + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + if (reader != null) { + reader.close(); + } + if (writer != null) { + writer.close(); + } + if (socket != null) { + socket.close(); + } + } catch (Exception e2) { + e2.printStackTrace(); + } + } + } + + + private List<String> dataExplain(String data) { + String[] segments = data.split("\r"); + ArrayList<String> arrayList = new ArrayList(); + + // Process each segment + for (String segment : segments) { + // 鏍规嵁 '|'杩涜鎴彇 + String[] fields = segment.split("\\|"); + + // 閬嶅巻鏁扮粍 + for (String field : fields) { + arrayList.add(field); + } + } + return arrayList; + } +} + diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/TomcatConfig.java b/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/TomcatConfig.java new file mode 100644 index 0000000..9eef711 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/TomcatConfig.java @@ -0,0 +1,19 @@ +package com.ruoyi.web.core.config; + +import org.apache.catalina.connector.Connector; +import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class TomcatConfig { + @Bean + public TomcatServletWebServerFactory webServerFactory() { + TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory(); + factory.addConnectorCustomizers((Connector connector) -> { + connector.setProperty("relaxedPathChars", "\"#<>[\\]^`{|}/"); + connector.setProperty("relaxedQueryChars", "\"#<>[\\]^`{|}/"); + }); + return factory; + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/webservice/PateintBaseService.java b/ruoyi-admin/src/main/java/com/ruoyi/web/webservice/PateintBaseService.java new file mode 100644 index 0000000..26712d4 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/webservice/PateintBaseService.java @@ -0,0 +1,14 @@ +package com.ruoyi.web.webservice; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebService; + +@WebService(name = "API_ESB_Service", // 鏆撮湶鏈嶅姟鍚嶇О + targetNamespace = "http://webservice.web.ruoyi.com"// 鍛藉悕绌洪棿,涓�鑸槸鎺ュ彛鐨勫寘鍚嶅�掑簭 +) +public interface PateintBaseService { + + @WebMethod(action = "Run") + public String Run(@WebParam(name = "MessageVersion") String MessageVersion,@WebParam(name = "MessageType") String MessageType,@WebParam(name = "Message") String Message); +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/webservice/PstientWSConfig.java b/ruoyi-admin/src/main/java/com/ruoyi/web/webservice/PstientWSConfig.java new file mode 100644 index 0000000..6c80c26 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/webservice/PstientWSConfig.java @@ -0,0 +1,39 @@ +package com.ruoyi.web.webservice; + + +import com.ruoyi.web.webservice.impl.PateintBaseServiceImpl; +import org.apache.cxf.Bus; +import org.apache.cxf.bus.spring.SpringBus; +import org.apache.cxf.jaxws.EndpointImpl; +import org.apache.cxf.transport.servlet.CXFServlet; +import org.springframework.boot.web.servlet.ServletRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import javax.xml.ws.Endpoint; + +@Configuration +public class PstientWSConfig { + @Bean + public ServletRegistrationBean disServlet() { + + + ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new CXFServlet(), "/API_ESB_Service"); + return servletRegistrationBean; + } + + @Bean(name = Bus.DEFAULT_BUS_ID) + public SpringBus springBus() { + + + return new SpringBus(); + } + @Bean + public Endpoint endpoint() { + + + EndpointImpl endpoint = new EndpointImpl(springBus(),new PateintBaseServiceImpl()); + endpoint.publish(""); + return endpoint; + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/webservice/impl/PateintBaseServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/web/webservice/impl/PateintBaseServiceImpl.java new file mode 100644 index 0000000..59d25fa --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/webservice/impl/PateintBaseServiceImpl.java @@ -0,0 +1,31 @@ +package com.ruoyi.web.webservice.impl; + +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.web.webservice.PateintBaseService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import javax.jws.WebService; +import java.util.Arrays; +import java.util.List; + +@WebService(serviceName = "API_ESB_Service", // 涓庢帴鍙d腑鎸囧畾鐨刵ame涓�鑷� + targetNamespace = "http://webservice.web.ruoyi.com", // 涓庢帴鍙d腑鐨勫懡鍚嶇┖闂翠竴鑷�,涓�鑸槸鎺ュ彛鐨勫寘鍚嶅�� + endpointInterface = "com.ruoyi.web.webservice.PateintBaseService"// 鎺ュ彛鍦板潃 +) +@Component +@Slf4j +public class PateintBaseServiceImpl implements PateintBaseService { + @Override + public String Run(String MessageVersion, String MessageType, String Message) { + log.info("鎮h�呬俊鎭�: {}", Message); + log.info("鎮h�呬俊鎭�: {}", Message); + log.info("鎮h�呬俊鎭�: {}", Message); + if (StringUtils.isNotEmpty(Message)) { + String[] split = Message.split("\\|"); + List<String> stringList = Arrays.asList(split); + System.out.println(stringList); + } + return Message; + } +} diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/ruoyi-admin/src/main/resources/application-druid.yml index 444a453..0f46331 100644 --- a/ruoyi-admin/src/main/resources/application-druid.yml +++ b/ruoyi-admin/src/main/resources/application-druid.yml @@ -6,9 +6,12 @@ druid: # 涓诲簱鏁版嵁婧� master: - url: jdbc:mysql://116.62.18.175:6002/smartor?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 - username: hxsoft - password: Hxerp2000 + url: jdbc:mysql://127.0.0.1:3306/smartor?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 +# url: jdbc:mysql://116.62.18.175:6002/smartor?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + username: root + password: 123456 +# username: hxsoft +# password: Hxerp2000 # 浠庡簱鏁版嵁婧� slave: # 浠庢暟鎹簮寮�鍏�/榛樿鍏抽棴 diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index de72b37..eee2def 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -18,7 +18,7 @@ # 寮�鍙戠幆澧冮厤缃� server: # 鏈嶅姟鍣ㄧ殑HTTP绔彛锛岄粯璁や负8080 - port: 8080 + port: 8181 servlet: # 搴旂敤鐨勮闂矾寰� context-path: / @@ -70,8 +70,12 @@ # redis 閰嶇疆 redis: # 鍦板潃 - host: 116.62.18.175 + host: 127.0.0.1 # 绔彛锛岄粯璁や负6379 +# port: 6379 +# # 鍦板潃 +# host: 116.62.18.175 +# # 绔彛锛岄粯璁や负6379 port: 6020 # 鏁版嵁搴撶储寮� database: 0 diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/FollowUpEnum.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/FollowUpEnum.java new file mode 100644 index 0000000..9106552 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/enums/FollowUpEnum.java @@ -0,0 +1,74 @@ +package com.ruoyi.common.enums; + +public enum FollowUpEnum { + + HZGH("ADT^A04", "鎮h�呮寕鍙�"), + WCJZ("REF^I12", "瀹屾垚鎺ヨ瘖"), + CFSQ("OMP^O09[NW~PH~IP]", "澶勬柟鐢宠"), + CFSFQR("OMP^O09[OK^SC]", "澶勬柟鏀惰垂纭"), + CFTFQR("OMP^O09[OK^DC]", "澶勬柟閫�璐圭‘璁�"), + HZZDXXXG("ADT^A08", "鎮h�呰瘖鏂俊鎭慨鏀�"), + JCBGMJZ("ORU^R01[UX~CM]", "妫�鏌ユ姤鍛�(闂ㄦ�ヨ瘖涓氬姟)"), + + KS("MFN^Z2B", "绉戝"), + BQ("MFN^Z2C", "鐥呭尯"), + XZZGXX("PMU^B01", "鏂板鑱屽伐淇℃伅"), + XGZGXX("PMU^B02", "淇敼鑱屽伐淇℃伅"), + JBZDXX("MFN^Z4A", "鐤剧梾瀛楀吀淇℃伅"), + SSZDXX("MFN^Z8A", "鎵嬫湳瀛楀吀淇℃伅"), + YPZDXX("MFN^Z3C", "鑽搧瀛楀吀淇℃伅"), + HZJBXXXG("ADT^A31", "鎮h�呭熀鏈俊鎭慨鏀�"), + + HZRY("ADT^A01", "鎮h�呭叆闄�"), + HZQXRY("ADT^A11", "鎮h�呭彇娑堝叆闄�"), + HZRK("ADT^A10", "鎮h�呭叆绉�"), + HZQXRK("ADT^A32", "鎮h�呭彇娑堝叆绉�"), + HZYCY("ADT^A16", "鎮h�呴鍑洪櫌"), + QXYCY("ADT^A25", "鍙栨秷棰勫嚭闄�"), + YZSQ("OMP^O09[NW~IP]", "鍖诲槺鐢宠"), + YZZF("OMP^O09[CA~CA]", "鍖诲槺浣滃簾"), + YZTZ("OMP^O09[DC~DC]", "鍖诲槺鍋滄"), + ZDXXXG("ADT^A08", "璇婃柇淇℃伅淇敼"), + JCBG("ORU^R01[UX~CM]", "妫�鏌ユ姤鍛�"), + JCSJ("ORU^R01", "妫�鏌ユ暟鎹�"), + JYBG("OUL^R21", "妫�楠屾姤鍛�"), + CFXZSQ("OMP^O09", "澶勬柟鏂板鐢宠"), + SHDJ("SIU^S21", "鏈悗鐧昏"); + + + private String code; + private String desc; + + FollowUpEnum(String code, String desc) { + this.code = code; + this.desc = desc; + } + + public static String getDescByCode(String code) { + FollowUpEnum[] organEnums = values(); + for (int i = 0; i < organEnums.length; i++) { + FollowUpEnum organEnum = organEnums[i]; + if (organEnum.getCode().equals(code)) { + return organEnum.getDesc(); + } + } + return null; + } + + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } +} \ No newline at end of file diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java index 07ac7c9..7b4d3bb 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java @@ -22,18 +22,17 @@ /** * spring security閰嶇疆 - * + * * @author ruoyi */ @EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true) -public class SecurityConfig extends WebSecurityConfigurerAdapter -{ +public class SecurityConfig extends WebSecurityConfigurerAdapter { /** * 鑷畾涔夌敤鎴疯璇侀�昏緫 */ @Autowired private UserDetailsService userDetailsService; - + /** * 璁よ瘉澶辫触澶勭悊绫� */ @@ -51,7 +50,7 @@ */ @Autowired private JwtAuthenticationTokenFilter authenticationTokenFilter; - + /** * 璺ㄥ煙杩囨护鍣� */ @@ -72,8 +71,7 @@ */ @Bean @Override - public AuthenticationManager authenticationManagerBean() throws Exception - { + public AuthenticationManager authenticationManagerBean() throws Exception { return super.authenticationManagerBean(); } @@ -93,8 +91,7 @@ * authenticated | 鐢ㄦ埛鐧诲綍鍚庡彲璁块棶 */ @Override - protected void configure(HttpSecurity httpSecurity) throws Exception - { + protected void configure(HttpSecurity httpSecurity) throws Exception { // 娉ㄨВ鏍囪鍏佽鍖垮悕璁块棶鐨剈rl ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry registry = httpSecurity.authorizeRequests(); permitAllUrl.getUrls().forEach(url -> registry.antMatchers(url).permitAll()); @@ -111,14 +108,11 @@ // 杩囨护璇锋眰 .authorizeRequests() // 瀵逛簬鐧诲綍login 娉ㄥ唽register 楠岃瘉鐮乧aptchaImage 鍏佽鍖垮悕璁块棶 - .antMatchers("/login", "/register", "/captchaImage","/qrcode/generateStaticHtml","/qrcode/getQRcode","/qrcode/getFormDate","/chat","/system/file/admin/uploadFile").permitAll() + .antMatchers("/login", "/register", "/captchaImage", "/qrcode/generateStaticHtml", "/qrcode/getQRcode", "/qrcode/getFormDate", "/chat", "/system/file/admin/uploadFile", "/smartor/dingtalk/sendNotification", "/patient/read/patientInfo","/socket","/API_ESB_Service","/API_ESB_Service/Run").permitAll() // 闈欐�佽祫婧愶紝鍙尶鍚嶈闂� - .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll() - .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll() + .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll().antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll() // 闄や笂闈㈠鐨勬墍鏈夎姹傚叏閮ㄩ渶瑕侀壌鏉冭璇� - .anyRequest().authenticated() - .and() - .headers().frameOptions().disable(); + .anyRequest().authenticated().and().headers().frameOptions().disable(); // 娣诲姞Logout filter httpSecurity.logout().logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler); // 娣诲姞JWT filter @@ -132,8 +126,7 @@ * 寮烘暎鍒楀搱甯屽姞瀵嗗疄鐜� */ @Bean - public BCryptPasswordEncoder bCryptPasswordEncoder() - { + public BCryptPasswordEncoder bCryptPasswordEncoder() { return new BCryptPasswordEncoder(); } @@ -141,8 +134,7 @@ * 韬唤璁よ瘉鎺ュ彛 */ @Override - protected void configure(AuthenticationManagerBuilder auth) throws Exception - { + protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.userDetailsService(userDetailsService).passwordEncoder(bCryptPasswordEncoder()); } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/EquipmentinfoServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/EquipmentinfoServiceImpl.java index d64c1ed..078313f 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/EquipmentinfoServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/EquipmentinfoServiceImpl.java @@ -117,7 +117,7 @@ DingTalkReqVo dingTalkReqVo = new DingTalkReqVo(); //璁剧疆鍙戦�佸唴瀹� dingTalkReqVo.setContents(null); - dingTalkReqVo.setDeptId(reportReqVo.getDealDeptID()); + dingTalkReqVo.setDeptId(Long.valueOf(reportReqVo.getDealDeptID())); dingTalkReqVo.setUserId(reportReqVo.getDealPersionDingNO()); aBoolean = dingTalkService.sendNotification(dingTalkReqVo); } diff --git a/smartor/src/main/java/com/smartor/domain/DingTalkReqVo.java b/smartor/src/main/java/com/smartor/domain/DingTalkReqVo.java index 9d195b5..30c7325 100644 --- a/smartor/src/main/java/com/smartor/domain/DingTalkReqVo.java +++ b/smartor/src/main/java/com/smartor/domain/DingTalkReqVo.java @@ -1,16 +1,12 @@ package com.smartor.domain; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.core.domain.BaseEntity; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import java.util.Date; import java.util.List; +import java.util.concurrent.ConcurrentHashMap; /** * 閽夐拤娑堟伅鍙戦�� @@ -26,17 +22,34 @@ * 鍙戦�佸唴瀹� */ @ApiModelProperty(value = "鍙戦�佸唴瀹�") - private List<String> contents; + private List<ConcurrentHashMap<String, String>> contents; /** * 鐢ㄦ埛閽夐拤鍙� */ - @ApiModelProperty(value = "鐢ㄦ埛閽夐拤鍙�") - private String userId; + @ApiModelProperty(value = "鐢ㄦ埛鎵嬫満鍙�") + private String number; /** * 閮ㄩ棬ID */ @ApiModelProperty(value = "閮ㄩ棬ID") - private String deptId; + private Long deptId; + + /** + * 鍙戦�佹秷鎭殑鏍囬 + */ + @ApiModelProperty(value = "鍙戦�佹秷鎭殑鏍囬") + private String title; + + /** + * 璺宠浆url + */ + @ApiModelProperty(value = "璺宠浆url") + private String url; + /** + * 璺宠浆url + */ + @ApiModelProperty(value = "璺宠浆url") + private String userId; } diff --git a/smartor/src/main/java/com/smartor/domain/ServiceThirdData.java b/smartor/src/main/java/com/smartor/domain/ServiceThirdData.java new file mode 100644 index 0000000..444a6ba --- /dev/null +++ b/smartor/src/main/java/com/smartor/domain/ServiceThirdData.java @@ -0,0 +1,74 @@ +package com.smartor.domain; + + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +/** + * 绗笁鏂瑰巶鍟嗘暟鎹璞� service_third_data + * + * @author ruoyi + * @date 2023-10-10 + */ +@Data +@ApiModel("绗笁鏂瑰巶鍟嗘暟鎹�") +public class ServiceThirdData { + + /** + * $column.columnComment + */ + @ApiModelProperty("$column.columnComment") + //鏁版嵁搴撹嚜澧炴敼鎴怈TableId(type = IdType.AUTO) + private Long id; + + /** + * 鏁版嵁绫诲瀷 + */ + @ApiModelProperty("鏁版嵁绫诲瀷") + @Excel(name = "鏁版嵁绫诲瀷") + private String dataType; + + /** + * 鏁版嵁绫诲瀷瑙i噴 + */ + @ApiModelProperty("鏁版嵁绫诲瀷瑙i噴") + @Excel(name = "鏁版嵁绫诲瀷瑙i噴") + private String dataTypeExplain; + + /** + * 鏁版嵁瀛樺偍 + */ + @ApiModelProperty("鏁版嵁瀛樺偍") + @Excel(name = "鏁版嵁瀛樺偍") + private String dataInfo; + + /** + * 鍘傚晢 + */ + @ApiModelProperty("鍘傚晢") + @Excel(name = "鍘傚晢") + private String factory; + + + /** + * 鍒涘缓鏃堕棿 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createTime; + + /** + * 鏁版嵁鏄惁澶勭悊1锛�0鏈鐞嗭紝1宸插鐞� + */ + @ApiModelProperty("鏁版嵁鏄惁澶勭悊1锛�0鏈鐞嗭紝1宸插鐞�") + @Excel(name = "鏁版嵁鏄惁澶勭悊1锛�0鏈鐞嗭紝1宸插鐞�") + private Integer isDeal; + + +} + diff --git a/smartor/src/main/java/com/smartor/mapper/ServiceThirdDataMapper.java b/smartor/src/main/java/com/smartor/mapper/ServiceThirdDataMapper.java new file mode 100644 index 0000000..1b98cf3 --- /dev/null +++ b/smartor/src/main/java/com/smartor/mapper/ServiceThirdDataMapper.java @@ -0,0 +1,32 @@ +package com.smartor.mapper; + + +import com.smartor.domain.ServiceThirdData; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 绗笁鏂瑰巶鍟嗘暟鎹甅apper鎺ュ彛 + * + * @author ruoyi + * @date 2023-10-10 + */ +@Mapper +public interface ServiceThirdDataMapper { + /** + * 鏌ヨ绗笁鏂瑰巶鍟嗘暟鎹垪琛� + * + * @param serviceThirdData 绗笁鏂瑰巶鍟嗘暟鎹� + * @return 绗笁鏂瑰巶鍟嗘暟鎹泦鍚� + */ + public List<ServiceThirdData> selectServiceThirdDataList(ServiceThirdData serviceThirdData); + + /** + * 鏂板鐭俊鍙傛暟 + * + * @param serviceThirdData 鐭俊鍙傛暟 + * @return 缁撴灉 + */ + public int insertThirdData(ServiceThirdData serviceThirdData); +} diff --git a/smartor/src/main/java/com/smartor/service/IServiceThirdDataService.java b/smartor/src/main/java/com/smartor/service/IServiceThirdDataService.java new file mode 100644 index 0000000..0db374f --- /dev/null +++ b/smartor/src/main/java/com/smartor/service/IServiceThirdDataService.java @@ -0,0 +1,22 @@ +package com.smartor.service; + +import java.util.List; + +import com.smartor.domain.ServiceThirdData; + +/** + * 绗笁鏂瑰巶鍟嗘暟鎹甋ervice鎺ュ彛 + * + * @author ruoyi + * @date 2023-10-10 + */ +public interface IServiceThirdDataService { + + /** + * 鏌ヨ绗笁鏂瑰巶鍟嗘暟鎹垪琛� + * + * @param serviceThirdData 绗笁鏂瑰巶鍟嗘暟鎹� + * @return 绗笁鏂瑰巶鍟嗘暟鎹泦鍚� + */ + public List<ServiceThirdData> queryList(ServiceThirdData serviceThirdData); +} diff --git a/smartor/src/main/java/com/smartor/service/RemoteDataSaveService.java b/smartor/src/main/java/com/smartor/service/RemoteDataSaveService.java new file mode 100644 index 0000000..2f9b78c --- /dev/null +++ b/smartor/src/main/java/com/smartor/service/RemoteDataSaveService.java @@ -0,0 +1,41 @@ +package com.smartor.service; + + +import java.util.List; +import java.util.Map; + +/** + * 杩滅▼鏁版嵁淇濆瓨鎺ュ彛 + * + * @author ls + * @date 2023-10-10 + */ +public interface RemoteDataSaveService { + public void dealData(Map<String, List> map, String dataInfo); + + /** + * 鎮h�呭熀鏈俊鎭� + * + * @param map + * @return 鎮h�呭熀鏈俊鎭� + */ + public Boolean patientInfo(Map<String, List> map); + + /** + * 鎮h�呭熀鏈俊鎭慨鏀� + * + * @param map + * @return + */ + public Boolean patientInfoEdit(Map<String, List> map); + + /** + * 鎮h�呭叆闄� + * + * @param map + * @return + */ + public Boolean patientHospitalized(Map<String, List> map); + + +} diff --git a/smartor/src/main/java/com/smartor/service/impl/DingTalkServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/DingTalkServiceImpl.java index 423b906..69303b5 100644 --- a/smartor/src/main/java/com/smartor/service/impl/DingTalkServiceImpl.java +++ b/smartor/src/main/java/com/smartor/service/impl/DingTalkServiceImpl.java @@ -7,12 +7,14 @@ import com.dingtalk.api.request.OapiGettokenRequest; import com.dingtalk.api.request.OapiMessageCorpconversationAsyncsendV2Request; import com.dingtalk.api.request.OapiUserListidRequest; +import com.dingtalk.api.request.OapiV2UserGetbymobileRequest; import com.dingtalk.api.response.OapiGettokenResponse; import com.dingtalk.api.response.OapiMessageCorpconversationAsyncsendV2Response; import com.dingtalk.api.response.OapiUserListidResponse; +import com.dingtalk.api.response.OapiV2UserGetbymobileResponse; +import com.ruoyi.common.utils.StringUtils; import com.smartor.domain.DingTalkReqVo; import com.smartor.service.DingTalkService; -import com.smartor.service.IntelligenceCenterService; import com.taobao.api.ApiException; import lombok.extern.log4j.Log4j; import org.springframework.beans.factory.annotation.Value; @@ -20,7 +22,8 @@ import java.util.ArrayList; import java.util.List; - +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; /** * 鏅鸿兘涓績 * @@ -40,61 +43,85 @@ @Override public Boolean sendNotification(DingTalkReqVo dingTalkReqVo) { + String body = null; + List<String> userIdlist = new ArrayList(); Boolean result = false; log.info("鍙戦�侀拤閽夐�氱煡"); + String accessToken = null; try { accessToken = getAccessToken(); } catch (ApiException e) { e.printStackTrace(); } - DingTalkClient client3 = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/user/listid"); + if (StringUtils.isNotEmpty(dingTalkReqVo.getNumber())) { + DingTalkClient clientT = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/v2/user/getbymobile"); + OapiV2UserGetbymobileRequest req = new OapiV2UserGetbymobileRequest(); + req.setMobile(dingTalkReqVo.getNumber()); + OapiV2UserGetbymobileResponse rsp = null; + try { + rsp = clientT.execute(req, accessToken); + body = rsp.getBody(); + String jsonObject = JSONObject.parseObject(body).getJSONObject("result").get("userid").toString(); + userIdlist.add(jsonObject); - OapiUserListidRequest request2 = new OapiUserListidRequest(); - request2.setDeptId(675909059L); // 璁剧疆瑕佽幏鍙栫殑閮ㄩ棬 ID锛岃繖閲屼互鏍归儴闂ㄤ负渚� - // 璁剧疆閮ㄩ棬 ID锛屽鏋滆幏鍙栨墍鏈夊憳宸ユ墜鏈哄彿锛屽彲浠ヨ缃负鏍归儴闂ㄧ殑 ID - OapiUserListidResponse response2 = null; - try { - response2 = client3.execute(request2, accessToken); - } catch (ApiException e) { - e.printStackTrace(); + } catch (ApiException e) { + e.printStackTrace(); + } + } else { + DingTalkClient client3 = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/user/listid"); + + OapiUserListidRequest request2 = new OapiUserListidRequest(); + request2.setDeptId(dingTalkReqVo.getDeptId()); // 璁剧疆瑕佽幏鍙栫殑閮ㄩ棬 ID锛岃繖閲屼互鏍归儴闂ㄤ负渚�675909059L + // 璁剧疆閮ㄩ棬 ID锛屽鏋滆幏鍙栨墍鏈夊憳宸ユ墜鏈哄彿锛屽彲浠ヨ缃负鏍归儴闂ㄧ殑 ID + OapiUserListidResponse response2 = null; + try { + response2 = client3.execute(request2, accessToken); + } catch (ApiException e) { + e.printStackTrace(); + } + body = response2.getBody(); + // 瑙f瀽涓篔SONObject + JSONObject jsonObject = JSONObject.parseObject(body); + // 鎻愬彇鍑篔SONArray + JSONArray jsonArray = new JSONArray(jsonObject.getJSONObject("result").getJSONArray("userid_list")); + // 灏咼SONArray杞负List鍒楄〃 + String str = JSONObject.toJSONString(jsonArray); + userIdlist = JSONObject.parseObject(str, List.class); } - String body = response2.getBody(); - // 瑙f瀽涓篔SONObject - JSONObject jsonObject = JSONObject.parseObject(body); - // 鎻愬彇鍑篔SONArray - JSONArray jsonArray = new JSONArray(jsonObject.getJSONObject("result").getJSONArray("userid_list")); - // 灏咼SONArray杞负List鍒楄〃 - String str = JSONObject.toJSONString(jsonArray); - List<String> list = JSONObject.parseObject(str, List.class); + //userid鏁扮粍 - for (String urid : list) { + for (String urid : userIdlist) { DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2"); OapiMessageCorpconversationAsyncsendV2Request request = new OapiMessageCorpconversationAsyncsendV2Request(); request.setUseridList(urid); request.setAgentId(1779052814L); request.setToAllUser(false); - List<String> contents = dingTalkReqVo.getContents(); + //鍙戦�佸唴瀹瑰鐞� + List<ConcurrentHashMap<String, String>> contents = dingTalkReqVo.getContents(); ArrayList<OapiMessageCorpconversationAsyncsendV2Request.Form> objects = new ArrayList<>(); for (int i = 0; i < contents.size(); i++) { - OapiMessageCorpconversationAsyncsendV2Request.Form formSeverityDesc = new OapiMessageCorpconversationAsyncsendV2Request.Form(); - formSeverityDesc.setKey("闂" + i); - formSeverityDesc.setValue(contents.get(i).toString()); - objects.add(formSeverityDesc); + ConcurrentHashMap<String, String> map = contents.get(i); + for (Map.Entry<String, String> entry : map.entrySet()) { + OapiMessageCorpconversationAsyncsendV2Request.Form formSeverityDesc = new OapiMessageCorpconversationAsyncsendV2Request.Form(); + formSeverityDesc.setKey(entry.getKey()); + formSeverityDesc.setValue(entry.getValue()); + objects.add(formSeverityDesc); + } } OapiMessageCorpconversationAsyncsendV2Request.Msg msg = new OapiMessageCorpconversationAsyncsendV2Request.Msg(); msg.setOa(new OapiMessageCorpconversationAsyncsendV2Request.OA()); - msg.getOa().setMessageUrl("https://www.baidu.com"); - msg.getOa().setPcMessageUrl("https://www.baidu.com"); + msg.getOa().setMessageUrl(dingTalkReqVo.getUrl()); + msg.getOa().setPcMessageUrl(dingTalkReqVo.getUrl()); msg.getOa().setHead(new OapiMessageCorpconversationAsyncsendV2Request.Head()); - msg.getOa().getHead().setText("寰呭姙浜嬪疁"); + // msg.getOa().getHead().setText("浣犲湪璇村暐鍛㈢粧椤舵浛鑻涘ず闃挎柉钂傝姮闃挎柉钂傝姮"); msg.getOa().getHead().setBgcolor("00409eff"); msg.getOa().setBody(new OapiMessageCorpconversationAsyncsendV2Request.Body()); - msg.getOa().getBody().setTitle("灏婃暚鐨� " + "AAA" + "(椤圭洰缁忕悊)"); - msg.getOa().getBody().setContent("寰呭鎵�:" + "123" + "鏉�"); + msg.getOa().getBody().setTitle(dingTalkReqVo.getTitle()); + // msg.getOa().getBody().setContent("寰呭鐞�:" + "123" + "鏉�"); msg.getOa().getBody().setForm(objects); msg.setMsgtype("oa"); diff --git a/smartor/src/main/java/com/smartor/service/impl/RemoteDataSaveServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/RemoteDataSaveServiceImpl.java new file mode 100644 index 0000000..a58461e --- /dev/null +++ b/smartor/src/main/java/com/smartor/service/impl/RemoteDataSaveServiceImpl.java @@ -0,0 +1,121 @@ +package com.smartor.service.impl; + +import com.github.pagehelper.util.StringUtil; +import com.ruoyi.common.enums.FollowUpEnum; +import com.ruoyi.common.utils.spring.SpringUtils; +import com.smartor.domain.ServiceThirdData; +import com.smartor.mapper.ServiceThirdDataMapper; +import com.smartor.service.RemoteDataSaveService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.applet.AppletContext; +import java.text.SimpleDateFormat; +import java.util.*; + +/** + * 銆愯濉啓鍔熻兘鍚嶇О銆慡ervice涓氬姟灞傚鐞� + * + * @author ruoyi + * @date 2023-05-25 + */ +@Service +public class RemoteDataSaveServiceImpl implements RemoteDataSaveService { + + /** + * 鏁版嵁澶勭悊 + * + * @param map + */ + @Override + public void dealData(Map<String, List> map, String dataInfo) { + if (CollectionUtils.isEmpty(map)) { + return; + } + + //鏍规嵁鏂囨。寰楃煡锛岀8涓紙浠�0寮�濮嬶級灏辨槸鏁版嵁绫诲瀷 + List msh = map.get("MSH"); + String result = msh.get(8).toString(); + + //鑾峰彇鍒版渶鍚庝竴涓�� ^ 鈥濈殑浣嶇疆,鏂逛究涓嬮潰鎴彇鏁版嵁绫诲瀷锛堝氨鏄彂杩囨潵鐨勫唴瀹规槸鍟ワ級 + int endIndex = result.lastIndexOf("^"); + String dataType = result.substring(0, endIndex); + System.out.println("dataType : " + dataType); + ServiceThirdData serviceThirdData = new ServiceThirdData(); + serviceThirdData.setDataType(dataType); + serviceThirdData.setDataTypeExplain(FollowUpEnum.getDescByCode(dataType)); + //姝ゅ涓嶈兘鐢╩ap鐨勬暟鎹紝鍥犱负鏈夌殑鏁版嵁鐨凨EY鍙兘鏄竴鏍风殑锛屾墍浠ョ敤string閲岀殑鏁版嵁 + serviceThirdData.setDataInfo(dataInfo); + serviceThirdData.setFactory("鑱斾紬"); + serviceThirdData.setIsDeal(0); + serviceThirdData.setCreateTime(new Date()); + + //姝ゅ寮曚笉鍒皊ping涓殑mapper,鍙兘閫氳繃涓婁笅鏂囷紝鍘昏幏鍙杕apper瀵硅薄 + ServiceThirdDataMapper serviceThirdDataMapper = SpringUtils.getBean(ServiceThirdDataMapper.class); + try { + int i = serviceThirdDataMapper.insertThirdData(serviceThirdData); + } catch (Exception e) { + SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("YYYY-MM-dd HH:mm:ss"); + String date = simpleDateFormat1.format(new Date()); + System.out.println(date + " 鎶ラ敊鏃堕棿锛屾湭鎻掑叆鐨勬暟鎹� : " + dataInfo); + e.getMessage(); + } + + +// //鏍规嵁鏁版嵁绫诲瀷锛屽幓璋冪敤鐩稿簲鐨勬柟娉曡繘琛屾暟鎹繚瀛�(杩欎竴鍧楀厛涓嶅仛浜嗭紝鍚庨潰鍐嶅仛) +// switch (dataType) { +// case "ADT^A31": +// //鎮h�呭熀鏈俊鎭� +// patientInfo(map); +// break; +// case "ADT^A08": +// //鎮h�呰瘖鏂俊鎭慨鏀�/ +// patientInfoEdit(map); +// case "ADT^A01": +// //鎮h�呭叆闄� +// patientHospitalized(map); +// break; +// } + } + + /** + * 鎮h�呭熀鏈俊鎭� + * + * @param map + * @return + */ + @Override + public Boolean patientInfo(Map<String, List> map) { + System.out.println("patientInfo鎮h�呭熀鏈俊鎭� : " + map); + return null; + } + + /** + * 鎮h�呰瘖鏂俊鎭慨鏀� + * + * @param map + * @return + */ + @Override + public Boolean patientInfoEdit(Map<String, List> map) { + System.out.println("patientInfoEdit鎮h�呰瘖鏂俊鎭慨鏀� : " + map); + + return null; + } + + /** + * 鎮h�呭叆闄� + * + * @param map + * @return + */ + @Override + public Boolean patientHospitalized(Map<String, List> map) { + System.out.println("patientHospitalized鎮h�呭叆闄� : " + map); + + return null; + } + + +} diff --git a/smartor/src/main/java/com/smartor/service/impl/ServiceThirdDataServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/ServiceThirdDataServiceImpl.java new file mode 100644 index 0000000..bbfb7fc --- /dev/null +++ b/smartor/src/main/java/com/smartor/service/impl/ServiceThirdDataServiceImpl.java @@ -0,0 +1,24 @@ +package com.smartor.service.impl; + +import java.util.List; + +import com.smartor.domain.ServiceThirdData; +import com.smartor.service.IServiceThirdDataService; +import org.springframework.stereotype.Service; + + +/** + * 绗笁鏂瑰巶鍟嗘暟鎹甋ervice涓氬姟灞傚鐞� + * + * @author ruoyi + * @date 2023-10-10 + */ +@Service +public class ServiceThirdDataServiceImpl implements IServiceThirdDataService { + + + @Override + public List<ServiceThirdData> queryList(ServiceThirdData serviceThirdData) { + return null; + } +} diff --git a/smartor/src/main/resources/mapper/smartor/ServiceThirdDataMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceThirdDataMapper.xml new file mode 100644 index 0000000..36c8f52 --- /dev/null +++ b/smartor/src/main/resources/mapper/smartor/ServiceThirdDataMapper.xml @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.smartor.mapper.ServiceThirdDataMapper"> + + <resultMap type="com.smartor.domain.ServiceThirdData" id="ServiceThirdDataResult"> + <result property="id" column="id"/> + <result property="dataType" column="data_type"/> + <result property="dataTypeExplain" column="data_tepe_explain"/> + <result property="dataInfo" column="data_info"/> + <result property="factory" column="factory"/> + <result property="createTime" column="create_time"/> + <result property="isDeal" column="is_deal"/> + </resultMap> + + <sql id="selectServiceThirdDataVo"> + select id, data_type, data_type_explain, data_info, factory, create_time, is_deal + from service_third_data + </sql> + + <select id="selectServiceThirdDataList" parameterType="com.smartor.domain.ServiceThirdData" + resultMap="ServiceThirdDataResult"> + <include refid="selectServiceThirdDataVo"/> + <where> + <if test="dataType != null and dataType != ''">and data_type = #{dataType}</if> + <if test="dataTypeExplain != null and dataTypeExplain != ''">and data_type_explain = #{dataTypeExplain} + </if> + <if test="dataInfo != null and dataInfo != ''">and data_info = #{dataInfo}</if> + <if test="factory != null and factory != ''">and factory = #{factory}</if> + <if test="isDeal != null">and is_deal = #{isDeal}</if> + </where> + </select> + + <insert id="insertThirdData" parameterType="com.smartor.domain.ServiceThirdData"> + insert into service_third_data + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="dataType != null">data_type,</if> + <if test="dataTypeExplain != null">data_type_explain,</if> + <if test="dataInfo != null">data_info,</if> + <if test="factory != null">factory,</if> + <if test="createTime != null">create_time,</if> + <if test="isDeal != null">is_deal,</if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="dataType != null">#{dataType},</if> + <if test="dataTypeExplain != null">#{dataTypeExplain},</if> + <if test="dataInfo != null">#{dataInfo},</if> + <if test="factory != null">#{factory},</if> + <if test="createTime != null">#{createTime},</if> + <if test="isDeal != null">#{isDeal}</if> + </trim> + </insert> + +</mapper> \ No newline at end of file -- Gitblit v1.9.3