Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The method for processing citizen information provided by the embodiment of the invention can be applied to the communication system shown in fig. 1. As shown in fig. 1, the communication system includes a block chain network, wherein institutions (or departments) related to citizens, such as hospitals, schools, household authorities, banks, etc., can be used as nodes of the block chain network, and can write all citizen information into a block chain, for example, a hospital node 11 can write information of mothers and mothers at birth and information of hospitals, doctors, etc., where the citizen is located into the block chain, a household authority node 12 can store household relations and household pictures of the citizens into the block chain, a school node 13 can write household information of the citizens into the block chain, and a bank node 14 can write records of the citizens' confidences and defaults into the block chain. After each citizen information is written into the block chain, a record identifier is returned, the record identifier is associated with the citizen identity identifier, and the association relationship is stored in the database 15. The embodiment of the invention can also provide a function of inquiring the citizen information, some organization nodes have the authority to check some information of the citizen, can directly acquire the citizen information from the block chain according to the record identification after inquiring the record identification from the database 15, and can inquire the record identification from the database 15 after requesting the citizen authorization and acquire the citizen information from the block chain according to the record identification when the authority does not have the checking authority.
The following describes the processing procedure of citizen information in detail with reference to specific embodiments.
Fig. 2 is a flowchart of a processing method of citizen information according to an embodiment of the present invention. The embodiment provides a processing method of citizen information, the execution main body is any mechanism node in a block chain network, and the processing method of the citizen information specifically comprises the following steps:
s101, acquiring a citizen information change record of at least one citizen.
In this embodiment, the citizen information change may specifically include, but is not limited to, a change of existing citizen information or entering new citizen information. For example, the birth of a baby, the creation of the information of the baby, including the information of the mother and the son or the mother and the mother at the birth, the information of the hospital and the doctor where the baby is in, and the like, and for example, the change of the citizenship and the like, all need to record the relevant citizen information of the citizen and obtain corresponding records.
S102, generating a block according to the citizen information change record of at least one citizen, writing the block into a block chain, and acquiring a record identifier corresponding to each citizen information change record.
In this embodiment, when the organization node generates a block, the citizen information change record of at least one citizen is packaged into the block, that is, one block may include not only one citizen information change record, but also at least one citizen information change record of the same citizen, and may also include at least one citizen information change record of a plurality of different citizens, for example, the school node records citizen student status information, and can package the citizen status information of a plurality of citizens into the same block and then distribute the citizen status information to the block chain network, thereby writing the block into the block chain. More specifically, when the blocks are packed, how many citizen information change records are contained in each block can be set according to actual needs; the time for packing the blocks may be set according to actual requirements, for example, the citizen information change records obtained on the same day may be sequentially packed (may be packed into one or more blocks) before going off duty each day and then written into the block chain, or the blocks may be packed once and written into the block chain in real time after each time the citizen information change records satisfying the packing requirement number are obtained.
After the writing of the block into the block chain is completed, a transaction id (txid) corresponding to each citizen information change record is returned, that is, a record identifier corresponding to the citizen information change record. Where txid (transaction id) may also be referred to as transaction hash, is a segment of characters required in a blockchain asset transaction to mark transfers, typically consisting of tens of digits and letters. The corresponding citizen information change record can be quickly positioned from the block chain through the record identifier corresponding to the citizen information change record.
S103, storing the corresponding relation between the record identification corresponding to each citizen information change record and the citizen identification into a database.
In this embodiment, after the record identifier corresponding to the citizen information change record is obtained, the record identifier corresponding to the citizen information change record is associated with a citizen identity identifier (such as an identity document number), and the association relationship is stored in a database, where the database may be a node in a block chain network, or certainly may not be a node in the block chain network. The corresponding relation between the record identification corresponding to each citizen information change record and the citizen identification is stored in the database, so that the record identification corresponding to any citizen information change record can be inquired according to the citizen identification, and the corresponding citizen information change record can be acquired from the block chain according to the inquired record identification.
In the method for processing citizen information provided by this embodiment, a citizen information change record of at least one citizen is obtained; generating a block according to the citizen information change record of the at least one citizen, writing the block into a block chain, and acquiring a record identifier corresponding to each citizen information change record; and storing the corresponding relation between the record identifier corresponding to each citizen information change record and the citizen identity identifier in a database. The embodiment stores the citizen information by using the block chain technology, is convenient for managing and inquiring the citizen information, can improve the efficiency of managing and inquiring the citizen information, saves a large amount of manpower and material resources, and has the advantages of decentralization and no falsification.
On the basis of the foregoing embodiment, optionally, as shown in fig. 3, the step of storing, in a database, a correspondence relationship between a record identifier corresponding to each citizen information change record and a citizen identity identifier in S103 includes:
s201, if the citizen does not obtain the citizen identity, creating a temporary citizen identity of the citizen according to the citizen identity of the citizen relative and preset information;
s202, storing the corresponding relation between the record identification corresponding to the citizen information change record and the temporary citizen identity identification of the citizen into the database.
As an application scenario, the citizen information change record is a baby information entry record, at least one baby information entry record of a baby can be obtained, and the baby information entry record can include height, weight, photos, mother information, a hospital, information of a relevant doctor and the like when the baby is born; generating a block according to the infant information entry record of the at least one infant, writing the block into a block chain, and acquiring a record identifier corresponding to each infant information entry record; if the baby does not have the citizen identity, creating a temporary citizen identity of the baby according to the citizen identity of the baby mother and preset information; and storing the corresponding relation between the record identification corresponding to the infant information entry record and the temporary citizen identity identification of the infant into the database. In this embodiment, if the baby is not named and not in the mouth of the family, it may not have a citizenship identification (e.g., identification document number), and therefore a temporary citizenship identification of the baby may be created based on the citizenship identification of the baby's mother and predetermined information, such as extending two digits after the baby's mother's identification document number, where one digit indicates that the baby is the second child of the mother (assuming that the mother nurses less than 10 children) and the other digit indicates the sex of the baby. Of course, the creation of the temporary citizenship id of the baby is not limited to the above manner, as long as the temporary citizenship id can uniquely identify the baby. Of course, the situation that the citizen does not acquire the citizen identity in this embodiment is not limited to the above scenario, and may be the case that a foreigner joins the national nationality.
Further, after the citizen obtains the citizen identity, the temporary citizen identity in the corresponding relationship between the record identity corresponding to the citizen information change record in the database and the temporary citizen identity of the citizen is replaced by the citizen identity of the citizen.
In this embodiment, after the baby starts its name and enters the home, the citizen identification of the baby can be obtained, and the temporary citizen identification in the correspondence between the recording identification corresponding to the baby information entry record in the database and the temporary citizen identification of the baby can be replaced with the citizen identification of the baby. Of course, the baby name, the record of the family name can also be written into the blockchain.
On the basis of the foregoing embodiment, optionally, as shown in fig. 4, the generating a block according to the citizen information change record of the at least one citizen in S102 includes:
s301, if the citizen information change record relates to the citizen information of at least two citizens, repeatedly writing the citizen information change record into the block according to the number of the citizens;
further, the step S103 of storing the correspondence between the record identifier corresponding to each citizen information change record and the citizen identity identifier in a database includes:
s302, storing a corresponding relation between a record identifier corresponding to each citizen information change record repeatedly written into the block and one citizen identity identifier of the at least two citizens into the database.
In the present embodiment, as for citizen information of at least two citizens related to citizen information change records of citizens such as marriage, divorce, and children, as an example, a marital information entry record of a citizen is taken as an example, and the marital information entry record may be first obtained; writing the marital information input record twice in the block to obtain a first marital information input record and a second marital information input record; writing the first marriage information entry record and the second marriage information entry record into a block chain through a block, and acquiring a record identifier corresponding to the first marriage information entry record and a record identifier corresponding to the second marriage information entry record; and storing the corresponding relation between the record identifier corresponding to the first marital information entry record and the citizen identity identifier of one of the two couples and the corresponding relation between the record identifier corresponding to the second marital information entry record and the citizen identity identifier of the other of the two couples in the database.
In the present embodiment, since both couples are involved in marriage and divorce, the marriage information entry record may be entered twice into the blockchain, once for one of the couples and once for the other of the couples, and twice for both of the couples, the citizenship identification and the marriage information of both of the couples may be recorded. The two written marital information entry records can be respectively recorded as a first marital information entry record and a second marital information entry record, correspondingly, a record identifier corresponding to the first marital information entry record and a record identifier corresponding to the second marital information entry record can be obtained after the block chain is written in, and further, the corresponding relation between the record identifier corresponding to the first marital information entry record and the citizen identity identifier of one of the two couples and the corresponding relation between the record identifier corresponding to the second marital information entry record and the citizen identity identifier of the other of the two couples can be recorded in the database. Of course, if both couples have children born, they are also related to both couples, and they can be written into the block chain according to the above-mentioned manner.
Of course, in another optional embodiment, the citizen information change record related to at least two citizens may be written into the block chain only once, the record identifier corresponding to the citizen information change record is obtained, then the record identifier corresponding to the citizen information change record is associated with each of the citizen identifiers of the at least two citizens, that is, one record identifier corresponds to at least two citizen identifiers, and the correspondence between the record identifier corresponding to the citizen information change record and each of the citizen identifiers of the at least two citizens is stored in the database.
On the basis of any of the above embodiments, as shown in fig. 5, this embodiment further provides a method for querying citizen information, which includes the following specific steps:
s401, receiving a citizen information viewing instruction, wherein the citizen information viewing instruction comprises a target citizen identity and a target citizen information category to be viewed;
s402, judging whether the target citizen information category has the authority to check the target citizen information category;
s403, if the permission for checking the target citizen information category exists, searching a record identifier of a target citizen information change record from the database according to the target citizen identity identifier and the target citizen information category;
s404, acquiring the target citizen information change record from the block chain according to the record identifier of the target citizen information change record.
In this embodiment, if a certain organization node needs to check a certain type of citizen information of a certain citizen, it may be determined whether the organization node has an authority to check the type of citizen information, and if so, directly obtain a record identifier of the target citizen information change record from the database, and then obtain the target citizen information change record from the block chain according to the record identifier. Certainly, when the corresponding relationship between the record identifier corresponding to the citizen information change record and the citizen identity identifier needs to be stored in the database, the citizen information category corresponding to each target citizen information change record is recorded, so that the citizen information can be conveniently searched and rapidly located to the target citizen information category.
Of course, if the authority for checking the information category of the target citizen does not exist, sending a checking request to the terminal equipment of the target citizen according to the identity of the target citizen, wherein the checking request comprises the mechanism node information and the information category of the target citizen to be checked; after receiving an authorization instruction returned by the terminal device of the target citizen, the steps of the cartridges S403 to S404 can be executed, that is, the record identifier of the target citizen information change record is searched from the database according to the target citizen identity identifier and the target citizen information category; and acquiring the target citizen information change record from the block chain according to the record identifier of the target citizen information change record. In this embodiment, a viewing request is sent to the terminal device of the target citizen according to the identity of the target citizen, specifically, a contact manner of the target citizen may be obtained according to the identity of the target citizen, the viewing request is further sent to the terminal device of the target citizen through the contact manner, and an authorization instruction returned by the terminal device of the target citizen is received, where the authorization instruction may include an authorization password or a key for viewing the information category of the target citizen. Of course, the authorization instruction can be used as once as possible, and the implementation can also be used.
Fig. 6 is a block diagram of a citizen information processing device according to an embodiment of the present invention. The processing apparatus for citizen information provided by this embodiment can execute the processing flow provided by the embodiment of the processing method for citizen information, as shown in fig. 6, the processing apparatus 50 for citizen information includes an obtaining module 51, an inputting module 52 and a processing module 53.
An obtaining module 51, configured to obtain a citizen information change record of at least one citizen;
the input module 52 is configured to generate a block according to the citizen information change record of the at least one citizen, write the block into a block chain, and obtain a record identifier corresponding to each citizen information change record;
and the processing module 53 is configured to store a corresponding relationship between a record identifier corresponding to each citizen information change record and the citizen identity identifier in a database.
On the basis of any of the above embodiments, when the processing module 53 stores the correspondence between the record identifier corresponding to each citizen information change record and the citizen identity identifier in the database, the processing module is configured to:
if the citizen does not acquire the citizen identity, creating a temporary citizen identity of the citizen according to the citizen identity of the citizen relative and predetermined information;
and storing the corresponding relation between the record identifier corresponding to the citizen information change record and the temporary citizen identity identifier of the citizen into the database.
On the basis of any of the above embodiments, the processing module 53 is further configured to:
and if the citizen obtains the citizen identity, replacing the temporary citizen identity in the corresponding relation between the record identity corresponding to the citizen information change record in the database and the temporary citizen identity of the citizen with the citizen identity of the citizen.
On the basis of any of the above embodiments, when the record generation block is changed according to the citizen information of the at least one citizen, the input module 52 is configured to:
if the citizen information change record relates to the citizen information of at least two citizens, repeatedly writing the citizen information change record into the block according to the number of the citizens;
when the processing module 53 stores the corresponding relationship between the record identifier corresponding to each citizen information change record and the citizen identity identifier in the database, the processing module is configured to:
and storing the corresponding relation between the record identifier corresponding to each citizen information change record repeatedly written into the block and one citizen identity identifier of the at least two citizens into the database.
On the basis of any of the above embodiments, the processing module 53 is further configured to:
receiving a citizen information viewing instruction, wherein the citizen information viewing instruction comprises a target citizen identity and a target citizen information category to be viewed;
judging whether the target citizen information category has the authority to check the target citizen information category;
if the target citizen information type has the authority to view the target citizen information type, searching a record identifier of a target citizen information change record from the database according to the target citizen identity identifier and the target citizen information type;
and acquiring the target citizen information change record from the block chain according to the record identifier of the target citizen information change record.
On the basis of any of the above embodiments, the processing module 53 is further configured to:
if the authority for checking the information category of the target citizen does not exist, sending a checking request to terminal equipment of the target citizen according to the identity of the target citizen, wherein the checking request comprises the mechanism node information and the information category of the target citizen to be checked;
after an authorization instruction returned by terminal equipment of a target citizen is received, searching a record identifier of a target citizen information change record from the database according to the target citizen identity identifier and the target citizen information category;
and acquiring the target citizen information change record from the block chain according to the record identifier of the target citizen information change record.
The citizen information processing apparatus provided in the embodiment of the present invention may be specifically configured to execute the method embodiments provided in fig. 2 to 5, and specific functions are not described herein again.
According to the processing device for the citizen information, provided by the embodiment of the invention, the citizen information change record of at least one citizen is obtained; generating a block according to the citizen information change record of the at least one citizen, writing the block into a block chain, and acquiring a record identifier corresponding to each citizen information change record; and storing the corresponding relation between the record identifier corresponding to each citizen information change record and the citizen identity identifier in a database. The embodiment stores the citizen information by using the block chain technology, is convenient for managing and inquiring the citizen information, can improve the efficiency of managing and inquiring the citizen information, saves a large amount of manpower and material resources, and has the advantages of decentralization and no falsification.
Fig. 7 is a schematic structural diagram of a citizen information processing device according to an embodiment of the present invention. As shown in fig. 7, the processing device 60 for citizen information includes a memory 61, a processor 62, a computer program, and a communication interface 63; wherein the computer program is stored in the memory 61 and is configured to execute the processing method of citizen information described in the above embodiment by the processor 62.
The citizen information processing device in the embodiment shown in fig. 7 can be used to execute the technical solution of the above method embodiment, and the implementation principle and the technical effect are similar, and are not described herein again.
In addition, the present embodiment also provides a computer-readable storage medium on which a computer program is stored, the computer program being executed by a processor to implement the method for processing citizen information described in the above embodiments.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
The integrated unit implemented in the form of a software functional unit may be stored in a computer readable storage medium. The software functional unit is stored in a storage medium and includes several instructions to enable a computer device (which may be a personal computer, a server, or a network device) or a processor (processor) to execute some steps of the methods according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
It is obvious to those skilled in the art that, for convenience and simplicity of description, the foregoing division of the functional modules is merely used as an example, and in practical applications, the above function distribution may be performed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to perform all or part of the above described functions. For the specific working process of the device described above, reference may be made to the corresponding process in the foregoing method embodiment, which is not described herein again.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.