帮我将下面的内容翻译成英文并注意不要有语法和词汇错误:图5-18展示的后端代码是一个Java Spring Boot的Controller方法用于实现修改角色权限功能。RequiresPermissionssysroleupdate是一个Shiro的权限控制注解表示只有具有sysroleupdate权限的用户才能访问该方法。public R updateRequestBody SysRoleEnt
The backend code shown in Figure 5-18 is a Java Spring Boot Controller method used to implement the function of modifying role permissions. The @RequiresPermissions("sys:role:update") is a Shiro permission control annotation, which means that only users with the "sys:role:update" permission can access this method. The public R update(@RequestBody SysRoleEntity role) is a public method that returns an R object. The @RequestBody annotation is used to convert the JSON format data in the request body into a SysRoleEntity object. SysRoleEntity is an entity class used to store role information. ValidatorUtils.validateEntity(role) is a custom validation method used to validate whether the SysRoleEntity object meets the standards. role.setCreateUserId(getUserId()) is used to set the ID of the creator for the SysRoleEntity object, using a getUserId() method to get the ID of the current user. sysRoleService.update(role) is used to call the update method of the sysRoleService, which updates the modified role permission information to the database. return R.ok() returns an R object, indicating that the modification was successful. The R object is a custom response class that contains response code and response message information.
Figure 5-19 shows the menu management interface for the system administrator, and the backend code in Figure 5-20 explains how to implement the deletion of menu contents. This code is a Spring Boot Controller method used to handle HTTP DELETE requests and delete the specified menu ID. First, the code checks whether the menu ID passed in is a system menu (ID less than or equal to 31), and if so, returns an error message indicating that system menus cannot be deleted. Then, the code checks whether there are any child menus or buttons for the menu. If there are, an error message is returned, indicating that the child menus or buttons must be deleted first before the menu can be deleted. Finally, if there are no child menus or buttons, the sysMenuService's delete method is called to delete the menu, and a success message is returned.
According to the system requirements analysis and system design, the hospital operator's end of the system mainly includes four information management functions: medical insurance information management, medical treatment information management, medical insurance reimbursement information management, and problem feedback management, mainly implementing the functions of adding, deleting, modifying, and querying them. Since the implementation of the information add, delete, modify, and query functions has been explained in the system administrator module, and the problem feedback management function in the patient end is more comprehensive, the following mainly describes the medical insurance information interface, medical treatment information interface, and medical insurance reimbursement information interface in the system operator end.
Figure 5-21 shows the medical insurance information management interface for the hospital operator end.
Figure 5-22 shows the medical treatment information management interface for the hospital operator end.
Figure 5-23 shows the medical insurance reimbursement information management interface for the hospital operator end.
According to the system requirements analysis and system design, the patient end function menu is the same as the hospital operator end, but the patient end mainly implements the viewing function of medical insurance information, medical treatment information, and medical insurance reimbursement information, as well as the problem feedback management function. In addition, the most important function of the patient end is to implement the download of the medical insurance reimbursement list PDF file. Since the implementation method of the information viewing function has been explained above, the following will mainly describe the download function and problem feedback management.
Figure 5-24, Figure 5-25, and Figure 5-26 show the interface flow of the system medical insurance reimbursement list PDF file download. First, you need to click the button and select the patient's medical insurance reimbursement information row, and then click the export PDF button. The PDF file will be downloaded to the browser's set download path by default. Open the PDF file to see the patient's personal medical insurance reimbursement list content.
The frontend code shown in Figure 5-27 is a method used to convert the current component into a PDF file and download it, so that users can save or print it. First, the code switches the status of whether to display the select column, and then executes the following code after waiting for 3 seconds. Create a jsPDF object, specify the page orientation as portrait, and the page size as A4. Next, get the selected row data. If no data is selected, use all the data by default. Then use the html2canvas library to convert the entire component to image data and add it to the PDF, setting the PDF page width and height, and calculating the height that each row of data should occupy. Finally, add the image data to the PDF and adjust the position. The downloaded PDF file is saved and named as "Medical Insurance Reimbursement List.pdf".
The backend code shown in Figure 5-28 implements an interface for exporting PDF files. The request method of the interface is POST, and the request body is an integer array, which represents the IDs of the medical reimbursement records that need to be exported. The exported PDF file will contain the selected reimbursement record information.
First, the code defines the export file path as /data/pdf/export.pdf. Then, create a ByteArrayOutputStream object to save the binary data of the PDF file. Use the iText library to create a PDF document object and write it to the ByteArrayOutputStream object. Add a title, blank lines, and a reimbursement record table to the PDF document, and get the reimbursement record data that needs to be exported and fill it into the table. Add export time information to the PDF document and close the PDF document object. Finally, save the binary data in the ByteArrayOutputStream object to the export file path and write it to the output stream of the HttpServletResponse object, implementing the function of sending a PDF file to the browser.
The implementation process of the entire interface is more complicated, including multiple steps such as creating a PDF document, filling in data, and outputting files. The iText library involved is also a powerful PDF processing tool that can easily implement functions such as PDF file creation, text insertion, and table generation.
The backend code shown in Figure 5-29 is a Spring Boot Controller method used to export and download medical reimbursement records in PDF format. The code sets the produces attribute to MediaType.APPLICATION_PDF_VALUE, indicating that the content returned by this method is in PDF format. The parameter list includes two parameters, ids and response. ids is an Integer array used to specify the IDs of the medical reimbursement records that need to be exported. response is of the HttpServletResponse type and is used to output the PDF file stream to the client. Then, set the ContentType attribute of response to "application/pdf", indicating that the output content is in PDF format. Then set the Content-Disposition attribute of response to "attachment; filename=medical_reimbursement.pdf", indicating that the output PDF file is downloaded as an attachment.
Next, create a Document object and set the page size to A4 portrait. Create a PdfWriter object and bind the output stream to it. Open the Document object. Create a PdfPTable object to hold the table data. Set the table to have 12 columns, with a width ratio of 1:6:3:3:5:5:8:5:8:5:5:7 for each column. Add a table header, including the record ID, patient name, patient gender, patient age, medical number, insurance number, medical project, medical cost, reimbursement project, reimbursement amount, reimbursement time, and creation time.
Get the medical reimbursement record list to be exported based on the ids parameter. If ids is empty, export all records. Traverse the medical reimbursement record list and add data to the table row by row. Add the table to the Document. Close the Document object and refresh the output stream. Define a helper method getCell to create a cell object. This method accepts a string parameter as the content of the cell and sets the vertical alignment of the cell to center and the horizontal alignment to center.
Figure 5-30 shows the system problem feedback management interface, and Figure 5-31 shows the interface for querying based on the insurance number in problem feedback management. The backend code in Figure 5-32 explains the query method. It represents a Spring MVC controller method that is executed when the path is "/info/{id}". {id} is a path variable that represents the ID of the feedback record. This method requires the user to have the "hospital:feedback:info" permission to access it. The method will call the getById method of feedbackService to get the feedback record with the specified ID and encapsulate the record into a FeedbackEntity object. Finally, a successful response object will be constructed through the R.ok() method, and the obtained feedback record will be placed in the response body and returned to the client. R is a custom response object used to encapsulate HTTP response status code, message, data, and other information
原文地址: https://www.cveoy.top/t/topic/flN8 著作权归作者所有。请勿转载和采集!