Document generation method, device, electronic device and storage medium
By receiving document generation instructions and replacing variables in the template, and using preset tags to process judicial document templates, the problem of redundant personnel information in document generation is solved, automated processing is realized, and the efficiency of document generation is improved.
Patent Information
- Application Number
- CN202010859944.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-24
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2040-08-24
AI Technical Summary
In the existing judicial document generation method, the personnel information part in the document template is redundant when there is no information, resulting in low generation efficiency and requiring manual deletion, which affects the efficiency of document generation.
By receiving document generation instructions, the target template is determined, and elements in the template are replaced according to the carried variables, and preset tags are used for display, hiding and logical judgment processing to generate the target document and avoid manual processing.
It improves the efficiency of document generation, automatically hides or displays document content, reduces manual processing steps, and improves the automation level of document generation.
Smart Images

Figure CN112001159B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a document generation method, device, electronic device and storage medium. Background Art
[0002] At present, due to the fixed structure of judicial documents, the generation of judicial documents can be achieved through document templates with fixed content and the use of text tags in designated locations to replace words that may change, such as case numbers and causes of action. However, in practice, it is found that in the document template that displays the basic information of the three types of personnel, there are fixed content and personnel information tags, but if there is no information about the three types of personnel, this part of the content is redundant and needs to be deleted after the judicial document is generated, making the document template of the judicial document inconvenient to use and the efficiency of document generation low.
[0003] Therefore, how to improve the efficiency of document generation is a technical problem that needs to be solved urgently. Summary of the invention
[0004] In view of the above, it is necessary to provide a document generation method, device, electronic device and storage medium that can improve the efficiency of document generation.
[0005] A first aspect of the present invention provides a document generation method, the document generation method comprising:
[0006] Receive document generation instructions;
[0007] Determining a target template according to the template identifier carried by the document generation instruction;
[0008] According to the variables carried by the document generation instruction, the elements in the target template are replaced to obtain a replacement document;
[0009] According to the preset label of the replacement document, the replacement document is processed accordingly to generate a target document, wherein the processing includes display processing, hiding processing and logical judgment processing.
[0010] In a possible implementation, the preset tag includes a first range tag, and the performing corresponding processing on the replacement document according to the preset tag of the replacement document to generate the target document includes:
[0011] Obtaining a first range tag in the replacement document;
[0012] Determine whether there is a null value element among all elements of the first range tag;
[0013] If there is a null value element among all the elements of the first range tag, all text contents of the first range tag are hidden, the target document is obtained, and the logic judgment process is completed; or
[0014] If there is no empty value element among all the elements of the first range tag, all the text contents of the first range tag are displayed in the replacement document, the target document is obtained, and the logical judgment processing is completed.
[0015] In a possible implementation, the preset tag includes a second range tag, and the performing corresponding processing on the replacement document according to the preset tag of the replacement document to generate the target document includes:
[0016] Obtaining a second range tag in the replacement document;
[0017] Determine whether all elements of the second range tag are null value elements;
[0018] If all elements of the second range tag are null value elements, all text contents of the second range tag are hidden, the target document is obtained, and the logic judgment process is completed; or
[0019] If all elements of the second range tag are not empty value elements, all text contents of the second range tag are displayed in the replacement document, the target document is obtained, and the logical judgment processing is completed.
[0020] In a possible implementation, the preset tag includes a hidden tag, and the step of performing corresponding processing on the replacement document according to the preset tag of the replacement document to generate the target document includes:
[0021] Obtaining hidden tags in the replacement document;
[0022] All text contents in the hidden tag are hidden, the target document is obtained, and the hiding process is completed.
[0023] In a possible implementation, the preset tag includes a display tag, and the performing corresponding processing on the replacement document according to the preset tag of the replacement document to generate the target document includes:
[0024] Obtaining a display tag in the replacement document;
[0025] For each of the display tags, determining whether a display element in the display tag is a null value element;
[0026] If the display element in the display tag is not a null value element, all the contents in the display tag are replaced with the text content corresponding to the display element, the target document is obtained, and the display processing is completed.
[0027] In a possible implementation, the document generation method further includes:
[0028] If the display element in the display tag is a null value element, generating a prompt message;
[0029] The prompt information is sent to a preset terminal device.
[0030] In a possible implementation, replacing elements in the target template according to the variables carried by the document generation instruction to obtain the replacement document includes:
[0031] For each of the variables, determining a replacement element corresponding to the name of the variable from all elements of the target template;
[0032] The replacement element is replaced with the value of the variable.
[0033] A second aspect of the present invention provides a document generation device, the document generation device comprising:
[0034] A receiving module, used for receiving a document generation instruction;
[0035] A determination module, used to determine a target template according to the template identifier carried by the document generation instruction;
[0036] A replacement module, used to replace elements in the target template according to the variables carried by the document generation instruction to obtain a replacement document;
[0037] The processing module is used to perform corresponding processing on the replacement document according to the preset label of the replacement document to generate a target document, wherein the processing includes display processing, hiding processing and logical judgment processing.
[0038] A third aspect of the present invention provides an electronic device, comprising a processor and a memory, wherein the processor is configured to implement the document generation method when executing a computer program stored in the memory.
[0039] A fourth aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, and the computer program implements the document generation method when executed by a processor.
[0040] According to the above technical scheme, in the present invention, the elements of the document template (such as the text content to be replaced) can be replaced according to the preset tags in the document template, and the specified text content can be displayed or hidden without the need for additional manual processing, thereby improving the efficiency of document generation. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 It is a flow chart of a preferred embodiment of a document generation method disclosed in the present invention.
[0042] Figure 2 It is a functional module diagram of a preferred embodiment of a document generation device disclosed in the present invention.
[0043] Figure 3 It is a schematic diagram of the structure of an electronic device of a preferred embodiment of the document generation method of the present invention. DETAILED DESCRIPTION
[0044] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0045] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in the specification of the present invention herein are only for the purpose of describing specific embodiments and are not intended to limit the present invention.
[0046] The document generation method of the embodiment of the present invention is applied in an electronic device, and can also be applied in a hardware environment consisting of an electronic device and a server connected to the electronic device via a network, and is executed by the server and the electronic device together. The network includes but is not limited to: a wide area network, a metropolitan area network or a local area network.
[0047] Among them, a server can refer to a computer system that can provide services to other devices (such as electronic devices) in the network. If a personal computer can provide File Transfer Protocol (FTP) services to the outside world, it can also be called a server. In a narrow sense, a server refers specifically to certain high-performance computers that can provide services to the outside world through the network. Compared with ordinary personal computers, it has higher requirements in terms of stability, security, and performance. Therefore, it is different from ordinary personal computers in terms of hardware such as CPU, chipset, memory, disk system, network, etc.
[0048] The electronic device is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application-specific integrated circuits (ASICs), field programmable gate arrays (FPGAs), digital processors (DSPs), embedded devices, etc. The electronic device may also include network devices and / or user devices. Among them, the network device includes but is not limited to a single network device, a server group composed of multiple network devices, or a cloud composed of a large number of hosts or network devices based on cloud computing (Cloud Computing), wherein cloud computing is a type of distributed computing, a super virtual computer composed of a group of loosely coupled computer sets. The user device includes but is not limited to any electronic product that can interact with the user through a keyboard, mouse, remote control, touchpad or voice control device, such as a personal computer, tablet computer, smart phone, personal digital assistant PDA, etc.
[0049] See also Figure 1 , Figure 1 The flowchart of a preferred embodiment of a document generation method disclosed in the present invention. According to different requirements, the order of the steps in the flowchart can be changed, and some steps can be omitted. The execution subject of the document generation method can be an electronic device.
[0050] S11. Receive document generation instructions.
[0051] The document may refer to a document with a fixed structure, such as legal documents used by courts, procuratorates, public security departments, prisons, etc. to handle litigation and non-litigation cases, and judicial documents with legal effect or legal significance written by or on behalf of parties to a case, lawyers, and law firms. Documents can be batch-produced using fixed document templates.
[0052] In the embodiment of the present invention, a document generation instruction input by a user may be received, and the document generation instruction may be triggered by a designated button.
[0053] As an optional implementation, before receiving the document generation instruction, the method further includes:
[0054] Receive editing instructions for document templates;
[0055] Output the document template to be edited indicated by the editing instruction.
[0056] In this optional implementation, the designated document template can be modified, wherein the document template to be edited can be the designated document template, and the document template to be modified can be selected. After the system receives the corresponding editing instruction, it outputs the designated document template, allowing the user to edit and modify the document template.
[0057] As an optional implementation, after outputting the document template to be edited indicated by the editing instruction, the method further includes:
[0058] Receiving an upload instruction for the document template to be edited;
[0059] The document template to be edited in the server is replaced with the document template carried by the upload instruction.
[0060] In this optional implementation, after outputting the document template to be edited indicated by the editing instruction, the user can edit the document template to be edited, and can upload the edited document template to the server at any time to replace the previous document template.
[0061] S12. Determine a target template according to the template identifier carried by the document generation instruction.
[0062] In an embodiment of the present invention, a unique template identifier can be assigned to each document template, and an association between the template identifier and the document template can be established in advance and saved in a database. After receiving a document generation instruction, a query can be performed in the database based on the template identifier carried by the document generation instruction to determine the document template with the template identifier, that is, the target template.
[0063] S13. Replace the elements in the target template according to the variables carried by the document generation instruction to obtain a replacement document.
[0064] Specifically, replacing the elements in the target template according to the variables carried by the document generation instruction to obtain the replacement document includes:
[0065] For each of the variables, determining a replacement element corresponding to the name of the variable from all elements of the target template;
[0066] The replacement element is replaced with the value of the variable.
[0067] In this optional implementation, the elements refer to the text content in the target template that is marked with a label and needs to be replaced, such as [+defendant+], and the variables specify the values of these elements, such as specifying that the defendant is "Zhang San", where the name of the variable is defendant and the value of the variable is Zhang San, then the element "defendant" in the label can be replaced with "Zhang San".
[0068] S14. According to the preset label of the replacement document, the replacement document is processed accordingly to generate a target document, wherein the processing includes display processing, hiding processing and logical judgment processing.
[0069] The preset tags include a display tag, a hidden tag, a first range tag, and a second range tag. The display tag can be [++], the hidden tag can be [--], the first range tag can be {--}, and the second range tag can be {++}.
[0070] Specifically, the preset tag includes a display tag, and the step of performing corresponding processing on the replacement document according to the preset tag of the replacement document to generate the target document includes:
[0071] Obtaining a display tag in the replacement document;
[0072] For each of the display tags, determining whether a display element in the display tag is a null value element;
[0073] If the display element in the display tag is not a null value element, all the contents in the display tag are replaced with the text content corresponding to the display element, the target document is obtained, and the display processing is completed.
[0074] In this optional implementation, a display tag, "[+...+]" tag, can be used to mark the elements that need to be replaced and displayed, such as "[+ plaintiff's name+]" in the target template, which becomes "[+ Zhang San+]" in the replacement document. When generating the target document, all the contents in the display tag need to be replaced with the text content corresponding to the display element, that is, the value of the variable named plaintiff's name is displayed, and "[+ plaintiff's name+]" in the template corresponds to "[+ Zhang San+]" in the replacement document and corresponds to " Zhang San" in the template document.
[0075] As an optional implementation, the document generation method further includes:
[0076] If the display element in the display tag is a null value element, generating a prompt message;
[0077] The prompt information is sent to a preset terminal device.
[0078] In this optional implementation, if the display element in the display label is an empty value element, i.e. "[++]", a prompt message can be generated, such as: "Plaintiff's name cannot be empty", and the prompt message is sent to a preset terminal device to prompt the user to supplement the corresponding information.
[0079] Specifically, the preset tag includes a hidden tag, and the step of performing corresponding processing on the replacement document according to the preset tag of the replacement document to generate the target document includes:
[0080] Obtaining hidden tags in the replacement document;
[0081] All text contents in the hidden tag are hidden, the target document is obtained, and the hiding process is completed.
[0082] In this optional implementation, a hidden tag, “[-...-]” tag, may be used to mark elements that need to be replaced but do not need to be displayed, such as [-defendant’s name-]; when generating the target document, the text content included in the hidden tag needs to be hidden.
[0083] Specifically, the preset tag includes a first range tag, and the step of performing corresponding processing on the replacement document according to the preset tag of the replacement document to generate the target document includes:
[0084] Obtaining a first range tag in the replacement document;
[0085] Determine whether there is a null value element among all elements of the first range tag;
[0086] If there is a null value element among all the elements of the first range tag, all text contents of the first range tag are hidden, the target document is obtained, and the logic judgment process is completed; or
[0087] If there is no empty value element among all the elements of the first range tag, all the text contents of the first range tag are displayed in the replacement document, the target document is obtained, and the logical judgment processing is completed.
[0088] In this optional implementation, the first range tag, "{-...-}" tag, can be used to mark a paragraph of text, such as "{-Appointed litigation agent: [+Litigation agent's name+], Contact information: [+Litigation agent's contact information+].-}", if one of the elements "Litigation agent's name" and "Litigation agent's contact information" is empty, that is, a null value element, then this paragraph of text will not be displayed. Alternatively, if there is no null value element in the elements "Litigation agent's name" and "Litigation agent's contact information" (for example, the value of "Litigation agent's name" and the value of "Litigation agent's contact information" are not empty), then this paragraph of text content will be displayed.
[0089] Specifically, the preset tag includes a second range tag, and the corresponding processing of the replacement document according to the preset tag of the replacement document to generate the target document includes:
[0090] Obtaining a second range tag in the replacement document;
[0091] Determine whether all elements of the second range tag are null value elements;
[0092] If all elements of the second range tag are null value elements, all text contents of the second range tag are hidden, the target document is obtained, and the logic judgment process is completed; or
[0093] If all elements of the second range tag are not empty value elements, all text contents of the second range tag are displayed in the replacement document, the target document is obtained, and the logical judgment processing is completed.
[0094] In this optional implementation, a second range tag "{+...+}" can be used to mark a paragraph of text. Whether this paragraph of text is displayed is determined based on the value of the elements inside it, such as "{+Appointed litigation agent: [+Litigation agent's name+], Contact information: [+Litigation agent's contact information+].+}". The text in "{+...+}" will be judged based on the values of the elements "Litigation agent's name" and "Litigation agent's contact information". If the values of "Litigation agent's name" and "Litigation agent's contact information" are both empty, the paragraph of text will not be displayed. Alternatively, if the values of "Litigation agent's name" and "Litigation agent's contact information" are not both empty, the paragraph of text will be displayed.
[0095] It should be emphasized that in order to further ensure the privacy and security of the above-mentioned target document, the above-mentioned target document can also be stored in a node of a blockchain.
[0096] exist Figure 1 In the described method flow, the elements of the document template (such as the text content to be replaced) can be replaced according to the preset tags in the document template, and the specified text content can be displayed or hidden without the need for additional manual processing, thereby improving the efficiency of document generation.
[0097] Figure 2 It is a functional module diagram of a preferred embodiment of a document generation device disclosed in the present invention.
[0098] See also Figure 2 The document generation device 20 runs in an electronic device. The document generation device 20 may include a plurality of functional modules composed of program code segments. The program code of each program segment in the document generation device 20 may be stored in a memory and executed by at least one processor to execute Figure 1 Some or all of the steps in the described instrument generation method.
[0099] In this embodiment, the document generation device 20 can be divided into multiple functional modules according to the functions it performs. The functional modules may include: a receiving module 201, a determining module 202, a replacing module 203 and a processing module 204. The module referred to in the present invention refers to a series of computer program segments that can be executed by at least one processor and can perform fixed functions, which are stored in a memory.
[0100] The receiving module 201 is used to receive a document generation instruction.
[0101] The document may refer to a document with a fixed structure, such as legal documents used by courts, procuratorates, public security departments, prisons, etc. to handle litigation and non-litigation cases, and judicial documents with legal effect or legal significance written by or on behalf of parties to a case, lawyers, and law firms. Documents can be batch-produced using fixed document templates.
[0102] In the embodiment of the present invention, a document generation instruction input by a user may be received, and the document generation instruction may be triggered by a designated button.
[0103] The determination module 202 is used to determine the target template according to the template identifier carried by the document generation instruction.
[0104] In an embodiment of the present invention, a unique template identifier can be assigned to each document template, and an association between the template identifier and the document template can be established in advance and saved in a database. After receiving a document generation instruction, a query can be performed in the database based on the template identifier carried by the document generation instruction to determine the document template with the template identifier, that is, the target template.
[0105] The replacement module 203 is used to replace the elements in the target template according to the variables carried by the document generation instruction to obtain a replacement document.
[0106] The processing module 204 is used to perform corresponding processing on the replacement document according to the preset label of the replacement document to generate a target document, wherein the processing includes display processing, hiding processing and logical judgment processing.
[0107] The preset tags include a display tag, a hidden tag, a first range tag, and a second range tag. The display tag can be [++], the hidden tag can be [--], the first range tag can be {--}, and the second range tag can be {++}.
[0108] As an optional implementation, the preset tag includes a hidden tag. The processing module 204 performs corresponding processing on the replacement document according to the preset tag of the replacement document. The specific method of generating the target document is as follows:
[0109] Obtaining hidden tags in the replacement document;
[0110] All text contents in the hidden tag are hidden, the target document is obtained, and the hiding process is completed.
[0111] In this optional implementation, a hidden tag, “[-...-]” tag, may be used to mark elements that need to be replaced but do not need to be displayed, such as [-defendant’s name-]; when generating the target document, the text content included in the hidden tag needs to be hidden.
[0112] As an optional implementation, the preset tag includes a first range tag, and the processing module 204 performs corresponding processing on the replacement document according to the preset tag of the replacement document to generate the target document in the following manner:
[0113] Obtaining a first range tag in the replacement document;
[0114] Determine whether there is a null value element among all elements of the first range tag;
[0115] If there is a null value element among all the elements of the first range tag, all text contents of the first range tag are hidden, the target document is obtained, and the logic judgment process is completed; or
[0116] If there is no empty value element among all the elements of the first range tag, all the text contents of the first range tag are displayed in the replacement document, the target document is obtained, and the logical judgment processing is completed.
[0117] In this optional implementation, the first range tag, "{-...-}" tag, can be used to mark a paragraph of text, such as "{-Appointed litigation agent: [+Litigation agent's name+], Contact information: [+Litigation agent's contact information+].-}", if one of the elements "Litigation agent's name" and "Litigation agent's contact information" is empty, that is, a null value element, then this paragraph of text will not be displayed. Alternatively, if there is no null value element in the elements "Litigation agent's name" and "Litigation agent's contact information" (for example, the value of "Litigation agent's name" and the value of "Litigation agent's contact information" are not empty), then this paragraph of text content will be displayed.
[0118] As an optional implementation, the preset tag includes a second range tag, and the processing module 204 performs corresponding processing on the replacement document according to the preset tag of the replacement document to generate the target document in the following manner:
[0119] Obtaining a second range tag in the replacement document;
[0120] Determine whether all elements of the second range tag are null value elements;
[0121] If all elements of the second range tag are null value elements, all text contents of the second range tag are hidden, the target document is obtained, and the logic judgment process is completed; or
[0122] If all elements of the second range tag are not empty value elements, all text contents of the second range tag are displayed in the replacement document, the target document is obtained, and the logical judgment processing is completed.
[0123] In this optional implementation, a second range tag "{+...+}" can be used to mark a paragraph of text. Whether this paragraph of text is displayed is determined based on the value of the elements inside it, such as "{+Appointed litigation agent: [+Litigation agent's name+], Contact information: [+Litigation agent's contact information+].+}". The text in "{+...+}" will be judged based on the values of the elements "Litigation agent's name" and "Litigation agent's contact information". If the values of "Litigation agent's name" and "Litigation agent's contact information" are both empty, the paragraph of text will not be displayed. Alternatively, if the values of "Litigation agent's name" and "Litigation agent's contact information" are not both empty, the paragraph of text will be displayed.
[0124] As an optional implementation, the preset tag includes a display tag. The processing module 204 performs corresponding processing on the replacement document according to the preset tag of the replacement document. The specific method of generating the target document is as follows:
[0125] Obtaining a display tag in the replacement document;
[0126] For each of the display tags, determining whether a display element in the display tag is a null value element;
[0127] If the display element in the display tag is not a null value element, all the contents in the display tag are replaced with the text content corresponding to the display element, the target document is obtained, and the display processing is completed.
[0128] In this optional implementation, a display tag, "[+...+]" tag, can be used to mark the elements that need to be replaced and displayed, such as "[+ plaintiff's name+]" in the target template, which becomes "[+ Zhang San+]" in the replacement document. When generating the target document, all the contents in the display tag need to be replaced with the text content corresponding to the display element, that is, the value of the variable named plaintiff's name is displayed, and "[+ plaintiff's name+]" in the template corresponds to "[+ Zhang San+]" in the replacement document and corresponds to " Zhang San" in the template document.
[0129] As an optional implementation, the document generating device 20 may further include:
[0130] A generating module, used for generating prompt information if the display element in the display tag is a null value element;
[0131] The sending module is used to send the prompt information to a preset terminal device.
[0132] In this optional implementation, if the display element in the display label is an empty value element, i.e. "[++]", a prompt message can be generated, such as: "Plaintiff's name cannot be empty", and the prompt message is sent to a preset terminal device to prompt the user to supplement the corresponding information.
[0133] As an optional implementation, the replacement module 203 replaces the elements in the target template according to the variables carried by the document generation instruction, and the method of obtaining the replacement document is specifically as follows:
[0134] For each of the variables, determining a replacement element corresponding to the name of the variable from all elements of the target template;
[0135] The replacement element is replaced with the value of the variable.
[0136] In this optional implementation, the elements refer to the text content in the target template that is marked with a label and needs to be replaced, such as [+defendant+], and the variables specify the values of these elements, such as specifying that the defendant is "Zhang San", where the name of the variable is defendant and the value of the variable is Zhang San, then the element "defendant" in the label can be replaced with "Zhang San".
[0137] As an optional implementation, the receiving module 201 is further used to receive an editing instruction for a document template;
[0138] The document generation device 20 may further include:
[0139] The output module is used to output the document template to be edited indicated by the editing instruction.
[0140] In this optional implementation, the designated document template can be modified, wherein the document template to be edited can be the designated document template, and the document template to be modified can be selected. After the system receives the corresponding editing instruction, it outputs the designated document template, allowing the user to edit and modify the document template.
[0141] As an optional implementation, the method further includes:
[0142] The receiving module 201 is further configured to receive an upload instruction for the document template to be edited after the output module outputs the document template to be edited indicated by the editing instruction;
[0143] The replacement module 203 is also used to replace the document template to be edited in the server with the document template carried by the upload instruction.
[0144] In this optional implementation, after outputting the document template to be edited indicated by the editing instruction, the user can edit the document template to be edited, and can upload the edited document template to the server at any time to replace the previous document template.
[0145] exist Figure 2 In the described document generation device 20, the elements of the document template (such as the text content to be replaced) can be replaced according to the preset tags in the document template, and the specified text content can be displayed or the specified text content can be hidden without the need for additional manual processing, thereby improving the efficiency of document generation.
[0146] It should be emphasized that in order to further ensure the privacy and security of the above-mentioned target document, the above-mentioned target document can also be stored in a node of a blockchain.
[0147] like Figure 3 As shown, Figure 3 The electronic device 3 includes a memory 31, at least one processor 32, a computer program 33 stored in the memory 31 and executable on the at least one processor 32, and at least one communication bus 34.
[0148] Those skilled in the art will understand that Figure 3 The schematic diagram shown is merely an example of the electronic device 3 and does not constitute a limitation on the electronic device 3. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the electronic device 3 may also include input and output devices, network access devices, etc.
[0149] The electronic device 3 also includes but is not limited to any electronic product that can interact with the user through a keyboard, mouse, remote control, touch pad or voice control device, such as a personal computer, tablet computer, smart phone, personal digital assistant (PDA), game console, interactive network television (IPTV), smart wearable device, etc. The network where the electronic device 3 is located includes but is not limited to the Internet, wide area network, metropolitan area network, local area network, virtual private network (VPN), etc.
[0150] The at least one processor 32 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, transistor logic devices, discrete hardware components, etc. The processor 32 may be a microprocessor or any conventional processor, etc. The processor 32 is the control center of the electronic device 3, and uses various interfaces and lines to connect various parts of the entire electronic device 3.
[0151] The memory 31 can be used to store the computer program 33 and / or modules / units. The processor 32 implements various functions of the electronic device 3 by running or executing the computer program and / or modules / units stored in the memory 31 and calling the data stored in the memory 31. The memory 31 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the electronic device 3, etc. In addition, the memory 31 can include volatile and non-volatile memories, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, etc.
[0152] Combination Figure 1The memory 31 in the electronic device 3 stores a plurality of instructions to implement a document generation method, and the processor 32 can execute the plurality of instructions to implement:
[0153] Receive document generation instructions;
[0154] Determining a target template according to the template identifier carried by the document generation instruction;
[0155] According to the variables carried by the document generation instruction, the elements in the target template are replaced to obtain a replacement document;
[0156] According to the preset label of the replacement document, the replacement document is processed accordingly to generate a target document, wherein the processing includes display processing, hiding processing and logical judgment processing.
[0157] Specifically, the specific implementation method of the processor 32 for the above instructions can refer to Figure 1 The description of the relevant steps in the corresponding embodiments will not be repeated here.
[0158] exist Figure 3 In the described electronic device 3, the elements of the document template (such as the text content to be replaced) can be replaced according to the preset tags in the document template, and the specified text content can be displayed or hidden without the need for additional manual processing, thereby improving the efficiency of document generation.
[0159] If the module / unit integrated in the electronic device 3 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the process in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program code can be in the form of source code, object code, executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), etc.
[0160] Furthermore, the computer-usable storage medium may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function, etc.; the data storage area may store data created according to the use of the blockchain node, etc.
[0161] The blockchain referred to in this invention is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.
[0162] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.
[0163] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0164] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional modules.
[0165] It is obvious to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential features of the present invention. Therefore, from any point of view, the embodiments should be regarded as exemplary and non-restrictive, and the scope of the present invention is defined by the appended claims rather than the above description, and it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present invention. Any accompanying figure mark in the claims should not be regarded as limiting the claims involved. In addition, it is obvious that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in the system claim may also be implemented by one unit or device through software or hardware. The second and other words are used to indicate names, and do not indicate any particular order.
[0166] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention.
Claims
1. A document generation method, characterized in that: The document generation method comprises: Receive document generation instructions; Determining a target template according to the template identifier carried by the document generation instruction; According to the variables carried by the document generation instruction, the elements in the target template are replaced to obtain a replacement document; According to the preset label of the replacement document, the replacement document is processed accordingly to generate a target document, wherein the processing includes display processing, hiding processing and logical judgment processing; the preset label includes a hidden label, and according to the preset label of the replacement document, the replacement document is processed accordingly to generate a target document, including: obtaining the hidden label in the replacement document; deleting the content in the hidden label to obtain the target document, and completing the hiding processing; The preset tag includes a first range tag, and the corresponding processing of the replacement document according to the preset tag of the replacement document to generate the target document includes: obtaining the first range tag in the replacement document; judging whether there is a null value element among all the elements of the first range tag; if there is a null value element among all the elements of the first range tag, hiding all the text content of the first range tag, obtaining the target document, and completing the logic judgment processing; or if there is no null value element among all the elements of the first range tag, displaying all the text content of the first range tag in the replacement document, obtaining the target document, and completing the logic judgment processing; The preset tag includes a second range tag, and the replacement document is processed accordingly according to the preset tag of the replacement document to generate a target document, including: obtaining the second range tag in the replacement document; determining whether all elements of the second range tag are null value elements; if all elements of the second range tag are null value elements, hiding all text contents of the second range tag, obtaining the target document, and completing the logical judgment processing; or if all elements of the second range tag are not null value elements, displaying all text contents of the second range tag in the replacement document, obtaining the target document, and completing the logical judgment processing.
2. The document generation method according to claim 1, characterized in that: The preset tag includes a display tag, and the processing of the replacement document according to the preset tag of the replacement document to generate the target document includes: Obtaining a display tag in the replacement document; For each of the display tags, determining whether a display element in the display tag is a null value element; If the display element in the display tag is not a null value element, all the contents in the display tag are replaced with the text content corresponding to the display element, the target document is obtained, and the display processing is completed.
3. The document generation method according to claim 2, characterized in that: The document generation method further includes: If the display element in the display tag is a null value element, generating a prompt message; The prompt information is sent to a preset terminal device.
4. The document generation method according to any one of claims 1 to 3, characterized in that: The step of replacing the elements in the target template according to the variables carried by the document generation instruction to obtain the replacement document comprises: For each of the variables, determining a replacement element corresponding to the name of the variable from all elements of the target template; The replacement element is replaced with the value of the variable.
5. A document generation device for implementing the document generation method according to claim 1, characterized in that: The document generating device comprises: A receiving module, used for receiving a document generation instruction; A determination module, used to determine a target template according to the template identifier carried by the document generation instruction; A replacement module, used to replace elements in the target template according to the variables carried by the document generation instruction to obtain a replacement document; A processing module is used to perform corresponding processing on the replacement document according to the preset label of the replacement document to generate a target document, wherein the processing includes display processing, hiding processing and logical judgment processing; the preset label includes a hidden label, and the corresponding processing on the replacement document according to the preset label of the replacement document to generate the target document includes: obtaining the hidden label in the replacement document; deleting the content in the hidden label, obtaining the target document, and completing the hiding processing.
6. An electronic device, characterized in that: The electronic device includes a processor and a memory, and the processor is used to execute a computer program stored in the memory to implement the document generation method as described in any one of claims 1 to 4.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one instruction, and when the at least one instruction is executed by a processor, the document generation method as described in any one of claims 1 to 4 is implemented.
