Beispiel #1
0
        /* -----------------------------------------------------------------------------------
         * Create new an EmrDocument.
         * Parameter:
         *      registryID -- The registry identifier of a patient for a visit to the hospital.
         *      permission -- The current operator has what privilege on this EmrDocument.
         * Attributes:
         *      inUse directs that the array element is in use.
         *      inNew directs that the document has not been created and is empty.
         * Return:
         *      index -- Direct to the new EmrDocument if successful.
         *      -1 -- No new EmrDocument is created.
         * ------------------------------------------------------------------------------------- */
        public int open(string registryID, PermissionLevel permission, string archiveNum)
        {
            int index = AvailableIndex();

            if (index < 0)
            {
                return(-1);
            }

            if (emrDocuments[index] == null)
            {
                emrDocuments[index] = new EmrDocument();
            }
            int errno = emrDocuments[index].Create(registryID, archiveNum);

            if (errno == 0 || errno == -3)
            {
                inUse[index]           = true;
                permissionLevel[index] = permission;
                if (errno == -3)
                {
                    permissionLevel[index] = PermissionLevel.ReadOnly;
                }
                if (emrDocuments[index].Get().DocumentElement.Attributes[AttributeNames.Series].Value == "0")
                {
                    isNew[index] = true;
                }
                else
                {
                    isNew[index] = false;
                }
                return(index);
            }
            return(errno);
        }
Beispiel #2
0
 public void Set(EmrDocument emrd)
 {
     emrDocuments[0] = emrd;
 }