ψ = x2 (x2^2 - 3*x1^2)/Sqrt[3]/a

Simplify[D[ψ, x1, x1] + D[ψ, x2, x2]]

{D[ψ, x1], D[ψ, x2]}

n1 = {1/Sqrt[3], 1}
n2 = {-1, 0}
n3 = {1/Sqrt[3], -1}
GradPsi = {D[ψ, x1], D[ψ, x2]}

Dn1 = Simplify[GradPsi . n1]
Dn2 = Simplify[GradPsi . n2]
Dn3 = Simplify[GradPsi . n3]

Ehto1 = Simplify[{x2, -x1} . n1]
Ehto2 = Simplify[{x2, -x1} . n2]
Ehto3 = Simplify[{x2, -x1} . n3]

Simplify[
      Dn1 - Ehto1 /. {x1 -> 
            a/Sqrt[3] - Sqrt[3]*x2}]
Simplify[
      Dn2 - Ehto2 /. {x1 -> -a/Sqrt[3]/
              2}]
Simplify[
      Dn3 - Ehto3 /. {x1 -> a/Sqrt[3] + Sqrt[3]*x2}]

integrand = 
      Simplify[(D[ψ, x1] - x2)^2 + (D[ψ, x2] + 
                x1)^2]
J = 
      Simplify[Integrate[
            integrand, {x2, -a/2, 0}, {x1, -a/Sqrt[3]/2, 
              Sqrt[3]*x2 + a/Sqrt[3]}] + 
          Integrate[
            integrand, {x2, 0, 
              a/2}, {x1, -a/Sqrt[3]/2, -Sqrt[3]*x2 + 
                a/Sqrt[3]}]]

ϕ = -1/4*(x1^2 + x2^2) + 1/2/Sqrt[3]/
            a*(x1^3 - 3*x1*x2^2) + a^2/36

Simplify[D[ϕ, x1, x1] + D[ϕ, x2, x2]]

Simplify[ϕ /. {x1 -> -Sqrt[3]*x2 + 
              a/Sqrt[3]}]
Simplify[ϕ /. {x1 -> -a/Sqrt[3]/
              2}]
Simplify[ϕ /. {x1 -> Sqrt[3]*x2 + a/Sqrt[3]}]

integrand = 
      4*Simplify[(D[ϕ, x1])^2 + (D[ϕ, 
                  x2])^2]
J = 
      Simplify[Integrate[
            integrand, {x2, -a/2, 0}, {x1, -a/Sqrt[3]/2, 
              Sqrt[3]*x2 + a/Sqrt[3]}] + 
          Integrate[
            integrand, {x2, 0, 
              a/2}, {x1, -a/Sqrt[3]/2, -Sqrt[3]*x2 + 
                a/Sqrt[3]}]]