patient_medical.set("medical_name", medical_name)
        patient_medical.set("finish", False)
        processes_list = []
        processes = Query(MedicalProcess).equal_to("parent", medical).equal_to("is_delete", False).ascending("sort").find()
        for process in processes:
            p_dic = {
                "process_id": process.id,
                "head": ""
            }
            processes_list.append(p_dic)
        patient_medical.set("processes_json", json.dumps(processes_list))
        patient_medical.save()

        if creater_id.startswith("doctor-") and creater_id != "doctor-100000":
            doctor_id = int(creater_id[7:])
            doctor_medical = DoctorMedicalRelation()
            doctor_medical.set("doctor_id", doctor_id)
            doctor_medical.set("patient_medical", patient_medical)
            doctor_medical.set("is_cancel", False)
            doctor_medical.save()

        patient_medical.set("first_create", True)
        app.logger.debug(u"创建成功,患者病历id为%s" % patient_medical.id)
        return patient_medical

class PatientMedicalApi(Resource):
    @marshal_with(PatientMedicalDetailsFields.resource_fields)
    def get(self, patient_medical_id):
        """
        根据创建的患者的病历id获取病历
        :param patient_medical_id: